Allow UI scaling to be 4 in Chararacter Editor

locked-door-action.xml: add b and p shortcuts
This commit is contained in:
ALONSO Laurent
2021-10-06 14:10:52 +02:00
committed by Celtic Minstrel
parent cd6eebdebe
commit 80c362eb60
3 changed files with 33 additions and 18 deletions

View File

@@ -2,8 +2,8 @@
<?xml-stylesheet href="dialog.xsl" type="text/xsl"?>
<dialog defbtn='leave'>
<button name='leave' type='regular' top='36' left='271'>Leave</button>
<button name='pick' type='large' top='36' left='161'>Pick Lock</button>
<button name='bash' type='large' top='36' left='50'>Bash Door</button>
<button name='pick' type='large' def-key='p' top='36' left='161'>Pick Lock</button>
<button name='bash' type='large' def-key='b' top='36' left='50'>Bash Door</button>
<text top='8' left='50' width='252' height='19'>
This door is locked.
What do you do?

View File

@@ -6,8 +6,14 @@
BoE Character 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>
<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' rel-anchor='prev' type='regular' top='7' left='354'>OK</button>
<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>

View File

@@ -7,22 +7,24 @@
#include "pc.editors.hpp"
#include "pc.action.hpp"
#include "pc.fileio.hpp"
#include "button.hpp"
#include "choicedlog.hpp"
#include "control.hpp"
#include "cursors.hpp"
#include "dialog.hpp"
#include "fileio.hpp"
#include "led.hpp"
#include "ledgroup.hpp"
#include "prefs.hpp"
#include "strdlog.hpp"
#include "strchoice.hpp"
#include "sounds.hpp"
#include "render_image.hpp"
#include "tiling.hpp"
#include "utility.hpp"
#include "dialog.hpp"
#include "control.hpp"
#include "strdlog.hpp"
#include "choicedlog.hpp"
#include "strchoice.hpp"
#include "fileio.hpp"
#include "pc.menus.hpp"
#include "winutil.hpp"
#include "cursors.hpp"
#include "pc.menus.hpp"
#include "res_image.hpp"
#include "button.hpp"
#include "prefs.hpp"
#include "framerate_limiter.hpp"
#ifdef __APPLE__
@@ -517,11 +519,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();
@@ -535,7 +539,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();