From 2562a5ce3b58f3ebe2be7f8e3f0e875a1d9eafca Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Fri, 10 Mar 2017 20:39:46 +0100 Subject: [PATCH] Save/Restore TimeInfoBox clock modes The clocks are not transient, so ARDOUR_UI::store_clock_modes takes care of saving the state and the clock restores itself. --- gtk2_ardour/ardour_ui_dependents.cc | 2 +- gtk2_ardour/editor.cc | 2 +- gtk2_ardour/time_info_box.cc | 22 ++++++++++++++++------ gtk2_ardour/time_info_box.h | 2 +- 4 files changed, 19 insertions(+), 9 deletions(-) diff --git a/gtk2_ardour/ardour_ui_dependents.cc b/gtk2_ardour/ardour_ui_dependents.cc index 0c052924bd..a4603b4888 100644 --- a/gtk2_ardour/ardour_ui_dependents.cc +++ b/gtk2_ardour/ardour_ui_dependents.cc @@ -271,7 +271,7 @@ ARDOUR_UI::setup_windows () mixer->add_to_notebook (_tabs, _("Mixer")); editor->add_to_notebook (_tabs, _("Editor")); - time_info_box = new TimeInfoBox (false); + time_info_box = new TimeInfoBox ("ToolbarTimeInfo", false); /* all other dialogs are created conditionally */ we_have_dependents (); diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc index 7aaeb46678..66c1e8af86 100644 --- a/gtk2_ardour/editor.cc +++ b/gtk2_ardour/editor.cc @@ -643,7 +643,7 @@ Editor::Editor () _regions = new EditorRegions (this); _snapshots = new EditorSnapshots (this); _locations = new EditorLocations (this); - _time_info_box = new TimeInfoBox (true); + _time_info_box = new TimeInfoBox ("EditorTimeInfo", true); /* these are static location signals */ diff --git a/gtk2_ardour/time_info_box.cc b/gtk2_ardour/time_info_box.cc index ceda41e90c..fd573ad4b7 100644 --- a/gtk2_ardour/time_info_box.cc +++ b/gtk2_ardour/time_info_box.cc @@ -43,7 +43,7 @@ using namespace ARDOUR; using std::min; using std::max; -TimeInfoBox::TimeInfoBox (bool with_punch) +TimeInfoBox::TimeInfoBox (std::string state_node_name, bool with_punch) : table (3, 3) , punch_start (0) , punch_end (0) @@ -53,9 +53,15 @@ TimeInfoBox::TimeInfoBox (bool with_punch) { set_name (X_("TimeInfoBox")); - selection_start = new AudioClock ("selection-start", false, "selection", false, false, false, false); - selection_end = new AudioClock ("selection-end", false, "selection", false, false, false, false); - selection_length = new AudioClock ("selection-length", false, "selection", false, false, true, false); + selection_start = new AudioClock ( + string_compose ("%1-selection-start", state_node_name), + false, "selection", false, false, false, false); + selection_end = new AudioClock ( + string_compose ("%1-selection-end", state_node_name), + false, "selection", false, false, false, false); + selection_length = new AudioClock ( + string_compose ("%1-selection-length", state_node_name), + false, "selection", false, false, true, false); selection_title.set_text (_("Selection")); @@ -98,8 +104,12 @@ TimeInfoBox::TimeInfoBox (bool with_punch) table.attach (*selection_length, 1, 2, 3, 4); if (with_punch_clock) { - punch_start = new AudioClock ("punch-start", false, "punch", false, false, false, false); - punch_end = new AudioClock ("punch-end", false, "punch", false, false, false, false); + punch_start = new AudioClock ( + string_compose ("%1-punch-start", state_node_name), + false, "punch", false, false, false, false); + punch_end = new AudioClock ( + string_compose ("%1-punch-end", state_node_name), + false, "punch", false, false, false, false); punch_title.set_text (_("Punch")); punch_title.set_name ("TimeInfoSelectionTitle"); diff --git a/gtk2_ardour/time_info_box.h b/gtk2_ardour/time_info_box.h index 83f58e7eb5..625f5345a3 100644 --- a/gtk2_ardour/time_info_box.h +++ b/gtk2_ardour/time_info_box.h @@ -43,7 +43,7 @@ class AudioClock; class TimeInfoBox : public CairoHPacker, public ARDOUR::SessionHandlePtr { public: - TimeInfoBox (bool with_punch); + TimeInfoBox (std::string state_node_name, bool with_punch); ~TimeInfoBox (); void set_session (ARDOUR::Session*); -- 2.30.2