Boe Character/Scenario Editor[OsX]: retrieve also PlaySound in the preferences...

This commit is contained in:
Laurent Alonso(fr)
2020-06-10 16:01:06 +02:00
committed by Celtic Minstrel
parent 141b668eb6
commit 34d3431e49
4 changed files with 9 additions and 3 deletions

View File

@@ -5,7 +5,8 @@
<text size='large' relative='pos pos-in' rel-anchor='prev' top='0' left='4' width='218' height='16'>
BoE Character Editor Preferences
</text>
<led name='scaleui' relative='pos-in pos' rel-anchor='prev' top='31' left='0' width='340'>Apply UI scaling</led>
<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>
<button name='cancel' relative='neg pos-in' anchor='okay' type='regular' def-key='esc' top='0' left='73'>Cancel</button>

View File

@@ -5,7 +5,8 @@
<text size='large' relative='pos pos-in' rel-anchor='prev' top='0' left='4' width='218' height='16'>
BoE Scenario Editor Preferences
</text>
<led name='scaleui' relative='pos-in pos' rel-anchor='prev' top='31' left='0' width='340'>Apply UI scaling</led>
<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>
<button name='cancel' relative='neg pos-in' anchor='okay' type='regular' def-key='esc' top='0' left='73'>Cancel</button>

View File

@@ -516,6 +516,7 @@ bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
set_pref("UIScale", 1.0);
else if(ui_scale.getState() == led_red)
set_pref("UIScale", 2.0);
set_pref("PlaySounds", dynamic_cast<cLed&>(me["nosound"]).getState() == led_off);
}
save_prefs();
return true;
@@ -529,6 +530,7 @@ void pick_preferences() {
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));
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySounds", true) ? led_off : led_red);
prefsDlog.run();

View File

@@ -655,7 +655,7 @@ void handle_menu_choice(eMenu item_hit) {
void save_prefs(){
bool success = sync_prefs();
if(!success){
showWarning("There was a problem writing to the preferences file. When the game is next run the preferences will revert to their previously set values.","Should you manage to resolve the problem without closing the program, simply open the preferences screen and click \"OK\" to try again.");
showWarning("There was a problem writing to the preferences file. When the Scenerio Editor is next run the preferences will revert to their previously set values.","Should you manage to resolve the problem without closing the program, simply open the preferences screen and click \"OK\" to try again.");
}
}
@@ -675,6 +675,7 @@ bool prefs_event_filter (cDialog& me, std::string id, eKeyMod) {
set_pref("UIScale", 1.0);
else if(ui_scale.getState() == led_red)
set_pref("UIScale", 2.0);
set_pref("PlaySounds", dynamic_cast<cLed&>(me["nosound"]).getState() == led_off);
}
save_prefs();
return true;
@@ -688,6 +689,7 @@ void pick_preferences() {
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));
dynamic_cast<cLed&>(prefsDlog["nosound"]).setState(get_bool_pref("PlaySounds", true) ? led_off : led_red);
prefsDlog.run();