Mercurial > hg > octave-max
changeset 10008:b6261d776a82
handle window title correctly in fltk_backend
author | Shai Ayal <shaiay@users.sourceforge.net> |
---|---|
date | Sun, 20 Dec 2009 23:02:08 +0200 |
parents | 12dd0a7597ff |
children | 360de61b2722 |
files | src/ChangeLog src/DLD-FUNCTIONS/fltk_backend.cc |
diffstat | 2 files changed, 50 insertions(+), 5 deletions(-) [+] |
line wrap: on
line diff
--- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-12-20 Shai Ayal <shaiay@users.sourceforge.net> + + * DLD-FUNCTIONS/fltk_backend.cc (plot_sindow::set_name): New method. + (figure_manager::set_name, figure_manage::do_set_name): New methods. + (fltk_backend::property_changed): Handle change of figure title string. + 2009-12-19 Rik <octave@nomad.inbox5.com> * Makefile.am: Eliminate TOPDIR variable in favor of built-in automake
--- a/src/DLD-FUNCTIONS/fltk_backend.cc +++ b/src/DLD-FUNCTIONS/fltk_backend.cc @@ -283,13 +283,10 @@ autoscale->show (); togglegrid->show (); + set_name (); resizable (canvas); size_range (4*status_h, 2*status_h); - std::stringstream name; - name << "octave: figure " << number (); - window_label = name.str (); - label (window_label.c_str ()); } ~plot_window (void) @@ -320,6 +317,23 @@ canvas->damage (FL_DAMAGE_ALL); } + void set_name (void) + { + std::stringstream name; + std::string sep; + + if (fp.is_numbertitle ()) + { + name << "Figure " << number (); + sep = ": "; + } + if (fp.get_name ().size ()) + name << sep << fp.get_name (); + + window_label = name.str (); + label (window_label.c_str ()); + } + private: // window name -- this must exists for the duration of the window's // life @@ -708,6 +722,17 @@ mark_modified (hnd2idx (gh)); } + static void set_name (int idx) + { + if (instance_ok ()) + instance->do_set_name (idx); + } + + static void set_name (std::string idx_str) + { + set_name (str2idx (idx_str)); + } + static Matrix get_size (int idx) { return instance_ok () ? instance->do_get_size (idx) : Matrix (); @@ -797,6 +822,15 @@ } } + void do_set_name (int idx) + { + wm_iterator win; + if ((win = windows.find (idx)) != windows.end ()) + { + win->second->set_name (); + } + } + Matrix do_get_size (int idx) { Matrix sz (1, 2, 0.0); @@ -953,8 +987,13 @@ switch (id) { case base_properties::VISIBLE: - figure_manager::toggle_window_visibility (ov.string_value(), fp.is_visible ()); + figure_manager::toggle_window_visibility (ov.string_value (), fp.is_visible ()); break; + + case figure::properties::NAME: + case figure::properties::NUMBERTITLE: + figure_manager::set_name (ov.string_value ()); + break; } } }