summaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-09-06 21:08:52 +0000
committerDavid Robillard <d@drobilla.net>2006-09-06 21:08:52 +0000
commit80923fdb966c74263a723f2ac6a39ea44efb07b2 (patch)
treead84b87670612949bad257efed77652e6346beb0 /src
parentdac2461ba66560c00efb43a12e35394a698b60f7 (diff)
downloadingen-80923fdb966c74263a723f2ac6a39ea44efb07b2.tar.gz
ingen-80923fdb966c74263a723f2ac6a39ea44efb07b2.tar.bz2
ingen-80923fdb966c74263a723f2ac6a39ea44efb07b2.zip
Connecting/Disconnecting/Reconnecting to the engine without restarting.
git-svn-id: http://svn.drobilla.net/lad/ingen@115 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src')
-rw-r--r--src/libs/client/Store.cpp9
-rw-r--r--src/libs/client/Store.h2
-rw-r--r--src/progs/ingenuity/App.cpp19
-rw-r--r--src/progs/ingenuity/App.h1
-rw-r--r--src/progs/ingenuity/ConnectWindow.cpp30
-rw-r--r--src/progs/ingenuity/ConnectWindow.h1
-rw-r--r--src/progs/ingenuity/GtkObjectController.cpp5
-rw-r--r--src/progs/ingenuity/GtkObjectController.h2
8 files changed, 65 insertions, 4 deletions
diff --git a/src/libs/client/Store.cpp b/src/libs/client/Store.cpp
index 0b25da2e..403264f2 100644
--- a/src/libs/client/Store.cpp
+++ b/src/libs/client/Store.cpp
@@ -49,6 +49,15 @@ Store::Store(SigClientInterface& emitter)
void
+Store::clear()
+{
+ m_objects.clear();
+ m_plugins.clear();
+
+}
+
+
+void
Store::add_object(CountedPtr<ObjectModel> object)
{
assert(object->path() != "");
diff --git a/src/libs/client/Store.h b/src/libs/client/Store.h
index ff3eea62..cb6c3206 100644
--- a/src/libs/client/Store.h
+++ b/src/libs/client/Store.h
@@ -47,6 +47,8 @@ public:
CountedPtr<NodeModel> node(const string& path);
CountedPtr<PortModel> port(const string& path);*/
+ void clear();
+
size_t num_objects() { return m_objects.size(); }
const map<string, CountedPtr<PluginModel> >& plugins() const { return m_plugins; }
diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp
index 1ca2fec5..26bf50cd 100644
--- a/src/progs/ingenuity/App.cpp
+++ b/src/progs/ingenuity/App.cpp
@@ -43,6 +43,7 @@
#include "PatchTreeWindow.h"
#include "Configuration.h"
#include "ConnectWindow.h"
+#include "Store.h"
#ifdef HAVE_LASH
#include "LashController.h"
#endif
@@ -214,6 +215,24 @@ App::num_open_patch_windows()
return ret;
}
+
+void
+App::disconnect()
+{
+ // FIXME: this is pretty gross.. figure out the death situation better
+
+ list<PatchWindow*> windows = m_windows; // make a copy
+
+ for (list<PatchWindow*>::iterator i = windows.begin(); i != windows.end(); ++i)
+ delete (*i);
+
+ Store::instance().clear();
+
+ // PatchWindow destructor removes them from the list
+ assert(m_windows.size() == 0);
+}
+
+
void
App::quit()
{
diff --git a/src/progs/ingenuity/App.h b/src/progs/ingenuity/App.h
index faabc115..1e64abe8 100644
--- a/src/progs/ingenuity/App.h
+++ b/src/progs/ingenuity/App.h
@@ -69,6 +69,7 @@ public:
void error_message(const string& msg);
+ void disconnect();
void quit();
void add_patch_window(PatchWindow* pw);
diff --git a/src/progs/ingenuity/ConnectWindow.cpp b/src/progs/ingenuity/ConnectWindow.cpp
index 4cfb7a9c..6715c4ed 100644
--- a/src/progs/ingenuity/ConnectWindow.cpp
+++ b/src/progs/ingenuity/ConnectWindow.cpp
@@ -26,6 +26,7 @@
#include "Store.h"
#include "PatchController.h"
#include "PatchModel.h"
+#include "App.h"
namespace Ingenuity {
@@ -63,10 +64,27 @@ ConnectWindow::start(CountedPtr<Ingen::Shared::ClientInterface> client)
show();
}
+void
+ConnectWindow::init()
+{
+ _icon->set(Gtk::Stock::DISCONNECT, Gtk::ICON_SIZE_LARGE_TOOLBAR);
+ _progress_bar->set_fraction(0.0);
+ _url_entry->set_sensitive(true);
+ _connect_button->set_sensitive(true);
+ _disconnect_button->set_sensitive(false);
+ _port_spinbutton->set_sensitive(false);
+ _launch_radio->set_sensitive(true);
+ _internal_radio->set_sensitive(false);
+ server_toggled();
+
+ _progress_label->set_text(string("Disconnected"));
+}
void
ConnectWindow::connect()
{
+ _connect_button->set_sensitive(false);
+
if (_server_radio->get_active()) {
Controller::instance().set_engine_url(_url_entry->get_text());
Glib::signal_timeout().connect(
@@ -88,15 +106,19 @@ ConnectWindow::connect()
sigc::mem_fun(this, &ConnectWindow::gtk_callback), 100);
}
}
-
- _connect_button->set_sensitive(false);
}
void
ConnectWindow::disconnect()
{
- // Nope
+ _progress_bar->set_fraction(0.0);
+ _connect_button->set_sensitive(false);
+ _disconnect_button->set_sensitive(false);
+
+ App::instance().disconnect();
+
+ init();
}
@@ -247,9 +269,11 @@ ConnectWindow::gtk_callback()
_progress_bar->set_fraction(1.0);
_url_entry->set_sensitive(false);
_connect_button->set_sensitive(false);
+ _disconnect_button->set_sensitive(true);
_port_spinbutton->set_sensitive(false);
_launch_radio->set_sensitive(false);
_internal_radio->set_sensitive(false);
+ stage = 0; // set ourselves up for next time (if there is one)
return false; // deregister this callback
} else {
return true;
diff --git a/src/progs/ingenuity/ConnectWindow.h b/src/progs/ingenuity/ConnectWindow.h
index 3609c5fc..b553c3da 100644
--- a/src/progs/ingenuity/ConnectWindow.h
+++ b/src/progs/ingenuity/ConnectWindow.h
@@ -47,6 +47,7 @@ private:
void launch_toggled();
void internal_toggled();
+ void init();
void disconnect();
void connect();
void quit();
diff --git a/src/progs/ingenuity/GtkObjectController.cpp b/src/progs/ingenuity/GtkObjectController.cpp
index d5fb08a1..798dc1f4 100644
--- a/src/progs/ingenuity/GtkObjectController.cpp
+++ b/src/progs/ingenuity/GtkObjectController.cpp
@@ -26,6 +26,11 @@ GtkObjectController::GtkObjectController(CountedPtr<ObjectModel> model)
model->metadata_update_sig.connect(sigc::mem_fun(this, &GtkObjectController::metadata_update));
}
+GtkObjectController::~GtkObjectController()
+{
+ assert(m_model->controller() == this);
+ m_model->set_controller(NULL);
+}
} // namespace Ingenuity
diff --git a/src/progs/ingenuity/GtkObjectController.h b/src/progs/ingenuity/GtkObjectController.h
index 735e7b6b..6df13d02 100644
--- a/src/progs/ingenuity/GtkObjectController.h
+++ b/src/progs/ingenuity/GtkObjectController.h
@@ -45,7 +45,7 @@ class GtkObjectController : public ObjectController
{
public:
GtkObjectController(CountedPtr<ObjectModel> model);
- virtual ~GtkObjectController() {}
+ virtual ~GtkObjectController();
/** Destroy object.
*