From 9ebe154964c4d335e74026f653de24beb3699dab Mon Sep 17 00:00:00 2001 From: arch1t3cht Date: Sun, 14 Aug 2022 16:24:50 +0200 Subject: [PATCH] Fix width of lua float edits Float edits with a spinner are by default sized to fit their full min-max range of possible values, so this makes min and max default to 0 and 100 (like it'd done internally in wx) instead of -DOUBLE_MAX and DOUBLE_MAX. Note that this does change the behavior of lua dialogs, but does not contradict existing documentation or specification. It should only affect scripts who either disobey the specification by specifying only one value out of max/min, or scripts displaying these large float edits by specifing a step, but no max or min. --- src/auto4_lua_dialog.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/auto4_lua_dialog.cpp b/src/auto4_lua_dialog.cpp index 7985c49b9..7b4b5fa0c 100644 --- a/src/auto4_lua_dialog.cpp +++ b/src/auto4_lua_dialog.cpp @@ -284,6 +284,10 @@ namespace Automation4 { max = DBL_MAX; min = -DBL_MAX; } + if (step != 0.0) { + min = min == -DBL_MAX ? 0.0 : min; + max = max == DBL_MAX ? 100.0 : max; + } } bool CanSerialiseValue() const override { return true; }