summaryrefslogtreecommitdiffstats
path: root/src/progs/ingenuity
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2006-10-28 04:59:44 +0000
committerDavid Robillard <d@drobilla.net>2006-10-28 04:59:44 +0000
commit90ab0227e7ce1abcb5b0b4eb455aa3c3845065d3 (patch)
treefeea187323d05592e66ad02c772a4d083dbc173a /src/progs/ingenuity
parentf8e09808b7a51b474cbee66442cf7a03eed9010a (diff)
downloadingen-90ab0227e7ce1abcb5b0b4eb455aa3c3845065d3.tar.gz
ingen-90ab0227e7ce1abcb5b0b4eb455aa3c3845065d3.tar.bz2
ingen-90ab0227e7ce1abcb5b0b4eb455aa3c3845065d3.zip
Added proper new loading interface to Serializer, updated everything that uses it (no actual implementation yet).
git-svn-id: http://svn.drobilla.net/lad/ingen@194 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/progs/ingenuity')
-rw-r--r--src/progs/ingenuity/LoadPatchWindow.cpp19
-rw-r--r--src/progs/ingenuity/LoadPatchWindow.h6
-rw-r--r--src/progs/ingenuity/LoadSubpatchWindow.cpp17
-rw-r--r--src/progs/ingenuity/Loader.cpp17
-rw-r--r--src/progs/ingenuity/Loader.h19
5 files changed, 42 insertions, 36 deletions
diff --git a/src/progs/ingenuity/LoadPatchWindow.cpp b/src/progs/ingenuity/LoadPatchWindow.cpp
index 7605f0f0..b3e3068b 100644
--- a/src/progs/ingenuity/LoadPatchWindow.cpp
+++ b/src/progs/ingenuity/LoadPatchWindow.cpp
@@ -17,12 +17,15 @@
#include "LoadPatchWindow.h"
#include <sys/types.h>
#include <dirent.h>
+#include <boost/optional/optional.hpp>
#include "App.h"
#include "Configuration.h"
#include "PatchModel.h"
#include "ModelEngineInterface.h"
#include "Loader.h"
+using boost::optional;
+
namespace Ingenuity {
@@ -108,9 +111,9 @@ LoadPatchWindow::poly_from_user_selected()
void
LoadPatchWindow::ok_clicked()
{
- // These values are interpreted by load_patch() as "not defined", ie load from file
- string name = "";
- int poly = 0;
+ // If unset load_patch will load values
+ optional<const string&> name;
+ optional<size_t> poly;
if (m_poly_from_user_radio->get_active())
poly = m_poly_spinbutton->get_value_as_int();
@@ -118,14 +121,8 @@ LoadPatchWindow::ok_clicked()
if (m_replace)
App::instance().engine()->clear_patch(m_patch->path());
- cerr << "FIXME: load patch" << endl;
- //SharedPtr<PatchModel> pm(new PatchModel(m_patch->path(), poly));
- //pm->filename(get_filename());
- //pm->set_metadata("filename", Atom(get_filename().c_str()));
- // FIXME: necessary?
- //pm->set_parent(m_patch->parent());
- //App::instance().engine()->push_added_patch(pm);
- //App::instance().loader()->load_patch(pm, true, true);
+ App::instance().loader()->load_patch(true, get_filename(), "/",
+ m_initial_data, m_patch->parent()->path(), name, poly);
hide();
}
diff --git a/src/progs/ingenuity/LoadPatchWindow.h b/src/progs/ingenuity/LoadPatchWindow.h
index b70552b1..a1bc228f 100644
--- a/src/progs/ingenuity/LoadPatchWindow.h
+++ b/src/progs/ingenuity/LoadPatchWindow.h
@@ -31,9 +31,9 @@ namespace Ingenuity {
/** 'Load Patch' window.
*
- * Loaded by glade as a derived object. Used for both "Load" and "Load Into"
- * operations (the radio button state should be changed with the provided
- * methods prior to presenting this window).
+ * Loaded by glade as a derived object. Used for both "Import" and "Load"
+ * (e.g. Replace, clear-then-import) operations (the radio button state
+ * should be changed with the provided methods before presenting).
*
* This is not for loading subpatches. See @a LoadSubpatchWindow for that.
*
diff --git a/src/progs/ingenuity/LoadSubpatchWindow.cpp b/src/progs/ingenuity/LoadSubpatchWindow.cpp
index 9aea1bd6..6a8aa24d 100644
--- a/src/progs/ingenuity/LoadSubpatchWindow.cpp
+++ b/src/progs/ingenuity/LoadSubpatchWindow.cpp
@@ -136,20 +136,23 @@ LoadSubpatchWindow::ok_clicked()
{
assert(m_patch);
- const string filename = get_filename();
-
- string name = "";
- int poly = 1;
+ // If unset load_patch will load values
+ optional<const string&> name;
+ optional<size_t> poly;
+ string name_str = "";
- if (m_name_from_user_radio->get_active())
- name = m_name_entry->get_text();
+ if (m_name_from_user_radio->get_active()) {
+ name_str = m_name_entry->get_text();
+ name = name_str;
+ }
if (m_poly_from_user_radio->get_active())
poly = m_poly_spinbutton->get_value_as_int();
else if (m_poly_from_parent_radio->get_active())
poly = m_patch->poly();
- App::instance().loader()->load_patch(filename, m_patch->path(), name, poly, m_initial_data);
+ App::instance().loader()->load_patch(false, get_filename(), "/",
+ m_initial_data, m_patch->parent()->path(), name, poly);
hide();
}
diff --git a/src/progs/ingenuity/Loader.cpp b/src/progs/ingenuity/Loader.cpp
index 98f88e55..89245dff 100644
--- a/src/progs/ingenuity/Loader.cpp
+++ b/src/progs/ingenuity/Loader.cpp
@@ -54,20 +54,21 @@ Loader::_whipped()
_mutex.unlock();
}
-
void
-Loader::load_patch(const string& filename,
- const string& parent_path,
- const string& name,
- size_t poly,
- const MetadataMap& initial_data,
- bool existing)
+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)
{
_mutex.lock();
_events.push_back(sigc::hide_return(sigc::bind(
sigc::mem_fun(_serializer, &Serializer::load_patch),
- filename, parent_path, name, poly, initial_data, existing)));
+ merge, data_base_uri, data_path,
+ engine_data, engine_parent, engine_name, engine_poly)));
_mutex.unlock();
diff --git a/src/progs/ingenuity/Loader.h b/src/progs/ingenuity/Loader.h
index 65d1fcfe..05f97dbb 100644
--- a/src/progs/ingenuity/Loader.h
+++ b/src/progs/ingenuity/Loader.h
@@ -20,6 +20,7 @@
#include <string>
#include <list>
#include <cassert>
+#include <boost/optional/optional.hpp>
#include "raul/Thread.h"
#include "raul/Slave.h"
#include "raul/Mutex.h"
@@ -28,6 +29,7 @@
#include "ObjectModel.h"
using std::string;
using std::list;
+using boost::optional;
namespace Ingen { namespace Client {
class Serializer;
@@ -57,16 +59,19 @@ public:
Serializer& serializer() const { return *_serializer; }
- void load_patch(const string& filename,
- const string& parent_path,
- const string& name,
- size_t poly,
- const MetadataMap& initial_data,
- bool merge = false);
+ // FIXME: there's a pattern here....
+ // (same core interface as Serializer)
+
+ void load_patch(bool merge,
+ const string& data_base_uri,
+ const Path& data_path,
+ MetadataMap engine_data,
+ optional<const Path&> engine_parent = optional<const Path&>(),
+ optional<const string&> engine_name = optional<const string&>(),
+ optional<size_t> engine_poly = optional<size_t>());
void save_patch(SharedPtr<PatchModel> model, const string& filename, bool recursive);
-
private:
void save_patch_event(SharedPtr<PatchModel> model, const string& filename, bool recursive);