diff options
author | David Robillard <d@drobilla.net> | 2007-04-06 02:20:48 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2007-04-06 02:20:48 +0000 |
commit | 1019f1b943ae17bb116bbd2223fcbd0532657055 (patch) | |
tree | 5989fd5989d46f7f0b3a653a0b8fd934727a2d49 /src/Patchage.cpp | |
parent | 9f7241e83ba62f51852430398f4badfe68320e0f (diff) | |
download | patchage-1019f1b943ae17bb116bbd2223fcbd0532657055.tar.gz patchage-1019f1b943ae17bb116bbd2223fcbd0532657055.tar.bz2 patchage-1019f1b943ae17bb116bbd2223fcbd0532657055.zip |
LASH project saving/restoring.
git-svn-id: http://svn.drobilla.net/lad/patchage@400 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/Patchage.cpp')
-rw-r--r-- | src/Patchage.cpp | 57 |
1 files changed, 38 insertions, 19 deletions
diff --git a/src/Patchage.cpp b/src/Patchage.cpp index 4e48bb0..84d9024 100644 --- a/src/Patchage.cpp +++ b/src/Patchage.cpp @@ -129,14 +129,13 @@ Patchage::Patchage(int argc, char** argv) xml->get_widget_derived("jack_settings_win", _jack_settings_dialog); xml->get_widget("about_win", _about_window); xml->get_widget("jack_settings_menuitem", _menu_jack_settings); - xml->get_widget("launch_jack_menuitem", _menu_jack_launch); xml->get_widget("connect_to_jack_menuitem", _menu_jack_connect); xml->get_widget("disconnect_from_jack_menuitem", _menu_jack_disconnect); #ifdef HAVE_LASH xml->get_widget("open_session_menuitem", _menu_open_session); xml->get_widget("save_session_menuitem", _menu_save_session); xml->get_widget("save_session_as_menuitem", _menu_save_session_as); - xml->get_widget("launch_lash_menuitem", _menu_lash_launch); + xml->get_widget("close_session_menuitem", _menu_close_session); xml->get_widget("connect_to_lash_menuitem", _menu_lash_connect); xml->get_widget("disconnect_from_lash_menuitem", _menu_lash_disconnect); #endif @@ -201,11 +200,8 @@ Patchage::Patchage(int argc, char** argv) _menu_jack_settings->signal_activate().connect( sigc::hide_return(sigc::mem_fun(_jack_settings_dialog, &JackSettingsDialog::run))); - _menu_jack_launch->signal_activate().connect(sigc::bind( - sigc::mem_fun(_jack_driver, &JackDriver::attach), true)); - _menu_jack_connect->signal_activate().connect(sigc::bind( - sigc::mem_fun(_jack_driver, &JackDriver::attach), false)); + sigc::mem_fun(_jack_driver, &JackDriver::attach), true)); _menu_jack_disconnect->signal_activate().connect(sigc::mem_fun(_jack_driver, &JackDriver::detach)); @@ -213,7 +209,7 @@ Patchage::Patchage(int argc, char** argv) _menu_open_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_open_session)); _menu_save_session->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_save_session)); _menu_save_session_as->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_save_session_as)); - _menu_lash_launch->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_launch)); + _menu_close_session->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_close_session)); _menu_lash_connect->signal_activate().connect( sigc::mem_fun(this, &Patchage::menu_lash_connect)); _menu_lash_disconnect->signal_activate().connect(sigc::mem_fun(this, &Patchage::menu_lash_disconnect)); #endif @@ -474,15 +470,11 @@ Patchage::connect_widgets() { #ifdef HAVE_LASH _lash_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(_menu_lash_launch, &Gtk::MenuItem::set_sensitive), false)); - _lash_driver->signal_attached.connect(sigc::bind( sigc::mem_fun(_menu_lash_connect, &Gtk::MenuItem::set_sensitive), false)); _lash_driver->signal_attached.connect(sigc::bind( sigc::mem_fun(_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), true)); _lash_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(_menu_lash_launch, &Gtk::MenuItem::set_sensitive), true)); - _lash_driver->signal_detached.connect(sigc::bind( sigc::mem_fun(_menu_lash_connect, &Gtk::MenuItem::set_sensitive), true)); _lash_driver->signal_detached.connect(sigc::bind( sigc::mem_fun(_menu_lash_disconnect, &Gtk::MenuItem::set_sensitive), false)); @@ -495,8 +487,6 @@ Patchage::connect_widgets() sigc::mem_fun(_jack_connect_toggle, &Gtk::ToggleButton::set_active), true)); _jack_driver->signal_attached.connect(sigc::bind( - sigc::mem_fun(_menu_jack_launch, &Gtk::MenuItem::set_sensitive), false)); - _jack_driver->signal_attached.connect(sigc::bind( sigc::mem_fun(_menu_jack_connect, &Gtk::MenuItem::set_sensitive), false)); _jack_driver->signal_attached.connect(sigc::bind( sigc::mem_fun(_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), true)); @@ -504,8 +494,6 @@ Patchage::connect_widgets() _jack_driver->signal_detached.connect(sigc::bind( sigc::mem_fun(_jack_connect_toggle, &Gtk::ToggleButton::set_active), false)); _jack_driver->signal_detached.connect(sigc::bind( - sigc::mem_fun(_menu_jack_launch, &Gtk::MenuItem::set_sensitive), true)); - _jack_driver->signal_detached.connect(sigc::bind( sigc::mem_fun(_menu_jack_connect, &Gtk::MenuItem::set_sensitive), true)); _jack_driver->signal_detached.connect(sigc::bind( sigc::mem_fun(_menu_jack_disconnect, &Gtk::MenuItem::set_sensitive), false)); @@ -528,29 +516,61 @@ Patchage::connect_widgets() void Patchage::menu_open_session() { + Gtk::FileChooserDialog dialog(*_main_window, "Open LASH Session", + Gtk::FILE_CHOOSER_ACTION_SELECT_FOLDER); + + dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + dialog.add_button(Gtk::Stock::OPEN, Gtk::RESPONSE_OK); + + const int result = dialog.run(); + + if (result == Gtk::RESPONSE_OK) { + _lash_driver->restore_project(dialog.get_filename()); + } } + void Patchage::menu_save_session() { + if (_lash_driver) + _lash_driver->save_project(); } + void Patchage::menu_save_session_as() { + if (!_lash_driver) + return; + + Gtk::FileChooserDialog dialog(*_main_window, "Save LASH Session", + Gtk::FILE_CHOOSER_ACTION_SAVE); + + dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); + dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK); + + const int result = dialog.run(); + + if (result == Gtk::RESPONSE_OK) { + _lash_driver->set_project_directory(dialog.get_filename()); + _lash_driver->save_project(); + } } + void -Patchage::menu_lash_launch() +Patchage::menu_close_session() { - _lash_driver->attach(true); + cerr << "CLOSE SESSION\n"; + _lash_driver->close_project(); } void Patchage::menu_lash_connect() { - _lash_driver->attach(false); + _lash_driver->attach(true); } @@ -610,7 +630,6 @@ Patchage::on_pane_position_changed() if (_pane_closed && new_position < max_pane_position()) { // Auto open _user_pane_position = new_position; - cerr << "FOO\n"; _messages_expander->set_expanded(true); _pane_closed = false; _menu_view_messages->set_active(true); |