diff options
-rw-r--r-- | src/gui/ConnectWindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/LoadPluginWindow.cpp | 3 | ||||
-rw-r--r-- | src/gui/PatchWindow.cpp | 51 | ||||
-rw-r--r-- | src/gui/PatchWindow.hpp | 1 | ||||
-rw-r--r-- | src/gui/WindowFactory.cpp | 7 |
5 files changed, 45 insertions, 20 deletions
diff --git a/src/gui/ConnectWindow.cpp b/src/gui/ConnectWindow.cpp index c21a462c..ae0153c6 100644 --- a/src/gui/ConnectWindow.cpp +++ b/src/gui/ConnectWindow.cpp @@ -350,8 +350,7 @@ ConnectWindow::quit() true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true); d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); d.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE); - int ret = d.run(); - if (ret == Gtk::RESPONSE_CLOSE) + if (d.run() == Gtk::RESPONSE_CLOSE) Gtk::Main::quit(); } else { Gtk::Main::quit(); diff --git a/src/gui/LoadPluginWindow.cpp b/src/gui/LoadPluginWindow.cpp index c82fed23..d8944d28 100644 --- a/src/gui/LoadPluginWindow.cpp +++ b/src/gui/LoadPluginWindow.cpp @@ -335,7 +335,8 @@ LoadPluginWindow::add_clicked() Path path = _patch->path().base() + Path::nameify(name); App::instance().engine()->new_node(path, plugin->uri()); App::instance().engine()->set_property(path, "ingen:polyphonic", polyphonic); - for (GraphObject::Variables::const_iterator i = _initial_data.begin(); i != _initial_data.end(); ++i) + for (GraphObject::Variables::const_iterator i = _initial_data.begin(); + i != _initial_data.end(); ++i) App::instance().engine()->set_variable(path, i->first, i->second); _node_name_entry->set_text(generate_module_name(++_plugin_name_offset)); diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp index 707f5f0e..377ff59f 100644 --- a/src/gui/PatchWindow.cpp +++ b/src/gui/PatchWindow.cpp @@ -119,6 +119,8 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gnome::Glad sigc::mem_fun(this, &PatchWindow::event_delete)); _menu_select_all->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_select_all)); + _menu_close->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_close)); _menu_quit->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_quit)); _menu_fullscreen->signal_activate().connect( @@ -593,33 +595,54 @@ PatchWindow::on_key_release_event(GdkEventKey* event) return ret; } - + +void +PatchWindow::event_close() +{ + App::instance().window_factory()->remove_patch_window(this); +} + + void PatchWindow::event_quit() { - Gtk::MessageDialog d(*this, "Would you like to quit just this GUI\nor kill the engine as well?", + Gtk::Widget* kill_img = Gtk::manage( + new Gtk::Image(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)); + + Gtk::Widget* close_img = Gtk::manage( + new Gtk::Image(Gtk::Stock::QUIT, Gtk::ICON_SIZE_BUTTON)); + + const char* msg = (App::instance().world()->local_engine) + ? "This will kill the engine as well.\nAre you sure you want to quit?" + : "Would you like to quit just the GUI,\nor kill the engine as well?"; + + Gtk::MessageDialog d(*this, msg, true, Gtk::MESSAGE_QUESTION, Gtk::BUTTONS_NONE, true); - d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - Gtk::Button* b = d.add_button(Gtk::Stock::REMOVE, 2); // kill - b->set_label("_Kill Engine"); - Gtk::Widget* kill_img = Gtk::manage(new Gtk::Image(Gtk::Stock::CLOSE, Gtk::ICON_SIZE_BUTTON)); - b->set_image(*kill_img); + d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); - b = d.add_button(Gtk::Stock::QUIT, 1); // just exit + if (!App::instance().world()->local_engine) { + Gtk::Button* b = d.add_button(Gtk::Stock::REMOVE, 2); + b->set_label("_Kill Engine"); + b->set_image(*kill_img); + } + + Gtk::Button* b = d.add_button(Gtk::Stock::QUIT, 1); b->set_label("_Quit"); - Gtk::Widget* close_img = Gtk::manage(new Gtk::Image(Gtk::Stock::QUIT, Gtk::ICON_SIZE_BUTTON)); b->set_image(*close_img); b->grab_default(); - - int ret = d.run(); - if (ret == 1) { + + switch (d.run()) { + case 1: App::instance().quit(); - } else if (ret == 2) { + break; + case 2: App::instance().engine()->quit(); App::instance().quit(); + break; + default: + break; } - // Otherwise cancelled, do nothing } diff --git a/src/gui/PatchWindow.hpp b/src/gui/PatchWindow.hpp index a8d0cca0..63707a1e 100644 --- a/src/gui/PatchWindow.hpp +++ b/src/gui/PatchWindow.hpp @@ -92,6 +92,7 @@ private: void event_paste(); void event_delete(); void event_select_all(); + void event_close(); void event_quit(); void event_clear(); void event_fullscreen_toggled(); diff --git a/src/gui/WindowFactory.cpp b/src/gui/WindowFactory.cpp index b831db05..7709273b 100644 --- a/src/gui/WindowFactory.cpp +++ b/src/gui/WindowFactory.cpp @@ -184,9 +184,10 @@ bool WindowFactory::remove_patch_window(PatchWindow* win, GdkEventAny* ignored) { if (_patch_windows.size() <= 1) { - Gtk::MessageDialog d(*win, "This is the last remaining open patch " - "window. Closing this window will exit the GUI (the engine will " - "remain running).\n\nAre you sure you want to quit?", + Gtk::MessageDialog d(*win, + "Closing the only open patch window will exit the GUI\n" + "(If the engine is remote it will remain running)\n\n" + "Are you sure you want to quit?", true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_NONE, true); d.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL); d.add_button(Gtk::Stock::QUIT, Gtk::RESPONSE_CLOSE); |