From 4341d675dcedb976bb7cfb25fba7ff7d69f2f161 Mon Sep 17 00:00:00 2001 From: Robin Gareus Date: Tue, 21 May 2013 21:23:10 +0200 Subject: [PATCH] remember plugin-UI type (custom/basic) with session. amend to 3.1-81-g1acf8bd --- gtk2_ardour/processor_box.cc | 32 ++++++++++++++++++++++++++++++++ gtk2_ardour/processor_box.h | 3 +++ gtk2_ardour/window_manager.cc | 8 +++++++- 3 files changed, 42 insertions(+), 1 deletion(-) diff --git a/gtk2_ardour/processor_box.cc b/gtk2_ardour/processor_box.cc index 9ac57a356c..2f8513fd2a 100644 --- a/gtk2_ardour/processor_box.cc +++ b/gtk2_ardour/processor_box.cc @@ -2642,6 +2642,38 @@ ProcessorWindowProxy::session_handle() return 0; } +XMLNode& +ProcessorWindowProxy::get_state () const +{ + XMLNode *node; + node = &ProxyBase::get_state(); + node->add_property (X_("custom-ui"), is_custom? X_("yes") : X_("no")); + return *node; +} + +void +ProcessorWindowProxy::set_state (const XMLNode& node) +{ + XMLNodeList children = node.children (); + XMLNodeList::const_iterator i = children.begin (); + while (i != children.end()) { + XMLProperty* prop = (*i)->property (X_("name")); + if ((*i)->name() == X_("Window") && prop && prop->value() == _name) { + break; + } + ++i; + } + + if (i != children.end()) { + XMLProperty* prop; + if ((prop = (*i)->property (X_("custom-ui"))) != 0) { + want_custom = PBD::string_is_affirmative (prop->value ()); + } + } + + ProxyBase::set_state(node); +} + Gtk::Window* ProcessorWindowProxy::get (bool create) { diff --git a/gtk2_ardour/processor_box.h b/gtk2_ardour/processor_box.h index 7d80abdc68..d4d1456e09 100644 --- a/gtk2_ardour/processor_box.h +++ b/gtk2_ardour/processor_box.h @@ -92,6 +92,9 @@ class ProcessorWindowProxy : public WM::ProxyBase bool marked; + void set_state (const XMLNode&); + XMLNode& get_state () const; + private: ProcessorBox* _processor_box; boost::weak_ptr _processor; diff --git a/gtk2_ardour/window_manager.cc b/gtk2_ardour/window_manager.cc index 4a3d5f6ce4..986e6ade3a 100644 --- a/gtk2_ardour/window_manager.cc +++ b/gtk2_ardour/window_manager.cc @@ -28,6 +28,7 @@ #include "ardour_dialog.h" #include "ardour_window.h" #include "window_manager.h" +#include "processor_box.h" #include "i18n.h" @@ -106,7 +107,12 @@ Manager::add_state (XMLNode& root) const if (dynamic_cast (*i)) { continue; } - root.add_child_nocopy ((*i)->get_state()); + if (dynamic_cast (*i)) { + ProcessorWindowProxy *pi = dynamic_cast (*i); + root.add_child_nocopy (pi->get_state()); + } else { + root.add_child_nocopy ((*i)->get_state()); + } } } -- 2.30.2