summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity/App.cpp
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-12-13 04:25:46 +0000
committerDavid Robillard <d@drobilla.net>2006-12-13 04:25:46 +0000
commitd80bbb83b77d3e1dcdc9bfd60f795c4c2cbb1ac9 (patch)
treec56fea6691161077a266a0a97cad21e2c1c36897 /src/progs/ingenuity/App.cpp
parent443530680da9d6f909088ceb6a5c86178225b84f (diff)
downloadingen-d80bbb83b77d3e1dcdc9bfd60f795c4c2cbb1ac9.tar.gz
ingen-d80bbb83b77d3e1dcdc9bfd60f795c4c2cbb1ac9.tar.bz2
ingen-d80bbb83b77d3e1dcdc9bfd60f795c4c2cbb1ac9.zip
Repeated attaching/reattaching/etc/etc with Ingenuity.
Fixed behaviour on closing last window (quit). git-svn-id: http://svn.drobilla.net/lad/ingen@221 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity/App.cpp')
-rw-r--r--src/progs/ingenuity/App.cpp65
1 files changed, 16 insertions, 49 deletions
diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp
index 6470a807..00f4cee4 100644
--- a/src/progs/ingenuity/App.cpp
+++ b/src/progs/ingenuity/App.cpp
@@ -57,9 +57,7 @@ App* App::_instance = 0;
App::App()
-: _store(NULL),
- _loader(NULL),
- _configuration(new Configuration()),
+: _configuration(new Configuration()),
_about_dialog(NULL),
_window_factory(new WindowFactory()),
_enable_signal(true)
@@ -99,14 +97,27 @@ App::attach(const SharedPtr<ModelEngineInterface>& engine, const SharedPtr<SigCl
_engine = engine;
_client = client;
- _store = new Store(engine, client);
- _loader = new ThreadedLoader(engine);
+ _store = SharedPtr<Store>(new Store(engine, client));
+ _loader = SharedPtr<ThreadedLoader>(new ThreadedLoader(engine));
_patch_tree_window->init(*_store);
}
void
+App::detach()
+{
+ _window_factory->clear();
+ _store->clear();
+
+ _loader.reset();
+ _store.reset();
+ _client.reset();
+ _engine.reset();
+}
+
+
+void
App::error_message(const string& str)
{
_messages_window->post(str);
@@ -207,50 +218,6 @@ App::event_save_session_as()
}
#endif
-void
-App::add_patch_window(PatchWindow* pw)
-{
- _windows.push_back(pw);
-}
-
-
-void
-App::remove_patch_window(PatchWindow* pw)
-{
- _windows.erase(find(_windows.begin(), _windows.end(), pw));
-}
-
-
-/** Returns the number of Patch windows currently visible.
- */
-int
-App::num_open_patch_windows()
-{
- int ret = 0;
- for (list<PatchWindow*>::iterator i = _windows.begin(); i != _windows.end(); ++i)
- if ((*i)->is_visible())
- ++ret;
-
- return ret;
-}
-
-
-void
-App::disconnect()
-{
- // FIXME: this is pretty gross.. figure out the death situation better
-
- list<PatchWindow*> windows = _windows; // make a copy
-
- for (list<PatchWindow*>::iterator i = windows.begin(); i != windows.end(); ++i)
- delete (*i);
-
- _store->clear();
-
- // PatchWindow destructor removes them from the list
- assert(_windows.size() == 0);
-}
-
void
App::quit()