summaryrefslogtreecommitdiffstats
path: root/src/libs/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-08-17 06:38:33 +0000
committerDavid Robillard <d@drobilla.net>2008-08-17 06:38:33 +0000
commit03acefb8271d2abb5160b349d8e70687af6965fb (patch)
treee377017141707b2a97eeda4adffcfbb56eec88bc /src/libs/gui
parent696535322342c56901d4d48641b6f9cf816ac1e1 (diff)
downloadingen-03acefb8271d2abb5160b349d8e70687af6965fb.tar.gz
ingen-03acefb8271d2abb5160b349d8e70687af6965fb.tar.bz2
ingen-03acefb8271d2abb5160b349d8e70687af6965fb.zip
Clean up parser into generic form that can parse anything (rather than just the root patch from a document).
Support for parsing from a string. Fix serialisation to a string. git-svn-id: http://svn.drobilla.net/lad/ingen@1414 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/libs/gui')
-rw-r--r--src/libs/gui/LoadPatchWindow.cpp7
-rw-r--r--src/libs/gui/LoadRemotePatchWindow.cpp7
-rw-r--r--src/libs/gui/LoadSubpatchWindow.cpp6
-rw-r--r--src/libs/gui/PatchCanvas.cpp2
-rw-r--r--src/libs/gui/ThreadedLoader.cpp14
-rw-r--r--src/libs/gui/ThreadedLoader.hpp6
6 files changed, 20 insertions, 22 deletions
diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp
index 398eaf1f..4a86515a 100644
--- a/src/libs/gui/LoadPatchWindow.cpp
+++ b/src/libs/gui/LoadPatchWindow.cpp
@@ -120,9 +120,8 @@ LoadPatchWindow::ok_clicked()
return;
// If unset load_patch will load value
- optional<const string&> name;
-
- optional<Path> parent;
+ optional<Path> parent;
+ optional<Symbol> symbol;
if (_poly_from_user_radio->get_active())
_initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int()));
@@ -137,7 +136,7 @@ LoadPatchWindow::ok_clicked()
hide();
App::instance().loader()->load_patch(true, get_uri(), "/",
- _initial_data, parent, name);
+ _initial_data, parent, symbol);
}
diff --git a/src/libs/gui/LoadRemotePatchWindow.cpp b/src/libs/gui/LoadRemotePatchWindow.cpp
index d4a9329f..5d4bcb5c 100644
--- a/src/libs/gui/LoadRemotePatchWindow.cpp
+++ b/src/libs/gui/LoadRemotePatchWindow.cpp
@@ -136,9 +136,8 @@ LoadRemotePatchWindow::open_clicked()
cerr << "OPEN URI: " << uri << endl;
// If unset load_patch will load values
- optional<const string&> name;
-
- optional<Path> parent;
+ optional<Path> parent;
+ optional<Symbol> symbol;
if (_replace)
App::instance().engine()->clear_patch(_patch->path());
@@ -147,7 +146,7 @@ LoadRemotePatchWindow::open_clicked()
parent = _patch->path().parent();
App::instance().loader()->load_patch(true, uri, "/",
- _initial_data, parent, name);
+ _initial_data, parent, symbol);
hide();
}
diff --git a/src/libs/gui/LoadSubpatchWindow.cpp b/src/libs/gui/LoadSubpatchWindow.cpp
index cd3745dd..df954e48 100644
--- a/src/libs/gui/LoadSubpatchWindow.cpp
+++ b/src/libs/gui/LoadSubpatchWindow.cpp
@@ -145,12 +145,12 @@ LoadSubpatchWindow::ok_clicked()
assert(_patch);
// If unset load_patch will load values
- optional<const string&> name;
+ optional<Symbol> symbol;
string name_str = "";
if (_name_from_user_radio->get_active()) {
name_str = _name_entry->get_text();
- name = name_str;
+ symbol = Symbol::symbolify(name_str);
}
if (_poly_from_user_radio->get_active()) {
@@ -168,7 +168,7 @@ LoadSubpatchWindow::ok_clicked()
Atom& y = _initial_data["ingenuity:canvas-y"];
y = Atom(y.get_float() + 20.0f);
- App::instance().loader()->load_patch(false, *i, "/", _initial_data, _patch->path(), name);
+ App::instance().loader()->load_patch(false, *i, "/", _initial_data, _patch->path(), symbol);
}
hide();
diff --git a/src/libs/gui/PatchCanvas.cpp b/src/libs/gui/PatchCanvas.cpp
index df6ba285..019851f0 100644
--- a/src/libs/gui/PatchCanvas.cpp
+++ b/src/libs/gui/PatchCanvas.cpp
@@ -540,7 +540,7 @@ void
PatchCanvas::copy_selection()
{
Serialiser serialiser(*App::instance().world(), App::instance().store());
- serialiser.start_to_string("");
+ serialiser.start_to_string(_patch->path(), "");
for (list<boost::shared_ptr<Item> >::iterator m = _selected_items.begin(); m != _selected_items.end(); ++m) {
boost::shared_ptr<NodeModule> module = boost::dynamic_pointer_cast<NodeModule>(*m);
diff --git a/src/libs/gui/ThreadedLoader.cpp b/src/libs/gui/ThreadedLoader.cpp
index 8c8af828..d85d54a3 100644
--- a/src/libs/gui/ThreadedLoader.cpp
+++ b/src/libs/gui/ThreadedLoader.cpp
@@ -80,11 +80,11 @@ ThreadedLoader::_whipped()
void
ThreadedLoader::load_patch(bool merge,
- const string& data_base_uri,
+ const Glib::ustring& data_base_uri,
const Path& data_path,
GraphObject::Variables engine_data,
optional<Path> engine_parent,
- optional<const string&> engine_name)
+ optional<Symbol> engine_symbol)
{
_mutex.lock();
@@ -94,18 +94,18 @@ ThreadedLoader::load_patch(bool merge,
sigc::mem_fun(_deprecated_loader, &DeprecatedLoader::load_patch),
data_base_uri,
engine_parent,
- (engine_name) ? engine_name.get() : "",
+ (engine_symbol) ? engine_symbol.get() : "",
engine_data,
false)));
} else {
_events.push_back(sigc::hide_return(sigc::bind(
- sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse),
+ sigc::mem_fun(_parser.get(), &Ingen::Serialisation::Parser::parse_document),
App::instance().world(),
App::instance().world()->engine.get(),
- data_base_uri,
+ data_base_uri, // document
+ data_base_uri, // patch (root of document)
engine_parent,
- (engine_name) ? engine_name.get() : "",
- "",
+ engine_symbol,
engine_data)));
}
diff --git a/src/libs/gui/ThreadedLoader.hpp b/src/libs/gui/ThreadedLoader.hpp
index ea4f652d..dd5909fe 100644
--- a/src/libs/gui/ThreadedLoader.hpp
+++ b/src/libs/gui/ThreadedLoader.hpp
@@ -62,11 +62,11 @@ public:
// (same core interface as Loader/Serialiser)
void load_patch(bool merge,
- const string& data_base_uri,
+ const Glib::ustring& data_base_uri,
const Path& data_path,
GraphObject::Variables engine_data,
- optional<Path> engine_parent,
- optional<const string&> engine_name = optional<const string&>());
+ optional<Path> engine_parent = optional<Path>(),
+ optional<Symbol> engine_symbol = optional<Symbol>());
void save_patch(SharedPtr<PatchModel> model, const string& filename);