summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorTim Mayberry <mojofunk@gmail.com>2007-06-17 00:47:40 +0000
committerTim Mayberry <mojofunk@gmail.com>2007-06-17 00:47:40 +0000
commit36291eb399316b01bf7d23137eb9b9a3bad6998d (patch)
treedd48e3de88534110fb304978da6ea6e82fba3748
parent4b95621853072c44b1df698df8a96d7d9167319f (diff)
Make Stateful::*instant_xml methods protected and non-virtual
Add add_instant_xml and instant_xml methods to the Session class which call the corresponding Stateful methods with the session directory for the directory argument Add add_instant_xml and instant_xml methods to the Configuration class which call the Stateful methods with ARDOUR::get_user_ardour_path() for the directory argument git-svn-id: svn://localhost/ardour2/trunk@2012 d708f5d6-7413-0410-9779-e7cbd77b26cf
-rw-r--r--gtk2_ardour/ardour_ui.cc20
-rw-r--r--gtk2_ardour/editor.cc4
-rw-r--r--gtk2_ardour/export_dialog.cc4
-rw-r--r--libs/ardour/ardour/configuration.h5
-rw-r--r--libs/ardour/ardour/session.h6
-rw-r--r--libs/ardour/configuration.cc13
-rw-r--r--libs/ardour/session_state.cc11
-rw-r--r--libs/pbd/pbd/stateful.h6
8 files changed, 48 insertions, 21 deletions
diff --git a/gtk2_ardour/ardour_ui.cc b/gtk2_ardour/ardour_ui.cc
index 46fa5838b9..10f6a2fe7a 100644
--- a/gtk2_ardour/ardour_ui.cc
+++ b/gtk2_ardour/ardour_ui.cc
@@ -428,11 +428,11 @@ ARDOUR_UI::save_ardour_state ()
XMLNode mnode(mixer->get_state());
if (session) {
- session->add_instant_xml (enode, session->path());
- session->add_instant_xml (mnode, session->path());
+ session->add_instant_xml (enode);
+ session->add_instant_xml (mnode);
} else {
- Config->add_instant_xml (enode, get_user_ardour_path());
- Config->add_instant_xml (mnode, get_user_ardour_path());
+ Config->add_instant_xml (enode);
+ Config->add_instant_xml (mnode);
}
save_keybindings ();
@@ -481,7 +481,7 @@ void
ARDOUR_UI::no_memory_warning ()
{
XMLNode node (X_("no-memory-warning"));
- Config->add_instant_xml (node, get_user_ardour_path());
+ Config->add_instant_xml (node);
}
void
@@ -492,7 +492,7 @@ ARDOUR_UI::check_memory_locking ()
return;
#else // !__APPLE__
- XMLNode* memory_warning_node = Config->instant_xml (X_("no-memory-warning"), get_user_ardour_path());
+ XMLNode* memory_warning_node = Config->instant_xml (X_("no-memory-warning"));
if (engine->is_realtime() && memory_warning_node == 0) {
@@ -2446,9 +2446,9 @@ ARDOUR_UI::mixer_settings () const
XMLNode* node = 0;
if (session) {
- node = session->instant_xml(X_("Mixer"), session->path());
+ node = session->instant_xml(X_("Mixer"));
} else {
- node = Config->instant_xml(X_("Mixer"), get_user_ardour_path());
+ node = Config->instant_xml(X_("Mixer"));
}
if (!node) {
@@ -2464,9 +2464,9 @@ ARDOUR_UI::editor_settings () const
XMLNode* node = 0;
if (session) {
- node = session->instant_xml(X_("Editor"), session->path());
+ node = session->instant_xml(X_("Editor"));
} else {
- node = Config->instant_xml(X_("Editor"), get_user_ardour_path());
+ node = Config->instant_xml(X_("Editor"));
}
if (!node) {
diff --git a/gtk2_ardour/editor.cc b/gtk2_ardour/editor.cc
index ffda84e2f6..61250c1289 100644
--- a/gtk2_ardour/editor.cc
+++ b/gtk2_ardour/editor.cc
@@ -845,9 +845,9 @@ Editor::instant_save ()
}
if (session) {
- session->add_instant_xml(get_state(), session->path());
+ session->add_instant_xml(get_state());
} else {
- Config->add_instant_xml(get_state(), get_user_ardour_path());
+ Config->add_instant_xml(get_state());
}
}
diff --git a/gtk2_ardour/export_dialog.cc b/gtk2_ardour/export_dialog.cc
index 3a66099b6c..2d73887d3a 100644
--- a/gtk2_ardour/export_dialog.cc
+++ b/gtk2_ardour/export_dialog.cc
@@ -431,7 +431,7 @@ ExportDialog::connect_to_session (Session *s)
void
ExportDialog::set_state()
{
- XMLNode* node = session->instant_xml(X_("ExportDialog"), session->path());
+ XMLNode* node = session->instant_xml(X_("ExportDialog"));
XMLProperty* prop;
if (node) {
@@ -582,7 +582,7 @@ ExportDialog::save_state()
}
node->add_child_nocopy(*tracks);
- session->add_instant_xml(*node, session->path());
+ session->add_instant_xml(*node);
}
void
diff --git a/libs/ardour/ardour/configuration.h b/libs/ardour/ardour/configuration.h
index c63af0a4cf..91a1d04714 100644
--- a/libs/ardour/ardour/configuration.h
+++ b/libs/ardour/ardour/configuration.h
@@ -61,6 +61,11 @@ class Configuration : public PBD::Stateful
int load_state ();
int save_state ();
+ /// calls Stateful::*instant_xml methods using
+ /// ARDOUR::get_user_ardour_path for the directory
+ void add_instant_xml (XMLNode&);
+ XMLNode * instant_xml (const std::string& str);
+
int set_state (const XMLNode&);
XMLNode& get_state (void);
XMLNode& get_variables (sigc::slot<bool,ConfigVariableBase::Owner>, std::string which_node = "Config");
diff --git a/libs/ardour/ardour/session.h b/libs/ardour/ardour/session.h
index 16ee76a06b..136822ad48 100644
--- a/libs/ardour/ardour/session.h
+++ b/libs/ardour/ardour/session.h
@@ -440,8 +440,10 @@ class Session : public PBD::StatefulDestructible
XMLNode& get_state();
int set_state(const XMLNode& node); // not idempotent
XMLNode& get_template();
-
- void add_instant_xml (XMLNode&, const std::string& dir);
+
+ /// The instant xml file is written to the session directory
+ void add_instant_xml (XMLNode&);
+ XMLNode * instant_xml (const std::string& str);
enum StateOfTheState {
Clean = 0x0,
diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc
index 9baa525cb7..062f30b700 100644
--- a/libs/ardour/configuration.cc
+++ b/libs/ardour/configuration.cc
@@ -156,6 +156,19 @@ Configuration::save_state()
return 0;
}
+void
+Configuration::add_instant_xml(XMLNode& node)
+{
+ Stateful::add_instant_xml (node, get_user_ardour_path());
+}
+
+XMLNode*
+Configuration::instant_xml(const string& node_name)
+{
+ return Stateful::instant_xml (node_name, get_user_ardour_path());
+}
+
+
bool
Configuration::save_config_options_predicate (ConfigVariableBase::Owner owner)
{
diff --git a/libs/ardour/session_state.cc b/libs/ardour/session_state.cc
index 0dd4b0b684..ea53a696d1 100644
--- a/libs/ardour/session_state.cc
+++ b/libs/ardour/session_state.cc
@@ -2740,12 +2740,17 @@ Session::controllable_by_id (const PBD::ID& id)
}
void
-Session::add_instant_xml (XMLNode& node, const std::string& dir)
+Session::add_instant_xml (XMLNode& node)
{
- Stateful::add_instant_xml (node, dir);
- Config->add_instant_xml (node, get_user_ardour_path());
+ Stateful::add_instant_xml (node, _path);
+ Config->add_instant_xml (node);
}
+XMLNode*
+Session::instant_xml (const string& node_name)
+{
+ return Stateful::instant_xml (node_name, _path);
+}
int
Session::save_history (string snapshot_name)
diff --git a/libs/pbd/pbd/stateful.h b/libs/pbd/pbd/stateful.h
index fed078c802..6866450cd2 100644
--- a/libs/pbd/pbd/stateful.h
+++ b/libs/pbd/pbd/stateful.h
@@ -41,11 +41,13 @@ class Stateful {
void add_extra_xml (XMLNode&);
XMLNode *extra_xml (const std::string& str);
- virtual void add_instant_xml (XMLNode&, const std::string& dir);
- XMLNode *instant_xml (const std::string& str, const std::string& dir);
const PBD::ID& id() const { return _id; }
protected:
+
+ void add_instant_xml (XMLNode&, const std::string& dir);
+ XMLNode *instant_xml (const std::string& str, const std::string& dir);
+
XMLNode *_extra_xml;
XMLNode *_instant_xml;
PBD::ID _id;