Allow UI scaling of 4 in Scenario Editor
dialog.cpp[cleaning]: remove unused code
This commit is contained in:
@@ -6,8 +6,14 @@
|
||||
BoE Scenario Editor Preferences
|
||||
</text>
|
||||
<led name='nosound' relative='pos-in pos' rel-anchor='prev' top='10' left='0' width='117'>No Sounds</led>
|
||||
<led name='scaleui' relative='pos-in pos' rel-anchor='prev' top='10' left='0' width='340'>Apply UI scaling</led>
|
||||
|
||||
<button name='okay' relative='abs pos' rel-anchor='prev' type='regular' top='7' left='354'>OK</button>
|
||||
<text name='scale-head' size='large' relative='pos-in pos' rel-anchor='prev' top='10' left='00' width='260' height='17'>Scale UI:</text>
|
||||
<group name='scaleui'>
|
||||
<led name='1' relative='pos-in pos' anchor='scale-head' top='4' left='15' width='33'>1</led>
|
||||
<led name='2' relative='pos-in pos' anchor='scale-head' top='4' left='55' width='33'>2</led>
|
||||
<led name='4' relative='pos-in pos' anchor='scale-head' top='4' left='95' width='33'>4</led>
|
||||
<led name='other' relative='pos-in pos' anchor='scale-head' top='4' left='135' width='43'>other</led>
|
||||
</group>
|
||||
|
||||
<button name='okay' relative='abs pos' anchor='scale-head' type='regular' top='7' left='354'>OK</button>
|
||||
<button name='cancel' relative='neg pos-in' anchor='okay' type='regular' def-key='esc' top='0' left='73'>Cancel</button>
|
||||
</dialog>
|
||||
|
@@ -512,15 +512,6 @@ void cDialog::run(std::function<void(cDialog&)> onopen){
|
||||
currentFocus = iter->first;
|
||||
}
|
||||
}
|
||||
#if 0
|
||||
// Sometimes it seems like the Cocoa menu handling clobbers the active rendering context.
|
||||
// For whatever reason, delaying 100 milliseconds appears to fix this.
|
||||
sf::sleep(sf::milliseconds(100));
|
||||
// So this little section of code is a real-life valley of dying things.
|
||||
// Instantiating a window and then closing it seems to fix the update error, because magic.
|
||||
win.create(sf::VideoMode(1,1),"");
|
||||
win.close();
|
||||
#endif
|
||||
if (ui_scale<=0) {
|
||||
ui_scale = get_float_pref("UIScale", 1.0);
|
||||
if (ui_scale < 0.1) ui_scale = 1.0;
|
||||
|
@@ -28,6 +28,7 @@
|
||||
#include "button.hpp"
|
||||
#include "keycodes.hpp"
|
||||
#include "led.hpp"
|
||||
#include "ledgroup.hpp"
|
||||
#include "prefs.hpp"
|
||||
#include "framerate_limiter.hpp"
|
||||
#include "event_listener.hpp"
|
||||
@@ -679,11 +680,13 @@ bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
|
||||
}
|
||||
|
||||
if(!did_cancel) {
|
||||
cLed& ui_scale = dynamic_cast<cLed&>(me["scaleui"]);
|
||||
if(ui_scale.getState() == led_off)
|
||||
std::string scale = dynamic_cast<cLedGroup&>(me["scaleui"]).getSelected();
|
||||
if(scale == "1")
|
||||
set_pref("UIScale", 1.0);
|
||||
else if(ui_scale.getState() == led_red)
|
||||
else if(scale == "2")
|
||||
set_pref("UIScale", 2.0);
|
||||
else if(scale == "4")
|
||||
set_pref("UIScale", 4.0);
|
||||
set_pref("PlaySounds", dynamic_cast<cLed&>(me["nosound"]).getState() == led_off);
|
||||
}
|
||||
save_prefs();
|
||||
@@ -697,7 +700,12 @@ void pick_preferences() {
|
||||
prefsDlog.attachClickHandlers(&prefs_event_filter, {"okay", "cancel"});
|
||||
|
||||
float ui_scale = get_float_pref("UIScale", 1.0);
|
||||
dynamic_cast<cLed&>(prefsDlog["scaleui"]).setState(ui_scale == 1.0 ? led_off : (ui_scale == 2.0 ? led_red : led_green));
|
||||
cLedGroup& uiScale = dynamic_cast<cLedGroup&>(prefsDlog["scaleui"]);
|
||||
if (ui_scale>0.95 && ui_scale<1.05) uiScale.setSelected("1");
|
||||
else if (ui_scale>1.95 && ui_scale<2.05) uiScale.setSelected("2");
|
||||
else if (ui_scale>3.95 && ui_scale<4.05) uiScale.setSelected("4");
|
||||
else uiScale.setSelected("other");
|
||||
|
||||
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySounds", true) ? led_off : led_red);
|
||||
|
||||
prefsDlog.run();
|
||||
|
Reference in New Issue
Block a user