From 608aeac60ef43243b85c0dcc5894ccc79f35fba5 Mon Sep 17 00:00:00 2001 From: David Robillard Date: Sun, 21 Oct 2007 19:02:02 +0000 Subject: Fix crash on OSC connection. Fix patch filename persistance. git-svn-id: http://svn.drobilla.net/lad/ingen@894 a436a847-0d15-0410-975c-d299462d15a1 --- src/libs/gui/LoadPatchWindow.cpp | 7 +++++-- src/libs/gui/PatchWindow.cpp | 15 ++++++++------- src/libs/gui/ingen_gui.glade | 4 ++-- 3 files changed, 15 insertions(+), 11 deletions(-) (limited to 'src/libs/gui') diff --git a/src/libs/gui/LoadPatchWindow.cpp b/src/libs/gui/LoadPatchWindow.cpp index 66aec5b0..57ae1536 100644 --- a/src/libs/gui/LoadPatchWindow.cpp +++ b/src/libs/gui/LoadPatchWindow.cpp @@ -15,10 +15,10 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "LoadPatchWindow.hpp" #include #include #include +#include "LoadPatchWindow.hpp" #include "interface/EngineInterface.hpp" #include "client/PatchModel.hpp" #include "App.hpp" @@ -127,8 +127,11 @@ LoadPatchWindow::ok_clicked() if (_poly_from_user_radio->get_active()) _initial_data.insert(make_pair("ingen:polyphony", _poly_spinbutton->get_value_as_int())); - if (_replace) + if (_replace) { App::instance().engine()->clear_patch(_patch->path()); + App::instance().engine()->set_variable(_patch->path(), "ingen:document", + Atom(get_uri().c_str())); + } if (_patch->path() != "/") parent = _patch->path().parent(); diff --git a/src/libs/gui/PatchWindow.cpp b/src/libs/gui/PatchWindow.cpp index 716d4356..5569c037 100644 --- a/src/libs/gui/PatchWindow.cpp +++ b/src/libs/gui/PatchWindow.cpp @@ -304,10 +304,11 @@ PatchWindow::event_import_location() void PatchWindow::event_save() { - if (_patch->filename() == "") + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc == _patch->variables().end()) event_save_as(); else - App::instance().loader()->save_patch(_patch, _patch->filename()); + App::instance().loader()->save_patch(_patch, doc->second.get_string()); } @@ -330,9 +331,9 @@ PatchWindow::event_save_as() save_button->property_has_default() = true; // Set current folder to most sensible default - const string& current_filename = _patch->filename(); - if (current_filename.length() > 0) - dialog.set_filename(current_filename); + GraphObject::Variables::const_iterator doc = _patch->variables().find("ingen:document"); + if (doc != _patch->variables().end()) + dialog.set_uri(doc->second.get_string()); else if (App::instance().configuration()->patch_folder().length() > 0) dialog.set_current_folder(App::instance().configuration()->patch_folder()); @@ -365,8 +366,8 @@ PatchWindow::event_save_as() if (confirm) { App::instance().loader()->save_patch(_patch, filename); - _patch->set_filename(filename); - //_patch->set_variable("filename", Atom(filename.c_str())); + App::instance().engine()->set_variable(_patch->path(), "ingen:document", + Atom(Glib::filename_to_uri(filename).c_str())); } } App::instance().configuration()->set_patch_folder(dialog.get_current_folder()); diff --git a/src/libs/gui/ingen_gui.glade b/src/libs/gui/ingen_gui.glade index 18090268..e3f66321 100644 --- a/src/libs/gui/ingen_gui.glade +++ b/src/libs/gui/ingen_gui.glade @@ -404,8 +404,8 @@ True True - GTK_POLICY_NEVER - GTK_POLICY_NEVER + GTK_POLICY_AUTOMATIC + GTK_POLICY_AUTOMATIC True -- cgit v1.2.1