diff options
author | David Robillard <d@drobilla.net> | 2011-09-24 02:27:45 +0000 |
---|---|---|
committer | David Robillard <d@drobilla.net> | 2011-09-24 02:27:45 +0000 |
commit | 2be10b0b6f2c0f01870208e9d18e5db87e5dfb88 (patch) | |
tree | e5bf3a28b59978c6464bb07eac160a458b01cd0d /src/gui | |
parent | 4cc5c82a87cf2316f425a9ea1de0fb29d0c24c8e (diff) | |
download | ingen-2be10b0b6f2c0f01870208e9d18e5db87e5dfb88.tar.gz ingen-2be10b0b6f2c0f01870208e9d18e5db87e5dfb88.tar.bz2 ingen-2be10b0b6f2c0f01870208e9d18e5db87e5dfb88.zip |
Only store patch canvas coordinates in containing patch.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3483 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r-- | src/gui/PatchCanvas.cpp | 17 | ||||
-rw-r--r-- | src/gui/PatchCanvas.hpp | 2 | ||||
-rw-r--r-- | src/gui/SubpatchModule.cpp | 37 | ||||
-rw-r--r-- | src/gui/SubpatchModule.hpp | 2 |
4 files changed, 48 insertions, 10 deletions
diff --git a/src/gui/PatchCanvas.cpp b/src/gui/PatchCanvas.cpp index 13836154..ded2cbe9 100644 --- a/src/gui/PatchCanvas.cpp +++ b/src/gui/PatchCanvas.cpp @@ -822,31 +822,36 @@ PatchCanvas::get_new_module_location(double& x, double& y) } GraphObject::Properties -PatchCanvas::get_initial_data() +PatchCanvas::get_initial_data(Resource::Graph ctx) { GraphObject::Properties result; const LV2URIMap& uris = App::instance().uris(); - result.insert(make_pair(uris.ingenui_canvas_x, Atom((float)_last_click_x))); - result.insert(make_pair(uris.ingenui_canvas_y, Atom((float)_last_click_y))); + result.insert(make_pair(uris.ingenui_canvas_x, + Resource::Property((float)_last_click_x, ctx))); + result.insert(make_pair(uris.ingenui_canvas_y, + Resource::Property((float)_last_click_y, ctx))); return result; } void PatchCanvas::menu_load_plugin() { - App::instance().window_factory()->present_load_plugin(_patch, get_initial_data()); + App::instance().window_factory()->present_load_plugin( + _patch, get_initial_data()); } void PatchCanvas::menu_load_patch() { - App::instance().window_factory()->present_load_subpatch(_patch, get_initial_data()); + App::instance().window_factory()->present_load_subpatch( + _patch, get_initial_data(Resource::EXTERNAL)); } void PatchCanvas::menu_new_patch() { - App::instance().window_factory()->present_new_subpatch(_patch, get_initial_data()); + App::instance().window_factory()->present_new_subpatch( + _patch, get_initial_data(Resource::EXTERNAL)); } void diff --git a/src/gui/PatchCanvas.hpp b/src/gui/PatchCanvas.hpp index e20aa96b..654b2dca 100644 --- a/src/gui/PatchCanvas.hpp +++ b/src/gui/PatchCanvas.hpp @@ -122,7 +122,7 @@ private: const LV2Children& children, std::set<const char*>& ancestors); - GraphObject::Properties get_initial_data(); + GraphObject::Properties get_initial_data(Resource::Graph ctx=Resource::DEFAULT); FlowCanvas::Port* get_port_view(SharedPtr<PortModel> port); diff --git a/src/gui/SubpatchModule.cpp b/src/gui/SubpatchModule.cpp index 8481d185..3cadb506 100644 --- a/src/gui/SubpatchModule.cpp +++ b/src/gui/SubpatchModule.cpp @@ -15,18 +15,25 @@ * 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA */ -#include "SubpatchModule.hpp" #include <cassert> +#include <utility> + #include "ingen/ServerInterface.hpp" #include "ingen/client/PatchModel.hpp" + #include "App.hpp" -#include "NodeModule.hpp" +#include "LV2URIMap.hpp" #include "NodeControlWindow.hpp" -#include "PatchWindow.hpp" +#include "NodeModule.hpp" #include "PatchCanvas.hpp" +#include "PatchWindow.hpp" #include "Port.hpp" +#include "SubpatchModule.hpp" #include "WindowFactory.hpp" +using namespace std; +using namespace Raul; + namespace Ingen { namespace GUI { @@ -52,6 +59,30 @@ SubpatchModule::on_double_click(GdkEventButton* event) App::instance().window_factory()->present_patch(_patch, preferred); } +void +SubpatchModule::store_location() +{ + const Atom x(static_cast<float>(property_x())); + const Atom y(static_cast<float>(property_y())); + + const LV2URIMap& uris = App::instance().uris(); + + const Atom& existing_x = _node->get_property(uris.ingenui_canvas_x); + const Atom& existing_y = _node->get_property(uris.ingenui_canvas_y); + + if (x != existing_x && y != existing_y) { + Resource::Properties remove; + remove.insert(make_pair(uris.ingenui_canvas_x, uris.wildcard)); + remove.insert(make_pair(uris.ingenui_canvas_y, uris.wildcard)); + Resource::Properties add; + add.insert(make_pair(uris.ingenui_canvas_x, + Resource::Property(x, Resource::EXTERNAL))); + add.insert(make_pair(uris.ingenui_canvas_y, + Resource::Property(y, Resource::EXTERNAL))); + App::instance().engine()->delta(_node->path(), remove, add); + } +} + /** Browse to this patch in current (parent's) window * (unless an existing window is displaying it) */ diff --git a/src/gui/SubpatchModule.hpp b/src/gui/SubpatchModule.hpp index b58c78fa..97a7d85c 100644 --- a/src/gui/SubpatchModule.hpp +++ b/src/gui/SubpatchModule.hpp @@ -53,6 +53,8 @@ public: void on_double_click(GdkEventButton* ev); + void store_location(); + void browse_to_patch(); void menu_remove(); |