summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2008-11-16 23:11:54 +0000
committerDavid Robillard <d@drobilla.net>2008-11-16 23:11:54 +0000
commit89ebed9d01c1851ca003f6e01d963b1940da9cf9 (patch)
treefe60a90dc8597898e1757b4a0ea3792a76d515c7
parent001eb2b49a2a0127bde1fea4db6c0f976b838584 (diff)
downloadingen-89ebed9d01c1851ca003f6e01d963b1940da9cf9.tar.gz
ingen-89ebed9d01c1851ca003f6e01d963b1940da9cf9.tar.bz2
ingen-89ebed9d01c1851ca003f6e01d963b1940da9cf9.zip
Remember patch save file location in client (fix ticket #239).
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@1741 a436a847-0d15-0410-975c-d299462d15a1
-rw-r--r--src/gui/PatchWindow.cpp20
-rw-r--r--src/serialisation/Parser.cpp7
-rw-r--r--src/serialisation/Serialiser.cpp2
3 files changed, 11 insertions, 18 deletions
diff --git a/src/gui/PatchWindow.cpp b/src/gui/PatchWindow.cpp
index d7499bfb..13413b5c 100644
--- a/src/gui/PatchWindow.cpp
+++ b/src/gui/PatchWindow.cpp
@@ -324,10 +324,12 @@ void
PatchWindow::event_save()
{
GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document");
- if (doc == _patch->variables().end())
+ if (doc == _patch->variables().end()) {
event_save_as();
- else
- App::instance().loader()->save_patch(_patch, doc->second.get_string());
+ } else {
+ const Glib::ustring& filename = Glib::filename_from_uri(doc->second.get_string());
+ App::instance().loader()->save_patch(_patch, filename);
+ }
}
@@ -336,15 +338,6 @@ PatchWindow::event_save_as()
{
Gtk::FileChooserDialog dialog(*this, "Save Patch", Gtk::FILE_CHOOSER_ACTION_SAVE);
- /*Gtk::VBox* box = dialog.get_vbox();
- Gtk::Label warning("Warning: Recursively saving will overwrite any subpatch files \
- without confirmation.");
- box->pack_start(warning, false, false, 2);
- Gtk::CheckButton recursive_checkbutton("Recursively save all subpatches");
- box->pack_start(recursive_checkbutton, false, false, 0);
- recursive_checkbutton.show();
- */
-
dialog.add_button(Gtk::Stock::CANCEL, Gtk::RESPONSE_CANCEL);
Gtk::Button* save_button = dialog.add_button(Gtk::Stock::SAVE, Gtk::RESPONSE_OK);
save_button->property_has_default() = true;
@@ -363,7 +356,7 @@ PatchWindow::event_save_as()
string filename = dialog.get_filename();
if (filename.length() < 11 || filename.substr(filename.length()-10) != ".ingen.ttl")
filename += ".ingen.ttl";
-
+
bool confirm = false;
std::fstream fin;
fin.open(filename.c_str(), std::ios::in);
@@ -383,6 +376,7 @@ PatchWindow::event_save_as()
if (confirm) {
App::instance().loader()->save_patch(_patch, filename);
+ _patch->set_variable("ingen:document", Atom(Glib::filename_to_uri(filename).c_str()));
}
}
App::instance().configuration()->set_patch_folder(dialog.get_current_folder());
diff --git a/src/serialisation/Parser.cpp b/src/serialisation/Parser.cpp
index 9d5007e4..2959e12a 100644
--- a/src/serialisation/Parser.cpp
+++ b/src/serialisation/Parser.cpp
@@ -250,10 +250,9 @@ Parser::parse(
// continue;
if (rdf_class == patch_class) {
- ret = parse_patch(world, target, model, base_uri, engine_base,
- path_str, data);
- if (ret)
- target->set_variable(path, "ingen:document", Atom(base_uri.c_str()));
+ ret = parse_patch(world, target, model, base_uri, engine_base, path_str, data);
+ //if (ret)
+ // target->set_variable(path, "ingen:document", Atom(base_uri.c_str()));
} else if (rdf_class == node_class) {
ret = parse_node(world, target, model,
base_uri, Glib::ustring("<") + subject.to_c_string() + ">", path, data);
diff --git a/src/serialisation/Serialiser.cpp b/src/serialisation/Serialiser.cpp
index fdadfc2f..0704247e 100644
--- a/src/serialisation/Serialiser.cpp
+++ b/src/serialisation/Serialiser.cpp
@@ -520,7 +520,7 @@ Serialiser::serialise_variables(Redland::Node subject, const GraphObject::Variab
cerr << "Warning: variable with no value: key '" << v->first << "'" << endl;
}
} else {
- cerr << "Warning: not serialising variable with invalid key '" << v->first << "'" << endl;
+ cerr << "Not serialising special variable '" << v->first << "'" << endl;
}
}
}