components_data_OptionsData.bs
import "pkg:/source/utils/config.bs"
import "pkg:/source/utils/misc.bs"
sub init()
m.top.valueIndex = 0
end sub
sub updateTitle()
if m.top.choices.count() = 0
m.top.title = m.top.baseTitle + ": <none>"
return
end if
for i = 0 to m.top.choices.count() - 1
if m.top.choices[i].value = m.top.value
m.top.valueIndex = i
exit for
end if
end for
m.top.title = m.top.baseTitle + ": " + m.top.choices[m.top.valueIndex].display
end sub
sub press()
maxOpt = m.top.choices.count()
i = m.top.valueIndex + 1
while i >= maxOpt
i = i - maxOpt
end while
m.top.valueIndex = i
m.top.value = m.top.choices[m.top.valueIndex].value
if m.top.configKey = "" or not isValid(m.top.configKey)
return
end if
if m.top.isGlobalSetting
setSetting(m.top.configKey, m.top.value)
else
setUserSetting(m.top.configKey, m.top.value)
end if
end sub