From dbebf1346507d502a247f9c48a8367fbc475d4ac Mon Sep 17 00:00:00 2001 From: Zeno Rogue Date: Tue, 9 Sep 2025 16:56:47 +0200 Subject: [PATCH] nicer help for number dialogs --- dialogs.cpp | 76 ++++++++++++++++++++++++++++++++----------------- language-cz.cpp | 4 +-- language-fr.cpp | 4 +-- language-pl.cpp | 4 +-- language-zh.cpp | 4 +-- util.cpp | 11 ++++++- 6 files changed, 68 insertions(+), 35 deletions(-) diff --git a/dialogs.cpp b/dialogs.cpp index 72dc975b..c157d527 100644 --- a/dialogs.cpp +++ b/dialogs.cpp @@ -1383,38 +1383,62 @@ EX namespace dialog { init("number dialog help"); dialog::addBreak(100); dialog::addHelp(XLAT("You can enter formulas in this dialog.")); - dialog::addBreak(100); - dialog::addHelp(XLAT("Functions available:")); - addHelp(available_functions()); - dialog::addBreak(100); - dialog::addHelp(XLAT("Constants and variables available:")); - addHelp(available_constants()); - if(ptr && ptr->animatable) { + + dialog::addBreak(150); + + dialog::addItem("functions and constants", 'f'); + dialog::add_action_push([] { + init("functions and constants"); + dialog::addHelp(XLAT("Functions available:")); + addHelp(available_functions()); dialog::addBreak(100); - dialog::addHelp(XLAT("Animations:")); - dialog::addHelp(XLAT("a..b -- animate linearly from a to b")); - dialog::addHelp(XLAT("a..b..|c..d -- animate from a to b, then from c to d")); - dialog::addHelp(XLAT("a../x..b../y -- change smoothly, x and y are derivatives")); - } - - /* "Most parameters can be animated simply by using '..' in their editing dialog. " - "For example, the value of a parameter set to 0..1 will grow linearly from 0 to 1. " - "You can also use functions (e.g. cos(0..2*pi)) and refer to other parameters." - )); */ - + dialog::addHelp(XLAT("Constants available:")); + addHelp(available_constants()); + dialog::addBreak(100); + dialog::addBack(); + dialog::display(); + }); + + dialog::addItem("variables", 'v'); + dialog::add_action_push([] { + init("variables"); + addHelp(available_variables()); + dialog::addBreak(100); + dialog::addBack(); + dialog::display(); + }); + #if CAP_ANIMATIONS - dialog::addBreak(50); auto f = find_edit(!ptr ? nullptr : ptr->intval ? (void*) ptr->intval : (void*) ptr->editwhat); if(f) - dialog::addHelp(XLAT("Parameter names, e.g. '%1'", f->name)); + dialog::addItem(XLAT("parameter names, e.g. '%1'", f->name), 'p'); else - dialog::addHelp(XLAT("Parameter names")); - dialog::addBreak(50); - for(auto& ap: anims::aps) { - dialog::addInfo(ap.par->name + " = " + ap.formula); - } + dialog::addItem(XLAT("parameter names"), 'p'); + dialog::add_action_push([] { + init("parameter names"); + for(auto& ap: anims::aps) { + dialog::addInfo(ap.par->name + " = " + ap.formula); + } + dialog::addBreak(100); + dialog::addBack(); + dialog::display(); + }); #endif - dialog::addBreak(50); + + if(ptr && ptr->animatable) { + dialog::addItem("animations", 'a'); + dialog::add_action_push([] { + init("Animations:"); + dialog::addHelp(XLAT("a..b -- animate linearly from a to b")); + dialog::addHelp(XLAT("a..b..|c..d -- animate from a to b, then from c to d")); + dialog::addHelp(XLAT("a../x..b../y -- change smoothly, x and y are derivatives")); + dialog::addBreak(100); + dialog::addBack(); + dialog::display(); + }); + } + + dialog::addBreak(150); dialog::addHelp(XLAT("These can be combined, e.g. %1", "projection*sin(0..2*pi)")); display(); } diff --git a/language-cz.cpp b/language-cz.cpp index 762e422e..ab3afa66 100644 --- a/language-cz.cpp +++ b/language-cz.cpp @@ -8833,8 +8833,8 @@ S("Animations:", "Animace:") S("a..b -- animate linearly from a to b", "a..b -- animovat lineárně od a do b") S("a..b..|c..d -- animate from a to b, then from c to d", "a..b..|c..d -- animovat od a do b, potom od c do d") S("a../x..b../y -- change smoothly, x and y are derivatives", "a../x..b../y -- hladká změna; x a y jsou derivace") -S("Parameter names, e.g. '%1'", "Názvy parametrů, např. '%1'") -S("Parameter names", "Názvy parametrů") +S("parameter names, e.g. '%1'", "názvy parametrů, např. '%1'") +S("parameter names", "názvy parametrů") S("These can be combined, e.g. %1", "Je možné je kombinovat, např. %1") // manifolds diff --git a/language-fr.cpp b/language-fr.cpp index 334d9257..a1d0741b 100644 --- a/language-fr.cpp +++ b/language-fr.cpp @@ -8447,8 +8447,8 @@ S("Animations:", "Animations : ") S("a..b -- animate linearly from a to b", "a..b -- anime linéairement de a à b") S("a..b..|c..d -- animate from a to b, then from c to d", "a..b..|c..d -- anime de a à b, puis de c à d") S("a../x..b../y -- change smoothly, x and y are derivatives", "a../x..b../y -- change doucement, x et y sont dérivées") -S("Parameter names, e.g. '%1'", "Noms des paramètres, par exemple '%1'") -S("Parameter names", "Noms des paramètres") +S("parameter names, e.g. '%1'", "noms des paramètres, par exemple '%1'") +S("parameter names", "noms des paramètres") S("These can be combined, e.g. %1", "Ceux là peuvent être combinés, par exemple %1") // manifolds diff --git a/language-pl.cpp b/language-pl.cpp index ad423a82..4393571a 100644 --- a/language-pl.cpp +++ b/language-pl.cpp @@ -8557,8 +8557,8 @@ S("Animations:", "Animacje:") S("a..b -- animate linearly from a to b", "a..b -- animuj liniowo od a do b") S("a..b..|c..d -- animate from a to b, then from c to d", "a..b..|c..d -- animuj od a do b, potem od c do d") S("a../x..b../y -- change smoothly, x and y are derivatives", "a../x..b../y -- gładka zmiana, x i y to pochodne") -S("Parameter names, e.g. '%1'", "Nazwy parametrów, np. '%1'") -S("Parameter names", "Nazwy parametrów") +S("parameter names, e.g. '%1'", "nazwy parametrów, np. '%1'") +S("parameter names", "nazwy parametrów") S("These can be combined, e.g. %1", "Można łączyć, np. %1") // manifolds diff --git a/language-zh.cpp b/language-zh.cpp index 40cf98e6..11dc092e 100644 --- a/language-zh.cpp +++ b/language-zh.cpp @@ -7734,8 +7734,8 @@ S("Animations:", "动态化:") S("a..b -- animate linearly from a to b", "a..b——从a至b线性动态化") S("a..b..|c..d -- animate from a to b, then from c to d", "a..b..|c..d——从a至b,然后从c至d动态化") S("a../x..b../y -- change smoothly, x and y are derivatives", "a../x..b../y——平滑改变,x与y为导数") -S("Parameter names, e.g. '%1'", "参数名称,如“%1”") -S("Parameter names", "参数名称") +S("parameter names, e.g. '%1'", "参数名称,如“%1”") +S("parameter names", "参数名称") S("These can be combined, e.g. %1", "这些可以互相结合,如%1") // manifolds diff --git a/util.cpp b/util.cpp index ba3485b7..dfe51944 100644 --- a/util.cpp +++ b/util.cpp @@ -720,8 +720,17 @@ EX string available_functions() { } EX string available_constants() { + return + "e, i, pi, tau, phi, deg [degree]"; + } + +EX string available_variables() { return - "e, i, pi, s, ms, mousex, mousey, mousez, shot [1 if taking screenshot/animation]"; + "Keyboard and mouse:\n\n" + "mousex, mousey, mousez, lshift, rshift, lctrl, rctrl, capslock, numlock, scrolllock, holdmouse, random, mousexs, mouseys\n\n" + "Time:\n\n" + "s [seconds], ms [milliseconds], turncount, framecount, gametime\n\n" + "Other:\n\nshot [1 if taking screenshot/animation], illegal_moves"; } #if HDR