comparison libinterp/corefcn/graphics.cc @ 18761:868dcab453bd

Distinguish axes when checking for recursion in axes limits updates (bug #40005). * graphics.cc: change static variables "updating_aspectratios" and "updating_axis_limits" type to std::set<double> in order to store all currently updating axes. * graphics.cc (axes::properties::update_aspectratios, axes::update_axis_limits): update to use the new types and be able to distinguish what axes is being updated.
author Pantxo Diribarne <pantxo.diribarne@gmail.com>
date Sun, 04 May 2014 21:56:23 +0200
parents d57a83f2d73e
children 9fbb254c09e6
comparison
equal deleted inserted replaced
18760:5baada25d5a2 18761:868dcab453bd
5670 } 5670 }
5671 else 5671 else
5672 s = xmax(s, (limits(1) - limits(0)) / (pbfactor * dafactor)); 5672 s = xmax(s, (limits(1) - limits(0)) / (pbfactor * dafactor));
5673 } 5673 }
5674 5674
5675 static bool updating_aspectratios = false; 5675 static std::set<double> updating_aspectratios;
5676 5676
5677 void 5677 void
5678 axes::properties::update_aspectratios (void) 5678 axes::properties::update_aspectratios (void)
5679 { 5679 {
5680 if (updating_aspectratios) 5680 if (updating_aspectratios.find (get___myhandle__ ().value ()) !=
5681 updating_aspectratios.end ())
5681 return; 5682 return;
5682 5683
5683 Matrix xlimits = get_xlim ().matrix_value (); 5684 Matrix xlimits = get_xlim ().matrix_value ();
5684 Matrix ylimits = get_ylim ().matrix_value (); 5685 Matrix ylimits = get_ylim ().matrix_value ();
5685 Matrix zlimits = get_zlim ().matrix_value (); 5686 Matrix zlimits = get_zlim ().matrix_value ();
5741 { 5742 {
5742 5743
5743 unwind_protect frame; 5744 unwind_protect frame;
5744 frame.protect_var (updating_aspectratios); 5745 frame.protect_var (updating_aspectratios);
5745 5746
5746 updating_aspectratios = true; 5747 updating_aspectratios.insert (get___myhandle__ ().value ());
5747 5748
5748 dx = pba(0) *da(0); 5749 dx = pba(0) *da(0);
5749 dy = pba(1) *da(1); 5750 dy = pba(1) *da(1);
5750 dz = pba(2) *da(2); 5751 dz = pba(2) *da(2);
5751 if (xisinf (s)) 5752 if (xisinf (s))
6689 default: 6690 default:
6690 break; 6691 break;
6691 } 6692 }
6692 } 6693 }
6693 6694
6694 static bool updating_axis_limits = false; 6695 static std::set<double> updating_axis_limits;
6695 6696
6696 void 6697 void
6697 axes::update_axis_limits (const std::string& axis_type, 6698 axes::update_axis_limits (const std::string& axis_type,
6698 const graphics_handle& h) 6699 const graphics_handle& h)
6699 { 6700 {
6700 if (updating_axis_limits) 6701 if (updating_axis_limits.find (get_handle ().value ()) !=
6702 updating_axis_limits.end ())
6701 return; 6703 return;
6702 6704
6703 Matrix kids = Matrix (1, 1, h.value ()); 6705 Matrix kids = Matrix (1, 1, h.value ());
6704 6706
6705 double min_val = octave_Inf; 6707 double min_val = octave_Inf;
6854 #undef FIX_LIMITS 6856 #undef FIX_LIMITS
6855 6857
6856 unwind_protect frame; 6858 unwind_protect frame;
6857 frame.protect_var (updating_axis_limits); 6859 frame.protect_var (updating_axis_limits);
6858 6860
6859 updating_axis_limits = true; 6861 updating_axis_limits.insert (get_handle ().value ());
6860 6862
6861 switch (update_type) 6863 switch (update_type)
6862 { 6864 {
6863 case 'x': 6865 case 'x':
6864 xproperties.set_xlim (limits); 6866 xproperties.set_xlim (limits);
6897 } 6899 }
6898 6900
6899 void 6901 void
6900 axes::update_axis_limits (const std::string& axis_type) 6902 axes::update_axis_limits (const std::string& axis_type)
6901 { 6903 {
6902 if (updating_axis_limits || updating_aspectratios) 6904 if ((updating_axis_limits.find (get_handle ().value ()) !=
6905 updating_axis_limits.end ()) ||
6906 (updating_aspectratios.find (get_handle ().value ()) !=
6907 updating_aspectratios.end ()))
6903 return; 6908 return;
6904 6909
6905 Matrix kids = xproperties.get_children (); 6910 Matrix kids = xproperties.get_children ();
6906 6911
6907 double min_val = octave_Inf; 6912 double min_val = octave_Inf;
7013 } 7018 }
7014 7019
7015 unwind_protect frame; 7020 unwind_protect frame;
7016 frame.protect_var (updating_axis_limits); 7021 frame.protect_var (updating_axis_limits);
7017 7022
7018 updating_axis_limits = true; 7023 updating_axis_limits.insert (get_handle ().value ());
7019 7024
7020 switch (update_type) 7025 switch (update_type)
7021 { 7026 {
7022 case 'x': 7027 case 'x':
7023 xproperties.set_xlim (limits); 7028 xproperties.set_xlim (limits);