summaryrefslogtreecommitdiffstats
path: root/src/gui
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2011-09-23 20:42:57 +0000
committerDavid Robillard <d@drobilla.net>2011-09-23 20:42:57 +0000
commit1af9036d30ba65c6ec5e04902cdfdcfc88478e62 (patch)
tree9457903afda2eb3faceca5ae850bdd17e75215e7 /src/gui
parent53347ae88e643ce3fea887b56e843c0fa464eee5 (diff)
downloadingen-1af9036d30ba65c6ec5e04902cdfdcfc88478e62.tar.gz
ingen-1af9036d30ba65c6ec5e04902cdfdcfc88478e62.tar.bz2
ingen-1af9036d30ba65c6ec5e04902cdfdcfc88478e62.zip
Fix patch port canvas positioning across save/load.
git-svn-id: http://svn.drobilla.net/lad/trunk/ingen@3479 a436a847-0d15-0410-975c-d299462d15a1
Diffstat (limited to 'src/gui')
-rw-r--r--src/gui/NodeModule.cpp12
-rw-r--r--src/gui/PatchPortModule.cpp20
2 files changed, 17 insertions, 15 deletions
diff --git a/src/gui/NodeModule.cpp b/src/gui/NodeModule.cpp
index d087b883..8f66b3bd 100644
--- a/src/gui/NodeModule.cpp
+++ b/src/gui/NodeModule.cpp
@@ -352,24 +352,22 @@ NodeModule::on_double_click(GdkEventButton* ev)
void
NodeModule::store_location()
{
- const float x = static_cast<float>(property_x());
- const float y = static_cast<float>(property_y());
+ 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 (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
- || existing_x.get_float() != x || existing_y.get_float() != 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, Atom(x)));
- add.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
+ add.insert(make_pair(uris.ingenui_canvas_x, x));
+ add.insert(make_pair(uris.ingenui_canvas_y, y));
App::instance().engine()->delta(_node->path(), remove, add);
- // FIXME: context
}
}
diff --git a/src/gui/PatchPortModule.cpp b/src/gui/PatchPortModule.cpp
index 4c2b321b..15c26392 100644
--- a/src/gui/PatchPortModule.cpp
+++ b/src/gui/PatchPortModule.cpp
@@ -80,20 +80,24 @@ PatchPortModule::show_menu(GdkEventButton* ev)
void
PatchPortModule::store_location()
{
- const float x = static_cast<float>(property_x());
- const float y = static_cast<float>(property_y());
+ 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 = _model->get_property(uris.ingenui_canvas_x);
const Atom& existing_y = _model->get_property(uris.ingenui_canvas_y);
- if (existing_x.type() != Atom::FLOAT || existing_y.type() != Atom::FLOAT
- || existing_x.get_float() != x || existing_y.get_float() != y) {
- Resource::Properties props;
- props.insert(make_pair(uris.ingenui_canvas_x, Atom(x)));
- props.insert(make_pair(uris.ingenui_canvas_y, Atom(y)));
- App::instance().engine()->put(_model->path(), props, Resource::INTERNAL);
+ 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::INTERNAL)));
+ add.insert(make_pair(uris.ingenui_canvas_y,
+ Resource::Property(y, Resource::INTERNAL)));
+ App::instance().engine()->delta(_model->path(), remove, add);
}
}