From f9d0879e868cfab2e8ebd25803bdfa14a3f70426 Mon Sep 17 00:00:00 2001 From: Carl Hetherington Date: Wed, 18 Aug 2010 03:17:07 +0000 Subject: [PATCH] Plugin UI state should of course be saved per-session rather than globally. git-svn-id: svn://localhost/ardour2/branches/3.0@7646 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/ardour_ui.cc | 10 ++++++++++ gtk2_ardour/ardour_ui_ed.cc | 4 +++- gtk2_ardour/processor_box.cc | 2 +- gtk2_ardour/processor_box.h | 3 +++ gtk2_ardour/window_proxy.cc | 4 ++++ gtk2_ardour/window_proxy.h | 10 ++++++++++ 6 files changed, 31 insertions(+), 2 deletions(-) diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc index 837dfd9ba2..2cf6c8aaae 100644 --- a/gtk2_ardour/ardour_ui.cc +++ b/gtk2_ardour/ardour_ui.cc @@ -2100,6 +2100,16 @@ ARDOUR_UI::snapshot_session (bool switch_to_it) void ARDOUR_UI::save_state (const string & name, bool switch_to_it) { + XMLNode* node = new XMLNode (X_("UI")); + + for (list::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) { + if (!(*i)->rc_configured()) { + node->add_child_nocopy (*((*i)->get_state ())); + } + } + + _session->add_extra_xml (*node); + save_state_canfail (name, switch_to_it); } diff --git a/gtk2_ardour/ardour_ui_ed.cc b/gtk2_ardour/ardour_ui_ed.cc index 091d846c1b..be82a74403 100644 --- a/gtk2_ardour/ardour_ui_ed.cc +++ b/gtk2_ardour/ardour_ui_ed.cc @@ -676,7 +676,9 @@ ARDOUR_UI::save_ardour_state () XMLNode* window_node = new XMLNode (X_("UI")); for (list::iterator i = _window_proxies.begin(); i != _window_proxies.end(); ++i) { - window_node->add_child_nocopy (*((*i)->get_state ())); + if ((*i)->rc_configured()) { + window_node->add_child_nocopy (*((*i)->get_state ())); + } } /* tearoffs */ diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 8840c773f9..69f66b25c2 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -996,7 +996,7 @@ ProcessorBox::maybe_add_processor_to_ui_list (boost::weak_ptr w) ProcessorWindowProxy* wp = new ProcessorWindowProxy ( string_compose ("%1-%2-%3", loc, _route->id(), p->id()), - Config->extra_xml (X_("UI")), + _session->extra_xml (X_("UI")), this, w); diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 9273a75052..80b0cd818a 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -83,6 +83,9 @@ public: ProcessorWindowProxy (std::string const &, XMLNode const *, ProcessorBox *, boost::weak_ptr); void show (); + bool rc_configured () const { + return false; + } boost::weak_ptr processor () const { return _processor; diff --git a/gtk2_ardour/window_proxy.cc b/gtk2_ardour/window_proxy.cc index 28a90215af..b6f7508ad2 100755 --- a/gtk2_ardour/window_proxy.cc +++ b/gtk2_ardour/window_proxy.cc @@ -35,6 +35,10 @@ WindowProxyBase::WindowProxyBase (string const & name, XMLNode const * node) , _width (-1) , _height (-1) { + if (!node) { + return; + } + XMLNodeList children = node->children (); XMLNodeList::const_iterator i = children.begin (); diff --git a/gtk2_ardour/window_proxy.h b/gtk2_ardour/window_proxy.h index e2b015c27b..ac102baa4d 100755 --- a/gtk2_ardour/window_proxy.h +++ b/gtk2_ardour/window_proxy.h @@ -51,6 +51,12 @@ public: /** Show this window */ virtual void show () = 0; + /** @return true if the configuration for this window should be + * global (ie across all sessions), otherwise false if it should + * be session-specific. + */ + virtual bool rc_configured () const = 0; + virtual Gtk::Window* get_gtk_window () const = 0; private: @@ -124,6 +130,10 @@ public: } } + bool rc_configured () const { + return true; + } + private: std::string _action; };