# HG changeset patch # User Shai Ayal # Date 1261342928 -7200 # Node ID b6261d776a8257b7ee560684f6852a14b0edfba4 # Parent 12dd0a7597ff9615c515ac9a9f43cc07b1d27d14 handle window title correctly in fltk_backend diff --git a/src/ChangeLog b/src/ChangeLog --- a/src/ChangeLog +++ b/src/ChangeLog @@ -1,3 +1,9 @@ +2009-12-20 Shai Ayal + + * 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 * Makefile.am: Eliminate TOPDIR variable in favor of built-in automake diff --git a/src/DLD-FUNCTIONS/fltk_backend.cc b/src/DLD-FUNCTIONS/fltk_backend.cc --- 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; } } }