From 20d28e80a5c861a9d5f449ea911ab75b4f37ad0d Mon Sep 17 00:00:00 2001 From: Jef Date: Tue, 24 Sep 2024 14:54:57 +0200 Subject: Initial community commit --- .../skins/Big Bento/scripts/timecontrol.m | 89 ++++++++++++++++++++++ 1 file changed, 89 insertions(+) create mode 100644 Src/resources/skins/Big Bento/scripts/timecontrol.m (limited to 'Src/resources/skins/Big Bento/scripts/timecontrol.m') diff --git a/Src/resources/skins/Big Bento/scripts/timecontrol.m b/Src/resources/skins/Big Bento/scripts/timecontrol.m new file mode 100644 index 00000000..f801e233 --- /dev/null +++ b/Src/resources/skins/Big Bento/scripts/timecontrol.m @@ -0,0 +1,89 @@ +/*--------------------------------------------------- +----------------------------------------------------- +Filename: timecontrol.m +Version: 1.0 + +Type: maki +Date: 29. Jun. 2007 - 00:13 +Author: Martin Poehlmann aka Deimos +E-Mail: martin@skinconsortium.com +Internet: www.skinconsortium.com + www.martin.deimos.de.vu +----------------------------------------------------- +---------------------------------------------------*/ + +#include +#include +#include + +Function updateAttrib (int val); + +Global ConfigAttribute timeAttrib; +Global text Display; +Global AutoRepeatButton Increase, Decrease; +Global float multiplier; +Global int maxvalue, step; +Global string suffix; +Global boolean myChange; + +System.onScriptLoaded () +{ + AutoRepeat_Load(); + string param = getParam(); + + string objects = getToken(param, "|", 0); + group scriptGroup = getScriptGroup(); + Display = scriptGroup.findObject(getToken(objects, ";", 0)); + Decrease = scriptGroup.findObject(getToken(objects, ";", 1)); + Increase = scriptGroup.findObject(getToken(objects, ";", 2)); + + objects = getToken(param, "|", 1); + timeAttrib = config.getItemByGuid(getToken(objects, ";", 0)).getattribute(getToken(objects, ";", 1)); + + step = stringToInteger(getToken(param, "|", 2)); + maxvalue = stringToInteger(getToken(param, "|", 3)); + multiplier = stringToFloat(getToken(param, "|", 4)); + suffix = getToken(param, "|", 5); + + AutoRepeat_SetInitalDelay(250); + AutoRepeat_SetRepeatDelay(125); + + updateAttrib (0); +} + +System.onScriptUnloading () +{ + AutoRepeat_Unload(); +} + +Increase.onLeftClick () +{ + if (!AutoRepeat_ClickType) return; + updateAttrib (step); +} + +Decrease.onLeftClick () +{ + if (!AutoRepeat_ClickType) return; + updateAttrib (-step); +} + +timeAttrib.onDataChanged () +{ + if (myChange) return; + updateAttrib (0); +} + +updateAttrib (int val) +{ + float i = stringToInteger(timeAttrib.getData()); + i += val; + if (i < 0 || i > maxvalue) return; + myChange = 1; + string s = integerToString(i); + if (timeAttrib) timeAttrib.setData(s); + i *= multiplier; + s = floatToString(i,1); + Display.setText(s + suffix); + myChange = 0; +} \ No newline at end of file -- cgit