Merge lp:~widelands-dev/widelands/background_images into lp:widelands

Proposed by GunChleoc
Status: Merged
Merged at revision: 8704
Proposed branch: lp:~widelands-dev/widelands/background_images
Merge into: lp:widelands
Diff against target: 6731 lines (+1333/-1093)
177 files modified
data/templates/default/init.lua (+101/-0)
src/editor/tools/decrease_height_tool.cc (+0/-1)
src/editor/tools/decrease_resources_tool.cc (+0/-2)
src/editor/tools/increase_height_tool.cc (+0/-1)
src/editor/tools/increase_resources_tool.cc (+0/-2)
src/editor/tools/info_tool.cc (+1/-3)
src/editor/tools/place_critter_tool.cc (+0/-1)
src/editor/tools/set_height_tool.cc (+0/-1)
src/editor/tools/set_origin_tool.cc (+0/-1)
src/editor/tools/set_port_space_tool.cc (+0/-1)
src/editor/tools/set_resources_tool.cc (+0/-2)
src/editor/tools/set_starting_pos_tool.cc (+0/-2)
src/editor/tools/tool.h (+1/-5)
src/editor/ui_menus/categorized_item_selection_menu.h (+2/-5)
src/editor/ui_menus/main_menu.cc (+11/-41)
src/editor/ui_menus/main_menu_load_or_save_map.cc (+6/-8)
src/editor/ui_menus/main_menu_map_options.cc (+11/-20)
src/editor/ui_menus/main_menu_new_map.cc (+5/-6)
src/editor/ui_menus/main_menu_random_map.cc (+12/-13)
src/editor/ui_menus/main_menu_save_map.cc (+5/-7)
src/editor/ui_menus/main_menu_save_map_make_directory.cc (+3/-10)
src/editor/ui_menus/player_menu.cc (+7/-10)
src/editor/ui_menus/tool_change_height_options_menu.cc (+2/-3)
src/editor/ui_menus/tool_change_resources_options_menu.cc (+2/-2)
src/editor/ui_menus/tool_noise_height_options_menu.cc (+3/-4)
src/editor/ui_menus/tool_place_critter_options_menu.cc (+0/-1)
src/editor/ui_menus/tool_place_immovable_options_menu.cc (+0/-1)
src/editor/ui_menus/tool_set_terrain_options_menu.cc (+0/-2)
src/editor/ui_menus/toolsize_menu.cc (+2/-2)
src/game_io/CMakeLists.txt (+0/-1)
src/game_io/game_preload_packet.cc (+0/-1)
src/graphic/CMakeLists.txt (+15/-3)
src/graphic/game_renderer.cc (+0/-1)
src/graphic/gl/road_program.cc (+0/-1)
src/graphic/graphic.cc (+5/-1)
src/graphic/graphic.h (+7/-0)
src/graphic/minimap_renderer.cc (+0/-1)
src/graphic/panel_styles.cc (+1/-0)
src/graphic/panel_styles.h (+57/-0)
src/graphic/style_manager.cc (+199/-0)
src/graphic/style_manager.h (+63/-0)
src/graphic/texture.cc (+0/-1)
src/io/filesystem/filesystem.cc (+1/-1)
src/logic/CMakeLists.txt (+0/-1)
src/logic/editor_game_base.cc (+0/-1)
src/logic/game.cc (+0/-1)
src/logic/map.cc (+0/-1)
src/logic/map_objects/bob.cc (+0/-1)
src/logic/map_objects/map_object.h (+1/-3)
src/logic/map_objects/tribes/building.cc (+0/-1)
src/logic/map_objects/tribes/dismantlesite.cc (+0/-1)
src/logic/map_objects/tribes/production_program.cc (+0/-1)
src/logic/map_objects/tribes/ship.cc (+0/-1)
src/logic/map_objects/tribes/ware_descr.cc (+0/-1)
src/logic/map_objects/tribes/worker_descr.cc (+0/-1)
src/logic/map_objects/tribes/worker_program.cc (+0/-1)
src/logic/map_objects/world/critter.cc (+0/-1)
src/logic/map_objects/world/terrain_description.h (+1/-1)
src/logic/map_objects/world/world.cc (+1/-0)
src/map_io/map_building_packet.cc (+0/-1)
src/scripting/CMakeLists.txt (+0/-1)
src/scripting/lua_interface.cc (+1/-1)
src/scripting/lua_map.cc (+0/-1)
src/sound/CMakeLists.txt (+0/-1)
src/sound/sound_handler.cc (+0/-1)
src/ui_basic/CMakeLists.txt (+1/-0)
src/ui_basic/box.cc (+3/-3)
src/ui_basic/button.cc (+82/-69)
src/ui_basic/button.h (+32/-16)
src/ui_basic/dropdown.cc (+8/-8)
src/ui_basic/dropdown.h (+6/-21)
src/ui_basic/editbox.cc (+7/-7)
src/ui_basic/editbox.h (+3/-4)
src/ui_basic/fileview_panel.cc (+11/-8)
src/ui_basic/fileview_panel.h (+2/-3)
src/ui_basic/fullscreen_window.cc (+72/-52)
src/ui_basic/fullscreen_window.h (+20/-6)
src/ui_basic/icongrid.cc (+4/-5)
src/ui_basic/listselect.cc (+8/-5)
src/ui_basic/listselect.h (+6/-19)
src/ui_basic/messagebox.cc (+10/-11)
src/ui_basic/multilineeditbox.cc (+12/-21)
src/ui_basic/multilineeditbox.h (+1/-10)
src/ui_basic/multilinetextarea.cc (+2/-9)
src/ui_basic/multilinetextarea.h (+1/-4)
src/ui_basic/panel.cc (+16/-0)
src/ui_basic/panel.h (+3/-0)
src/ui_basic/scrollbar.cc (+4/-3)
src/ui_basic/scrollbar.h (+4/-6)
src/ui_basic/slider.cc (+13/-10)
src/ui_basic/slider.h (+7/-7)
src/ui_basic/spinbox.cc (+11/-10)
src/ui_basic/spinbox.h (+1/-2)
src/ui_basic/table.cc (+7/-8)
src/ui_basic/table.h (+16/-16)
src/ui_basic/tabpanel.cc (+24/-21)
src/ui_basic/tabpanel.h (+3/-6)
src/ui_basic/window.cc (+6/-5)
src/ui_fsmenu/CMakeLists.txt (+0/-3)
src/ui_fsmenu/about.cc (+2/-3)
src/ui_fsmenu/campaign_select.cc (+17/-9)
src/ui_fsmenu/helpwindow.cc (+3/-3)
src/ui_fsmenu/internet_lobby.cc (+11/-14)
src/ui_fsmenu/launch_game.cc (+5/-18)
src/ui_fsmenu/launch_game.h (+0/-1)
src/ui_fsmenu/launch_mpg.cc (+23/-15)
src/ui_fsmenu/launch_mpg.h (+0/-1)
src/ui_fsmenu/launch_spg.cc (+3/-4)
src/ui_fsmenu/launch_spg.h (+0/-2)
src/ui_fsmenu/load_map_or_game.cc (+2/-4)
src/ui_fsmenu/load_map_or_game.h (+0/-2)
src/ui_fsmenu/loadgame.cc (+2/-2)
src/ui_fsmenu/main.cc (+9/-45)
src/ui_fsmenu/main_menu.cc (+0/-1)
src/ui_fsmenu/main_menu.h (+0/-1)
src/ui_fsmenu/mapselect.cc (+2/-3)
src/ui_fsmenu/multiplayer.cc (+7/-20)
src/ui_fsmenu/netsetup_lan.cc (+12/-7)
src/ui_fsmenu/options.cc (+17/-25)
src/ui_fsmenu/singleplayer.cc (+6/-26)
src/wui/CMakeLists.txt (+0/-1)
src/wui/actionconfirm.cc (+8/-10)
src/wui/attack_box.cc (+4/-6)
src/wui/attack_box.h (+0/-1)
src/wui/building_statistics_menu.cc (+20/-20)
src/wui/buildingwindow.cc (+24/-25)
src/wui/buildingwindow.h (+1/-0)
src/wui/constructionsitewindow.cc (+0/-1)
src/wui/dismantlesitewindow.cc (+0/-1)
src/wui/economy_options_window.cc (+11/-10)
src/wui/encyclopedia_window.cc (+12/-10)
src/wui/fieldaction.cc (+3/-4)
src/wui/game_chat_menu.cc (+1/-1)
src/wui/game_debug_ui.cc (+7/-8)
src/wui/game_main_menu_save_game.cc (+4/-4)
src/wui/game_message_menu.cc (+21/-26)
src/wui/game_objectives_menu.cc (+2/-2)
src/wui/game_options_menu.cc (+6/-6)
src/wui/game_options_sound_menu.cc (+4/-5)
src/wui/game_statistics_menu.cc (+4/-4)
src/wui/game_summary.cc (+9/-8)
src/wui/gamechatpanel.cc (+4/-3)
src/wui/gamechatpanel.h (+7/-1)
src/wui/gamedetails.cc (+6/-9)
src/wui/gamedetails.h (+2/-3)
src/wui/general_statistics_menu.cc (+8/-8)
src/wui/helpwindow.cc (+1/-1)
src/wui/inputqueuedisplay.cc (+8/-10)
src/wui/interactive_base.cc (+6/-5)
src/wui/interactive_base.h (+0/-1)
src/wui/interactive_player.h (+0/-6)
src/wui/interactive_spectator.cc (+0/-3)
src/wui/load_or_save_game.cc (+3/-4)
src/wui/load_or_save_game.h (+1/-1)
src/wui/login_box.cc (+14/-16)
src/wui/mapdetails.cc (+11/-12)
src/wui/mapdetails.h (+2/-4)
src/wui/maptable.cc (+3/-2)
src/wui/maptable.h (+1/-1)
src/wui/mapview.cc (+0/-1)
src/wui/militarysitewindow.cc (+0/-1)
src/wui/minimap.cc (+12/-12)
src/wui/multiplayersetupgroup.cc (+8/-9)
src/wui/playerdescrgroup.cc (+4/-5)
src/wui/plot_area.h (+1/-2)
src/wui/productionsitewindow.cc (+5/-6)
src/wui/seafaring_statistics_menu.cc (+10/-10)
src/wui/shipwindow.cc (+2/-3)
src/wui/soldiercapacitycontrol.cc (+2/-2)
src/wui/stock_menu.cc (+1/-1)
src/wui/story_message_box.cc (+2/-4)
src/wui/trainingsitewindow.cc (+0/-1)
src/wui/ware_statistics_menu.cc (+2/-3)
src/wui/ware_statistics_menu.h (+0/-1)
src/wui/warehousewindow.cc (+1/-2)
src/wui/watchwindow.cc (+11/-12)
utils/win32/innosetup/Widelands.iss (+1/-0)
To merge this branch: bzr merge lp:~widelands-dev/widelands/background_images
Reviewer Review Type Date Requested Status
Benedikt Straub Needs Fixing
kaputtnik (community) testing Approve
Review via email: mp+337629@code.launchpad.net

Commit message

Use Lua to define background and button styles

- Background images and colors are now defined in data/templates/default
- Combine common background graphics with color overlays
- Added StyleManager class to load and access backgrounds
- Downscale background images (e.g. campaign maps) on small screens
- New graphics for ui_fsmenu
- Darker background for wui elements

Description of the change

Use Lua to define background and button styles

The icing on the cake would be to use RGBA color instead of RGB for the color overlays, but I couldn't get it to work.

To post a comment you must log in.
Revision history for this message
kaputtnik (franku) wrote :

Uff, this is a big change :-D Needs a bit familiarization...

In general i think the new background is better, because it is less noisy. After playing around with the main menus and in game menus i think two colors need a bit tweaking:

The bluish buttons appears on one of my monitors more petrol colored. Maybe add a bit more blue?
The background of the stock has a touch of violet. Reduce red?

Just my opinion :-)

Is there a possibility to play with the colors without restarting widelands every time? I have tried with gimp, but the rgb-values provided in the lua file look totally different over there.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3180. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/341039129.
Appveyor build 2987. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-2987.

Revision history for this message
GunChleoc (gunchleoc) wrote :

All we have of the old fullscreen graphics are some flattend jpg files dating back to sourceforge, so the only way to go ahead was to completely redo the graphics. I showed some screen shots last summer on the forum: https://wl.widelands.org/forum/topic/2881/

I'd be happy to have someone help with tweaking the colors :)

Sorry, but reloading the graphics in-game is not trivial.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3206. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/342943879.
Appveyor build 3015. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-3015.

Revision history for this message
kaputtnik (franku) wrote :

Let's do a try for other coloring in a different branch :-)

I have tested this branch by playing a game, check editor and opened all dialogs. So i think this could be merged without a code review?

review: Approve (testing)
Revision history for this message
GunChleoc (gunchleoc) wrote :

No code review is dangerous. I'd like to have at least src/graphic/style_manager reviewed.

Revision history for this message
GunChleoc (gunchleoc) wrote :
Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3396. State: failed. Details: https://travis-ci.org/widelands/widelands/builds/369727261.
Appveyor build 3202. State: failed. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-3202.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3433. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/373592122.
Appveyor build 3238. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-3238.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

As far as I can judge, this should work fine. Didn´t test it though.

I mainly checked the logic behind the code and found nothing that can go wrong; if it compiles and works, I guess there are no problems c++-wise either.
I reviewed style_manager.*, panel_styles.h, the drawing-related functions and the lua script; the rest is just moving some pieces of code and converting all UI elements to the new style definitions, isn´t it?

review: Approve (review)
Revision history for this message
GunChleoc (gunchleoc) wrote :

Yes it is, thanks for the review!

I want to give this a final test under Windows before I merge.

Revision history for this message
GunChleoc (gunchleoc) wrote :

This crashes on my Windows without any indication of what's wrong in the log.

Revision history for this message
Benedikt Straub (nordfriese) wrote :

I compiled the branch and I can reproduce the crash.
Assert fail and backtrace (if you didn´t debug it already :) ):

widelands: ../src/graphic/graphic.cc:111: void Graphic::initialize(const Graphic::TraceGl&, int, int, bool): Assertion `SDL_BYTESPERPIXEL(disp_mode.format) == 4' failed.

Program received signal SIGABRT, Aborted.
0xb7fd6d09 in __kernel_vsyscall ()
(gdb) bt
#0 0xb7fd6d09 in __kernel_vsyscall ()
#1 0xb759a832 in __libc_signal_restore_set (set=0xbfffeabc) at ../sysdeps/unix/sysv/linux/nptl-signals.h:80
#2 __GI_raise (sig=6) at ../sysdeps/unix/sysv/linux/raise.c:48
#3 0xb759bcc1 in __GI_abort () at abort.c:79
#4 0xb75927bb in __assert_fail_base (fmt=0xb76ee848 "%s%s%s:%u: %s%sAssertion `%s' failed.\n%n",
    assertion=0x1463c28 "SDL_BYTESPERPIXEL(disp_mode.format) == 4", file=0x1463b66 "../src/graphic/graphic.cc", line=111,
    function=0x1463d00 <Graphic::initialize(Graphic::TraceGl const&, int, int, bool)::__PRETTY_FUNCTION__> "void Graphic::initialize(const Graphic::TraceGl&, int, int, bool)") at assert.c:92
#5 0xb7592819 in __GI___assert_fail (assertion=0x1463c28 "SDL_BYTESPERPIXEL(disp_mode.format) == 4",
    file=0x1463b66 "../src/graphic/graphic.cc", line=111,
    function=0x1463d00 <Graphic::initialize(Graphic::TraceGl const&, int, int, bool)::__PRETTY_FUNCTION__> "void Graphic::initialize(const Graphic::TraceGl&, int, int, bool)") at assert.c:101
#6 0x00d8ec6b in Graphic::initialize (this=0x1b39b20, trace_gl=@0xbfffeecc: Graphic::TraceGl::kNo, window_mode_w=1270, window_mode_h=1710,
    init_fullscreen=false) at ../src/graphic/graphic.cc:111
#7 0x00cbe0e2 in WLApplication::WLApplication (this=0x19bd5c0, argc=1, argv=0xbffff074) at ../src/wlapplication.cc:343
#8 0x00cbd8f1 in WLApplication::get (argc=1, argv=0xbffff074) at ../src/wlapplication.cc:262
#9 0x00cbca29 in main (argc=1, argv=0xbffff074) at ../src/main.cc:47

No idea what´s going wrong here...

review: Needs Fixing
Revision history for this message
GunChleoc (gunchleoc) wrote :

Thanks! All I could get out of gdb on Windows is error code 3... I did some changes to the initialize function, so that's a place to start.

I am also trying to set up a build environment on Windows, but I'm still busy with compiling the libraries...

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3498. State: errored. Details: https://travis-ci.org/widelands/widelands/builds/378009939.
Appveyor build 3303. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-3303.

Revision history for this message
bunnybot (widelandsofficial) wrote :

Continuous integration builds have changed state:

Travis build 3502. State: passed. Details: https://travis-ci.org/widelands/widelands/builds/378103984.
Appveyor build 3307. State: success. Details: https://ci.appveyor.com/project/widelands-dev/widelands/build/_widelands_dev_widelands_background_images-3307.

Revision history for this message
GunChleoc (gunchleoc) wrote :

Fixed it :)

There were 2 problems:

1. Wrong file separator for Windows
2. New directory not added to InnoSetup

@bunnybot merge

Preview Diff

[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
1=== removed file 'data/images/ui_basic/but0.png'
2Binary files data/images/ui_basic/but0.png 2014-12-03 10:10:14 +0000 and data/images/ui_basic/but0.png 1970-01-01 00:00:00 +0000 differ
3=== removed file 'data/images/ui_basic/but1.png'
4Binary files data/images/ui_basic/but1.png 2014-12-03 10:10:14 +0000 and data/images/ui_basic/but1.png 1970-01-01 00:00:00 +0000 differ
5=== removed file 'data/images/ui_basic/but2.png'
6Binary files data/images/ui_basic/but2.png 2014-12-03 10:10:14 +0000 and data/images/ui_basic/but2.png 1970-01-01 00:00:00 +0000 differ
7=== removed file 'data/images/ui_basic/but3.png'
8Binary files data/images/ui_basic/but3.png 2014-12-03 10:10:14 +0000 and data/images/ui_basic/but3.png 1970-01-01 00:00:00 +0000 differ
9=== removed file 'data/images/ui_basic/but4.png'
10Binary files data/images/ui_basic/but4.png 2014-12-03 10:10:14 +0000 and data/images/ui_basic/but4.png 1970-01-01 00:00:00 +0000 differ
11=== removed file 'data/images/ui_basic/but5.png'
12Binary files data/images/ui_basic/but5.png 2015-10-04 19:26:02 +0000 and data/images/ui_basic/but5.png 1970-01-01 00:00:00 +0000 differ
13=== removed file 'data/images/ui_fsmenu/top_left.png'
14Binary files data/images/ui_fsmenu/top_left.png 2016-10-31 08:33:56 +0000 and data/images/ui_fsmenu/top_left.png 1970-01-01 00:00:00 +0000 differ
15=== removed file 'data/images/wui/window_background_dark.png'
16Binary files data/images/wui/window_background_dark.png 2016-10-05 08:04:18 +0000 and data/images/wui/window_background_dark.png 1970-01-01 00:00:00 +0000 differ
17=== added directory 'data/templates'
18=== added directory 'data/templates/default'
19=== added directory 'data/templates/default/fsmenu'
20=== renamed file 'data/images/ui_fsmenu/background.png' => 'data/templates/default/fsmenu/background.png'
21Binary files data/images/ui_fsmenu/background.png 2016-10-31 12:09:15 +0000 and data/templates/default/fsmenu/background.png 2018-05-12 13:15:45 +0000 differ
22=== renamed file 'data/images/ui_fsmenu/bottom.png' => 'data/templates/default/fsmenu/bottom.png'
23Binary files data/images/ui_fsmenu/bottom.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom.png 2018-05-12 13:15:45 +0000 differ
24=== renamed file 'data/images/ui_fsmenu/bottom_left.png' => 'data/templates/default/fsmenu/bottom_left.png'
25Binary files data/images/ui_fsmenu/bottom_left.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom_left.png 2018-05-12 13:15:45 +0000 differ
26=== renamed file 'data/images/ui_fsmenu/bottom_right.png' => 'data/templates/default/fsmenu/bottom_right.png'
27Binary files data/images/ui_fsmenu/bottom_right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom_right.png 2018-05-12 13:15:45 +0000 differ
28=== added file 'data/templates/default/fsmenu/button.png'
29Binary files data/templates/default/fsmenu/button.png 1970-01-01 00:00:00 +0000 and data/templates/default/fsmenu/button.png 2018-05-12 13:15:45 +0000 differ
30=== renamed file 'data/images/ui_fsmenu/center.png' => 'data/templates/default/fsmenu/center.png'
31Binary files data/images/ui_fsmenu/center.png 2016-10-31 08:21:03 +0000 and data/templates/default/fsmenu/center.png 2018-05-12 13:15:45 +0000 differ
32=== renamed file 'data/images/ui_fsmenu/left.png' => 'data/templates/default/fsmenu/left.png'
33Binary files data/images/ui_fsmenu/left.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/left.png 2018-05-12 13:15:45 +0000 differ
34=== renamed file 'data/images/ui_fsmenu/right.png' => 'data/templates/default/fsmenu/right.png'
35Binary files data/images/ui_fsmenu/right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/right.png 2018-05-12 13:15:45 +0000 differ
36=== renamed file 'data/images/ui_fsmenu/top.png' => 'data/templates/default/fsmenu/top.png'
37Binary files data/images/ui_fsmenu/top.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/top.png 2018-05-12 13:15:45 +0000 differ
38=== added file 'data/templates/default/fsmenu/top_left.png'
39Binary files data/templates/default/fsmenu/top_left.png 1970-01-01 00:00:00 +0000 and data/templates/default/fsmenu/top_left.png 2018-05-12 13:15:45 +0000 differ
40=== renamed file 'data/images/ui_fsmenu/top_right.png' => 'data/templates/default/fsmenu/top_right.png'
41Binary files data/images/ui_fsmenu/top_right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/top_right.png 2018-05-12 13:15:45 +0000 differ
42=== added file 'data/templates/default/init.lua'
43--- data/templates/default/init.lua 1970-01-01 00:00:00 +0000
44+++ data/templates/default/init.lua 2018-05-12 13:15:45 +0000
45@@ -0,0 +1,101 @@
46+-- This script defines a GUI style for Widelands. At the moment, we only
47+-- support the default template.
48+-- So far, only background textures and colors can be defined, and they all have
49+-- the format { image = filename, color = {r, g, b } }.
50+
51+dirname = path.dirname(__file__)
52+
53+-- Some common elements for reuse
54+local fs_button = dirname .. "fsmenu/button.png"
55+local wui_button = dirname .. "wui/button.png"
56+
57+local fs_blue = {0, 31, 40}
58+local fs_green = {10, 50, 0}
59+local fs_brown = {45, 34, 18}
60+
61+local wui_light = {85, 63, 35}
62+local wui_green = {3, 15, 0}
63+local wui_brown = {32, 19, 8}
64+
65+-- These are the style definitions to be returned.
66+-- Note: you have to keep all the keys intact, or Widelands will not be happy.
67+return {
68+ -- Button backgrounds
69+ buttons = {
70+ -- Buttons used in Fullscreen menus
71+ fsmenu = {
72+ -- Main menu ("Single Player", "Watch Replay", ...)
73+ menu = { image = fs_button, color = fs_blue },
74+ -- Primary user selection ("OK", ...)
75+ primary = { image = fs_button, color = fs_green },
76+ -- Secondary user selection ("Cancel", "Delete", selection buttons, ...)
77+ secondary = { image = fs_button, color = fs_brown },
78+ },
79+ -- Buttons used in-game and in the editor
80+ wui = {
81+ -- Main menu ("Exit Game"), Building Windows, selection buttons, ...
82+ menu = { image = wui_button, color = wui_light },
83+ -- Primary user selection ("OK", attack, ...)
84+ primary = { image = wui_button, color = wui_green },
85+ -- Secondary user selection ("Cancel", "Delete", ...)
86+ secondary = { image = wui_button, color = wui_brown },
87+ -- Building buttons on fieldaction and building statistics need to be
88+ -- transparent in order to match the background of the tab panel.
89+ building_stats = { image = "", color = {0, 0, 0} },
90+ }
91+ },
92+ -- Slider cursors (Sound control, attack, statistics, ...)
93+ sliders = {
94+ fsmenu = {
95+ menu = { image = fs_button, color = fs_blue },
96+ },
97+ wui = {
98+ -- Sound Options, Statistics
99+ light = { image = wui_button, color = wui_brown },
100+ -- Fieldaction (attack)
101+ dark = { image = wui_button, color = wui_green },
102+ }
103+ },
104+ -- Background for tab panels
105+ tabpanels = {
106+ fsmenu = {
107+ -- Options, About, ... this comes with a hard-coded border too
108+ menu = { image = "", color = {5, 5, 5} },
109+ },
110+ wui = {
111+ -- Most in-game and in-editor tabs. Building windows, Editor tools,
112+ -- Encyclopedia, ...
113+ light = { image = "", color = {0, 0, 0} },
114+ -- Building buttons in Fieldaction and Building Statistics need a dark
115+ -- background, otherwise the icons will be hard to see.
116+ dark = { image = wui_button, color = wui_brown },
117+ }
118+ },
119+ -- Used both for one-line and multiline edit boxes
120+ editboxes = {
121+ fsmenu = {
122+ menu = { image = fs_button, color = fs_green },
123+ },
124+ wui = {
125+ menu = { image = wui_button, color = wui_brown },
126+ }
127+ },
128+ -- Background for dropdown menus
129+ dropdowns = {
130+ fsmenu = {
131+ menu = { image = fs_button, color = fs_brown },
132+ },
133+ wui = {
134+ menu = { image = wui_button, color = wui_brown },
135+ }
136+ },
137+ -- Scrollbar buttons, table headers etc.
138+ scrollbars = {
139+ fsmenu = {
140+ menu = { image = fs_button, color = fs_blue },
141+ },
142+ wui = {
143+ menu = { image = wui_button, color = wui_brown },
144+ }
145+ }
146+}
147
148=== added directory 'data/templates/default/wui'
149=== renamed file 'data/images/wui/window_background.png' => 'data/templates/default/wui/background.png'
150Binary files data/images/wui/window_background.png 2014-12-03 10:43:04 +0000 and data/templates/default/wui/background.png 2018-05-12 13:15:45 +0000 differ
151=== renamed file 'data/images/wui/window_bottom.png' => 'data/templates/default/wui/bottom.png'
152=== added file 'data/templates/default/wui/button.png'
153Binary files data/templates/default/wui/button.png 1970-01-01 00:00:00 +0000 and data/templates/default/wui/button.png 2018-05-12 13:15:45 +0000 differ
154=== renamed file 'data/images/wui/window_left.png' => 'data/templates/default/wui/left.png'
155=== renamed file 'data/images/wui/window_right.png' => 'data/templates/default/wui/right.png'
156=== renamed file 'data/images/wui/window_top.png' => 'data/templates/default/wui/top.png'
157=== modified file 'src/editor/tools/decrease_height_tool.cc'
158--- src/editor/tools/decrease_height_tool.cc 2018-04-07 16:59:00 +0000
159+++ src/editor/tools/decrease_height_tool.cc 2018-05-12 13:15:45 +0000
160@@ -23,7 +23,6 @@
161 #include "editor/tools/increase_height_tool.h"
162 #include "editor/tools/set_height_tool.h"
163 #include "logic/field.h"
164-#include "logic/map.h"
165 #include "logic/mapregion.h"
166
167 /// Decreases the heights by a value. Chages surrounding nodes if necessary.
168
169=== modified file 'src/editor/tools/decrease_resources_tool.cc'
170--- src/editor/tools/decrease_resources_tool.cc 2018-04-07 16:59:00 +0000
171+++ src/editor/tools/decrease_resources_tool.cc 2018-05-12 13:15:45 +0000
172@@ -22,10 +22,8 @@
173 #include "editor/editorinteractive.h"
174 #include "editor/tools/increase_resources_tool.h"
175 #include "editor/tools/set_resources_tool.h"
176-#include "graphic/graphic.h"
177 #include "logic/field.h"
178 #include "logic/map_objects/world/resource_description.h"
179-#include "logic/map_objects/world/world.h"
180 #include "logic/mapregion.h"
181 #include "logic/widelands_geometry.h"
182
183
184=== modified file 'src/editor/tools/increase_height_tool.cc'
185--- src/editor/tools/increase_height_tool.cc 2018-04-07 16:59:00 +0000
186+++ src/editor/tools/increase_height_tool.cc 2018-05-12 13:15:45 +0000
187@@ -21,7 +21,6 @@
188
189 #include "editor/editorinteractive.h"
190 #include "logic/field.h"
191-#include "logic/map.h"
192 #include "logic/mapregion.h"
193
194 /// Increases the heights by a value. Changes surrounding nodes if necessary.
195
196=== modified file 'src/editor/tools/increase_resources_tool.cc'
197--- src/editor/tools/increase_resources_tool.cc 2018-04-07 16:59:00 +0000
198+++ src/editor/tools/increase_resources_tool.cc 2018-05-12 13:15:45 +0000
199@@ -20,11 +20,9 @@
200 #include "editor/tools/increase_resources_tool.h"
201
202 #include "editor/editorinteractive.h"
203-#include "graphic/graphic.h"
204 #include "logic/field.h"
205 #include "logic/map_objects/world/resource_description.h"
206 #include "logic/map_objects/world/terrain_description.h"
207-#include "logic/map_objects/world/world.h"
208 #include "logic/mapregion.h"
209
210 using Widelands::TCoords;
211
212=== modified file 'src/editor/tools/info_tool.cc'
213--- src/editor/tools/info_tool.cc 2018-04-07 16:59:00 +0000
214+++ src/editor/tools/info_tool.cc 2018-05-12 13:15:45 +0000
215@@ -26,10 +26,8 @@
216
217 #include "base/i18n.h"
218 #include "editor/editorinteractive.h"
219-#include "logic/map.h"
220 #include "logic/map_objects/world/editor_category.h"
221 #include "logic/map_objects/world/terrain_description.h"
222-#include "logic/map_objects/world/world.h"
223 #include "ui_basic/multilinetextarea.h"
224 #include "ui_basic/window.h"
225
226@@ -44,7 +42,7 @@
227 UI::Window* const w =
228 new UI::Window(&parent, "field_information", 30, 30, 400, 200, _("Field Information"));
229 UI::MultilineTextarea* const multiline_textarea =
230- new UI::MultilineTextarea(w, 0, 0, w->get_inner_w(), w->get_inner_h());
231+ new UI::MultilineTextarea(w, 0, 0, w->get_inner_w(), w->get_inner_h(), UI::PanelStyle::kWui);
232
233 Widelands::Field& f = (*map)[center.node];
234
235
236=== modified file 'src/editor/tools/place_critter_tool.cc'
237--- src/editor/tools/place_critter_tool.cc 2018-04-07 16:59:00 +0000
238+++ src/editor/tools/place_critter_tool.cc 2018-05-12 13:15:45 +0000
239@@ -24,7 +24,6 @@
240 #include "logic/field.h"
241 #include "logic/map_objects/bob.h"
242 #include "logic/map_objects/world/critter.h"
243-#include "logic/map_objects/world/world.h"
244 #include "logic/mapregion.h"
245
246 /**
247
248=== modified file 'src/editor/tools/set_height_tool.cc'
249--- src/editor/tools/set_height_tool.cc 2018-04-07 16:59:00 +0000
250+++ src/editor/tools/set_height_tool.cc 2018-05-12 13:15:45 +0000
251@@ -23,7 +23,6 @@
252 #include "editor/tools/decrease_height_tool.h"
253 #include "editor/tools/increase_height_tool.h"
254 #include "logic/field.h"
255-#include "logic/map.h"
256 #include "logic/mapregion.h"
257
258 int32_t EditorSetHeightTool::handle_click_impl(const Widelands::World& world,
259
260=== modified file 'src/editor/tools/set_origin_tool.cc'
261--- src/editor/tools/set_origin_tool.cc 2018-04-07 16:59:00 +0000
262+++ src/editor/tools/set_origin_tool.cc 2018-05-12 13:15:45 +0000
263@@ -20,7 +20,6 @@
264 #include "editor/tools/set_origin_tool.h"
265
266 #include "editor/editorinteractive.h"
267-#include "logic/map.h"
268 #include "wui/mapviewpixelconstants.h"
269
270 int32_t EditorSetOriginTool::handle_click_impl(const Widelands::World&,
271
272=== modified file 'src/editor/tools/set_port_space_tool.cc'
273--- src/editor/tools/set_port_space_tool.cc 2018-04-07 16:59:00 +0000
274+++ src/editor/tools/set_port_space_tool.cc 2018-05-12 13:15:45 +0000
275@@ -21,7 +21,6 @@
276
277 #include "editor/editorinteractive.h"
278 #include "editor/tools/tool.h"
279-#include "logic/map.h"
280 #include "logic/map_objects/tribes/building.h"
281 #include "logic/mapfringeregion.h"
282 #include "logic/mapregion.h"
283
284=== modified file 'src/editor/tools/set_resources_tool.cc'
285--- src/editor/tools/set_resources_tool.cc 2018-04-07 16:59:00 +0000
286+++ src/editor/tools/set_resources_tool.cc 2018-05-12 13:15:45 +0000
287@@ -22,10 +22,8 @@
288 #include "editor/editorinteractive.h"
289 #include "editor/tools/decrease_resources_tool.h"
290 #include "editor/tools/increase_resources_tool.h"
291-#include "graphic/graphic.h"
292 #include "logic/field.h"
293 #include "logic/map_objects/world/resource_description.h"
294-#include "logic/map_objects/world/world.h"
295 #include "logic/mapregion.h"
296
297 int32_t EditorSetResourcesTool::handle_click_impl(const Widelands::World& world,
298
299=== modified file 'src/editor/tools/set_starting_pos_tool.cc'
300--- src/editor/tools/set_starting_pos_tool.cc 2018-04-07 16:59:00 +0000
301+++ src/editor/tools/set_starting_pos_tool.cc 2018-05-12 13:15:45 +0000
302@@ -21,9 +21,7 @@
303
304 #include "editor/editorinteractive.h"
305 #include "editor/tools/tool.h"
306-#include "graphic/graphic.h"
307 #include "graphic/playercolor.h"
308-#include "logic/map.h"
309
310 // global variable to pass data from callback to class
311 static int32_t current_player_;
312
313=== modified file 'src/editor/tools/tool.h'
314--- src/editor/tools/tool.h 2018-04-07 16:59:00 +0000
315+++ src/editor/tools/tool.h 2018-05-12 13:15:45 +0000
316@@ -24,16 +24,12 @@
317
318 #include "base/macros.h"
319 #include "editor/tools/action_args.h"
320-#include "graphic/graphic.h"
321 #include "graphic/image.h"
322 #include "logic/editor_game_base.h"
323+#include "logic/map_objects/world/world.h"
324 #include "logic/widelands_geometry.h"
325
326 class EditorInteractive;
327-namespace Widelands {
328-class Map;
329-class World;
330-}
331
332 /**
333 * An editor tool is a tool that can be selected in the editor. Examples are:
334
335=== modified file 'src/editor/ui_menus/categorized_item_selection_menu.h'
336--- src/editor/ui_menus/categorized_item_selection_menu.h 2018-04-07 16:59:00 +0000
337+++ src/editor/ui_menus/categorized_item_selection_menu.h 2018-05-12 13:15:45 +0000
338@@ -27,7 +27,6 @@
339 #include "boost/format.hpp"
340
341 #include "base/i18n.h"
342-#include "graphic/graphic.h"
343 #include "graphic/image.h"
344 #include "logic/description_maintainer.h"
345 #include "logic/map_objects/world/editor_category.h"
346@@ -83,19 +82,17 @@
347 descriptions_(descriptions),
348 select_correct_tool_(select_correct_tool),
349 protect_against_recursive_select_(false),
350- tab_panel_(this, g_gr->images().get("images/wui/window_background_dark.png")),
351+ tab_panel_(this, UI::TabPanelStyle::kWuiLight),
352 current_selection_names_(this,
353 0,
354 0,
355 20,
356 20,
357+ UI::PanelStyle::kWui,
358 "",
359 UI::Align::kCenter,
360- g_gr->images().get("images/ui_basic/but1.png"),
361 UI::MultilineTextarea::ScrollMode::kNoScrolling),
362 tool_(tool) {
363- current_selection_names_.set_background(
364- g_gr->images().get("images/wui/window_background_dark.png"));
365 add(&tab_panel_);
366
367 for (uint32_t category_index = 0; category_index < categories.size(); ++category_index) {
368
369=== modified file 'src/editor/ui_menus/main_menu.cc'
370--- src/editor/ui_menus/main_menu.cc 2018-04-07 16:59:00 +0000
371+++ src/editor/ui_menus/main_menu.cc 2018-05-12 13:15:45 +0000
372@@ -42,54 +42,24 @@
373 EditorMainMenu::EditorMainMenu(EditorInteractive& parent, UI::UniqueWindow::Registry& registry)
374 : UI::UniqueWindow(&parent, "main_menu", &registry, 2 * margin + width, 0, _("Main Menu")),
375 box_(this, margin, margin, UI::Box::Vertical, width, get_h() - 2 * margin, vspacing),
376- button_new_map_(&box_,
377- "new_map",
378- 0,
379- 0,
380- width,
381- 0,
382- g_gr->images().get("images/ui_basic/but1.png"),
383- _("New Map")),
384+ button_new_map_(
385+ &box_, "new_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("New Map")),
386 button_new_random_map_(&box_,
387 "new_random_map",
388 0,
389 0,
390 width,
391 0,
392- g_gr->images().get("images/ui_basic/but1.png"),
393+ UI::ButtonStyle::kWuiSecondary,
394 _("New Random Map")),
395- button_load_map_(&box_,
396- "load_map",
397- 0,
398- 0,
399- width,
400- 0,
401- g_gr->images().get("images/ui_basic/but1.png"),
402- _("Load Map")),
403- button_save_map_(&box_,
404- "save_map",
405- 0,
406- 0,
407- width,
408- 0,
409- g_gr->images().get("images/ui_basic/but1.png"),
410- _("Save Map")),
411- button_map_options_(&box_,
412- "map_options",
413- 0,
414- 0,
415- width,
416- 0,
417- g_gr->images().get("images/ui_basic/but1.png"),
418- _("Map Options")),
419- button_exit_editor_(&box_,
420- "exit",
421- 0,
422- 0,
423- width,
424- 0,
425- g_gr->images().get("images/ui_basic/but5.png"),
426- _("Exit Editor")) {
427+ button_load_map_(
428+ &box_, "load_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Load Map")),
429+ button_save_map_(
430+ &box_, "save_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Save Map")),
431+ button_map_options_(
432+ &box_, "map_options", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Map Options")),
433+ button_exit_editor_(
434+ &box_, "exit", 0, 0, width, 0, UI::ButtonStyle::kWuiPrimary, _("Exit Editor")) {
435 box_.add(&button_new_map_);
436 box_.add(&button_new_random_map_);
437 box_.add(&button_load_map_);
438
439=== modified file 'src/editor/ui_menus/main_menu_load_or_save_map.cc'
440--- src/editor/ui_menus/main_menu_load_or_save_map.cc 2018-04-07 16:59:00 +0000
441+++ src/editor/ui_menus/main_menu_load_or_save_map.cc 2018-05-12 13:15:45 +0000
442@@ -26,7 +26,6 @@
443 #include "base/wexception.h"
444 #include "editor/editorinteractive.h"
445 #include "graphic/font_handler1.h"
446-#include "graphic/graphic.h"
447 #include "io/filesystem/filesystem.h"
448 #include "io/filesystem/layered_filesystem.h"
449 #include "map_io/widelands_map_loader.h"
450@@ -49,13 +48,13 @@
451 right_column_x_(tablew_ + 2 * padding_),
452 butw_((get_inner_w() - right_column_x_ - 2 * padding_) / 2),
453
454- table_(this, tablex_, tabley_, tablew_, tableh_),
455+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kWui),
456 map_details_(this,
457 right_column_x_,
458 tabley_,
459 get_inner_w() - right_column_x_ - padding_,
460 tableh_,
461- MapDetails::Style::kWui),
462+ UI::PanelStyle::kWui),
463 directory_info_(this, padding_, get_inner_h() - 2 * buth_ - 4 * padding_),
464 ok_(this,
465 "ok",
466@@ -64,7 +63,7 @@
467 get_inner_h() - padding_ - buth_,
468 butw_,
469 buth_,
470- g_gr->images().get("images/ui_basic/but5.png"),
471+ UI::ButtonStyle::kWuiPrimary,
472 _("OK")),
473 cancel_(this,
474 "cancel",
475@@ -73,7 +72,7 @@
476 get_inner_h() - padding_ - buth_,
477 butw_,
478 buth_,
479- g_gr->images().get("images/ui_basic/but1.png"),
480+ UI::ButtonStyle::kWuiSecondary,
481 _("Cancel")),
482 basedir_(basedir),
483 has_translated_mapname_(false),
484@@ -82,9 +81,8 @@
485 curdir_ = basedir_;
486
487 UI::Box* vbox = new UI::Box(this, tablex_, padding_, UI::Box::Horizontal, padding_, get_w());
488- show_mapnames_ =
489- new UI::Button(vbox, "show_mapnames", 0, 0, 2 * butw_, buth_,
490- g_gr->images().get("images/ui_basic/but1.png"), _("Show Map Names"));
491+ show_mapnames_ = new UI::Button(vbox, "show_mapnames", 0, 0, 2 * butw_, buth_,
492+ UI::ButtonStyle::kWuiSecondary, _("Show Map Names"));
493 vbox->add(show_mapnames_, UI::Box::Resizing::kFullSize);
494
495 cb_dont_localize_mapnames_ =
496
497=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
498--- src/editor/ui_menus/main_menu_map_options.cc 2018-04-07 16:59:00 +0000
499+++ src/editor/ui_menus/main_menu_map_options.cc 2018-05-12 13:15:45 +0000
500@@ -31,7 +31,6 @@
501 #include "logic/map.h"
502 #include "ui_basic/editbox.h"
503 #include "ui_basic/multilineeditbox.h"
504-#include "ui_basic/multilinetextarea.h"
505 #include "ui_basic/textarea.h"
506 #include "wui/map_tags.h"
507
508@@ -56,7 +55,7 @@
509 get_inner_h() - padding_ - labelh_,
510 butw_,
511 labelh_,
512- g_gr->images().get("images/ui_basic/but5.png"),
513+ UI::ButtonStyle::kWuiPrimary,
514 _("OK")),
515 cancel_(this,
516 "cancel",
517@@ -64,26 +63,21 @@
518 get_inner_h() - padding_ - labelh_,
519 butw_,
520 labelh_,
521- g_gr->images().get("images/ui_basic/but1.png"),
522+ UI::ButtonStyle::kWuiSecondary,
523 _("Cancel")),
524 tab_box_(this, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
525- tabs_(&tab_box_, nullptr),
526+ tabs_(&tab_box_, UI::TabPanelStyle::kWuiLight),
527
528 main_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
529 tags_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
530 teams_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
531
532- name_(&main_box_, 0, 0, max_w_, 0, 2, g_gr->images().get("images/ui_basic/but1.png")),
533- author_(&main_box_, 0, 0, max_w_, 0, 2, g_gr->images().get("images/ui_basic/but1.png")),
534+ name_(&main_box_, 0, 0, max_w_, 0, 2, UI::PanelStyle::kWui),
535+ author_(&main_box_, 0, 0, max_w_, 0, 2, UI::PanelStyle::kWui),
536 size_(&main_box_, 0, 0, max_w_ - indent_, labelh_, ""),
537
538- teams_list_(&teams_box_,
539- 0,
540- 0,
541- max_w_,
542- 60,
543- g_gr->images().get("images/ui_basic/but1.png"),
544- UI::ListselectLayout::kShowCheck),
545+ teams_list_(
546+ &teams_box_, 0, 0, max_w_, 60, UI::PanelStyle::kWui, UI::ListselectLayout::kShowCheck),
547
548 modal_(modal) {
549
550@@ -98,13 +92,10 @@
551
552 // We need less space for the hint and the description, but it should at least have 1 line
553 // height.
554- hint_ =
555- new UI::MultilineEditbox(&main_box_, 0, 0, max_w_, std::max(labelh_, remaining_space * 1 / 3),
556- "", g_gr->images().get("images/ui_basic/but1.png"),
557- g_gr->images().get("images/ui_basic/but1.png"));
558- descr_ = new UI::MultilineEditbox(&main_box_, 0, 0, max_w_, remaining_space - hint_->get_h(), "",
559- g_gr->images().get("images/ui_basic/but1.png"),
560- g_gr->images().get("images/ui_basic/but1.png"));
561+ hint_ = new UI::MultilineEditbox(
562+ &main_box_, 0, 0, max_w_, std::max(labelh_, remaining_space * 1 / 3), UI::PanelStyle::kWui);
563+ descr_ = new UI::MultilineEditbox(
564+ &main_box_, 0, 0, max_w_, remaining_space - hint_->get_h(), UI::PanelStyle::kWui);
565
566 main_box_.add(new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Map name:")));
567 main_box_.add(&name_);
568
569=== modified file 'src/editor/ui_menus/main_menu_new_map.cc'
570--- src/editor/ui_menus/main_menu_new_map.cc 2018-04-07 16:59:00 +0000
571+++ src/editor/ui_menus/main_menu_new_map.cc 2018-05-12 13:15:45 +0000
572@@ -29,7 +29,6 @@
573 #include "base/macros.h"
574 #include "editor/editorinteractive.h"
575 #include "graphic/font_handler1.h"
576-#include "graphic/graphic.h"
577 #include "graphic/image.h"
578 #include "graphic/texture.h"
579 #include "logic/editor_game_base.h"
580@@ -55,9 +54,9 @@
581 0,
582 0,
583 0,
584+ UI::PanelStyle::kWui,
585 _("Width:"),
586 UI::SpinBox::Units::kNone,
587- g_gr->images().get("images/ui_basic/but1.png"),
588 UI::SpinBox::Type::kValueList),
589 height_(&box_,
590 0,
591@@ -67,11 +66,11 @@
592 0,
593 0,
594 0,
595+ UI::PanelStyle::kWui,
596 _("Height:"),
597 UI::SpinBox::Units::kNone,
598- g_gr->images().get("images/ui_basic/but1.png"),
599 UI::SpinBox::Type::kValueList),
600- list_(&box_, 0, 0, box_width_, 330),
601+ list_(&box_, 0, 0, box_width_, 330, UI::PanelStyle::kWui),
602 // Buttons
603 button_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
604 ok_button_(&button_box_,
605@@ -80,7 +79,7 @@
606 0,
607 box_width_ / 2 - margin_,
608 0,
609- g_gr->images().get("images/ui_basic/but5.png"),
610+ UI::ButtonStyle::kWuiPrimary,
611 _("Create Map")),
612 cancel_button_(&button_box_,
613 "generate_map",
614@@ -88,7 +87,7 @@
615 0,
616 box_width_ / 2 - margin_,
617 0,
618- g_gr->images().get("images/ui_basic/but1.png"),
619+ UI::ButtonStyle::kWuiSecondary,
620 _("Cancel")) {
621 width_.set_value_list(Widelands::kMapDimensions);
622 height_.set_value_list(Widelands::kMapDimensions);
623
624=== modified file 'src/editor/ui_menus/main_menu_random_map.cc'
625--- src/editor/ui_menus/main_menu_random_map.cc 2018-04-07 16:59:00 +0000
626+++ src/editor/ui_menus/main_menu_random_map.cc 2018-05-12 13:15:45 +0000
627@@ -32,7 +32,6 @@
628 #include "editor/editorinteractive.h"
629 #include "editor/map_generator.h"
630 #include "graphic/font_handler1.h"
631-#include "graphic/graphic.h"
632 #include "logic/editor_game_base.h"
633 #include "logic/map.h"
634 #include "logic/map_objects/world/world.h"
635@@ -63,9 +62,9 @@
636 0,
637 0,
638 0,
639+ UI::PanelStyle::kWui,
640 _("Width:"),
641 UI::SpinBox::Units::kNone,
642- g_gr->images().get("images/ui_basic/but1.png"),
643 UI::SpinBox::Type::kValueList),
644 height_(&box_,
645 0,
646@@ -75,9 +74,9 @@
647 0,
648 0,
649 0,
650+ UI::PanelStyle::kWui,
651 _("Height:"),
652 UI::SpinBox::Units::kNone,
653- g_gr->images().get("images/ui_basic/but1.png"),
654 UI::SpinBox::Type::kValueList),
655 max_players_(2),
656 players_(&box_,
657@@ -88,9 +87,9 @@
658 2,
659 1,
660 max_players_,
661+ UI::PanelStyle::kWui,
662 _("Players:"),
663 UI::SpinBox::Units::kNone,
664- g_gr->images().get("images/ui_basic/but1.png"),
665 UI::SpinBox::Type::kSmall),
666 // World + Resources
667 world_descriptions_({
668@@ -123,7 +122,7 @@
669 0,
670 box_width_ - 2 * margin_ - std::max(world_label_.get_w(), resources_label_.get_w()),
671 label_height_,
672- g_gr->images().get("images/ui_basic/but1.png"),
673+ UI::ButtonStyle::kWuiSecondary,
674 world_descriptions_[current_world_].descname),
675 resources_(&resources_box_,
676 "resources",
677@@ -131,7 +130,7 @@
678 0,
679 box_width_ - 2 * margin_ - std::max(world_label_.get_w(), resources_label_.get_w()),
680 label_height_,
681- g_gr->images().get("images/ui_basic/but1.png"),
682+ UI::ButtonStyle::kWuiSecondary,
683 resource_amounts_[resource_amount_].c_str()),
684 // Terrain
685 waterval_(20),
686@@ -146,9 +145,9 @@
687 waterval_,
688 0,
689 60,
690+ UI::PanelStyle::kWui,
691 _("Water:"),
692 UI::SpinBox::Units::kPercent,
693- g_gr->images().get("images/ui_basic/but1.png"),
694 UI::SpinBox::Type::kSmall,
695 5),
696 land_(&box_,
697@@ -159,9 +158,9 @@
698 landval_,
699 0,
700 100,
701+ UI::PanelStyle::kWui,
702 _("Land:"),
703 UI::SpinBox::Units::kPercent,
704- g_gr->images().get("images/ui_basic/but1.png"),
705 UI::SpinBox::Type::kSmall,
706 5),
707 wasteland_(&box_,
708@@ -172,9 +171,9 @@
709 wastelandval_,
710 0,
711 70,
712+ UI::PanelStyle::kWui,
713 _("Wasteland:"),
714 UI::SpinBox::Units::kPercent,
715- g_gr->images().get("images/ui_basic/but1.png"),
716 UI::SpinBox::Type::kSmall,
717 5),
718 mountains_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
719@@ -196,7 +195,7 @@
720 box_width_ - 2 * margin_ - map_number_label_.get_w(),
721 0,
722 2,
723- g_gr->images().get("images/ui_basic/but1.png")),
724+ UI::PanelStyle::kWui),
725 map_id_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
726 map_id_label_(&map_id_box_, 0, 0, _("Map ID:")),
727 map_id_edit_(&map_id_box_,
728@@ -205,7 +204,7 @@
729 box_width_ - 2 * margin_ - map_id_label_.get_w(),
730 0,
731 2,
732- g_gr->images().get("images/ui_basic/but1.png")),
733+ UI::PanelStyle::kWui),
734 // Buttons
735 button_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
736 ok_button_(&button_box_,
737@@ -214,7 +213,7 @@
738 0,
739 box_width_ / 2 - margin_,
740 0,
741- g_gr->images().get("images/ui_basic/but5.png"),
742+ UI::ButtonStyle::kWuiPrimary,
743 _("Generate Map")),
744 cancel_button_(&button_box_,
745 "generate_map",
746@@ -222,7 +221,7 @@
747 0,
748 box_width_ / 2 - margin_,
749 0,
750- g_gr->images().get("images/ui_basic/but1.png"),
751+ UI::ButtonStyle::kWuiSecondary,
752 _("Cancel")) {
753 int32_t box_height = 0;
754
755
756=== modified file 'src/editor/ui_menus/main_menu_save_map.cc'
757--- src/editor/ui_menus/main_menu_save_map.cc 2018-04-07 16:59:00 +0000
758+++ src/editor/ui_menus/main_menu_save_map.cc 2018-05-12 13:15:45 +0000
759@@ -33,7 +33,6 @@
760 #include "editor/editorinteractive.h"
761 #include "editor/ui_menus/main_menu_map_options.h"
762 #include "editor/ui_menus/main_menu_save_map_make_directory.h"
763-#include "graphic/graphic.h"
764 #include "io/filesystem/filesystem.h"
765 #include "io/filesystem/layered_filesystem.h"
766 #include "io/filesystem/zip_filesystem.h"
767@@ -58,7 +57,7 @@
768 tabley_ + tableh_ + 3 * padding_ - 1,
769 get_inner_w() - right_column_x_ - padding_,
770 buth_,
771- g_gr->images().get("images/ui_basic/but1.png"),
772+ UI::ButtonStyle::kWuiSecondary,
773 _("Make Directory")),
774 edit_options_(this,
775 "edit_options",
776@@ -66,7 +65,7 @@
777 tabley_ + tableh_ - buth_,
778 get_inner_w() - right_column_x_ - padding_,
779 buth_,
780- g_gr->images().get("images/ui_basic/but5.png"),
781+ UI::ButtonStyle::kWuiPrimary,
782 _("Map Options")),
783 editbox_label_(
784 this, padding_, tabley_ + tableh_ + 3 * padding_, butw_, buth_, _("Filename:")) {
785@@ -79,10 +78,9 @@
786 table_.double_clicked.connect(
787 boost::bind(&MainMenuSaveMap::double_clicked_item, boost::ref(*this)));
788
789- editbox_ =
790- new UI::EditBox(this, editbox_label_.get_x() + editbox_label_.get_w() + padding_,
791- editbox_label_.get_y(), tablew_ - editbox_label_.get_w() - padding_ + 1,
792- buth_, 2, g_gr->images().get("images/ui_basic/but1.png"));
793+ editbox_ = new UI::EditBox(
794+ this, editbox_label_.get_x() + editbox_label_.get_w() + padding_, editbox_label_.get_y(),
795+ tablew_ - editbox_label_.get_w() - padding_ + 1, buth_, 2, UI::PanelStyle::kWui);
796
797 editbox_->set_text(parent.egbase().map().get_name());
798 editbox_->changed.connect(boost::bind(&MainMenuSaveMap::edit_box_changed, this));
799
800=== modified file 'src/editor/ui_menus/main_menu_save_map_make_directory.cc'
801--- src/editor/ui_menus/main_menu_save_map_make_directory.cc 2018-04-07 16:59:00 +0000
802+++ src/editor/ui_menus/main_menu_save_map_make_directory.cc 2018-05-12 13:15:45 +0000
803@@ -21,7 +21,6 @@
804
805 #include "base/i18n.h"
806 #include "graphic/font_handler1.h"
807-#include "graphic/graphic.h"
808 #include "io/filesystem/layered_filesystem.h"
809
810 MainMenuSaveMapMakeDirectory::MainMenuSaveMapMakeDirectory(UI::Panel* const parent,
811@@ -39,20 +38,14 @@
812 get_inner_h() - 3 * padding_ - buth_,
813 padding_ / 2),
814 label_(&vbox_, 0, 0, get_inner_w() - 2 * padding_, buth_, _("Enter Directory Name:")),
815- edit_(&vbox_,
816- 0,
817- 0,
818- get_inner_w() - 2 * padding_,
819- 0,
820- 4,
821- g_gr->images().get("images/ui_basic/but1.png")),
822+ edit_(&vbox_, 0, 0, get_inner_w() - 2 * padding_, 0, 4, UI::PanelStyle::kWui),
823 ok_button_(this,
824 "ok",
825 UI::g_fh1->fontset()->is_rtl() ? padding_ : get_inner_w() - butw_ - padding_,
826 get_inner_h() - padding_ - buth_,
827 butw_,
828 buth_,
829- g_gr->images().get("images/ui_basic/but5.png"),
830+ UI::ButtonStyle::kWuiPrimary,
831 _("OK")),
832 cancel_button_(this,
833 "cancel",
834@@ -60,7 +53,7 @@
835 get_inner_h() - padding_ - buth_,
836 butw_,
837 buth_,
838- g_gr->images().get("images/ui_basic/but1.png"),
839+ UI::ButtonStyle::kWuiSecondary,
840 _("Cancel")) {
841
842 vbox_.add(&label_);
843
844=== modified file 'src/editor/ui_menus/player_menu.cc'
845--- src/editor/ui_menus/player_menu.cc 2018-04-07 16:59:00 +0000
846+++ src/editor/ui_menus/player_menu.cc 2018-05-12 13:15:45 +0000
847@@ -47,7 +47,7 @@
848 5,
849 20,
850 20,
851- g_gr->images().get("images/ui_basic/but1.png"),
852+ UI::ButtonStyle::kWuiSecondary,
853 g_gr->images().get("images/ui_basic/scrollbar_up.png"),
854 _("Add player")),
855 remove_last_player_(this,
856@@ -56,7 +56,7 @@
857 5,
858 20,
859 20,
860- g_gr->images().get("images/ui_basic/but1.png"),
861+ UI::ButtonStyle::kWuiSecondary,
862 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
863 _("Remove last player")),
864 tribenames_(Widelands::get_all_tribenames()) {
865@@ -140,8 +140,7 @@
866 iterate_player_numbers(p, nr_players) {
867 int32_t posx = spacing;
868 if (!plr_names_[p - 1]) {
869- plr_names_[p - 1] = new UI::EditBox(
870- this, posx, posy, 140, size, 2, g_gr->images().get("images/ui_basic/but0.png"));
871+ plr_names_[p - 1] = new UI::EditBox(this, posx, posy, 140, size, 2, UI::PanelStyle::kWui);
872 plr_names_[p - 1]->changed.connect(
873 boost::bind(&EditorPlayerMenu::name_changed, this, p - 1));
874 posx += 140 + spacing;
875@@ -149,9 +148,8 @@
876 }
877
878 if (!plr_set_tribes_buts_[p - 1]) {
879- plr_set_tribes_buts_[p - 1] =
880- new UI::Button(this, "tribe", posx, posy, 140, size,
881- g_gr->images().get("images/ui_basic/but0.png"), "");
882+ plr_set_tribes_buts_[p - 1] = new UI::Button(
883+ this, "tribe", posx, posy, 140, size, UI::ButtonStyle::kWuiSecondary, "");
884 plr_set_tribes_buts_[p - 1]->sigclicked.connect(
885 boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));
886 posx += 140 + spacing;
887@@ -174,9 +172,8 @@
888
889 // Set Starting pos button.
890 if (!plr_set_pos_buts_[p - 1]) {
891- plr_set_pos_buts_[p - 1] =
892- new UI::Button(this, "starting_pos", posx, posy, size, size,
893- g_gr->images().get("images/ui_basic/but0.png"), nullptr, "");
894+ plr_set_pos_buts_[p - 1] = new UI::Button(this, "starting_pos", posx, posy, size, size,
895+ UI::ButtonStyle::kWuiSecondary, nullptr, "");
896 plr_set_pos_buts_[p - 1]->sigclicked.connect(
897 boost::bind(&EditorPlayerMenu::set_starting_pos_clicked, boost::ref(*this), p));
898 }
899
900=== modified file 'src/editor/ui_menus/tool_change_height_options_menu.cc'
901--- src/editor/ui_menus/tool_change_height_options_menu.cc 2018-04-07 16:59:00 +0000
902+++ src/editor/ui_menus/tool_change_height_options_menu.cc 2018-05-12 13:15:45 +0000
903@@ -26,7 +26,6 @@
904 #include "editor/editorinteractive.h"
905 #include "editor/tools/increase_height_tool.h"
906 #include "editor/tools/set_height_tool.h"
907-#include "graphic/graphic.h"
908 #include "logic/widelands_geometry.h"
909
910 EditorToolChangeHeightOptionsMenu::EditorToolChangeHeightOptionsMenu(
911@@ -44,9 +43,9 @@
912 increase_tool_.get_change_by(),
913 1,
914 MAX_FIELD_HEIGHT_DIFF,
915+ UI::PanelStyle::kWui,
916 _("Increase/Decrease height by:"),
917 UI::SpinBox::Units::kNone,
918- g_gr->images().get("images/ui_basic/but1.png"),
919 UI::SpinBox::Type::kSmall),
920 set_to_(&box_,
921 0,
922@@ -56,9 +55,9 @@
923 increase_tool_.set_tool().get_interval().min,
924 0,
925 MAX_FIELD_HEIGHT,
926+ UI::PanelStyle::kWui,
927 _("Set height to:"),
928 UI::SpinBox::Units::kNone,
929- g_gr->images().get("images/ui_basic/but1.png"),
930 UI::SpinBox::Type::kSmall) {
931 change_by_.set_tooltip(
932 /** TRANSLATORS: Editor change height access keys. **/
933
934=== modified file 'src/editor/ui_menus/tool_change_resources_options_menu.cc'
935--- src/editor/ui_menus/tool_change_resources_options_menu.cc 2018-04-07 16:59:00 +0000
936+++ src/editor/ui_menus/tool_change_resources_options_menu.cc 2018-05-12 13:15:45 +0000
937@@ -57,9 +57,9 @@
938 increase_tool_.get_change_by(),
939 1,
940 kMaxValue,
941+ UI::PanelStyle::kWui,
942 _("Increase/Decrease amount by:"),
943 UI::SpinBox::Units::kNone,
944- g_gr->images().get("images/ui_basic/but1.png"),
945 UI::SpinBox::Type::kSmall),
946 set_to_(&box_,
947 0,
948@@ -69,9 +69,9 @@
949 increase_tool_.set_tool().get_set_to(),
950 0,
951 kMaxValue,
952+ UI::PanelStyle::kWui,
953 _("Set amount to:"),
954 UI::SpinBox::Units::kNone,
955- g_gr->images().get("images/ui_basic/but1.png"),
956 UI::SpinBox::Type::kSmall),
957 resources_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1),
958 cur_selection_(&box_, 0, 0, "", UI::Align::kCenter) {
959
960=== modified file 'src/editor/ui_menus/tool_noise_height_options_menu.cc'
961--- src/editor/ui_menus/tool_noise_height_options_menu.cc 2018-04-07 16:59:00 +0000
962+++ src/editor/ui_menus/tool_noise_height_options_menu.cc 2018-05-12 13:15:45 +0000
963@@ -26,7 +26,6 @@
964 #include "editor/tools/decrease_height_tool.h"
965 #include "editor/tools/increase_height_tool.h"
966 #include "editor/tools/noise_height_tool.h"
967-#include "graphic/graphic.h"
968 #include "logic/widelands_geometry.h"
969 #include "ui_basic/textarea.h"
970
971@@ -47,9 +46,9 @@
972 noise_tool_.get_interval().min,
973 1,
974 MAX_FIELD_HEIGHT,
975+ UI::PanelStyle::kWui,
976 _("Minimum height:"),
977 UI::SpinBox::Units::kNone,
978- g_gr->images().get("images/ui_basic/but1.png"),
979 UI::SpinBox::Type::kSmall),
980 upper_(&box_,
981 0,
982@@ -59,9 +58,9 @@
983 noise_tool_.get_interval().max,
984 0,
985 MAX_FIELD_HEIGHT,
986+ UI::PanelStyle::kWui,
987 _("Maximum height:"),
988 UI::SpinBox::Units::kNone,
989- g_gr->images().get("images/ui_basic/but1.png"),
990 UI::SpinBox::Type::kSmall),
991 set_to_(&box_,
992 0,
993@@ -71,9 +70,9 @@
994 noise_tool_.set_tool().get_interval().min,
995 0,
996 MAX_FIELD_HEIGHT,
997+ UI::PanelStyle::kWui,
998 _("Set height to:"),
999 UI::SpinBox::Units::kNone,
1000- g_gr->images().get("images/ui_basic/but1.png"),
1001 UI::SpinBox::Type::kSmall) {
1002 lower_.set_tooltip(
1003 /** TRANSLATORS: Editor random height access key. **/
1004
1005=== modified file 'src/editor/ui_menus/tool_place_critter_options_menu.cc'
1006--- src/editor/ui_menus/tool_place_critter_options_menu.cc 2018-04-07 16:59:00 +0000
1007+++ src/editor/ui_menus/tool_place_critter_options_menu.cc 2018-05-12 13:15:45 +0000
1008@@ -24,7 +24,6 @@
1009 #include "base/i18n.h"
1010 #include "editor/editorinteractive.h"
1011 #include "editor/tools/place_critter_tool.h"
1012-#include "graphic/graphic.h"
1013 #include "logic/map.h"
1014 #include "logic/map_objects/world/critter.h"
1015 #include "logic/map_objects/world/world.h"
1016
1017=== modified file 'src/editor/ui_menus/tool_place_immovable_options_menu.cc'
1018--- src/editor/ui_menus/tool_place_immovable_options_menu.cc 2018-04-07 16:59:00 +0000
1019+++ src/editor/ui_menus/tool_place_immovable_options_menu.cc 2018-05-12 13:15:45 +0000
1020@@ -24,7 +24,6 @@
1021 #include "base/i18n.h"
1022 #include "editor/editorinteractive.h"
1023 #include "editor/tools/place_immovable_tool.h"
1024-#include "graphic/graphic.h"
1025 #include "logic/map.h"
1026 #include "logic/map_objects/world/world.h"
1027 #include "ui_basic/box.h"
1028
1029=== modified file 'src/editor/ui_menus/tool_set_terrain_options_menu.cc'
1030--- src/editor/ui_menus/tool_set_terrain_options_menu.cc 2018-04-07 16:59:00 +0000
1031+++ src/editor/ui_menus/tool_set_terrain_options_menu.cc 2018-05-12 13:15:45 +0000
1032@@ -27,7 +27,6 @@
1033 #include "base/i18n.h"
1034 #include "editor/editorinteractive.h"
1035 #include "editor/tools/set_terrain_tool.h"
1036-#include "graphic/graphic.h"
1037 #include "graphic/rendertarget.h"
1038 #include "graphic/texture.h"
1039 #include "logic/map.h"
1040@@ -36,7 +35,6 @@
1041 #include "logic/map_objects/world/world.h"
1042 #include "ui_basic/checkbox.h"
1043 #include "ui_basic/panel.h"
1044-#include "ui_basic/tabpanel.h"
1045
1046 namespace {
1047
1048
1049=== modified file 'src/editor/ui_menus/toolsize_menu.cc'
1050--- src/editor/ui_menus/toolsize_menu.cc 2018-04-07 16:59:00 +0000
1051+++ src/editor/ui_menus/toolsize_menu.cc 2018-05-12 13:15:45 +0000
1052@@ -45,7 +45,7 @@
1053 25,
1054 20,
1055 20,
1056- g_gr->images().get("images/ui_basic/but0.png"),
1057+ UI::ButtonStyle::kWuiSecondary,
1058 g_gr->images().get("images/ui_basic/scrollbar_up.png")),
1059 decrease_(this,
1060 "decr",
1061@@ -53,7 +53,7 @@
1062 25,
1063 20,
1064 20,
1065- g_gr->images().get("images/ui_basic/but0.png"),
1066+ UI::ButtonStyle::kWuiSecondary,
1067 g_gr->images().get("images/ui_basic/scrollbar_down.png")),
1068 value_(0) {
1069 increase_.sigclicked.connect(
1070
1071=== modified file 'src/game_io/CMakeLists.txt'
1072--- src/game_io/CMakeLists.txt 2017-11-20 13:50:51 +0000
1073+++ src/game_io/CMakeLists.txt 2018-05-12 13:15:45 +0000
1074@@ -29,7 +29,6 @@
1075 base_time_string
1076 build_info
1077 economy
1078- graphic
1079 graphic_image_io
1080 graphic_minimap_renderer
1081 io_fileread
1082
1083=== modified file 'src/game_io/game_preload_packet.cc'
1084--- src/game_io/game_preload_packet.cc 2018-04-07 16:59:00 +0000
1085+++ src/game_io/game_preload_packet.cc 2018-05-12 13:15:45 +0000
1086@@ -26,7 +26,6 @@
1087
1088 #include "base/time_string.h"
1089 #include "build_info.h"
1090-#include "graphic/graphic.h"
1091 #include "graphic/image_io.h"
1092 #include "graphic/minimap_renderer.h"
1093 #include "logic/game.h"
1094
1095=== modified file 'src/graphic/CMakeLists.txt'
1096--- src/graphic/CMakeLists.txt 2017-09-01 15:45:59 +0000
1097+++ src/graphic/CMakeLists.txt 2018-05-12 13:15:45 +0000
1098@@ -5,6 +5,16 @@
1099
1100 # Align and color
1101
1102+
1103+wl_library(graphic_styles
1104+ SRCS
1105+ panel_styles.cc
1106+ panel_styles.h
1107+ DEPENDS
1108+ graphic_color
1109+ graphic_surface
1110+)
1111+
1112 wl_library(graphic_align
1113 SRCS
1114 align.h
1115@@ -115,7 +125,6 @@
1116 base_geometry
1117 base_log
1118 base_macros
1119- graphic
1120 graphic_color
1121 graphic_draw_programs
1122 graphic_gl_utils
1123@@ -195,7 +204,6 @@
1124 base_geometry
1125 base_macros
1126 economy
1127- graphic
1128 graphic_surface
1129 logic
1130 wui_mapview_pixelfunctions
1131@@ -228,7 +236,6 @@
1132 base_geometry
1133 base_log
1134 base_macros
1135- graphic
1136 graphic_fields_to_draw
1137 graphic_gl_utils
1138 graphic_image_io
1139@@ -330,6 +337,8 @@
1140 diranimations.h
1141 graphic.cc
1142 graphic.h
1143+ style_manager.cc
1144+ style_manager.h
1145 rendertarget.cc
1146 rendertarget.h
1147 USES_SDL2
1148@@ -339,6 +348,7 @@
1149 base_i18n
1150 base_log
1151 base_macros
1152+ base_scoped_timer
1153 build_info
1154 graphic_align
1155 graphic_build_texture_atlas
1156@@ -349,6 +359,7 @@
1157 graphic_image_io
1158 graphic_playercolor
1159 graphic_render_queue
1160+ graphic_styles
1161 graphic_surface
1162 graphic_text_layout
1163 io_filesystem
1164@@ -356,6 +367,7 @@
1165 logic_constants
1166 note_sound
1167 notifications
1168+ scripting_lua_interface
1169 scripting_lua_table
1170 sound
1171 )
1172
1173=== modified file 'src/graphic/game_renderer.cc'
1174--- src/graphic/game_renderer.cc 2018-04-07 16:59:00 +0000
1175+++ src/graphic/game_renderer.cc 2018-05-12 13:15:45 +0000
1176@@ -22,7 +22,6 @@
1177 #include <memory>
1178
1179 #include "graphic/gl/coordinate_conversion.h"
1180-#include "graphic/graphic.h"
1181 #include "graphic/render_queue.h"
1182 #include "graphic/rendertarget.h"
1183 #include "graphic/surface.h"
1184
1185=== modified file 'src/graphic/gl/road_program.cc'
1186--- src/graphic/gl/road_program.cc 2018-04-07 16:59:00 +0000
1187+++ src/graphic/gl/road_program.cc 2018-05-12 13:15:45 +0000
1188@@ -26,7 +26,6 @@
1189 #include "graphic/gl/coordinate_conversion.h"
1190 #include "graphic/gl/fields_to_draw.h"
1191 #include "graphic/gl/utils.h"
1192-#include "graphic/graphic.h"
1193 #include "graphic/image_io.h"
1194 #include "graphic/texture.h"
1195 #include "logic/player.h"
1196
1197=== modified file 'src/graphic/graphic.cc'
1198--- src/graphic/graphic.cc 2018-04-07 16:59:00 +0000
1199+++ src/graphic/graphic.cc 2018-05-12 13:15:45 +0000
1200@@ -59,7 +59,10 @@
1201
1202 } // namespace
1203
1204-Graphic::Graphic() : image_cache_(new ImageCache()), animation_manager_(new AnimationManager()) {
1205+Graphic::Graphic()
1206+ : image_cache_(new ImageCache()),
1207+ animation_manager_(new AnimationManager()),
1208+ style_manager_(new StyleManager()) {
1209 }
1210
1211 /**
1212@@ -112,6 +115,7 @@
1213 auto texture_atlases = build_texture_atlas(max_texture_size_, &textures_in_atlas);
1214 image_cache_->fill_with_texture_atlases(
1215 std::move(texture_atlases), std::move(textures_in_atlas));
1216+ styles().init();
1217 }
1218
1219 Graphic::~Graphic() {
1220
1221=== modified file 'src/graphic/graphic.h'
1222--- src/graphic/graphic.h 2018-04-07 16:59:00 +0000
1223+++ src/graphic/graphic.h 2018-05-12 13:15:45 +0000
1224@@ -25,6 +25,7 @@
1225 #include <SDL.h>
1226
1227 #include "graphic/image_cache.h"
1228+#include "graphic/style_manager.h"
1229 #include "notifications/note_ids.h"
1230 #include "notifications/notifications.h"
1231
1232@@ -90,6 +91,9 @@
1233 AnimationManager& animations() const {
1234 return *animation_manager_.get();
1235 }
1236+ StyleManager& styles() const {
1237+ return *style_manager_.get();
1238+ }
1239
1240 // Requests a screenshot being taken on the next frame.
1241 void screenshot(const std::string& fname);
1242@@ -124,6 +128,9 @@
1243 /// This holds all animations.
1244 std::unique_ptr<AnimationManager> animation_manager_;
1245
1246+ /// This holds all GUI styles.
1247+ std::unique_ptr<StyleManager> style_manager_;
1248+
1249 /// Screenshot filename. If a screenshot is requested, this will be set to
1250 /// the requested filename. On the next frame the screenshot will be written
1251 /// out and this will be clear()ed again.
1252
1253=== modified file 'src/graphic/minimap_renderer.cc'
1254--- src/graphic/minimap_renderer.cc 2018-04-07 16:59:00 +0000
1255+++ src/graphic/minimap_renderer.cc 2018-05-12 13:15:45 +0000
1256@@ -24,7 +24,6 @@
1257 #include "base/macros.h"
1258 #include "economy/flag.h"
1259 #include "economy/road.h"
1260-#include "graphic/graphic.h"
1261 #include "logic/field.h"
1262 #include "logic/map_objects/world/terrain_description.h"
1263 #include "logic/map_objects/world/world.h"
1264
1265=== added file 'src/graphic/panel_styles.cc'
1266--- src/graphic/panel_styles.cc 1970-01-01 00:00:00 +0000
1267+++ src/graphic/panel_styles.cc 2018-05-12 13:15:45 +0000
1268@@ -0,0 +1,1 @@
1269+// Dummy to make CMake happy
1270
1271=== added file 'src/graphic/panel_styles.h'
1272--- src/graphic/panel_styles.h 1970-01-01 00:00:00 +0000
1273+++ src/graphic/panel_styles.h 2018-05-12 13:15:45 +0000
1274@@ -0,0 +1,57 @@
1275+/*
1276+ * Copyright (C) 2017 by the Widelands Development Team
1277+ *
1278+ * This program is free software; you can redistribute it and/or
1279+ * modify it under the terms of the GNU General Public License
1280+ * as published by the Free Software Foundation; either version 2
1281+ * of the License, or (at your option) any later version.
1282+ *
1283+ * This program is distributed in the hope that it will be useful,
1284+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1285+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1286+ * GNU General Public License for more details.
1287+ *
1288+ * You should have received a copy of the GNU General Public License
1289+ * along with this program; if not, write to the Free Software
1290+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
1291+ *
1292+ */
1293+
1294+#ifndef WL_GRAPHIC_PANEL_STYLES_H
1295+#define WL_GRAPHIC_PANEL_STYLES_H
1296+
1297+#include "graphic/color.h"
1298+#include "graphic/image.h"
1299+
1300+namespace UI {
1301+
1302+// Buttons
1303+enum class ButtonStyle {
1304+ kFsMenuMenu,
1305+ kFsMenuPrimary,
1306+ kFsMenuSecondary,
1307+ kWuiMenu,
1308+ kWuiPrimary,
1309+ kWuiSecondary,
1310+ kWuiBuildingStats
1311+};
1312+enum class SliderStyle { kFsMenu, kWuiLight, kWuiDark };
1313+
1314+// Backgrounds
1315+enum class PanelStyle { kFsMenu, kWui };
1316+enum class TabPanelStyle { kFsMenu, kWuiLight, kWuiDark };
1317+
1318+struct PanelStyleInfo {
1319+ PanelStyleInfo(const Image* init_image, const RGBAColor& init_color)
1320+ : image(init_image), color(init_color) {
1321+ }
1322+ PanelStyleInfo() : PanelStyleInfo(nullptr, RGBAColor(0, 0, 0, 0)) {
1323+ }
1324+
1325+ const Image* image;
1326+ const RGBAColor color;
1327+};
1328+
1329+} // namespace UI
1330+
1331+#endif // end of include guard: WL_GRAPHIC_PANEL_STYLES_H
1332
1333=== added file 'src/graphic/style_manager.cc'
1334--- src/graphic/style_manager.cc 1970-01-01 00:00:00 +0000
1335+++ src/graphic/style_manager.cc 2018-05-12 13:15:45 +0000
1336@@ -0,0 +1,199 @@
1337+/*
1338+ * Copyright (C) 2017 by the Widelands Development Team
1339+ *
1340+ * This program is free software; you can redistribute it and/or
1341+ * modify it under the terms of the GNU General Public License
1342+ * as published by the Free Software Foundation; either version 2
1343+ * of the License, or (at your option) any later version.
1344+ *
1345+ * This program is distributed in the hope that it will be useful,
1346+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1347+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1348+ * GNU General Public License for more details.
1349+ *
1350+ * You should have received a copy of the GNU General Public License
1351+ * along with this program; if not, write to the Free Software
1352+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1353+ *
1354+ */
1355+
1356+#include "graphic/style_manager.h"
1357+
1358+#include <memory>
1359+
1360+#include "base/scoped_timer.h"
1361+#include "base/wexception.h"
1362+#include "graphic/graphic.h"
1363+#include "scripting/lua_interface.h"
1364+
1365+namespace {
1366+// Read image filename and RGB color from LuaTable
1367+UI::PanelStyleInfo* read_style(const LuaTable& table) {
1368+ const std::string image = table.get_string("image");
1369+ std::vector<int> rgbcolor = table.get_table("color")->array_entries<int>();
1370+ if (rgbcolor.size() != 3) {
1371+ throw wexception("Expected 3 entries for RGB color, but got %" PRIuS ".", rgbcolor.size());
1372+ }
1373+ return new UI::PanelStyleInfo(image.empty() ? nullptr : g_gr->images().get(image),
1374+ RGBAColor(rgbcolor[0], rgbcolor[1], rgbcolor[2], 0));
1375+}
1376+
1377+// Stupid completeness check - enum classes weren't meant for iterating, so we just compare the size
1378+// to the last enum member. This assumes that there are no holes in the enum, and will need
1379+// adjusting if the last enum member changes.
1380+void check_completeness(const std::string& name, size_t map_size, size_t last_enum_member) {
1381+ if (map_size != last_enum_member + 1) {
1382+ throw wexception("StyleManager: There is a definition missing for the '%s'.", name.c_str());
1383+ }
1384+}
1385+} // namespace
1386+
1387+void StyleManager::init() {
1388+
1389+ ScopedTimer timer("Style Manager: Reading style templates took %ums");
1390+
1391+ buttonstyles_.clear();
1392+ sliderstyles_.clear();
1393+ tabpanelstyles_.clear();
1394+ editboxstyles_.clear();
1395+ dropdownstyles_.clear();
1396+ scrollbarstyles_.clear();
1397+
1398+ log("Style Manager: Loading %sinit.lua ... ", kTemplateDir.c_str());
1399+
1400+ LuaInterface lua;
1401+ std::unique_ptr<LuaTable> table(lua.run_script(kTemplateDir + "init.lua"));
1402+
1403+ log("took %ums\n", timer.ms_since_last_query());
1404+ log("Style Manager: Reading button styles ... ");
1405+
1406+ // Buttons
1407+ std::unique_ptr<LuaTable> element_table = table->get_table("buttons");
1408+ std::unique_ptr<LuaTable> style_table = element_table->get_table("fsmenu");
1409+ add_button_style(UI::ButtonStyle::kFsMenuMenu, *style_table->get_table("menu").get());
1410+ add_button_style(UI::ButtonStyle::kFsMenuPrimary, *style_table->get_table("primary").get());
1411+ add_button_style(UI::ButtonStyle::kFsMenuSecondary, *style_table->get_table("secondary").get());
1412+ style_table = element_table->get_table("wui");
1413+ add_button_style(UI::ButtonStyle::kWuiMenu, *style_table->get_table("menu").get());
1414+ add_button_style(UI::ButtonStyle::kWuiPrimary, *style_table->get_table("primary").get());
1415+ add_button_style(UI::ButtonStyle::kWuiSecondary, *style_table->get_table("secondary").get());
1416+ add_button_style(
1417+ UI::ButtonStyle::kWuiBuildingStats, *style_table->get_table("building_stats").get());
1418+ check_completeness(
1419+ "buttons", buttonstyles_.size(), static_cast<size_t>(UI::ButtonStyle::kWuiBuildingStats));
1420+
1421+ log("took %ums\n", timer.ms_since_last_query());
1422+ log("Style Manager: Reading slider styles ... ");
1423+
1424+ // Sliders
1425+ element_table = table->get_table("sliders");
1426+ style_table = element_table->get_table("fsmenu");
1427+ add_slider_style(UI::SliderStyle::kFsMenu, *style_table->get_table("menu").get());
1428+ style_table = element_table->get_table("wui");
1429+ add_slider_style(UI::SliderStyle::kWuiLight, *style_table->get_table("light").get());
1430+ add_slider_style(UI::SliderStyle::kWuiDark, *style_table->get_table("dark").get());
1431+ check_completeness(
1432+ "sliders", sliderstyles_.size(), static_cast<size_t>(UI::SliderStyle::kWuiDark));
1433+
1434+ log("took %ums\n", timer.ms_since_last_query());
1435+ log("Style Manager: Reading tabpanel styles ... ");
1436+
1437+ // Tabpanels
1438+ element_table = table->get_table("tabpanels");
1439+ style_table = element_table->get_table("fsmenu");
1440+ add_tabpanel_style(UI::TabPanelStyle::kFsMenu, *style_table->get_table("menu").get());
1441+ style_table = element_table->get_table("wui");
1442+ add_tabpanel_style(UI::TabPanelStyle::kWuiLight, *style_table->get_table("light").get());
1443+ add_tabpanel_style(UI::TabPanelStyle::kWuiDark, *style_table->get_table("dark").get());
1444+ check_completeness(
1445+ "tabpanels", tabpanelstyles_.size(), static_cast<size_t>(UI::TabPanelStyle::kWuiDark));
1446+
1447+ log("took %ums\n", timer.ms_since_last_query());
1448+ log("Style Manager: Reading editbox styles ... ");
1449+
1450+ // Editboxes
1451+ element_table = table->get_table("editboxes");
1452+ style_table = element_table->get_table("fsmenu");
1453+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &editboxstyles_);
1454+ style_table = element_table->get_table("wui");
1455+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &editboxstyles_);
1456+ check_completeness(
1457+ "editboxes", editboxstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
1458+
1459+ log("took %ums\n", timer.ms_since_last_query());
1460+ log("Style Manager: Reading dropdown styles ... ");
1461+
1462+ // Dropdowns
1463+ element_table = table->get_table("dropdowns");
1464+ style_table = element_table->get_table("fsmenu");
1465+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &dropdownstyles_);
1466+ style_table = element_table->get_table("wui");
1467+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &dropdownstyles_);
1468+ check_completeness(
1469+ "dropdowns", dropdownstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
1470+
1471+ log("took %ums\n", timer.ms_since_last_query());
1472+ log("Style Manager: Reading scrollbar styles ... ");
1473+
1474+ // Scrollbars
1475+ element_table = table->get_table("scrollbars");
1476+ style_table = element_table->get_table("fsmenu");
1477+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &scrollbarstyles_);
1478+ style_table = element_table->get_table("wui");
1479+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &scrollbarstyles_);
1480+ check_completeness(
1481+ "scrollbars", scrollbarstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
1482+
1483+ log("took %ums\n", timer.ms_since_last_query());
1484+}
1485+
1486+// Return functions for the styles
1487+const UI::PanelStyleInfo* StyleManager::button_style(UI::ButtonStyle style) const {
1488+ assert(buttonstyles_.count(style) == 1);
1489+ return buttonstyles_.at(style).get();
1490+}
1491+
1492+const UI::PanelStyleInfo* StyleManager::slider_style(UI::SliderStyle style) const {
1493+ assert(sliderstyles_.count(style) == 1);
1494+ return sliderstyles_.at(style).get();
1495+}
1496+
1497+const UI::PanelStyleInfo* StyleManager::tabpanel_style(UI::TabPanelStyle style) const {
1498+ assert(tabpanelstyles_.count(style) == 1);
1499+ return tabpanelstyles_.at(style).get();
1500+}
1501+
1502+const UI::PanelStyleInfo* StyleManager::editbox_style(UI::PanelStyle style) const {
1503+ assert(editboxstyles_.count(style) == 1);
1504+ return editboxstyles_.at(style).get();
1505+}
1506+
1507+const UI::PanelStyleInfo* StyleManager::dropdown_style(UI::PanelStyle style) const {
1508+ assert(dropdownstyles_.count(style) == 1);
1509+ return dropdownstyles_.at(style).get();
1510+}
1511+
1512+const UI::PanelStyleInfo* StyleManager::scrollbar_style(UI::PanelStyle style) const {
1513+ assert(scrollbarstyles_.count(style) == 1);
1514+ return scrollbarstyles_.at(style).get();
1515+}
1516+
1517+// Fill the maps
1518+void StyleManager::add_button_style(UI::ButtonStyle style, const LuaTable& table) {
1519+ buttonstyles_.insert(
1520+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
1521+}
1522+
1523+void StyleManager::add_slider_style(UI::SliderStyle style, const LuaTable& table) {
1524+ sliderstyles_.insert(
1525+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
1526+}
1527+
1528+void StyleManager::add_tabpanel_style(UI::TabPanelStyle style, const LuaTable& table) {
1529+ tabpanelstyles_.insert(
1530+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
1531+}
1532+
1533+void StyleManager::add_style(UI::PanelStyle style, const LuaTable& table, PanelStyleMap* map) {
1534+ map->insert(std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
1535+}
1536
1537=== added file 'src/graphic/style_manager.h'
1538--- src/graphic/style_manager.h 1970-01-01 00:00:00 +0000
1539+++ src/graphic/style_manager.h 2018-05-12 13:15:45 +0000
1540@@ -0,0 +1,63 @@
1541+/*
1542+ * Copyright (C) 2017 by the Widelands Development Team
1543+ *
1544+ * This program is free software; you can redistribute it and/or
1545+ * modify it under the terms of the GNU General Public License
1546+ * as published by the Free Software Foundation; either version 2
1547+ * of the License, or (at your option) any later version.
1548+ *
1549+ * This program is distributed in the hope that it will be useful,
1550+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
1551+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
1552+ * GNU General Public License for more details.
1553+ *
1554+ * You should have received a copy of the GNU General Public License
1555+ * along with this program; if not, write to the Free Software
1556+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
1557+ *
1558+ */
1559+
1560+#ifndef WL_GRAPHIC_STYLE_MANAGER_H
1561+#define WL_GRAPHIC_STYLE_MANAGER_H
1562+
1563+#include <map>
1564+#include <memory>
1565+
1566+#include "graphic/panel_styles.h"
1567+#include "scripting/lua_table.h"
1568+
1569+static const std::string kTemplateDir = "templates/default/";
1570+
1571+class StyleManager {
1572+public:
1573+ StyleManager() = default;
1574+ ~StyleManager() = default;
1575+
1576+ // Late initialization, because Graphics needs to load the image files first.
1577+ void init();
1578+
1579+ const UI::PanelStyleInfo* button_style(UI::ButtonStyle) const;
1580+ const UI::PanelStyleInfo* slider_style(UI::SliderStyle) const;
1581+ const UI::PanelStyleInfo* tabpanel_style(UI::TabPanelStyle) const;
1582+ const UI::PanelStyleInfo* editbox_style(UI::PanelStyle) const;
1583+ const UI::PanelStyleInfo* dropdown_style(UI::PanelStyle) const;
1584+ const UI::PanelStyleInfo* scrollbar_style(UI::PanelStyle) const;
1585+
1586+private:
1587+ using PanelStyleMap = std::map<UI::PanelStyle, std::unique_ptr<const UI::PanelStyleInfo>>;
1588+ void add_button_style(UI::ButtonStyle style, const LuaTable& table);
1589+ void add_slider_style(UI::SliderStyle style, const LuaTable& table);
1590+ void add_tabpanel_style(UI::TabPanelStyle style, const LuaTable& table);
1591+ void add_style(UI::PanelStyle style, const LuaTable& table, PanelStyleMap* map);
1592+
1593+ std::map<UI::ButtonStyle, std::unique_ptr<const UI::PanelStyleInfo>> buttonstyles_;
1594+ std::map<UI::SliderStyle, std::unique_ptr<const UI::PanelStyleInfo>> sliderstyles_;
1595+ std::map<UI::TabPanelStyle, std::unique_ptr<const UI::PanelStyleInfo>> tabpanelstyles_;
1596+ PanelStyleMap editboxstyles_;
1597+ PanelStyleMap dropdownstyles_;
1598+ PanelStyleMap scrollbarstyles_;
1599+
1600+ DISALLOW_COPY_AND_ASSIGN(StyleManager);
1601+};
1602+
1603+#endif // end of include guard: WL_GRAPHIC_STYLE_MANAGER_H
1604
1605=== modified file 'src/graphic/texture.cc'
1606--- src/graphic/texture.cc 2017-05-21 14:52:14 +0000
1607+++ src/graphic/texture.cc 2018-05-12 13:15:45 +0000
1608@@ -30,7 +30,6 @@
1609 #include "graphic/gl/draw_line_program.h"
1610 #include "graphic/gl/fill_rect_program.h"
1611 #include "graphic/gl/utils.h"
1612-#include "graphic/graphic.h"
1613 #include "graphic/sdl_utils.h"
1614 #include "graphic/surface.h"
1615
1616
1617=== modified file 'src/io/filesystem/filesystem.cc'
1618--- src/io/filesystem/filesystem.cc 2018-04-07 16:59:00 +0000
1619+++ src/io/filesystem/filesystem.cc 2018-05-12 13:15:45 +0000
1620@@ -93,7 +93,7 @@
1621 /**
1622 * Fix a path that might come from another OS.
1623 * This function is used to make sure that paths send via network are usable
1624- * on locale OS.
1625+ * on local OS.
1626 */
1627 std::string FileSystem::fix_cross_file(const std::string& path) const {
1628 uint32_t path_size = path.size();
1629
1630=== modified file 'src/logic/CMakeLists.txt'
1631--- src/logic/CMakeLists.txt 2017-12-19 07:12:18 +0000
1632+++ src/logic/CMakeLists.txt 2018-05-12 13:15:45 +0000
1633@@ -265,7 +265,6 @@
1634 base_time_string
1635 build_info
1636 economy
1637- editor
1638 game_io
1639 graphic
1640 graphic_color
1641
1642=== modified file 'src/logic/editor_game_base.cc'
1643--- src/logic/editor_game_base.cc 2018-04-07 16:59:00 +0000
1644+++ src/logic/editor_game_base.cc 2018-05-12 13:15:45 +0000
1645@@ -30,7 +30,6 @@
1646 #include "economy/flag.h"
1647 #include "economy/road.h"
1648 #include "graphic/color.h"
1649-#include "graphic/graphic.h"
1650 #include "logic/findimmovable.h"
1651 #include "logic/game.h"
1652 #include "logic/game_data_error.h"
1653
1654=== modified file 'src/logic/game.cc'
1655--- src/logic/game.cc 2018-04-27 20:12:08 +0000
1656+++ src/logic/game.cc 2018-05-12 13:15:45 +0000
1657@@ -40,7 +40,6 @@
1658 #include "economy/economy.h"
1659 #include "game_io/game_loader.h"
1660 #include "game_io/game_preload_packet.h"
1661-#include "graphic/graphic.h"
1662 #include "io/fileread.h"
1663 #include "io/filesystem/layered_filesystem.h"
1664 #include "io/filewrite.h"
1665
1666=== modified file 'src/logic/map.cc'
1667--- src/logic/map.cc 2018-04-11 18:42:55 +0000
1668+++ src/logic/map.cc 2018-05-12 13:15:45 +0000
1669@@ -32,7 +32,6 @@
1670 #include "build_info.h"
1671 #include "economy/flag.h"
1672 #include "economy/road.h"
1673-#include "editor/tools/increase_resources_tool.h"
1674 #include "io/filesystem/layered_filesystem.h"
1675 #include "logic/filesystem_constants.h"
1676 #include "logic/findimmovable.h"
1677
1678=== modified file 'src/logic/map_objects/bob.cc'
1679--- src/logic/map_objects/bob.cc 2018-04-07 16:59:00 +0000
1680+++ src/logic/map_objects/bob.cc 2018-05-12 13:15:45 +0000
1681@@ -29,7 +29,6 @@
1682 #include "base/wexception.h"
1683 #include "economy/route.h"
1684 #include "economy/transfer.h"
1685-#include "graphic/graphic.h"
1686 #include "graphic/rendertarget.h"
1687 #include "io/fileread.h"
1688 #include "io/filewrite.h"
1689
1690=== modified file 'src/logic/map_objects/map_object.h'
1691--- src/logic/map_objects/map_object.h 2018-05-07 19:11:53 +0000
1692+++ src/logic/map_objects/map_object.h 2018-05-12 13:15:45 +0000
1693@@ -39,13 +39,11 @@
1694 #include "logic/map_objects/tribes/training_attribute.h"
1695 #include "logic/widelands.h"
1696 #include "scripting/lua_table.h"
1697+#include "ui_basic/tabpanel.h"
1698
1699 class FileRead;
1700 class RenderTarget;
1701 struct DirAnimations;
1702-namespace UI {
1703-struct TabPanel;
1704-}
1705
1706 namespace Widelands {
1707
1708
1709=== modified file 'src/logic/map_objects/tribes/building.cc'
1710--- src/logic/map_objects/tribes/building.cc 2018-04-07 16:59:00 +0000
1711+++ src/logic/map_objects/tribes/building.cc 2018-05-12 13:15:45 +0000
1712@@ -32,7 +32,6 @@
1713 #include "economy/flag.h"
1714 #include "economy/input_queue.h"
1715 #include "economy/request.h"
1716-#include "graphic/graphic.h"
1717 #include "graphic/rendertarget.h"
1718 #include "graphic/text_constants.h"
1719 #include "io/filesystem/filesystem.h"
1720
1721=== modified file 'src/logic/map_objects/tribes/dismantlesite.cc'
1722--- src/logic/map_objects/tribes/dismantlesite.cc 2018-04-07 16:59:00 +0000
1723+++ src/logic/map_objects/tribes/dismantlesite.cc 2018-05-12 13:15:45 +0000
1724@@ -28,7 +28,6 @@
1725 #include "base/wexception.h"
1726 #include "economy/wares_queue.h"
1727 #include "graphic/animation.h"
1728-#include "graphic/graphic.h"
1729 #include "graphic/rendertarget.h"
1730 #include "graphic/text_constants.h"
1731 #include "logic/editor_game_base.h"
1732
1733=== modified file 'src/logic/map_objects/tribes/production_program.cc'
1734--- src/logic/map_objects/tribes/production_program.cc 2018-04-07 16:59:00 +0000
1735+++ src/logic/map_objects/tribes/production_program.cc 2018-05-12 13:15:45 +0000
1736@@ -32,7 +32,6 @@
1737 #include "economy/economy.h"
1738 #include "economy/flag.h"
1739 #include "economy/input_queue.h"
1740-#include "graphic/graphic.h"
1741 #include "helper.h"
1742 #include "io/filesystem/layered_filesystem.h"
1743 #include "logic/findimmovable.h"
1744
1745=== modified file 'src/logic/map_objects/tribes/ship.cc'
1746--- src/logic/map_objects/tribes/ship.cc 2018-04-29 09:20:29 +0000
1747+++ src/logic/map_objects/tribes/ship.cc 2018-05-12 13:15:45 +0000
1748@@ -30,7 +30,6 @@
1749 #include "economy/fleet.h"
1750 #include "economy/portdock.h"
1751 #include "economy/wares_queue.h"
1752-#include "graphic/graphic.h"
1753 #include "graphic/rendertarget.h"
1754 #include "graphic/text_constants.h"
1755 #include "io/fileread.h"
1756
1757=== modified file 'src/logic/map_objects/tribes/ware_descr.cc'
1758--- src/logic/map_objects/tribes/ware_descr.cc 2018-04-07 16:59:00 +0000
1759+++ src/logic/map_objects/tribes/ware_descr.cc 2018-05-12 13:15:45 +0000
1760@@ -25,7 +25,6 @@
1761
1762 #include "base/i18n.h"
1763 #include "graphic/animation.h"
1764-#include "graphic/graphic.h"
1765 #include "logic/game_data_error.h"
1766 #include "logic/map_objects/tribes/tribe_descr.h"
1767
1768
1769=== modified file 'src/logic/map_objects/tribes/worker_descr.cc'
1770--- src/logic/map_objects/tribes/worker_descr.cc 2018-05-05 13:51:33 +0000
1771+++ src/logic/map_objects/tribes/worker_descr.cc 2018-05-12 13:15:45 +0000
1772@@ -24,7 +24,6 @@
1773 #include "base/i18n.h"
1774 #include "base/vector.h"
1775 #include "base/wexception.h"
1776-#include "graphic/graphic.h"
1777 #include "logic/game_data_error.h"
1778 #include "logic/map_objects/tribes/carrier.h"
1779 #include "logic/map_objects/tribes/soldier.h"
1780
1781=== modified file 'src/logic/map_objects/tribes/worker_program.cc'
1782--- src/logic/map_objects/tribes/worker_program.cc 2018-04-07 16:59:00 +0000
1783+++ src/logic/map_objects/tribes/worker_program.cc 2018-05-12 13:15:45 +0000
1784@@ -23,7 +23,6 @@
1785 #include <string>
1786
1787 #include "base/log.h"
1788-#include "graphic/graphic.h"
1789 #include "helper.h"
1790 #include "logic/findnode.h"
1791 #include "logic/game_data_error.h"
1792
1793=== modified file 'src/logic/map_objects/world/critter.cc'
1794--- src/logic/map_objects/world/critter.cc 2018-04-07 16:59:00 +0000
1795+++ src/logic/map_objects/world/critter.cc 2018-05-12 13:15:45 +0000
1796@@ -27,7 +27,6 @@
1797 #include <stdint.h>
1798
1799 #include "base/wexception.h"
1800-#include "graphic/graphic.h"
1801 #include "helper.h"
1802 #include "io/fileread.h"
1803 #include "io/filewrite.h"
1804
1805=== modified file 'src/logic/map_objects/world/terrain_description.h'
1806--- src/logic/map_objects/world/terrain_description.h 2018-04-07 16:59:00 +0000
1807+++ src/logic/map_objects/world/terrain_description.h 2018-05-12 13:15:45 +0000
1808@@ -26,7 +26,7 @@
1809
1810 #include "base/macros.h"
1811 #include "graphic/color.h"
1812-#include "graphic/graphic.h"
1813+#include "graphic/image.h"
1814 #include "logic/map_objects/world/resource_description.h"
1815 #include "logic/widelands.h"
1816
1817
1818=== modified file 'src/logic/map_objects/world/world.cc'
1819--- src/logic/map_objects/world/world.cc 2018-04-07 16:59:00 +0000
1820+++ src/logic/map_objects/world/world.cc 2018-05-12 13:15:45 +0000
1821@@ -22,6 +22,7 @@
1822 #include <memory>
1823
1824 #include "base/i18n.h"
1825+#include "graphic/graphic.h"
1826 #include "graphic/image_io.h"
1827 #include "logic/game_data_error.h"
1828 #include "logic/map_objects/immovable.h"
1829
1830=== modified file 'src/map_io/map_building_packet.cc'
1831--- src/map_io/map_building_packet.cc 2018-04-07 16:59:00 +0000
1832+++ src/map_io/map_building_packet.cc 2018-05-12 13:15:45 +0000
1833@@ -23,7 +23,6 @@
1834
1835 #include "base/macros.h"
1836 #include "economy/request.h"
1837-#include "graphic/graphic.h"
1838 #include "io/fileread.h"
1839 #include "io/filewrite.h"
1840 #include "logic/editor_game_base.h"
1841
1842=== modified file 'src/scripting/CMakeLists.txt'
1843--- src/scripting/CMakeLists.txt 2017-11-20 13:50:51 +0000
1844+++ src/scripting/CMakeLists.txt 2018-05-12 13:15:45 +0000
1845@@ -104,7 +104,6 @@
1846 base_log
1847 base_macros
1848 economy
1849- graphic
1850 io_fileread
1851 io_filesystem
1852 logic
1853
1854=== modified file 'src/scripting/lua_interface.cc'
1855--- src/scripting/lua_interface.cc 2018-04-07 16:59:00 +0000
1856+++ src/scripting/lua_interface.cc 2018-05-12 13:15:45 +0000
1857@@ -93,5 +93,5 @@
1858 }
1859
1860 std::unique_ptr<LuaTable> LuaInterface::run_script(const std::string& path) {
1861- return ::run_script(lua_state_, path, g_fs);
1862+ return ::run_script(lua_state_, g_fs->fix_cross_file(path), g_fs);
1863 }
1864
1865=== modified file 'src/scripting/lua_map.cc'
1866--- src/scripting/lua_map.cc 2018-04-11 18:42:55 +0000
1867+++ src/scripting/lua_map.cc 2018-05-12 13:15:45 +0000
1868@@ -27,7 +27,6 @@
1869 #include "base/macros.h"
1870 #include "base/wexception.h"
1871 #include "economy/input_queue.h"
1872-#include "graphic/graphic.h"
1873 #include "logic/findimmovable.h"
1874 #include "logic/map_objects/checkstep.h"
1875 #include "logic/map_objects/immovable.h"
1876
1877=== modified file 'src/sound/CMakeLists.txt'
1878--- src/sound/CMakeLists.txt 2017-03-04 11:40:59 +0000
1879+++ src/sound/CMakeLists.txt 2018-05-12 13:15:45 +0000
1880@@ -22,7 +22,6 @@
1881 DEPENDS
1882 base_i18n
1883 base_log
1884- graphic
1885 helper
1886 io_fileread
1887 io_filesystem
1888
1889=== modified file 'src/sound/sound_handler.cc'
1890--- src/sound/sound_handler.cc 2018-04-23 08:25:10 +0000
1891+++ src/sound/sound_handler.cc 2018-05-12 13:15:45 +0000
1892@@ -32,7 +32,6 @@
1893
1894 #include "base/i18n.h"
1895 #include "base/log.h"
1896-#include "graphic/graphic.h"
1897 #include "helper.h"
1898 #include "io/fileread.h"
1899 #include "io/filesystem/layered_filesystem.h"
1900
1901=== modified file 'src/ui_basic/CMakeLists.txt'
1902--- src/ui_basic/CMakeLists.txt 2017-02-28 20:07:07 +0000
1903+++ src/ui_basic/CMakeLists.txt 2018-05-12 13:15:45 +0000
1904@@ -65,6 +65,7 @@
1905 graphic_color
1906 graphic_fonthandler
1907 graphic_fonthandler_legacy
1908+ graphic_styles
1909 graphic_surface
1910 graphic_text
1911 graphic_text_constants
1912
1913=== modified file 'src/ui_basic/box.cc'
1914--- src/ui_basic/box.cc 2018-04-07 16:59:00 +0000
1915+++ src/ui_basic/box.cc 2018-05-12 13:15:45 +0000
1916@@ -195,9 +195,9 @@
1917 pagesize = get_inner_h() - Scrollbar::kSize;
1918 }
1919 if (scrollbar_ == nullptr) {
1920- scrollbar_.reset(new Scrollbar(this, sb_x, sb_y, sb_w, sb_h,
1921- g_gr->images().get("images/ui_basic/but3.png"),
1922- orientation_ == Horizontal));
1923+ // TODO(GunChleoc): Implement styling if we ever use the scrollbar function.
1924+ scrollbar_.reset(new Scrollbar(
1925+ this, sb_x, sb_y, sb_w, sb_h, UI::PanelStyle::kFsMenu, orientation_ == Horizontal));
1926 scrollbar_->moved.connect(boost::bind(&Box::scrollbar_moved, this, _1));
1927 } else {
1928 scrollbar_->set_pos(Vector2i(sb_x, sb_y));
1929
1930=== modified file 'src/ui_basic/button.cc'
1931--- src/ui_basic/button.cc 2018-04-07 16:59:00 +0000
1932+++ src/ui_basic/button.cc 2018-05-12 13:15:45 +0000
1933@@ -20,8 +20,10 @@
1934 #include "ui_basic/button.h"
1935
1936 #include "graphic/font_handler1.h"
1937+#include "graphic/graphic.h"
1938 #include "graphic/image.h"
1939 #include "graphic/rendertarget.h"
1940+#include "graphic/style_manager.h"
1941 #include "graphic/text_constants.h"
1942 #include "graphic/text_layout.h"
1943 #include "ui_basic/mouse_constants.h"
1944@@ -32,6 +34,36 @@
1945 // size.
1946 constexpr int kButtonImageMargin = 2;
1947
1948+Button::Button // Common constructor
1949+ (Panel* const parent,
1950+ const std::string& name,
1951+ int32_t const x,
1952+ int32_t const y,
1953+ uint32_t const w,
1954+ uint32_t const h,
1955+ UI::ButtonStyle init_style,
1956+ const Image* title_image,
1957+ const std::string& title_text,
1958+ const std::string& tooltip_text,
1959+ UI::Button::VisualState init_state,
1960+ ImageMode mode)
1961+ : NamedPanel(parent, name, x, y, w, h, tooltip_text),
1962+ highlighted_(false),
1963+ pressed_(false),
1964+ enabled_(true),
1965+ visual_state_(init_state),
1966+ disable_style_(ButtonDisableStyle::kMonochrome),
1967+ repeating_(false),
1968+ image_mode_(mode),
1969+ time_nextact_(0),
1970+ title_(title_text),
1971+ title_image_(title_image),
1972+ background_style_(g_gr->styles().button_style(init_style)),
1973+ clr_down_(229, 161, 2) {
1974+ set_thinks(false);
1975+ set_can_focus(true);
1976+}
1977+
1978 Button::Button // for textual buttons. If h = 0, h will resize according to the font's height.
1979 (Panel* const parent,
1980 const std::string& name,
1981@@ -39,31 +71,28 @@
1982 int32_t const y,
1983 uint32_t const w,
1984 uint32_t const h,
1985- const Image* bg_pic,
1986+ UI::ButtonStyle init_style,
1987 const std::string& title_text,
1988 const std::string& tooltip_text,
1989- UI::Button::Style init_style)
1990- : NamedPanel(parent, name, x, y, w, h, tooltip_text),
1991- highlighted_(false),
1992- pressed_(false),
1993- enabled_(true),
1994- style_(init_style),
1995- disable_style_(ButtonDisableStyle::kMonochrome),
1996- repeating_(false),
1997- image_mode_(UI::Button::ImageMode::kShrink),
1998- time_nextact_(0),
1999- title_(title_text),
2000- pic_background_(bg_pic),
2001- pic_custom_(nullptr),
2002- clr_down_(229, 161, 2) {
2003+ UI::Button::VisualState init_state)
2004+ : Button(parent,
2005+ name,
2006+ x,
2007+ y,
2008+ w,
2009+ h,
2010+ init_style,
2011+ nullptr,
2012+ title_text,
2013+ tooltip_text,
2014+ init_state,
2015+ UI::Button::ImageMode::kShrink) {
2016 // Automatically resize for font height and give it a margin.
2017 if (h < 1) {
2018 int new_height = text_height() + 4;
2019 set_desired_size(w, new_height);
2020 set_size(w, new_height);
2021 }
2022- set_thinks(false);
2023- set_can_focus(true);
2024 }
2025
2026 Button::Button // for pictorial buttons
2027@@ -73,25 +102,12 @@
2028 const int32_t y,
2029 const uint32_t w,
2030 const uint32_t h,
2031- const Image* bg_pic,
2032- const Image* fg_pic,
2033+ UI::ButtonStyle init_style,
2034+ const Image* title_image,
2035 const std::string& tooltip_text,
2036- UI::Button::Style init_style,
2037+ UI::Button::VisualState init_state,
2038 ImageMode mode)
2039- : NamedPanel(parent, name, x, y, w, h, tooltip_text),
2040- highlighted_(false),
2041- pressed_(false),
2042- enabled_(true),
2043- style_(init_style),
2044- disable_style_(ButtonDisableStyle::kMonochrome),
2045- repeating_(false),
2046- image_mode_(mode),
2047- time_nextact_(0),
2048- pic_background_(bg_pic),
2049- pic_custom_(fg_pic),
2050- clr_down_(229, 161, 2) {
2051- set_thinks(false);
2052- set_can_focus(true);
2053+ : Button(parent, name, x, y, w, h, init_style, title_image, "", tooltip_text, init_state, mode) {
2054 }
2055
2056 Button::~Button() {
2057@@ -103,10 +119,10 @@
2058 void Button::set_pic(const Image* pic) {
2059 title_.clear();
2060
2061- if (pic_custom_ == pic)
2062+ if (title_image_ == pic)
2063 return;
2064
2065- pic_custom_ = pic;
2066+ title_image_ = pic;
2067 }
2068
2069 /**
2070@@ -116,7 +132,7 @@
2071 if (title_ == title)
2072 return;
2073
2074- pic_custom_ = nullptr;
2075+ title_image_ = nullptr;
2076 title_ = title;
2077 }
2078
2079@@ -148,57 +164,53 @@
2080 * Redraw the button
2081 */
2082 void Button::draw(RenderTarget& dst) {
2083- const bool is_flat = (enabled_ && style_ == Style::kFlat) ||
2084+ const bool is_flat = (enabled_ && visual_state_ == VisualState::kFlat) ||
2085 (!enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kFlat));
2086 const bool is_permpressed =
2087- (enabled_ && style_ == Style::kPermpressed) ||
2088+ (enabled_ && visual_state_ == VisualState::kPermpressed) ||
2089 (!enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kPermpressed));
2090 const bool is_monochrome =
2091 !enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kMonochrome);
2092
2093 // Draw the background
2094- if (pic_background_) {
2095- dst.fill_rect(Recti(0, 0, get_w(), get_h()), RGBAColor(0, 0, 0, 255));
2096- dst.tile(
2097- Recti(Vector2i::zero(), get_w(), get_h()), pic_background_, Vector2i(get_x(), get_y()));
2098- }
2099+ draw_background(dst, *background_style_);
2100
2101 if (is_flat && highlighted_)
2102 dst.brighten_rect(Recti(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR);
2103
2104 // If we've got a picture, draw it centered
2105- if (pic_custom_) {
2106+ if (title_image_) {
2107 if (image_mode_ == UI::Button::ImageMode::kUnscaled) {
2108 if (!is_monochrome) {
2109- dst.blit(Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2,
2110- (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2),
2111- pic_custom_);
2112+ dst.blit(Vector2i((get_w() - static_cast<int32_t>(title_image_->width())) / 2,
2113+ (get_h() - static_cast<int32_t>(title_image_->height())) / 2),
2114+ title_image_);
2115 } else {
2116 dst.blit_monochrome(
2117- Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2,
2118- (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2),
2119- pic_custom_, RGBAColor(255, 255, 255, 127));
2120+ Vector2i((get_w() - static_cast<int32_t>(title_image_->width())) / 2,
2121+ (get_h() - static_cast<int32_t>(title_image_->height())) / 2),
2122+ title_image_, RGBAColor(255, 255, 255, 127));
2123 }
2124 } else {
2125 const int max_image_w = get_w() - 2 * kButtonImageMargin;
2126 const int max_image_h = get_h() - 2 * kButtonImageMargin;
2127 const float image_scale =
2128- std::min(1.f, std::min(static_cast<float>(max_image_w) / pic_custom_->width(),
2129- static_cast<float>(max_image_h) / pic_custom_->height()));
2130- int blit_width = image_scale * pic_custom_->width();
2131- int blit_height = image_scale * pic_custom_->height();
2132+ std::min(1.f, std::min(static_cast<float>(max_image_w) / title_image_->width(),
2133+ static_cast<float>(max_image_h) / title_image_->height()));
2134+ int blit_width = image_scale * title_image_->width();
2135+ int blit_height = image_scale * title_image_->height();
2136
2137 if (!is_monochrome) {
2138 dst.blitrect_scale(Rectf((get_w() - blit_width) / 2.f, (get_h() - blit_height) / 2.f,
2139 blit_width, blit_height),
2140- pic_custom_,
2141- Recti(0, 0, pic_custom_->width(), pic_custom_->height()), 1.,
2142+ title_image_,
2143+ Recti(0, 0, title_image_->width(), title_image_->height()), 1.,
2144 BlendMode::UseAlpha);
2145 } else {
2146 dst.blitrect_scale_monochrome(
2147 Rectf((get_w() - blit_width) / 2.f, (get_h() - blit_height) / 2.f, blit_width,
2148 blit_height),
2149- pic_custom_, Recti(0, 0, pic_custom_->width(), pic_custom_->height()),
2150+ title_image_, Recti(0, 0, title_image_->width(), title_image_->height()),
2151 RGBAColor(255, 255, 255, 127));
2152 }
2153 }
2154@@ -341,8 +353,8 @@
2155 return true; // We handle this always by lighting up
2156 }
2157
2158-void Button::set_style(UI::Button::Style input_style) {
2159- style_ = input_style;
2160+void Button::set_visual_state(UI::Button::VisualState input_state) {
2161+ visual_state_ = input_state;
2162 }
2163
2164 void Button::set_disable_style(UI::ButtonDisableStyle input_style) {
2165@@ -350,18 +362,19 @@
2166 }
2167
2168 void Button::set_perm_pressed(bool pressed) {
2169- set_style(pressed ? UI::Button::Style::kPermpressed : UI::Button::Style::kRaised);
2170+ set_visual_state(pressed ? UI::Button::VisualState::kPermpressed :
2171+ UI::Button::VisualState::kRaised);
2172 }
2173
2174 void Button::toggle() {
2175- switch (style_) {
2176- case UI::Button::Style::kRaised:
2177- style_ = UI::Button::Style::kPermpressed;
2178- break;
2179- case UI::Button::Style::kPermpressed:
2180- style_ = UI::Button::Style::kRaised;
2181- break;
2182- case UI::Button::Style::kFlat:
2183+ switch (visual_state_) {
2184+ case UI::Button::VisualState::kRaised:
2185+ visual_state_ = UI::Button::VisualState::kPermpressed;
2186+ break;
2187+ case UI::Button::VisualState::kPermpressed:
2188+ visual_state_ = UI::Button::VisualState::kRaised;
2189+ break;
2190+ case UI::Button::VisualState::kFlat:
2191 break; // Do nothing for flat buttons
2192 }
2193 }
2194
2195=== modified file 'src/ui_basic/button.h'
2196--- src/ui_basic/button.h 2018-04-07 16:59:00 +0000
2197+++ src/ui_basic/button.h 2018-05-12 13:15:45 +0000
2198@@ -48,7 +48,7 @@
2199 /// This is all that is needed in most cases, but if there is a need to give a
2200 /// callback function to the button, there are some templates for that below.
2201 struct Button : public NamedPanel {
2202- enum class Style {
2203+ enum class VisualState {
2204 kRaised, // Normal raised Button
2205 kPermpressed, // Button will appear pressed
2206 kFlat // Flat button with simple coloured outline
2207@@ -59,6 +59,23 @@
2208 kUnscaled // Show the foreground image without any scaling
2209 };
2210
2211+private:
2212+ Button // Common constructor
2213+ (Panel* const parent,
2214+ const std::string& name,
2215+ int32_t const x,
2216+ int32_t const y,
2217+ uint32_t const w,
2218+ uint32_t const h,
2219+ UI::ButtonStyle style,
2220+ const Image* title_image,
2221+ const std::string& title_text,
2222+ const std::string& tooltip_text,
2223+ UI::Button::VisualState state,
2224+ UI::Button::ImageMode mode);
2225+
2226+public:
2227+
2228 /**
2229 * Text conventions: Title Case for the 'title_text', Sentence case for the 'tooltip_text'
2230 */
2231@@ -69,10 +86,10 @@
2232 int32_t const y,
2233 uint32_t const w,
2234 uint32_t const h,
2235- const Image* background_picture_id,
2236+ UI::ButtonStyle style,
2237 const std::string& title_text,
2238 const std::string& tooltip_text = std::string(),
2239- UI::Button::Style init_style = UI::Button::Style::kRaised);
2240+ UI::Button::VisualState state = UI::Button::VisualState::kRaised);
2241
2242 /**
2243 * Text conventions: Sentence case for the 'tooltip_text'
2244@@ -84,10 +101,10 @@
2245 const int32_t y,
2246 const uint32_t w,
2247 const uint32_t h,
2248- const Image* background_picture_id,
2249- const Image* foreground_picture_id,
2250+ UI::ButtonStyle style,
2251+ const Image* title_image,
2252 const std::string& tooltip_text = std::string(),
2253- UI::Button::Style init_style = UI::Button::Style::kRaised,
2254+ UI::Button::VisualState state = UI::Button::VisualState::kRaised,
2255 UI::Button::ImageMode mode = UI::Button::ImageMode::kShrink);
2256 ~Button() override;
2257
2258@@ -118,9 +135,9 @@
2259 bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
2260
2261 /// Sets the visual style of the button
2262- void set_style(UI::Button::Style input_style);
2263- UI::Button::Style style() const {
2264- return style_;
2265+ void set_visual_state(UI::Button::VisualState state);
2266+ UI::Button::VisualState style() const {
2267+ return visual_state_;
2268 }
2269
2270 /// Sets the visual style of the disabled button
2271@@ -143,19 +160,18 @@
2272 bool highlighted_; // mouse is over the button
2273 bool pressed_; // mouse is clicked over the button
2274 bool enabled_;
2275- UI::Button::Style style_;
2276+ UI::Button::VisualState visual_state_;
2277 UI::ButtonDisableStyle disable_style_;
2278 bool repeating_;
2279 const UI::Button::ImageMode image_mode_;
2280
2281 uint32_t time_nextact_;
2282
2283- std::string title_; // title string used when pic_custom_ == 0
2284-
2285- const Image* pic_background_; // background texture (picture ID)
2286- const Image* pic_custom_; // custom icon on the button
2287-
2288- RGBColor clr_down_; // color of border while a flat button is "down"
2289+ std::string title_; // title string used when title_image_ == nullptr
2290+ const Image* title_image_; // custom icon on the button
2291+
2292+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
2293+ RGBColor clr_down_; // color of border while a flat button is "down"
2294 };
2295
2296 } // namespace UI
2297
2298=== modified file 'src/ui_basic/dropdown.cc'
2299--- src/ui_basic/dropdown.cc 2018-04-07 16:59:00 +0000
2300+++ src/ui_basic/dropdown.cc 2018-05-12 13:15:45 +0000
2301@@ -27,6 +27,7 @@
2302 #include "base/macros.h"
2303 #include "graphic/align.h"
2304 #include "graphic/font_handler1.h"
2305+#include "graphic/graphic.h"
2306 #include "graphic/rendertarget.h"
2307 #include "ui_basic/mouse_constants.h"
2308 #include "ui_basic/tabpanel.h"
2309@@ -53,8 +54,7 @@
2310 int button_dimension,
2311 const std::string& label,
2312 const DropdownType type,
2313- const Image* background,
2314- const Image* button_background)
2315+ UI::PanelStyle style)
2316 : UI::Panel(parent,
2317 x,
2318 y,
2319@@ -76,7 +76,9 @@
2320 0,
2321 button_dimension,
2322 get_h(),
2323- button_background,
2324+ style == UI::PanelStyle::kFsMenu ?
2325+ UI::ButtonStyle::kFsMenuMenu :
2326+ UI::ButtonStyle::kWuiSecondary,
2327 g_gr->images().get("images/ui_basic/scrollbar_down.png"),
2328 pgettext("dropdown", "Select Item")) :
2329 nullptr),
2330@@ -88,7 +90,8 @@
2331 w - button_dimension :
2332 type == DropdownType::kTextualNarrow ? w : button_dimension,
2333 get_h(),
2334- background,
2335+ style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuSecondary :
2336+ UI::ButtonStyle::kWuiSecondary,
2337 label),
2338 label_(label),
2339 type_(type),
2340@@ -107,12 +110,9 @@
2341 while (parent->get_parent() && !is_a(UI::TabPanel, parent->get_parent())) {
2342 parent = parent->get_parent();
2343 }
2344- list_ = new UI::Listselect<uintptr_t>(
2345- parent, 0, 0, w, 0, button_background, ListselectLayout::kDropdown);
2346+ list_ = new UI::Listselect<uintptr_t>(parent, 0, 0, w, 0, style, ListselectLayout::kDropdown);
2347
2348 list_->set_visible(false);
2349- list_->set_background(background);
2350-
2351 button_box_.add(&display_button_);
2352 display_button_.sigclicked.connect(boost::bind(&BaseDropdown::toggle_list, this));
2353 if (push_button_ != nullptr) {
2354
2355=== modified file 'src/ui_basic/dropdown.h'
2356--- src/ui_basic/dropdown.h 2018-04-07 16:59:00 +0000
2357+++ src/ui_basic/dropdown.h 2018-05-12 13:15:45 +0000
2358@@ -25,7 +25,6 @@
2359
2360 #include <boost/signals2.hpp>
2361
2362-#include "graphic/graphic.h"
2363 #include "graphic/image.h"
2364 #include "notifications/note_ids.h"
2365 #include "notifications/notifications.h"
2366@@ -60,8 +59,7 @@
2367 /// dropdowns, this is both the width and the height of the button.
2368 /// \param label a label to prefix to the selected entry on the display button.
2369 /// \param type whether this is a textual or pictorial dropdown
2370- /// \param background the background image for this dropdown
2371- /// \param button_background the background image all buttons in this dropdown
2372+ /// \param style the style used for buttons and background
2373 BaseDropdown(Panel* parent,
2374 int32_t x,
2375 int32_t y,
2376@@ -70,8 +68,7 @@
2377 int button_dimension,
2378 const std::string& label,
2379 const DropdownType type,
2380- const Image* background,
2381- const Image* button_background);
2382+ PanelStyle style);
2383 ~BaseDropdown() override;
2384
2385 public:
2386@@ -206,9 +203,7 @@
2387 /// dropdowns, this is both the width and the height of the button.
2388 /// \param label a label to prefix to the selected entry on the display button.
2389 /// \param type whether this is a textual or pictorial dropdown
2390- /// \param background the background image for this dropdown
2391- /// \param button_background the background image all buttons in this dropdown
2392- ///
2393+ /// \param style the style used for buttons and background
2394 /// Text conventions: Title Case for all elements
2395 Dropdown(Panel* parent,
2396 int32_t x,
2397@@ -217,19 +212,9 @@
2398 uint32_t list_h,
2399 int button_dimension,
2400 const std::string& label,
2401- const DropdownType type = DropdownType::kTextual,
2402- const Image* background = g_gr->images().get("images/ui_basic/but1.png"),
2403- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"))
2404- : BaseDropdown(parent,
2405- x,
2406- y,
2407- list_w,
2408- list_h,
2409- button_dimension,
2410- label,
2411- type,
2412- background,
2413- button_background) {
2414+ const DropdownType type,
2415+ PanelStyle style)
2416+ : BaseDropdown(parent, x, y, list_w, list_h, button_dimension, label, type, style) {
2417 }
2418 ~Dropdown() {
2419 entry_cache_.clear();
2420
2421=== modified file 'src/ui_basic/editbox.cc'
2422--- src/ui_basic/editbox.cc 2018-04-07 16:59:00 +0000
2423+++ src/ui_basic/editbox.cc 2018-05-12 13:15:45 +0000
2424@@ -24,9 +24,11 @@
2425 #include <SDL_keycode.h>
2426 #include <boost/format.hpp>
2427
2428+#include "graphic/color.h"
2429 #include "graphic/font_handler1.h"
2430 #include "graphic/graphic.h"
2431 #include "graphic/rendertarget.h"
2432+#include "graphic/style_manager.h"
2433 #include "graphic/text/bidi.h"
2434 #include "graphic/text/font_set.h"
2435 #include "graphic/text/rt_errors.h"
2436@@ -53,8 +55,8 @@
2437 uint32_t fontsize;
2438 /*@}*/
2439
2440- /// Background tile style.
2441- const Image* background;
2442+ /// Background color and texture
2443+ const UI::PanelStyleInfo* background_style;
2444
2445 /// Maximum number of characters in the input
2446 uint32_t maxLength;
2447@@ -78,7 +80,7 @@
2448 uint32_t w,
2449 uint32_t h,
2450 int margin_y,
2451- const Image* background,
2452+ UI::PanelStyle style,
2453 int font_size)
2454 : Panel(parent, x, y, w, h > 0 ? h : text_height(font_size) + 2 * margin_y),
2455 m_(new EditBoxImpl),
2456@@ -86,7 +88,7 @@
2457 history_position_(-1) {
2458 set_thinks(false);
2459
2460- m_->background = background;
2461+ m_->background_style = g_gr->styles().editbox_style(style);
2462 m_->fontname = UI::g_fh1->fontset()->sans();
2463 m_->fontsize = font_size;
2464
2465@@ -340,9 +342,7 @@
2466 }
2467
2468 void EditBox::draw(RenderTarget& dst) {
2469-
2470- // Draw the background
2471- dst.tile(Recti(0, 0, get_w(), get_h()), m_->background, Vector2i(get_x(), get_y()));
2472+ draw_background(dst, *m_->background_style);
2473
2474 // Draw border.
2475 if (get_w() >= 2 && get_h() >= 2) {
2476
2477=== modified file 'src/ui_basic/editbox.h'
2478--- src/ui_basic/editbox.h 2018-04-07 16:59:00 +0000
2479+++ src/ui_basic/editbox.h 2018-05-12 13:15:45 +0000
2480@@ -26,7 +26,6 @@
2481 #include <boost/signals2.hpp>
2482
2483 #include "graphic/align.h"
2484-#include "graphic/graphic.h"
2485 #include "ui_basic/button.h"
2486
2487 #define CHAT_HISTORY_SIZE 5
2488@@ -49,9 +48,9 @@
2489 int32_t x,
2490 int32_t y,
2491 uint32_t w,
2492- uint32_t h = 0,
2493- int margin_y = 2,
2494- const Image* background = g_gr->images().get("images/ui_basic/but2.png"),
2495+ uint32_t h,
2496+ int margin_y,
2497+ UI::PanelStyle style,
2498 int font_size = UI_FONT_SIZE_SMALL);
2499 ~EditBox() override;
2500
2501
2502=== modified file 'src/ui_basic/fileview_panel.cc'
2503--- src/ui_basic/fileview_panel.cc 2018-04-07 16:59:00 +0000
2504+++ src/ui_basic/fileview_panel.cc 2018-05-12 13:15:45 +0000
2505@@ -29,11 +29,14 @@
2506
2507 namespace UI {
2508
2509-FileViewPanel::FileViewPanel(Panel* parent, const Image* background, TabPanel::Type border_type)
2510- : TabPanel(parent, background, border_type),
2511- padding_(5),
2512- contents_width_(0),
2513- contents_height_(0) {
2514+FileViewPanel::FileViewPanel(Panel* parent,
2515+ UI::PanelStyle scrollbar_style,
2516+ TabPanelStyle background_style)
2517+ : TabPanel(parent, background_style),
2518+ padding_(5),
2519+ contents_width_(0),
2520+ contents_height_(0),
2521+ style_(scrollbar_style) {
2522 layout();
2523 }
2524
2525@@ -53,7 +56,7 @@
2526 size_t index = boxes_.size() - 1;
2527
2528 UI::MultilineTextarea* textarea =
2529- new UI::MultilineTextarea(boxes_.at(index).get(), 0, 0, Scrollbar::kSize, 0);
2530+ new UI::MultilineTextarea(boxes_.at(index).get(), 0, 0, Scrollbar::kSize, 0, style_);
2531 try {
2532 textarea->force_new_renderer();
2533 textarea->set_text(content);
2534@@ -85,9 +88,9 @@
2535
2536 // If there is a border, we have less space for the contents
2537 contents_width_ = std::max(
2538- 0, border_type_ == TabPanel::Type::kNoBorder ? get_w() - padding_ : get_w() - 2 * padding_);
2539+ 0, style_ == UI::PanelStyle::kFsMenu ? get_w() - padding_ : get_w() - 2 * padding_);
2540
2541- contents_height_ = std::max(0, border_type_ == TabPanel::Type::kNoBorder ?
2542+ contents_height_ = std::max(0, style_ == UI::PanelStyle::kFsMenu ?
2543 get_inner_h() - 2 * padding_ - UI::kTabPanelButtonHeight :
2544 get_inner_h() - 3 * padding_ - UI::kTabPanelButtonHeight);
2545
2546
2547=== modified file 'src/ui_basic/fileview_panel.h'
2548--- src/ui_basic/fileview_panel.h 2018-04-07 16:59:00 +0000
2549+++ src/ui_basic/fileview_panel.h 2018-05-12 13:15:45 +0000
2550@@ -35,9 +35,7 @@
2551 */
2552 class FileViewPanel : public TabPanel {
2553 public:
2554- FileViewPanel(Panel* parent,
2555- const Image* background,
2556- TabPanel::Type border_type = TabPanel::Type::kNoBorder);
2557+ FileViewPanel(Panel* parent, UI::PanelStyle scrollbar_style, UI::TabPanelStyle background_style);
2558
2559 /// Adds a tab with the contents of 'lua_script'.
2560 /// 'lua_script' must return a table that contains 'title' and 'text' keys.
2561@@ -49,6 +47,7 @@
2562 const int padding_;
2563 int contents_width_;
2564 int contents_height_;
2565+ const UI::PanelStyle style_;
2566
2567 // Tab contents
2568 std::vector<std::unique_ptr<Box>> boxes_;
2569
2570=== modified file 'src/ui_basic/fullscreen_window.cc'
2571--- src/ui_basic/fullscreen_window.cc 2018-04-07 16:59:00 +0000
2572+++ src/ui_basic/fullscreen_window.cc 2018-05-12 13:15:45 +0000
2573@@ -20,10 +20,10 @@
2574 #include "ui_basic/fullscreen_window.h"
2575
2576 #include <cstdio>
2577+#include <memory>
2578
2579-#include "graphic/graphic.h"
2580-#include "graphic/image.h"
2581 #include "graphic/rendertarget.h"
2582+#include "graphic/style_manager.h"
2583 #include "graphic/text_constants.h"
2584
2585 /*
2586@@ -37,23 +37,21 @@
2587
2588 FullscreenWindow::FullscreenWindow()
2589 : UI::Panel(nullptr, 0, 0, g_gr->get_xres(), g_gr->get_yres()),
2590- background_image_("images/ui_fsmenu/background.png") {
2591+ background_image_(kTemplateDir + "fsmenu/background.png") {
2592 graphic_resolution_changed_subscriber_ = Notifications::subscribe<GraphicResolutionChanged>(
2593 [this](const GraphicResolutionChanged& message) {
2594 set_size(message.width, message.height);
2595 layout();
2596 });
2597- set_frame_image(FullscreenWindow::Frames::kCornerTopLeft, "images/ui_fsmenu/top_left.png");
2598- set_frame_image(FullscreenWindow::Frames::kCornerTopRight, "images/ui_fsmenu/top_right.png");
2599- set_frame_image(FullscreenWindow::Frames::kCornerBottomLeft, "images/ui_fsmenu/bottom_left.png");
2600- set_frame_image(
2601- FullscreenWindow::Frames::kCornerBottomRight, "images/ui_fsmenu/bottom_right.png");
2602- set_frame_image(FullscreenWindow::Frames::kEdgeLeftTile, "images/ui_fsmenu/left.png");
2603- set_frame_image(FullscreenWindow::Frames::kEdgeRightTile, "images/ui_fsmenu/right.png");
2604- set_frame_image(FullscreenWindow::Frames::kEdgeTopTile, "images/ui_fsmenu/top.png");
2605- set_frame_image(FullscreenWindow::Frames::kEdgeBottomTile, "images/ui_fsmenu/bottom.png");
2606- add_overlay_image("images/ui_fsmenu/center.png",
2607- FullscreenWindow::Alignment(UI::Align::kCenter, UI::Align::kCenter));
2608+ set_frame_image(FullscreenWindow::Frames::kCornerTopLeft, "fsmenu/top_left.png");
2609+ set_frame_image(FullscreenWindow::Frames::kCornerTopRight, "fsmenu/top_right.png");
2610+ set_frame_image(FullscreenWindow::Frames::kCornerBottomLeft, "fsmenu/bottom_left.png");
2611+ set_frame_image(FullscreenWindow::Frames::kCornerBottomRight, "fsmenu/bottom_right.png");
2612+ set_frame_image(FullscreenWindow::Frames::kEdgeLeftTile, "fsmenu/left.png");
2613+ set_frame_image(FullscreenWindow::Frames::kEdgeRightTile, "fsmenu/right.png");
2614+ set_frame_image(FullscreenWindow::Frames::kEdgeTopTile, "fsmenu/top.png");
2615+ set_frame_image(FullscreenWindow::Frames::kEdgeBottomTile, "fsmenu/bottom.png");
2616+ set_frame_image(FullscreenWindow::Frames::kCenter, "fsmenu/center.png");
2617 }
2618
2619 FullscreenWindow::~FullscreenWindow() {
2620@@ -62,7 +60,7 @@
2621 }
2622
2623 void FullscreenWindow::add_overlay_image(const std::string& filename, Alignment align) {
2624- overlays_.push_back(std::make_pair(g_gr->images().get(filename), align));
2625+ overlays_.push_back(std::unique_ptr<const Overlay>(new Overlay(g_gr->images().get(filename), align)));
2626 }
2627
2628 void FullscreenWindow::clear_overlays() {
2629@@ -70,7 +68,7 @@
2630 }
2631
2632 void FullscreenWindow::set_frame_image(FullscreenWindow::Frames id, const std::string& filename) {
2633- frame_overlays_.insert(std::make_pair(id, g_gr->images().get(filename)));
2634+ frame_overlays_.insert(std::make_pair(id, g_gr->images().get(kTemplateDir + filename)));
2635 }
2636
2637 const Image* FullscreenWindow::get_frame_image(FullscreenWindow::Frames id) const {
2638@@ -88,20 +86,24 @@
2639 // Overall background
2640 dst.tile(Recti(0, 0, get_w(), get_h()), g_gr->images().get(background_image_), Vector2i::zero());
2641
2642+ // Center background
2643+ blit_image(dst, get_frame_image(FullscreenWindow::Frames::kCenter),
2644+ FullscreenWindow::Alignment(UI::Align::kCenter, UI::Align::kCenter));
2645+
2646 // Optional overlays
2647 for (const auto& overlay : overlays_) {
2648- blit_image(dst, overlay.first, overlay.second);
2649+ blit_image(dst, overlay->image, overlay->align);
2650 }
2651
2652 // Frame edges
2653 blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeLeftTile),
2654- Alignment(UI::Align::kLeft, UI::Align::kTop), kVertical);
2655+ Alignment(UI::Align::kLeft, UI::Align::kTop), Tiling::kVertical);
2656 blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeRightTile),
2657- Alignment(UI::Align::kRight, UI::Align::kTop), kVertical);
2658+ Alignment(UI::Align::kRight, UI::Align::kTop), Tiling::kVertical);
2659 blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeTopTile),
2660- Alignment(UI::Align::kLeft, UI::Align::kTop), kHorizontal);
2661+ Alignment(UI::Align::kLeft, UI::Align::kTop), Tiling::kHorizontal);
2662 blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeBottomTile),
2663- Alignment(UI::Align::kLeft, UI::Align::kBottom), kHorizontal);
2664+ Alignment(UI::Align::kLeft, UI::Align::kBottom), Tiling::kHorizontal);
2665
2666 // Frame corners
2667 blit_image(dst, get_frame_image(FullscreenWindow::Frames::kCornerTopLeft),
2668@@ -114,43 +116,61 @@
2669 FullscreenWindow::Alignment(UI::Align::kRight, UI::Align::kBottom));
2670 }
2671
2672+Recti FullscreenWindow::calculate_rect(const Image* image, Alignment align, Tiling tiling) {
2673+ int x = 0;
2674+ int y = 0;
2675+ int w = image->width();
2676+ int h = image->height();
2677+ const int available_width = g_gr->get_xres();
2678+ const int available_height = g_gr->get_yres();
2679+
2680+ if (tiling != Tiling::kNone) {
2681+ w = (tiling == Tiling::kVertical) ? w : available_width;
2682+ h = (tiling == Tiling::kHorizontal) ? h : available_height;
2683+ } else {
2684+ const float scale =
2685+ std::min(1.f, std::max(static_cast<float>(available_width) / image->width(), static_cast<float>(available_height) / image->height()));
2686+ w = scale * image->width();
2687+ h = scale * image->height();
2688+ }
2689+
2690+ // Adjust horizontal alignment
2691+ switch (align.halign) {
2692+ case UI::Align::kRight:
2693+ x = available_width - w;
2694+ break;
2695+ case UI::Align::kCenter:
2696+ x = (available_width - w) / 2;
2697+ break;
2698+ case UI::Align::kLeft:
2699+ break;
2700+ }
2701+
2702+ // Adjust vertical alignment
2703+ switch (align.valign) {
2704+ case UI::Align::kBottom:
2705+ y = available_height - h;
2706+ break;
2707+ case UI::Align::kCenter:
2708+ y = (available_height - h) / 2;
2709+ break;
2710+ case UI::Align::kTop:
2711+ break;
2712+ }
2713+ return Recti(x, y, w, h);
2714+}
2715+
2716 void FullscreenWindow::blit_image(RenderTarget& dst,
2717 const Image* image,
2718 Alignment align,
2719 Tiling tiling) {
2720 if (image) {
2721- int x = 0;
2722- int y = 0;
2723- // Adjust horizontal alignment
2724- switch (align.halign) {
2725- case UI::Align::kRight:
2726- x = get_w() - image->width();
2727- break;
2728- case UI::Align::kCenter:
2729- x = (get_w() - image->width()) / 2;
2730- break;
2731- case UI::Align::kLeft:
2732- break;
2733- }
2734-
2735- // Adjust vertical alignment
2736- switch (align.valign) {
2737- case UI::Align::kBottom:
2738- y = get_h() - image->height();
2739- break;
2740- case UI::Align::kCenter:
2741- y = (get_h() - image->height()) / 2;
2742- break;
2743- case UI::Align::kTop:
2744- break;
2745- }
2746-
2747- if (tiling != kNone) {
2748- const int w = (tiling == kVertical) ? image->width() : get_w();
2749- const int h = (tiling == kHorizontal) ? image->height() : get_h();
2750- dst.tile(Recti(x, y, w, h), image, Vector2i::zero());
2751+ const Recti dest = FullscreenWindow::calculate_rect(image, align, tiling);
2752+ if (tiling != Tiling::kNone) {
2753+ dst.tile(dest, image, Vector2i::zero());
2754 } else {
2755- dst.blit(Vector2i(x, y), image);
2756+ dst.blitrect_scale(dest.cast<float>(), image, Recti(0, 0, image->width(), image->height()),
2757+ 1., BlendMode::UseAlpha);
2758 }
2759 }
2760 }
2761
2762=== modified file 'src/ui_basic/fullscreen_window.h'
2763--- src/ui_basic/fullscreen_window.h 2018-04-07 16:59:00 +0000
2764+++ src/ui_basic/fullscreen_window.h 2018-05-12 13:15:45 +0000
2765@@ -48,7 +48,8 @@
2766 kEdgeLeftTile,
2767 kEdgeRightTile,
2768 kEdgeTopTile,
2769- kEdgeBottomTile
2770+ kEdgeBottomTile,
2771+ kCenter
2772 };
2773 struct FramesHash {
2774 template <typename T> int operator()(T t) const {
2775@@ -88,20 +89,33 @@
2776 /// Returns the image for the given frame position.
2777 const Image* get_frame_image(FullscreenWindow::Frames id) const;
2778
2779- enum Tiling { kNone, kHorizontal, kVertical };
2780+ enum class Tiling { kNone, kHorizontal, kVertical };
2781+
2782+ /// Calculate the rect that the image will be blitted to.
2783+ static Recti calculate_rect(const Image* image, Alignment align, Tiling tiling);
2784
2785 /**
2786 * Blit an image according to the given 'align'.
2787 * If 'tiling' is set to 'UI::Align::kVertical' or 'UI::Align::kHorizontal', the image will be
2788- * tiled.
2789+ * tiled. If the image is bigger than the panel, it will get scaled down.
2790 */
2791- void blit_image(RenderTarget& dst, const Image* image, Alignment align, Tiling tiling = kNone);
2792+ void blit_image(RenderTarget& dst,
2793+ const Image* image,
2794+ Alignment align,
2795+ Tiling tiling = Tiling::kNone);
2796
2797 const std::string background_image_;
2798+
2799 /// These overlay images will be blitted in the order they were added and according to the given
2800 /// align.
2801- std::vector<std::pair<const Image*, Alignment>> overlays_;
2802- /// Images for the edges. They will be blitted in top of the overlays_.
2803+ struct Overlay {
2804+ Overlay(const Image* init_image, const FullscreenWindow::Alignment& init_align) : image(init_image), align(init_align) {}
2805+ const Image* image;
2806+ const FullscreenWindow::Alignment align;
2807+ };
2808+ std::vector<std::unique_ptr<const Overlay>> overlays_;
2809+
2810+ /// Images for the edges and the center. Except for the center one, they will be blitted on top of the overlays_.
2811 std::unordered_map<FullscreenWindow::Frames, const Image*, FullscreenWindow::FramesHash>
2812 frame_overlays_;
2813
2814
2815=== modified file 'src/ui_basic/icongrid.cc'
2816--- src/ui_basic/icongrid.cc 2018-04-07 16:59:00 +0000
2817+++ src/ui_basic/icongrid.cc 2018-05-12 13:15:45 +0000
2818@@ -30,7 +30,6 @@
2819 int32_t y,
2820 uint32_t w,
2821 uint32_t h,
2822- const Image* background_picture_id,
2823 const Image* foreground_picture_id,
2824 uint32_t callback_argument_id,
2825 const std::string& tooltip_text)
2826@@ -40,10 +39,10 @@
2827 y,
2828 w,
2829 h,
2830- background_picture_id,
2831+ UI::ButtonStyle::kWuiBuildingStats,
2832 foreground_picture_id,
2833 tooltip_text,
2834- UI::Button::Style::kFlat),
2835+ UI::Button::VisualState::kFlat),
2836 icongrid_(parent),
2837 callback_argument_id_(callback_argument_id) {
2838 }
2839@@ -97,8 +96,8 @@
2840 uint32_t x = (idx % columns_) * cell_width_;
2841 uint32_t y = (idx / columns_) * cell_height_;
2842
2843- UI::Button* btn = new IconGridButton(
2844- *this, name, x, y, cell_width_, cell_height_, nullptr, pic, idx, tooltip_text);
2845+ UI::Button* btn =
2846+ new IconGridButton(*this, name, x, y, cell_width_, cell_height_, pic, idx, tooltip_text);
2847 btn->sigclicked.connect(boost::bind(&IconGrid::clicked_button, this, idx));
2848
2849 return idx;
2850
2851=== modified file 'src/ui_basic/listselect.cc'
2852--- src/ui_basic/listselect.cc 2018-04-07 16:59:00 +0000
2853+++ src/ui_basic/listselect.cc 2018-05-12 13:15:45 +0000
2854@@ -28,6 +28,7 @@
2855 #include "graphic/font_handler1.h"
2856 #include "graphic/graphic.h"
2857 #include "graphic/rendertarget.h"
2858+#include "graphic/style_manager.h"
2859 #include "graphic/text/bidi.h"
2860 #include "graphic/text_constants.h"
2861 #include "graphic/text_layout.h"
2862@@ -50,17 +51,19 @@
2863 const int32_t y,
2864 const uint32_t w,
2865 const uint32_t h,
2866- const Image* button_background,
2867+ UI::PanelStyle style,
2868 const ListselectLayout selection_mode)
2869 : Panel(parent, x, y, w, h),
2870 lineheight_(text_height() + kMargin),
2871- scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, button_background),
2872+ scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, style),
2873 scrollpos_(0),
2874 selection_(no_selection_index()),
2875 last_click_time_(-10000),
2876 last_selection_(no_selection_index()),
2877 selection_mode_(selection_mode),
2878- background_(nullptr) {
2879+ background_style_(selection_mode == ListselectLayout::kDropdown ?
2880+ g_gr->styles().dropdown_style(style) :
2881+ nullptr) {
2882 set_thinks(false);
2883
2884 scrollbar_.moved.connect(boost::bind(&BaseListselect::set_scrollpos, this, _1));
2885@@ -313,8 +316,8 @@
2886 uint32_t idx = scrollpos_ / get_lineheight();
2887 int y = 1 + idx * get_lineheight() - scrollpos_;
2888
2889- if (background_ != nullptr) {
2890- dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), background_, Vector2i::zero());
2891+ if (background_style_ != nullptr) {
2892+ draw_background(dst, *background_style_);
2893 }
2894
2895 if (selection_mode_ == ListselectLayout::kDropdown) {
2896
2897=== modified file 'src/ui_basic/listselect.h'
2898--- src/ui_basic/listselect.h 2018-04-07 16:59:00 +0000
2899+++ src/ui_basic/listselect.h 2018-05-12 13:15:45 +0000
2900@@ -26,7 +26,6 @@
2901 #include <boost/signals2.hpp>
2902
2903 #include "graphic/color.h"
2904-#include "graphic/graphic.h"
2905 #include "ui_basic/panel.h"
2906 #include "ui_basic/scrollbar.h"
2907
2908@@ -51,7 +50,7 @@
2909 int32_t y,
2910 uint32_t w,
2911 uint32_t h,
2912- const Image* button_background,
2913+ PanelStyle style,
2914 ListselectLayout selection_mode = ListselectLayout::kPlain);
2915 ~BaseListselect() override;
2916
2917@@ -108,10 +107,6 @@
2918 const std::string& get_selected_tooltip() const;
2919 const Image* get_selected_image() const;
2920
2921- void set_background(const Image* background) {
2922- background_ = background;
2923- }
2924-
2925 /// Return the total height (text + spacing) occupied by a single line.
2926 int get_lineheight() const;
2927
2928@@ -153,7 +148,7 @@
2929 uint32_t last_selection_; // for double clicks
2930 ListselectLayout selection_mode_;
2931 const Image* check_pic_;
2932- const Image* background_;
2933+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
2934 std::string current_tooltip_;
2935 };
2936
2937@@ -163,9 +158,9 @@
2938 int32_t y,
2939 uint32_t w,
2940 uint32_t h,
2941- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
2942+ UI::PanelStyle style,
2943 ListselectLayout selection_mode = ListselectLayout::kPlain)
2944- : BaseListselect(parent, x, y, w, h, button_background, selection_mode) {
2945+ : BaseListselect(parent, x, y, w, h, style, selection_mode) {
2946 }
2947
2948 void add(const std::string& name,
2949@@ -193,10 +188,6 @@
2950 return entry_cache_[BaseListselect::get_selected()];
2951 }
2952
2953- void set_background(const Image* background) {
2954- BaseListselect::set_background(background);
2955- }
2956-
2957 private:
2958 std::deque<Entry> entry_cache_;
2959 };
2960@@ -216,9 +207,9 @@
2961 int32_t y,
2962 uint32_t w,
2963 uint32_t h,
2964- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
2965+ UI::PanelStyle style,
2966 ListselectLayout selection_mode = ListselectLayout::kPlain)
2967- : Base(parent, x, y, w, h, button_background, selection_mode) {
2968+ : Base(parent, x, y, w, h, style, selection_mode) {
2969 }
2970
2971 void add(const std::string& name,
2972@@ -243,10 +234,6 @@
2973 Entry& get_selected() const {
2974 return *Base::get_selected();
2975 }
2976-
2977- void set_background(const Image* background) {
2978- *Base::set_background(background);
2979- }
2980 };
2981 }
2982
2983
2984=== modified file 'src/ui_basic/messagebox.cc'
2985--- src/ui_basic/messagebox.cc 2018-04-07 16:59:00 +0000
2986+++ src/ui_basic/messagebox.cc 2018-05-12 13:15:45 +0000
2987@@ -71,26 +71,25 @@
2988 scrollmode = MultilineTextarea::ScrollMode::kScrollNormal;
2989 }
2990
2991- textarea_.reset(new MultilineTextarea(this, margin, margin, width - 2 * margin, height, text,
2992- align, g_gr->images().get("images/ui_basic/but1.png"),
2993- scrollmode));
2994+ textarea_.reset(new MultilineTextarea(this, margin, margin, width - 2 * margin, height,
2995+ UI::PanelStyle::kWui, text, align, scrollmode));
2996
2997 // Now add the buttons
2998 const int button_y = textarea_->get_y() + textarea_->get_h() + 2 * margin;
2999 const int left_button_x = width / 3 - button_w / 2;
3000 const int right_button_x = width * 2 / 3 - button_w / 2;
3001
3002- ok_button_.reset(new Button(
3003- this, "ok",
3004- type_ == MBoxType::kOk ? (width - button_w) / 2 :
3005- UI::g_fh1->fontset()->is_rtl() ? left_button_x : right_button_x,
3006- button_y, button_w, 0, g_gr->images().get("images/ui_basic/but5.png"), _("OK")));
3007+ ok_button_.reset(new Button(this, "ok",
3008+ type_ == MBoxType::kOk ?
3009+ (width - button_w) / 2 :
3010+ UI::g_fh1->fontset()->is_rtl() ? left_button_x : right_button_x,
3011+ button_y, button_w, 0, UI::ButtonStyle::kWuiPrimary, _("OK")));
3012 ok_button_->sigclicked.connect(boost::bind(&WLMessageBox::clicked_ok, boost::ref(*this)));
3013
3014 if (type_ == MBoxType::kOkCancel) {
3015- cancel_button_.reset(new Button(
3016- this, "cancel", UI::g_fh1->fontset()->is_rtl() ? right_button_x : left_button_x, button_y,
3017- button_w, 0, g_gr->images().get("images/ui_basic/but1.png"), _("Cancel")));
3018+ cancel_button_.reset(
3019+ new Button(this, "cancel", UI::g_fh1->fontset()->is_rtl() ? right_button_x : left_button_x,
3020+ button_y, button_w, 0, UI::ButtonStyle::kWuiSecondary, _("Cancel")));
3021 cancel_button_->sigclicked.connect(
3022 boost::bind(&WLMessageBox::clicked_back, boost::ref(*this)));
3023 }
3024
3025=== modified file 'src/ui_basic/multilineeditbox.cc'
3026--- src/ui_basic/multilineeditbox.cc 2018-04-07 16:59:00 +0000
3027+++ src/ui_basic/multilineeditbox.cc 2018-05-12 13:15:45 +0000
3028@@ -25,6 +25,7 @@
3029 #include "graphic/font_handler1.h"
3030 #include "graphic/graphic.h"
3031 #include "graphic/rendertarget.h"
3032+#include "graphic/style_manager.h"
3033 #include "graphic/text_layout.h"
3034 #include "graphic/wordwrap.h"
3035 #include "ui_basic/mouse_constants.h"
3036@@ -40,8 +41,8 @@
3037 /// The text in the edit box
3038 std::string text;
3039
3040- /// Background tile style.
3041- const Image* background;
3042+ /// Background color and texture
3043+ const UI::PanelStyleInfo* background_style;
3044
3045 /// Position of the cursor inside the text.
3046 /// 0 indicates that the cursor is before the first character,
3047@@ -59,7 +60,7 @@
3048 WordWrap ww;
3049 /*@}*/
3050
3051- Data(MultilineEditbox&, const Image* init_background, const Image* button_background);
3052+ Data(MultilineEditbox&, const UI::PanelStyleInfo* style);
3053 void refresh_ww();
3054
3055 void update();
3056@@ -81,28 +82,19 @@
3057 /**
3058 * Initialize an editbox that supports multiline strings.
3059 */
3060-MultilineEditbox::MultilineEditbox(Panel* parent,
3061- int32_t x,
3062- int32_t y,
3063- uint32_t w,
3064- uint32_t h,
3065- const std::string& text,
3066- const Image* background,
3067- const Image* button_background)
3068- : Panel(parent, x, y, w, h), d_(new Data(*this, background, button_background)) {
3069+MultilineEditbox::MultilineEditbox(
3070+ Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, UI::PanelStyle style)
3071+ : Panel(parent, x, y, w, h), d_(new Data(*this, g_gr->styles().editbox_style(style))) {
3072 set_handle_mouse(true);
3073 set_can_focus(true);
3074 set_thinks(false);
3075 set_handle_textinput();
3076-
3077- set_text(text);
3078 }
3079
3080-MultilineEditbox::Data::Data(MultilineEditbox& o,
3081- const Image* init_background,
3082- const Image* button_background)
3083- : scrollbar(&o, o.get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, o.get_h(), button_background),
3084- background(init_background),
3085+MultilineEditbox::Data::Data(MultilineEditbox& o, const UI::PanelStyleInfo* style)
3086+ : scrollbar(
3087+ &o, o.get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, o.get_h(), UI::PanelStyle::kWui),
3088+ background_style(style),
3089 cursor_pos(0),
3090 lineheight(text_height()),
3091 maxbytes(std::min(g_gr->max_texture_size() / UI_FONT_SIZE_SMALL, 0xffff)),
3092@@ -408,8 +400,7 @@
3093 * Redraw the Editbox
3094 */
3095 void MultilineEditbox::draw(RenderTarget& dst) {
3096- // Draw the background
3097- dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), d_->background, Vector2i(get_x(), get_y()));
3098+ draw_background(dst, *d_->background_style);
3099
3100 // Draw border.
3101 if (get_w() >= 4 && get_h() >= 4) {
3102
3103=== modified file 'src/ui_basic/multilineeditbox.h'
3104--- src/ui_basic/multilineeditbox.h 2018-04-07 16:59:00 +0000
3105+++ src/ui_basic/multilineeditbox.h 2018-05-12 13:15:45 +0000
3106@@ -24,7 +24,6 @@
3107
3108 #include <boost/signals2.hpp>
3109
3110-#include "graphic/graphic.h"
3111 #include "ui_basic/panel.h"
3112
3113 namespace UI {
3114@@ -36,15 +35,7 @@
3115 * Text conventions: Sentence case for labels associated with thie editbox
3116 */
3117 struct MultilineEditbox : public Panel {
3118- MultilineEditbox(
3119- Panel*,
3120- int32_t x,
3121- int32_t y,
3122- uint32_t w,
3123- uint32_t h,
3124- const std::string& text,
3125- const Image* background = g_gr->images().get("images/ui_basic/but2.png"),
3126- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"));
3127+ MultilineEditbox(Panel*, int32_t x, int32_t y, uint32_t w, uint32_t h, PanelStyle style);
3128
3129 boost::signals2::signal<void()> changed;
3130
3131
3132=== modified file 'src/ui_basic/multilinetextarea.cc'
3133--- src/ui_basic/multilinetextarea.cc 2018-04-07 16:59:00 +0000
3134+++ src/ui_basic/multilinetextarea.cc 2018-05-12 13:15:45 +0000
3135@@ -37,9 +37,9 @@
3136 const int32_t y,
3137 const uint32_t w,
3138 const uint32_t h,
3139+ UI::PanelStyle style,
3140 const std::string& text,
3141 const Align align,
3142- const Image* button_background,
3143 MultilineTextarea::ScrollMode scroll_mode)
3144 : Panel(parent, x, y, w, h),
3145 text_(text),
3146@@ -47,8 +47,7 @@
3147 align_(align),
3148 force_new_renderer_(false),
3149 use_old_renderer_(false),
3150- scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, button_background, false),
3151- pic_background_(nullptr) {
3152+ scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, style, false) {
3153 set_thinks(false);
3154
3155 scrollbar_.moved.connect(boost::bind(&MultilineTextarea::scrollpos_changed, this, _1));
3156@@ -134,9 +133,6 @@
3157 * Redraw the textarea
3158 */
3159 void MultilineTextarea::draw(RenderTarget& dst) {
3160- if (pic_background_) {
3161- dst.tile(Recti(0, 0, get_inner_w(), get_inner_h()), pic_background_, Vector2i::zero());
3162- }
3163 if (use_old_renderer_) {
3164 rt.draw(dst, Vector2i(RICHTEXT_MARGIN, RICHTEXT_MARGIN - scrollbar_.get_scrollpos()));
3165 } else {
3166@@ -175,9 +171,6 @@
3167 scrollbar_.set_scrollpos(0);
3168 }
3169
3170-void MultilineTextarea::set_background(const Image* background) {
3171- pic_background_ = background;
3172-}
3173 void MultilineTextarea::set_scrollmode(MultilineTextarea::ScrollMode scroll_mode) {
3174 scrollmode_ = scroll_mode;
3175 scrollbar_.set_force_draw(scrollmode_ == ScrollMode::kScrollNormalForced ||
3176
3177=== modified file 'src/ui_basic/multilinetextarea.h'
3178--- src/ui_basic/multilinetextarea.h 2018-04-07 16:59:00 +0000
3179+++ src/ui_basic/multilinetextarea.h 2018-05-12 13:15:45 +0000
3180@@ -51,9 +51,9 @@
3181 const int32_t y,
3182 const uint32_t w,
3183 const uint32_t h,
3184+ UI::PanelStyle style,
3185 const std::string& text = std::string(),
3186 const Align = UI::Align::kLeft,
3187- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3188 MultilineTextarea::ScrollMode scroll_mode = MultilineTextarea::ScrollMode::kScrollNormal);
3189
3190 const std::string& get_text() const {
3191@@ -87,7 +87,6 @@
3192 bool handle_key(bool down, SDL_Keysym code) override;
3193 void scroll_to_top();
3194
3195- void set_background(const Image* background);
3196 void set_scrollmode(MultilineTextarea::ScrollMode scroll_mode);
3197
3198 protected:
3199@@ -113,8 +112,6 @@
3200
3201 Scrollbar scrollbar_;
3202 ScrollMode scrollmode_;
3203-
3204- const Image* pic_background_;
3205 };
3206 }
3207
3208
3209=== modified file 'src/ui_basic/panel.cc'
3210--- src/ui_basic/panel.cc 2018-05-03 18:52:48 +0000
3211+++ src/ui_basic/panel.cc 2018-05-12 13:15:45 +0000
3212@@ -440,6 +440,22 @@
3213 }
3214
3215 /**
3216+ * Draw texture and color from the info if they have been specified.
3217+ */
3218+void Panel::draw_background(RenderTarget& dst, const UI::PanelStyleInfo& info) {
3219+ draw_background(dst, Recti(0, 0, get_w(), get_h()), info);
3220+}
3221+void Panel::draw_background(RenderTarget& dst, Recti rect, const UI::PanelStyleInfo& info) {
3222+ if (info.image != nullptr) {
3223+ dst.fill_rect(rect, RGBAColor(0, 0, 0, 255));
3224+ dst.tile(rect, info.image, Vector2i(get_x(), get_y()));
3225+ }
3226+ if (info.color != RGBAColor(0, 0, 0, 0)) {
3227+ dst.fill_rect(rect, info.color, BlendMode::UseAlpha);
3228+ }
3229+}
3230+
3231+/**
3232 * Called once per event loop pass, unless set_think(false) has
3233 * been called. It is intended to be used for animations and game logic.
3234 */
3235
3236=== modified file 'src/ui_basic/panel.h'
3237--- src/ui_basic/panel.h 2018-04-07 16:59:00 +0000
3238+++ src/ui_basic/panel.h 2018-05-12 13:15:45 +0000
3239@@ -32,6 +32,7 @@
3240 #include "base/vector.h"
3241 #include "graphic/align.h"
3242 #include "graphic/font_handler1.h"
3243+#include "graphic/panel_styles.h"
3244
3245 class RenderTarget;
3246 class Image;
3247@@ -311,6 +312,8 @@
3248 static void play_new_chat_message();
3249
3250 static bool draw_tooltip(RenderTarget&, const std::string& text);
3251+ void draw_background(RenderTarget& dst, const UI::PanelStyleInfo&);
3252+ void draw_background(RenderTarget& dst, Recti rect, const UI::PanelStyleInfo&);
3253
3254 static const Image* default_cursor_;
3255 static const Image* default_cursor_click_;
3256
3257=== modified file 'src/ui_basic/scrollbar.cc'
3258--- src/ui_basic/scrollbar.cc 2018-04-07 16:59:00 +0000
3259+++ src/ui_basic/scrollbar.cc 2018-05-12 13:15:45 +0000
3260@@ -23,6 +23,7 @@
3261
3262 #include "graphic/graphic.h"
3263 #include "graphic/rendertarget.h"
3264+#include "graphic/style_manager.h"
3265 #include "ui_basic/mouse_constants.h"
3266
3267 namespace UI {
3268@@ -43,7 +44,7 @@
3269 int32_t const y,
3270 uint32_t const w,
3271 uint32_t const h,
3272- const Image* button_background,
3273+ UI::PanelStyle style,
3274 bool const horiz)
3275 : Panel(parent, x, y, w, h),
3276 horizontal_(horiz),
3277@@ -60,7 +61,7 @@
3278 "images/ui_basic/scrollbar_up.png")),
3279 pic_plus_(g_gr->images().get(horiz ? "images/ui_basic/scrollbar_right.png" :
3280 "images/ui_basic/scrollbar_down.png")),
3281- pic_buttons_(button_background) {
3282+ button_style_(g_gr->styles().scrollbar_style(style)) {
3283 set_thinks(true);
3284 layout();
3285 }
3286@@ -233,7 +234,7 @@
3287 }
3288
3289 void Scrollbar::draw_button(RenderTarget& dst, Area area, const Recti& r) {
3290- dst.tile(r.cast<int>(), pic_buttons_, Vector2i(get_x(), get_y()));
3291+ draw_background(dst, r.cast<int>(), *button_style_);
3292
3293 // Draw the picture
3294 const Image* pic = nullptr;
3295
3296=== modified file 'src/ui_basic/scrollbar.h'
3297--- src/ui_basic/scrollbar.h 2018-04-07 16:59:00 +0000
3298+++ src/ui_basic/scrollbar.h 2018-05-12 13:15:45 +0000
3299@@ -23,7 +23,6 @@
3300 #include <boost/signals2.hpp>
3301
3302 #include "base/rect.h"
3303-#include "graphic/graphic.h"
3304 #include "ui_basic/panel.h"
3305
3306 namespace UI {
3307@@ -43,7 +42,7 @@
3308 int32_t y,
3309 uint32_t w,
3310 uint32_t h,
3311- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3312+ UI::PanelStyle style,
3313 bool horiz = false);
3314
3315 boost::signals2::signal<void(int32_t)> moved;
3316@@ -92,7 +91,6 @@
3317 bool
3318 handle_mousemove(uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
3319
3320-private:
3321 bool horizontal_;
3322 bool force_draw_; // draw this scrollbar, even if it can't do anything
3323
3324@@ -106,9 +104,9 @@
3325 uint32_t time_nextact_;
3326 int32_t knob_grabdelta_; ///< only while pressed_ == Knob
3327
3328- const Image* pic_minus_; ///< left/up
3329- const Image* pic_plus_; ///< right/down
3330- const Image* pic_buttons_;
3331+ const Image* pic_minus_; ///< left/up
3332+ const Image* pic_plus_; ///< right/down
3333+ const UI::PanelStyleInfo* button_style_; // Background color and texture. Not owned.
3334 };
3335 }
3336
3337
3338=== modified file 'src/ui_basic/slider.cc'
3339--- src/ui_basic/slider.cc 2018-04-07 16:59:00 +0000
3340+++ src/ui_basic/slider.cc 2018-05-12 13:15:45 +0000
3341@@ -21,7 +21,9 @@
3342 #include <cmath>
3343
3344 #include "graphic/font_handler1.h"
3345+#include "graphic/graphic.h"
3346 #include "graphic/rendertarget.h"
3347+#include "graphic/style_manager.h"
3348 #include "graphic/text_layout.h"
3349 #include "ui_basic/mouse_constants.h"
3350
3351@@ -55,7 +57,7 @@
3352 const int32_t min_value,
3353 const int32_t max_value,
3354 const int32_t value,
3355- const Image* background_picture_id,
3356+ SliderStyle style,
3357 const std::string& tooltip_text,
3358 const uint32_t cursor_size,
3359 const bool enabled,
3360@@ -70,7 +72,7 @@
3361 highlighted_(false),
3362 pressed_(false),
3363 enabled_(enabled),
3364- pic_background_(background_picture_id),
3365+ cursor_style_(g_gr->styles().slider_style(style)),
3366 x_gap_(x_gap),
3367 y_gap_(y_gap),
3368 bar_size_(bar_size),
3369@@ -148,12 +150,13 @@
3370 RenderTarget& dst, int32_t const x, int32_t const y, int32_t const w, int32_t const h) {
3371
3372 RGBColor black(0, 0, 0);
3373-
3374- dst.tile // background
3375- (Recti(Vector2i(x, y), w, h), pic_background_, Vector2i(get_x(), get_y()));
3376-
3377- if (highlighted_)
3378- dst.brighten_rect(Recti(x, y, w, h), MOUSE_OVER_BRIGHT_FACTOR);
3379+ const Recti background_rect(x, y, w, h);
3380+
3381+ draw_background(dst, background_rect, *cursor_style_);
3382+
3383+ if (highlighted_) {
3384+ dst.brighten_rect(background_rect, MOUSE_OVER_BRIGHT_FACTOR);
3385+ }
3386
3387 if (pressed_) { // draw border
3388 dst.brighten_rect // bottom edge
3389@@ -487,7 +490,7 @@
3390 const uint32_t h,
3391 const std::vector<std::string>& labels_in,
3392 uint32_t value_,
3393- const Image* background_picture_id,
3394+ SliderStyle style,
3395 const std::string& tooltip_text,
3396 const uint32_t cursor_size,
3397 const bool enabled)
3398@@ -501,7 +504,7 @@
3399 0,
3400 labels_in.size() - 1,
3401 value_,
3402- background_picture_id,
3403+ style,
3404 tooltip_text,
3405 cursor_size,
3406 enabled),
3407
3408=== modified file 'src/ui_basic/slider.h'
3409--- src/ui_basic/slider.h 2018-04-07 16:59:00 +0000
3410+++ src/ui_basic/slider.h 2018-05-12 13:15:45 +0000
3411@@ -48,7 +48,7 @@
3412 int32_t min_value,
3413 int32_t max_value,
3414 int32_t value,
3415- const Image* background_picture_id,
3416+ UI::SliderStyle style,
3417 const std::string& tooltip_text,
3418 uint32_t cursor_size,
3419 bool enabled,
3420@@ -118,7 +118,7 @@
3421 bool pressed_; // the cursor is pressed
3422 bool enabled_; // enabled widget
3423
3424- const Image* pic_background_; // background texture (picture ID)
3425+ const UI::PanelStyleInfo* cursor_style_; // Cursor color and texture. Not owned.
3426
3427 protected:
3428 int32_t x_gap_; // draw positions
3429@@ -141,7 +141,7 @@
3430 const int32_t min_value,
3431 const int32_t max_value,
3432 const int32_t value,
3433- const Image* background_picture_id,
3434+ UI::SliderStyle style,
3435 const std::string& tooltip_text = std::string(),
3436 const uint32_t cursor_size = 20,
3437 const bool enabled = true)
3438@@ -153,7 +153,7 @@
3439 min_value,
3440 max_value,
3441 value,
3442- background_picture_id,
3443+ style,
3444 tooltip_text,
3445 cursor_size,
3446 enabled,
3447@@ -181,7 +181,7 @@
3448 const int32_t min_value,
3449 const int32_t max_value,
3450 const int32_t value,
3451- const Image* background_picture_id,
3452+ UI::SliderStyle style,
3453 const uint32_t cursor_size = 20,
3454 const std::string& tooltip_text = std::string(),
3455 const bool enabled = true)
3456@@ -193,7 +193,7 @@
3457 min_value,
3458 max_value,
3459 value,
3460- background_picture_id,
3461+ style,
3462 tooltip_text,
3463 cursor_size,
3464 enabled,
3465@@ -221,7 +221,7 @@
3466 const uint32_t h,
3467 const std::vector<std::string>& labels_in,
3468 uint32_t value_,
3469- const Image* background_picture_id,
3470+ UI::SliderStyle style,
3471 const std::string& tooltip_text = std::string(),
3472 const uint32_t cursor_size = 20,
3473 const bool enabled = true);
3474
3475=== modified file 'src/ui_basic/spinbox.cc'
3476--- src/ui_basic/spinbox.cc 2018-04-07 16:59:00 +0000
3477+++ src/ui_basic/spinbox.cc 2018-05-12 13:15:45 +0000
3478@@ -29,6 +29,7 @@
3479 #include "base/macros.h"
3480 #include "base/wexception.h"
3481 #include "graphic/font_handler1.h"
3482+#include "graphic/graphic.h"
3483 #include "graphic/text/font_set.h"
3484 #include "graphic/text_constants.h"
3485 #include "ui_basic/button.h"
3486@@ -52,7 +53,7 @@
3487 UI::SpinBox::Units unit;
3488
3489 /// Background tile style of buttons.
3490- const Image* background;
3491+ UI::ButtonStyle button_style;
3492
3493 /// Special names for specific values
3494 std::map<int32_t, std::string> value_replacements;
3495@@ -83,9 +84,9 @@
3496 int32_t const startval,
3497 int32_t const minval,
3498 int32_t const maxval,
3499+ UI::PanelStyle style,
3500 const std::string& label_text,
3501 const SpinBox::Units& unit,
3502- const Image* button_background,
3503 SpinBox::Type type,
3504 int32_t step_size,
3505 int32_t big_step_size)
3506@@ -105,13 +106,13 @@
3507 }
3508 sbi_->value = startval;
3509 sbi_->unit = unit;
3510- sbi_->background = button_background;
3511+ sbi_->button_style = style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuMenu :
3512+ UI::ButtonStyle::kWuiSecondary;
3513
3514 box_ = new UI::Box(this, 0, 0, UI::Box::Horizontal, 0, 0, padding_);
3515
3516- sbi_->label =
3517- new UI::MultilineTextarea(box_, 0, 0, 0, 0, label_text, UI::Align::kLeft, button_background,
3518- UI::MultilineTextarea::ScrollMode::kNoScrolling);
3519+ sbi_->label = new UI::MultilineTextarea(box_, 0, 0, 0, 0, style, label_text, UI::Align::kLeft,
3520+ UI::MultilineTextarea::ScrollMode::kNoScrolling);
3521 box_->add(sbi_->label);
3522
3523 sbi_->text = new UI::Textarea(box_, "", UI::Align::kCenter);
3524@@ -119,23 +120,23 @@
3525 bool is_big = type_ == SpinBox::Type::kBig;
3526
3527 sbi_->button_minus =
3528- new Button(box_, "-", 0, 0, button_height_, button_height_, sbi_->background,
3529+ new Button(box_, "-", 0, 0, button_height_, button_height_, sbi_->button_style,
3530 g_gr->images().get(is_big ? "images/ui_basic/scrollbar_left.png" :
3531 "images/ui_basic/scrollbar_down.png"),
3532 _("Decrease the value"));
3533 sbi_->button_plus =
3534- new Button(box_, "+", 0, 0, button_height_, button_height_, sbi_->background,
3535+ new Button(box_, "+", 0, 0, button_height_, button_height_, sbi_->button_style,
3536 g_gr->images().get(is_big ? "images/ui_basic/scrollbar_right.png" :
3537 "images/ui_basic/scrollbar_up.png"),
3538 _("Increase the value"));
3539
3540 if (is_big) {
3541 sbi_->button_ten_minus =
3542- new Button(box_, "--", 0, 0, 2 * button_height_, button_height_, sbi_->background,
3543+ new Button(box_, "--", 0, 0, 2 * button_height_, button_height_, sbi_->button_style,
3544 g_gr->images().get("images/ui_basic/scrollbar_left_fast.png"),
3545 _("Decrease the value by 10"));
3546 sbi_->button_ten_plus =
3547- new Button(box_, "++", 0, 0, 2 * button_height_, button_height_, sbi_->background,
3548+ new Button(box_, "++", 0, 0, 2 * button_height_, button_height_, sbi_->button_style,
3549 g_gr->images().get("images/ui_basic/scrollbar_right_fast.png"),
3550 _("Increase the value by 10"));
3551
3552
3553=== modified file 'src/ui_basic/spinbox.h'
3554--- src/ui_basic/spinbox.h 2018-04-07 16:59:00 +0000
3555+++ src/ui_basic/spinbox.h 2018-05-12 13:15:45 +0000
3556@@ -26,7 +26,6 @@
3557 #include <boost/signals2.hpp>
3558
3559 #include "graphic/align.h"
3560-#include "graphic/graphic.h"
3561 #include "ui_basic/box.h"
3562 #include "ui_basic/button.h"
3563
3564@@ -59,9 +58,9 @@
3565 int32_t startval,
3566 int32_t minval,
3567 int32_t maxval,
3568+ UI::PanelStyle style,
3569 const std::string& label_text = std::string(),
3570 const Units& unit = Units::kNone,
3571- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3572 SpinBox::Type = SpinBox::Type::kSmall,
3573 // The amount by which units are increased/decreased for small and big steps when a
3574 // button is pressed.
3575
3576=== modified file 'src/ui_basic/table.cc'
3577--- src/ui_basic/table.cc 2018-05-02 07:02:18 +0000
3578+++ src/ui_basic/table.cc 2018-05-12 13:15:45 +0000
3579@@ -22,14 +22,12 @@
3580 #include <boost/bind.hpp>
3581
3582 #include "graphic/font_handler1.h"
3583-#include "graphic/graphic.h"
3584 #include "graphic/rendertarget.h"
3585 #include "graphic/text/bidi.h"
3586 #include "graphic/text/font_set.h"
3587 #include "graphic/text_constants.h"
3588 #include "graphic/text_layout.h"
3589 #include "graphic/texture.h"
3590-#include "ui_basic/button.h"
3591 #include "ui_basic/mouse_constants.h"
3592 #include "ui_basic/scrollbar.h"
3593
3594@@ -47,16 +45,17 @@
3595 int32_t y,
3596 uint32_t w,
3597 uint32_t h,
3598- const Image* button_background,
3599+ PanelStyle style,
3600 TableRows rowtype)
3601 : Panel(parent, x, y, w, h),
3602 total_width_(0),
3603 headerheight_(text_height() + 4),
3604 lineheight_(text_height()),
3605- button_background_(button_background),
3606+ button_style_(style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuMenu :
3607+ UI::ButtonStyle::kWuiSecondary),
3608 scrollbar_(nullptr),
3609 scrollbar_filler_button_(
3610- new Button(this, "", 0, 0, Scrollbar::kSize, headerheight_, button_background, "")),
3611+ new Button(this, "", 0, 0, Scrollbar::kSize, headerheight_, button_style_, "")),
3612 scrollpos_(0),
3613 selection_(no_selection_index()),
3614 last_multiselect_(no_selection_index()),
3615@@ -71,7 +70,7 @@
3616 set_can_focus(true);
3617 scrollbar_filler_button_->set_visible(false);
3618 scrollbar_ = new Scrollbar(this, get_w() - Scrollbar::kSize, headerheight_, Scrollbar::kSize,
3619- get_h() - headerheight_, button_background);
3620+ get_h() - headerheight_, style);
3621 scrollbar_->moved.connect(boost::bind(&Table::set_scrollpos, this, _1));
3622 scrollbar_->set_steps(1);
3623 scrollbar_->set_singlestepsize(lineheight_);
3624@@ -113,8 +112,8 @@
3625 Column c;
3626 // All columns have a title button that is clickable for sorting.
3627 // The title text can be empty.
3628- c.btn = new Button(this, title, complete_width, 0, width, headerheight_, button_background_,
3629- title, tooltip_string);
3630+ c.btn = new Button(this, title, complete_width, 0, width, headerheight_, button_style_, title,
3631+ tooltip_string);
3632 c.btn->sigclicked.connect(
3633 boost::bind(&Table::header_button_clicked, boost::ref(*this), columns_.size()));
3634 c.width = width;
3635
3636=== modified file 'src/ui_basic/table.h'
3637--- src/ui_basic/table.h 2018-05-02 07:02:18 +0000
3638+++ src/ui_basic/table.h 2018-05-12 13:15:45 +0000
3639@@ -29,7 +29,7 @@
3640
3641 #include "graphic/align.h"
3642 #include "graphic/color.h"
3643-#include "graphic/graphic.h"
3644+#include "ui_basic/button.h"
3645 #include "ui_basic/panel.h"
3646
3647 namespace UI {
3648@@ -58,7 +58,7 @@
3649 int32_t y,
3650 uint32_t w,
3651 uint32_t h,
3652- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3653+ UI::PanelStyle style,
3654 TableRows rowtype = TableRows::kSingle);
3655 ~Table();
3656
3657@@ -168,7 +168,7 @@
3658 int32_t y,
3659 uint32_t w,
3660 uint32_t h,
3661- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3662+ UI::PanelStyle style,
3663 TableRows rowtype = TableRows::kSingle);
3664 ~Table() override;
3665
3666@@ -303,7 +303,7 @@
3667 int total_width_;
3668 const uint32_t headerheight_;
3669 int32_t lineheight_;
3670- const Image* button_background_;
3671+ UI::ButtonStyle button_style_;
3672 Scrollbar* scrollbar_;
3673 // A disabled button that will fill the space above the scroll bar
3674 UI::Button* scrollbar_filler_button_;
3675@@ -334,9 +334,9 @@
3676 int32_t y,
3677 uint32_t w,
3678 uint32_t h,
3679- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3680+ UI::PanelStyle style,
3681 TableRows rowtype = TableRows::kSingle)
3682- : Base(parent, x, y, w, h, button_background, rowtype) {
3683+ : Base(parent, x, y, w, h, style, rowtype) {
3684 }
3685
3686 void remove_entry(Entry const* const entry) {
3687@@ -368,9 +368,9 @@
3688 int32_t y,
3689 uint32_t w,
3690 uint32_t h,
3691- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3692+ UI::PanelStyle style,
3693 TableRows rowtype = TableRows::kSingle)
3694- : Base(parent, x, y, w, h, button_background, rowtype) {
3695+ : Base(parent, x, y, w, h, style, rowtype) {
3696 }
3697
3698 void remove_entry(Entry const* entry) {
3699@@ -402,9 +402,9 @@
3700 int32_t y,
3701 uint32_t w,
3702 uint32_t h,
3703- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3704+ UI::PanelStyle style,
3705 TableRows rowtype = TableRows::kSingle)
3706- : Base(parent, x, y, w, h, button_background, rowtype) {
3707+ : Base(parent, x, y, w, h, style, rowtype) {
3708 }
3709
3710 void remove_entry(const Entry& entry) {
3711@@ -440,9 +440,9 @@
3712 int32_t y,
3713 uint32_t w,
3714 uint32_t h,
3715- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3716+ UI::PanelStyle style,
3717 TableRows rowtype = TableRows::kSingle)
3718- : Base(parent, x, y, w, h, button_background, rowtype) {
3719+ : Base(parent, x, y, w, h, style, rowtype) {
3720 }
3721
3722 void remove_entry(Entry& entry) {
3723@@ -480,9 +480,9 @@
3724 int32_t y,
3725 uint32_t w,
3726 uint32_t h,
3727- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3728+ UI::PanelStyle style,
3729 TableRows rowtype = TableRows::kSingle)
3730- : Base(parent, x, y, w, h, button_background, rowtype) {
3731+ : Base(parent, x, y, w, h, style, rowtype) {
3732 }
3733
3734 void remove_entry(uintptr_t const entry) {
3735@@ -516,9 +516,9 @@
3736 int32_t y,
3737 uint32_t w,
3738 uint32_t h,
3739- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
3740+ UI::PanelStyle style,
3741 TableRows rowtype = TableRows::kSingle)
3742- : Base(parent, x, y, w, h, button_background, rowtype) {
3743+ : Base(parent, x, y, w, h, style, rowtype) {
3744 }
3745 };
3746 }
3747
3748=== modified file 'src/ui_basic/tabpanel.cc'
3749--- src/ui_basic/tabpanel.cc 2018-04-09 06:11:31 +0000
3750+++ src/ui_basic/tabpanel.cc 2018-05-12 13:15:45 +0000
3751@@ -20,7 +20,9 @@
3752 #include "ui_basic/tabpanel.h"
3753
3754 #include "graphic/font_handler1.h"
3755+#include "graphic/graphic.h"
3756 #include "graphic/rendertarget.h"
3757+#include "graphic/style_manager.h"
3758 #include "graphic/text_layout.h"
3759 #include "ui_basic/mouse_constants.h"
3760
3761@@ -90,12 +92,16 @@
3762 * Initialize an empty TabPanel. We use width == 0 as an indicator that the size hasn't been set
3763 * yet.
3764 */
3765-TabPanel::TabPanel(Panel* const parent, const Image* background, TabPanel::Type border_type)
3766- : Panel(parent, 0, 0, 0, 0),
3767- border_type_(border_type),
3768+TabPanel::TabPanel(Panel* const parent, UI::TabPanelStyle style)
3769+ : Panel(parent,
3770+ 0,
3771+ 0,
3772+ 0,
3773+ 0),
3774+ style_(style),
3775 active_(0),
3776 highlight_(kNotFound),
3777- pic_background_(background) {
3778+ background_style_(g_gr->styles().tabpanel_style(style)) {
3779 }
3780
3781 /**
3782@@ -113,7 +119,7 @@
3783 // avoid excessive craziness in case there is a wraparound
3784 h = std::min(h, h - (kTabPanelButtonHeight + kTabPanelSeparatorHeight));
3785 // If we have a border, we will also want some margin to the bottom
3786- if (border_type_ == TabPanel::Type::kBorder) {
3787+ if (style_ == UI::TabPanelStyle::kFsMenu) {
3788 h -= kTabPanelSeparatorHeight;
3789 }
3790 panel->set_size(get_w(), h);
3791@@ -182,7 +188,7 @@
3792 tabs_.push_back(new Tab(this, id, x, name, title, pic, tooltip_text, panel));
3793
3794 // Add a margin if there is a border
3795- if (border_type_ == TabPanel::Type::kBorder) {
3796+ if (style_ == UI::TabPanelStyle::kFsMenu) {
3797 panel->set_border(kTabPanelSeparatorHeight + 1, kTabPanelSeparatorHeight + 1,
3798 kTabPanelSeparatorHeight, kTabPanelSeparatorHeight);
3799 panel->set_pos(Vector2i(0, kTabPanelButtonHeight));
3800@@ -248,22 +254,19 @@
3801 return;
3802 }
3803
3804- // draw the background
3805+ // Draw the background
3806 static_assert(2 < kTabPanelButtonHeight, "assert(2 < kTabPanelButtonSize) failed.");
3807 static_assert(4 < kTabPanelButtonHeight, "assert(4 < kTabPanelButtonSize) failed.");
3808-
3809- if (pic_background_) {
3810- if (!tabs_.empty()) {
3811- dst.tile(Recti(Vector2i::zero(), tabs_.back()->get_x() + tabs_.back()->get_w(),
3812- kTabPanelButtonHeight - 2),
3813- pic_background_, Vector2i(get_x(), get_y()));
3814- }
3815- assert(kTabPanelButtonHeight - 2 <= get_h());
3816- dst.tile(Recti(Vector2i(0, kTabPanelButtonHeight - 2), get_w(),
3817- get_h() - kTabPanelButtonHeight + 2),
3818- pic_background_, Vector2i(get_x(), get_y() + kTabPanelButtonHeight - 2));
3819- }
3820-
3821+ assert(kTabPanelButtonHeight - 2 <= get_h());
3822+
3823+ draw_background(
3824+ dst, Recti(0, 0, tabs_.back()->get_x() + tabs_.back()->get_w(), kTabPanelButtonHeight - 2),
3825+ *background_style_);
3826+ draw_background(
3827+ dst, Recti(0, kTabPanelButtonHeight - 2, get_w(), get_h() - kTabPanelButtonHeight + 2),
3828+ *background_style_);
3829+
3830+ // Draw the buttons
3831 RGBColor black(0, 0, 0);
3832
3833 // draw the buttons
3834@@ -324,7 +327,7 @@
3835 2 * BUTTON_EDGE_BRIGHT_FACTOR);
3836
3837 // Draw border around the main panel
3838- if (border_type_ == TabPanel::Type::kBorder) {
3839+ if (style_ == UI::TabPanelStyle::kFsMenu) {
3840 // left edge
3841 dst.brighten_rect(Recti(0, kTabPanelButtonHeight, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR);
3842 // bottom edge
3843
3844=== modified file 'src/ui_basic/tabpanel.h'
3845--- src/ui_basic/tabpanel.h 2018-04-07 16:59:00 +0000
3846+++ src/ui_basic/tabpanel.h 2018-05-12 13:15:45 +0000
3847@@ -86,13 +86,10 @@
3848 *
3849 */
3850 struct TabPanel : public Panel {
3851- enum class Type { kNoBorder, kBorder };
3852
3853 friend struct Tab;
3854
3855- TabPanel(Panel* parent,
3856- const Image* background,
3857- TabPanel::Type border_type = TabPanel::Type::kNoBorder);
3858+ TabPanel(Panel* parent, UI::TabPanelStyle style);
3859
3860 /** Add textual tab
3861 *
3862@@ -129,7 +126,7 @@
3863 void layout() override;
3864 void update_desired_size() override;
3865
3866- TabPanel::Type border_type_; ///< whether there will be a border around the panels.
3867+ UI::TabPanelStyle style_;
3868
3869 private:
3870 // Common adding function for textual and pictorial tabs
3871@@ -153,7 +150,7 @@
3872 size_t active_; ///< index of the currently active tab
3873 size_t highlight_; ///< index of the highlighted button
3874
3875- const Image* pic_background_; ///< picture used to draw background
3876+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
3877 };
3878 }
3879
3880
3881=== modified file 'src/ui_basic/window.cc'
3882--- src/ui_basic/window.cc 2018-04-07 16:59:00 +0000
3883+++ src/ui_basic/window.cc 2018-05-12 13:15:45 +0000
3884@@ -25,6 +25,7 @@
3885 #include "graphic/font_handler1.h"
3886 #include "graphic/graphic.h"
3887 #include "graphic/rendertarget.h"
3888+#include "graphic/style_manager.h"
3889 #include "graphic/text_layout.h"
3890
3891 namespace UI {
3892@@ -87,11 +88,11 @@
3893 drag_start_win_y_(0),
3894 drag_start_mouse_x_(0),
3895 drag_start_mouse_y_(0),
3896- pic_lborder_(g_gr->images().get("images/wui/window_left.png")),
3897- pic_rborder_(g_gr->images().get("images/wui/window_right.png")),
3898- pic_top_(g_gr->images().get("images/wui/window_top.png")),
3899- pic_bottom_(g_gr->images().get("images/wui/window_bottom.png")),
3900- pic_background_(g_gr->images().get("images/wui/window_background.png")),
3901+ pic_lborder_(g_gr->images().get(kTemplateDir + "wui/left.png")),
3902+ pic_rborder_(g_gr->images().get(kTemplateDir + "wui/right.png")),
3903+ pic_top_(g_gr->images().get(kTemplateDir + "wui/top.png")),
3904+ pic_bottom_(g_gr->images().get(kTemplateDir + "wui/bottom.png")),
3905+ pic_background_(g_gr->images().get(kTemplateDir + "wui/background.png")),
3906 center_panel_(nullptr),
3907 fastclick_panel_(nullptr) {
3908 set_title(title);
3909
3910=== modified file 'src/ui_fsmenu/CMakeLists.txt'
3911--- src/ui_fsmenu/CMakeLists.txt 2017-12-02 12:43:38 +0000
3912+++ src/ui_fsmenu/CMakeLists.txt 2018-05-12 13:15:45 +0000
3913@@ -52,7 +52,6 @@
3914 DEPENDS
3915 base_i18n
3916 build_info
3917- graphic
3918 ui_basic
3919 ui_fsmenu_main_menu
3920 )
3921@@ -76,7 +75,6 @@
3922 singleplayer.h
3923 DEPENDS
3924 base_i18n
3925- graphic
3926 graphic_text_constants
3927 io_filesystem
3928 profile
3929@@ -180,7 +178,6 @@
3930 intro.h
3931 DEPENDS
3932 base_i18n
3933- graphic
3934 ui_basic
3935 ui_fsmenu_base
3936 )
3937
3938=== modified file 'src/ui_fsmenu/about.cc'
3939--- src/ui_fsmenu/about.cc 2018-04-07 16:59:00 +0000
3940+++ src/ui_fsmenu/about.cc 2018-05-12 13:15:45 +0000
3941@@ -22,13 +22,12 @@
3942 #include <boost/format.hpp>
3943
3944 #include "base/i18n.h"
3945-#include "graphic/graphic.h"
3946
3947 FullscreenMenuAbout::FullscreenMenuAbout()
3948 : FullscreenMenuBase(),
3949 title_(this, 0, 0, _("About Widelands"), UI::Align::kCenter),
3950- close_(this, "close", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("Close")),
3951- tabs_(this, g_gr->images().get("images/ui_basic/but1.png"), UI::TabPanel::Type::kBorder) {
3952+ close_(this, "close", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("Close")),
3953+ tabs_(this, UI::PanelStyle::kFsMenu, UI::TabPanelStyle::kFsMenu) {
3954 title_.set_fontsize(UI_FONT_SIZE_BIG);
3955 tabs_.add_tab("txts/README.lua");
3956 tabs_.add_tab("txts/LICENSE.lua");
3957
3958=== modified file 'src/ui_fsmenu/campaign_select.cc'
3959--- src/ui_fsmenu/campaign_select.cc 2018-04-07 16:59:00 +0000
3960+++ src/ui_fsmenu/campaign_select.cc 2018-05-12 13:15:45 +0000
3961@@ -42,7 +42,7 @@
3962 */
3963 FullscreenMenuCampaignSelect::FullscreenMenuCampaignSelect()
3964 : FullscreenMenuLoadMapOrGame(),
3965- table_(this, tablex_, tabley_, tablew_, tableh_),
3966+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
3967
3968 // Main Title
3969 title_(this, get_w() / 2, tabley_ / 3, _("Choose a campaign"), UI::Align::kCenter),
3970@@ -53,21 +53,24 @@
3971 right_column_x_ + indent_,
3972 get_y_from_preceding(label_campname_) + padding_,
3973 get_right_column_w(right_column_x_) - indent_,
3974- label_height_),
3975+ label_height_,
3976+ UI::PanelStyle::kFsMenu),
3977
3978 label_tribename_(this, right_column_x_, get_y_from_preceding(ta_campname_) + 2 * padding_),
3979 ta_tribename_(this,
3980 right_column_x_ + indent_,
3981 get_y_from_preceding(label_tribename_) + padding_,
3982 get_right_column_w(right_column_x_ + indent_),
3983- label_height_),
3984+ label_height_,
3985+ UI::PanelStyle::kFsMenu),
3986
3987 label_difficulty_(this, right_column_x_, get_y_from_preceding(ta_tribename_) + 2 * padding_),
3988 ta_difficulty_(this,
3989 right_column_x_ + indent_,
3990 get_y_from_preceding(label_difficulty_) + padding_,
3991 get_right_column_w(right_column_x_ + indent_),
3992- 2 * label_height_ - padding_),
3993+ 2 * label_height_ - padding_,
3994+ UI::PanelStyle::kFsMenu),
3995
3996 label_description_(this,
3997 right_column_x_,
3998@@ -77,7 +80,8 @@
3999 right_column_x_ + indent_,
4000 get_y_from_preceding(label_description_) + padding_,
4001 get_right_column_w(right_column_x_ + indent_),
4002- buty_ - get_y_from_preceding(label_description_) - 4 * padding_) {
4003+ buty_ - get_y_from_preceding(label_description_) - 4 * padding_,
4004+ UI::PanelStyle::kFsMenu) {
4005 title_.set_fontsize(UI_FONT_SIZE_BIG);
4006 back_.set_tooltip(_("Return to the main menu"));
4007 ok_.set_tooltip(_("Play this campaign"));
4008@@ -265,7 +269,7 @@
4009 */
4010 FullscreenMenuCampaignMapSelect::FullscreenMenuCampaignMapSelect(bool is_tutorial)
4011 : FullscreenMenuLoadMapOrGame(),
4012- table_(this, tablex_, tabley_, tablew_, tableh_),
4013+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
4014
4015 // Main title
4016 title_(this,
4017@@ -278,6 +282,7 @@
4018 get_y_from_preceding(title_) + 6 * padding_,
4019 get_w() * 2 / 3,
4020 4 * label_height_,
4021+ UI::PanelStyle::kFsMenu,
4022 "",
4023 UI::Align::kCenter),
4024
4025@@ -287,21 +292,24 @@
4026 right_column_x_ + indent_,
4027 get_y_from_preceding(label_mapname_) + padding_,
4028 get_right_column_w(right_column_x_ + indent_),
4029- label_height_),
4030+ label_height_,
4031+ UI::PanelStyle::kFsMenu),
4032
4033 label_author_(this, right_column_x_, get_y_from_preceding(ta_mapname_) + 2 * padding_),
4034 ta_author_(this,
4035 right_column_x_ + indent_,
4036 get_y_from_preceding(label_author_) + padding_,
4037 get_right_column_w(right_column_x_ + indent_),
4038- 2 * label_height_),
4039+ 2 * label_height_,
4040+ UI::PanelStyle::kFsMenu),
4041
4042 label_description_(this, right_column_x_, get_y_from_preceding(ta_author_) + padding_),
4043 ta_description_(this,
4044 right_column_x_ + indent_,
4045 get_y_from_preceding(label_description_) + padding_,
4046 get_right_column_w(right_column_x_ + indent_),
4047- buty_ - get_y_from_preceding(label_description_) - 4 * padding_),
4048+ buty_ - get_y_from_preceding(label_description_) - 4 * padding_,
4049+ UI::PanelStyle::kFsMenu),
4050
4051 is_tutorial_(is_tutorial) {
4052 title_.set_fontsize(UI_FONT_SIZE_BIG);
4053
4054=== modified file 'src/ui_fsmenu/helpwindow.cc'
4055--- src/ui_fsmenu/helpwindow.cc 2018-04-07 16:59:00 +0000
4056+++ src/ui_fsmenu/helpwindow.cc 2018-05-12 13:15:45 +0000
4057@@ -40,15 +40,15 @@
4058 uint32_t height)
4059 : Window(
4060 parent, "help_window", 0, 0, width, height, (boost::format(_("Help: %s")) % caption).str()),
4061- textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 30)) {
4062+ textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 30, UI::PanelStyle::kWui)) {
4063 int margin = 5;
4064
4065 // Calculate sizes
4066 width = (width == 0) ? g_gr->get_xres() * 3 / 5 : width;
4067 height = (height == 0) ? g_gr->get_yres() * 4 / 5 : height;
4068
4069- Button* btn = new Button(this, "ok", width / 3, 0, width / 3, 0,
4070- g_gr->images().get("images/ui_basic/but5.png"), _("OK"));
4071+ Button* btn =
4072+ new Button(this, "ok", width / 3, 0, width / 3, 0, UI::ButtonStyle::kWuiPrimary, _("OK"));
4073
4074 btn->sigclicked.connect(boost::bind(&FullscreenHelpWindow::clicked_ok, boost::ref(*this)));
4075 btn->set_pos(Vector2i(btn->get_x(), height - margin - btn->get_h()));
4076
4077=== modified file 'src/ui_fsmenu/internet_lobby.cc'
4078--- src/ui_fsmenu/internet_lobby.cc 2018-05-02 19:26:52 +0000
4079+++ src/ui_fsmenu/internet_lobby.cc 2018-05-12 13:15:45 +0000
4080@@ -71,7 +71,7 @@
4081 get_h() * 55 / 100,
4082 butw_,
4083 buth_,
4084- g_gr->images().get("images/ui_basic/but1.png"),
4085+ UI::ButtonStyle::kFsMenuSecondary,
4086 _("Join this game")),
4087 hostgame_(this,
4088 "host_game",
4089@@ -79,7 +79,7 @@
4090 get_h() * 81 / 100,
4091 butw_,
4092 buth_,
4093- g_gr->images().get("images/ui_basic/but1.png"),
4094+ UI::ButtonStyle::kFsMenuSecondary,
4095 _("Open a new game")),
4096 back_(this,
4097 "back",
4098@@ -87,22 +87,18 @@
4099 get_h() * 90 / 100,
4100 butw_,
4101 buth_,
4102- g_gr->images().get("images/ui_basic/but0.png"),
4103+ UI::ButtonStyle::kFsMenuSecondary,
4104 _("Back")),
4105
4106 // Edit boxes
4107- edit_servername_(this,
4108- get_w() * 17 / 25,
4109- get_h() * 68 / 100,
4110- butw_,
4111- buth_,
4112- 2,
4113- g_gr->images().get("images/ui_basic/but2.png"),
4114- fs_),
4115+ edit_servername_(
4116+ this, get_w() * 17 / 25, get_h() * 68 / 100, butw_, buth_, 2, UI::PanelStyle::kFsMenu, fs_),
4117
4118 // List
4119- clientsonline_list_(this, get_w() * 4 / 125, get_h() / 5, lisw_, get_h() * 3 / 10),
4120- opengames_list_(this, get_w() * 17 / 25, get_h() / 5, butw_, get_h() * 7 / 20),
4121+ clientsonline_list_(
4122+ this, get_w() * 4 / 125, get_h() / 5, lisw_, get_h() * 3 / 10, UI::PanelStyle::kFsMenu),
4123+ opengames_list_(
4124+ this, get_w() * 17 / 25, get_h() / 5, butw_, get_h() * 7 / 20, UI::PanelStyle::kFsMenu),
4125
4126 // The chat UI
4127 chat(this,
4128@@ -110,7 +106,8 @@
4129 get_h() * 51 / 100,
4130 lisw_,
4131 get_h() * 44 / 100,
4132- InternetGaming::ref()),
4133+ InternetGaming::ref(),
4134+ UI::PanelStyle::kFsMenu),
4135
4136 // Login information
4137 nickname_(nick),
4138
4139=== modified file 'src/ui_fsmenu/launch_game.cc'
4140--- src/ui_fsmenu/launch_game.cc 2018-04-07 16:59:00 +0000
4141+++ src/ui_fsmenu/launch_game.cc 2018-05-12 13:15:45 +0000
4142@@ -26,7 +26,6 @@
4143 #include "base/i18n.h"
4144 #include "base/warning.h"
4145 #include "base/wexception.h"
4146-#include "graphic/graphic.h"
4147 #include "graphic/text_constants.h"
4148 #include "logic/game.h"
4149 #include "logic/game_controller.h"
4150@@ -53,23 +52,11 @@
4151 butw_,
4152 get_h() - get_h() * 4 / 10 - buth_,
4153 buth_,
4154- ""),
4155- ok_(this,
4156- "ok",
4157- 0,
4158- 0,
4159- butw_,
4160- buth_,
4161- g_gr->images().get("images/ui_basic/but2.png"),
4162- _("Start game")),
4163- back_(this,
4164- "back",
4165- 0,
4166- 0,
4167- butw_,
4168- buth_,
4169- g_gr->images().get("images/ui_basic/but0.png"),
4170- _("Back")),
4171+ "",
4172+ UI::DropdownType::kTextual,
4173+ UI::PanelStyle::kFsMenu),
4174+ ok_(this, "ok", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuPrimary, _("Start game")),
4175+ back_(this, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuSecondary, _("Back")),
4176 // Text labels
4177 title_(this, get_w() / 2, get_h() / 25, "", UI::Align::kCenter),
4178 // Variables and objects used in the menu
4179
4180=== modified file 'src/ui_fsmenu/launch_game.h'
4181--- src/ui_fsmenu/launch_game.h 2018-04-07 16:59:00 +0000
4182+++ src/ui_fsmenu/launch_game.h 2018-05-12 13:15:45 +0000
4183@@ -27,7 +27,6 @@
4184 #include "logic/map.h"
4185 #include "ui_basic/button.h"
4186 #include "ui_basic/dropdown.h"
4187-#include "ui_basic/multilinetextarea.h"
4188 #include "ui_basic/textarea.h"
4189 #include "ui_fsmenu/base.h"
4190
4191
4192=== modified file 'src/ui_fsmenu/launch_mpg.cc'
4193--- src/ui_fsmenu/launch_mpg.cc 2018-04-07 16:59:00 +0000
4194+++ src/ui_fsmenu/launch_mpg.cc 2018-05-12 13:15:45 +0000
4195@@ -59,24 +59,24 @@
4196 uint32_t space = y;
4197 uint32_t butw = get_inner_w() - 2 * space;
4198 uint32_t buth = (get_inner_h() - 2 * space) / 5;
4199- UI::Button* btn = new UI::Button(this, "map", space, y, butw, buth,
4200- g_gr->images().get("images/ui_basic/but0.png"), _("Map"),
4201- _("Select a map"));
4202+ UI::Button* btn =
4203+ new UI::Button(this, "map", space, y, butw, buth, UI::ButtonStyle::kFsMenuSecondary,
4204+ _("Map"), _("Select a map"));
4205 btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
4206 boost::ref(*this),
4207 FullscreenMenuBase::MenuTarget::kNormalGame));
4208
4209 btn = new UI::Button(this, "saved_game", space, y + buth + space, butw, buth,
4210- g_gr->images().get("images/ui_basic/but0.png"),
4211+ UI::ButtonStyle::kFsMenuSecondary,
4212 /** Translators: This is a button to select a savegame */
4213 _("Saved Game"), _("Select a saved game"));
4214 btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
4215 boost::ref(*this),
4216 FullscreenMenuBase::MenuTarget::kScenarioGame));
4217
4218- btn = new UI::Button(this, "cancel", space + butw / 4, y + 3 * buth + 2 * space, butw / 2,
4219- buth, g_gr->images().get("images/ui_basic/but1.png"), _("Cancel"),
4220- _("Cancel selection"));
4221+ btn =
4222+ new UI::Button(this, "cancel", space + butw / 4, y + 3 * buth + 2 * space, butw / 2, buth,
4223+ UI::ButtonStyle::kFsMenuSecondary, _("Cancel"), _("Cancel selection"));
4224 btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
4225 boost::ref(*this),
4226 FullscreenMenuBase::MenuTarget::kBack));
4227@@ -114,7 +114,7 @@
4228 get_h() * 3 / 20,
4229 buth_,
4230 buth_,
4231- g_gr->images().get("images/ui_basic/but1.png"),
4232+ UI::ButtonStyle::kFsMenuSecondary,
4233 g_gr->images().get("images/wui/menus/menu_toggle_minimap.png"),
4234 _("Change map or saved game")),
4235 help_button_(this,
4236@@ -123,7 +123,7 @@
4237 get_h() / 100,
4238 buth_,
4239 buth_,
4240- g_gr->images().get("images/ui_basic/but1.png"),
4241+ UI::ButtonStyle::kFsMenuSecondary,
4242 g_gr->images().get("images/ui_basic/menu_help.png"),
4243 _("Show the help window")),
4244
4245@@ -151,10 +151,18 @@
4246 _("Type of game"),
4247 UI::Align::kCenter),
4248
4249- map_info_(
4250- this, right_column_x_, get_h() * 2 / 10, butw_, get_h() * 23 / 80 - 2 * label_height_),
4251- client_info_(
4252- this, right_column_x_, get_h() * 13 / 20 - 2 * label_height_, butw_, 2 * label_height_),
4253+ map_info_(this,
4254+ right_column_x_,
4255+ get_h() * 2 / 10,
4256+ butw_,
4257+ get_h() * 23 / 80 - 2 * label_height_,
4258+ UI::PanelStyle::kFsMenu),
4259+ client_info_(this,
4260+ right_column_x_,
4261+ get_h() * 13 / 20 - 2 * label_height_,
4262+ butw_,
4263+ 2 * label_height_,
4264+ UI::PanelStyle::kFsMenu),
4265 help_(nullptr),
4266
4267 // Variables and objects used in the menu
4268@@ -215,8 +223,8 @@
4269 */
4270 void FullscreenMenuLaunchMPG::set_chat_provider(ChatProvider& chat) {
4271 delete chat_;
4272- chat_ = new GameChatPanel(
4273- this, get_w() / 50, get_h() * 13 / 20, get_w() * 57 / 80, get_h() * 3 / 10, chat);
4274+ chat_ = new GameChatPanel(this, get_w() / 50, get_h() * 13 / 20, get_w() * 57 / 80,
4275+ get_h() * 3 / 10, chat, UI::PanelStyle::kFsMenu);
4276 }
4277
4278 /**
4279
4280=== modified file 'src/ui_fsmenu/launch_mpg.h'
4281--- src/ui_fsmenu/launch_mpg.h 2018-04-07 16:59:00 +0000
4282+++ src/ui_fsmenu/launch_mpg.h 2018-05-12 13:15:45 +0000
4283@@ -25,7 +25,6 @@
4284
4285 #include "logic/game_settings.h"
4286 #include "ui_basic/button.h"
4287-#include "ui_basic/dropdown.h"
4288 #include "ui_basic/multilinetextarea.h"
4289 #include "ui_basic/textarea.h"
4290 #include "ui_fsmenu/helpwindow.h"
4291
4292=== modified file 'src/ui_fsmenu/launch_spg.cc'
4293--- src/ui_fsmenu/launch_spg.cc 2018-04-07 16:59:00 +0000
4294+++ src/ui_fsmenu/launch_spg.cc 2018-05-12 13:15:45 +0000
4295@@ -26,7 +26,6 @@
4296 #include "base/i18n.h"
4297 #include "base/warning.h"
4298 #include "base/wexception.h"
4299-#include "graphic/graphic.h"
4300 #include "graphic/text_constants.h"
4301 #include "helper.h"
4302 #include "io/filesystem/layered_filesystem.h"
4303@@ -52,7 +51,7 @@
4304 get_h() * 3 / 10,
4305 butw_,
4306 buth_,
4307- g_gr->images().get("images/ui_basic/but1.png"),
4308+ UI::ButtonStyle::kFsMenuSecondary,
4309 _("Select map")),
4310
4311 // Text labels
4312@@ -106,8 +105,8 @@
4313
4314 pos_[i] =
4315 new UI::Button(this, "switch_to_position", get_w() / 100, y += buth_, get_h() * 17 / 500,
4316- get_h() * 17 / 500, g_gr->images().get("images/ui_basic/but1.png"),
4317- player_image, _("Switch to position"));
4318+ get_h() * 17 / 500, UI::ButtonStyle::kFsMenuSecondary, player_image,
4319+ _("Switch to position"));
4320 pos_[i]->sigclicked.connect(
4321 boost::bind(&FullscreenMenuLaunchSPG::switch_to_position, boost::ref(*this), i));
4322 players_[i] = new PlayerDescriptionGroup(
4323
4324=== modified file 'src/ui_fsmenu/launch_spg.h'
4325--- src/ui_fsmenu/launch_spg.h 2018-04-07 16:59:00 +0000
4326+++ src/ui_fsmenu/launch_spg.h 2018-05-12 13:15:45 +0000
4327@@ -26,8 +26,6 @@
4328 #include "graphic/playercolor.h"
4329 #include "logic/map.h"
4330 #include "ui_basic/button.h"
4331-#include "ui_basic/dropdown.h"
4332-#include "ui_basic/multilinetextarea.h"
4333 #include "ui_basic/textarea.h"
4334 #include "ui_fsmenu/launch_game.h"
4335
4336
4337=== modified file 'src/ui_fsmenu/load_map_or_game.cc'
4338--- src/ui_fsmenu/load_map_or_game.cc 2018-04-07 16:59:00 +0000
4339+++ src/ui_fsmenu/load_map_or_game.cc 2018-05-12 13:15:45 +0000
4340@@ -22,10 +22,8 @@
4341 #include <memory>
4342
4343 #include "base/i18n.h"
4344-#include "graphic/graphic.h"
4345 #include "io/filesystem/filesystem.h"
4346 #include "ui_basic/button.h"
4347-#include "ui_basic/multilinetextarea.h"
4348 #include "ui_basic/textarea.h"
4349
4350 /// Select a Map, Saved Game or Replay in Fullscreen Mode.
4351@@ -34,8 +32,8 @@
4352 FullscreenMenuLoadMapOrGame::FullscreenMenuLoadMapOrGame()
4353 : FullscreenMenuBase(),
4354 // Main buttons
4355- back_(this, "back", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but0.png"), _("Back")),
4356- ok_(this, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")) {
4357+ back_(this, "back", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Back")),
4358+ ok_(this, "ok", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("OK")) {
4359 layout();
4360 }
4361
4362
4363=== modified file 'src/ui_fsmenu/load_map_or_game.h'
4364--- src/ui_fsmenu/load_map_or_game.h 2018-04-07 16:59:00 +0000
4365+++ src/ui_fsmenu/load_map_or_game.h 2018-05-12 13:15:45 +0000
4366@@ -27,10 +27,8 @@
4367 #include <boost/algorithm/string.hpp>
4368
4369 #include "base/i18n.h"
4370-#include "graphic/graphic.h"
4371 #include "io/filesystem/filesystem.h"
4372 #include "ui_basic/button.h"
4373-#include "ui_basic/multilinetextarea.h"
4374 #include "ui_basic/table.h"
4375 #include "ui_basic/textarea.h"
4376 #include "wui/maptable.h"
4377
4378=== modified file 'src/ui_fsmenu/loadgame.cc'
4379--- src/ui_fsmenu/loadgame.cc 2018-04-07 16:59:00 +0000
4380+++ src/ui_fsmenu/loadgame.cc 2018-05-12 13:15:45 +0000
4381@@ -27,7 +27,7 @@
4382 FullscreenMenuLoadGame::FullscreenMenuLoadGame(Widelands::Game& g,
4383 GameSettingsProvider* gsp,
4384 bool is_replay)
4385- : FullscreenMenuLoadMapOrGame(),
4386+ : FullscreenMenuLoadMapOrGame(),
4387
4388 main_box_(this, 0, 0, UI::Box::Vertical),
4389 info_box_(&main_box_, 0, 0, UI::Box::Horizontal),
4390@@ -45,7 +45,7 @@
4391 LoadOrSaveGame::FileType::kReplay :
4392 (gsp->settings().multiplayer ? LoadOrSaveGame::FileType::kGameMultiPlayer :
4393 LoadOrSaveGame::FileType::kGameSinglePlayer),
4394- GameDetails::Style::kFsMenu,
4395+ UI::PanelStyle::kFsMenu,
4396 true),
4397
4398 is_replay_(is_replay) {
4399
4400=== modified file 'src/ui_fsmenu/main.cc'
4401--- src/ui_fsmenu/main.cc 2018-04-07 16:59:00 +0000
4402+++ src/ui_fsmenu/main.cc 2018-05-12 13:15:45 +0000
4403@@ -23,7 +23,6 @@
4404
4405 #include "base/i18n.h"
4406 #include "build_info.h"
4407-#include "graphic/graphic.h"
4408
4409 FullscreenMenuMain::FullscreenMenuMain()
4410 : FullscreenMenuMainMenu(),
4411@@ -35,7 +34,7 @@
4412 0,
4413 butw_,
4414 buth_,
4415- g_gr->images().get(button_background_),
4416+ UI::ButtonStyle::kFsMenuMenu,
4417 _("Play Tutorial")),
4418 singleplayer(&vbox_,
4419 "single_player",
4420@@ -43,50 +42,15 @@
4421 0,
4422 butw_,
4423 buth_,
4424- g_gr->images().get(button_background_),
4425+ UI::ButtonStyle::kFsMenuMenu,
4426 _("Single Player")),
4427- multiplayer(&vbox_,
4428- "multi_player",
4429- 0,
4430- 0,
4431- butw_,
4432- buth_,
4433- g_gr->images().get(button_background_),
4434- _("Multiplayer")),
4435- replay(&vbox_,
4436- "replay",
4437- 0,
4438- 0,
4439- butw_,
4440- buth_,
4441- g_gr->images().get(button_background_),
4442- _("Watch Replay")),
4443- editor(
4444- &vbox_, "editor", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Editor")),
4445- options(&vbox_,
4446- "options",
4447- 0,
4448- 0,
4449- butw_,
4450- buth_,
4451- g_gr->images().get(button_background_),
4452- _("Options")),
4453- about(&vbox_,
4454- "about",
4455- 0,
4456- 0,
4457- butw_,
4458- buth_,
4459- g_gr->images().get(button_background_),
4460- _("About Widelands")),
4461- exit(&vbox_,
4462- "exit",
4463- 0,
4464- 0,
4465- butw_,
4466- buth_,
4467- g_gr->images().get(button_background_),
4468- _("Exit Widelands")),
4469+ multiplayer(
4470+ &vbox_, "multi_player", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Multiplayer")),
4471+ replay(&vbox_, "replay", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Watch Replay")),
4472+ editor(&vbox_, "editor", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Editor")),
4473+ options(&vbox_, "options", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Options")),
4474+ about(&vbox_, "about", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("About Widelands")),
4475+ exit(&vbox_, "exit", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Exit Widelands")),
4476
4477 // Textlabels
4478 version(
4479
4480=== modified file 'src/ui_fsmenu/main_menu.cc'
4481--- src/ui_fsmenu/main_menu.cc 2018-04-07 16:59:00 +0000
4482+++ src/ui_fsmenu/main_menu.cc 2018-05-12 13:15:45 +0000
4483@@ -29,7 +29,6 @@
4484 buth_(get_h() * 9 / 200),
4485 title_y_(get_h() * 3 / 40),
4486 padding_(buth_ / 3),
4487- button_background_("images/ui_basic//but3.png"),
4488 vbox_(this, 0, 0, UI::Box::Vertical, 0, 0, padding_) {
4489 }
4490
4491
4492=== modified file 'src/ui_fsmenu/main_menu.h'
4493--- src/ui_fsmenu/main_menu.h 2018-04-07 16:59:00 +0000
4494+++ src/ui_fsmenu/main_menu.h 2018-05-12 13:15:45 +0000
4495@@ -40,7 +40,6 @@
4496 uint32_t title_y_;
4497 uint32_t padding_;
4498
4499- const std::string button_background_;
4500 UI::Box vbox_;
4501 };
4502
4503
4504=== modified file 'src/ui_fsmenu/mapselect.cc'
4505--- src/ui_fsmenu/mapselect.cc 2018-04-07 16:59:00 +0000
4506+++ src/ui_fsmenu/mapselect.cc 2018-05-12 13:15:45 +0000
4507@@ -27,7 +27,6 @@
4508 #include "base/log.h"
4509 #include "base/wexception.h"
4510 #include "graphic/font_handler1.h"
4511-#include "graphic/graphic.h"
4512 #include "io/filesystem/layered_filesystem.h"
4513 #include "logic/filesystem_constants.h"
4514 #include "logic/game_controller.h"
4515@@ -50,13 +49,13 @@
4516 // Main title
4517 title_(this, 0, 0, _("Choose a map"), UI::Align::kCenter),
4518 checkboxes_(this, 0, 0, UI::Box::Vertical, 0, 0, 2 * padding_),
4519- table_(this, tablex_, tabley_, tablew_, tableh_),
4520+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
4521 map_details_(this,
4522 right_column_x_,
4523 tabley_,
4524 get_right_column_w(right_column_x_),
4525 tableh_ - buth_ - 4 * padding_,
4526- MapDetails::Style::kFsMenu),
4527+ UI::PanelStyle::kFsMenu),
4528
4529 scenario_types_(settings->settings().multiplayer ? Map::MP_SCENARIO : Map::SP_SCENARIO),
4530 basedir_(kMapsDir),
4531
4532=== modified file 'src/ui_fsmenu/multiplayer.cc'
4533--- src/ui_fsmenu/multiplayer.cc 2018-04-07 16:59:00 +0000
4534+++ src/ui_fsmenu/multiplayer.cc 2018-05-12 13:15:45 +0000
4535@@ -35,24 +35,11 @@
4536 title(this, 0, 0, _("Choose game type"), UI::Align::kCenter),
4537
4538 // Buttons
4539- metaserver(&vbox_,
4540- "metaserver",
4541- 0,
4542- 0,
4543- butw_,
4544- buth_,
4545- g_gr->images().get(button_background_),
4546- _("Internet game")),
4547+ metaserver(
4548+ &vbox_, "metaserver", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Internet game")),
4549 showloginbox(nullptr),
4550- lan(&vbox_,
4551- "lan",
4552- 0,
4553- 0,
4554- butw_,
4555- buth_,
4556- g_gr->images().get(button_background_),
4557- _("LAN / Direct IP")),
4558- back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
4559+ lan(&vbox_, "lan", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("LAN / Direct IP")),
4560+ back(&vbox_, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Back")) {
4561 metaserver.sigclicked.connect(
4562 boost::bind(&FullscreenMenuMultiPlayer::internet_login, boost::ref(*this)));
4563
4564@@ -74,9 +61,9 @@
4565 Section& s = g_options.pull_section("global");
4566 auto_log_ = s.get_bool("auto_log", false);
4567 if (auto_log_) {
4568- showloginbox = new UI::Button(
4569- this, "login_dialog", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but1.png"),
4570- g_gr->images().get("images/ui_basic/continue.png"), _("Show login dialog"));
4571+ showloginbox =
4572+ new UI::Button(this, "login_dialog", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary,
4573+ g_gr->images().get("images/ui_basic/continue.png"), _("Show login dialog"));
4574 showloginbox->sigclicked.connect(
4575 boost::bind(&FullscreenMenuMultiPlayer::show_internet_login, boost::ref(*this)));
4576 }
4577
4578=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
4579--- src/ui_fsmenu/netsetup_lan.cc 2018-04-07 16:59:00 +0000
4580+++ src/ui_fsmenu/netsetup_lan.cc 2018-05-12 13:15:45 +0000
4581@@ -50,7 +50,7 @@
4582 get_h() * 5333 / 10000,
4583 butw_,
4584 buth_,
4585- g_gr->images().get("images/ui_basic/but1.png"),
4586+ UI::ButtonStyle::kFsMenuSecondary,
4587 _("Join this game")),
4588 hostgame(this,
4589 "host_game",
4590@@ -58,7 +58,7 @@
4591 get_h() * 6083 / 10000,
4592 butw_,
4593 buth_,
4594- g_gr->images().get("images/ui_basic/but1.png"),
4595+ UI::ButtonStyle::kFsMenuSecondary,
4596 _("Host a new game")),
4597 back(this,
4598 "back",
4599@@ -66,7 +66,7 @@
4600 get_h() * 8333 / 10000,
4601 butw_,
4602 buth_,
4603- g_gr->images().get("images/ui_basic/but0.png"),
4604+ UI::ButtonStyle::kFsMenuSecondary,
4605 _("Back")),
4606 loadlasthost(this,
4607 "load_previous_host",
4608@@ -74,7 +74,7 @@
4609 get_h() * 19 / 40,
4610 buth_,
4611 buth_,
4612- g_gr->images().get("images/ui_basic/but1.png"),
4613+ UI::ButtonStyle::kFsMenuSecondary,
4614 g_gr->images().get("images/ui_fsmenu/menu_load_game.png"),
4615 _("Load previous host")),
4616
4617@@ -85,7 +85,7 @@
4618 butw_,
4619 buth_,
4620 2,
4621- g_gr->images().get("images/ui_basic/but2.png"),
4622+ UI::PanelStyle::kFsMenu,
4623 fs_small()),
4624 hostname(this,
4625 get_w() * 16 / 25,
4626@@ -93,11 +93,16 @@
4627 get_w() * 17 / 80,
4628 buth_,
4629 2,
4630- g_gr->images().get("images/ui_basic/but2.png"),
4631+ UI::PanelStyle::kFsMenu,
4632 fs_small()),
4633
4634 // List
4635- opengames(this, get_w() * 3 / 50, get_h() * 3333 / 10000, listw_, get_h() * 5433 / 10000) {
4636+ opengames(this,
4637+ get_w() * 3 / 50,
4638+ get_h() * 3333 / 10000,
4639+ listw_,
4640+ get_h() * 5433 / 10000,
4641+ UI::PanelStyle::kFsMenu) {
4642 joingame.sigclicked.connect(
4643 boost::bind(&FullscreenMenuNetSetupLAN::clicked_joingame, boost::ref(*this)));
4644 hostgame.sigclicked.connect(
4645
4646=== modified file 'src/ui_fsmenu/options.cc'
4647--- src/ui_fsmenu/options.cc 2018-04-23 08:25:10 +0000
4648+++ src/ui_fsmenu/options.cc 2018-05-12 13:15:45 +0000
4649@@ -83,26 +83,12 @@
4650
4651 // Buttons
4652 button_box_(this, 0, 0, UI::Box::Horizontal),
4653- cancel_(&button_box_,
4654- "cancel",
4655- 0,
4656- 0,
4657- 0,
4658- 0,
4659- g_gr->images().get("images/ui_basic/but0.png"),
4660- _("Cancel")),
4661- apply_(&button_box_,
4662- "apply",
4663- 0,
4664- 0,
4665- 0,
4666- 0,
4667- g_gr->images().get("images/ui_basic/but0.png"),
4668- _("Apply")),
4669- ok_(&button_box_, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")),
4670+ cancel_(&button_box_, "cancel", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Cancel")),
4671+ apply_(&button_box_, "apply", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Apply")),
4672+ ok_(&button_box_, "ok", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("OK")),
4673
4674 // Tabs
4675- tabs_(this, g_gr->images().get("images/ui_basic/but1.png"), UI::TabPanel::Type::kBorder),
4676+ tabs_(this, UI::TabPanelStyle::kFsMenu),
4677
4678 box_interface_(&tabs_, 0, 0, UI::Box::Horizontal, 0, 0, padding_),
4679 box_interface_left_(&box_interface_, 0, 0, UI::Box::Vertical, 0, 0, padding_),
4680@@ -118,19 +104,23 @@
4681 100, // 100 is arbitrary, will be resized in layout().
4682 100, // 100 is arbitrary, will be resized in layout().
4683 24,
4684- _("Language")),
4685+ _("Language"),
4686+ UI::DropdownType::kTextual,
4687+ UI::PanelStyle::kFsMenu),
4688 resolution_dropdown_(&box_interface_left_,
4689 0,
4690 0,
4691 100, // 100 is arbitrary, will be resized in layout().
4692 100, // 100 is arbitrary, will be resized in layout().
4693 24,
4694- _("Window Size")),
4695+ _("Window Size"),
4696+ UI::DropdownType::kTextual,
4697+ UI::PanelStyle::kFsMenu),
4698
4699 fullscreen_(&box_interface_left_, Vector2i::zero(), _("Fullscreen"), "", 0),
4700- inputgrab_(&box_interface_left_, Vector2i::zero(), _("Grab input"), "", 0),
4701- sb_maxfps_(&box_interface_left_, 0, 0, 0, 0, opt.maxfps, 0, 99, _("Maximum FPS:")),
4702- translation_info_(&box_interface_, 0, 0, 100, 100),
4703+ inputgrab_(&box_interface_left_, Vector2i::zero(), _("Grab Input"), "", 0),
4704+ sb_maxfps_(&box_interface_left_, 0, 0, 0, 0, opt.maxfps, 0, 99, UI::PanelStyle::kFsMenu, _("Maximum FPS:")),
4705+ translation_info_(&box_interface_, 0, 0, 100, 100, UI::PanelStyle::kFsMenu),
4706
4707 // Windows options
4708 snap_win_overlap_only_(
4709@@ -147,6 +137,7 @@
4710 opt.panel_snap_distance,
4711 0,
4712 99,
4713+ UI::PanelStyle::kFsMenu,
4714 _("Distance for windows to snap to other panels:"),
4715 UI::SpinBox::Units::kPixels),
4716
4717@@ -158,6 +149,7 @@
4718 opt.border_snap_distance,
4719 0,
4720 99,
4721+ UI::PanelStyle::kFsMenu,
4722 _("Distance for windows to snap to borders:"),
4723 UI::SpinBox::Units::kPixels),
4724
4725@@ -175,9 +167,9 @@
4726 opt.autosave / 60,
4727 0,
4728 100,
4729+ UI::PanelStyle::kFsMenu,
4730 _("Save game automatically every:"),
4731 UI::SpinBox::Units::kMinutes,
4732- g_gr->images().get("images/ui_basic/but3.png"),
4733 UI::SpinBox::Type::kBig),
4734
4735 sb_rolling_autosave_(&box_saving_,
4736@@ -188,9 +180,9 @@
4737 opt.rolling_autosave,
4738 1,
4739 20,
4740+ UI::PanelStyle::kFsMenu,
4741 _("Maximum number of autosave files:"),
4742 UI::SpinBox::Units::kNone,
4743- g_gr->images().get("images/ui_basic/but3.png"),
4744 UI::SpinBox::Type::kBig),
4745
4746 zip_(&box_saving_,
4747
4748=== modified file 'src/ui_fsmenu/singleplayer.cc'
4749--- src/ui_fsmenu/singleplayer.cc 2018-04-07 16:59:00 +0000
4750+++ src/ui_fsmenu/singleplayer.cc 2018-05-12 13:15:45 +0000
4751@@ -20,7 +20,6 @@
4752 #include "ui_fsmenu/singleplayer.h"
4753
4754 #include "base/i18n.h"
4755-#include "graphic/graphic.h"
4756 #include "graphic/text_constants.h"
4757
4758 FullscreenMenuSinglePlayer::FullscreenMenuSinglePlayer()
4759@@ -30,31 +29,12 @@
4760 title(this, 0, 0, _("Single Player"), UI::Align::kCenter),
4761
4762 // Buttons
4763- new_game(&vbox_,
4764- "new_game",
4765- 0,
4766- 0,
4767- butw_,
4768- buth_,
4769- g_gr->images().get(button_background_),
4770- _("New Game")),
4771- campaign(&vbox_,
4772- "campaigns",
4773- 0,
4774- 0,
4775- butw_,
4776- buth_,
4777- g_gr->images().get(button_background_),
4778- _("Campaigns")),
4779- load_game(&vbox_,
4780- "load_game",
4781- 0,
4782- 0,
4783- butw_,
4784- buth_,
4785- g_gr->images().get(button_background_),
4786- _("Load Game")),
4787- back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
4788+ new_game(&vbox_, "new_game", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("New Game")),
4789+ campaign(
4790+ &vbox_, "campaigns", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Campaigns")),
4791+ load_game(
4792+ &vbox_, "load_game", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Load Game")),
4793+ back(&vbox_, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Back")) {
4794 new_game.sigclicked.connect(
4795 boost::bind(&FullscreenMenuSinglePlayer::end_modal<FullscreenMenuBase::MenuTarget>,
4796 boost::ref(*this), FullscreenMenuBase::MenuTarget::kNewGame));
4797
4798=== modified file 'src/wui/CMakeLists.txt'
4799--- src/wui/CMakeLists.txt 2018-02-14 17:16:53 +0000
4800+++ src/wui/CMakeLists.txt 2018-05-12 13:15:45 +0000
4801@@ -73,7 +73,6 @@
4802 base_time_string
4803 helper
4804 game_io
4805- graphic
4806 graphic_fonthandler
4807 graphic_image_io
4808 graphic_surface
4809
4810=== modified file 'src/wui/actionconfirm.cc'
4811--- src/wui/actionconfirm.cc 2018-04-07 16:59:00 +0000
4812+++ src/wui/actionconfirm.cc 2018-05-12 13:15:45 +0000
4813@@ -132,20 +132,18 @@
4814 UI::Box* main_box = new UI::Box(this, padding, padding, UI::Box::Vertical);
4815 UI::Box* button_box = new UI::Box(main_box, 0, 0, UI::Box::Horizontal);
4816
4817- UI::MultilineTextarea* textarea =
4818- new UI::MultilineTextarea(main_box, 0, 0, 200, 74, message, UI::Align::kCenter,
4819- g_gr->images().get("images/ui_basic/but1.png"),
4820- UI::MultilineTextarea::ScrollMode::kNoScrolling);
4821+ UI::MultilineTextarea* textarea = new UI::MultilineTextarea(
4822+ main_box, 0, 0, 200, 74, UI::PanelStyle::kWui, message, UI::Align::kCenter,
4823+ UI::MultilineTextarea::ScrollMode::kNoScrolling);
4824 textarea->force_new_renderer();
4825
4826- UI::Button* okbtn =
4827- new UI::Button(button_box, "ok", 0, 0, 80, 34, g_gr->images().get("images/ui_basic/but4.png"),
4828- g_gr->images().get("images/wui/menu_okay.png"));
4829+ UI::Button* okbtn = new UI::Button(button_box, "ok", 0, 0, 80, 34, UI::ButtonStyle::kWuiMenu,
4830+ g_gr->images().get("images/wui/menu_okay.png"));
4831 okbtn->sigclicked.connect(boost::bind(&ActionConfirm::ok, this));
4832
4833- UI::Button* cancelbtn = new UI::Button(button_box, "abort", 0, 0, 80, 34,
4834- g_gr->images().get("images/ui_basic/but4.png"),
4835- g_gr->images().get("images/wui/menu_abort.png"));
4836+ UI::Button* cancelbtn =
4837+ new UI::Button(button_box, "abort", 0, 0, 80, 34, UI::ButtonStyle::kWuiMenu,
4838+ g_gr->images().get("images/wui/menu_abort.png"));
4839 cancelbtn->sigclicked.connect(boost::bind(&ActionConfirm::die, this));
4840
4841 button_box->add(
4842
4843=== modified file 'src/wui/attack_box.cc'
4844--- src/wui/attack_box.cc 2018-04-07 16:59:00 +0000
4845+++ src/wui/attack_box.cc 2018-05-12 13:15:45 +0000
4846@@ -26,7 +26,6 @@
4847
4848 #include "base/macros.h"
4849 #include "graphic/font_handler1.h"
4850-#include "graphic/graphic.h"
4851 #include "graphic/text/font_set.h"
4852 #include "graphic/text_constants.h"
4853 #include "logic/map_objects/tribes/soldier.h"
4854@@ -60,10 +59,9 @@
4855 uint32_t min,
4856 uint32_t max,
4857 uint32_t initial,
4858- char const* picname,
4859 char const* hint) {
4860 std::unique_ptr<UI::HorizontalSlider> result(new UI::HorizontalSlider(
4861- &parent, 0, 0, width, height, min, max, initial, g_gr->images().get(picname), hint));
4862+ &parent, 0, 0, width, height, min, max, initial, UI::SliderStyle::kWuiDark, hint));
4863 parent.add(result.get());
4864 return result;
4865 }
4866@@ -81,7 +79,7 @@
4867 void (AttackBox::*fn)(),
4868 const std::string& tooltip_text) {
4869 std::unique_ptr<UI::Button> button(new UI::Button(&parent, text, 8, 8, 26, 26,
4870- g_gr->images().get("images/ui_basic/but2.png"),
4871+ UI::ButtonStyle::kWuiPrimary,
4872 text, tooltip_text));
4873 button->sigclicked.connect(boost::bind(fn, boost::ref(*this)));
4874 parent.add(button.get());
4875@@ -144,8 +142,8 @@
4876 soldiers_text_.reset(
4877 &add_text(columnbox, attack_string, UI::Align::kCenter, UI_FONT_SIZE_ULTRASMALL));
4878
4879- soldiers_slider_ = add_slider(columnbox, 100, 10, 0, max_attackers, max_attackers > 0 ? 1 : 0,
4880- "images/ui_basic/but2.png", _("Number of soldiers"));
4881+ soldiers_slider_ = add_slider(
4882+ columnbox, 100, 10, 0, max_attackers, max_attackers > 0 ? 1 : 0, _("Number of soldiers"));
4883
4884 soldiers_slider_->changed.connect(boost::bind(&AttackBox::update_attack, this));
4885 more_soldiers_ = add_button(linebox, std::to_string(max_attackers),
4886
4887=== modified file 'src/wui/attack_box.h'
4888--- src/wui/attack_box.h 2018-04-07 16:59:00 +0000
4889+++ src/wui/attack_box.h 2018-05-12 13:15:45 +0000
4890@@ -61,7 +61,6 @@
4891 uint32_t min,
4892 uint32_t max,
4893 uint32_t initial,
4894- char const* picname,
4895 char const* hint);
4896 // TODO(GunChleoc): This should also return a unique_ptr
4897 UI::Textarea& add_text(UI::Box& parent,
4898
4899=== modified file 'src/wui/building_statistics_menu.cc'
4900--- src/wui/building_statistics_menu.cc 2018-04-15 14:37:45 +0000
4901+++ src/wui/building_statistics_menu.cc 2018-05-12 13:15:45 +0000
4902@@ -57,9 +57,13 @@
4903
4904 BuildingStatisticsMenu::BuildingStatisticsMenu(InteractivePlayer& parent,
4905 UI::UniqueWindow::Registry& registry)
4906- : UI::UniqueWindow(
4907- &parent, "building_statistics", &registry, kWindowWidth, 100, _("Building Statistics")),
4908- tab_panel_(this, g_gr->images().get("images/ui_basic/but1.png")),
4909+ : UI::UniqueWindow(&parent,
4910+ "building_statistics",
4911+ &registry,
4912+ kWindowWidth,
4913+ 100,
4914+ _("Building Statistics")),
4915+ tab_panel_(this, UI::TabPanelStyle::kWuiDark),
4916 navigation_panel_(this, 0, 0, kWindowWidth, 4 * kButtonRowHeight),
4917 building_name_(
4918 &navigation_panel_, get_inner_w() / 2, 0, 0, kButtonHeight, "", UI::Align::kCenter),
4919@@ -83,7 +87,7 @@
4920 35,
4921 0,
4922 1,
4923- g_gr->images().get("images/ui_basic/but1.png"),
4924+ UI::PanelStyle::kWui,
4925 kLabelFontSize - UI::g_fh1->fontset()->size_offset()), // We need consistent height here
4926 unproductive_label2_(
4927 &unproductive_box_,
4928@@ -141,36 +145,32 @@
4929
4930 navigation_buttons_[NavigationButton::PrevOwned] = new UI::Button(
4931 &navigation_panel_, "previous_owned", get_inner_w() - 2 * kButtonRowHeight, kButtonRowHeight,
4932- kButtonHeight, kButtonHeight, g_gr->images().get("images/ui_basic/but4.png"),
4933+ kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4934 g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
4935
4936 navigation_buttons_[NavigationButton::NextOwned] = new UI::Button(
4937 &navigation_panel_, "next_owned", get_inner_w() - kButtonRowHeight, kButtonRowHeight,
4938- kButtonHeight, kButtonHeight, g_gr->images().get("images/ui_basic/but4.png"),
4939+ kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4940 g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
4941
4942 navigation_buttons_[NavigationButton::PrevConstruction] = new UI::Button(
4943 &navigation_panel_, "previous_constructed", get_inner_w() - 2 * kButtonRowHeight,
4944- 2 * kButtonRowHeight, kButtonHeight, kButtonHeight,
4945- g_gr->images().get("images/ui_basic/but4.png"),
4946+ 2 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4947 g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
4948
4949 navigation_buttons_[NavigationButton::NextConstruction] = new UI::Button(
4950 &navigation_panel_, "next_constructed", get_inner_w() - kButtonRowHeight,
4951- 2 * kButtonRowHeight, kButtonHeight, kButtonHeight,
4952- g_gr->images().get("images/ui_basic/but4.png"),
4953+ 2 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4954 g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
4955
4956 navigation_buttons_[NavigationButton::PrevUnproductive] = new UI::Button(
4957 &navigation_panel_, "previous_unproductive", get_inner_w() - 2 * kButtonRowHeight,
4958- 3 * kButtonRowHeight, kButtonHeight, kButtonHeight,
4959- g_gr->images().get("images/ui_basic/but4.png"),
4960+ 3 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4961 g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
4962
4963 navigation_buttons_[NavigationButton::NextUnproductive] = new UI::Button(
4964 &navigation_panel_, "next_unproductive", get_inner_w() - kButtonRowHeight,
4965- 3 * kButtonRowHeight, kButtonHeight, kButtonHeight,
4966- g_gr->images().get("images/ui_basic/but4.png"),
4967+ 3 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
4968 g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
4969
4970 navigation_buttons_[NavigationButton::PrevOwned]->sigclicked.connect(boost::bind(
4971@@ -399,11 +399,11 @@
4972 const BuildingDescr& descr,
4973 UI::Box* row) {
4974 UI::Box* button_box = new UI::Box(row, 0, 0, UI::Box::Vertical);
4975- building_buttons_[id] = new UI::Button(
4976- button_box, (boost::format("building_button%s") % id).str(), 0, 0, kBuildGridCellWidth,
4977- kBuildGridCellHeight, g_gr->images().get("images/ui_basic/but1.png"),
4978- descr.representative_image(&iplayer().get_player()->get_playercolor()), "",
4979- UI::Button::Style::kFlat);
4980+ building_buttons_[id] =
4981+ new UI::Button(button_box, (boost::format("building_button%s") % id).str(), 0, 0,
4982+ kBuildGridCellWidth, kBuildGridCellHeight, UI::ButtonStyle::kWuiBuildingStats,
4983+ descr.representative_image(&iplayer().get_player()->get_playercolor()), "",
4984+ UI::Button::VisualState::kFlat);
4985 building_buttons_[id]->set_disable_style(UI::ButtonDisableStyle::kMonochrome |
4986 UI::ButtonDisableStyle::kFlat);
4987 button_box->add(building_buttons_[id]);
4988@@ -785,7 +785,7 @@
4989 if (building_button == nullptr) {
4990 continue;
4991 }
4992- building_button->set_style(UI::Button::Style::kFlat);
4993+ building_button->set_visual_state(UI::Button::VisualState::kFlat);
4994 }
4995
4996 // Update for current button
4997
4998=== modified file 'src/wui/buildingwindow.cc'
4999--- src/wui/buildingwindow.cc 2018-04-07 16:59:00 +0000
5000+++ src/wui/buildingwindow.cc 2018-05-12 13:15:45 +0000
The diff has been truncated for viewing.

Subscribers

People subscribed via source and target branches

to status/vote changes: