Merge pull request #447 from CelticMinstrel/master
Interface to fine-tune displayed labels (and some other label stuff)
This commit is contained in:
commit
74a81069b9
48 changed files with 747 additions and 63 deletions
|
@ -34,6 +34,10 @@ Version 1.13.1+dev:
|
|||
* WML engine:
|
||||
* Added support for mod_x,mod_y= in [terrain_graphics].
|
||||
* Added support for has_flag= in terrain graphics [variant].
|
||||
* Added category= to [label] - allows grouping labels so that players can
|
||||
show/hide them
|
||||
* Editor:
|
||||
* Added Category field and color sliders to the Edit Label panel.
|
||||
* Miscellaneous and bug fixes:
|
||||
* Fixed Generate Map dialog bug that caused last choice of map
|
||||
generator to not be actually selected (bug #23711).
|
||||
|
|
|
@ -1013,6 +1013,9 @@
|
|||
name = "Burkay Özdemir (Velory)"
|
||||
comment = "Poisoning improvement for Formula AI"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Celtic Minstrel"
|
||||
[/entry]
|
||||
[entry]
|
||||
name = "Chris Carpenter (mordocai)"
|
||||
[/entry]
|
||||
|
|
|
@ -91,63 +91,191 @@
|
|||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 1
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
|
||||
label = _ "Category:"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_grow = "true"
|
||||
|
||||
[text_box]
|
||||
id = "category"
|
||||
definition = "default"
|
||||
label = ""
|
||||
[/text_box]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[grid]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[toggle_button]
|
||||
id = "immutable_toggle"
|
||||
definition = "default"
|
||||
label= _ "Immutable"
|
||||
[/toggle_button]
|
||||
[label]
|
||||
definition = "default"
|
||||
label = _ "Properties"
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
definition = "default"
|
||||
label = _ "Color"
|
||||
[/label]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[toggle_button]
|
||||
id = "immutable_toggle"
|
||||
definition = "default"
|
||||
label= _ "Immutable"
|
||||
[/toggle_button]
|
||||
|
||||
[toggle_button]
|
||||
id = "visible_fog_toggle"
|
||||
definition = "default"
|
||||
label= _ "Visible in fog"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[slider]
|
||||
id = "slider_red"
|
||||
definition = "default"
|
||||
|
||||
minimum_value = 0
|
||||
maximum_value = 255
|
||||
step_size = 1
|
||||
value = 255
|
||||
[/slider]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[/column]
|
||||
[/row]
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[toggle_button]
|
||||
id = "visible_fog_toggle"
|
||||
definition = "default"
|
||||
label= _ "Visible in fog"
|
||||
[/toggle_button]
|
||||
|
||||
[toggle_button]
|
||||
id = "visible_shroud_toggle"
|
||||
definition = "default"
|
||||
label= _ "Visible in shroud"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[slider]
|
||||
id = "slider_green"
|
||||
definition = "default"
|
||||
|
||||
minimum_value = 0
|
||||
maximum_value = 255
|
||||
step_size = 1
|
||||
value = 255
|
||||
[/slider]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[toggle_button]
|
||||
id = "visible_shroud_toggle"
|
||||
definition = "default"
|
||||
label= _ "Visible in shroud"
|
||||
[/toggle_button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[slider]
|
||||
id = "slider_blue"
|
||||
definition = "default"
|
||||
|
||||
minimum_value = 0
|
||||
maximum_value = 255
|
||||
step_size = 1
|
||||
value = 255
|
||||
[/slider]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
|
|
152
data/gui/default/window/label_settings.cfg
Normal file
152
data/gui/default/window/label_settings.cfg
Normal file
|
@ -0,0 +1,152 @@
|
|||
#textdomain wesnoth-lib
|
||||
###
|
||||
### Definition of the window to choose which categories of gamemap labels to display
|
||||
###
|
||||
|
||||
[window]
|
||||
id = "label_settings"
|
||||
description = "Editor map label editor."
|
||||
|
||||
[resolution]
|
||||
definition = "default"
|
||||
|
||||
automatic_placement = "true"
|
||||
vertical_placement = "center"
|
||||
horizontal_placement = "center"
|
||||
|
||||
maximum_width = 800
|
||||
|
||||
[tooltip]
|
||||
id = "tooltip_large"
|
||||
[/tooltip]
|
||||
|
||||
[helptip]
|
||||
id = "tooltip_large"
|
||||
[/helptip]
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
[label]
|
||||
id = "title"
|
||||
definition = "title"
|
||||
|
||||
label = _ "Show or Hide Labels"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
grow_factor = 1
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[listbox]
|
||||
id = "label_types"
|
||||
definition = "default"
|
||||
|
||||
[list_definition]
|
||||
[row]
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
vertical_grow = true
|
||||
|
||||
[toggle_panel]
|
||||
[grid]
|
||||
[row]
|
||||
[column]
|
||||
grow_factor = 2
|
||||
horizontal_grow = "true"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[label]
|
||||
id = "cat_name"
|
||||
wrap = true
|
||||
[/label]
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
grow_factor = 0
|
||||
horizontal_grow = "false"
|
||||
border = "all"
|
||||
border_size = 5
|
||||
[toggle_button]
|
||||
id = "cat_status"
|
||||
definition = "default"
|
||||
[/toggle_button]
|
||||
[/column]
|
||||
[/row]
|
||||
[/grid]
|
||||
[/toggle_panel]
|
||||
[/column]
|
||||
[/row]
|
||||
[/list_definition]
|
||||
[/listbox]
|
||||
[/column]
|
||||
[/row]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
[column]
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
grow_factor = 0
|
||||
|
||||
{GUI_FILLER}
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[button]
|
||||
id = "ok"
|
||||
definition = "default"
|
||||
|
||||
label = _ "OK"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[button]
|
||||
id = "cancel"
|
||||
definition = "default"
|
||||
|
||||
label = _ "Cancel"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
[/grid]
|
||||
[/resolution]
|
||||
[/window]
|
|
@ -116,7 +116,7 @@
|
|||
id=actions-menu
|
||||
title= _ "Actions"
|
||||
image=classic/lite
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,endturn
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,label_settings,endturn
|
||||
rect="+2,=,+100,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
|
|
@ -97,7 +97,7 @@
|
|||
id=actions-menu
|
||||
title= _ "Actions"
|
||||
image=button_menu/menu_button_copper_H20
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,endturn
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,label_settings,endturn
|
||||
rect="+2,=,+100,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
|
|
@ -111,7 +111,7 @@
|
|||
id=menu-main
|
||||
title= _ "Menu"
|
||||
image=button_square/button_square_60
|
||||
items=objectives,statistics,unitlist,statustable,save,savereplay,load,preferences,chatlog,AUTOSAVES,help,stopnetwork,startnetwork,quit,undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud
|
||||
items=objectives,statistics,unitlist,statustable,save,savereplay,load,preferences,chatlog,AUTOSAVES,help,stopnetwork,startnetwork,quit,undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,speak,recruit,recall,label_settings,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud
|
||||
#,endturn
|
||||
ref=sidebar-panel
|
||||
font_size=30
|
||||
|
|
|
@ -117,7 +117,7 @@
|
|||
id=actions-menu
|
||||
title= _ "Actions"
|
||||
image=button_menu/menu_button_copper_H20
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,endturn
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,label_settings,endturn
|
||||
rect="+2,=,+100,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
|
|
@ -147,7 +147,7 @@
|
|||
id=actions-menu
|
||||
title= _ "Actions"
|
||||
image=button_menu/menu_button_copper_H20
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,endturn
|
||||
items=undo,redo,wbexecuteallactions,wbexecuteaction,wbdeleteaction,cycle,speak,recruit,recall,showenemymoves,bestenemymoves,wbtoggle,delayshroud,updateshroud,label_settings,endturn
|
||||
rect="+2,=,+100,="
|
||||
xanchor=fixed
|
||||
yanchor=fixed
|
||||
|
|
|
@ -23,6 +23,10 @@ Version 1.13.1+dev:
|
|||
* User interface:
|
||||
* Added a version dialog button to the title screen, replacing the Paths
|
||||
option previously found in Preferences -> General.
|
||||
* Added an interface to hide labels placed by certain players or belonging
|
||||
to certain categories (such as village names).
|
||||
* By default, labels placed by ignored players are hidden. You can override
|
||||
this using the above interface.
|
||||
|
||||
|
||||
Version 1.13.1:
|
||||
|
|
|
@ -668,6 +668,8 @@
|
|||
<Unit filename="../../src/gui/dialogs/gamestate_inspector.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/gamestate_inspector.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/helper.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/label_settings.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/label_settings.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/language_selection.cpp" />
|
||||
<Unit filename="../../src/gui/dialogs/language_selection.hpp" />
|
||||
<Unit filename="../../src/gui/dialogs/lobby/lobby_data.cpp" />
|
||||
|
|
|
@ -3049,6 +3049,7 @@
|
|||
<File Name="../../data/gui/default/window/mp_create_game.cfg"/>
|
||||
<File Name="../../data/gui/default/window/mp_change_control.cfg"/>
|
||||
<File Name="../../data/gui/default/window/mp_depcheck_select_new.cfg"/>
|
||||
<File Name="../../data/gui/default/window/label_settings.cfg"/>
|
||||
<File Name="../../data/gui/default/window/language_selection.cfg"/>
|
||||
<File Name="../../data/gui/default/window/tooltip_large.cfg"/>
|
||||
<File Name="../../data/gui/default/window/editor_resize_map.cfg"/>
|
||||
|
@ -3737,11 +3738,13 @@
|
|||
<File Name="../../src/gui/dialogs/mp_host_game_prompt.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/gamestate_inspector.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/mp_cmd_wrapper.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/label_settings.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/language_selection.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/network_transmission.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/editor_generate_map.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/wml_message.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/message.hpp"/>
|
||||
<File Name="../../src/gui/dialogs/label_settings.cpp"/>
|
||||
<File Name="../../src/gui/dialogs/language_selection.cpp"/>
|
||||
<File Name="../../src/gui/dialogs/wml_message.cpp"/>
|
||||
<File Name="../../src/gui/dialogs/mp_depcheck_select_new.hpp"/>
|
||||
|
|
|
@ -8713,6 +8713,61 @@
|
|||
RelativePath="..\..\src\gui\dialogs\helper.hpp"
|
||||
>
|
||||
</File>
|
||||
<File
|
||||
RelativePath="..\..\src\gui\dialogs\label_settings.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\label_settings.hpp"
|
||||
>
|
||||
<File
|
||||
RelativePath="..\..\src\gui\dialogs\language_selection.cpp"
|
||||
>
|
||||
|
|
|
@ -76,6 +76,7 @@
|
|||
62D24F351519995200350848 /* palette_manager.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62D24F341519995200350848 /* palette_manager.cpp */; };
|
||||
62E48250154D865E001DD4FC /* pane.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 62E4824E154D865E001DD4FC /* pane.cpp */; };
|
||||
8D11072F0486CEB800E47090 /* Cocoa.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = 1058C7A1FEA54F0111CA2CBB /* Cocoa.framework */; };
|
||||
91B6217C1B74E6D200B00E0F /* label_settings.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 91B6217A1B74E6D100B00E0F /* label_settings.cpp */; };
|
||||
B504B94C1284C06B00261FE9 /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B504B94A1284C06B00261FE9 /* tips.cpp */; };
|
||||
B504B94D1284C06B00261FE9 /* tips.cpp in Sources */ = {isa = PBXBuildFile; fileRef = B504B94A1284C06B00261FE9 /* tips.cpp */; };
|
||||
B508D13F10013BF900B12852 /* Growl.framework in Frameworks */ = {isa = PBXBuildFile; fileRef = B508D13E10013BF900B12852 /* Growl.framework */; };
|
||||
|
@ -1257,6 +1258,8 @@
|
|||
62E4824F154D865E001DD4FC /* pane.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = pane.hpp; sourceTree = "<group>"; };
|
||||
8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
|
||||
8D1107320486CEB800E47090 /* Wesnoth.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = Wesnoth.app; sourceTree = BUILT_PRODUCTS_DIR; };
|
||||
91B6217A1B74E6D100B00E0F /* label_settings.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = label_settings.cpp; sourceTree = "<group>"; };
|
||||
91B6217B1B74E6D100B00E0F /* label_settings.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = label_settings.hpp; sourceTree = "<group>"; };
|
||||
B504B94A1284C06B00261FE9 /* tips.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = tips.cpp; sourceTree = "<group>"; };
|
||||
B504B94B1284C06B00261FE9 /* tips.hpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.h; path = tips.hpp; sourceTree = "<group>"; };
|
||||
B508D13E10013BF900B12852 /* Growl.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = Growl.framework; path = lib/Growl.framework; sourceTree = "<group>"; };
|
||||
|
@ -3890,6 +3893,8 @@
|
|||
B561F36F104B11B6001369F5 /* formula_debugger.hpp */,
|
||||
B59F9731103716E400A57C1A /* unit_create.cpp */,
|
||||
B59F9732103716E400A57C1A /* unit_create.hpp */,
|
||||
91B6217A1B74E6D100B00E0F /* label_settings.cpp */,
|
||||
91B6217B1B74E6D100B00E0F /* label_settings.hpp */,
|
||||
B59F96EB1034796700A57C1A /* lobby_player_info.cpp */,
|
||||
B59F96EC1034796700A57C1A /* lobby_player_info.hpp */,
|
||||
B5951A931013BB3400C10B66 /* game_delete.cpp */,
|
||||
|
@ -4894,6 +4899,7 @@
|
|||
ECC2FFFC1A51A91100023AF4 /* unit_attack_type.cpp in Sources */,
|
||||
F4C02A10182F1F64008525C6 /* lua_api.cpp in Sources */,
|
||||
F4C02A11182F1F64008525C6 /* lua_types.cpp in Sources */,
|
||||
91B6217C1B74E6D200B00E0F /* label_settings.cpp in Sources */,
|
||||
);
|
||||
runOnlyForDeploymentPostprocessing = 0;
|
||||
};
|
||||
|
|
|
@ -874,6 +874,7 @@ set(wesnoth-main_SRC
|
|||
gui/dialogs/game_save.cpp
|
||||
gui/dialogs/game_version.cpp
|
||||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
gui/dialogs/language_selection.cpp
|
||||
gui/dialogs/lobby/lobby_data.cpp
|
||||
gui/dialogs/lobby/lobby_info.cpp
|
||||
|
|
|
@ -424,6 +424,7 @@ wesnoth_sources = Split("""
|
|||
gui/dialogs/game_save.cpp
|
||||
gui/dialogs/game_version.cpp
|
||||
gui/dialogs/gamestate_inspector.cpp
|
||||
gui/dialogs/label_settings.cpp
|
||||
gui/dialogs/language_selection.cpp
|
||||
gui/dialogs/lobby/lobby_data.cpp
|
||||
gui/dialogs/lobby/lobby_info.cpp
|
||||
|
|
|
@ -1367,7 +1367,7 @@ private:
|
|||
SDL_Color color = int_to_color(team::get_side_rgb(ai_.get_side()));
|
||||
|
||||
const terrain_label *res;
|
||||
res = gui->labels().set_label(location, text, team_name, color);
|
||||
res = gui->labels().set_label(location, text, ai_.get_side() - 1, team_name, color);
|
||||
if (res && resources::recorder)
|
||||
resources::recorder->add_label(res);
|
||||
}
|
||||
|
|
|
@ -57,7 +57,7 @@ static void display_label(int /*side*/, const map_location& location, const std:
|
|||
SDL_Color color = int_to_color(team::get_side_rgb(surrounded ? 2 : 1 ) );//@fixme: for tests
|
||||
|
||||
const terrain_label *res;
|
||||
res = gui->labels().set_label(location, text, team_name, color);
|
||||
res = gui->labels().set_label(location, text, surrounded, team_name, color);
|
||||
if (res && resources::recorder)
|
||||
resources::recorder->add_label(res);
|
||||
}
|
||||
|
|
|
@ -22,6 +22,10 @@
|
|||
|
||||
#include <boost/foreach.hpp>
|
||||
|
||||
std::vector<std::string>& display_context::hidden_label_categories_ref() {
|
||||
return const_cast<std::vector<std::string>&>(this->hidden_label_categories());
|
||||
}
|
||||
|
||||
bool display_context::would_be_discovered(const map_location & loc, int side_num, bool see_all)
|
||||
{
|
||||
map_location adjs[6];
|
||||
|
|
|
@ -54,6 +54,8 @@ public:
|
|||
virtual const std::vector<team> & teams() const = 0;
|
||||
virtual const gamemap & map() const = 0;
|
||||
virtual const unit_map & units() const = 0;
|
||||
virtual const std::vector<std::string> & hidden_label_categories() const = 0;
|
||||
std::vector<std::string> & hidden_label_categories_ref();
|
||||
|
||||
// Helper for is_visible_to_team
|
||||
|
||||
|
|
|
@ -37,7 +37,7 @@ editor_action* editor_action_label::perform(map_context& mc) const
|
|||
const terrain_label *old_label = mc.get_labels().get_label(loc_);
|
||||
if (old_label) {
|
||||
undo.reset(new editor_action_label(loc_, old_label->text(), old_label->team_name(), old_label->color()
|
||||
, old_label->visible_in_fog(), old_label->visible_in_shroud(), old_label->immutable()) );
|
||||
, old_label->visible_in_fog(), old_label->visible_in_shroud(), old_label->immutable(), old_label->category()) );
|
||||
} else {
|
||||
undo.reset(new editor_action_label_delete(loc_));
|
||||
}
|
||||
|
@ -49,7 +49,7 @@ editor_action* editor_action_label::perform(map_context& mc) const
|
|||
void editor_action_label::perform_without_undo(map_context& mc) const
|
||||
{
|
||||
mc.get_labels()
|
||||
.set_label(loc_, text_, team_name_, color_, visible_fog_, visible_shroud_, immutable_);
|
||||
.set_label(loc_, text_, -1, team_name_, color_, visible_fog_, visible_shroud_, immutable_, category_);
|
||||
}
|
||||
|
||||
editor_action_label_delete* editor_action_label_delete::clone() const
|
||||
|
@ -66,7 +66,7 @@ editor_action* editor_action_label_delete::perform(map_context& mc) const
|
|||
if (!deleted) return NULL;
|
||||
|
||||
undo.reset(new editor_action_label(loc_, deleted->text(), deleted->team_name()
|
||||
, deleted->color(), deleted->visible_in_fog(), deleted->visible_in_shroud(), deleted->immutable()));
|
||||
, deleted->color(), deleted->visible_in_fog(), deleted->visible_in_shroud(), deleted->immutable(), deleted->category()));
|
||||
|
||||
perform_without_undo(mc);
|
||||
return undo.release();
|
||||
|
|
|
@ -41,8 +41,8 @@ class editor_action_label : public editor_action_location
|
|||
{
|
||||
public:
|
||||
editor_action_label(map_location loc, const std::string& text, const std::string& team_name,
|
||||
SDL_Color color, bool visible_fog, bool visible_shroud, bool immutable)
|
||||
: editor_action_location(loc), text_(text) , team_name_(team_name), color_(color)
|
||||
SDL_Color color, bool visible_fog, bool visible_shroud, bool immutable, std::string category)
|
||||
: editor_action_location(loc), text_(text) , team_name_(team_name), category_(category), color_(color)
|
||||
, visible_fog_(visible_fog), visible_shroud_(visible_shroud), immutable_(immutable)
|
||||
{
|
||||
}
|
||||
|
@ -53,6 +53,7 @@ class editor_action_label : public editor_action_location
|
|||
protected:
|
||||
const std::string text_;
|
||||
const std::string team_name_;
|
||||
const std::string category_;
|
||||
SDL_Color color_;
|
||||
bool visible_fog_;
|
||||
bool visible_shroud_;
|
||||
|
|
|
@ -52,7 +52,7 @@ editor_action* mouse_action_map_label::drag_left(editor_display& disp, int x, in
|
|||
partial = true;
|
||||
chain = new editor_action_chain(new editor_action_label_delete(last_draged_));
|
||||
chain->append_action(new editor_action_label(hex, label->text(), label->team_name(), label->color(),
|
||||
label->visible_in_shroud(), label->visible_in_fog(), label->immutable()));
|
||||
label->visible_in_shroud(), label->visible_in_fog(), label->immutable(), label->category()));
|
||||
}
|
||||
|
||||
last_draged_ = hex;
|
||||
|
@ -72,16 +72,18 @@ editor_action* mouse_action_map_label::up_left(editor_display& disp, int x, int
|
|||
const terrain_label* old_label = editor::get_current_labels()->get_label(hex);
|
||||
std::string label = old_label ? old_label->text() : "";
|
||||
std::string team_name = old_label ? old_label->team_name() : "";
|
||||
std::string category = old_label ? old_label->category() : "";
|
||||
bool visible_shroud = old_label ? old_label->visible_in_shroud() : false;
|
||||
bool visible_fog = old_label ? old_label->visible_in_fog() : true;
|
||||
bool immutable = old_label ? old_label->immutable() : true;
|
||||
SDL_Color color = old_label ? old_label->color() : font::NORMAL_COLOR;
|
||||
|
||||
gui2::teditor_edit_label d(label, immutable, visible_fog, visible_shroud);
|
||||
gui2::teditor_edit_label d(label, immutable, visible_fog, visible_shroud, color, category);
|
||||
|
||||
editor_action* a = NULL;
|
||||
if(d.show(disp.video())) {
|
||||
a = new editor_action_label(hex, label, team_name, font::NORMAL_COLOR
|
||||
, visible_fog, visible_shroud, immutable);
|
||||
a = new editor_action_label(hex, label, team_name, color
|
||||
, visible_fog, visible_shroud, immutable, category);
|
||||
update_brush_highlights(disp, hex);
|
||||
}
|
||||
return a;
|
||||
|
|
|
@ -35,14 +35,16 @@ class dummy_editor_display_context : public display_context
|
|||
editor_map em;
|
||||
unit_map u;
|
||||
std::vector<team> t;
|
||||
std::vector<std::string> lbls;
|
||||
|
||||
public:
|
||||
dummy_editor_display_context() : dummy_cfg1(), em(dummy_cfg1), u(), t() {}
|
||||
dummy_editor_display_context() : dummy_cfg1(), em(dummy_cfg1), u(), t(), lbls() {}
|
||||
virtual ~dummy_editor_display_context(){}
|
||||
|
||||
virtual const gamemap & map() const { return em; }
|
||||
virtual const unit_map & units() const { return u; }
|
||||
virtual const std::vector<team> & teams() const { return t; }
|
||||
virtual const std::vector<std::string> & hidden_label_categories() const { return lbls; }
|
||||
};
|
||||
|
||||
const display_context * get_dummy_display_context() {
|
||||
|
|
|
@ -136,6 +136,9 @@ public:
|
|||
virtual const gamemap & map() const {
|
||||
return map_;
|
||||
}
|
||||
virtual const std::vector<std::string>& hidden_label_categories() const {
|
||||
return lbl_categories_;
|
||||
}
|
||||
|
||||
/**
|
||||
* Replace the [time]s of the currently active area.
|
||||
|
@ -478,6 +481,7 @@ private:
|
|||
map_labels labels_;
|
||||
unit_map units_;
|
||||
std::vector<team> teams_;
|
||||
std::vector<std::string> lbl_categories_;
|
||||
boost::scoped_ptr<tod_manager> tod_manager_;
|
||||
mp_game_settings mp_settings_;
|
||||
game_classification game_classification_;
|
||||
|
|
|
@ -54,6 +54,7 @@ namespace events {
|
|||
class game_board : public display_context {
|
||||
|
||||
std::vector<team> teams_;
|
||||
std::vector<std::string> labels_;
|
||||
|
||||
boost::scoped_ptr<gamemap> map_;
|
||||
unit_map units_;
|
||||
|
@ -93,6 +94,7 @@ class game_board : public display_context {
|
|||
virtual const std::vector<team> & teams() const { return teams_; }
|
||||
virtual const gamemap & map() const { return *map_; }
|
||||
virtual const unit_map & units() const { return units_; }
|
||||
virtual const std::vector<std::string> & hidden_label_categories() const { return labels_; }
|
||||
|
||||
// Copy and swap idiom, because we have a scoped pointer.
|
||||
|
||||
|
|
|
@ -175,6 +175,13 @@ void game_state::init(const int ticks, play_controller & pc)
|
|||
{
|
||||
build_team_stage_two(tb_ptr);
|
||||
}
|
||||
for(size_t i = 0; i < board_.teams_.size(); i++) {
|
||||
// Labels from players in your ignore list default to hidden
|
||||
if(preferences::is_ignored(board_.teams_[i].current_player())) {
|
||||
std::string label_cat = "side:" + str_cast(i + 1);
|
||||
board_.hidden_label_categories_ref().push_back(label_cat);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
pathfind_manager_.reset(new pathfind::manager(level_));
|
||||
|
|
|
@ -456,6 +456,7 @@ config default_map_generator::create_scenario(boost::optional<boost::uint32_t> r
|
|||
|
||||
config& label = res.add_child("label");
|
||||
label["text"] = i->second;
|
||||
label["category"] = "villages";
|
||||
i->first.write(label);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -18,6 +18,9 @@
|
|||
|
||||
#include "gui/widgets/settings.hpp"
|
||||
|
||||
#include <SDL_video.h>
|
||||
#include <boost/bind.hpp>
|
||||
|
||||
namespace gui2
|
||||
{
|
||||
|
||||
|
@ -49,7 +52,10 @@ REGISTER_DIALOG(editor_edit_label)
|
|||
teditor_edit_label::teditor_edit_label(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud)
|
||||
bool& visible_shroud,
|
||||
SDL_Color& color,
|
||||
std::string& category)
|
||||
: color_store(color)
|
||||
{
|
||||
// std::string text = label.text();
|
||||
// bool immutable = label.immutable();
|
||||
|
@ -65,8 +71,26 @@ teditor_edit_label::teditor_edit_label(std::string& text,
|
|||
// true;
|
||||
|
||||
register_text("label", true, text, true);
|
||||
register_text("category", true, category, false);
|
||||
register_bool("immutable_toggle", true, immutable);
|
||||
register_bool("visible_fog_toggle", true, visible_fog);
|
||||
register_bool("visible_shroud_toggle", true, visible_shroud);
|
||||
register_color_component("slider_red", &SDL_Color::r);
|
||||
register_color_component("slider_green", &SDL_Color::g);
|
||||
register_color_component("slider_blue", &SDL_Color::b);
|
||||
}
|
||||
|
||||
void teditor_edit_label::register_color_component(std::string widget_id, Uint8 SDL_Color::* component) {
|
||||
register_integer(widget_id, true,
|
||||
boost::bind(&teditor_edit_label::load_color_component, this, component),
|
||||
boost::bind(&teditor_edit_label::save_color_component, this, component, _1));
|
||||
}
|
||||
|
||||
int teditor_edit_label::load_color_component(Uint8 SDL_Color::* component) {
|
||||
return color_store.*component;
|
||||
}
|
||||
|
||||
void teditor_edit_label::save_color_component(Uint8 SDL_Color::* component, const int value) {
|
||||
color_store.*component = value;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -36,20 +36,28 @@ public:
|
|||
teditor_edit_label(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud);
|
||||
bool& visible_shroud,
|
||||
SDL_Color& color,
|
||||
std::string& category);
|
||||
|
||||
/** The execute function see @ref tdialog for more information. */
|
||||
static bool execute(std::string& text,
|
||||
bool& immutable,
|
||||
bool& visible_fog,
|
||||
bool& visible_shroud,
|
||||
SDL_Color& color,
|
||||
std::string& category,
|
||||
CVideo& video)
|
||||
{
|
||||
return teditor_edit_label(text, immutable, visible_fog, visible_shroud)
|
||||
return teditor_edit_label(text, immutable, visible_fog, visible_shroud, color, category)
|
||||
.show(video);
|
||||
}
|
||||
|
||||
private:
|
||||
SDL_Color& color_store;
|
||||
int load_color_component(Uint8 SDL_Color::* component);
|
||||
void save_color_component(Uint8 SDL_Color::* component, const int value);
|
||||
void register_color_component(std::string widget_id, Uint8 SDL_Color::* component);
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
};
|
||||
|
|
103
src/gui/dialogs/label_settings.cpp
Normal file
103
src/gui/dialogs/label_settings.cpp
Normal file
|
@ -0,0 +1,103 @@
|
|||
/*
|
||||
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 "label_settings.hpp"
|
||||
|
||||
#include <vector>
|
||||
#include <boost/bind.hpp>
|
||||
#include "gettext.hpp"
|
||||
#include "game_display.hpp"
|
||||
#include "map_label.hpp"
|
||||
#include "resources.hpp"
|
||||
#include "gui/auxiliary/find_widget.tpp"
|
||||
#include "gui/widgets/control.hpp"
|
||||
#include "gui/widgets/listbox.hpp"
|
||||
#include "gui/widgets/window.hpp"
|
||||
#include "gui/widgets/settings.hpp"
|
||||
#include "gui/widgets/toggle_button.hpp"
|
||||
#include "gui/widgets/label.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
REGISTER_DIALOG(label_settings);
|
||||
|
||||
tlabel_settings::tlabel_settings(display_context& dc) : viewer(dc) {
|
||||
const std::vector<std::string>& all_categories = resources::screen->labels().all_categories();
|
||||
const std::vector<std::string>& hidden_categories = viewer.hidden_label_categories();
|
||||
|
||||
for(size_t i = 0; i < all_categories.size(); i++) {
|
||||
all_labels[all_categories[i]] = true;
|
||||
if(all_categories[i].substr(0,4) == "cat:")
|
||||
labels_display[all_categories[i]] = all_categories[i].substr(4);
|
||||
else if(all_categories[i] == "team")
|
||||
labels_display[all_categories[i]] = _("Team Labels");
|
||||
// TODO: Translatable names for categories?
|
||||
}
|
||||
for(size_t i = 0; i < hidden_categories.size(); i++) {
|
||||
all_labels[hidden_categories[i]] = false;
|
||||
}
|
||||
for(size_t i = 0; i < dc.teams().size(); i++) {
|
||||
labels_display["side:" + str_cast(i + 1)] = dc.teams()[i].name();
|
||||
}
|
||||
}
|
||||
|
||||
void tlabel_settings::pre_show(CVideo& /*video*/, twindow& window) {
|
||||
std::map<std::string, string_map> list_data;
|
||||
tlistbox& cats_listbox = find_widget<tlistbox>(&window, "label_types", false);
|
||||
FOREACH(const AUTO & label_entry, all_labels) {
|
||||
const std::string& category = label_entry.first;
|
||||
const bool& visible = label_entry.second;
|
||||
|
||||
std::string name = labels_display[category];
|
||||
if(category.substr(0,5) == "side:") {
|
||||
int team = lexical_cast<int>(category.substr(5)) - 1;
|
||||
Uint32 which_color = game_config::tc_info(viewer.teams()[team].color())[0];
|
||||
std::ostringstream sout;
|
||||
sout << "<span color='#" << std::hex << which_color << "'>" << name << "</span>";
|
||||
name = sout.str();
|
||||
}
|
||||
|
||||
list_data["cat_name"]["label"] = name;
|
||||
cats_listbox.add_row(list_data);
|
||||
|
||||
tgrid* grid = cats_listbox.get_row_grid(cats_listbox.get_item_count() - 1);
|
||||
ttoggle_button& status = find_widget<ttoggle_button>(grid, "cat_status", false);
|
||||
status.set_value(visible);
|
||||
status.set_callback_state_change(boost::bind(&tlabel_settings::toggle_category, this, _1, category));
|
||||
|
||||
if(category.substr(0,5) == "side:") {
|
||||
tlabel& label = find_widget<tlabel>(grid, "cat_name", false);
|
||||
label.set_use_markup(true);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
bool tlabel_settings::execute(display_context& dc, CVideo& video) {
|
||||
tlabel_settings window(dc);
|
||||
if(!window.show(video)) return false;
|
||||
std::vector<std::string> hidden_categories;
|
||||
typedef std::map<std::string,bool>::value_type value_type;
|
||||
BOOST_FOREACH(value_type lbl, window.all_labels) {
|
||||
if(lbl.second == false) {
|
||||
hidden_categories.push_back(lbl.first);
|
||||
}
|
||||
}
|
||||
dc.hidden_label_categories_ref().swap(hidden_categories);
|
||||
return true;
|
||||
}
|
||||
|
||||
void tlabel_settings::toggle_category(twidget& box, std::string category) {
|
||||
all_labels[category] = static_cast<ttoggle_button&>(box).get_value();
|
||||
}
|
||||
}
|
50
src/gui/dialogs/label_settings.hpp
Normal file
50
src/gui/dialogs/label_settings.hpp
Normal file
|
@ -0,0 +1,50 @@
|
|||
/*
|
||||
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_LABEL_SETTINGS_HPP_INCLUDED
|
||||
#define GUI_DIALOGS_LABEL_SETTINGS_HPP_INCLUDED
|
||||
|
||||
#include "gui/dialogs/dialog.hpp"
|
||||
#include <map>
|
||||
#include "display_context.hpp"
|
||||
#include "tstring.hpp"
|
||||
|
||||
namespace gui2 {
|
||||
|
||||
class tlabel_settings : public tdialog {
|
||||
public:
|
||||
tlabel_settings(display_context& dc);
|
||||
|
||||
/**
|
||||
* The execute function.
|
||||
*
|
||||
* See @ref tdialog for more information.
|
||||
*/
|
||||
static bool execute(display_context& dc, CVideo& video);
|
||||
private:
|
||||
std::map<std::string, bool> all_labels;
|
||||
std::map<std::string, t_string> labels_display;
|
||||
display_context& viewer;
|
||||
|
||||
/** Inherited from tdialog, implemented by REGISTER_DIALOG. */
|
||||
virtual const std::string& window_id() const;
|
||||
|
||||
/** Inherited from tdialog. */
|
||||
void pre_show(CVideo& video, twindow& window);
|
||||
|
||||
/** Callback for toggling a checkbox state. */
|
||||
void toggle_category(twidget& box, std::string category);
|
||||
};
|
||||
}
|
||||
|
||||
#endif
|
|
@ -108,6 +108,9 @@ bool command_executor::execute_command(const hotkey_command& cmd, int /*index*/
|
|||
case HOTKEY_RECALL:
|
||||
recall();
|
||||
break;
|
||||
case HOTKEY_LABEL_SETTINGS:
|
||||
label_settings();
|
||||
break;
|
||||
case HOTKEY_RECRUIT:
|
||||
recruit();
|
||||
break;
|
||||
|
|
|
@ -67,6 +67,7 @@ public:
|
|||
virtual void start_network() {}
|
||||
virtual void label_terrain(bool /*team_only*/) {}
|
||||
virtual void clear_labels() {}
|
||||
virtual void label_settings() {}
|
||||
virtual void show_enemy_moves(bool /*ignore_units*/) {}
|
||||
virtual void toggle_shroud_updates() {}
|
||||
virtual void update_shroud_now() {}
|
||||
|
|
|
@ -70,6 +70,7 @@ hotkey::hotkey_command_temp hotkey_list_[] = {
|
|||
{ hotkey::HOTKEY_RECRUIT, "recruit", N_("Recruit"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_REPEAT_RECRUIT, "repeatrecruit", N_("Repeat Recruit"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_RECALL, "recall", N_("Recall"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_LABEL_SETTINGS, "label_settings", N_("Show/Hide Labels"), false, scope_game, "" },
|
||||
{ hotkey::HOTKEY_ENDTURN, "endturn", N_("End Turn"), false, scope_game, "" },
|
||||
//TODO: why has HOTKEY_TOGGLE_ELLIPSES more than scope_game ?
|
||||
{ hotkey::HOTKEY_TOGGLE_ELLIPSES, "toggleellipses", N_("Toggle Ellipses"), false, scope_game | scope_editor | scope_main, "" },
|
||||
|
|
|
@ -79,6 +79,7 @@ enum HOTKEY_COMMAND {
|
|||
HOTKEY_CUSTOM_CMD,
|
||||
HOTKEY_AI_FORMULA,
|
||||
HOTKEY_CLEAR_MSG,
|
||||
HOTKEY_LABEL_SETTINGS,
|
||||
|
||||
// Minimap
|
||||
HOTKEY_MINIMAP_CODING_TERRAIN, HOTKEY_MINIMAP_CODING_UNIT,
|
||||
|
|
|
@ -298,6 +298,7 @@ bool play_controller::hotkey_handler::can_execute_command(const hotkey::hotkey_c
|
|||
case hotkey::HOTKEY_MINIMAP_DRAW_VILLAGES:
|
||||
case hotkey::HOTKEY_NULL:
|
||||
case hotkey::HOTKEY_SAVE_REPLAY:
|
||||
case hotkey::HOTKEY_LABEL_SETTINGS:
|
||||
case hotkey::LUA_CONSOLE:
|
||||
return true;
|
||||
|
||||
|
|
|
@ -50,6 +50,7 @@ bool replay_controller::hotkey_handler::can_execute_command(const hotkey::hotkey
|
|||
case hotkey::HOTKEY_REPLAY_SKIP_ANIMATION:
|
||||
case hotkey::HOTKEY_SAVE_GAME:
|
||||
case hotkey::HOTKEY_SAVE_REPLAY:
|
||||
case hotkey::HOTKEY_LABEL_SETTINGS:
|
||||
case hotkey::HOTKEY_CHAT_LOG:
|
||||
return true;
|
||||
|
||||
|
|
|
@ -123,6 +123,10 @@ void playsingle_controller::hotkey_handler::clear_messages(){
|
|||
menu_handler_.clear_messages();
|
||||
}
|
||||
|
||||
void playsingle_controller::hotkey_handler::label_settings(){
|
||||
menu_handler_.label_settings();
|
||||
}
|
||||
|
||||
void playsingle_controller::hotkey_handler::whiteboard_toggle() {
|
||||
whiteboard_manager_->set_active(!whiteboard_manager_->is_active());
|
||||
|
||||
|
|
|
@ -54,6 +54,7 @@ public:
|
|||
virtual void kill_unit();
|
||||
virtual void label_terrain(bool);
|
||||
virtual void clear_labels();
|
||||
virtual void label_settings();
|
||||
virtual void continue_move();
|
||||
virtual void unit_hold_position();
|
||||
virtual void end_unit_turn();
|
||||
|
|
|
@ -43,7 +43,7 @@ inline bool is_fogged(const display& disp, const map_location& loc)
|
|||
}
|
||||
|
||||
map_labels::map_labels(const display &disp, const team *team) :
|
||||
disp_(disp), team_(team), labels_(), enabled_(true)
|
||||
disp_(disp), team_(team), labels_(), enabled_(true), categories_dirty(true)
|
||||
{
|
||||
}
|
||||
|
||||
|
@ -139,17 +139,20 @@ void map_labels::set_team(const team* team)
|
|||
if ( team_ != team )
|
||||
{
|
||||
team_ = team;
|
||||
categories_dirty = true;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
const terrain_label* map_labels::set_label(const map_location& loc,
|
||||
const t_string& text,
|
||||
const int creator,
|
||||
const std::string& team_name,
|
||||
const SDL_Color color,
|
||||
const bool visible_in_fog,
|
||||
const bool visible_in_shroud,
|
||||
const bool immutable,
|
||||
const std::string& category,
|
||||
const t_string& tooltip )
|
||||
{
|
||||
terrain_label* res = NULL;
|
||||
|
@ -176,7 +179,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
|
|||
}
|
||||
else
|
||||
{
|
||||
current_label->second->update_info(text, tooltip, team_name, color, visible_in_fog, visible_in_shroud, immutable);
|
||||
current_label->second->update_info(text, creator, tooltip, team_name, color, visible_in_fog, visible_in_shroud, immutable, category);
|
||||
res = current_label->second;
|
||||
}
|
||||
}
|
||||
|
@ -187,6 +190,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
|
|||
|
||||
// Add the new label.
|
||||
res = new terrain_label(text,
|
||||
creator,
|
||||
team_name,
|
||||
loc,
|
||||
*this,
|
||||
|
@ -194,6 +198,7 @@ const terrain_label* map_labels::set_label(const map_location& loc,
|
|||
visible_in_fog,
|
||||
visible_in_shroud,
|
||||
immutable,
|
||||
category,
|
||||
tooltip);
|
||||
add_label(loc, res);
|
||||
|
||||
|
@ -201,12 +206,14 @@ const terrain_label* map_labels::set_label(const map_location& loc,
|
|||
if ( global_label != NULL )
|
||||
global_label->recalculate();
|
||||
}
|
||||
categories_dirty = true;
|
||||
return res;
|
||||
}
|
||||
|
||||
void map_labels::add_label(const map_location &loc, terrain_label *new_label)
|
||||
{
|
||||
labels_[new_label->team_name()][loc] = new_label;
|
||||
categories_dirty = true;
|
||||
}
|
||||
|
||||
void map_labels::clear(const std::string& team_name, bool force)
|
||||
|
@ -222,6 +229,7 @@ void map_labels::clear(const std::string& team_name, bool force)
|
|||
{
|
||||
clear_map(i->second, force);
|
||||
}
|
||||
categories_dirty = true;
|
||||
}
|
||||
|
||||
void map_labels::clear_map(label_map &m, bool force)
|
||||
|
@ -234,6 +242,7 @@ void map_labels::clear_map(label_map &m, bool force)
|
|||
m.erase(i++);
|
||||
} else ++i;
|
||||
}
|
||||
categories_dirty = true;
|
||||
}
|
||||
|
||||
void map_labels::clear_all()
|
||||
|
@ -286,9 +295,30 @@ void map_labels::recalculate_shroud()
|
|||
}
|
||||
}
|
||||
|
||||
const std::vector<std::string>& map_labels::all_categories() const {
|
||||
if(categories_dirty) {
|
||||
categories_dirty = false;
|
||||
categories.clear();
|
||||
categories.push_back("team");
|
||||
for(size_t i = 1; i <= resources::teams->size(); i++) {
|
||||
categories.push_back("side:" + str_cast(i));
|
||||
}
|
||||
std::set<std::string> unique_cats;
|
||||
BOOST_FOREACH(const team_label_map::value_type& m, labels_) {
|
||||
BOOST_FOREACH(const label_map::value_type& l, m.second) {
|
||||
if(l.second->category().empty()) continue;
|
||||
unique_cats.insert("cat:" + l.second->category());
|
||||
}
|
||||
}
|
||||
std::copy(unique_cats.begin(), unique_cats.end(), std::back_inserter(categories));
|
||||
}
|
||||
return categories;
|
||||
}
|
||||
|
||||
|
||||
/// creating new label
|
||||
terrain_label::terrain_label(const t_string& text,
|
||||
const int creator,
|
||||
const std::string& team_name,
|
||||
const map_location& loc,
|
||||
const map_labels& parent,
|
||||
|
@ -296,14 +326,17 @@ terrain_label::terrain_label(const t_string& text,
|
|||
const bool visible_in_fog,
|
||||
const bool visible_in_shroud,
|
||||
const bool immutable,
|
||||
const std::string& category,
|
||||
const t_string& tooltip ) :
|
||||
handle_(0),
|
||||
text_(text),
|
||||
tooltip_(tooltip),
|
||||
category_(category),
|
||||
team_name_(team_name),
|
||||
visible_in_fog_(visible_in_fog),
|
||||
visible_in_shroud_(visible_in_shroud),
|
||||
immutable_(immutable),
|
||||
creator_(creator),
|
||||
color_(color),
|
||||
parent_(&parent),
|
||||
loc_(loc)
|
||||
|
@ -320,6 +353,7 @@ terrain_label::terrain_label(const map_labels &parent, const config &cfg) :
|
|||
visible_in_fog_(true),
|
||||
visible_in_shroud_(false),
|
||||
immutable_(true),
|
||||
creator_(-1),
|
||||
color_(),
|
||||
parent_(&parent),
|
||||
loc_()
|
||||
|
@ -347,6 +381,17 @@ void terrain_label::read(const config &cfg)
|
|||
visible_in_fog_ = cfg["visible_in_fog"].to_bool(true);
|
||||
visible_in_shroud_ = cfg["visible_in_shroud"].to_bool();
|
||||
immutable_ = cfg["immutable"].to_bool(true);
|
||||
category_ = cfg["category"].str();
|
||||
|
||||
int side = cfg["side"].to_int(-1);
|
||||
if(side >= 0) {
|
||||
creator_ = side - 1;
|
||||
} else if(cfg["side"].str() == "current") {
|
||||
config::attribute_value current_side = vs.get_variable_const("side_number");
|
||||
if(!current_side.empty()) {
|
||||
creator_ = current_side.to_int();
|
||||
}
|
||||
}
|
||||
|
||||
text_ = utils::interpolate_variables_into_tstring(text_, vs); // Not moved to rendering, as that would depend on variables at render-time
|
||||
team_name_ = utils::interpolate_variables_into_string(team_name_, vs);
|
||||
|
@ -371,6 +416,8 @@ void terrain_label::write(config& cfg) const
|
|||
cfg["visible_in_fog"] = visible_in_fog_;
|
||||
cfg["visible_in_shroud"] = visible_in_shroud_;
|
||||
cfg["immutable"] = immutable_;
|
||||
cfg["category"] = category_;
|
||||
cfg["side"] = creator_ + 1;
|
||||
}
|
||||
|
||||
const t_string& terrain_label::text() const
|
||||
|
@ -383,6 +430,16 @@ const t_string& terrain_label::tooltip() const
|
|||
return tooltip_;
|
||||
}
|
||||
|
||||
int terrain_label::creator() const
|
||||
{
|
||||
return creator_;
|
||||
}
|
||||
|
||||
const std::string& terrain_label::category() const
|
||||
{
|
||||
return category_;
|
||||
}
|
||||
|
||||
const std::string& terrain_label::team_name() const
|
||||
{
|
||||
return team_name_;
|
||||
|
@ -434,6 +491,7 @@ void terrain_label::set_text(const t_string& text)
|
|||
}
|
||||
|
||||
void terrain_label::update_info(const t_string& text,
|
||||
const int creator,
|
||||
const t_string& tooltip,
|
||||
const std::string& team_name,
|
||||
const SDL_Color color)
|
||||
|
@ -442,21 +500,25 @@ void terrain_label::update_info(const t_string& text,
|
|||
text_ = text;
|
||||
tooltip_ = tooltip;
|
||||
team_name_ = team_name;
|
||||
creator_ = creator;
|
||||
draw();
|
||||
}
|
||||
|
||||
void terrain_label::update_info(const t_string& text,
|
||||
const int creator,
|
||||
const t_string& tooltip,
|
||||
const std::string& team_name,
|
||||
const SDL_Color color,
|
||||
const bool visible_in_fog,
|
||||
const bool visible_in_shroud,
|
||||
const bool immutable)
|
||||
const bool immutable,
|
||||
const std::string& category)
|
||||
{
|
||||
visible_in_fog_ = visible_in_fog;
|
||||
visible_in_shroud_ = visible_in_shroud;
|
||||
immutable_ = immutable;
|
||||
update_info(text, tooltip, team_name, color);
|
||||
category_ = category;
|
||||
update_info(text, creator, tooltip, team_name, color);
|
||||
}
|
||||
|
||||
void terrain_label::recalculate()
|
||||
|
@ -539,6 +601,18 @@ void terrain_label::draw()
|
|||
*/
|
||||
bool terrain_label::hidden() const
|
||||
{
|
||||
// Respect user's label preferences
|
||||
std::string category = "cat:" + category_;
|
||||
std::string creator = "side:" + str_cast(creator_ + 1);
|
||||
const std::vector<std::string>& hidden_categories = parent_->disp().get_disp_context().hidden_label_categories();
|
||||
|
||||
if(std::find(hidden_categories.begin(), hidden_categories.end(), category) != hidden_categories.end())
|
||||
return true;
|
||||
if(creator_ >= 0 && std::find(hidden_categories.begin(), hidden_categories.end(), creator) != hidden_categories.end())
|
||||
return true;
|
||||
if(!team_name().empty() && std::find(hidden_categories.begin(), hidden_categories.end(), "team") != hidden_categories.end())
|
||||
return true;
|
||||
|
||||
// Fog can hide some labels.
|
||||
if ( !visible_in_fog_ && is_fogged(parent_->disp(), loc_) )
|
||||
return true;
|
||||
|
|
|
@ -47,11 +47,13 @@ public:
|
|||
const terrain_label* get_label(const map_location& loc) const;
|
||||
const terrain_label* set_label(const map_location& loc,
|
||||
const t_string& text,
|
||||
const int creator = -1,
|
||||
const std::string& team = "",
|
||||
const SDL_Color color = font::NORMAL_COLOR,
|
||||
const bool visible_in_fog = true,
|
||||
const bool visible_in_shroud = false,
|
||||
const bool immutable = false,
|
||||
const std::string& category = "",
|
||||
const t_string& tooltip = "" );
|
||||
|
||||
bool enabled() const { return enabled_; }
|
||||
|
@ -69,6 +71,7 @@ public:
|
|||
const display& disp() const;
|
||||
|
||||
const std::string& team_name() const;
|
||||
const std::vector<std::string>& all_categories() const;
|
||||
|
||||
void set_team(const team*);
|
||||
|
||||
|
@ -91,6 +94,9 @@ private:
|
|||
|
||||
team_label_map labels_;
|
||||
bool enabled_;
|
||||
|
||||
mutable std::vector<std::string> categories;
|
||||
mutable bool categories_dirty;
|
||||
};
|
||||
|
||||
/// To store label data
|
||||
|
@ -99,6 +105,7 @@ class terrain_label
|
|||
{
|
||||
public:
|
||||
terrain_label(const t_string& text,
|
||||
const int creator,
|
||||
const std::string& team_name,
|
||||
const map_location& loc,
|
||||
const map_labels& parent,
|
||||
|
@ -106,6 +113,7 @@ public:
|
|||
const bool visible_in_fog = true,
|
||||
const bool visible_in_shroud = false,
|
||||
const bool immutable = false,
|
||||
const std::string& category = "",
|
||||
const t_string& tooltip = "" );
|
||||
|
||||
terrain_label(const map_labels &, const config &);
|
||||
|
@ -117,7 +125,9 @@ public:
|
|||
|
||||
const t_string& text() const;
|
||||
const t_string& tooltip() const;
|
||||
int creator() const;
|
||||
const std::string& team_name() const;
|
||||
const std::string& category() const;
|
||||
bool visible_in_fog() const;
|
||||
bool visible_in_shroud() const;
|
||||
bool immutable() const;
|
||||
|
@ -127,17 +137,20 @@ public:
|
|||
void set_text(const t_string&);
|
||||
|
||||
void update_info(const t_string&,
|
||||
const int creator,
|
||||
const t_string&,
|
||||
const std::string&,
|
||||
const SDL_Color);
|
||||
|
||||
void update_info(const t_string& text,
|
||||
const int creator,
|
||||
const t_string& tooltip,
|
||||
const std::string& team_name,
|
||||
const SDL_Color color,
|
||||
const bool visible_in_fog,
|
||||
const bool visible_in_shroud,
|
||||
const bool immutable);
|
||||
const bool immutable,
|
||||
const std::string& category);
|
||||
|
||||
void recalculate();
|
||||
void calculate_shroud();
|
||||
|
@ -156,10 +169,12 @@ private:
|
|||
|
||||
t_string text_;
|
||||
t_string tooltip_;
|
||||
std::string category_;
|
||||
std::string team_name_;
|
||||
bool visible_in_fog_;
|
||||
bool visible_in_shroud_;
|
||||
bool immutable_;
|
||||
int creator_;
|
||||
|
||||
SDL_Color color_;
|
||||
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
#include "gettext.hpp"
|
||||
#include "gui/dialogs/chat_log.hpp"
|
||||
#include "gui/dialogs/edit_label.hpp"
|
||||
#include "gui/dialogs/label_settings.hpp"
|
||||
#include "gui/dialogs/message.hpp"
|
||||
#include "gui/dialogs/transient_message.hpp"
|
||||
#include "gui/dialogs/wml_message.hpp"
|
||||
|
@ -1180,7 +1181,7 @@ void menu_handler::label_terrain(mouse_handler& mousehandler, bool team_only)
|
|||
} else {
|
||||
color = int_to_color(team::get_side_rgb(gui_->viewing_side()));
|
||||
}
|
||||
const terrain_label* res = gui_->labels().set_label(loc, label, team_name, color);
|
||||
const terrain_label* res = gui_->labels().set_label(loc, label, gui_->viewing_team(), team_name, color);
|
||||
if (res)
|
||||
resources::recorder->add_label(res);
|
||||
}
|
||||
|
@ -1195,6 +1196,12 @@ void menu_handler::clear_labels()
|
|||
resources::recorder->clear_labels(gui_->current_team_name(), false);
|
||||
}
|
||||
}
|
||||
|
||||
void menu_handler::label_settings() {
|
||||
// TODO: I think redraw_everything might be a bit too much? It causes a flicker.
|
||||
if(gui2::tlabel_settings::execute(board(), gui_->video()))
|
||||
gui_->redraw_everything();
|
||||
}
|
||||
|
||||
void menu_handler::continue_move(mouse_handler &mousehandler, int side_num)
|
||||
{
|
||||
|
|
|
@ -77,6 +77,7 @@ public:
|
|||
void kill_unit(mouse_handler& mousehandler);
|
||||
void label_terrain(mouse_handler& mousehandler, bool team_only);
|
||||
void clear_labels();
|
||||
void label_settings();
|
||||
void continue_move(mouse_handler &mousehandler, int side_num);
|
||||
void execute_gotos(mouse_handler &mousehandler, int side_num);
|
||||
void toggle_ellipses();
|
||||
|
|
|
@ -68,6 +68,7 @@ public:
|
|||
: um_()
|
||||
, gm_(&dc.map())
|
||||
, tm_(&dc.teams())
|
||||
, lbls_(&dc.hidden_label_categories())
|
||||
{
|
||||
static unit_map empty_unit_map;
|
||||
um_ = &empty_unit_map;
|
||||
|
@ -75,11 +76,13 @@ public:
|
|||
const unit_map & units() const { return *um_; }
|
||||
const gamemap & map() const { return *gm_; }
|
||||
const std::vector<team> & teams() const { return *tm_; }
|
||||
const std::vector<std::string> & hidden_label_categories() const { return *lbls_; }
|
||||
|
||||
private:
|
||||
const unit_map * um_;
|
||||
const gamemap * gm_;
|
||||
const std::vector<team> * tm_;
|
||||
const std::vector<std::string> * lbls_;
|
||||
};
|
||||
|
||||
class ignore_units_filter_context : public filter_context {
|
||||
|
|
|
@ -717,6 +717,7 @@ REPLAY_RETURN do_replay_handle(bool one_move)
|
|||
|
||||
resources::screen->labels().set_label(label.location(),
|
||||
label.text(),
|
||||
label.creator(),
|
||||
label.team_name(),
|
||||
label.color());
|
||||
}
|
||||
|
|
|
@ -3585,8 +3585,8 @@ int game_lua_kernel::intf_label(lua_State *L)
|
|||
|
||||
terrain_label label(screen.labels(), cfg.get_config());
|
||||
|
||||
screen.labels().set_label(label.location(), label.text(), label.team_name(), label.color(),
|
||||
label.visible_in_fog(), label.visible_in_shroud(), label.immutable(), label.tooltip());
|
||||
screen.labels().set_label(label.location(), label.text(), label.creator(), label.team_name(), label.color(),
|
||||
label.visible_in_fog(), label.visible_in_shroud(), label.immutable(), label.category(), label.tooltip());
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -49,6 +49,7 @@
|
|||
#include "gui/dialogs/game_version.hpp"
|
||||
#include "gui/dialogs/game_save.hpp"
|
||||
#include "gui/dialogs/gamestate_inspector.hpp"
|
||||
#include "gui/dialogs/label_settings.hpp"
|
||||
#include "gui/dialogs/language_selection.hpp"
|
||||
#include "gui/dialogs/lobby_main.hpp"
|
||||
#include "gui/dialogs/lobby_player_info.hpp"
|
||||
|
|
Loading…
Add table
Reference in a new issue