From 0d58aba484757ce2924cd94656a3dbc64852d45d Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 16 Jun 2006 05:25:47 +0000 Subject: [PATCH] GUI polishing git-svn-id: http://svn.drobilla.net/lad@42 a436a847-0d15-0410-975c-d299462d15a1 --- grauph/src/progs/gtk/App.cpp | 7 - grauph/src/progs/gtk/App.h | 1 - grauph/src/progs/gtk/ConnectWindow.cpp | 4 + grauph/src/progs/gtk/ConnectWindow.h | 1 - grauph/src/progs/gtk/PatchWindow.cpp | 81 ++++++-- grauph/src/progs/gtk/PatchWindow.h | 15 +- grauph/src/progs/gtk/om_gtk.glade | 236 +++++++----------------- grauph/src/progs/gtk/om_gtk.glade.bak | 244 ++++++++----------------- 8 files changed, 216 insertions(+), 373 deletions(-) diff --git a/grauph/src/progs/gtk/App.cpp b/grauph/src/progs/gtk/App.cpp index 4c42ff90..262849d5 100644 --- a/grauph/src/progs/gtk/App.cpp +++ b/grauph/src/progs/gtk/App.cpp @@ -215,13 +215,6 @@ App::quit() Gtk::Main::quit(); } -void -App::quit_and_kill() -{ - Controller::instance().quit(); - Gtk::Main::quit(); -} - } // namespace OmGtk diff --git a/grauph/src/progs/gtk/App.h b/grauph/src/progs/gtk/App.h index dc5e3904..f86dc568 100644 --- a/grauph/src/progs/gtk/App.h +++ b/grauph/src/progs/gtk/App.h @@ -69,7 +69,6 @@ public: void error_message(const string& msg); void quit(); - void quit_and_kill(); void add_patch_window(PatchWindow* pw); void remove_patch_window(PatchWindow* pw); diff --git a/grauph/src/progs/gtk/ConnectWindow.cpp b/grauph/src/progs/gtk/ConnectWindow.cpp index 0b753266..2f160782 100644 --- a/grauph/src/progs/gtk/ConnectWindow.cpp +++ b/grauph/src/progs/gtk/ConnectWindow.cpp @@ -159,6 +159,8 @@ ConnectWindow::gtk_callback() ++stage; } } else if (stage == 8) { + _label->set_text(string("Connected to engine at ").append( + Controller::instance().engine_url())); stage = -1; hide(); // FIXME: actually destroy window to save mem? } @@ -167,6 +169,8 @@ ConnectWindow::gtk_callback() _progress_bar->pulse(); if (stage == -1) { // finished connecting + _progress_bar->set_fraction(1.0); + _launch_button->set_sensitive(false); return false; // deregister this callback } else { return true; diff --git a/grauph/src/progs/gtk/ConnectWindow.h b/grauph/src/progs/gtk/ConnectWindow.h index 8c0c7390..7de15ba1 100644 --- a/grauph/src/progs/gtk/ConnectWindow.h +++ b/grauph/src/progs/gtk/ConnectWindow.h @@ -42,7 +42,6 @@ public: ConnectWindow(BaseObjectType* cobject, const Glib::RefPtr& xml); void start(CountedPtr client); - private: void launch_engine(); diff --git a/grauph/src/progs/gtk/PatchWindow.cpp b/grauph/src/progs/gtk/PatchWindow.cpp index 8211e653..0814e1ac 100644 --- a/grauph/src/progs/gtk/PatchWindow.cpp +++ b/grauph/src/progs/gtk/PatchWindow.cpp @@ -35,6 +35,7 @@ #include "Controller.h" #include "BreadCrumb.h" #include "Store.h" +#include "ConnectWindow.h" namespace OmGtk { @@ -55,16 +56,17 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("patch_win_viewport", m_viewport); xml->get_widget("patch_win_breadcrumb_box", m_breadcrumb_box); //xml->get_widget("patch_win_status_bar", m_status_bar); - xml->get_widget("patch_open_menuitem", m_menu_open); - xml->get_widget("patch_open_into_menuitem", m_menu_open_into); + //xml->get_widget("patch_open_menuitem", m_menu_open); + xml->get_widget("patch_import_menuitem", m_menu_import); + //xml->get_widget("patch_open_into_menuitem", m_menu_open_into); xml->get_widget("patch_save_menuitem", m_menu_save); xml->get_widget("patch_save_as_menuitem", m_menu_save_as); xml->get_widget("patch_close_menuitem", m_menu_close); xml->get_widget("patch_configuration_menuitem", m_menu_configuration); xml->get_widget("patch_quit_menuitem", m_menu_quit); - xml->get_widget("patch_quit_and_kill_menuitem", m_menu_quit_and_kill); xml->get_widget("patch_view_control_window_menuitem", m_menu_view_control_window); - xml->get_widget("patch_description_menuitem", m_menu_view_patch_description); + xml->get_widget("patch_view_engine_window_menuitem", m_menu_view_engine_window); + xml->get_widget("patch_properties_menuitem", m_menu_view_patch_properties); xml->get_widget("patch_fullscreen_menuitem", m_menu_fullscreen); xml->get_widget("patch_clear_menuitem", m_menu_clear); xml->get_widget("patch_destroy_menuitem", m_menu_destroy_patch); @@ -89,10 +91,10 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrpush(Controller::instance().engine_url()); //m_status_bar->pack_start(*Gtk::manage(new Gtk::Image(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_MENU)), false, false); - m_menu_open->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_open)); - m_menu_open_into->signal_activate().connect( - sigc::mem_fun(this, &PatchWindow::event_open_into)); + /*m_menu_open->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_open));*/ + m_menu_import->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_import)); m_menu_save->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_save)); m_menu_save_as->signal_activate().connect( @@ -100,16 +102,16 @@ PatchWindow::PatchWindow(BaseObjectType* cobject, const Glib::RefPtrsignal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_close)); m_menu_quit->signal_activate().connect( - sigc::mem_fun(App::instance(), &App::quit)); - m_menu_quit_and_kill->signal_activate().connect( - sigc::mem_fun(App::instance(), &App::quit_and_kill)); + sigc::mem_fun(this, &PatchWindow::event_quit)); m_menu_configuration->signal_activate().connect( sigc::mem_fun(App::instance().configuration_dialog(), &ConfigWindow::show)); m_menu_fullscreen->signal_toggled().connect( sigc::mem_fun(this, &PatchWindow::event_fullscreen_toggled)); + m_menu_view_engine_window->signal_activate().connect( + sigc::mem_fun(this, &PatchWindow::event_show_engine)); m_menu_view_control_window->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_show_controls)); - m_menu_view_patch_description->signal_activate().connect( + m_menu_view_patch_properties->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_show_properties)); m_menu_destroy_patch->signal_activate().connect( sigc::mem_fun(this, &PatchWindow::event_destroy)); @@ -300,6 +302,14 @@ PatchWindow::breadcrumb_clicked(BreadCrumb* crumb) } +void +PatchWindow::event_show_engine() +{ + if (m_patch) + App::instance().connect_window()->show(); +} + + void PatchWindow::event_show_controls() { @@ -362,16 +372,17 @@ PatchWindow::patch_renamed(const string& new_path) } } - +/* void PatchWindow::event_open() { m_load_patch_window->set_replace(); m_load_patch_window->present(); } +*/ void -PatchWindow::event_open_into() +PatchWindow::event_import() { m_load_patch_window->set_merge(); m_load_patch_window->present(); @@ -497,17 +508,49 @@ PatchWindow::event_close() if (App::instance().num_open_patch_windows() > 1) { hide(); } else { - Gtk::MessageDialog d(*this, "This is the last remaining open Om patch\ -window. Closing this window will exit OmGtk (the engine will remain running).\n\n\ -Are you sure you want to quit?", - true, Gtk::MESSAGE_WARNING, Gtk::BUTTONS_OK_CANCEL, true); + Gtk::MessageDialog d(*this, "This is the last remaining open patch " + "window. Closing this window will exit OmGtk (the engine will " + "remain running).\n\nAre 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); int ret = d.run(); - if (ret == Gtk::RESPONSE_OK) + if (ret == Gtk::RESPONSE_CLOSE) App::instance().quit(); + else + d.hide(); } } +void +PatchWindow::event_quit() +{ + Gtk::MessageDialog d(*this, "Would you like to quit just OmGtk\nor kill the engine as well?", + 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); + + b = d.add_button(Gtk::Stock::QUIT, 1); // just exit + 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); + + int ret = d.run(); + if (ret == 1) { + App::instance().quit(); + } else if (ret == 2) { + Controller::instance().quit(); + App::instance().quit(); + } + // Otherwise cancelled, do nothing +} + + void PatchWindow::event_destroy() { diff --git a/grauph/src/progs/gtk/PatchWindow.h b/grauph/src/progs/gtk/PatchWindow.h index 42fba478..2821fa41 100644 --- a/grauph/src/progs/gtk/PatchWindow.h +++ b/grauph/src/progs/gtk/PatchWindow.h @@ -85,17 +85,18 @@ protected: bool on_key_press_event(GdkEventKey* event); private: - void event_open(); - void event_open_into(); + //void event_open(); + void event_import(); void event_save(); void event_save_as(); void event_close(); + void event_quit(); void event_destroy(); void event_clear(); void event_fullscreen_toggled(); void event_show_properties(); void event_show_controls(); - + void event_show_engine(); PatchController* m_patch; LoadPluginWindow* m_load_plugin_window; @@ -108,19 +109,19 @@ private: int m_x; int m_y; - Gtk::MenuItem* m_menu_open; - Gtk::MenuItem* m_menu_open_into; + //Gtk::MenuItem* m_menu_open; + Gtk::MenuItem* m_menu_import; Gtk::MenuItem* m_menu_save; Gtk::MenuItem* m_menu_save_as; Gtk::MenuItem* m_menu_configuration; Gtk::MenuItem* m_menu_close; Gtk::MenuItem* m_menu_quit; - Gtk::MenuItem* m_menu_quit_and_kill; Gtk::CheckMenuItem* m_menu_fullscreen; Gtk::MenuItem* m_menu_clear; Gtk::MenuItem* m_menu_destroy_patch; + Gtk::MenuItem* m_menu_view_engine_window; Gtk::MenuItem* m_menu_view_control_window; - Gtk::MenuItem* m_menu_view_patch_description; + Gtk::MenuItem* m_menu_view_patch_properties; Gtk::MenuItem* m_menu_add_plugin; Gtk::MenuItem* m_menu_new_subpatch; Gtk::MenuItem* m_menu_load_subpatch; diff --git a/grauph/src/progs/gtk/om_gtk.glade b/grauph/src/progs/gtk/om_gtk.glade index bbf98197..809451bf 100644 --- a/grauph/src/progs/gtk/om_gtk.glade +++ b/grauph/src/progs/gtk/om_gtk.glade @@ -44,37 +44,15 @@ - + True - _Open (Replace)... + Load a patch into the current patch (merge with existing contents). + _Import True - - + - - True - gtk-open - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Open _Into (Import)... - True - - - - - + True gtk-open 1 @@ -97,22 +75,9 @@ True Save this patch - _Save - True + gtk-save + True - - - - - True - gtk-save - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -120,22 +85,9 @@ True Save this patch to a specific filename - Save _As... - True + gtk-save-as + True - - - - - True - gtk-save-as - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -155,7 +107,7 @@ - + True gtk-preferences 1 @@ -178,22 +130,9 @@ True Close this window (patch will not be destroyed) - Close _Window - True + gtk-close + True - - - - - True - gtk-close - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -207,45 +146,9 @@ True Quit OmGtk (Om engine will continue running) - _Quit - True + gtk-quit + True - - - - - True - gtk-quit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Quit OmGtk and kill the Om engine - Quit and _Kill Engine - True - - - - - - True - gtk-stop - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -267,7 +170,7 @@ True Fullscreen True - False + True @@ -289,7 +192,7 @@ - + True gtk-preferences 1 @@ -303,24 +206,12 @@ - + True - View/Edit description for this patch - Descr_iption - True - - - - - True - gtk-edit - 1 - 0.5 - 0.5 - 0 - 0 - - + View/Edit properties for this patch + gtk-properties + True + @@ -328,21 +219,9 @@ True Remove all objects from patch - Clear - True + gtk-clear + True - - - - True - gtk-clear - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -355,7 +234,7 @@ - + True gtk-delete 1 @@ -375,7 +254,7 @@ True - _Insert + _Add True @@ -385,13 +264,13 @@ True - Insert a plugin into this patch + Load a plugin as a child of this patch _Plugin... True - + True gtk-execute 1 @@ -405,18 +284,18 @@ - + True - Insert a new, empty subpatch into this patchch - _New Patch... + Load a patch as a child of this patch + _Patch From File... True - - + + - + True - gtk-new + gtk-open 1 0.5 0.5 @@ -428,18 +307,18 @@ - + True - Load a subpatch from a file and insert it into this patch - _Load Patch... + Create a new (empty) patch as a child of this patch + _New Patch... True - - + + - + True - gtk-open + gtk-new 1 0.5 0.5 @@ -466,7 +345,7 @@ - + True gtk-info 1 @@ -493,6 +372,29 @@ + + + True + Connect to, Disconnect from, or Launch Engine + _Engine + True + + + + + + True + gtk-connect + 1 + 0.5 + 0.5 + 0 + 0 + + + + + True @@ -503,7 +405,7 @@ - + True gtk-index 1 @@ -526,7 +428,7 @@ - + True gtk-dialog-error 1 @@ -3278,7 +3180,7 @@ Contributors: 6 - Connecting to Engine + Connect to Engine GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER False @@ -3385,7 +3287,7 @@ Contributors: True True True - gtk-cancel + gtk-quit True GTK_RELIEF_NORMAL True diff --git a/grauph/src/progs/gtk/om_gtk.glade.bak b/grauph/src/progs/gtk/om_gtk.glade.bak index 508ee6b1..809451bf 100644 --- a/grauph/src/progs/gtk/om_gtk.glade.bak +++ b/grauph/src/progs/gtk/om_gtk.glade.bak @@ -44,37 +44,15 @@ - + True - _Open (Replace)... + Load a patch into the current patch (merge with existing contents). + _Import True - - + - - True - gtk-open - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Open _Into (Import)... - True - - - - - + True gtk-open 1 @@ -97,22 +75,9 @@ True Save this patch - _Save - True + gtk-save + True - - - - - True - gtk-save - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -120,22 +85,9 @@ True Save this patch to a specific filename - Save _As... - True + gtk-save-as + True - - - - - True - gtk-save-as - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -155,7 +107,7 @@ - + True gtk-preferences 1 @@ -178,22 +130,9 @@ True Close this window (patch will not be destroyed) - Close _Window - True + gtk-close + True - - - - - True - gtk-close - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -207,45 +146,9 @@ True Quit OmGtk (Om engine will continue running) - _Quit - True + gtk-quit + True - - - - - True - gtk-quit - 1 - 0.5 - 0.5 - 0 - 0 - - - - - - - - True - Quit OmGtk and kill the Om engine - Quit and _Kill Engine - True - - - - - - True - gtk-stop - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -267,7 +170,7 @@ True Fullscreen True - False + True @@ -289,7 +192,7 @@ - + True gtk-preferences 1 @@ -303,24 +206,12 @@ - + True - View/Edit description for this patch - Descr_iption - True - - - - - True - gtk-edit - 1 - 0.5 - 0.5 - 0 - 0 - - + View/Edit properties for this patch + gtk-properties + True + @@ -328,21 +219,9 @@ True Remove all objects from patch - Clear - True + gtk-clear + True - - - - True - gtk-clear - 1 - 0.5 - 0.5 - 0 - 0 - - @@ -355,7 +234,7 @@ - + True gtk-delete 1 @@ -375,7 +254,7 @@ True - _Insert + _Add True @@ -385,13 +264,13 @@ True - Insert a plugin into this patch + Load a plugin as a child of this patch _Plugin... True - + True gtk-execute 1 @@ -405,18 +284,18 @@ - + True - Insert a new, empty subpatch into this patchch - _New Patch... + Load a patch as a child of this patch + _Patch From File... True - - + + - + True - gtk-new + gtk-open 1 0.5 0.5 @@ -428,18 +307,18 @@ - + True - Load a subpatch from a file and insert it into this patch - _Load Patch... + Create a new (empty) patch as a child of this patch + _New Patch... True - - + + - + True - gtk-open + gtk-new 1 0.5 0.5 @@ -466,7 +345,7 @@ - + True gtk-info 1 @@ -493,6 +372,29 @@ + + + True + Connect to, Disconnect from, or Launch Engine + _Engine + True + + + + + + True + gtk-connect + 1 + 0.5 + 0.5 + 0 + 0 + + + + + True @@ -503,7 +405,7 @@ - + True gtk-index 1 @@ -526,7 +428,7 @@ - + True gtk-dialog-error 1 @@ -2533,7 +2435,7 @@ - + True True True @@ -2568,7 +2470,7 @@ GTK_CORNER_TOP_LEFT - + True A short description of the patch to be included in the patch file True @@ -2602,7 +2504,7 @@ 5 - + True True True @@ -2614,7 +2516,7 @@ - + True Apply these changes to be saved the next time the patch is saved True @@ -3278,7 +3180,7 @@ Contributors: 6 - Connecting to Engine + Connect to Engine GTK_WINDOW_TOPLEVEL GTK_WIN_POS_CENTER False @@ -3385,7 +3287,7 @@ Contributors: True True True - gtk-cancel + gtk-quit True GTK_RELIEF_NORMAL True