From c59d2b2cb60c8a0d32d5bbcac5e007e692fb70cc Mon Sep 17 00:00:00 2001 From: dave Date: Fri, 16 Jun 2006 06:33:04 +0000 Subject: [PATCH] Connect window improvements git-svn-id: http://svn.drobilla.net/lad@43 a436a847-0d15-0410-975c-d299462d15a1 --- grauph/src/progs/gtk/ConnectWindow.cpp | 82 +++- grauph/src/progs/gtk/ConnectWindow.h | 14 +- grauph/src/progs/gtk/om_gtk.glade | 551 +++++++++++++++++++------ grauph/src/progs/gtk/om_gtk.glade.bak | 549 ++++++++++++++++++------ 4 files changed, 941 insertions(+), 255 deletions(-) diff --git a/grauph/src/progs/gtk/ConnectWindow.cpp b/grauph/src/progs/gtk/ConnectWindow.cpp index 2f160782..deb2c134 100644 --- a/grauph/src/progs/gtk/ConnectWindow.cpp +++ b/grauph/src/progs/gtk/ConnectWindow.cpp @@ -34,18 +34,22 @@ ConnectWindow::ConnectWindow(BaseObjectType* cobject, const Glib::RefPtrget_widget("connect_progress_bar", _progress_bar); - xml->get_widget("connect_label", _label); - xml->get_widget("connect_launch_button", _launch_button); - xml->get_widget("connect_cancel_button", _cancel_button); + xml->get_widget("connect_icon", _icon); + xml->get_widget("connect_progress_bar", _progress_bar); + xml->get_widget("connect_label", _label); + xml->get_widget("connect_url_entry", _url_entry); + xml->get_widget("connect_connect_button", _connect_button); + xml->get_widget("connect_port_spinbutton", _port_spinbutton); + xml->get_widget("connect_launch_button", _launch_button); + xml->get_widget("connect_spawn_internal_button", _spawn_internal_button); + xml->get_widget("connect_disconnect_button", _disconnect_button); + xml->get_widget("connect_quit_button", _quit_button); - assert(_progress_bar); - assert(_label); - assert(_launch_button); - assert(_cancel_button); - - _launch_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::launch_engine)); - _cancel_button->signal_clicked().connect(sigc::ptr_fun(&Gtk::Main::quit)); + _connect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::connect)); + _launch_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::launch)); + _spawn_internal_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::spawn_internal)); + _disconnect_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::disconnect)); + _quit_button->signal_clicked().connect(sigc::mem_fun(this, &ConnectWindow::quit)); } @@ -53,24 +57,65 @@ void ConnectWindow::start(CountedPtr client) { _client = client; - - Glib::signal_timeout().connect( - sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); - resize(100, 100); + show(); } void -ConnectWindow::launch_engine() +ConnectWindow::connect() +{ + Controller::instance().set_engine_url(_url_entry->get_text()); + Glib::signal_timeout().connect( + sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); +} + + +void +ConnectWindow::disconnect() +{ + // Nope +} + + +void +ConnectWindow::quit() +{ + if (Controller::instance().is_attached()) { + Gtk::MessageDialog d(*this, "This will exit OmGtk, but the engine will " + "remain running (if it is remote).\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_CLOSE) + Gtk::Main::quit(); + } else { + Gtk::Main::quit(); + } +} + + +void +ConnectWindow::launch() { if (fork() == 0) { //cerr << "Launching engine.."; execlp("om", NULL); + + Glib::signal_timeout().connect( + sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100); } } +void +ConnectWindow::spawn_internal() +{ + // Not quite yet... +} + + bool ConnectWindow::gtk_callback() { @@ -169,8 +214,13 @@ ConnectWindow::gtk_callback() _progress_bar->pulse(); if (stage == -1) { // finished connecting + _icon->set(Gtk::Stock::CONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR); _progress_bar->set_fraction(1.0); + _url_entry->set_sensitive(false); + _connect_button->set_sensitive(false); + _port_spinbutton->set_sensitive(false); _launch_button->set_sensitive(false); + _spawn_internal_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 7de15ba1..7f405097 100644 --- a/grauph/src/progs/gtk/ConnectWindow.h +++ b/grauph/src/progs/gtk/ConnectWindow.h @@ -43,15 +43,25 @@ public: void start(CountedPtr client); private: - void launch_engine(); + void connect(); + void disconnect(); + void quit(); + void launch(); + void spawn_internal(); bool gtk_callback(); CountedPtr _client; + Gtk::Image* _icon; Gtk::ProgressBar* _progress_bar; Gtk::Label* _label; + Gtk::Entry* _url_entry; + Gtk::Button* _connect_button; + Gtk::SpinButton* _port_spinbutton; Gtk::Button* _launch_button; - Gtk::Button* _cancel_button; + Gtk::Button* _spawn_internal_button; + Gtk::Button* _disconnect_button; + Gtk::Button* _quit_button; }; diff --git a/grauph/src/progs/gtk/om_gtk.glade b/grauph/src/progs/gtk/om_gtk.glade index 809451bf..39af1fd1 100644 --- a/grauph/src/progs/gtk/om_gtk.glade +++ b/grauph/src/progs/gtk/om_gtk.glade @@ -3205,85 +3205,24 @@ Contributors: True - GTK_BUTTONBOX_DEFAULT_STYLE + GTK_BUTTONBOX_END - + True + False True True + gtk-disconnect + True GTK_RELIEF_NORMAL True - 0 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-execute - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Launch Engine - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - + -6 - + True True True @@ -3305,7 +3244,6 @@ Contributors: - 2 True False 0 @@ -3317,18 +3255,19 @@ Contributors: 0 - + True - om-icon.png + gtk-disconnect + 3 0.5 0.5 - 6 + 12 0 0 False - False + True @@ -3339,31 +3278,6 @@ Contributors: True 0 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - True @@ -3381,15 +3295,15 @@ Contributors: - + True - + Not Connected False False GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 0 0 @@ -3401,7 +3315,7 @@ Contributors: 0 False - False + True @@ -3420,27 +3334,426 @@ Contributors: - + True - Connecting to engine - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 4 - False - False + True + True + + + + + + True + 3 + 2 + False + 8 + 0 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Launch Server + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + False + 0 + + + + True + Port: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + True + 1 + 0 + True + GTK_UPDATE_ALWAYS + False + False + 16180 1 65535 1 10 10 + + + 0 + False + False + + + + + 0 + 1 + 1 + 2 + 8 + fill + + + + + + True + False + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Spawn _Internal Engine + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-connect + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Connect to Server + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + False + 0 + + + + True + URL: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + True + True + True + 0 + osc.udp://localhost:16180 + True + * + False + 28 + + + 0 + False + False + + + + + 0 + 1 + 0 + 1 + 8 + fill + fill + + + + + + True + False + This executable does not include an engine + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + 8 + fill + + + + + + 0 + True + True diff --git a/grauph/src/progs/gtk/om_gtk.glade.bak b/grauph/src/progs/gtk/om_gtk.glade.bak index 809451bf..db3e01b4 100644 --- a/grauph/src/progs/gtk/om_gtk.glade.bak +++ b/grauph/src/progs/gtk/om_gtk.glade.bak @@ -3205,85 +3205,24 @@ Contributors: True - GTK_BUTTONBOX_DEFAULT_STYLE + GTK_BUTTONBOX_END - + True + False True True + gtk-disconnect + True GTK_RELIEF_NORMAL True - 0 - - - - True - 0.5 - 0.5 - 0 - 0 - 0 - 0 - 0 - 0 - - - - True - False - 2 - - - - True - gtk-execute - 4 - 0.5 - 0.5 - 0 - 0 - - - 0 - False - False - - - - - - True - _Launch Engine - True - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - - - - + -6 - + True True True @@ -3305,7 +3244,6 @@ Contributors: - 2 True False 0 @@ -3317,12 +3255,13 @@ Contributors: 0 - + True - om-icon.png + gtk-disconnect + 3 0.5 0.5 - 6 + 12 0 @@ -3339,31 +3278,6 @@ Contributors: True 0 - - - True - - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - - - 0 - False - False - - - True @@ -3381,15 +3295,15 @@ Contributors: - + True - + Not Connected False False GTK_JUSTIFY_LEFT False False - 0.5 + 0 0.5 0 0 @@ -3420,27 +3334,426 @@ Contributors: - + True - Connecting to engine - False - False - GTK_JUSTIFY_LEFT - False - False - 0.5 - 0.5 - 0 - 0 - PANGO_ELLIPSIZE_NONE - -1 - False - 0 - 4 - False - False + 8 + True + True + + + + + + True + 3 + 2 + False + 8 + 0 + + + + True + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Launch Server + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 1 + 2 + fill + + + + + + + True + False + 0 + + + + True + Port: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + True + 1 + 0 + False + GTK_UPDATE_ALWAYS + False + False + 1 0 100 1 10 10 + + + 0 + False + False + + + + + 0 + 1 + 1 + 2 + 8 + fill + + + + + + True + False + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-execute + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + Spawn _Internal Engine + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 2 + 3 + fill + + + + + + + True + True + GTK_RELIEF_NORMAL + True + + + + True + 0.5 + 0.5 + 0 + 0 + 0 + 0 + 0 + 0 + + + + True + False + 2 + + + + True + gtk-connect + 4 + 0.5 + 0.5 + 0 + 0 + + + 0 + False + False + + + + + + True + _Connect to Server + True + False + GTK_JUSTIFY_LEFT + False + False + 0.5 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + False + False + + + + + + + + + 1 + 2 + 0 + 1 + fill + + + + + + + True + False + 0 + + + + True + URL: + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + True + True + + + + + + True + True + True + True + 0 + osc.udp://localhost:16180 + True + * + False + 28 + + + 0 + False + False + + + + + 0 + 1 + 0 + 1 + 8 + fill + fill + + + + + + True + False + This executable does not include an engine + False + False + GTK_JUSTIFY_LEFT + False + False + 1 + 0.5 + 0 + 0 + PANGO_ELLIPSIZE_NONE + -1 + False + 0 + + + 0 + 1 + 2 + 3 + 8 + fill + + + + + + 0 + True + True