From d23fec7b9a0f076256dbd71faae254a78efbe37a Mon Sep 17 00:00:00 2001 From: Taybin Rutkin Date: Thu, 27 Jul 2006 03:30:03 +0000 Subject: sfdb paths are saved and restored. git-svn-id: svn://localhost/ardour2/trunk@700 d708f5d6-7413-0410-9779-e7cbd77b26cf --- gtk2_ardour/sfdb_ui.cc | 10 ++++++++++ gtk2_ardour/sfdb_ui.h | 1 + libs/ardour/ardour/audio_library.h | 2 ++ libs/ardour/audio_library.cc | 12 ++++-------- libs/ardour/configuration.cc | 4 ++++ libs/ardour/globals.cc | 6 +++--- 6 files changed, 24 insertions(+), 11 deletions(-) diff --git a/gtk2_ardour/sfdb_ui.cc b/gtk2_ardour/sfdb_ui.cc index 79546880de..5cca008dc0 100644 --- a/gtk2_ardour/sfdb_ui.cc +++ b/gtk2_ardour/sfdb_ui.cc @@ -97,6 +97,9 @@ SoundFileBox::SoundFileBox () (mem_fun (*this, &SoundFileBox::add_field_clicked)); remove_field_btn.signal_clicked().connect (mem_fun (*this, &SoundFileBox::remove_field_clicked)); + + Gtk::CellRendererText* cell(static_cast(field_view.get_column_cell_renderer(1))); + cell->signal_edited().connect (mem_fun (*this, &SoundFileBox::field_edited)); field_view.get_selection()->signal_changed().connect (mem_fun (*this, &SoundFileBox::field_selected)); Library->fields_changed.connect (mem_fun (*this, &SoundFileBox::setup_fields)); @@ -259,6 +262,13 @@ SoundFileBox::remove_field_clicked () Library->save_changes (); } +void +SoundFileBox::field_edited (const Glib::ustring& str1, const Glib::ustring& str2) +{ + cout << "field_edited" << endl; + Library->save_changes (); +} + void SoundFileBox::delete_row (const Gtk::TreeModel::iterator& iter) { diff --git a/gtk2_ardour/sfdb_ui.h b/gtk2_ardour/sfdb_ui.h index 79c73b97ac..8ef57d7b9f 100644 --- a/gtk2_ardour/sfdb_ui.h +++ b/gtk2_ardour/sfdb_ui.h @@ -100,6 +100,7 @@ class SoundFileBox : public Gtk::VBox void stop_btn_clicked (); void add_field_clicked (); void remove_field_clicked (); + void field_edited (const Glib::ustring&, const Glib::ustring&); void delete_row (const Gtk::TreeModel::iterator& iter); void field_selected (); diff --git a/libs/ardour/ardour/audio_library.h b/libs/ardour/ardour/audio_library.h index 3d4585fbd8..f5ac6da654 100644 --- a/libs/ardour/ardour/audio_library.h +++ b/libs/ardour/ardour/audio_library.h @@ -42,6 +42,8 @@ class AudioLibrary : public Stateful AudioLibrary (); ~AudioLibrary (); + static string state_node_name; + XMLNode& get_state (void); int set_state (const XMLNode&); diff --git a/libs/ardour/audio_library.cc b/libs/ardour/audio_library.cc index 1358ebd6d9..ad008f6312 100644 --- a/libs/ardour/audio_library.cc +++ b/libs/ardour/audio_library.cc @@ -46,6 +46,8 @@ using namespace PBD; static char* SOUNDFILE = "http://ardour.org/ontology/Soundfile"; +string AudioLibrary::state_node_name = "AudioLibrary"; + AudioLibrary::AudioLibrary () { // sfdb_paths.push_back("/Users/taybin/sounds"); @@ -74,12 +76,6 @@ AudioLibrary::AudioLibrary () } lrdf_free_statements(matches); - - XMLNode* state = instant_xml(X_("AudioLibrary"), get_user_ardour_path()); - if (state) { - set_state(*state); - } - scan_paths(); } AudioLibrary::~AudioLibrary () @@ -361,7 +357,7 @@ AudioLibrary::set_paths (vector paths) { sfdb_paths = paths; - add_instant_xml(get_state(), get_user_ardour_path()); + scan_paths (); } vector @@ -478,7 +474,7 @@ AudioLibrary::set_state (const XMLNode& node) } } - sfdb_paths = paths; + set_paths (paths); return 0; } diff --git a/libs/ardour/configuration.cc b/libs/ardour/configuration.cc index fc708f805d..58da77f933 100644 --- a/libs/ardour/configuration.cc +++ b/libs/ardour/configuration.cc @@ -25,6 +25,7 @@ #include #include +#include #include #include #include @@ -178,6 +179,7 @@ Configuration::state (bool user_only) } root->add_child_nocopy (ControlProtocolManager::instance().get_state()); + root->add_child_nocopy (Library->get_state()); return *root; } @@ -229,6 +231,8 @@ Configuration::set_state (const XMLNode& root) } else if (node->name() == ControlProtocolManager::state_node_name) { _control_protocol_state = new XMLNode (*node); + } else if (node->name() == AudioLibrary::state_node_name) { + Library->set_state (*node); } } diff --git a/libs/ardour/globals.cc b/libs/ardour/globals.cc index ffcc4ddb05..308f502d2a 100644 --- a/libs/ardour/globals.cc +++ b/libs/ardour/globals.cc @@ -198,6 +198,9 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) PBD::ID::init (); + lrdf_init(); + Library = new AudioLibrary; + Config = new Configuration; if (Config->load_state ()) { @@ -296,9 +299,6 @@ ARDOUR::init (AudioEngine& engine, bool use_vst, bool try_optimization) info << "No H/W specific optimizations in use" << endmsg; } - lrdf_init(); - Library = new AudioLibrary; - /* singleton - first object is "it" */ new PluginManager (engine); -- cgit v1.2.3