nextStyle: switch to next available style, allowing the index range to
have holes. That way people can start their private styles with e.g. 100 and can be sure that the system doesn't mess with them.
This commit is contained in:
parent
8a974bc9c1
commit
b6b39def59
1 changed files with 9 additions and 8 deletions
|
@ -377,18 +377,19 @@ var dialog_update = func(dialog, objects...) {
|
|||
# GUI theming
|
||||
########################################################################
|
||||
|
||||
nextStyle = func {
|
||||
numStyles = size(props.globals.getNode("/sim/gui").getChildren("style"));
|
||||
curr = getprop("/sim/gui/current-style") + 1;
|
||||
if (curr >= numStyles) {
|
||||
curr = 0;
|
||||
}
|
||||
setprop("/sim/gui/current-style", curr);
|
||||
var nextStyle = func {
|
||||
var curr = getprop("/sim/gui/current-style");
|
||||
var styles = props.globals.getNode("/sim/gui").getChildren("style");
|
||||
forindex (var i; styles)
|
||||
if (styles[i].getIndex() == curr)
|
||||
break;
|
||||
if ((i += 1) >= size(styles))
|
||||
i = 0;
|
||||
setprop("/sim/gui/current-style", styles[i].getIndex());
|
||||
fgcommand("gui-redraw");
|
||||
}
|
||||
|
||||
|
||||
|
||||
########################################################################
|
||||
# Dialog Boxes
|
||||
########################################################################
|
||||
|
|
Loading…
Add table
Reference in a new issue