diff options
Diffstat (limited to 'src/progs')
-rw-r--r-- | src/progs/ingenuity/App.cpp | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/App.h | 8 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadPatchWindow.cpp | 6 | ||||
-rw-r--r-- | src/progs/ingenuity/LoadSubpatchWindow.cpp | 8 | ||||
-rw-r--r-- | src/progs/ingenuity/Makefile.am | 4 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchCanvas.cpp | 2 | ||||
-rw-r--r-- | src/progs/ingenuity/PatchWindow.cpp | 6 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.cpp (renamed from src/progs/ingenuity/Loader.cpp) | 49 | ||||
-rw-r--r-- | src/progs/ingenuity/ThreadedLoader.h (renamed from src/progs/ingenuity/Loader.h) | 17 | ||||
-rw-r--r-- | src/progs/patch_loader/patch_loader.cpp | 4 |
10 files changed, 62 insertions, 46 deletions
diff --git a/src/progs/ingenuity/App.cpp b/src/progs/ingenuity/App.cpp index 4e58a9dd..6470a807 100644 --- a/src/progs/ingenuity/App.cpp +++ b/src/progs/ingenuity/App.cpp @@ -37,7 +37,7 @@ #include "Configuration.h" #include "ConnectWindow.h" #include "Store.h" -#include "Loader.h" +#include "ThreadedLoader.h" #include "WindowFactory.h" #ifdef HAVE_LASH #include "LashController.h" @@ -100,7 +100,7 @@ App::attach(const SharedPtr<ModelEngineInterface>& engine, const SharedPtr<SigCl _engine = engine; _client = client; _store = new Store(engine, client); - _loader = new Loader(engine); + _loader = new ThreadedLoader(engine); _patch_tree_window->init(*_store); } diff --git a/src/progs/ingenuity/App.h b/src/progs/ingenuity/App.h index 282958b9..213b572d 100644 --- a/src/progs/ingenuity/App.h +++ b/src/progs/ingenuity/App.h @@ -54,7 +54,7 @@ class PatchTreeView; class PatchTreeWindow; class ConnectWindow; class Configuration; -class Loader; +class ThreadedLoader; class WindowFactory; @@ -90,7 +90,7 @@ public: PatchTreeWindow* patch_tree() const { return _patch_tree_window; } Configuration* configuration() const { return _configuration; } Store* store() const { return _store; } - Loader* loader() const { return _loader; } + ThreadedLoader* loader() const { return _loader; } WindowFactory* window_factory() const { return _window_factory; } const SharedPtr<ModelEngineInterface>& engine() const { return _engine; } @@ -106,8 +106,8 @@ protected: SharedPtr<ModelEngineInterface> _engine; SharedPtr<SigClientInterface> _client; - Store* _store; - Loader* _loader; + Store* _store; + ThreadedLoader* _loader; Configuration* _configuration; diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp index b3e3068b..0588c6b1 100644 --- a/src/progs/ingenuity/LoadPatchWindow.cpp +++ b/src/progs/ingenuity/LoadPatchWindow.cpp @@ -22,7 +22,7 @@ #include "Configuration.h" #include "PatchModel.h" #include "ModelEngineInterface.h" -#include "Loader.h" +#include "ThreadedLoader.h" using boost::optional; @@ -50,7 +50,9 @@ LoadPatchWindow::LoadPatchWindow(BaseObjectType* cobject, const Glib::RefPtr<Gno Gtk::FileFilter filt; filt.add_pattern("*.om"); - filt.set_name("Om patch files (*.om)"); + filt.set_name("Om patch files (DEPRECATED) (*.om)"); + filt.add_pattern("*.ingen.ttl"); + filt.set_name("Ingen patch files (*.ingen.ttl)"); set_filter(filt); // Add global examples directory to "shortcut folders" (bookmarks) diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp index 6a8aa24d..92c8483c 100644 --- a/src/progs/ingenuity/LoadSubpatchWindow.cpp +++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp @@ -18,13 +18,15 @@ #include <sys/types.h> #include <dirent.h> #include <cassert> +#include <boost/optional.hpp> #include "App.h" #include "PatchView.h" #include "NodeModel.h" #include "PatchModel.h" #include "Configuration.h" #include "ModelEngineInterface.h" -#include "Loader.h" +#include "ThreadedLoader.h" +using boost::optional; namespace Ingenuity { @@ -52,7 +54,9 @@ LoadSubpatchWindow::LoadSubpatchWindow(BaseObjectType* cobject, const Glib::RefP Gtk::FileFilter filt; filt.add_pattern("*.om"); - filt.set_name("Om patch files (*.om)"); + filt.set_name("Om patch files (DEPRECATED) (*.om)"); + filt.add_pattern("*.ingen.ttl"); + filt.set_name("Ingen patch files (*.ingen.ttl)"); set_filter(filt); // Add global examples directory to "shortcut folders" (bookmarks) diff --git a/src/progs/ingenuity/Makefile.am b/src/progs/ingenuity/Makefile.am index a54f00c8..898a8b83 100644 --- a/src/progs/ingenuity/Makefile.am +++ b/src/progs/ingenuity/Makefile.am @@ -82,8 +82,8 @@ ingenuity_SOURCES = \ ConfigWindow.cpp \ PatchPropertiesWindow.h \ PatchPropertiesWindow.cpp \ - Loader.h \ - Loader.cpp \ + ThreadedLoader.h \ + ThreadedLoader.cpp \ RenameWindow.h \ RenameWindow.cpp \ NodePropertiesWindow.h \ diff --git a/src/progs/ingenuity/PatchCanvas.cpp b/src/progs/ingenuity/PatchCanvas.cpp index b1de8d60..84ec274c 100644 --- a/src/progs/ingenuity/PatchCanvas.cpp +++ b/src/progs/ingenuity/PatchCanvas.cpp @@ -311,7 +311,7 @@ PatchCanvas::destroy_selection() void PatchCanvas::copy_selection() { - Serializer serializer(App::instance().engine()); + Serializer serializer; serializer.start_to_string(); for (list<boost::shared_ptr<Module> >::iterator m = m_selected_modules.begin(); m != m_selected_modules.end(); ++m) { diff --git a/src/progs/ingenuity/PatchWindow.cpp b/src/progs/ingenuity/PatchWindow.cpp index ef7de264..ccadb9ed 100644 --- a/src/progs/ingenuity/PatchWindow.cpp +++ b/src/progs/ingenuity/PatchWindow.cpp @@ -34,7 +34,7 @@ #include "BreadCrumbBox.h" #include "Store.h" #include "ConnectWindow.h" -#include "Loader.h" +#include "ThreadedLoader.h" #include "WindowFactory.h" #include "PatchView.h" @@ -283,8 +283,8 @@ PatchWindow::event_save_as() if (result == Gtk::RESPONSE_OK) { string filename = dialog.get_filename(); - if (filename.length() < 4 || filename.substr(filename.length()-3) != ".om") - filename += ".om"; + if (filename.length() < 11 || filename.substr(filename.length()-10) != ".ingen.ttl") + filename += ".ingen.ttl"; bool confirm = false; std::fstream fin; diff --git a/src/progs/ingenuity/Loader.cpp b/src/progs/ingenuity/ThreadedLoader.cpp index 89245dff..fbd64d3d 100644 --- a/src/progs/ingenuity/Loader.cpp +++ b/src/progs/ingenuity/ThreadedLoader.cpp @@ -14,35 +14,36 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "Loader.h" +#include "ThreadedLoader.h" #include <fstream> #include <cassert> #include <string> -#include "Serializer.h" +#include "Loader.h" #include "PatchModel.h" using std::cout; using std::endl; namespace Ingenuity { -Loader::Loader(SharedPtr<ModelEngineInterface> engine) -: _serializer(new Serializer(engine)) +ThreadedLoader::ThreadedLoader(SharedPtr<ModelEngineInterface> engine) +: _loader(new Loader(engine)) +, _serializer(new Serializer()) { - assert(_serializer != NULL); + assert(_loader != NULL); // FIXME: rework this so the thread is only present when it's doing something (save mem) start(); } -Loader::~Loader() +ThreadedLoader::~ThreadedLoader() { - delete _serializer; + delete _loader; } void -Loader::_whipped() +ThreadedLoader::_whipped() { _mutex.lock(); @@ -55,20 +56,26 @@ Loader::_whipped() } void -Loader::load_patch(bool merge, - const string& data_base_uri, - const Path& data_path, - MetadataMap engine_data, - optional<const Path&> engine_parent, - optional<const string&> engine_name, - optional<size_t> engine_poly) +ThreadedLoader::load_patch(bool merge, + const string& data_base_uri, + const Path& data_path, + MetadataMap engine_data, + optional<const Path&> engine_parent, + optional<const string&> engine_name, + optional<size_t> engine_poly) { _mutex.lock(); - _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(_serializer, &Serializer::load_patch), + /*_events.push_back(sigc::hide_return(sigc::bind( + sigc::mem_fun(_loader, &Loader::load_patch), merge, data_base_uri, data_path, - engine_data, engine_parent, engine_name, engine_poly))); + engine_data, engine_parent, engine_name, engine_poly)));*/ + + cerr << "FIXME: load under root only\n"; + + _events.push_back(sigc::bind( + sigc::mem_fun(_loader, &Loader::load), + data_base_uri, "/")); _mutex.unlock(); @@ -77,12 +84,12 @@ Loader::load_patch(bool merge, void -Loader::save_patch(SharedPtr<PatchModel> model, const string& filename, bool recursive) +ThreadedLoader::save_patch(SharedPtr<PatchModel> model, const string& filename, bool recursive) { _mutex.lock(); _events.push_back(sigc::hide_return(sigc::bind( - sigc::mem_fun(this, &Loader::save_patch_event), + sigc::mem_fun(this, &ThreadedLoader::save_patch_event), model, filename, recursive))); _mutex.unlock(); @@ -92,7 +99,7 @@ Loader::save_patch(SharedPtr<PatchModel> model, const string& filename, bool rec void -Loader::save_patch_event(SharedPtr<PatchModel> model, const string& filename, bool recursive) +ThreadedLoader::save_patch_event(SharedPtr<PatchModel> model, const string& filename, bool recursive) { if (recursive) cerr << "FIXME: Recursive save." << endl; diff --git a/src/progs/ingenuity/Loader.h b/src/progs/ingenuity/ThreadedLoader.h index 05f97dbb..9212c9c7 100644 --- a/src/progs/ingenuity/Loader.h +++ b/src/progs/ingenuity/ThreadedLoader.h @@ -14,8 +14,8 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#ifndef LOADERTHREAD_H -#define LOADERTHREAD_H +#ifndef THREADEDLOADER_H +#define THREADEDLOADER_H #include <string> #include <list> @@ -27,12 +27,13 @@ #include "raul/Condition.h" #include "ModelEngineInterface.h" #include "ObjectModel.h" +#include "Serializer.h" using std::string; using std::list; using boost::optional; namespace Ingen { namespace Client { - class Serializer; + class Loader; class PatchModel; } } using namespace Ingen::Client; @@ -51,16 +52,17 @@ namespace Ingenuity { * * \ingroup Ingenuity */ -class Loader : public Slave +class ThreadedLoader : public Slave { public: - Loader(SharedPtr<ModelEngineInterface> engine); - ~Loader(); + ThreadedLoader(SharedPtr<ModelEngineInterface> engine); + ~ThreadedLoader(); + Loader& loader() const { return *_loader; } Serializer& serializer() const { return *_serializer; } // FIXME: there's a pattern here.... - // (same core interface as Serializer) + // (same core interface as Loader/Serializer) void load_patch(bool merge, const string& data_base_uri, @@ -81,6 +83,7 @@ private: void _whipped(); + Loader* const _loader; Serializer* const _serializer; Mutex _mutex; list<Closure> _events; diff --git a/src/progs/patch_loader/patch_loader.cpp b/src/progs/patch_loader/patch_loader.cpp index 25fd626f..eb222c33 100644 --- a/src/progs/patch_loader/patch_loader.cpp +++ b/src/progs/patch_loader/patch_loader.cpp @@ -16,7 +16,7 @@ #include "OSCModelEngineInterface.h" -#include "Serializer.h" +//#include "Serializer.h" #include "PatchModel.h" #include "raul/Path.h" #include <iostream> @@ -53,7 +53,7 @@ int main(int argc, char** argv) SharedPtr<OSCModelEngineInterface> engine(new OSCModelEngineInterface(engine_url)); - Serializer serializer(engine); + //Serializer serializer(engine); /* Connect to engine */ engine->attach(-1, client_port); |