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/SubpatchModule.cpp | |
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/SubpatchModule.cpp')
-rw-r--r-- | src/gui/SubpatchModule.cpp | 37 |
1 files changed, 34 insertions, 3 deletions
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) */ |