Merge pull request #603 from CelticMinstrel/prefs_stuff
Font scaling and reimplemented orb colors
|
@ -176,13 +176,13 @@
|
|||
type=custom
|
||||
[/advanced_preference]
|
||||
|
||||
#ifdef __UNUSED__
|
||||
[advanced_preference]
|
||||
field=orb_color
|
||||
name= _ "Customize orb colors (unimplemented)"
|
||||
name= _ "Customize orb colors"
|
||||
type=custom
|
||||
[/advanced_preference]
|
||||
|
||||
#ifdef __UNUSED__
|
||||
[advanced_preference]
|
||||
field=joystick_support_enabled
|
||||
name= _ "Joystick support"
|
||||
|
|
|
@ -13,28 +13,13 @@
|
|||
rgb=FF0000,FFFFFF,000000,FF0000
|
||||
name= _ "Red"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=orb_3red
|
||||
rgb=FF0000,FFFFFF,000000,FF0000
|
||||
name= _ "Red"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_lightred
|
||||
rgb=D1620D,FFFFFF,000000,FF0000
|
||||
name= _ "Light Red"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=lightred
|
||||
rgb=D1620D,FFFFFF,000000,FF0000
|
||||
name= _ "Light Red"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_darkred
|
||||
rgb=8A0808,FFFFFF,000000,FF0000
|
||||
name= _ "Dark Red"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=darkred
|
||||
rgb=8A0808,FFFFFF,000000,FF0000
|
||||
|
@ -46,17 +31,7 @@
|
|||
rgb=2E419B,FFFFFF,0F0F0F,0000FF
|
||||
name= _ "Blue"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=orb_6blue
|
||||
rgb=2E419B,FFFFFF,0F0F0F,0000FF
|
||||
name= _ "Blue"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_5lightblue
|
||||
rgb=00A4FF,FFFFFF,000A21,00A4FF
|
||||
name= _ "Light blue"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=lightblue
|
||||
rgb=00A4FF,FFFFFF,000A21,00A4FF
|
||||
|
@ -69,11 +44,6 @@
|
|||
name= _ "Green"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_1brightgreen
|
||||
rgb=8CFF00,EBFFBF,2D4001,8CFF00
|
||||
name= _ "Bright green"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=brightgreen
|
||||
rgb=8CFF00,EBFFBF,2D4001,8CFF00
|
||||
|
@ -92,12 +62,6 @@
|
|||
name= _ "Black"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_6black
|
||||
rgb=5A5A5A,FFFFFF,000000,000000
|
||||
name= _ "Black"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=brown
|
||||
rgb=945027,FFFFFF,000000,AA4600
|
||||
|
@ -111,7 +75,7 @@
|
|||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=orb_2brightorange
|
||||
id=brightorange
|
||||
rgb=FFC600,FFF7E6,792A00,FFC600
|
||||
name= _ "Bright orange"
|
||||
[/color_range]
|
||||
|
@ -121,11 +85,6 @@
|
|||
rgb=E1E1E1,FFFFFF,1E1E1E,FFFFFF
|
||||
name= _ "White"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=orb_7white
|
||||
rgb=E1E1E1,FFFFFF,1E1E1E,FFFFFF
|
||||
name= _ "White"
|
||||
[/color_range]
|
||||
|
||||
[color_range]
|
||||
id=teal
|
||||
|
@ -138,11 +97,6 @@
|
|||
rgb=FFF35A,FFF8D2,994F13,FFF35A
|
||||
name= _ "Gold"
|
||||
[/color_range]
|
||||
[color_range]
|
||||
id=orb_8gold
|
||||
rgb=FFF35A,FFF8D2,994F13,FFF35A
|
||||
name= _ "Gold"
|
||||
[/color_range]
|
||||
|
||||
# The following team colors are an extended palette meant specifically to recolor the background of terrain type icons
|
||||
# Each color range is named after the terrain type it corresponds to.
|
||||
|
|
|
@ -47,11 +47,11 @@
|
|||
footprint_teleport_exit="footsteps/teleport-out.png"
|
||||
|
||||
[colors]
|
||||
enemy_orb_color="orb_6black"
|
||||
unmoved_orb_color="orb_1brightgreen"
|
||||
ally_orb_color="orb_5lightblue"
|
||||
partial_orb_color="orb_2brightorange"
|
||||
moved_orb_color="orb_3red"
|
||||
enemy_orb_color="black"
|
||||
unmoved_orb_color="brightgreen"
|
||||
ally_orb_color="lightblue"
|
||||
partial_orb_color="brightorange"
|
||||
moved_orb_color="red"
|
||||
[/colors]
|
||||
|
||||
[images]
|
||||
|
|
112
data/gui/default/widget/toggle_button_orb.cfg
Normal file
|
@ -0,0 +1,112 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of a selectable orb button.
|
||||
###
|
||||
|
||||
#define _GUI_ICON SIZE STATE
|
||||
[image]
|
||||
x = 0
|
||||
y = 0
|
||||
w = {SIZE}
|
||||
h = {SIZE}
|
||||
name = "('buttons/misc/orb{STATE}.png" + <<~RC(magenta>{icon})')>>
|
||||
[/image]
|
||||
#enddef
|
||||
|
||||
#define _GUI_RESOLUTION RESOLUTION SIZE
|
||||
[resolution]
|
||||
{RESOLUTION}
|
||||
|
||||
min_width = {SIZE}
|
||||
min_height = {SIZE}
|
||||
|
||||
default_width = {SIZE}
|
||||
default_height = {SIZE}
|
||||
|
||||
max_width = {SIZE}
|
||||
max_height = {SIZE}
|
||||
|
||||
text_extra_width = 0
|
||||
text_font_size = 0
|
||||
|
||||
[state]
|
||||
[enabled]
|
||||
[draw]
|
||||
{_GUI_ICON ({SIZE}) ()}
|
||||
[/draw]
|
||||
[/enabled]
|
||||
|
||||
[disabled]
|
||||
[draw]
|
||||
{_GUI_ICON ({SIZE}) ()}
|
||||
[/draw]
|
||||
[/disabled]
|
||||
|
||||
[focused]
|
||||
[draw]
|
||||
{_GUI_ICON ({SIZE}) (-active)}
|
||||
[/draw]
|
||||
[/focused]
|
||||
[/state]
|
||||
|
||||
###
|
||||
### Selected
|
||||
###
|
||||
|
||||
[state]
|
||||
[enabled]
|
||||
[draw]
|
||||
[image]
|
||||
x = 0
|
||||
y = 0
|
||||
w = {SIZE}
|
||||
h = {SIZE}
|
||||
name = "buttons/misc/orb-pressed-bg.png"
|
||||
[/image]
|
||||
|
||||
{_GUI_ICON ({SIZE}) (-pressed)}
|
||||
[/draw]
|
||||
[/enabled]
|
||||
|
||||
[disabled]
|
||||
[draw]
|
||||
[image]
|
||||
x = 0
|
||||
y = 0
|
||||
w = {SIZE}
|
||||
h = {SIZE}
|
||||
name = "buttons/misc/orb-pressed-bg.png"
|
||||
[/image]
|
||||
|
||||
{_GUI_ICON ({SIZE}) (-pressed)}
|
||||
[/draw]
|
||||
[/disabled]
|
||||
|
||||
[focused]
|
||||
[draw]
|
||||
[image]
|
||||
x = 0
|
||||
y = 0
|
||||
w = {SIZE}
|
||||
h = {SIZE}
|
||||
name = "buttons/misc/orb-pressed-bg-active.png"
|
||||
[/image]
|
||||
|
||||
{_GUI_ICON ({SIZE}) (-active)}
|
||||
[/draw]
|
||||
[/focused]
|
||||
[/state]
|
||||
|
||||
[/resolution]
|
||||
#enddef
|
||||
|
||||
[toggle_button_definition]
|
||||
id = "orb"
|
||||
description = "This toggle button is meant to be used in the select orbs dialog."
|
||||
|
||||
{_GUI_RESOLUTION ({GUI_NORMAL__RESOLUTION}) 30 }
|
||||
[/toggle_button_definition]
|
||||
|
||||
#undef _GUI_RESOLUTION
|
||||
#undef _GUI_ICON
|
||||
|
|
@ -208,6 +208,20 @@
|
|||
[/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
{_GUI_PREFERENCES_SPACER_ROW}
|
||||
[row]
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
{_GUI_PREFERENCES_MAIN_COMPOSITE_SLIDER
|
||||
scaling_value ( _ "Font scale:")
|
||||
scaling_slider (
|
||||
minimum_value,maximum_value=100,200
|
||||
step_size=5
|
||||
tooltip= _ "Set the scaling factor of fonts"
|
||||
)
|
||||
}
|
||||
[/column]
|
||||
[/row]
|
||||
#enddef
|
||||
|
||||
#define _GUI_PREFERENCES_DISPLAY_GRID_2
|
||||
|
|
136
data/gui/default/window/select_orb_colors.cfg
Normal file
|
@ -0,0 +1,136 @@
|
|||
|
||||
#define _GUI_ORB_CELL PURPOSE COLOR
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[toggle_button]
|
||||
id = "orb_{PURPOSE}_{COLOR}"
|
||||
definition = "orb"
|
||||
icon = "{COLOR}"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
#enddef
|
||||
|
||||
#define _GUI_ORB_ROW PURPOSE
|
||||
[grid]
|
||||
id = "orb_{PURPOSE}_selection"
|
||||
[row]
|
||||
{_GUI_ORB_CELL {PURPOSE} brightgreen}
|
||||
{_GUI_ORB_CELL {PURPOSE} brightorange}
|
||||
{_GUI_ORB_CELL {PURPOSE} red}
|
||||
{_GUI_ORB_CELL {PURPOSE} lightblue}
|
||||
{_GUI_ORB_CELL {PURPOSE} black}
|
||||
{_GUI_ORB_CELL {PURPOSE} blue}
|
||||
{_GUI_ORB_CELL {PURPOSE} white}
|
||||
{_GUI_ORB_CELL {PURPOSE} gold}
|
||||
{_GUI_ORB_CELL {PURPOSE} darkred}
|
||||
{_GUI_ORB_CELL {PURPOSE} lightred}
|
||||
[/row]
|
||||
[/grid]
|
||||
#enddef
|
||||
|
||||
#define _GUI_ORB_GROUP PURPOSE LABEL
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[toggle_button]
|
||||
id = "orb_{PURPOSE}_show"
|
||||
definition = "default"
|
||||
label = {LABEL}
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
{_GUI_ORB_ROW {PURPOSE}}
|
||||
[/column]
|
||||
[/row]
|
||||
#enddef
|
||||
|
||||
[window]
|
||||
id = "select_orb_colors"
|
||||
description = "Select the colors of orbs displayed on units for various purposes."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
click_dismiss = "true"
|
||||
maximum_width = 600
|
||||
maximum_height = 480
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip_large"
|
||||
[/tooltip]
|
||||
[helptip]
|
||||
id = "tooltip_large"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
[label]
|
||||
definition = "title"
|
||||
label = _ "Choose Orb/Minimap Colors"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
{_GUI_ORB_GROUP unmoved (_"Show unmoved orb")}
|
||||
{_GUI_ORB_GROUP partial (_"Show partial moved orb")}
|
||||
{_GUI_ORB_GROUP moved (_"Show moved orb")}
|
||||
{_GUI_ORB_GROUP ally (_"Show ally orb")}
|
||||
{_GUI_ORB_GROUP enemy (_"Show enemy orb")}
|
||||
[row]
|
||||
[column]
|
||||
horizontal_grow = "true"
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
horizontal_alignment = "left"
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[button]
|
||||
id = "orb_defaults"
|
||||
definition = "default"
|
||||
label = _ "Defaults"
|
||||
[/button]
|
||||
[/column]
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
grow_factor = 0
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
label = _ "OK"
|
||||
[/button]
|
||||
[/column]
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
grow_factor = 0
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[button]
|
||||
id = "cancel"
|
||||
definition = "default"
|
||||
label = _ "Cancel"
|
||||
[/button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/resolution]
|
||||
[/window]
|
||||
|
||||
#undef _GUI_ORB_GROUP
|
||||
#undef _GUI_ORB_ROW
|
||||
#undef _GUI_ORB_CELL
|
Before Width: | Height: | Size: 714 B After Width: | Height: | Size: 733 B |
BIN
images/buttons/misc/orb-pressed-bg-active.png
Normal file
After Width: | Height: | Size: 2.1 KiB |
BIN
images/buttons/misc/orb-pressed-bg.png
Normal file
After Width: | Height: | Size: 2 KiB |
Before Width: | Height: | Size: 915 B After Width: | Height: | Size: 784 B |
Before Width: | Height: | Size: 769 B After Width: | Height: | Size: 784 B |
|
@ -715,6 +715,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/preferences_dialog.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/screenshot_notification.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/screenshot_notification.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/select_orb_colors.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/select_orb_colors.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/simple_item_selector.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/simple_item_selector.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/synced_choice_wait.cpp" />
|
||||
|
|
|
@ -9919,6 +9919,62 @@
|
|||
RelativePath="..\..\src\gui\dialogs\screenshot_notification.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\gui\dialogs\select_orb_colors.cpp"
|
||||
>
|
||||
<FileConfiguration
|
||||
Name="Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Debug_with_VLD|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Debug|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="Test_Release|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
<FileConfiguration
|
||||
Name="ReleaseDEBUG|Win32"
|
||||
>
|
||||
<Tool
|
||||
Name="VCCLCompilerTool"
|
||||
ObjectFile="$(IntDir)\Gui\Dialogs\"
|
||||
/>
|
||||
</FileConfiguration>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\gui\dialogs\select_orb_colors.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\gui\dialogs\simple_item_selector.cpp"
|
||||
>
|
||||
|
|
|
@ -77,6 +77,8 @@
|
|||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
911F2DAD1BA086A400E3102E /* window.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 911F2DAB1BA086A400E3102E /* window.cpp */; };
|
||||
911F2DB01BA086FA00E3102E /* alpha.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 911F2DAE1BA086F900E3102E /* alpha.cpp */; };
|
||||
9130A4601C73BB6100852782 /* select_orb_colors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9130A45E1C73BB6100852782 /* select_orb_colors.cpp */; };
|
||||
9130A4611C73BB6100852782 /* select_orb_colors.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 9130A45E1C73BB6100852782 /* select_orb_colors.cpp */; };
|
||||
919B37F81BAF789E00E0094C /* synced_user_choice.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 919B37F71BAF789D00E0094C /* synced_user_choice.cpp */; };
|
||||
919B37FC1BAF7A9D00E0094C /* synced_choice_wait.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 919B37FA1BAF7A9D00E0094C /* synced_choice_wait.cpp */; };
|
||||
91B6217C1B74E6D200B00E0F /* label_settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B6217A1B74E6D100B00E0F /* label_settings.cpp */; };
|
||||
|
@ -1264,6 +1266,8 @@
|
|||
911F2DAE1BA086F900E3102E /* alpha.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = alpha.cpp; sourceTree = "<group>"; };
|
||||
911F2DAF1BA086FA00E3102E /* alpha.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = alpha.hpp; sourceTree = "<group>"; };
|
||||
911F2DB11BA0870E00E3102E /* compat.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = compat.hpp; sourceTree = "<group>"; };
|
||||
9130A45E1C73BB6100852782 /* select_orb_colors.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = select_orb_colors.cpp; sourceTree = "<group>"; };
|
||||
9130A45F1C73BB6100852782 /* select_orb_colors.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = select_orb_colors.hpp; sourceTree = "<group>"; };
|
||||
919B37F71BAF789D00E0094C /* synced_user_choice.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = synced_user_choice.cpp; sourceTree = "<group>"; };
|
||||
919B37F91BAF78AB00E0094C /* synced_user_choice.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = synced_user_choice.hpp; sourceTree = "<group>"; };
|
||||
919B37FA1BAF7A9D00E0094C /* synced_choice_wait.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = synced_choice_wait.cpp; sourceTree = "<group>"; };
|
||||
|
@ -4046,6 +4050,8 @@
|
|||
91F462831C71139B0050A9C9 /* preferences_dialog.hpp */,
|
||||
EC19E6EE18B7F24B003B4B81 /* screenshot_notification.cpp */,
|
||||
EC19E6EF18B7F24B003B4B81 /* screenshot_notification.hpp */,
|
||||
9130A45E1C73BB6100852782 /* select_orb_colors.cpp */,
|
||||
9130A45F1C73BB6100852782 /* select_orb_colors.hpp */,
|
||||
B5CE470312A041EF00D665EE /* simple_item_selector.cpp */,
|
||||
B5CE470412A041EF00D665EE /* simple_item_selector.hpp */,
|
||||
919B37FA1BAF7A9D00E0094C /* synced_choice_wait.cpp */,
|
||||
|
@ -5061,6 +5067,7 @@
|
|||
91F4628C1C7116C40050A9C9 /* combobox.cpp in Sources */,
|
||||
91F462901C7116E30050A9C9 /* combobox.cpp in Sources */,
|
||||
91F462941C7117400050A9C9 /* drop_down_list.cpp in Sources */,
|
||||
9130A4601C73BB6100852782 /* select_orb_colors.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
@ -5389,6 +5396,7 @@
|
|||
91F4628D1C7116C40050A9C9 /* combobox.cpp in Sources */,
|
||||
91F462911C7116E30050A9C9 /* combobox.cpp in Sources */,
|
||||
91F462951C7117400050A9C9 /* drop_down_list.cpp in Sources */,
|
||||
9130A4611C73BB6100852782 /* select_orb_colors.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -940,6 +940,7 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/preferences_dialog.cpp
|
||||
gui/dialogs/edit_text.cpp
|
||||
gui/dialogs/screenshot_notification.cpp
|
||||
gui/dialogs/select_orb_colors.cpp
|
||||
gui/dialogs/simple_item_selector.cpp
|
||||
gui/dialogs/synced_choice_wait.cpp
|
||||
gui/dialogs/theme_list.cpp
|
||||
|
|
|
@ -458,6 +458,7 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/preferences_dialog.cpp
|
||||
gui/dialogs/edit_text.cpp
|
||||
gui/dialogs/screenshot_notification.cpp
|
||||
gui/dialogs/select_orb_colors.cpp
|
||||
gui/dialogs/simple_item_selector.cpp
|
||||
gui/dialogs/synced_choice_wait.cpp
|
||||
gui/dialogs/theme_list.cpp
|
||||
|
|
|
@ -32,6 +32,7 @@
|
|||
#include "serialization/preprocessor.hpp"
|
||||
#include "serialization/string_utils.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
#include <boost/optional.hpp>
|
||||
|
@ -894,6 +895,7 @@ SDL_Rect draw_text_line(surface& gui_surface, const SDL_Rect& area, int size,
|
|||
const SDL_Color& color, const std::string& text,
|
||||
int x, int y, bool use_tooltips, int style)
|
||||
{
|
||||
size = preferences::font_scaled(size);
|
||||
if (gui_surface.null()) {
|
||||
text_surface const &u = text_cache::find(text_surface(text, size, color, style));
|
||||
return sdl::create_rect(0, 0, u.width(), u.height());
|
||||
|
|
|
@ -399,8 +399,8 @@ twindow_builder::tresolution::tresolution(const config& cfg)
|
|||
, click_dismiss(cfg["click_dismiss"].to_bool())
|
||||
, definition(cfg["definition"])
|
||||
, linked_groups()
|
||||
, tooltip(cfg.child_or_empty("tooltip"))
|
||||
, helptip(cfg.child_or_empty("helptip"))
|
||||
, tooltip(cfg.child_or_empty("tooltip"), "tooltip")
|
||||
, helptip(cfg.child_or_empty("helptip"), "helptip")
|
||||
, grid(0)
|
||||
{
|
||||
if(!cfg["functions"].empty()) {
|
||||
|
@ -452,10 +452,10 @@ twindow_builder::tresolution::tresolution(const config& cfg)
|
|||
}
|
||||
}
|
||||
|
||||
twindow_builder::tresolution::ttip::ttip(const config& cfg) : id(cfg["id"])
|
||||
twindow_builder::tresolution::ttip::ttip(const config& cfg, const std::string& tagname) : id(cfg["id"])
|
||||
{
|
||||
VALIDATE(!id.empty(),
|
||||
missing_mandatory_wml_key("[window][resolution][tip]", "id"));
|
||||
missing_mandatory_wml_key("[window][resolution][" + tagname + "]", "id"));
|
||||
}
|
||||
|
||||
/*WIKI
|
||||
|
|
|
@ -203,7 +203,7 @@ public:
|
|||
/** Helper struct to store information about the tips. */
|
||||
struct ttip
|
||||
{
|
||||
ttip(const config& cfg);
|
||||
ttip(const config& cfg, const std::string& tagname);
|
||||
|
||||
std::string id;
|
||||
};
|
||||
|
|
|
@ -30,6 +30,7 @@
|
|||
#include "gui/dialogs/advanced_graphics_options.hpp"
|
||||
#include "gui/dialogs/game_cache_options.hpp"
|
||||
#include "gui/dialogs/mp_alerts_options.hpp"
|
||||
#include "gui/dialogs/select_orb_colors.hpp"
|
||||
|
||||
#include "gui/dialogs/helper.hpp"
|
||||
#include "gui/dialogs/transient_message.hpp"
|
||||
|
@ -79,7 +80,6 @@ const std::string bool_to_display_string(bool value)
|
|||
|
||||
namespace gui2 {
|
||||
|
||||
// TODO: probably should use a namespace alias instead
|
||||
using namespace preferences;
|
||||
|
||||
REGISTER_DIALOG(preferences)
|
||||
|
@ -278,10 +278,10 @@ void tpreferences::bind_status_label(T& parent, const std::string& label_id,
|
|||
}
|
||||
|
||||
void tpreferences::bind_status_label(tslider& parent, const std::string& label_id,
|
||||
twidget& find_in)
|
||||
twidget& find_in, const std::string& suffix)
|
||||
{
|
||||
tcontrol& label = find_widget<tcontrol>(&find_in, label_id, false);
|
||||
label.set_label(lexical_cast<std::string>(parent.get_value_label()));
|
||||
label.set_label(lexical_cast<std::string>(parent.get_value_label()) + suffix);
|
||||
|
||||
connect_signal_notify_modified(parent, boost::bind(
|
||||
&tpreferences::status_label_callback<tslider>,
|
||||
|
@ -292,7 +292,7 @@ void tpreferences::setup_friends_list(twindow& window)
|
|||
{
|
||||
tlistbox& friends_list = find_widget<tlistbox>(&window, "friends_list", false);
|
||||
|
||||
const std::map<std::string, preferences::acquaintance>& acquaintances = get_acquaintances();
|
||||
const std::map<std::string, acquaintance>& acquaintances = get_acquaintances();
|
||||
|
||||
std::map<std::string, string_map> data;
|
||||
|
||||
|
@ -362,6 +362,19 @@ void tpreferences::add_friend_list_entry(const bool is_friend,
|
|||
setup_friends_list(window);
|
||||
}
|
||||
|
||||
void tpreferences::edit_friend_list_entry(tlistbox& friends,
|
||||
ttext_box& textbox)
|
||||
{
|
||||
const int num_available = get_acquaintances().size();
|
||||
const int sel = friends.get_selected_row();
|
||||
if(sel < 0 || sel >= num_available) {
|
||||
return;
|
||||
}
|
||||
std::map<std::string, acquaintance>::const_iterator who = get_acquaintances().begin();
|
||||
std::advance(who, sel);
|
||||
textbox.set_value(who->second.get_nick() + " " + who->second.get_notes());
|
||||
}
|
||||
|
||||
void tpreferences::remove_friend_list_entry(tlistbox& friends_list,
|
||||
ttext_box& textbox, twindow& window)
|
||||
{
|
||||
|
@ -479,7 +492,7 @@ void tpreferences::initialize_members(twindow& window)
|
|||
|
||||
/** SET HOTKEYS **/
|
||||
connect_signal_mouse_left_click(find_widget<tbutton>(&window, "hotkeys", false),
|
||||
boost::bind(&preferences::show_hotkeys_preferences_dialog,
|
||||
boost::bind(&show_hotkeys_preferences_dialog,
|
||||
boost::ref(window.video())));
|
||||
|
||||
/** CACHE MANAGE **/
|
||||
|
@ -542,10 +555,15 @@ void tpreferences::initialize_members(twindow& window)
|
|||
idle_anim(), idle_anim_rate(),
|
||||
set_idle_anim, set_idle_anim_rate, window);
|
||||
|
||||
/** FONT SCALING **/
|
||||
tslider& scale_slider = find_widget<tslider>(&window, "scaling_slider", false);
|
||||
setup_single_slider("scaling_slider", font_scaling(), set_font_scaling, window);
|
||||
bind_status_label(scale_slider, "scaling_value", window, "%");
|
||||
|
||||
/** SELECT THEME **/
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<tbutton>(&window, "choose_theme", false),
|
||||
boost::bind(&preferences::show_theme_dialog,
|
||||
boost::bind(&show_theme_dialog,
|
||||
boost::ref(window.video())));
|
||||
|
||||
|
||||
|
@ -638,6 +656,12 @@ void tpreferences::initialize_members(twindow& window)
|
|||
boost::ref(textbox),
|
||||
boost::ref(window)));
|
||||
|
||||
friend_list.set_callback_value_change(boost::bind(
|
||||
&tpreferences::edit_friend_list_entry,
|
||||
this,
|
||||
boost::ref(friend_list),
|
||||
boost::ref(textbox)));
|
||||
|
||||
friend_list.select_row(0);
|
||||
|
||||
/** ALERTS **/
|
||||
|
@ -649,7 +673,7 @@ void tpreferences::initialize_members(twindow& window)
|
|||
/** SET WESNOTHD PATH **/
|
||||
connect_signal_mouse_left_click(
|
||||
find_widget<tbutton>(&window, "mp_wesnothd", false), boost::bind(
|
||||
&preferences::show_wesnothd_server_search,
|
||||
&show_wesnothd_server_search,
|
||||
boost::ref(window.video())));
|
||||
|
||||
|
||||
|
@ -811,10 +835,10 @@ void tpreferences::on_advanced_prefs_list_select(tlistbox& list, twindow& window
|
|||
if(selected_type == ADVANCED_PREF_TYPE::SPECIAL) {
|
||||
if (selected_field == "advanced_graphic_options") {
|
||||
gui2::tadvanced_graphics_options::display(window.video());
|
||||
}
|
||||
|
||||
if (selected_field == "orb_color") {
|
||||
// TODO
|
||||
} else if (selected_field == "orb_color") {
|
||||
gui2::tselect_orb_colors::display(window.video());
|
||||
} else {
|
||||
WRN_GUI_L << "Invalid or unimplemented custom advanced prefs option: " << selected_field << "\n";
|
||||
}
|
||||
|
||||
// Add more options here as needed
|
||||
|
|
|
@ -64,6 +64,8 @@ private:
|
|||
void add_friend_list_entry(const bool is_friend,
|
||||
ttext_box& textbox, twindow& window);
|
||||
|
||||
void edit_friend_list_entry(tlistbox& friends, ttext_box& textbox);
|
||||
|
||||
void remove_friend_list_entry(tlistbox& friends_list,
|
||||
ttext_box& textbox, twindow& window);
|
||||
|
||||
|
@ -172,7 +174,8 @@ private:
|
|||
void bind_status_label(
|
||||
tslider& parent,
|
||||
const std::string& label_id,
|
||||
twidget& find_in);
|
||||
twidget& find_in,
|
||||
const std::string& suffix = "");
|
||||
|
||||
template <typename T>
|
||||
void status_label_callback(T& parent_widget,
|
||||
|
|
159
src/gui/dialogs/select_orb_colors.cpp
Normal file
|
@ -0,0 +1,159 @@
|
|||
/*
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#define GETTEXT_DOMAIN "wesnoth-lib"
|
||||
|
||||
#include "select_orb_colors.hpp"
|
||||
|
||||
#include "gui/auxiliary/event/dispatcher.hpp"
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/auxiliary/iterator/walker.hpp"
|
||||
#include "gui/widgets/button.hpp"
|
||||
#include "gui/widgets/grid.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
|
||||
#include "preferences.hpp"
|
||||
#include "game_config.hpp"
|
||||
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace gui2 {
|
||||
REGISTER_DIALOG(select_orb_colors);
|
||||
|
||||
tselect_orb_colors::tselect_orb_colors()
|
||||
: show_unmoved_(preferences::show_unmoved_orb())
|
||||
, show_partial_(preferences::show_partial_orb())
|
||||
, show_moved_(preferences::show_moved_orb())
|
||||
, show_ally_(preferences::show_allied_orb())
|
||||
, show_enemy_(preferences::show_enemy_orb())
|
||||
, unmoved_(preferences::unmoved_color())
|
||||
, partial_(preferences::partial_color())
|
||||
, moved_(preferences::moved_color())
|
||||
, ally_(preferences::allied_color())
|
||||
, enemy_(preferences::enemy_color())
|
||||
{
|
||||
}
|
||||
|
||||
void tselect_orb_colors::pre_show(CVideo&, twindow& window)
|
||||
{
|
||||
setup_orb_group("unmoved", show_unmoved_, unmoved_, window);
|
||||
setup_orb_group("partial", show_partial_, partial_, window);
|
||||
setup_orb_group("moved", show_moved_, moved_, window);
|
||||
setup_orb_group("ally", show_ally_, ally_, window);
|
||||
setup_orb_group("enemy", show_enemy_, enemy_, window);
|
||||
|
||||
tbutton& reset = find_widget<tbutton>(&window, "orb_defaults", false);
|
||||
connect_signal_mouse_left_click(reset, boost::bind(
|
||||
&tselect_orb_colors::handle_reset_click,
|
||||
this, boost::ref(window)
|
||||
));
|
||||
}
|
||||
|
||||
void tselect_orb_colors::post_show(twindow&)
|
||||
{
|
||||
if(get_retval() == twindow::OK) {
|
||||
preferences::set_show_unmoved_orb(show_unmoved_);
|
||||
preferences::set_show_partial_orb(show_partial_);
|
||||
preferences::set_show_moved_orb(show_moved_);
|
||||
preferences::set_show_allied_orb(show_ally_);
|
||||
preferences::set_show_enemy_orb(show_enemy_);
|
||||
|
||||
preferences::set_unmoved_color(unmoved_);
|
||||
preferences::set_partial_color(partial_);
|
||||
preferences::set_moved_color(moved_);
|
||||
preferences::set_allied_color(ally_);
|
||||
preferences::set_enemy_color(enemy_);
|
||||
}
|
||||
}
|
||||
|
||||
void tselect_orb_colors::setup_orb_group(const std::string& base_id, bool& shown, std::string& color, twindow& window, bool connect)
|
||||
{
|
||||
ttoggle_button& toggle = find_widget<ttoggle_button>(&window, "orb_" + base_id + "_show", false);
|
||||
toggle.set_value_bool(shown);
|
||||
if(connect) {
|
||||
connect_signal_mouse_left_click(toggle, boost::bind(
|
||||
&tselect_orb_colors::handle_toggle_click,
|
||||
this,
|
||||
boost::ref(shown)
|
||||
));
|
||||
}
|
||||
|
||||
tgrid& selection = find_widget<tgrid>(&window, "orb_" + base_id + "_selection", false);
|
||||
std::vector<ttoggle_button*>& group = groups_[base_id];
|
||||
|
||||
using iterator::twalker_;
|
||||
twalker_* iter = selection.create_walker();
|
||||
while(!iter->at_end(twalker_::child)) {
|
||||
twidget* next = iter->get(twalker_::child);
|
||||
if(ttoggle_button* button = dynamic_cast<ttoggle_button*>(next)) {
|
||||
group.push_back(button);
|
||||
if(button->id().rfind("_" + color) != std::string::npos) {
|
||||
button->set_value_bool(true);
|
||||
} else {
|
||||
button->set_value_bool(false);
|
||||
}
|
||||
if(connect) {
|
||||
connect_signal_mouse_left_click(*button, boost::bind(
|
||||
&tselect_orb_colors::handle_orb_click,
|
||||
this,
|
||||
button,
|
||||
boost::ref(group),
|
||||
boost::ref(color)
|
||||
));
|
||||
}
|
||||
}
|
||||
iter->next(twalker_::child);
|
||||
}
|
||||
}
|
||||
|
||||
void tselect_orb_colors::handle_orb_click(ttoggle_button* clicked, const std::vector<ttoggle_button*>& group, std::string& storage)
|
||||
{
|
||||
int split = clicked->id().find_last_of('_');
|
||||
storage = clicked->id().substr(split + 1);
|
||||
|
||||
FOREACH(const AUTO& button, group) {
|
||||
button->set_value_bool(false);
|
||||
}
|
||||
|
||||
clicked->set_value_bool(true);
|
||||
}
|
||||
|
||||
void tselect_orb_colors::handle_toggle_click(bool& storage)
|
||||
{
|
||||
storage = !storage;
|
||||
}
|
||||
|
||||
void tselect_orb_colors::handle_reset_click(twindow& window)
|
||||
{
|
||||
show_unmoved_ = game_config::show_unmoved_orb;
|
||||
show_partial_ = game_config::show_partial_orb;
|
||||
show_moved_ = game_config::show_moved_orb;
|
||||
show_ally_ = game_config::show_ally_orb;
|
||||
show_enemy_ = game_config::show_enemy_orb;
|
||||
|
||||
unmoved_ = game_config::colors::unmoved_orb_color;
|
||||
partial_ = game_config::colors::partial_orb_color;
|
||||
moved_ = game_config::colors::moved_orb_color;
|
||||
ally_ = game_config::colors::ally_orb_color;
|
||||
enemy_ = game_config::colors::enemy_orb_color;
|
||||
|
||||
setup_orb_group("unmoved", show_unmoved_, unmoved_, window, false);
|
||||
setup_orb_group("partial", show_partial_, partial_, window, false);
|
||||
setup_orb_group("moved", show_moved_, moved_, window, false);
|
||||
setup_orb_group("ally", show_ally_, ally_, window, false);
|
||||
setup_orb_group("enemy", show_enemy_, enemy_, window, false);
|
||||
}
|
||||
|
||||
}
|
57
src/gui/dialogs/select_orb_colors.hpp
Normal file
|
@ -0,0 +1,57 @@
|
|||
/*
|
||||
Part of the Battle for Wesnoth Project http://www.wesnoth.org/
|
||||
|
||||
This program is free software; you can redistribute it and/or modify
|
||||
it under the terms of the GNU General Public License as published by
|
||||
the Free Software Foundation; either version 2 of the License, or
|
||||
(at your option) any later version.
|
||||
This program is distributed in the hope that it will be useful,
|
||||
but WITHOUT ANY WARRANTY.
|
||||
|
||||
See the COPYING file for more details.
|
||||
*/
|
||||
|
||||
#ifndef GUI_DIALOGS_SELECT_ORB_COLORS_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_SELECT_ORB_COLORS_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include <map>
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
class ttoggle_button;
|
||||
|
||||
class tselect_orb_colors : public tdialog {
|
||||
public:
|
||||
tselect_orb_colors();
|
||||
|
||||
/**
|
||||
* The display function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
*/
|
||||
static void display(CVideo& video) {
|
||||
tselect_orb_colors().show(video);
|
||||
}
|
||||
private:
|
||||
void setup_orb_group(const std::string& base_id, bool& shown, std::string& color, twindow& window, bool connect = true);
|
||||
void handle_orb_click(ttoggle_button* clicked, const std::vector<ttoggle_button*>& group, std::string& storage);
|
||||
void handle_toggle_click(bool& storage);
|
||||
void handle_reset_click(twindow& window);
|
||||
|
||||
bool show_unmoved_, show_partial_, show_moved_, show_ally_, show_enemy_;
|
||||
std::string unmoved_, partial_, moved_, ally_, enemy_;
|
||||
std::map<std::string, std::vector<ttoggle_button*> > groups_;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
/** Inherited from tdialog. */
|
||||
void post_show(twindow& window);
|
||||
};
|
||||
|
||||
}
|
||||
|
||||
#endif
|
|
@ -27,6 +27,7 @@
|
|||
#include "video.hpp"
|
||||
#include "image.hpp"
|
||||
#include "text.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
#include <SDL_events.h>
|
||||
#include <SDL_image.h>
|
||||
|
@ -281,7 +282,7 @@ void loadscreen::draw_screen(const std::string &text)
|
|||
{
|
||||
SDL_Rect oldarea = textarea_;
|
||||
sdl::fill_rect(gdis,&textarea_,SDL_MapRGB(gdis->format,0,0,0));
|
||||
textarea_ = font::line_size(text, font::SIZE_NORMAL);
|
||||
textarea_ = font::line_size(text, preferences::font_scaled(font::SIZE_NORMAL));
|
||||
textarea_.x = scrx/2 + bw + bispw - textarea_.w / 2;
|
||||
textarea_.y = pby + pbh + 4*(bw + bispw);
|
||||
textarea_ = font::draw_text(&screen_,textarea_,font::SIZE_NORMAL,font::NORMAL_COLOR,text,textarea_.x,textarea_.y);
|
||||
|
|
|
@ -29,6 +29,7 @@
|
|||
#include "serialization/unicode.hpp"
|
||||
#include "video.hpp"
|
||||
#include "wml_exception.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
namespace font {
|
||||
|
||||
|
@ -323,6 +324,7 @@ static void cut_word(std::string& line, std::string& word, int font_size, int st
|
|||
std::string tmp = line;
|
||||
utf8::iterator tc(word);
|
||||
bool first = true;
|
||||
font_size = preferences::font_scaled(font_size);
|
||||
|
||||
for(;tc != utf8::iterator::end(word); ++tc) {
|
||||
tmp.append(tc.substr().first, tc.substr().second);
|
||||
|
@ -509,7 +511,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
|
|||
start_of_line = true;
|
||||
} else {
|
||||
|
||||
const size_t word_width = line_size(current_word, font_sz, style).w;
|
||||
const size_t word_width = line_size(current_word, preferences::font_scaled(font_sz), style).w;
|
||||
|
||||
line_width += word_width;
|
||||
|
||||
|
@ -528,7 +530,7 @@ std::string word_wrap_text(const std::string& unwrapped_text, int font_size,
|
|||
}
|
||||
|
||||
if(line_break || (current_word.empty() && ch == end)) {
|
||||
SDL_Rect size = line_size(current_line, font_sz, style);
|
||||
SDL_Rect size = line_size(current_line, preferences::font_scaled(font_sz), style);
|
||||
if(max_height > 0 && current_height + size.h >= size_t(max_height)) {
|
||||
return wrapped_text;
|
||||
}
|
||||
|
|
|
@ -267,11 +267,22 @@ void set_show_partial_orb(bool show_orb) {
|
|||
}
|
||||
|
||||
|
||||
static std::string fix_orb_color_name(const std::string& color) {
|
||||
if (color.substr(0,4) == "orb_") {
|
||||
if(color[4] >= '0' && color[4] <= '9') {
|
||||
return color.substr(5);
|
||||
} else {
|
||||
return color.substr(4);
|
||||
}
|
||||
}
|
||||
return color;
|
||||
}
|
||||
|
||||
std::string allied_color() {
|
||||
std::string ally_color = get("ally_orb_color");
|
||||
if (ally_color.empty())
|
||||
return game_config::colors::ally_orb_color;
|
||||
return ally_color;
|
||||
return fix_orb_color_name(ally_color);
|
||||
}
|
||||
void set_allied_color(const std::string& color_id) {
|
||||
prefs["ally_orb_color"] = color_id;
|
||||
|
@ -291,7 +302,7 @@ std::string enemy_color() {
|
|||
std::string enemy_color = get("enemy_orb_color");
|
||||
if (enemy_color.empty())
|
||||
return game_config::colors::enemy_orb_color;
|
||||
return enemy_color;
|
||||
return fix_orb_color_name(enemy_color);
|
||||
}
|
||||
void set_enemy_color(const std::string& color_id) {
|
||||
prefs["enemy_orb_color"] = color_id;
|
||||
|
@ -301,7 +312,7 @@ std::string moved_color() {
|
|||
std::string moved_color = get("moved_orb_color");
|
||||
if (moved_color.empty())
|
||||
return game_config::colors::moved_orb_color;
|
||||
return moved_color;
|
||||
return fix_orb_color_name(moved_color);
|
||||
}
|
||||
void set_moved_color(const std::string& color_id) {
|
||||
prefs["moved_orb_color"] = color_id;
|
||||
|
@ -311,7 +322,7 @@ std::string unmoved_color() {
|
|||
std::string unmoved_color = get("unmoved_orb_color");
|
||||
if (unmoved_color.empty())
|
||||
return game_config::colors::unmoved_orb_color;
|
||||
return unmoved_color;
|
||||
return fix_orb_color_name(unmoved_color);
|
||||
}
|
||||
void set_unmoved_color(const std::string& color_id) {
|
||||
prefs["unmoved_orb_color"] = color_id;
|
||||
|
@ -321,7 +332,7 @@ std::string partial_color() {
|
|||
std::string partmoved_color = get("partial_orb_color");
|
||||
if (partmoved_color.empty())
|
||||
return game_config::colors::partial_orb_color;
|
||||
return partmoved_color;
|
||||
return fix_orb_color_name(partmoved_color);
|
||||
}
|
||||
void set_partial_color(const std::string& color_id) {
|
||||
prefs["partial_orb_color"] = color_id;
|
||||
|
@ -411,6 +422,22 @@ void save_turbo_speed(const double speed)
|
|||
{
|
||||
prefs["turbo_speed"] = speed;
|
||||
}
|
||||
|
||||
int font_scaling()
|
||||
{
|
||||
// Clip at 50 because if it's too low it'll cause crashes
|
||||
return std::max<int>(50, prefs["font_scale"].to_int(100));
|
||||
}
|
||||
|
||||
void set_font_scaling(int scale)
|
||||
{
|
||||
prefs["font_scale"] = scale;
|
||||
}
|
||||
|
||||
int font_scaled(int size)
|
||||
{
|
||||
return (size * font_scaling()) / 100;
|
||||
}
|
||||
|
||||
bool idle_anim()
|
||||
{
|
||||
|
|
|
@ -81,6 +81,10 @@ namespace preferences {
|
|||
|
||||
double turbo_speed();
|
||||
void save_turbo_speed(const double speed);
|
||||
|
||||
int font_scaling();
|
||||
void set_font_scaling(int scale);
|
||||
int font_scaled(int size);
|
||||
|
||||
bool idle_anim();
|
||||
void _set_idle_anim(const bool ison);
|
||||
|
|
|
@ -115,57 +115,5 @@ void set_idle_anim_rate(int rate) {
|
|||
}
|
||||
}
|
||||
|
||||
|
||||
bool show_video_mode_dialog(CVideo& video)
|
||||
{
|
||||
const resize_lock prevent_resizing;
|
||||
// For some reason, this line prevents the dialog from being opened from GUI2...
|
||||
//const events::event_context dialog_events_context;
|
||||
|
||||
std::vector<std::pair<int,int> > resolutions
|
||||
= video.get_available_resolutions();
|
||||
|
||||
if(resolutions.empty()) {
|
||||
gui2::show_transient_message(
|
||||
video
|
||||
, ""
|
||||
, _("There are no alternative video modes available"));
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
std::vector<std::string> options;
|
||||
unsigned current_choice = 0;
|
||||
|
||||
for(size_t k = 0; k < resolutions.size(); ++k) {
|
||||
std::pair<int, int> const& res = resolutions[k];
|
||||
|
||||
if (res == video.current_resolution())
|
||||
current_choice = static_cast<unsigned>(k);
|
||||
|
||||
std::ostringstream option;
|
||||
option << res.first << utils::unicode_multiplication_sign << res.second;
|
||||
const int div = boost::math::gcd(res.first, res.second);
|
||||
const int ratio[2] = {res.first/div, res.second/div};
|
||||
if (ratio[0] <= 10 || ratio[1] <= 10)
|
||||
option << " (" << ratio[0] << ':' << ratio[1] << ')';
|
||||
options.push_back(option.str());
|
||||
}
|
||||
|
||||
gui2::tsimple_item_selector dlg(_("Choose Resolution"), "", options);
|
||||
dlg.set_selected_index(current_choice);
|
||||
dlg.show(video);
|
||||
|
||||
int choice = dlg.selected_index();
|
||||
|
||||
if(choice == -1 || resolutions[static_cast<size_t>(choice)] == video.current_resolution()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
video.set_resolution(resolutions[static_cast<size_t>(choice)]);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
} // end namespace preferences
|
||||
|
||||
|
|
|
@ -68,6 +68,7 @@
|
|||
#include "gui/dialogs/mp_method_selection.hpp"
|
||||
#include "gui/dialogs/simple_item_selector.hpp"
|
||||
#include "gui/dialogs/screenshot_notification.hpp"
|
||||
#include "gui/dialogs/select_orb_colors.hpp"
|
||||
#include "gui/dialogs/theme_list.hpp"
|
||||
#include "gui/dialogs/title_screen.hpp"
|
||||
#include "gui/dialogs/tip.hpp"
|
||||
|
@ -412,6 +413,7 @@ BOOST_AUTO_TEST_CASE(test_gui2)
|
|||
test<gui2::tmp_server_list>();
|
||||
test<gui2::tsimple_item_selector>();
|
||||
test<gui2::tscreenshot_notification>();
|
||||
test<gui2::tselect_orb_colors>();
|
||||
test<gui2::ttheme_list>();
|
||||
test<gui2::ttitle_screen>();
|
||||
test<gui2::ttransient_message>();
|
||||
|
@ -824,6 +826,15 @@ struct twrapper<gui2::tscreenshot_notification>
|
|||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct twrapper<gui2::tselect_orb_colors>
|
||||
{
|
||||
static gui2::tselect_orb_colors* create()
|
||||
{
|
||||
return new gui2::tselect_orb_colors();
|
||||
}
|
||||
};
|
||||
|
||||
template<>
|
||||
struct twrapper<gui2::ttheme_list>
|
||||
{
|
||||
|
|
|
@ -24,6 +24,7 @@
|
|||
#include "serialization/string_utils.hpp"
|
||||
#include "serialization/unicode.hpp"
|
||||
#include "tstring.hpp"
|
||||
#include "preferences.hpp"
|
||||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
|
@ -404,8 +405,9 @@ ttext& ttext::set_family_class(font::family_class fclass)
|
|||
|
||||
ttext& ttext::set_font_size(const unsigned font_size)
|
||||
{
|
||||
if(font_size != font_size_) {
|
||||
font_size_ = font_size;
|
||||
unsigned int actual_size = preferences::font_scaled(font_size);
|
||||
if(actual_size != font_size_) {
|
||||
font_size_ = actual_size;
|
||||
calculation_dirty_ = true;
|
||||
surface_dirty_ = true;
|
||||
}
|
||||
|
|