summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDavid Robillard <d@drobilla.net>2020-11-29 18:42:04 +0100
committerDavid Robillard <d@drobilla.net>2020-11-29 18:42:04 +0100
commit272369a4a40cd46123d4741571b6fcc7c6d8c3a8 (patch)
tree08c83725ae5ca16970e000996f5c65edb6ac4e3a
parent98e2535b82ab601081a56c8a22d789d2da25cfd8 (diff)
downloadpatchage-272369a4a40cd46123d4741571b6fcc7c6d8c3a8.tar.gz
patchage-272369a4a40cd46123d4741571b6fcc7c6d8c3a8.tar.bz2
patchage-272369a4a40cd46123d4741571b6fcc7c6d8c3a8.zip
Fix unstable module positions
-rw-r--r--NEWS3
-rw-r--r--src/CanvasModule.cpp7
-rw-r--r--src/Configuration.cpp5
3 files changed, 12 insertions, 3 deletions
diff --git a/NEWS b/NEWS
index 9221a55..f296268 100644
--- a/NEWS
+++ b/NEWS
@@ -4,11 +4,12 @@ patchage (1.0.3) unstable;
* Add command line option to print version
* Fix making and breaking connections with Jack DBus
* Fix sample rate with Jack DBus
+ * Fix unstable module positions
* Improve man page
* Remove Jack session support
* Remove flaky DSP load meter
- -- David Robillard <d@drobilla.net> Sun, 29 Nov 2020 15:54:01 +0000
+ -- David Robillard <d@drobilla.net> Sun, 29 Nov 2020 17:41:44 +0000
patchage (1.0.2) stable;
diff --git a/src/CanvasModule.cpp b/src/CanvasModule.cpp
index c049346..dc0af4e 100644
--- a/src/CanvasModule.cpp
+++ b/src/CanvasModule.cpp
@@ -115,7 +115,12 @@ CanvasModule::load_location()
if (_app->conf().get_module_location(_name, _type, loc)) {
move_to(loc.x, loc.y);
} else {
- move_to(20 + rand() % 640, 20 + rand() % 480);
+ const double x = 20 + rand() % 640;
+ const double y = 20 + rand() % 480;
+
+ // Move, then store generated location so it is stable
+ move_to(x, y);
+ store_location(x, y);
}
}
diff --git a/src/Configuration.cpp b/src/Configuration.cpp
index 6158702..f667b1b 100644
--- a/src/Configuration.cpp
+++ b/src/Configuration.cpp
@@ -346,9 +346,12 @@ Configuration::save()
const ModuleSettings& settings = s.second;
if (settings.split) {
- if (settings.input_location && settings.output_location) {
+ if (settings.input_location) {
write_module_position(
file, name, "input", *settings.input_location);
+ }
+
+ if (settings.output_location) {
write_module_position(
file, name, "output", *settings.output_location);
}