Don't show an 'other' option for UI scale unless it's actually selected
This commit is contained in:
@@ -45,7 +45,7 @@
|
||||
<led name='2' relative='pos-in pos' anchor='scale-head' top='4' left='95' width='33'>2</led>
|
||||
<led name='3' relative='pos-in pos' anchor='scale-head' top='4' left='135' width='33'>3</led>
|
||||
<led name='4' relative='pos-in pos' anchor='scale-head' top='4' left='175' width='33'>4</led>
|
||||
<led name='other' relative='pos-in pos' anchor='scale-head' top='4' left='215' width='43'>other</led>
|
||||
<led name='other' relative='pos-in pos' anchor='scale-head' top='4' left='215' width='85'/>
|
||||
</group>
|
||||
<text name='scalemap-head' size='large' relative='neg pos' anchor='scale-head' top='17' left='0' width='260' height='17'>Scale Map:</text>
|
||||
<group name='scalemap'>
|
||||
@@ -54,7 +54,7 @@
|
||||
<led name='2' relative='pos-in pos' anchor='scalemap-head' top='4' left='95' width='33'>2</led>
|
||||
<led name='3' relative='pos-in pos' anchor='scalemap-head' top='4' left='135' width='33'>3</led>
|
||||
<led name='4' relative='pos-in pos' anchor='scalemap-head' top='4' left='175' width='33'>4</led>
|
||||
<led name='other' relative='pos-in pos' anchor='scalemap-head' top='4' left='215' width='43'>other</led>
|
||||
<led name='other' relative='pos-in pos' anchor='scalemap-head' top='4' left='215' width='85'/>
|
||||
</group>
|
||||
<button name='okay' relative='abs pos' anchor='scalemap-head' type='regular' top='17' left='354'>OK</button>
|
||||
<button name='cancel' relative='neg pos-in' anchor='okay' type='regular' def-key='esc' top='0' left='73'>Cancel</button>
|
||||
|
@@ -1249,6 +1249,31 @@ void pick_preferences() {
|
||||
else if (ui_map_scale>2.95 && ui_map_scale<3.05) uiMapScale.setSelected("3");
|
||||
else if (ui_map_scale>3.95 && ui_map_scale<4.05) uiMapScale.setSelected("4");
|
||||
else uiMapScale.setSelected("other");
|
||||
|
||||
if(uiScale.getSelected() == "other") {
|
||||
auto val = std::to_string(ui_scale);
|
||||
while(val.length() > 2 && val[val.length() - 1] == val[val.length() - 2]) {
|
||||
val.pop_back();
|
||||
}
|
||||
while(val.length() > 1 && (val.back() == '.' || val.back() == '0')) {
|
||||
val.pop_back();
|
||||
}
|
||||
uiScale["other"].setText("Custom: " + val);
|
||||
} else {
|
||||
uiScale["other"].hide();
|
||||
}
|
||||
if(uiMapScale.getSelected() == "other") {
|
||||
auto val = std::to_string(ui_map_scale);
|
||||
while(val.length() > 2 && val[val.length() - 1] == val[val.length() - 2]) {
|
||||
val.pop_back();
|
||||
}
|
||||
while(val.length() > 1 && (val.back() == '.' || val.back() == '0')) {
|
||||
val.pop_back();
|
||||
}
|
||||
uiMapScale["other"].setText("Custom: " + val);
|
||||
} else {
|
||||
uiMapScale["other"].hide();
|
||||
}
|
||||
|
||||
void (*give_help)(short,short,cDialog&) = ::give_help;
|
||||
|
||||
|
Reference in New Issue
Block a user