widelands-dev team mailing list archive
-
widelands-dev team
-
Mailing list archive
-
Message #12535
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
GunChleoc has proposed merging lp:~widelands-dev/widelands/background_images into lp:widelands.
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
Requested reviews:
Widelands Developers (widelands-dev)
Related bugs:
Bug #1697147 in widelands: "Get rid of bold fonts in the UI"
https://bugs.launchpad.net/widelands/+bug/1697147
For more details, see:
https://code.launchpad.net/~widelands-dev/widelands/background_images/+merge/337629
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.
--
Your team Widelands Developers is requested to review the proposed merge of lp:~widelands-dev/widelands/background_images into lp:widelands.
=== removed file 'data/images/ui_basic/but0.png'
Binary 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
=== removed file 'data/images/ui_basic/but1.png'
Binary 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
=== removed file 'data/images/ui_basic/but2.png'
Binary 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
=== removed file 'data/images/ui_basic/but3.png'
Binary 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
=== removed file 'data/images/ui_basic/but4.png'
Binary 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
=== removed file 'data/images/ui_basic/but5.png'
Binary 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
=== removed file 'data/images/ui_fsmenu/top_left.png'
Binary 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
=== removed file 'data/images/wui/window_background_dark.png'
Binary 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
=== added directory 'data/templates'
=== added directory 'data/templates/default'
=== added directory 'data/templates/default/fsmenu'
=== renamed file 'data/images/ui_fsmenu/background.png' => 'data/templates/default/fsmenu/background.png'
Binary files data/images/ui_fsmenu/background.png 2016-10-31 12:09:15 +0000 and data/templates/default/fsmenu/background.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/bottom.png' => 'data/templates/default/fsmenu/bottom.png'
Binary files data/images/ui_fsmenu/bottom.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/bottom_left.png' => 'data/templates/default/fsmenu/bottom_left.png'
Binary files data/images/ui_fsmenu/bottom_left.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom_left.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/bottom_right.png' => 'data/templates/default/fsmenu/bottom_right.png'
Binary files data/images/ui_fsmenu/bottom_right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/bottom_right.png 2018-02-13 12:57:13 +0000 differ
=== added file 'data/templates/default/fsmenu/button.png'
Binary files data/templates/default/fsmenu/button.png 1970-01-01 00:00:00 +0000 and data/templates/default/fsmenu/button.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/center.png' => 'data/templates/default/fsmenu/center.png'
Binary files data/images/ui_fsmenu/center.png 2016-10-31 08:21:03 +0000 and data/templates/default/fsmenu/center.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/left.png' => 'data/templates/default/fsmenu/left.png'
Binary files data/images/ui_fsmenu/left.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/left.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/right.png' => 'data/templates/default/fsmenu/right.png'
Binary files data/images/ui_fsmenu/right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/right.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/top.png' => 'data/templates/default/fsmenu/top.png'
Binary files data/images/ui_fsmenu/top.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/top.png 2018-02-13 12:57:13 +0000 differ
=== added file 'data/templates/default/fsmenu/top_left.png'
Binary files data/templates/default/fsmenu/top_left.png 1970-01-01 00:00:00 +0000 and data/templates/default/fsmenu/top_left.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/ui_fsmenu/top_right.png' => 'data/templates/default/fsmenu/top_right.png'
Binary files data/images/ui_fsmenu/top_right.png 2016-10-31 08:33:56 +0000 and data/templates/default/fsmenu/top_right.png 2018-02-13 12:57:13 +0000 differ
=== added file 'data/templates/default/init.lua'
--- data/templates/default/init.lua 1970-01-01 00:00:00 +0000
+++ data/templates/default/init.lua 2018-02-13 12:57:13 +0000
@@ -0,0 +1,101 @@
+-- This script defines a GUI style for Widelands. At the moment, we only
+-- support the default template.
+-- So far, only background textures and colors can be defined, and they all have
+-- the format { image = filename, color = {r, g, b } }.
+
+dirname = path.dirname(__file__)
+
+-- Some common elements for reuse
+local fs_button = dirname .. "fsmenu/button.png"
+local wui_button = dirname .. "wui/button.png"
+
+local fs_blue = {0, 31, 40}
+local fs_green = {10, 50, 0}
+local fs_brown = {45, 34, 18}
+
+local wui_light = {85, 63, 35}
+local wui_green = {3, 15, 0}
+local wui_brown = {32, 19, 8}
+
+-- These are the style definitions to be returned.
+-- Note: you have to keep all the keys intact, or Widelands will not be happy.
+return {
+ -- Button backgrounds
+ buttons = {
+ -- Buttons used in Fullscreen menus
+ fsmenu = {
+ -- Main menu ("Single Player", "Watch Replay", ...)
+ menu = { image = fs_button, color = fs_blue },
+ -- Primary user selection ("OK", ...)
+ primary = { image = fs_button, color = fs_green },
+ -- Secondary user selection ("Cancel", "Delete", selection buttons, ...)
+ secondary = { image = fs_button, color = fs_brown },
+ },
+ -- Buttons used in-game and in the editor
+ wui = {
+ -- Main menu ("Exit Game"), Building Windows, selection buttons, ...
+ menu = { image = wui_button, color = wui_light },
+ -- Primary user selection ("OK", attack, ...)
+ primary = { image = wui_button, color = wui_green },
+ -- Secondary user selection ("Cancel", "Delete", ...)
+ secondary = { image = wui_button, color = wui_brown },
+ -- Building buttons on fieldaction and building statistics need to be
+ -- transparent in order to match the background of the tab panel.
+ building_stats = { image = "", color = {0, 0, 0} },
+ }
+ },
+ -- Slider cursors (Sound control, attack, statistics, ...)
+ sliders = {
+ fsmenu = {
+ menu = { image = fs_button, color = fs_blue },
+ },
+ wui = {
+ -- Sound Options, Statistics
+ light = { image = wui_button, color = wui_brown },
+ -- Fieldaction (attack)
+ dark = { image = wui_button, color = wui_green },
+ }
+ },
+ -- Background for tab panels
+ tabpanels = {
+ fsmenu = {
+ -- Options, About, ... this comes with a hard-coded border too
+ menu = { image = "", color = {5, 5, 5} },
+ },
+ wui = {
+ -- Most in-game and in-editor tabs. Building windows, Editor tools,
+ -- Encyclopedia, ...
+ light = { image = "", color = {0, 0, 0} },
+ -- Building buttons in Fieldaction and Building Statistics need a dark
+ -- background, otherwise the icons will be hard to see.
+ dark = { image = wui_button, color = wui_brown },
+ }
+ },
+ -- Used both for one-line and multiline edit boxes
+ editboxes = {
+ fsmenu = {
+ menu = { image = fs_button, color = fs_green },
+ },
+ wui = {
+ menu = { image = wui_button, color = wui_brown },
+ }
+ },
+ -- Background for dropdown menus
+ dropdowns = {
+ fsmenu = {
+ menu = { image = fs_button, color = fs_brown },
+ },
+ wui = {
+ menu = { image = wui_button, color = wui_brown },
+ }
+ },
+ -- Scrollbar buttons, table headers etc.
+ scrollbars = {
+ fsmenu = {
+ menu = { image = fs_button, color = fs_blue },
+ },
+ wui = {
+ menu = { image = wui_button, color = wui_brown },
+ }
+ }
+}
=== added directory 'data/templates/default/wui'
=== renamed file 'data/images/wui/window_background.png' => 'data/templates/default/wui/background.png'
Binary files data/images/wui/window_background.png 2014-12-03 10:43:04 +0000 and data/templates/default/wui/background.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/wui/window_bottom.png' => 'data/templates/default/wui/bottom.png'
=== added file 'data/templates/default/wui/button.png'
Binary files data/templates/default/wui/button.png 1970-01-01 00:00:00 +0000 and data/templates/default/wui/button.png 2018-02-13 12:57:13 +0000 differ
=== renamed file 'data/images/wui/window_left.png' => 'data/templates/default/wui/left.png'
=== renamed file 'data/images/wui/window_right.png' => 'data/templates/default/wui/right.png'
=== renamed file 'data/images/wui/window_top.png' => 'data/templates/default/wui/top.png'
=== modified file 'src/editor/tools/decrease_height_tool.cc'
--- src/editor/tools/decrease_height_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/decrease_height_tool.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include "editor/tools/increase_height_tool.h"
#include "editor/tools/set_height_tool.h"
#include "logic/field.h"
-#include "logic/map.h"
#include "logic/mapregion.h"
/// Decreases the heights by a value. Chages surrounding nodes if necessary.
=== modified file 'src/editor/tools/decrease_resources_tool.cc'
--- src/editor/tools/decrease_resources_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/decrease_resources_tool.cc 2018-02-13 12:57:13 +0000
@@ -22,10 +22,8 @@
#include "editor/editorinteractive.h"
#include "editor/tools/increase_resources_tool.h"
#include "editor/tools/set_resources_tool.h"
-#include "graphic/graphic.h"
#include "logic/field.h"
#include "logic/map_objects/world/resource_description.h"
-#include "logic/map_objects/world/world.h"
#include "logic/mapregion.h"
#include "logic/widelands_geometry.h"
=== modified file 'src/editor/tools/increase_height_tool.cc'
--- src/editor/tools/increase_height_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/increase_height_tool.cc 2018-02-13 12:57:13 +0000
@@ -21,7 +21,6 @@
#include "editor/editorinteractive.h"
#include "logic/field.h"
-#include "logic/map.h"
#include "logic/mapregion.h"
/// Increases the heights by a value. Changes surrounding nodes if necessary.
=== modified file 'src/editor/tools/increase_resources_tool.cc'
--- src/editor/tools/increase_resources_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/increase_resources_tool.cc 2018-02-13 12:57:13 +0000
@@ -20,11 +20,9 @@
#include "editor/tools/increase_resources_tool.h"
#include "editor/editorinteractive.h"
-#include "graphic/graphic.h"
#include "logic/field.h"
#include "logic/map_objects/world/resource_description.h"
#include "logic/map_objects/world/terrain_description.h"
-#include "logic/map_objects/world/world.h"
#include "logic/mapregion.h"
using Widelands::TCoords;
=== modified file 'src/editor/tools/info_tool.cc'
--- src/editor/tools/info_tool.cc 2017-11-24 21:34:17 +0000
+++ src/editor/tools/info_tool.cc 2018-02-13 12:57:13 +0000
@@ -26,10 +26,8 @@
#include "base/i18n.h"
#include "editor/editorinteractive.h"
-#include "logic/map.h"
#include "logic/map_objects/world/editor_category.h"
#include "logic/map_objects/world/terrain_description.h"
-#include "logic/map_objects/world/world.h"
#include "ui_basic/multilinetextarea.h"
#include "ui_basic/window.h"
@@ -44,7 +42,7 @@
UI::Window* const w =
new UI::Window(&parent, "field_information", 30, 30, 400, 200, _("Field Information"));
UI::MultilineTextarea* const multiline_textarea =
- new UI::MultilineTextarea(w, 0, 0, w->get_inner_w(), w->get_inner_h());
+ new UI::MultilineTextarea(w, 0, 0, w->get_inner_w(), w->get_inner_h(), UI::PanelStyle::kWui);
Widelands::Field& f = (*map)[center.node];
=== modified file 'src/editor/tools/place_critter_tool.cc'
--- src/editor/tools/place_critter_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/place_critter_tool.cc 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include "logic/field.h"
#include "logic/map_objects/bob.h"
#include "logic/map_objects/world/critter.h"
-#include "logic/map_objects/world/world.h"
#include "logic/mapregion.h"
/**
=== modified file 'src/editor/tools/set_height_tool.cc'
--- src/editor/tools/set_height_tool.cc 2017-01-25 18:55:59 +0000
+++ src/editor/tools/set_height_tool.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include "editor/tools/decrease_height_tool.h"
#include "editor/tools/increase_height_tool.h"
#include "logic/field.h"
-#include "logic/map.h"
#include "logic/mapregion.h"
int32_t EditorSetHeightTool::handle_click_impl(const Widelands::World& world,
=== modified file 'src/editor/tools/set_origin_tool.cc'
--- src/editor/tools/set_origin_tool.cc 2017-12-31 18:46:49 +0000
+++ src/editor/tools/set_origin_tool.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,6 @@
#include "editor/tools/set_origin_tool.h"
#include "editor/editorinteractive.h"
-#include "logic/map.h"
#include "wui/mapviewpixelconstants.h"
int32_t EditorSetOriginTool::handle_click_impl(const Widelands::World&,
=== modified file 'src/editor/tools/set_port_space_tool.cc'
--- src/editor/tools/set_port_space_tool.cc 2017-11-07 07:41:38 +0000
+++ src/editor/tools/set_port_space_tool.cc 2018-02-13 12:57:13 +0000
@@ -21,7 +21,6 @@
#include "editor/editorinteractive.h"
#include "editor/tools/tool.h"
-#include "logic/map.h"
#include "logic/map_objects/tribes/building.h"
#include "logic/mapfringeregion.h"
#include "logic/mapregion.h"
=== modified file 'src/editor/tools/set_resources_tool.cc'
--- src/editor/tools/set_resources_tool.cc 2017-12-18 19:07:41 +0000
+++ src/editor/tools/set_resources_tool.cc 2018-02-13 12:57:13 +0000
@@ -22,10 +22,8 @@
#include "editor/editorinteractive.h"
#include "editor/tools/decrease_resources_tool.h"
#include "editor/tools/increase_resources_tool.h"
-#include "graphic/graphic.h"
#include "logic/field.h"
#include "logic/map_objects/world/resource_description.h"
-#include "logic/map_objects/world/world.h"
#include "logic/mapregion.h"
int32_t EditorSetResourcesTool::handle_click_impl(const Widelands::World& world,
=== modified file 'src/editor/tools/set_starting_pos_tool.cc'
--- src/editor/tools/set_starting_pos_tool.cc 2017-09-15 19:18:08 +0000
+++ src/editor/tools/set_starting_pos_tool.cc 2018-02-13 12:57:13 +0000
@@ -21,9 +21,7 @@
#include "editor/editorinteractive.h"
#include "editor/tools/tool.h"
-#include "graphic/graphic.h"
#include "graphic/playercolor.h"
-#include "logic/map.h"
// global variable to pass data from callback to class
static int32_t current_player_;
=== modified file 'src/editor/tools/tool.h'
--- src/editor/tools/tool.h 2017-09-01 15:45:59 +0000
+++ src/editor/tools/tool.h 2018-02-13 12:57:13 +0000
@@ -27,13 +27,10 @@
#include "graphic/graphic.h"
#include "graphic/image.h"
#include "logic/editor_game_base.h"
+#include "logic/map_objects/world/world.h"
#include "logic/widelands_geometry.h"
class EditorInteractive;
-namespace Widelands {
-class Map;
-class World;
-}
/**
* An editor tool is a tool that can be selected in the editor. Examples are:
=== modified file 'src/editor/ui_menus/categorized_item_selection_menu.h'
--- src/editor/ui_menus/categorized_item_selection_menu.h 2017-08-16 04:31:56 +0000
+++ src/editor/ui_menus/categorized_item_selection_menu.h 2018-02-13 12:57:13 +0000
@@ -83,19 +83,17 @@
descriptions_(descriptions),
select_correct_tool_(select_correct_tool),
protect_against_recursive_select_(false),
- tab_panel_(this, g_gr->images().get("images/wui/window_background_dark.png")),
+ tab_panel_(this, UI::TabPanelStyle::kWuiLight),
current_selection_names_(this,
0,
0,
20,
20,
+ UI::PanelStyle::kWui,
"",
UI::Align::kCenter,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
tool_(tool) {
- current_selection_names_.set_background(
- g_gr->images().get("images/wui/window_background_dark.png"));
add(&tab_panel_);
for (uint32_t category_index = 0; category_index < categories.size(); ++category_index) {
=== modified file 'src/editor/ui_menus/main_menu.cc'
--- src/editor/ui_menus/main_menu.cc 2017-02-25 11:17:28 +0000
+++ src/editor/ui_menus/main_menu.cc 2018-02-13 12:57:13 +0000
@@ -42,54 +42,24 @@
EditorMainMenu::EditorMainMenu(EditorInteractive& parent, UI::UniqueWindow::Registry& registry)
: UI::UniqueWindow(&parent, "main_menu", ®istry, 2 * margin + width, 0, _("Main Menu")),
box_(this, margin, margin, UI::Box::Vertical, width, get_h() - 2 * margin, vspacing),
- button_new_map_(&box_,
- "new_map",
- 0,
- 0,
- width,
- 0,
- g_gr->images().get("images/ui_basic/but1.png"),
- _("New Map")),
+ button_new_map_(
+ &box_, "new_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("New Map")),
button_new_random_map_(&box_,
"new_random_map",
0,
0,
width,
0,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("New Random Map")),
- button_load_map_(&box_,
- "load_map",
- 0,
- 0,
- width,
- 0,
- g_gr->images().get("images/ui_basic/but1.png"),
- _("Load Map")),
- button_save_map_(&box_,
- "save_map",
- 0,
- 0,
- width,
- 0,
- g_gr->images().get("images/ui_basic/but1.png"),
- _("Save Map")),
- button_map_options_(&box_,
- "map_options",
- 0,
- 0,
- width,
- 0,
- g_gr->images().get("images/ui_basic/but1.png"),
- _("Map Options")),
- button_exit_editor_(&box_,
- "exit",
- 0,
- 0,
- width,
- 0,
- g_gr->images().get("images/ui_basic/but5.png"),
- _("Exit Editor")) {
+ button_load_map_(
+ &box_, "load_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Load Map")),
+ button_save_map_(
+ &box_, "save_map", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Save Map")),
+ button_map_options_(
+ &box_, "map_options", 0, 0, width, 0, UI::ButtonStyle::kWuiSecondary, _("Map Options")),
+ button_exit_editor_(
+ &box_, "exit", 0, 0, width, 0, UI::ButtonStyle::kWuiPrimary, _("Exit Editor")) {
box_.add(&button_new_map_);
box_.add(&button_new_random_map_);
box_.add(&button_load_map_);
=== modified file 'src/editor/ui_menus/main_menu_load_or_save_map.cc'
--- src/editor/ui_menus/main_menu_load_or_save_map.cc 2017-11-24 21:34:17 +0000
+++ src/editor/ui_menus/main_menu_load_or_save_map.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "base/wexception.h"
#include "editor/editorinteractive.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
#include "io/filesystem/layered_filesystem.h"
#include "map_io/widelands_map_loader.h"
@@ -49,13 +48,13 @@
right_column_x_(tablew_ + 2 * padding_),
butw_((get_inner_w() - right_column_x_ - 2 * padding_) / 2),
- table_(this, tablex_, tabley_, tablew_, tableh_),
+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kWui),
map_details_(this,
right_column_x_,
tabley_,
get_inner_w() - right_column_x_ - padding_,
tableh_,
- MapDetails::Style::kWui),
+ UI::PanelStyle::kWui),
directory_info_(this, padding_, get_inner_h() - 2 * buth_ - 4 * padding_),
ok_(this,
"ok",
@@ -64,7 +63,7 @@
get_inner_h() - padding_ - buth_,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("OK")),
cancel_(this,
"cancel",
@@ -73,7 +72,7 @@
get_inner_h() - padding_ - buth_,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")),
basedir_(basedir),
has_translated_mapname_(false),
@@ -82,9 +81,8 @@
curdir_ = basedir_;
UI::Box* vbox = new UI::Box(this, tablex_, padding_, UI::Box::Horizontal, padding_, get_w());
- show_mapnames_ =
- new UI::Button(vbox, "show_mapnames", 0, 0, 2 * butw_, buth_,
- g_gr->images().get("images/ui_basic/but1.png"), _("Show Map Names"));
+ show_mapnames_ = new UI::Button(vbox, "show_mapnames", 0, 0, 2 * butw_, buth_,
+ UI::ButtonStyle::kWuiSecondary, _("Show Map Names"));
vbox->add(show_mapnames_, UI::Box::Resizing::kFullSize);
cb_dont_localize_mapnames_ =
=== modified file 'src/editor/ui_menus/main_menu_map_options.cc'
--- src/editor/ui_menus/main_menu_map_options.cc 2017-12-14 09:02:31 +0000
+++ src/editor/ui_menus/main_menu_map_options.cc 2018-02-13 12:57:13 +0000
@@ -31,7 +31,6 @@
#include "logic/map.h"
#include "ui_basic/editbox.h"
#include "ui_basic/multilineeditbox.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "wui/map_tags.h"
@@ -56,7 +55,7 @@
get_inner_h() - padding_ - labelh_,
butw_,
labelh_,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("OK")),
cancel_(this,
"cancel",
@@ -64,26 +63,21 @@
get_inner_h() - padding_ - labelh_,
butw_,
labelh_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")),
tab_box_(this, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
- tabs_(&tab_box_, nullptr),
+ tabs_(&tab_box_, UI::TabPanelStyle::kWuiLight),
main_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
tags_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
teams_box_(&tabs_, padding_, padding_, UI::Box::Vertical, max_w_, get_inner_h(), 0),
- name_(&main_box_, 0, 0, max_w_, 0, 2, g_gr->images().get("images/ui_basic/but1.png")),
- author_(&main_box_, 0, 0, max_w_, 0, 2, g_gr->images().get("images/ui_basic/but1.png")),
+ name_(&main_box_, 0, 0, max_w_, 0, 2, UI::PanelStyle::kWui),
+ author_(&main_box_, 0, 0, max_w_, 0, 2, UI::PanelStyle::kWui),
size_(&main_box_, 0, 0, max_w_ - indent_, labelh_, ""),
- teams_list_(&teams_box_,
- 0,
- 0,
- max_w_,
- 60,
- g_gr->images().get("images/ui_basic/but1.png"),
- UI::ListselectLayout::kShowCheck),
+ teams_list_(
+ &teams_box_, 0, 0, max_w_, 60, UI::PanelStyle::kWui, UI::ListselectLayout::kShowCheck),
modal_(modal) {
@@ -98,13 +92,10 @@
// We need less space for the hint and the description, but it should at least have 1 line
// height.
- hint_ =
- new UI::MultilineEditbox(&main_box_, 0, 0, max_w_, std::max(labelh_, remaining_space * 1 / 3),
- "", g_gr->images().get("images/ui_basic/but1.png"),
- g_gr->images().get("images/ui_basic/but1.png"));
- descr_ = new UI::MultilineEditbox(&main_box_, 0, 0, max_w_, remaining_space - hint_->get_h(), "",
- g_gr->images().get("images/ui_basic/but1.png"),
- g_gr->images().get("images/ui_basic/but1.png"));
+ hint_ = new UI::MultilineEditbox(
+ &main_box_, 0, 0, max_w_, std::max(labelh_, remaining_space * 1 / 3), UI::PanelStyle::kWui);
+ descr_ = new UI::MultilineEditbox(
+ &main_box_, 0, 0, max_w_, remaining_space - hint_->get_h(), UI::PanelStyle::kWui);
main_box_.add(new UI::Textarea(&main_box_, 0, 0, max_w_, labelh_, _("Map name:")));
main_box_.add(&name_);
=== modified file 'src/editor/ui_menus/main_menu_new_map.cc'
--- src/editor/ui_menus/main_menu_new_map.cc 2017-08-19 22:22:20 +0000
+++ src/editor/ui_menus/main_menu_new_map.cc 2018-02-13 12:57:13 +0000
@@ -29,7 +29,6 @@
#include "base/macros.h"
#include "editor/editorinteractive.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "graphic/image.h"
#include "graphic/texture.h"
#include "logic/editor_game_base.h"
@@ -55,9 +54,9 @@
0,
0,
0,
+ UI::PanelStyle::kWui,
_("Width:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kValueList),
height_(&box_,
0,
@@ -67,11 +66,11 @@
0,
0,
0,
+ UI::PanelStyle::kWui,
_("Height:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kValueList),
- list_(&box_, 0, 0, box_width_, 330),
+ list_(&box_, 0, 0, box_width_, 330, UI::PanelStyle::kWui),
// Buttons
button_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
ok_button_(&button_box_,
@@ -80,7 +79,7 @@
0,
box_width_ / 2 - margin_,
0,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("Create Map")),
cancel_button_(&button_box_,
"generate_map",
@@ -88,7 +87,7 @@
0,
box_width_ / 2 - margin_,
0,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")) {
width_.set_value_list(Widelands::kMapDimensions);
height_.set_value_list(Widelands::kMapDimensions);
=== modified file 'src/editor/ui_menus/main_menu_random_map.cc'
--- src/editor/ui_menus/main_menu_random_map.cc 2017-12-14 09:02:31 +0000
+++ src/editor/ui_menus/main_menu_random_map.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,6 @@
#include "editor/editorinteractive.h"
#include "editor/map_generator.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "logic/editor_game_base.h"
#include "logic/map.h"
#include "logic/map_objects/world/world.h"
@@ -63,9 +62,9 @@
0,
0,
0,
+ UI::PanelStyle::kWui,
_("Width:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kValueList),
height_(&box_,
0,
@@ -75,9 +74,9 @@
0,
0,
0,
+ UI::PanelStyle::kWui,
_("Height:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kValueList),
max_players_(2),
players_(&box_,
@@ -88,9 +87,9 @@
2,
1,
max_players_,
+ UI::PanelStyle::kWui,
_("Players:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
// World + Resources
world_descriptions_({
@@ -123,7 +122,7 @@
0,
box_width_ - 2 * margin_ - std::max(world_label_.get_w(), resources_label_.get_w()),
label_height_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
world_descriptions_[current_world_].descname),
resources_(&resources_box_,
"resources",
@@ -131,7 +130,7 @@
0,
box_width_ - 2 * margin_ - std::max(world_label_.get_w(), resources_label_.get_w()),
label_height_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
resource_amounts_[resource_amount_].c_str()),
// Terrain
waterval_(20),
@@ -146,9 +145,9 @@
waterval_,
0,
60,
+ UI::PanelStyle::kWui,
_("Water:"),
UI::SpinBox::Units::kPercent,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall,
5),
land_(&box_,
@@ -159,9 +158,9 @@
landval_,
0,
100,
+ UI::PanelStyle::kWui,
_("Land:"),
UI::SpinBox::Units::kPercent,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall,
5),
wasteland_(&box_,
@@ -172,9 +171,9 @@
wastelandval_,
0,
70,
+ UI::PanelStyle::kWui,
_("Wasteland:"),
UI::SpinBox::Units::kPercent,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall,
5),
mountains_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
@@ -196,7 +195,7 @@
box_width_ - 2 * margin_ - map_number_label_.get_w(),
0,
2,
- g_gr->images().get("images/ui_basic/but1.png")),
+ UI::PanelStyle::kWui),
map_id_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
map_id_label_(&map_id_box_, 0, 0, _("Map ID:")),
map_id_edit_(&map_id_box_,
@@ -205,7 +204,7 @@
box_width_ - 2 * margin_ - map_id_label_.get_w(),
0,
2,
- g_gr->images().get("images/ui_basic/but1.png")),
+ UI::PanelStyle::kWui),
// Buttons
button_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, margin_),
ok_button_(&button_box_,
@@ -214,7 +213,7 @@
0,
box_width_ / 2 - margin_,
0,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("Generate Map")),
cancel_button_(&button_box_,
"generate_map",
@@ -222,7 +221,7 @@
0,
box_width_ / 2 - margin_,
0,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")) {
int32_t box_height = 0;
=== modified file 'src/editor/ui_menus/main_menu_save_map.cc'
--- src/editor/ui_menus/main_menu_save_map.cc 2017-12-16 10:48:12 +0000
+++ src/editor/ui_menus/main_menu_save_map.cc 2018-02-13 12:57:13 +0000
@@ -33,7 +33,6 @@
#include "editor/editorinteractive.h"
#include "editor/ui_menus/main_menu_map_options.h"
#include "editor/ui_menus/main_menu_save_map_make_directory.h"
-#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
#include "io/filesystem/layered_filesystem.h"
#include "io/filesystem/zip_filesystem.h"
@@ -58,7 +57,7 @@
tabley_ + tableh_ + 3 * padding_ - 1,
get_inner_w() - right_column_x_ - padding_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Make Directory")),
edit_options_(this,
"edit_options",
@@ -66,7 +65,7 @@
tabley_ + tableh_ - buth_,
get_inner_w() - right_column_x_ - padding_,
buth_,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("Map Options")),
editbox_label_(
this, padding_, tabley_ + tableh_ + 3 * padding_, butw_, buth_, _("Filename:")) {
@@ -79,10 +78,9 @@
table_.double_clicked.connect(
boost::bind(&MainMenuSaveMap::double_clicked_item, boost::ref(*this)));
- editbox_ =
- new UI::EditBox(this, editbox_label_.get_x() + editbox_label_.get_w() + padding_,
- editbox_label_.get_y(), tablew_ - editbox_label_.get_w() - padding_ + 1,
- buth_, 2, g_gr->images().get("images/ui_basic/but1.png"));
+ editbox_ = new UI::EditBox(
+ this, editbox_label_.get_x() + editbox_label_.get_w() + padding_, editbox_label_.get_y(),
+ tablew_ - editbox_label_.get_w() - padding_ + 1, buth_, 2, UI::PanelStyle::kWui);
editbox_->set_text(parent.egbase().map().get_name());
editbox_->changed.connect(boost::bind(&MainMenuSaveMap::edit_box_changed, this));
=== modified file 'src/editor/ui_menus/main_menu_save_map_make_directory.cc'
--- src/editor/ui_menus/main_menu_save_map_make_directory.cc 2017-02-26 12:16:09 +0000
+++ src/editor/ui_menus/main_menu_save_map_make_directory.cc 2018-02-13 12:57:13 +0000
@@ -21,7 +21,6 @@
#include "base/i18n.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "io/filesystem/layered_filesystem.h"
MainMenuSaveMapMakeDirectory::MainMenuSaveMapMakeDirectory(UI::Panel* const parent,
@@ -39,20 +38,14 @@
get_inner_h() - 3 * padding_ - buth_,
padding_ / 2),
label_(&vbox_, 0, 0, get_inner_w() - 2 * padding_, buth_, _("Enter Directory Name:")),
- edit_(&vbox_,
- 0,
- 0,
- get_inner_w() - 2 * padding_,
- 0,
- 4,
- g_gr->images().get("images/ui_basic/but1.png")),
+ edit_(&vbox_, 0, 0, get_inner_w() - 2 * padding_, 0, 4, UI::PanelStyle::kWui),
ok_button_(this,
"ok",
UI::g_fh1->fontset()->is_rtl() ? padding_ : get_inner_w() - butw_ - padding_,
get_inner_h() - padding_ - buth_,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but5.png"),
+ UI::ButtonStyle::kWuiPrimary,
_("OK")),
cancel_button_(this,
"cancel",
@@ -60,7 +53,7 @@
get_inner_h() - padding_ - buth_,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")) {
vbox_.add(&label_);
=== modified file 'src/editor/ui_menus/player_menu.cc'
--- src/editor/ui_menus/player_menu.cc 2017-12-02 12:43:38 +0000
+++ src/editor/ui_menus/player_menu.cc 2018-02-13 12:57:13 +0000
@@ -47,7 +47,7 @@
5,
20,
20,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/ui_basic/scrollbar_up.png"),
_("Add player")),
remove_last_player_(this,
@@ -56,7 +56,7 @@
5,
20,
20,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/ui_basic/scrollbar_down.png"),
_("Remove last player")),
tribenames_(Widelands::get_all_tribenames()) {
@@ -140,8 +140,7 @@
iterate_player_numbers(p, nr_players) {
int32_t posx = spacing;
if (!plr_names_[p - 1]) {
- plr_names_[p - 1] = new UI::EditBox(
- this, posx, posy, 140, size, 2, g_gr->images().get("images/ui_basic/but0.png"));
+ plr_names_[p - 1] = new UI::EditBox(this, posx, posy, 140, size, 2, UI::PanelStyle::kWui);
plr_names_[p - 1]->changed.connect(
boost::bind(&EditorPlayerMenu::name_changed, this, p - 1));
posx += 140 + spacing;
@@ -149,9 +148,8 @@
}
if (!plr_set_tribes_buts_[p - 1]) {
- plr_set_tribes_buts_[p - 1] =
- new UI::Button(this, "tribe", posx, posy, 140, size,
- g_gr->images().get("images/ui_basic/but0.png"), "");
+ plr_set_tribes_buts_[p - 1] = new UI::Button(
+ this, "tribe", posx, posy, 140, size, UI::ButtonStyle::kWuiSecondary, "");
plr_set_tribes_buts_[p - 1]->sigclicked.connect(
boost::bind(&EditorPlayerMenu::player_tribe_clicked, boost::ref(*this), p - 1));
posx += 140 + spacing;
@@ -174,9 +172,8 @@
// Set Starting pos button.
if (!plr_set_pos_buts_[p - 1]) {
- plr_set_pos_buts_[p - 1] =
- new UI::Button(this, "starting_pos", posx, posy, size, size,
- g_gr->images().get("images/ui_basic/but0.png"), nullptr, "");
+ plr_set_pos_buts_[p - 1] = new UI::Button(this, "starting_pos", posx, posy, size, size,
+ UI::ButtonStyle::kWuiSecondary, nullptr, "");
plr_set_pos_buts_[p - 1]->sigclicked.connect(
boost::bind(&EditorPlayerMenu::set_starting_pos_clicked, boost::ref(*this), p));
}
=== modified file 'src/editor/ui_menus/tool_change_height_options_menu.cc'
--- src/editor/ui_menus/tool_change_height_options_menu.cc 2017-12-14 09:02:31 +0000
+++ src/editor/ui_menus/tool_change_height_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "editor/editorinteractive.h"
#include "editor/tools/increase_height_tool.h"
#include "editor/tools/set_height_tool.h"
-#include "graphic/graphic.h"
#include "logic/widelands_geometry.h"
EditorToolChangeHeightOptionsMenu::EditorToolChangeHeightOptionsMenu(
@@ -44,9 +43,9 @@
increase_tool_.get_change_by(),
1,
MAX_FIELD_HEIGHT_DIFF,
+ UI::PanelStyle::kWui,
_("Increase/Decrease height by:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
set_to_(&box_,
0,
@@ -56,9 +55,9 @@
increase_tool_.set_tool().get_interval().min,
0,
MAX_FIELD_HEIGHT,
+ UI::PanelStyle::kWui,
_("Set height to:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall) {
change_by_.set_tooltip(
/** TRANSLATORS: Editor change height access keys. **/
=== modified file 'src/editor/ui_menus/tool_change_resources_options_menu.cc'
--- src/editor/ui_menus/tool_change_resources_options_menu.cc 2017-12-19 17:50:43 +0000
+++ src/editor/ui_menus/tool_change_resources_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -57,9 +57,9 @@
increase_tool_.get_change_by(),
1,
kMaxValue,
+ UI::PanelStyle::kWui,
_("Increase/Decrease amount by:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
set_to_(&box_,
0,
@@ -69,9 +69,9 @@
increase_tool_.set_tool().get_set_to(),
0,
kMaxValue,
+ UI::PanelStyle::kWui,
_("Set amount to:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
resources_box_(&box_, 0, 0, UI::Box::Horizontal, 0, 0, 1),
cur_selection_(&box_, 0, 0, "", UI::Align::kCenter) {
=== modified file 'src/editor/ui_menus/tool_noise_height_options_menu.cc'
--- src/editor/ui_menus/tool_noise_height_options_menu.cc 2017-12-14 10:29:30 +0000
+++ src/editor/ui_menus/tool_noise_height_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "editor/tools/decrease_height_tool.h"
#include "editor/tools/increase_height_tool.h"
#include "editor/tools/noise_height_tool.h"
-#include "graphic/graphic.h"
#include "logic/widelands_geometry.h"
#include "ui_basic/textarea.h"
@@ -47,9 +46,9 @@
noise_tool_.get_interval().min,
1,
MAX_FIELD_HEIGHT,
+ UI::PanelStyle::kWui,
_("Minimum height:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
upper_(&box_,
0,
@@ -59,9 +58,9 @@
noise_tool_.get_interval().max,
0,
MAX_FIELD_HEIGHT,
+ UI::PanelStyle::kWui,
_("Maximum height:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall),
set_to_(&box_,
0,
@@ -71,9 +70,9 @@
noise_tool_.set_tool().get_interval().min,
0,
MAX_FIELD_HEIGHT,
+ UI::PanelStyle::kWui,
_("Set height to:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::SpinBox::Type::kSmall) {
lower_.set_tooltip(
/** TRANSLATORS: Editor random height access key. **/
=== modified file 'src/editor/ui_menus/tool_place_critter_options_menu.cc'
--- src/editor/ui_menus/tool_place_critter_options_menu.cc 2017-05-14 14:40:24 +0000
+++ src/editor/ui_menus/tool_place_critter_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include "base/i18n.h"
#include "editor/editorinteractive.h"
#include "editor/tools/place_critter_tool.h"
-#include "graphic/graphic.h"
#include "logic/map.h"
#include "logic/map_objects/world/critter.h"
#include "logic/map_objects/world/world.h"
=== modified file 'src/editor/ui_menus/tool_place_immovable_options_menu.cc'
--- src/editor/ui_menus/tool_place_immovable_options_menu.cc 2017-05-14 14:40:24 +0000
+++ src/editor/ui_menus/tool_place_immovable_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include "base/i18n.h"
#include "editor/editorinteractive.h"
#include "editor/tools/place_immovable_tool.h"
-#include "graphic/graphic.h"
#include "logic/map.h"
#include "logic/map_objects/world/world.h"
#include "ui_basic/box.h"
=== modified file 'src/editor/ui_menus/tool_set_terrain_options_menu.cc'
--- src/editor/ui_menus/tool_set_terrain_options_menu.cc 2017-05-25 12:30:40 +0000
+++ src/editor/ui_menus/tool_set_terrain_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -27,7 +27,6 @@
#include "base/i18n.h"
#include "editor/editorinteractive.h"
#include "editor/tools/set_terrain_tool.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "graphic/texture.h"
#include "logic/map.h"
@@ -36,7 +35,6 @@
#include "logic/map_objects/world/world.h"
#include "ui_basic/checkbox.h"
#include "ui_basic/panel.h"
-#include "ui_basic/tabpanel.h"
namespace {
=== modified file 'src/editor/ui_menus/toolsize_menu.cc'
--- src/editor/ui_menus/toolsize_menu.cc 2017-02-23 19:38:51 +0000
+++ src/editor/ui_menus/toolsize_menu.cc 2018-02-13 12:57:13 +0000
@@ -45,7 +45,7 @@
25,
20,
20,
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/ui_basic/scrollbar_up.png")),
decrease_(this,
"decr",
@@ -53,7 +53,7 @@
25,
20,
20,
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/ui_basic/scrollbar_down.png")),
value_(0) {
increase_.sigclicked.connect(
=== modified file 'src/game_io/CMakeLists.txt'
--- src/game_io/CMakeLists.txt 2017-11-20 13:50:51 +0000
+++ src/game_io/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -29,7 +29,6 @@
base_time_string
build_info
economy
- graphic
graphic_image_io
graphic_minimap_renderer
io_fileread
=== modified file 'src/game_io/game_preload_packet.cc'
--- src/game_io/game_preload_packet.cc 2017-11-10 09:31:46 +0000
+++ src/game_io/game_preload_packet.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "base/time_string.h"
#include "build_info.h"
-#include "graphic/graphic.h"
#include "graphic/image_io.h"
#include "graphic/minimap_renderer.h"
#include "logic/game.h"
=== modified file 'src/graphic/CMakeLists.txt'
--- src/graphic/CMakeLists.txt 2017-09-01 15:45:59 +0000
+++ src/graphic/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -5,6 +5,16 @@
# Align and color
+
+wl_library(graphic_styles
+ SRCS
+ panel_styles.cc
+ panel_styles.h
+ DEPENDS
+ graphic_color
+ graphic_surface
+)
+
wl_library(graphic_align
SRCS
align.h
@@ -115,7 +125,6 @@
base_geometry
base_log
base_macros
- graphic
graphic_color
graphic_draw_programs
graphic_gl_utils
@@ -195,7 +204,6 @@
base_geometry
base_macros
economy
- graphic
graphic_surface
logic
wui_mapview_pixelfunctions
@@ -228,7 +236,6 @@
base_geometry
base_log
base_macros
- graphic
graphic_fields_to_draw
graphic_gl_utils
graphic_image_io
@@ -330,6 +337,8 @@
diranimations.h
graphic.cc
graphic.h
+ style_manager.cc
+ style_manager.h
rendertarget.cc
rendertarget.h
USES_SDL2
@@ -349,6 +358,7 @@
graphic_image_io
graphic_playercolor
graphic_render_queue
+ graphic_styles
graphic_surface
graphic_text_layout
io_filesystem
@@ -356,6 +366,7 @@
logic_constants
note_sound
notifications
+ scripting_lua_interface
scripting_lua_table
sound
)
=== modified file 'src/graphic/gl/road_program.cc'
--- src/graphic/gl/road_program.cc 2017-08-27 20:25:47 +0000
+++ src/graphic/gl/road_program.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "graphic/gl/coordinate_conversion.h"
#include "graphic/gl/fields_to_draw.h"
#include "graphic/gl/utils.h"
-#include "graphic/graphic.h"
#include "graphic/image_io.h"
#include "graphic/texture.h"
#include "logic/player.h"
=== modified file 'src/graphic/graphic.cc'
--- src/graphic/graphic.cc 2017-08-09 17:53:24 +0000
+++ src/graphic/graphic.cc 2018-02-13 12:57:13 +0000
@@ -35,6 +35,7 @@
#include "graphic/render_queue.h"
#include "graphic/rendertarget.h"
#include "graphic/screen.h"
+#include "graphic/style_manager.h"
#include "graphic/text_layout.h"
#include "graphic/texture.h"
#include "io/filesystem/layered_filesystem.h"
@@ -59,7 +60,10 @@
} // namespace
-Graphic::Graphic() : image_cache_(new ImageCache()), animation_manager_(new AnimationManager()) {
+Graphic::Graphic()
+ : image_cache_(new ImageCache()),
+ animation_manager_(new AnimationManager()),
+ style_manager_(new StyleManager()) {
}
/**
@@ -112,6 +116,7 @@
auto texture_atlases = build_texture_atlas(max_texture_size_, &textures_in_atlas);
image_cache_->fill_with_texture_atlases(
std::move(texture_atlases), std::move(textures_in_atlas));
+ styles().init();
}
Graphic::~Graphic() {
=== modified file 'src/graphic/graphic.h'
--- src/graphic/graphic.h 2017-08-09 17:53:24 +0000
+++ src/graphic/graphic.h 2018-02-13 12:57:13 +0000
@@ -25,10 +25,12 @@
#include <SDL.h>
#include "graphic/image_cache.h"
+#include "graphic/style_manager.h"
#include "notifications/note_ids.h"
#include "notifications/notifications.h"
class AnimationManager;
+class StyleManager;
class RenderTarget;
class Screen;
class StreamWrite;
@@ -90,6 +92,9 @@
AnimationManager& animations() const {
return *animation_manager_.get();
}
+ StyleManager& styles() const {
+ return *style_manager_.get();
+ }
// Requests a screenshot being taken on the next frame.
void screenshot(const std::string& fname);
@@ -124,6 +129,9 @@
/// This holds all animations.
std::unique_ptr<AnimationManager> animation_manager_;
+ /// This holds all GUI styles.
+ std::unique_ptr<StyleManager> style_manager_;
+
/// Screenshot filename. If a screenshot is requested, this will be set to
/// the requested filename. On the next frame the screenshot will be written
/// out and this will be clear()ed again.
=== modified file 'src/graphic/minimap_renderer.cc'
--- src/graphic/minimap_renderer.cc 2017-08-31 08:48:25 +0000
+++ src/graphic/minimap_renderer.cc 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include "base/macros.h"
#include "economy/flag.h"
#include "economy/road.h"
-#include "graphic/graphic.h"
#include "logic/field.h"
#include "logic/map_objects/world/terrain_description.h"
#include "logic/map_objects/world/world.h"
=== added file 'src/graphic/panel_styles.cc'
--- src/graphic/panel_styles.cc 1970-01-01 00:00:00 +0000
+++ src/graphic/panel_styles.cc 2018-02-13 12:57:13 +0000
@@ -0,0 +1,1 @@
+// Dummy to make CMake happy
=== added file 'src/graphic/panel_styles.h'
--- src/graphic/panel_styles.h 1970-01-01 00:00:00 +0000
+++ src/graphic/panel_styles.h 2018-02-13 12:57:13 +0000
@@ -0,0 +1,57 @@
+/*
+ * Copyright (C) 2017 by the Widelands Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ */
+
+#ifndef WL_GRAPHIC_PANEL_STYLES_H
+#define WL_GRAPHIC_PANEL_STYLES_H
+
+#include "graphic/color.h"
+#include "graphic/image.h"
+
+namespace UI {
+
+// Buttons
+enum class ButtonStyle {
+ kFsMenuMenu,
+ kFsMenuPrimary,
+ kFsMenuSecondary,
+ kWuiMenu,
+ kWuiPrimary,
+ kWuiSecondary,
+ kWuiBuildingStats
+};
+enum class SliderStyle { kFsMenu, kWuiLight, kWuiDark };
+
+// Backgrounds
+enum class PanelStyle { kFsMenu, kWui };
+enum class TabPanelStyle { kFsMenu, kWuiLight, kWuiDark };
+
+struct PanelStyleInfo {
+ PanelStyleInfo(const Image* init_image, const RGBAColor& init_color)
+ : image(init_image), color(init_color) {
+ }
+ PanelStyleInfo() : PanelStyleInfo(nullptr, RGBAColor(0, 0, 0, 0)) {
+ }
+
+ const Image* image;
+ const RGBAColor color;
+};
+
+} // namespace UI
+
+#endif // end of include guard: WL_GRAPHIC_PANEL_STYLES_H
=== added file 'src/graphic/style_manager.cc'
--- src/graphic/style_manager.cc 1970-01-01 00:00:00 +0000
+++ src/graphic/style_manager.cc 2018-02-13 12:57:13 +0000
@@ -0,0 +1,173 @@
+/*
+ * Copyright (C) 2017 by the Widelands Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#include "graphic/style_manager.h"
+
+#include <memory>
+
+#include "base/wexception.h"
+#include "graphic/graphic.h"
+#include "scripting/lua_interface.h"
+
+namespace {
+// Read image filename and RGB color from LuaTable
+UI::PanelStyleInfo* read_style(const LuaTable& table) {
+ const std::string image = table.get_string("image");
+ std::vector<int> rgbcolor = table.get_table("color")->array_entries<int>();
+ if (rgbcolor.size() != 3) {
+ throw wexception("Expected 3 entries for RGB color, but got %" PRIuS ".", rgbcolor.size());
+ }
+ return new UI::PanelStyleInfo(image.empty() ? nullptr : g_gr->images().get(image),
+ RGBAColor(rgbcolor[0], rgbcolor[1], rgbcolor[2], 0));
+}
+
+// Stupid completeness check - enum classes weren't meant for iterating, so we just compare the size
+// to the last enum member. This assumes that there are no holes in the enum, and will need
+// adjusting if the last enum member changes.
+void check_completeness(const std::string& name, size_t map_size, size_t last_enum_member) {
+ if (map_size != last_enum_member + 1) {
+ throw wexception("StyleManager: There is a definition missing for the '%s'.", name.c_str());
+ }
+}
+} // namespace
+
+void StyleManager::init() {
+ buttonstyles_.clear();
+ sliderstyles_.clear();
+ tabpanelstyles_.clear();
+ editboxstyles_.clear();
+ dropdownstyles_.clear();
+ scrollbarstyles_.clear();
+
+ LuaInterface lua;
+ std::unique_ptr<LuaTable> table(lua.run_script(kTemplateDir + "init.lua"));
+
+ // Buttons
+ std::unique_ptr<LuaTable> element_table = table->get_table("buttons");
+ std::unique_ptr<LuaTable> style_table = element_table->get_table("fsmenu");
+ add_button_style(UI::ButtonStyle::kFsMenuMenu, *style_table->get_table("menu").get());
+ add_button_style(UI::ButtonStyle::kFsMenuPrimary, *style_table->get_table("primary").get());
+ add_button_style(UI::ButtonStyle::kFsMenuSecondary, *style_table->get_table("secondary").get());
+ style_table = element_table->get_table("wui");
+ add_button_style(UI::ButtonStyle::kWuiMenu, *style_table->get_table("menu").get());
+ add_button_style(UI::ButtonStyle::kWuiPrimary, *style_table->get_table("primary").get());
+ add_button_style(UI::ButtonStyle::kWuiSecondary, *style_table->get_table("secondary").get());
+ add_button_style(
+ UI::ButtonStyle::kWuiBuildingStats, *style_table->get_table("building_stats").get());
+ check_completeness(
+ "buttons", buttonstyles_.size(), static_cast<size_t>(UI::ButtonStyle::kWuiBuildingStats));
+
+ // Sliders
+ element_table = table->get_table("sliders");
+ style_table = element_table->get_table("fsmenu");
+ add_slider_style(UI::SliderStyle::kFsMenu, *style_table->get_table("menu").get());
+ style_table = element_table->get_table("wui");
+ add_slider_style(UI::SliderStyle::kWuiLight, *style_table->get_table("light").get());
+ add_slider_style(UI::SliderStyle::kWuiDark, *style_table->get_table("dark").get());
+ check_completeness(
+ "sliders", sliderstyles_.size(), static_cast<size_t>(UI::SliderStyle::kWuiDark));
+
+ // Tabpanels
+ element_table = table->get_table("tabpanels");
+ style_table = element_table->get_table("fsmenu");
+ add_tabpanel_style(UI::TabPanelStyle::kFsMenu, *style_table->get_table("menu").get());
+ style_table = element_table->get_table("wui");
+ add_tabpanel_style(UI::TabPanelStyle::kWuiLight, *style_table->get_table("light").get());
+ add_tabpanel_style(UI::TabPanelStyle::kWuiDark, *style_table->get_table("dark").get());
+ check_completeness(
+ "tabpanels", tabpanelstyles_.size(), static_cast<size_t>(UI::TabPanelStyle::kWuiDark));
+
+ // Editboxes
+ element_table = table->get_table("editboxes");
+ style_table = element_table->get_table("fsmenu");
+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &editboxstyles_);
+ style_table = element_table->get_table("wui");
+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &editboxstyles_);
+ check_completeness(
+ "editboxes", editboxstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
+
+ // Dropdowns
+ element_table = table->get_table("dropdowns");
+ style_table = element_table->get_table("fsmenu");
+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &dropdownstyles_);
+ style_table = element_table->get_table("wui");
+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &dropdownstyles_);
+ check_completeness(
+ "dropdowns", dropdownstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
+
+ // Scrollbars
+ element_table = table->get_table("scrollbars");
+ style_table = element_table->get_table("fsmenu");
+ add_style(UI::PanelStyle::kFsMenu, *style_table->get_table("menu").get(), &scrollbarstyles_);
+ style_table = element_table->get_table("wui");
+ add_style(UI::PanelStyle::kWui, *style_table->get_table("menu").get(), &scrollbarstyles_);
+ check_completeness(
+ "scrollbars", scrollbarstyles_.size(), static_cast<size_t>(UI::PanelStyle::kWui));
+}
+
+// Return functions for the styles
+const UI::PanelStyleInfo* StyleManager::button_style(UI::ButtonStyle style) const {
+ assert(buttonstyles_.count(style) == 1);
+ return buttonstyles_.at(style).get();
+}
+
+const UI::PanelStyleInfo* StyleManager::slider_style(UI::SliderStyle style) const {
+ assert(sliderstyles_.count(style) == 1);
+ return sliderstyles_.at(style).get();
+}
+
+const UI::PanelStyleInfo* StyleManager::tabpanel_style(UI::TabPanelStyle style) const {
+ assert(tabpanelstyles_.count(style) == 1);
+ return tabpanelstyles_.at(style).get();
+}
+
+const UI::PanelStyleInfo* StyleManager::editbox_style(UI::PanelStyle style) const {
+ assert(editboxstyles_.count(style) == 1);
+ return editboxstyles_.at(style).get();
+}
+
+const UI::PanelStyleInfo* StyleManager::dropdown_style(UI::PanelStyle style) const {
+ assert(dropdownstyles_.count(style) == 1);
+ return dropdownstyles_.at(style).get();
+}
+
+const UI::PanelStyleInfo* StyleManager::scrollbar_style(UI::PanelStyle style) const {
+ assert(scrollbarstyles_.count(style) == 1);
+ return scrollbarstyles_.at(style).get();
+}
+
+// Fill the maps
+void StyleManager::add_button_style(UI::ButtonStyle style, const LuaTable& table) {
+ buttonstyles_.insert(
+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
+}
+
+void StyleManager::add_slider_style(UI::SliderStyle style, const LuaTable& table) {
+ sliderstyles_.insert(
+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
+}
+
+void StyleManager::add_tabpanel_style(UI::TabPanelStyle style, const LuaTable& table) {
+ tabpanelstyles_.insert(
+ std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
+}
+
+void StyleManager::add_style(UI::PanelStyle style, const LuaTable& table, PanelStyleMap* map) {
+ map->insert(std::make_pair(style, std::unique_ptr<UI::PanelStyleInfo>(read_style(table))));
+}
=== added file 'src/graphic/style_manager.h'
--- src/graphic/style_manager.h 1970-01-01 00:00:00 +0000
+++ src/graphic/style_manager.h 2018-02-13 12:57:13 +0000
@@ -0,0 +1,63 @@
+/*
+ * Copyright (C) 2017 by the Widelands Development Team
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of the GNU General Public License
+ * as published by the Free Software Foundation; either version 2
+ * of the License, or (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
+ *
+ */
+
+#ifndef WL_GRAPHIC_STYLE_MANAGER_H
+#define WL_GRAPHIC_STYLE_MANAGER_H
+
+#include <map>
+#include <memory>
+
+#include "graphic/panel_styles.h"
+#include "scripting/lua_table.h"
+
+static const std::string kTemplateDir = "templates/default/";
+
+class StyleManager {
+public:
+ StyleManager() = default;
+ ~StyleManager() = default;
+
+ // Late initialization, because Graphics needs to load the image files first.
+ void init();
+
+ const UI::PanelStyleInfo* button_style(UI::ButtonStyle) const;
+ const UI::PanelStyleInfo* slider_style(UI::SliderStyle) const;
+ const UI::PanelStyleInfo* tabpanel_style(UI::TabPanelStyle) const;
+ const UI::PanelStyleInfo* editbox_style(UI::PanelStyle) const;
+ const UI::PanelStyleInfo* dropdown_style(UI::PanelStyle) const;
+ const UI::PanelStyleInfo* scrollbar_style(UI::PanelStyle) const;
+
+private:
+ using PanelStyleMap = std::map<UI::PanelStyle, std::unique_ptr<const UI::PanelStyleInfo>>;
+ void add_button_style(UI::ButtonStyle style, const LuaTable& table);
+ void add_slider_style(UI::SliderStyle style, const LuaTable& table);
+ void add_tabpanel_style(UI::TabPanelStyle style, const LuaTable& table);
+ void add_style(UI::PanelStyle style, const LuaTable& table, PanelStyleMap* map);
+
+ std::map<UI::ButtonStyle, std::unique_ptr<const UI::PanelStyleInfo>> buttonstyles_;
+ std::map<UI::SliderStyle, std::unique_ptr<const UI::PanelStyleInfo>> sliderstyles_;
+ std::map<UI::TabPanelStyle, std::unique_ptr<const UI::PanelStyleInfo>> tabpanelstyles_;
+ PanelStyleMap editboxstyles_;
+ PanelStyleMap dropdownstyles_;
+ PanelStyleMap scrollbarstyles_;
+
+ DISALLOW_COPY_AND_ASSIGN(StyleManager);
+};
+
+#endif // end of include guard: WL_GRAPHIC_STYLE_MANAGER_H
=== modified file 'src/graphic/texture.cc'
--- src/graphic/texture.cc 2017-05-21 14:52:14 +0000
+++ src/graphic/texture.cc 2018-02-13 12:57:13 +0000
@@ -30,7 +30,6 @@
#include "graphic/gl/draw_line_program.h"
#include "graphic/gl/fill_rect_program.h"
#include "graphic/gl/utils.h"
-#include "graphic/graphic.h"
#include "graphic/sdl_utils.h"
#include "graphic/surface.h"
=== modified file 'src/logic/CMakeLists.txt'
--- src/logic/CMakeLists.txt 2017-12-19 07:12:18 +0000
+++ src/logic/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -265,7 +265,6 @@
base_time_string
build_info
economy
- editor
game_io
graphic
graphic_color
=== modified file 'src/logic/editor_game_base.cc'
--- src/logic/editor_game_base.cc 2017-11-11 18:59:55 +0000
+++ src/logic/editor_game_base.cc 2018-02-13 12:57:13 +0000
@@ -30,7 +30,6 @@
#include "economy/flag.h"
#include "economy/road.h"
#include "graphic/color.h"
-#include "graphic/graphic.h"
#include "logic/findimmovable.h"
#include "logic/game.h"
#include "logic/game_data_error.h"
=== modified file 'src/logic/game.cc'
--- src/logic/game.cc 2018-01-14 17:23:18 +0000
+++ src/logic/game.cc 2018-02-13 12:57:13 +0000
@@ -40,7 +40,6 @@
#include "economy/economy.h"
#include "game_io/game_loader.h"
#include "game_io/game_preload_packet.h"
-#include "graphic/graphic.h"
#include "io/fileread.h"
#include "io/filesystem/layered_filesystem.h"
#include "io/filewrite.h"
=== modified file 'src/logic/map.cc'
--- src/logic/map.cc 2017-12-31 18:46:49 +0000
+++ src/logic/map.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,6 @@
#include "build_info.h"
#include "economy/flag.h"
#include "economy/road.h"
-#include "editor/tools/increase_resources_tool.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/filesystem_constants.h"
#include "logic/findimmovable.h"
=== modified file 'src/logic/map_objects/bob.cc'
--- src/logic/map_objects/bob.cc 2017-09-22 09:26:28 +0000
+++ src/logic/map_objects/bob.cc 2018-02-13 12:57:13 +0000
@@ -29,7 +29,6 @@
#include "base/wexception.h"
#include "economy/route.h"
#include "economy/transfer.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "io/fileread.h"
#include "io/filewrite.h"
=== modified file 'src/logic/map_objects/map_object.h'
--- src/logic/map_objects/map_object.h 2018-01-23 00:23:13 +0000
+++ src/logic/map_objects/map_object.h 2018-02-13 12:57:13 +0000
@@ -39,13 +39,11 @@
#include "logic/map_objects/tribes/training_attribute.h"
#include "logic/widelands.h"
#include "scripting/lua_table.h"
+#include "ui_basic/tabpanel.h"
class FileRead;
class RenderTarget;
struct DirAnimations;
-namespace UI {
-struct TabPanel;
-}
namespace Widelands {
=== modified file 'src/logic/map_objects/tribes/building.cc'
--- src/logic/map_objects/tribes/building.cc 2018-01-11 11:40:45 +0000
+++ src/logic/map_objects/tribes/building.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,6 @@
#include "economy/flag.h"
#include "economy/input_queue.h"
#include "economy/request.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "graphic/text_constants.h"
#include "io/filesystem/filesystem.h"
=== modified file 'src/logic/map_objects/tribes/dismantlesite.cc'
--- src/logic/map_objects/tribes/dismantlesite.cc 2017-12-17 17:47:34 +0000
+++ src/logic/map_objects/tribes/dismantlesite.cc 2018-02-13 12:57:13 +0000
@@ -28,7 +28,6 @@
#include "base/wexception.h"
#include "economy/wares_queue.h"
#include "graphic/animation.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "graphic/text_constants.h"
#include "logic/editor_game_base.h"
=== modified file 'src/logic/map_objects/tribes/production_program.cc'
--- src/logic/map_objects/tribes/production_program.cc 2017-12-02 11:41:19 +0000
+++ src/logic/map_objects/tribes/production_program.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,6 @@
#include "economy/economy.h"
#include "economy/flag.h"
#include "economy/input_queue.h"
-#include "graphic/graphic.h"
#include "helper.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/findimmovable.h"
=== modified file 'src/logic/map_objects/tribes/ship.cc'
--- src/logic/map_objects/tribes/ship.cc 2017-11-01 18:09:04 +0000
+++ src/logic/map_objects/tribes/ship.cc 2018-02-13 12:57:13 +0000
@@ -30,7 +30,6 @@
#include "economy/fleet.h"
#include "economy/portdock.h"
#include "economy/wares_queue.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "graphic/text_constants.h"
#include "io/fileread.h"
=== modified file 'src/logic/map_objects/tribes/ware_descr.cc'
--- src/logic/map_objects/tribes/ware_descr.cc 2017-11-12 14:54:46 +0000
+++ src/logic/map_objects/tribes/ware_descr.cc 2018-02-13 12:57:13 +0000
@@ -25,7 +25,6 @@
#include "base/i18n.h"
#include "graphic/animation.h"
-#include "graphic/graphic.h"
#include "logic/game_data_error.h"
#include "logic/map_objects/tribes/tribe_descr.h"
=== modified file 'src/logic/map_objects/tribes/worker_descr.cc'
--- src/logic/map_objects/tribes/worker_descr.cc 2017-11-12 16:30:35 +0000
+++ src/logic/map_objects/tribes/worker_descr.cc 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include "base/i18n.h"
#include "base/vector.h"
#include "base/wexception.h"
-#include "graphic/graphic.h"
#include "logic/game_data_error.h"
#include "logic/map_objects/tribes/carrier.h"
#include "logic/map_objects/tribes/soldier.h"
=== modified file 'src/logic/map_objects/tribes/worker_program.cc'
--- src/logic/map_objects/tribes/worker_program.cc 2018-01-27 11:19:12 +0000
+++ src/logic/map_objects/tribes/worker_program.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include <string>
#include "base/log.h"
-#include "graphic/graphic.h"
#include "helper.h"
#include "logic/findnode.h"
#include "logic/game_data_error.h"
=== modified file 'src/logic/map_objects/world/critter.cc'
--- src/logic/map_objects/world/critter.cc 2017-01-25 18:55:59 +0000
+++ src/logic/map_objects/world/critter.cc 2018-02-13 12:57:13 +0000
@@ -27,7 +27,6 @@
#include <stdint.h>
#include "base/wexception.h"
-#include "graphic/graphic.h"
#include "helper.h"
#include "io/fileread.h"
#include "io/filewrite.h"
=== modified file 'src/logic/map_objects/world/terrain_description.h'
--- src/logic/map_objects/world/terrain_description.h 2017-06-24 08:47:46 +0000
+++ src/logic/map_objects/world/terrain_description.h 2018-02-13 12:57:13 +0000
@@ -26,7 +26,7 @@
#include "base/macros.h"
#include "graphic/color.h"
-#include "graphic/graphic.h"
+#include "graphic/image.h"
#include "logic/map_objects/world/resource_description.h"
#include "logic/widelands.h"
=== modified file 'src/logic/map_objects/world/world.cc'
--- src/logic/map_objects/world/world.cc 2017-01-25 18:55:59 +0000
+++ src/logic/map_objects/world/world.cc 2018-02-13 12:57:13 +0000
@@ -22,6 +22,7 @@
#include <memory>
#include "base/i18n.h"
+#include "graphic/graphic.h"
#include "graphic/image_io.h"
#include "logic/game_data_error.h"
#include "logic/map_objects/immovable.h"
=== modified file 'src/map_io/map_building_packet.cc'
--- src/map_io/map_building_packet.cc 2017-09-01 18:59:42 +0000
+++ src/map_io/map_building_packet.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include "base/macros.h"
#include "economy/request.h"
-#include "graphic/graphic.h"
#include "io/fileread.h"
#include "io/filewrite.h"
#include "logic/editor_game_base.h"
=== modified file 'src/scripting/CMakeLists.txt'
--- src/scripting/CMakeLists.txt 2017-11-20 13:50:51 +0000
+++ src/scripting/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -104,7 +104,6 @@
base_log
base_macros
economy
- graphic
io_fileread
io_filesystem
logic
=== modified file 'src/scripting/lua_map.cc'
--- src/scripting/lua_map.cc 2018-01-23 00:23:13 +0000
+++ src/scripting/lua_map.cc 2018-02-13 12:57:13 +0000
@@ -27,7 +27,6 @@
#include "base/macros.h"
#include "base/wexception.h"
#include "economy/input_queue.h"
-#include "graphic/graphic.h"
#include "logic/findimmovable.h"
#include "logic/map_objects/checkstep.h"
#include "logic/map_objects/immovable.h"
=== modified file 'src/sound/CMakeLists.txt'
--- src/sound/CMakeLists.txt 2017-03-04 11:40:59 +0000
+++ src/sound/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -22,7 +22,6 @@
DEPENDS
base_i18n
base_log
- graphic
helper
io_fileread
io_filesystem
=== modified file 'src/sound/sound_handler.cc'
--- src/sound/sound_handler.cc 2017-08-16 04:31:56 +0000
+++ src/sound/sound_handler.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,6 @@
#include "base/i18n.h"
#include "base/log.h"
-#include "graphic/graphic.h"
#include "helper.h"
#include "io/fileread.h"
#include "io/filesystem/layered_filesystem.h"
=== modified file 'src/ui_basic/CMakeLists.txt'
--- src/ui_basic/CMakeLists.txt 2017-02-28 20:07:07 +0000
+++ src/ui_basic/CMakeLists.txt 2018-02-13 12:57:13 +0000
@@ -65,6 +65,7 @@
graphic_color
graphic_fonthandler
graphic_fonthandler_legacy
+ graphic_styles
graphic_surface
graphic_text
graphic_text_constants
=== modified file 'src/ui_basic/box.cc'
--- src/ui_basic/box.cc 2017-12-17 03:57:22 +0000
+++ src/ui_basic/box.cc 2018-02-13 12:57:13 +0000
@@ -195,9 +195,9 @@
pagesize = get_inner_h() - Scrollbar::kSize;
}
if (scrollbar_ == nullptr) {
- scrollbar_.reset(new Scrollbar(this, sb_x, sb_y, sb_w, sb_h,
- g_gr->images().get("images/ui_basic/but3.png"),
- orientation_ == Horizontal));
+ // TODO(GunChleoc): Implement styling if we ever use the scrollbar function.
+ scrollbar_.reset(new Scrollbar(
+ this, sb_x, sb_y, sb_w, sb_h, UI::PanelStyle::kFsMenu, orientation_ == Horizontal));
scrollbar_->moved.connect(boost::bind(&Box::scrollbar_moved, this, _1));
} else {
scrollbar_->set_pos(Vector2i(sb_x, sb_y));
=== modified file 'src/ui_basic/button.cc'
--- src/ui_basic/button.cc 2017-05-21 18:15:17 +0000
+++ src/ui_basic/button.cc 2018-02-13 12:57:13 +0000
@@ -20,8 +20,10 @@
#include "ui_basic/button.h"
#include "graphic/font_handler1.h"
+#include "graphic/graphic.h"
#include "graphic/image.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_constants.h"
#include "graphic/text_layout.h"
#include "ui_basic/mouse_constants.h"
@@ -32,6 +34,36 @@
// size.
constexpr int kButtonImageMargin = 2;
+Button::Button // Common constructor
+ (Panel* const parent,
+ const std::string& name,
+ int32_t const x,
+ int32_t const y,
+ uint32_t const w,
+ uint32_t const h,
+ UI::ButtonStyle style,
+ const Image* title_image,
+ const std::string& title_text,
+ const std::string& tooltip_text,
+ UI::Button::VisualState init_state,
+ ImageMode mode)
+ : NamedPanel(parent, name, x, y, w, h, tooltip_text),
+ highlighted_(false),
+ pressed_(false),
+ enabled_(true),
+ visual_state_(init_state),
+ disable_style_(ButtonDisableStyle::kMonochrome),
+ repeating_(false),
+ image_mode_(mode),
+ time_nextact_(0),
+ title_(title_text),
+ title_image_(title_image),
+ background_style_(g_gr->styles().button_style(style)),
+ clr_down_(229, 161, 2) {
+ set_thinks(false);
+ set_can_focus(true);
+}
+
Button::Button // for textual buttons. If h = 0, h will resize according to the font's height.
(Panel* const parent,
const std::string& name,
@@ -39,31 +71,28 @@
int32_t const y,
uint32_t const w,
uint32_t const h,
- const Image* bg_pic,
+ UI::ButtonStyle style,
const std::string& title_text,
const std::string& tooltip_text,
- UI::Button::Style init_style)
- : NamedPanel(parent, name, x, y, w, h, tooltip_text),
- highlighted_(false),
- pressed_(false),
- enabled_(true),
- style_(init_style),
- disable_style_(ButtonDisableStyle::kMonochrome),
- repeating_(false),
- image_mode_(UI::Button::ImageMode::kShrink),
- time_nextact_(0),
- title_(title_text),
- pic_background_(bg_pic),
- pic_custom_(nullptr),
- clr_down_(229, 161, 2) {
+ UI::Button::VisualState init_state)
+ : Button(parent,
+ name,
+ x,
+ y,
+ w,
+ h,
+ style,
+ nullptr,
+ title_text,
+ tooltip_text,
+ init_state,
+ UI::Button::ImageMode::kShrink) {
// Automatically resize for font height and give it a margin.
if (h < 1) {
int new_height = text_height() + 4;
set_desired_size(w, new_height);
set_size(w, new_height);
}
- set_thinks(false);
- set_can_focus(true);
}
Button::Button // for pictorial buttons
@@ -73,25 +102,12 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
- const Image* bg_pic,
- const Image* fg_pic,
+ UI::ButtonStyle style,
+ const Image* title_image,
const std::string& tooltip_text,
- UI::Button::Style init_style,
+ UI::Button::VisualState init_state,
ImageMode mode)
- : NamedPanel(parent, name, x, y, w, h, tooltip_text),
- highlighted_(false),
- pressed_(false),
- enabled_(true),
- style_(init_style),
- disable_style_(ButtonDisableStyle::kMonochrome),
- repeating_(false),
- image_mode_(mode),
- time_nextact_(0),
- pic_background_(bg_pic),
- pic_custom_(fg_pic),
- clr_down_(229, 161, 2) {
- set_thinks(false);
- set_can_focus(true);
+ : Button(parent, name, x, y, w, h, style, title_image, "", tooltip_text, init_state, mode) {
}
Button::~Button() {
@@ -103,10 +119,10 @@
void Button::set_pic(const Image* pic) {
title_.clear();
- if (pic_custom_ == pic)
+ if (title_image_ == pic)
return;
- pic_custom_ = pic;
+ title_image_ = pic;
}
/**
@@ -116,7 +132,7 @@
if (title_ == title)
return;
- pic_custom_ = nullptr;
+ title_image_ = nullptr;
title_ = title;
}
@@ -148,57 +164,53 @@
* Redraw the button
*/
void Button::draw(RenderTarget& dst) {
- const bool is_flat = (enabled_ && style_ == Style::kFlat) ||
+ const bool is_flat = (enabled_ && visual_state_ == VisualState::kFlat) ||
(!enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kFlat));
const bool is_permpressed =
- (enabled_ && style_ == Style::kPermpressed) ||
+ (enabled_ && visual_state_ == VisualState::kPermpressed) ||
(!enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kPermpressed));
const bool is_monochrome =
!enabled_ && static_cast<int>(disable_style_ & ButtonDisableStyle::kMonochrome);
// Draw the background
- if (pic_background_) {
- dst.fill_rect(Recti(0, 0, get_w(), get_h()), RGBAColor(0, 0, 0, 255));
- dst.tile(
- Recti(Vector2i::zero(), get_w(), get_h()), pic_background_, Vector2i(get_x(), get_y()));
- }
+ draw_background(dst, *background_style_);
if (is_flat && highlighted_)
dst.brighten_rect(Recti(0, 0, get_w(), get_h()), MOUSE_OVER_BRIGHT_FACTOR);
// If we've got a picture, draw it centered
- if (pic_custom_) {
+ if (title_image_) {
if (image_mode_ == UI::Button::ImageMode::kUnscaled) {
if (!is_monochrome) {
- dst.blit(Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2,
- (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2),
- pic_custom_);
+ dst.blit(Vector2i((get_w() - static_cast<int32_t>(title_image_->width())) / 2,
+ (get_h() - static_cast<int32_t>(title_image_->height())) / 2),
+ title_image_);
} else {
dst.blit_monochrome(
- Vector2i((get_w() - static_cast<int32_t>(pic_custom_->width())) / 2,
- (get_h() - static_cast<int32_t>(pic_custom_->height())) / 2),
- pic_custom_, RGBAColor(255, 255, 255, 127));
+ Vector2i((get_w() - static_cast<int32_t>(title_image_->width())) / 2,
+ (get_h() - static_cast<int32_t>(title_image_->height())) / 2),
+ title_image_, RGBAColor(255, 255, 255, 127));
}
} else {
const int max_image_w = get_w() - 2 * kButtonImageMargin;
const int max_image_h = get_h() - 2 * kButtonImageMargin;
const float image_scale =
- std::min(1.f, std::min(static_cast<float>(max_image_w) / pic_custom_->width(),
- static_cast<float>(max_image_h) / pic_custom_->height()));
- int blit_width = image_scale * pic_custom_->width();
- int blit_height = image_scale * pic_custom_->height();
+ std::min(1.f, std::min(static_cast<float>(max_image_w) / title_image_->width(),
+ static_cast<float>(max_image_h) / title_image_->height()));
+ int blit_width = image_scale * title_image_->width();
+ int blit_height = image_scale * title_image_->height();
if (!is_monochrome) {
dst.blitrect_scale(Rectf((get_w() - blit_width) / 2.f, (get_h() - blit_height) / 2.f,
blit_width, blit_height),
- pic_custom_,
- Recti(0, 0, pic_custom_->width(), pic_custom_->height()), 1.,
+ title_image_,
+ Recti(0, 0, title_image_->width(), title_image_->height()), 1.,
BlendMode::UseAlpha);
} else {
dst.blitrect_scale_monochrome(
Rectf((get_w() - blit_width) / 2.f, (get_h() - blit_height) / 2.f, blit_width,
blit_height),
- pic_custom_, Recti(0, 0, pic_custom_->width(), pic_custom_->height()),
+ title_image_, Recti(0, 0, title_image_->width(), title_image_->height()),
RGBAColor(255, 255, 255, 127));
}
}
@@ -341,8 +353,8 @@
return true; // We handle this always by lighting up
}
-void Button::set_style(UI::Button::Style input_style) {
- style_ = input_style;
+void Button::set_visual_state(UI::Button::VisualState input_state) {
+ visual_state_ = input_state;
}
void Button::set_disable_style(UI::ButtonDisableStyle input_style) {
@@ -350,18 +362,19 @@
}
void Button::set_perm_pressed(bool pressed) {
- set_style(pressed ? UI::Button::Style::kPermpressed : UI::Button::Style::kRaised);
+ set_visual_state(pressed ? UI::Button::VisualState::kPermpressed :
+ UI::Button::VisualState::kRaised);
}
void Button::toggle() {
- switch (style_) {
- case UI::Button::Style::kRaised:
- style_ = UI::Button::Style::kPermpressed;
- break;
- case UI::Button::Style::kPermpressed:
- style_ = UI::Button::Style::kRaised;
- break;
- case UI::Button::Style::kFlat:
+ switch (visual_state_) {
+ case UI::Button::VisualState::kRaised:
+ visual_state_ = UI::Button::VisualState::kPermpressed;
+ break;
+ case UI::Button::VisualState::kPermpressed:
+ visual_state_ = UI::Button::VisualState::kRaised;
+ break;
+ case UI::Button::VisualState::kFlat:
break; // Do nothing for flat buttons
}
}
=== modified file 'src/ui_basic/button.h'
--- src/ui_basic/button.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/button.h 2018-02-13 12:57:13 +0000
@@ -48,7 +48,7 @@
/// This is all that is needed in most cases, but if there is a need to give a
/// callback function to the button, there are some templates for that below.
struct Button : public NamedPanel {
- enum class Style {
+ enum class VisualState {
kRaised, // Normal raised Button
kPermpressed, // Button will appear pressed
kFlat // Flat button with simple coloured outline
@@ -59,6 +59,23 @@
kUnscaled // Show the foreground image without any scaling
};
+private:
+ Button // Common constructor
+ (Panel* const parent,
+ const std::string& name,
+ int32_t const x,
+ int32_t const y,
+ uint32_t const w,
+ uint32_t const h,
+ UI::ButtonStyle style,
+ const Image* title_image,
+ const std::string& title_text,
+ const std::string& tooltip_text,
+ UI::Button::VisualState state,
+ UI::Button::ImageMode mode);
+
+public:
+
/**
* Text conventions: Title Case for the 'title_text', Sentence case for the 'tooltip_text'
*/
@@ -69,10 +86,10 @@
int32_t const y,
uint32_t const w,
uint32_t const h,
- const Image* background_picture_id,
+ UI::ButtonStyle style,
const std::string& title_text,
const std::string& tooltip_text = std::string(),
- UI::Button::Style init_style = UI::Button::Style::kRaised);
+ UI::Button::VisualState state = UI::Button::VisualState::kRaised);
/**
* Text conventions: Sentence case for the 'tooltip_text'
@@ -84,10 +101,10 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
- const Image* background_picture_id,
- const Image* foreground_picture_id,
+ UI::ButtonStyle style,
+ const Image* title_image,
const std::string& tooltip_text = std::string(),
- UI::Button::Style init_style = UI::Button::Style::kRaised,
+ UI::Button::VisualState state = UI::Button::VisualState::kRaised,
UI::Button::ImageMode mode = UI::Button::ImageMode::kShrink);
~Button() override;
@@ -118,9 +135,9 @@
bool handle_mousemove(uint8_t, int32_t, int32_t, int32_t, int32_t) override;
/// Sets the visual style of the button
- void set_style(UI::Button::Style input_style);
- UI::Button::Style style() const {
- return style_;
+ void set_visual_state(UI::Button::VisualState state);
+ UI::Button::VisualState style() const {
+ return visual_state_;
}
/// Sets the visual style of the disabled button
@@ -143,19 +160,18 @@
bool highlighted_; // mouse is over the button
bool pressed_; // mouse is clicked over the button
bool enabled_;
- UI::Button::Style style_;
+ UI::Button::VisualState visual_state_;
UI::ButtonDisableStyle disable_style_;
bool repeating_;
const UI::Button::ImageMode image_mode_;
uint32_t time_nextact_;
- std::string title_; // title string used when pic_custom_ == 0
-
- const Image* pic_background_; // background texture (picture ID)
- const Image* pic_custom_; // custom icon on the button
-
- RGBColor clr_down_; // color of border while a flat button is "down"
+ std::string title_; // title string used when pic_custom_ == 0
+ const Image* title_image_; // custom icon on the button
+
+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
+ RGBColor clr_down_; // color of border while a flat button is "down"
};
} // namespace UI
=== modified file 'src/ui_basic/dropdown.cc'
--- src/ui_basic/dropdown.cc 2017-06-27 16:27:42 +0000
+++ src/ui_basic/dropdown.cc 2018-02-13 12:57:13 +0000
@@ -27,6 +27,7 @@
#include "base/macros.h"
#include "graphic/align.h"
#include "graphic/font_handler1.h"
+#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "ui_basic/mouse_constants.h"
#include "ui_basic/tabpanel.h"
@@ -53,8 +54,7 @@
int button_dimension,
const std::string& label,
const DropdownType type,
- const Image* background,
- const Image* button_background)
+ UI::PanelStyle style)
: UI::Panel(parent,
x,
y,
@@ -76,7 +76,9 @@
0,
button_dimension,
get_h(),
- button_background,
+ style == UI::PanelStyle::kFsMenu ?
+ UI::ButtonStyle::kFsMenuMenu :
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/ui_basic/scrollbar_down.png"),
pgettext("dropdown", "Select Item")) :
nullptr),
@@ -88,7 +90,8 @@
w - button_dimension :
type == DropdownType::kTextualNarrow ? w : button_dimension,
get_h(),
- background,
+ style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuSecondary :
+ UI::ButtonStyle::kWuiSecondary,
label),
label_(label),
type_(type),
@@ -107,12 +110,9 @@
while (parent->get_parent() && !is_a(UI::TabPanel, parent->get_parent())) {
parent = parent->get_parent();
}
- list_ = new UI::Listselect<uintptr_t>(
- parent, 0, 0, w, 0, button_background, ListselectLayout::kDropdown);
+ list_ = new UI::Listselect<uintptr_t>(parent, 0, 0, w, 0, style, ListselectLayout::kDropdown);
list_->set_visible(false);
- list_->set_background(background);
-
button_box_.add(&display_button_);
display_button_.sigclicked.connect(boost::bind(&BaseDropdown::toggle_list, this));
if (push_button_ != nullptr) {
=== modified file 'src/ui_basic/dropdown.h'
--- src/ui_basic/dropdown.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/dropdown.h 2018-02-13 12:57:13 +0000
@@ -25,7 +25,6 @@
#include <boost/signals2.hpp>
-#include "graphic/graphic.h"
#include "graphic/image.h"
#include "notifications/note_ids.h"
#include "notifications/notifications.h"
@@ -60,8 +59,7 @@
/// dropdowns, this is both the width and the height of the button.
/// \param label a label to prefix to the selected entry on the display button.
/// \param type whether this is a textual or pictorial dropdown
- /// \param background the background image for this dropdown
- /// \param button_background the background image all buttons in this dropdown
+ /// \param style the style used for buttons and background
BaseDropdown(Panel* parent,
int32_t x,
int32_t y,
@@ -70,8 +68,7 @@
int button_dimension,
const std::string& label,
const DropdownType type,
- const Image* background,
- const Image* button_background);
+ PanelStyle style);
~BaseDropdown() override;
public:
@@ -206,9 +203,7 @@
/// dropdowns, this is both the width and the height of the button.
/// \param label a label to prefix to the selected entry on the display button.
/// \param type whether this is a textual or pictorial dropdown
- /// \param background the background image for this dropdown
- /// \param button_background the background image all buttons in this dropdown
- ///
+ /// \param style the style used for buttons and background
/// Text conventions: Title Case for all elements
Dropdown(Panel* parent,
int32_t x,
@@ -217,19 +212,9 @@
uint32_t list_h,
int button_dimension,
const std::string& label,
- const DropdownType type = DropdownType::kTextual,
- const Image* background = g_gr->images().get("images/ui_basic/but1.png"),
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"))
- : BaseDropdown(parent,
- x,
- y,
- list_w,
- list_h,
- button_dimension,
- label,
- type,
- background,
- button_background) {
+ const DropdownType type,
+ PanelStyle style)
+ : BaseDropdown(parent, x, y, list_w, list_h, button_dimension, label, type, style) {
}
~Dropdown() {
entry_cache_.clear();
=== modified file 'src/ui_basic/editbox.cc'
--- src/ui_basic/editbox.cc 2017-06-25 08:20:25 +0000
+++ src/ui_basic/editbox.cc 2018-02-13 12:57:13 +0000
@@ -24,9 +24,11 @@
#include <SDL_keycode.h>
#include <boost/format.hpp>
+#include "graphic/color.h"
#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text/bidi.h"
#include "graphic/text/font_set.h"
#include "graphic/text/rt_errors.h"
@@ -53,8 +55,8 @@
uint32_t fontsize;
/*@}*/
- /// Background tile style.
- const Image* background;
+ /// Background color and texture
+ const UI::PanelStyleInfo* background_style;
/// Maximum number of characters in the input
uint32_t maxLength;
@@ -78,7 +80,7 @@
uint32_t w,
uint32_t h,
int margin_y,
- const Image* background,
+ UI::PanelStyle style,
int font_size)
: Panel(parent, x, y, w, h > 0 ? h : text_height(font_size) + 2 * margin_y),
m_(new EditBoxImpl),
@@ -86,7 +88,7 @@
history_position_(-1) {
set_thinks(false);
- m_->background = background;
+ m_->background_style = g_gr->styles().editbox_style(style);
m_->fontname = UI::g_fh1->fontset()->sans();
m_->fontsize = font_size;
@@ -340,9 +342,7 @@
}
void EditBox::draw(RenderTarget& dst) {
-
- // Draw the background
- dst.tile(Recti(0, 0, get_w(), get_h()), m_->background, Vector2i(get_x(), get_y()));
+ draw_background(dst, *m_->background_style);
// Draw border.
if (get_w() >= 2 && get_h() >= 2) {
=== modified file 'src/ui_basic/editbox.h'
--- src/ui_basic/editbox.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/editbox.h 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include <boost/signals2.hpp>
#include "graphic/align.h"
-#include "graphic/graphic.h"
#include "ui_basic/button.h"
#define CHAT_HISTORY_SIZE 5
@@ -49,9 +48,9 @@
int32_t x,
int32_t y,
uint32_t w,
- uint32_t h = 0,
- int margin_y = 2,
- const Image* background = g_gr->images().get("images/ui_basic/but2.png"),
+ uint32_t h,
+ int margin_y,
+ UI::PanelStyle style,
int font_size = UI_FONT_SIZE_SMALL);
~EditBox() override;
=== modified file 'src/ui_basic/fileview_panel.cc'
--- src/ui_basic/fileview_panel.cc 2017-12-28 14:57:00 +0000
+++ src/ui_basic/fileview_panel.cc 2018-02-13 12:57:13 +0000
@@ -28,11 +28,14 @@
namespace UI {
-FileViewPanel::FileViewPanel(Panel* parent, const Image* background, TabPanel::Type border_type)
- : TabPanel(parent, background, border_type),
- padding_(5),
- contents_width_(0),
- contents_height_(0) {
+FileViewPanel::FileViewPanel(Panel* parent,
+ UI::PanelStyle scrollbar_style,
+ TabPanelStyle background_style)
+ : TabPanel(parent, background_style),
+ padding_(5),
+ contents_width_(0),
+ contents_height_(0),
+ style_(scrollbar_style) {
layout();
}
@@ -52,7 +55,7 @@
size_t index = boxes_.size() - 1;
UI::MultilineTextarea* textarea =
- new UI::MultilineTextarea(boxes_.at(index).get(), 0, 0, Scrollbar::kSize, 0);
+ new UI::MultilineTextarea(boxes_.at(index).get(), 0, 0, Scrollbar::kSize, 0, style_);
try {
textarea->force_new_renderer();
textarea->set_text(content);
@@ -84,9 +87,9 @@
// If there is a border, we have less space for the contents
contents_width_ = std::max(
- 0, border_type_ == TabPanel::Type::kNoBorder ? get_w() - padding_ : get_w() - 2 * padding_);
+ 0, style_ == UI::PanelStyle::kFsMenu ? get_w() - padding_ : get_w() - 2 * padding_);
- contents_height_ = std::max(0, border_type_ == TabPanel::Type::kNoBorder ?
+ contents_height_ = std::max(0, style_ == UI::PanelStyle::kFsMenu ?
get_inner_h() - 2 * padding_ - UI::kTabPanelButtonHeight :
get_inner_h() - 3 * padding_ - UI::kTabPanelButtonHeight);
=== modified file 'src/ui_basic/fileview_panel.h'
--- src/ui_basic/fileview_panel.h 2017-06-11 20:09:05 +0000
+++ src/ui_basic/fileview_panel.h 2018-02-13 12:57:13 +0000
@@ -35,9 +35,7 @@
*/
class FileViewPanel : public TabPanel {
public:
- FileViewPanel(Panel* parent,
- const Image* background,
- TabPanel::Type border_type = TabPanel::Type::kNoBorder);
+ FileViewPanel(Panel* parent, UI::PanelStyle scrollbar_style, UI::TabPanelStyle background_style);
/// Adds a tab with the contents of 'lua_script'.
/// 'lua_script' must return a table that contains 'title' and 'text' keys.
@@ -49,6 +47,7 @@
const int padding_;
int contents_width_;
int contents_height_;
+ const UI::PanelStyle style_;
// Tab contents
std::vector<std::unique_ptr<Box>> boxes_;
=== modified file 'src/ui_basic/fullscreen_window.cc'
--- src/ui_basic/fullscreen_window.cc 2017-05-14 04:38:39 +0000
+++ src/ui_basic/fullscreen_window.cc 2018-02-13 12:57:13 +0000
@@ -20,10 +20,12 @@
#include "ui_basic/fullscreen_window.h"
#include <cstdio>
+#include <memory>
#include "graphic/graphic.h"
#include "graphic/image.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_constants.h"
/*
@@ -37,23 +39,21 @@
FullscreenWindow::FullscreenWindow()
: UI::Panel(nullptr, 0, 0, g_gr->get_xres(), g_gr->get_yres()),
- background_image_("images/ui_fsmenu/background.png") {
+ background_image_(kTemplateDir + "fsmenu/background.png") {
graphic_resolution_changed_subscriber_ = Notifications::subscribe<GraphicResolutionChanged>(
[this](const GraphicResolutionChanged& message) {
set_size(message.width, message.height);
layout();
});
- set_frame_image(FullscreenWindow::Frames::kCornerTopLeft, "images/ui_fsmenu/top_left.png");
- set_frame_image(FullscreenWindow::Frames::kCornerTopRight, "images/ui_fsmenu/top_right.png");
- set_frame_image(FullscreenWindow::Frames::kCornerBottomLeft, "images/ui_fsmenu/bottom_left.png");
- set_frame_image(
- FullscreenWindow::Frames::kCornerBottomRight, "images/ui_fsmenu/bottom_right.png");
- set_frame_image(FullscreenWindow::Frames::kEdgeLeftTile, "images/ui_fsmenu/left.png");
- set_frame_image(FullscreenWindow::Frames::kEdgeRightTile, "images/ui_fsmenu/right.png");
- set_frame_image(FullscreenWindow::Frames::kEdgeTopTile, "images/ui_fsmenu/top.png");
- set_frame_image(FullscreenWindow::Frames::kEdgeBottomTile, "images/ui_fsmenu/bottom.png");
- add_overlay_image("images/ui_fsmenu/center.png",
- FullscreenWindow::Alignment(UI::Align::kCenter, UI::Align::kCenter));
+ set_frame_image(FullscreenWindow::Frames::kCornerTopLeft, "fsmenu/top_left.png");
+ set_frame_image(FullscreenWindow::Frames::kCornerTopRight, "fsmenu/top_right.png");
+ set_frame_image(FullscreenWindow::Frames::kCornerBottomLeft, "fsmenu/bottom_left.png");
+ set_frame_image(FullscreenWindow::Frames::kCornerBottomRight, "fsmenu/bottom_right.png");
+ set_frame_image(FullscreenWindow::Frames::kEdgeLeftTile, "fsmenu/left.png");
+ set_frame_image(FullscreenWindow::Frames::kEdgeRightTile, "fsmenu/right.png");
+ set_frame_image(FullscreenWindow::Frames::kEdgeTopTile, "fsmenu/top.png");
+ set_frame_image(FullscreenWindow::Frames::kEdgeBottomTile, "fsmenu/bottom.png");
+ set_frame_image(FullscreenWindow::Frames::kCenter, "fsmenu/center.png");
}
FullscreenWindow::~FullscreenWindow() {
@@ -62,7 +62,7 @@
}
void FullscreenWindow::add_overlay_image(const std::string& filename, Alignment align) {
- overlays_.push_back(std::make_pair(g_gr->images().get(filename), align));
+ overlays_.push_back(std::unique_ptr<const Overlay>(new Overlay(g_gr->images().get(filename), align)));
}
void FullscreenWindow::clear_overlays() {
@@ -70,7 +70,7 @@
}
void FullscreenWindow::set_frame_image(FullscreenWindow::Frames id, const std::string& filename) {
- frame_overlays_.insert(std::make_pair(id, g_gr->images().get(filename)));
+ frame_overlays_.insert(std::make_pair(id, g_gr->images().get(kTemplateDir + filename)));
}
const Image* FullscreenWindow::get_frame_image(FullscreenWindow::Frames id) const {
@@ -88,20 +88,24 @@
// Overall background
dst.tile(Recti(0, 0, get_w(), get_h()), g_gr->images().get(background_image_), Vector2i::zero());
+ // Center background
+ blit_image(dst, get_frame_image(FullscreenWindow::Frames::kCenter),
+ FullscreenWindow::Alignment(UI::Align::kCenter, UI::Align::kCenter));
+
// Optional overlays
for (const auto& overlay : overlays_) {
- blit_image(dst, overlay.first, overlay.second);
+ blit_image(dst, overlay->image, overlay->align);
}
// Frame edges
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeLeftTile),
- Alignment(UI::Align::kLeft, UI::Align::kTop), kVertical);
+ Alignment(UI::Align::kLeft, UI::Align::kTop), Tiling::kVertical);
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeRightTile),
- Alignment(UI::Align::kRight, UI::Align::kTop), kVertical);
+ Alignment(UI::Align::kRight, UI::Align::kTop), Tiling::kVertical);
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeTopTile),
- Alignment(UI::Align::kLeft, UI::Align::kTop), kHorizontal);
+ Alignment(UI::Align::kLeft, UI::Align::kTop), Tiling::kHorizontal);
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kEdgeBottomTile),
- Alignment(UI::Align::kLeft, UI::Align::kBottom), kHorizontal);
+ Alignment(UI::Align::kLeft, UI::Align::kBottom), Tiling::kHorizontal);
// Frame corners
blit_image(dst, get_frame_image(FullscreenWindow::Frames::kCornerTopLeft),
@@ -114,43 +118,61 @@
FullscreenWindow::Alignment(UI::Align::kRight, UI::Align::kBottom));
}
+Recti FullscreenWindow::calculate_rect(const Image* image, Alignment align, Tiling tiling) {
+ int x = 0;
+ int y = 0;
+ int w = image->width();
+ int h = image->height();
+ const int available_width = g_gr->get_xres();
+ const int available_height = g_gr->get_yres();
+
+ if (tiling != Tiling::kNone) {
+ w = (tiling == Tiling::kVertical) ? w : available_width;
+ h = (tiling == Tiling::kHorizontal) ? h : available_height;
+ } else {
+ const float scale =
+ std::min(1.f, std::max(static_cast<float>(available_width) / image->width(), static_cast<float>(available_height) / image->height()));
+ w = scale * image->width();
+ h = scale * image->height();
+ }
+
+ // Adjust horizontal alignment
+ switch (align.halign) {
+ case UI::Align::kRight:
+ x = available_width - w;
+ break;
+ case UI::Align::kCenter:
+ x = (available_width - w) / 2;
+ break;
+ case UI::Align::kLeft:
+ break;
+ }
+
+ // Adjust vertical alignment
+ switch (align.valign) {
+ case UI::Align::kBottom:
+ y = available_height - h;
+ break;
+ case UI::Align::kCenter:
+ y = (available_height - h) / 2;
+ break;
+ case UI::Align::kTop:
+ break;
+ }
+ return Recti(x, y, w, h);
+}
+
void FullscreenWindow::blit_image(RenderTarget& dst,
const Image* image,
Alignment align,
Tiling tiling) {
if (image) {
- int x = 0;
- int y = 0;
- // Adjust horizontal alignment
- switch (align.halign) {
- case UI::Align::kRight:
- x = get_w() - image->width();
- break;
- case UI::Align::kCenter:
- x = (get_w() - image->width()) / 2;
- break;
- case UI::Align::kLeft:
- break;
- }
-
- // Adjust vertical alignment
- switch (align.valign) {
- case UI::Align::kBottom:
- y = get_h() - image->height();
- break;
- case UI::Align::kCenter:
- y = (get_h() - image->height()) / 2;
- break;
- case UI::Align::kTop:
- break;
- }
-
- if (tiling != kNone) {
- const int w = (tiling == kVertical) ? image->width() : get_w();
- const int h = (tiling == kHorizontal) ? image->height() : get_h();
- dst.tile(Recti(x, y, w, h), image, Vector2i::zero());
+ const Recti dest = FullscreenWindow::calculate_rect(image, align, tiling);
+ if (tiling != Tiling::kNone) {
+ dst.tile(dest, image, Vector2i::zero());
} else {
- dst.blit(Vector2i(x, y), image);
+ dst.blitrect_scale(dest.cast<float>(), image, Recti(0, 0, image->width(), image->height()),
+ 1., BlendMode::UseAlpha);
}
}
}
=== modified file 'src/ui_basic/fullscreen_window.h'
--- src/ui_basic/fullscreen_window.h 2017-11-27 08:21:32 +0000
+++ src/ui_basic/fullscreen_window.h 2018-02-13 12:57:13 +0000
@@ -48,7 +48,8 @@
kEdgeLeftTile,
kEdgeRightTile,
kEdgeTopTile,
- kEdgeBottomTile
+ kEdgeBottomTile,
+ kCenter
};
struct FramesHash {
template <typename T> int operator()(T t) const {
@@ -88,20 +89,33 @@
/// Returns the image for the given frame position.
const Image* get_frame_image(FullscreenWindow::Frames id) const;
- enum Tiling { kNone, kHorizontal, kVertical };
+ enum class Tiling { kNone, kHorizontal, kVertical };
+
+ /// Calculate the rect that the image will be blitted to.
+ static Recti calculate_rect(const Image* image, Alignment align, Tiling tiling);
/**
* Blit an image according to the given 'align'.
* If 'tiling' is set to 'UI::Align::kVertical' or 'UI::Align::kHorizontal', the image will be
- * tiled.
+ * tiled. If the image is bigger than the panel, it will get scaled down.
*/
- void blit_image(RenderTarget& dst, const Image* image, Alignment align, Tiling tiling = kNone);
+ void blit_image(RenderTarget& dst,
+ const Image* image,
+ Alignment align,
+ Tiling tiling = Tiling::kNone);
const std::string background_image_;
+
/// These overlay images will be blitted in the order they were added and according to the given
/// align.
- std::vector<std::pair<const Image*, Alignment>> overlays_;
- /// Images for the edges. They will be blitted in top of the overlays_.
+ struct Overlay {
+ Overlay(const Image* init_image, const FullscreenWindow::Alignment& init_align) : image(init_image), align(init_align) {}
+ const Image* image;
+ const FullscreenWindow::Alignment align;
+ };
+ std::vector<std::unique_ptr<const Overlay>> overlays_;
+
+ /// Images for the edges and the center. Except for the center one, they will be blitted on top of the overlays_.
std::unordered_map<FullscreenWindow::Frames, const Image*, FullscreenWindow::FramesHash>
frame_overlays_;
=== modified file 'src/ui_basic/icongrid.cc'
--- src/ui_basic/icongrid.cc 2017-01-25 18:55:59 +0000
+++ src/ui_basic/icongrid.cc 2018-02-13 12:57:13 +0000
@@ -30,7 +30,6 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* background_picture_id,
const Image* foreground_picture_id,
uint32_t callback_argument_id,
const std::string& tooltip_text)
@@ -40,10 +39,10 @@
y,
w,
h,
- background_picture_id,
+ UI::ButtonStyle::kWuiBuildingStats,
foreground_picture_id,
tooltip_text,
- UI::Button::Style::kFlat),
+ UI::Button::VisualState::kFlat),
icongrid_(parent),
callback_argument_id_(callback_argument_id) {
}
@@ -97,8 +96,8 @@
uint32_t x = (idx % columns_) * cell_width_;
uint32_t y = (idx / columns_) * cell_height_;
- UI::Button* btn = new IconGridButton(
- *this, name, x, y, cell_width_, cell_height_, nullptr, pic, idx, tooltip_text);
+ UI::Button* btn =
+ new IconGridButton(*this, name, x, y, cell_width_, cell_height_, pic, idx, tooltip_text);
btn->sigclicked.connect(boost::bind(&IconGrid::clicked_button, this, idx));
return idx;
=== modified file 'src/ui_basic/listselect.cc'
--- src/ui_basic/listselect.cc 2017-09-20 21:27:25 +0000
+++ src/ui_basic/listselect.cc 2018-02-13 12:57:13 +0000
@@ -28,6 +28,7 @@
#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text/bidi.h"
#include "graphic/text_constants.h"
#include "graphic/text_layout.h"
@@ -50,17 +51,19 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
- const Image* button_background,
+ UI::PanelStyle style,
const ListselectLayout selection_mode)
: Panel(parent, x, y, w, h),
lineheight_(text_height() + kMargin),
- scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, button_background),
+ scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, style),
scrollpos_(0),
selection_(no_selection_index()),
last_click_time_(-10000),
last_selection_(no_selection_index()),
selection_mode_(selection_mode),
- background_(nullptr) {
+ background_style_(selection_mode == ListselectLayout::kDropdown ?
+ g_gr->styles().dropdown_style(style) :
+ nullptr) {
set_thinks(false);
scrollbar_.moved.connect(boost::bind(&BaseListselect::set_scrollpos, this, _1));
@@ -313,8 +316,8 @@
uint32_t idx = scrollpos_ / get_lineheight();
int y = 1 + idx * get_lineheight() - scrollpos_;
- if (background_ != nullptr) {
- dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), background_, Vector2i::zero());
+ if (background_style_ != nullptr) {
+ draw_background(dst, *background_style_);
}
if (selection_mode_ == ListselectLayout::kDropdown) {
=== modified file 'src/ui_basic/listselect.h'
--- src/ui_basic/listselect.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/listselect.h 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include <boost/signals2.hpp>
#include "graphic/color.h"
-#include "graphic/graphic.h"
#include "ui_basic/panel.h"
#include "ui_basic/scrollbar.h"
@@ -51,7 +50,7 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background,
+ PanelStyle style,
ListselectLayout selection_mode = ListselectLayout::kPlain);
~BaseListselect() override;
@@ -108,10 +107,6 @@
const std::string& get_selected_tooltip() const;
const Image* get_selected_image() const;
- void set_background(const Image* background) {
- background_ = background;
- }
-
/// Return the total height (text + spacing) occupied by a single line.
int get_lineheight() const;
@@ -153,7 +148,7 @@
uint32_t last_selection_; // for double clicks
ListselectLayout selection_mode_;
const Image* check_pic_;
- const Image* background_;
+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
std::string current_tooltip_;
};
@@ -163,9 +158,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
ListselectLayout selection_mode = ListselectLayout::kPlain)
- : BaseListselect(parent, x, y, w, h, button_background, selection_mode) {
+ : BaseListselect(parent, x, y, w, h, style, selection_mode) {
}
void add(const std::string& name,
@@ -193,10 +188,6 @@
return entry_cache_[BaseListselect::get_selected()];
}
- void set_background(const Image* background) {
- BaseListselect::set_background(background);
- }
-
private:
std::deque<Entry> entry_cache_;
};
@@ -216,9 +207,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
ListselectLayout selection_mode = ListselectLayout::kPlain)
- : Base(parent, x, y, w, h, button_background, selection_mode) {
+ : Base(parent, x, y, w, h, style, selection_mode) {
}
void add(const std::string& name,
@@ -243,10 +234,6 @@
Entry& get_selected() const {
return *Base::get_selected();
}
-
- void set_background(const Image* background) {
- *Base::set_background(background);
- }
};
}
=== modified file 'src/ui_basic/messagebox.cc'
--- src/ui_basic/messagebox.cc 2017-11-04 15:44:55 +0000
+++ src/ui_basic/messagebox.cc 2018-02-13 12:57:13 +0000
@@ -71,26 +71,25 @@
scrollmode = MultilineTextarea::ScrollMode::kScrollNormal;
}
- textarea_.reset(new MultilineTextarea(this, margin, margin, width - 2 * margin, height, text,
- align, g_gr->images().get("images/ui_basic/but1.png"),
- scrollmode));
+ textarea_.reset(new MultilineTextarea(this, margin, margin, width - 2 * margin, height,
+ UI::PanelStyle::kWui, text, align, scrollmode));
// Now add the buttons
const int button_y = textarea_->get_y() + textarea_->get_h() + 2 * margin;
const int left_button_x = width / 3 - button_w / 2;
const int right_button_x = width * 2 / 3 - button_w / 2;
- ok_button_.reset(new Button(
- this, "ok",
- type_ == MBoxType::kOk ? (width - button_w) / 2 :
- UI::g_fh1->fontset()->is_rtl() ? left_button_x : right_button_x,
- button_y, button_w, 0, g_gr->images().get("images/ui_basic/but5.png"), _("OK")));
+ ok_button_.reset(new Button(this, "ok",
+ type_ == MBoxType::kOk ?
+ (width - button_w) / 2 :
+ UI::g_fh1->fontset()->is_rtl() ? left_button_x : right_button_x,
+ button_y, button_w, 0, UI::ButtonStyle::kWuiPrimary, _("OK")));
ok_button_->sigclicked.connect(boost::bind(&WLMessageBox::clicked_ok, boost::ref(*this)));
if (type_ == MBoxType::kOkCancel) {
- cancel_button_.reset(new Button(
- this, "cancel", UI::g_fh1->fontset()->is_rtl() ? right_button_x : left_button_x, button_y,
- button_w, 0, g_gr->images().get("images/ui_basic/but1.png"), _("Cancel")));
+ cancel_button_.reset(
+ new Button(this, "cancel", UI::g_fh1->fontset()->is_rtl() ? right_button_x : left_button_x,
+ button_y, button_w, 0, UI::ButtonStyle::kWuiSecondary, _("Cancel")));
cancel_button_->sigclicked.connect(
boost::bind(&WLMessageBox::clicked_back, boost::ref(*this)));
}
=== modified file 'src/ui_basic/multilineeditbox.cc'
--- src/ui_basic/multilineeditbox.cc 2017-12-05 11:32:12 +0000
+++ src/ui_basic/multilineeditbox.cc 2018-02-13 12:57:13 +0000
@@ -25,6 +25,7 @@
#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_layout.h"
#include "graphic/wordwrap.h"
#include "ui_basic/mouse_constants.h"
@@ -40,8 +41,8 @@
/// The text in the edit box
std::string text;
- /// Background tile style.
- const Image* background;
+ /// Background color and texture
+ const UI::PanelStyleInfo* background_style;
/// Position of the cursor inside the text.
/// 0 indicates that the cursor is before the first character,
@@ -59,7 +60,7 @@
WordWrap ww;
/*@}*/
- Data(MultilineEditbox&, const Image* init_background, const Image* button_background);
+ Data(MultilineEditbox&, const UI::PanelStyleInfo* style);
void refresh_ww();
void update();
@@ -81,28 +82,19 @@
/**
* Initialize an editbox that supports multiline strings.
*/
-MultilineEditbox::MultilineEditbox(Panel* parent,
- int32_t x,
- int32_t y,
- uint32_t w,
- uint32_t h,
- const std::string& text,
- const Image* background,
- const Image* button_background)
- : Panel(parent, x, y, w, h), d_(new Data(*this, background, button_background)) {
+MultilineEditbox::MultilineEditbox(
+ Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, UI::PanelStyle style)
+ : Panel(parent, x, y, w, h), d_(new Data(*this, g_gr->styles().editbox_style(style))) {
set_handle_mouse(true);
set_can_focus(true);
set_thinks(false);
set_handle_textinput();
-
- set_text(text);
}
-MultilineEditbox::Data::Data(MultilineEditbox& o,
- const Image* init_background,
- const Image* button_background)
- : scrollbar(&o, o.get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, o.get_h(), button_background),
- background(init_background),
+MultilineEditbox::Data::Data(MultilineEditbox& o, const UI::PanelStyleInfo* style)
+ : scrollbar(
+ &o, o.get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, o.get_h(), UI::PanelStyle::kWui),
+ background_style(style),
cursor_pos(0),
lineheight(text_height()),
maxbytes(std::min(g_gr->max_texture_size() / UI_FONT_SIZE_SMALL, 0xffff)),
@@ -408,8 +400,7 @@
* Redraw the Editbox
*/
void MultilineEditbox::draw(RenderTarget& dst) {
- // Draw the background
- dst.tile(Recti(Vector2i::zero(), get_w(), get_h()), d_->background, Vector2i(get_x(), get_y()));
+ draw_background(dst, *d_->background_style);
// Draw border.
if (get_w() >= 4 && get_h() >= 4) {
=== modified file 'src/ui_basic/multilineeditbox.h'
--- src/ui_basic/multilineeditbox.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/multilineeditbox.h 2018-02-13 12:57:13 +0000
@@ -24,7 +24,6 @@
#include <boost/signals2.hpp>
-#include "graphic/graphic.h"
#include "ui_basic/panel.h"
namespace UI {
@@ -36,15 +35,7 @@
* Text conventions: Sentence case for labels associated with thie editbox
*/
struct MultilineEditbox : public Panel {
- MultilineEditbox(
- Panel*,
- int32_t x,
- int32_t y,
- uint32_t w,
- uint32_t h,
- const std::string& text,
- const Image* background = g_gr->images().get("images/ui_basic/but2.png"),
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"));
+ MultilineEditbox(Panel*, int32_t x, int32_t y, uint32_t w, uint32_t h, PanelStyle style);
boost::signals2::signal<void()> changed;
=== modified file 'src/ui_basic/multilinetextarea.cc'
--- src/ui_basic/multilinetextarea.cc 2017-12-07 11:46:10 +0000
+++ src/ui_basic/multilinetextarea.cc 2018-02-13 12:57:13 +0000
@@ -37,9 +37,9 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
+ UI::PanelStyle style,
const std::string& text,
const Align align,
- const Image* button_background,
MultilineTextarea::ScrollMode scroll_mode)
: Panel(parent, x, y, w, h),
text_(text),
@@ -47,8 +47,7 @@
align_(align),
force_new_renderer_(false),
use_old_renderer_(false),
- scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, button_background, false),
- pic_background_(nullptr) {
+ scrollbar_(this, get_w() - Scrollbar::kSize, 0, Scrollbar::kSize, h, style, false) {
set_thinks(false);
scrollbar_.moved.connect(boost::bind(&MultilineTextarea::scrollpos_changed, this, _1));
@@ -134,9 +133,6 @@
* Redraw the textarea
*/
void MultilineTextarea::draw(RenderTarget& dst) {
- if (pic_background_) {
- dst.tile(Recti(0, 0, get_inner_w(), get_inner_h()), pic_background_, Vector2i::zero());
- }
if (use_old_renderer_) {
rt.draw(dst, Vector2i(RICHTEXT_MARGIN, RICHTEXT_MARGIN - scrollbar_.get_scrollpos()));
} else {
@@ -175,9 +171,6 @@
scrollbar_.set_scrollpos(0);
}
-void MultilineTextarea::set_background(const Image* background) {
- pic_background_ = background;
-}
void MultilineTextarea::set_scrollmode(MultilineTextarea::ScrollMode scroll_mode) {
scrollmode_ = scroll_mode;
scrollbar_.set_force_draw(scrollmode_ == ScrollMode::kScrollNormalForced ||
=== modified file 'src/ui_basic/multilinetextarea.h'
--- src/ui_basic/multilinetextarea.h 2017-12-07 11:46:10 +0000
+++ src/ui_basic/multilinetextarea.h 2018-02-13 12:57:13 +0000
@@ -51,9 +51,9 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
+ UI::PanelStyle style,
const std::string& text = std::string(),
const Align = UI::Align::kLeft,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
MultilineTextarea::ScrollMode scroll_mode = MultilineTextarea::ScrollMode::kScrollNormal);
const std::string& get_text() const {
@@ -87,7 +87,6 @@
bool handle_key(bool down, SDL_Keysym code) override;
void scroll_to_top();
- void set_background(const Image* background);
void set_scrollmode(MultilineTextarea::ScrollMode scroll_mode);
protected:
@@ -113,8 +112,6 @@
Scrollbar scrollbar_;
ScrollMode scrollmode_;
-
- const Image* pic_background_;
};
}
=== modified file 'src/ui_basic/panel.cc'
--- src/ui_basic/panel.cc 2018-01-07 18:04:57 +0000
+++ src/ui_basic/panel.cc 2018-02-13 12:57:13 +0000
@@ -440,6 +440,22 @@
}
/**
+ * Draw texture and color from the info if they have been specified.
+ */
+void Panel::draw_background(RenderTarget& dst, const UI::PanelStyleInfo& info) {
+ draw_background(dst, Recti(0, 0, get_w(), get_h()), info);
+}
+void Panel::draw_background(RenderTarget& dst, Recti rect, const UI::PanelStyleInfo& info) {
+ if (info.image != nullptr) {
+ dst.fill_rect(rect, RGBAColor(0, 0, 0, 255));
+ dst.tile(rect, info.image, Vector2i(get_x(), get_y()));
+ }
+ if (info.color != RGBAColor(0, 0, 0, 0)) {
+ dst.fill_rect(rect, info.color, BlendMode::UseAlpha);
+ }
+}
+
+/**
* Called once per event loop pass, unless set_think(false) has
* been called. It is intended to be used for animations and game logic.
*/
=== modified file 'src/ui_basic/panel.h'
--- src/ui_basic/panel.h 2017-11-11 06:52:34 +0000
+++ src/ui_basic/panel.h 2018-02-13 12:57:13 +0000
@@ -32,6 +32,7 @@
#include "base/vector.h"
#include "graphic/align.h"
#include "graphic/font_handler1.h"
+#include "graphic/panel_styles.h"
class RenderTarget;
class Image;
@@ -311,6 +312,8 @@
static void play_new_chat_message();
static bool draw_tooltip(RenderTarget&, const std::string& text);
+ void draw_background(RenderTarget& dst, const UI::PanelStyleInfo&);
+ void draw_background(RenderTarget& dst, Recti rect, const UI::PanelStyleInfo&);
static const Image* default_cursor_;
static const Image* default_cursor_click_;
=== modified file 'src/ui_basic/scrollbar.cc'
--- src/ui_basic/scrollbar.cc 2017-12-17 03:57:22 +0000
+++ src/ui_basic/scrollbar.cc 2018-02-13 12:57:13 +0000
@@ -23,6 +23,7 @@
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "ui_basic/mouse_constants.h"
namespace UI {
@@ -43,7 +44,7 @@
int32_t const y,
uint32_t const w,
uint32_t const h,
- const Image* button_background,
+ UI::PanelStyle style,
bool const horiz)
: Panel(parent, x, y, w, h),
horizontal_(horiz),
@@ -60,7 +61,7 @@
"images/ui_basic/scrollbar_up.png")),
pic_plus_(g_gr->images().get(horiz ? "images/ui_basic/scrollbar_right.png" :
"images/ui_basic/scrollbar_down.png")),
- pic_buttons_(button_background) {
+ button_style_(g_gr->styles().scrollbar_style(style)) {
set_thinks(true);
layout();
}
@@ -233,7 +234,7 @@
}
void Scrollbar::draw_button(RenderTarget& dst, Area area, const Recti& r) {
- dst.tile(r.cast<int>(), pic_buttons_, Vector2i(get_x(), get_y()));
+ draw_background(dst, r.cast<int>(), *button_style_);
// Draw the picture
const Image* pic = nullptr;
=== modified file 'src/ui_basic/scrollbar.h'
--- src/ui_basic/scrollbar.h 2017-12-16 16:52:28 +0000
+++ src/ui_basic/scrollbar.h 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include <boost/signals2.hpp>
#include "base/rect.h"
-#include "graphic/graphic.h"
#include "ui_basic/panel.h"
namespace UI {
@@ -43,7 +42,7 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
bool horiz = false);
boost::signals2::signal<void(int32_t)> moved;
@@ -92,7 +91,6 @@
bool
handle_mousemove(uint8_t state, int32_t mx, int32_t my, int32_t xdiff, int32_t ydiff) override;
-private:
bool horizontal_;
bool force_draw_; // draw this scrollbar, even if it can't do anything
@@ -106,9 +104,9 @@
uint32_t time_nextact_;
int32_t knob_grabdelta_; ///< only while pressed_ == Knob
- const Image* pic_minus_; ///< left/up
- const Image* pic_plus_; ///< right/down
- const Image* pic_buttons_;
+ const Image* pic_minus_; ///< left/up
+ const Image* pic_plus_; ///< right/down
+ const UI::PanelStyleInfo* button_style_; // Background color and texture. Not owned.
};
}
=== modified file 'src/ui_basic/slider.cc'
--- src/ui_basic/slider.cc 2017-08-16 13:23:15 +0000
+++ src/ui_basic/slider.cc 2018-02-13 12:57:13 +0000
@@ -21,7 +21,9 @@
#include <cmath>
#include "graphic/font_handler1.h"
+#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_layout.h"
#include "ui_basic/mouse_constants.h"
@@ -55,7 +57,7 @@
const int32_t min_value,
const int32_t max_value,
const int32_t value,
- const Image* background_picture_id,
+ SliderStyle style,
const std::string& tooltip_text,
const uint32_t cursor_size,
const bool enabled,
@@ -70,7 +72,7 @@
highlighted_(false),
pressed_(false),
enabled_(enabled),
- pic_background_(background_picture_id),
+ cursor_style_(g_gr->styles().slider_style(style)),
x_gap_(x_gap),
y_gap_(y_gap),
bar_size_(bar_size),
@@ -148,12 +150,13 @@
RenderTarget& dst, int32_t const x, int32_t const y, int32_t const w, int32_t const h) {
RGBColor black(0, 0, 0);
-
- dst.tile // background
- (Recti(Vector2i(x, y), w, h), pic_background_, Vector2i(get_x(), get_y()));
-
- if (highlighted_)
- dst.brighten_rect(Recti(x, y, w, h), MOUSE_OVER_BRIGHT_FACTOR);
+ const Recti background_rect(x, y, w, h);
+
+ draw_background(dst, background_rect, *cursor_style_);
+
+ if (highlighted_) {
+ dst.brighten_rect(background_rect, MOUSE_OVER_BRIGHT_FACTOR);
+ }
if (pressed_) { // draw border
dst.brighten_rect // bottom edge
@@ -487,7 +490,7 @@
const uint32_t h,
const std::vector<std::string>& labels_in,
uint32_t value_,
- const Image* background_picture_id,
+ SliderStyle style,
const std::string& tooltip_text,
const uint32_t cursor_size,
const bool enabled)
@@ -501,7 +504,7 @@
0,
labels_in.size() - 1,
value_,
- background_picture_id,
+ style,
tooltip_text,
cursor_size,
enabled),
=== modified file 'src/ui_basic/slider.h'
--- src/ui_basic/slider.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/slider.h 2018-02-13 12:57:13 +0000
@@ -48,7 +48,7 @@
int32_t min_value,
int32_t max_value,
int32_t value,
- const Image* background_picture_id,
+ UI::SliderStyle style,
const std::string& tooltip_text,
uint32_t cursor_size,
bool enabled,
@@ -118,7 +118,7 @@
bool pressed_; // the cursor is pressed
bool enabled_; // enabled widget
- const Image* pic_background_; // background texture (picture ID)
+ const UI::PanelStyleInfo* cursor_style_; // Cursor color and texture. Not owned.
protected:
int32_t x_gap_; // draw positions
@@ -141,7 +141,7 @@
const int32_t min_value,
const int32_t max_value,
const int32_t value,
- const Image* background_picture_id,
+ UI::SliderStyle style,
const std::string& tooltip_text = std::string(),
const uint32_t cursor_size = 20,
const bool enabled = true)
@@ -153,7 +153,7 @@
min_value,
max_value,
value,
- background_picture_id,
+ style,
tooltip_text,
cursor_size,
enabled,
@@ -181,7 +181,7 @@
const int32_t min_value,
const int32_t max_value,
const int32_t value,
- const Image* background_picture_id,
+ UI::SliderStyle style,
const uint32_t cursor_size = 20,
const std::string& tooltip_text = std::string(),
const bool enabled = true)
@@ -193,7 +193,7 @@
min_value,
max_value,
value,
- background_picture_id,
+ style,
tooltip_text,
cursor_size,
enabled,
@@ -221,7 +221,7 @@
const uint32_t h,
const std::vector<std::string>& labels_in,
uint32_t value_,
- const Image* background_picture_id,
+ UI::SliderStyle style,
const std::string& tooltip_text = std::string(),
const uint32_t cursor_size = 20,
const bool enabled = true);
=== modified file 'src/ui_basic/spinbox.cc'
--- src/ui_basic/spinbox.cc 2017-04-22 07:26:13 +0000
+++ src/ui_basic/spinbox.cc 2018-02-13 12:57:13 +0000
@@ -29,6 +29,7 @@
#include "base/macros.h"
#include "base/wexception.h"
#include "graphic/font_handler1.h"
+#include "graphic/graphic.h"
#include "graphic/text/font_set.h"
#include "graphic/text_constants.h"
#include "ui_basic/button.h"
@@ -52,7 +53,7 @@
UI::SpinBox::Units unit;
/// Background tile style of buttons.
- const Image* background;
+ UI::ButtonStyle button_style;
/// Special names for specific values
std::map<int32_t, std::string> value_replacements;
@@ -83,9 +84,9 @@
int32_t const startval,
int32_t const minval,
int32_t const maxval,
+ UI::PanelStyle style,
const std::string& label_text,
const SpinBox::Units& unit,
- const Image* button_background,
SpinBox::Type type,
int32_t step_size,
int32_t big_step_size)
@@ -105,13 +106,13 @@
}
sbi_->value = startval;
sbi_->unit = unit;
- sbi_->background = button_background;
+ sbi_->button_style = style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuMenu :
+ UI::ButtonStyle::kWuiSecondary;
box_ = new UI::Box(this, 0, 0, UI::Box::Horizontal, 0, 0, padding_);
- sbi_->label =
- new UI::MultilineTextarea(box_, 0, 0, 0, 0, label_text, UI::Align::kLeft, button_background,
- UI::MultilineTextarea::ScrollMode::kNoScrolling);
+ sbi_->label = new UI::MultilineTextarea(box_, 0, 0, 0, 0, style, label_text, UI::Align::kLeft,
+ UI::MultilineTextarea::ScrollMode::kNoScrolling);
box_->add(sbi_->label);
sbi_->text = new UI::Textarea(box_, "", UI::Align::kCenter);
@@ -119,23 +120,23 @@
bool is_big = type_ == SpinBox::Type::kBig;
sbi_->button_minus =
- new Button(box_, "-", 0, 0, button_height_, button_height_, sbi_->background,
+ new Button(box_, "-", 0, 0, button_height_, button_height_, sbi_->button_style,
g_gr->images().get(is_big ? "images/ui_basic/scrollbar_left.png" :
"images/ui_basic/scrollbar_down.png"),
_("Decrease the value"));
sbi_->button_plus =
- new Button(box_, "+", 0, 0, button_height_, button_height_, sbi_->background,
+ new Button(box_, "+", 0, 0, button_height_, button_height_, sbi_->button_style,
g_gr->images().get(is_big ? "images/ui_basic/scrollbar_right.png" :
"images/ui_basic/scrollbar_up.png"),
_("Increase the value"));
if (is_big) {
sbi_->button_ten_minus =
- new Button(box_, "--", 0, 0, 2 * button_height_, button_height_, sbi_->background,
+ new Button(box_, "--", 0, 0, 2 * button_height_, button_height_, sbi_->button_style,
g_gr->images().get("images/ui_basic/scrollbar_left_fast.png"),
_("Decrease the value by 10"));
sbi_->button_ten_plus =
- new Button(box_, "++", 0, 0, 2 * button_height_, button_height_, sbi_->background,
+ new Button(box_, "++", 0, 0, 2 * button_height_, button_height_, sbi_->button_style,
g_gr->images().get("images/ui_basic/scrollbar_right_fast.png"),
_("Increase the value by 10"));
=== modified file 'src/ui_basic/spinbox.h'
--- src/ui_basic/spinbox.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/spinbox.h 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include <boost/signals2.hpp>
#include "graphic/align.h"
-#include "graphic/graphic.h"
#include "ui_basic/box.h"
#include "ui_basic/button.h"
@@ -59,9 +58,9 @@
int32_t startval,
int32_t minval,
int32_t maxval,
+ UI::PanelStyle style,
const std::string& label_text = std::string(),
const Units& unit = Units::kNone,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
SpinBox::Type = SpinBox::Type::kSmall,
// The amount by which units are increased/decreased for small and big steps when a
// button is pressed.
=== modified file 'src/ui_basic/table.cc'
--- src/ui_basic/table.cc 2017-12-13 19:31:54 +0000
+++ src/ui_basic/table.cc 2018-02-13 12:57:13 +0000
@@ -22,14 +22,12 @@
#include <boost/bind.hpp>
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
#include "graphic/text/bidi.h"
#include "graphic/text/font_set.h"
#include "graphic/text_constants.h"
#include "graphic/text_layout.h"
#include "graphic/texture.h"
-#include "ui_basic/button.h"
#include "ui_basic/mouse_constants.h"
#include "ui_basic/scrollbar.h"
@@ -47,16 +45,17 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background,
+ PanelStyle style,
TableRows rowtype)
: Panel(parent, x, y, w, h),
total_width_(0),
headerheight_(text_height() + 4),
lineheight_(text_height()),
- button_background_(button_background),
+ button_style_(style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuMenu :
+ UI::ButtonStyle::kWuiSecondary),
scrollbar_(nullptr),
scrollbar_filler_button_(
- new Button(this, "", 0, 0, Scrollbar::kSize, headerheight_, button_background, "")),
+ new Button(this, "", 0, 0, Scrollbar::kSize, headerheight_, button_style_, "")),
scrollpos_(0),
selection_(no_selection_index()),
last_multiselect_(no_selection_index()),
@@ -71,7 +70,7 @@
set_can_focus(true);
scrollbar_filler_button_->set_visible(false);
scrollbar_ = new Scrollbar(this, get_w() - Scrollbar::kSize, headerheight_, Scrollbar::kSize,
- get_h() - headerheight_, button_background);
+ get_h() - headerheight_, style);
scrollbar_->moved.connect(boost::bind(&Table::set_scrollpos, this, _1));
scrollbar_->set_steps(1);
scrollbar_->set_singlestepsize(lineheight_);
@@ -113,8 +112,8 @@
Column c;
// All columns have a title button that is clickable for sorting.
// The title text can be empty.
- c.btn = new Button(this, title, complete_width, 0, width, headerheight_, button_background_,
- title, tooltip_string);
+ c.btn = new Button(this, title, complete_width, 0, width, headerheight_, button_style_, title,
+ tooltip_string);
c.btn->sigclicked.connect(
boost::bind(&Table::header_button_clicked, boost::ref(*this), columns_.size()));
c.width = width;
=== modified file 'src/ui_basic/table.h'
--- src/ui_basic/table.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/table.h 2018-02-13 12:57:13 +0000
@@ -29,7 +29,7 @@
#include "graphic/align.h"
#include "graphic/color.h"
-#include "graphic/graphic.h"
+#include "ui_basic/button.h"
#include "ui_basic/panel.h"
namespace UI {
@@ -58,7 +58,7 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle);
~Table();
@@ -167,7 +167,7 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle);
~Table() override;
@@ -299,7 +299,7 @@
int total_width_;
const uint32_t headerheight_;
int32_t lineheight_;
- const Image* button_background_;
+ UI::ButtonStyle button_style_;
Scrollbar* scrollbar_;
// A disabled button that will fill the space above the scroll bar
UI::Button* scrollbar_filler_button_;
@@ -330,9 +330,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
EntryRecord& add(Entry const* const entry = 0, bool const select_this = false) {
@@ -360,9 +360,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
EntryRecord& add(Entry* const entry = 0, bool const select_this = false) {
@@ -390,9 +390,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
EntryRecord& add(const Entry& entry, bool const select_this = false) {
@@ -424,9 +424,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
EntryRecord& add(Entry& entry, bool const select_this = false) {
@@ -460,9 +460,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
EntryRecord& add(uintptr_t const entry, bool const select_this = false) {
@@ -492,9 +492,9 @@
int32_t y,
uint32_t w,
uint32_t h,
- const Image* button_background = g_gr->images().get("images/ui_basic/but3.png"),
+ UI::PanelStyle style,
TableRows rowtype = TableRows::kSingle)
- : Base(parent, x, y, w, h, button_background, rowtype) {
+ : Base(parent, x, y, w, h, style, rowtype) {
}
};
}
=== modified file 'src/ui_basic/tabpanel.cc'
--- src/ui_basic/tabpanel.cc 2017-08-08 17:39:40 +0000
+++ src/ui_basic/tabpanel.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,9 @@
#include "ui_basic/tabpanel.h"
#include "graphic/font_handler1.h"
+#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_layout.h"
#include "ui_basic/mouse_constants.h"
@@ -90,12 +92,16 @@
* Initialize an empty TabPanel. We use width == 0 as an indicator that the size hasn't been set
* yet.
*/
-TabPanel::TabPanel(Panel* const parent, const Image* background, TabPanel::Type border_type)
- : Panel(parent, 0, 0, 0, 0),
- border_type_(border_type),
+TabPanel::TabPanel(Panel* const parent, UI::TabPanelStyle style)
+ : Panel(parent,
+ 0,
+ 0,
+ 0,
+ 0),
+ style_(style),
active_(0),
highlight_(kNotFound),
- pic_background_(background) {
+ background_style_(g_gr->styles().tabpanel_style(style)) {
}
/**
@@ -113,7 +119,7 @@
// avoid excessive craziness in case there is a wraparound
h = std::min(h, h - (kTabPanelButtonHeight + kTabPanelSeparatorHeight));
// If we have a border, we will also want some margin to the bottom
- if (border_type_ == TabPanel::Type::kBorder) {
+ if (style_ == UI::TabPanelStyle::kFsMenu) {
h -= kTabPanelSeparatorHeight;
}
panel->set_size(get_w(), h);
@@ -182,7 +188,7 @@
tabs_.push_back(new Tab(this, id, x, name, title, pic, tooltip_text, panel));
// Add a margin if there is a border
- if (border_type_ == TabPanel::Type::kBorder) {
+ if (style_ == UI::TabPanelStyle::kFsMenu) {
panel->set_border(kTabPanelSeparatorHeight + 1, kTabPanelSeparatorHeight + 1,
kTabPanelSeparatorHeight, kTabPanelSeparatorHeight);
panel->set_pos(Vector2i(0, kTabPanelButtonHeight));
@@ -245,22 +251,19 @@
return;
}
- // draw the background
+ // Draw the background
static_assert(2 < kTabPanelButtonHeight, "assert(2 < kTabPanelButtonSize) failed.");
static_assert(4 < kTabPanelButtonHeight, "assert(4 < kTabPanelButtonSize) failed.");
-
- if (pic_background_) {
- if (!tabs_.empty()) {
- dst.tile(Recti(Vector2i::zero(), tabs_.back()->get_x() + tabs_.back()->get_w(),
- kTabPanelButtonHeight - 2),
- pic_background_, Vector2i(get_x(), get_y()));
- }
- assert(kTabPanelButtonHeight - 2 <= get_h());
- dst.tile(Recti(Vector2i(0, kTabPanelButtonHeight - 2), get_w(),
- get_h() - kTabPanelButtonHeight + 2),
- pic_background_, Vector2i(get_x(), get_y() + kTabPanelButtonHeight - 2));
- }
-
+ assert(kTabPanelButtonHeight - 2 <= get_h());
+
+ draw_background(
+ dst, Recti(0, 0, tabs_.back()->get_x() + tabs_.back()->get_w(), kTabPanelButtonHeight - 2),
+ *background_style_);
+ draw_background(
+ dst, Recti(0, kTabPanelButtonHeight - 2, get_w(), get_h() - kTabPanelButtonHeight + 2),
+ *background_style_);
+
+ // Draw the buttons
RGBColor black(0, 0, 0);
// draw the buttons
@@ -321,7 +324,7 @@
2 * BUTTON_EDGE_BRIGHT_FACTOR);
// Draw border around the main panel
- if (border_type_ == TabPanel::Type::kBorder) {
+ if (style_ == UI::TabPanelStyle::kFsMenu) {
// left edge
dst.brighten_rect(Recti(0, kTabPanelButtonHeight, 2, get_h() - 2), BUTTON_EDGE_BRIGHT_FACTOR);
// bottom edge
=== modified file 'src/ui_basic/tabpanel.h'
--- src/ui_basic/tabpanel.h 2017-12-14 09:02:31 +0000
+++ src/ui_basic/tabpanel.h 2018-02-13 12:57:13 +0000
@@ -86,13 +86,10 @@
*
*/
struct TabPanel : public Panel {
- enum class Type { kNoBorder, kBorder };
friend struct Tab;
- TabPanel(Panel* parent,
- const Image* background,
- TabPanel::Type border_type = TabPanel::Type::kNoBorder);
+ TabPanel(Panel* parent, UI::TabPanelStyle style);
/** Add textual tab
*
@@ -129,7 +126,7 @@
void layout() override;
void update_desired_size() override;
- TabPanel::Type border_type_; ///< whether there will be a border around the panels.
+ UI::TabPanelStyle style_;
private:
// Common adding function for textual and pictorial tabs
@@ -153,7 +150,7 @@
size_t active_; ///< index of the currently active tab
size_t highlight_; ///< index of the highlighted button
- const Image* pic_background_; ///< picture used to draw background
+ const UI::PanelStyleInfo* background_style_; // Background color and texture. Not owned.
};
}
=== modified file 'src/ui_basic/window.cc'
--- src/ui_basic/window.cc 2017-11-12 13:34:46 +0000
+++ src/ui_basic/window.cc 2018-02-13 12:57:13 +0000
@@ -25,6 +25,7 @@
#include "graphic/font_handler1.h"
#include "graphic/graphic.h"
#include "graphic/rendertarget.h"
+#include "graphic/style_manager.h"
#include "graphic/text_layout.h"
namespace UI {
@@ -87,11 +88,11 @@
drag_start_win_y_(0),
drag_start_mouse_x_(0),
drag_start_mouse_y_(0),
- pic_lborder_(g_gr->images().get("images/wui/window_left.png")),
- pic_rborder_(g_gr->images().get("images/wui/window_right.png")),
- pic_top_(g_gr->images().get("images/wui/window_top.png")),
- pic_bottom_(g_gr->images().get("images/wui/window_bottom.png")),
- pic_background_(g_gr->images().get("images/wui/window_background.png")),
+ pic_lborder_(g_gr->images().get(kTemplateDir + "wui/left.png")),
+ pic_rborder_(g_gr->images().get(kTemplateDir + "wui/right.png")),
+ pic_top_(g_gr->images().get(kTemplateDir + "wui/top.png")),
+ pic_bottom_(g_gr->images().get(kTemplateDir + "wui/bottom.png")),
+ pic_background_(g_gr->images().get(kTemplateDir + "wui/background.png")),
center_panel_(nullptr),
fastclick_panel_(nullptr) {
set_title(title);
=== modified file 'src/ui_fsmenu/about.cc'
--- src/ui_fsmenu/about.cc 2017-08-08 17:39:40 +0000
+++ src/ui_fsmenu/about.cc 2018-02-13 12:57:13 +0000
@@ -22,13 +22,12 @@
#include <boost/format.hpp>
#include "base/i18n.h"
-#include "graphic/graphic.h"
FullscreenMenuAbout::FullscreenMenuAbout()
: FullscreenMenuBase(),
title_(this, 0, 0, _("About Widelands"), UI::Align::kCenter),
- close_(this, "close", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("Close")),
- tabs_(this, g_gr->images().get("images/ui_basic/but1.png"), UI::TabPanel::Type::kBorder) {
+ close_(this, "close", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("Close")),
+ tabs_(this, UI::PanelStyle::kFsMenu, UI::TabPanelStyle::kFsMenu) {
title_.set_fontsize(UI_FONT_SIZE_BIG);
tabs_.add_tab("txts/README.lua");
tabs_.add_tab("txts/LICENSE.lua");
=== modified file 'src/ui_fsmenu/campaign_select.cc'
--- src/ui_fsmenu/campaign_select.cc 2017-11-18 16:54:13 +0000
+++ src/ui_fsmenu/campaign_select.cc 2018-02-13 12:57:13 +0000
@@ -42,7 +42,7 @@
*/
FullscreenMenuCampaignSelect::FullscreenMenuCampaignSelect()
: FullscreenMenuLoadMapOrGame(),
- table_(this, tablex_, tabley_, tablew_, tableh_),
+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
// Main Title
title_(this, get_w() / 2, tabley_ / 3, _("Choose a campaign"), UI::Align::kCenter),
@@ -53,21 +53,24 @@
right_column_x_ + indent_,
get_y_from_preceding(label_campname_) + padding_,
get_right_column_w(right_column_x_) - indent_,
- label_height_),
+ label_height_,
+ UI::PanelStyle::kFsMenu),
label_tribename_(this, right_column_x_, get_y_from_preceding(ta_campname_) + 2 * padding_),
ta_tribename_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_tribename_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- label_height_),
+ label_height_,
+ UI::PanelStyle::kFsMenu),
label_difficulty_(this, right_column_x_, get_y_from_preceding(ta_tribename_) + 2 * padding_),
ta_difficulty_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_difficulty_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- 2 * label_height_ - padding_),
+ 2 * label_height_ - padding_,
+ UI::PanelStyle::kFsMenu),
label_description_(this,
right_column_x_,
@@ -77,7 +80,8 @@
right_column_x_ + indent_,
get_y_from_preceding(label_description_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- buty_ - get_y_from_preceding(label_description_) - 4 * padding_) {
+ buty_ - get_y_from_preceding(label_description_) - 4 * padding_,
+ UI::PanelStyle::kFsMenu) {
title_.set_fontsize(UI_FONT_SIZE_BIG);
back_.set_tooltip(_("Return to the main menu"));
ok_.set_tooltip(_("Play this campaign"));
@@ -265,7 +269,7 @@
*/
FullscreenMenuCampaignMapSelect::FullscreenMenuCampaignMapSelect(bool is_tutorial)
: FullscreenMenuLoadMapOrGame(),
- table_(this, tablex_, tabley_, tablew_, tableh_),
+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
// Main title
title_(this,
@@ -278,6 +282,7 @@
get_y_from_preceding(title_) + 6 * padding_,
get_w() * 2 / 3,
4 * label_height_,
+ UI::PanelStyle::kFsMenu,
"",
UI::Align::kCenter),
@@ -287,21 +292,24 @@
right_column_x_ + indent_,
get_y_from_preceding(label_mapname_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- label_height_),
+ label_height_,
+ UI::PanelStyle::kFsMenu),
label_author_(this, right_column_x_, get_y_from_preceding(ta_mapname_) + 2 * padding_),
ta_author_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_author_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- 2 * label_height_),
+ 2 * label_height_,
+ UI::PanelStyle::kFsMenu),
label_description_(this, right_column_x_, get_y_from_preceding(ta_author_) + padding_),
ta_description_(this,
right_column_x_ + indent_,
get_y_from_preceding(label_description_) + padding_,
get_right_column_w(right_column_x_ + indent_),
- buty_ - get_y_from_preceding(label_description_) - 4 * padding_),
+ buty_ - get_y_from_preceding(label_description_) - 4 * padding_,
+ UI::PanelStyle::kFsMenu),
is_tutorial_(is_tutorial) {
title_.set_fontsize(UI_FONT_SIZE_BIG);
=== modified file 'src/ui_fsmenu/helpwindow.cc'
--- src/ui_fsmenu/helpwindow.cc 2017-12-19 08:04:37 +0000
+++ src/ui_fsmenu/helpwindow.cc 2018-02-13 12:57:13 +0000
@@ -40,15 +40,15 @@
uint32_t height)
: Window(
parent, "help_window", 0, 0, width, height, (boost::format(_("Help: %s")) % caption).str()),
- textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 30)) {
+ textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 30, UI::PanelStyle::kWui)) {
int margin = 5;
// Calculate sizes
width = (width == 0) ? g_gr->get_xres() * 3 / 5 : width;
height = (height == 0) ? g_gr->get_yres() * 4 / 5 : height;
- Button* btn = new Button(this, "ok", width / 3, 0, width / 3, 0,
- g_gr->images().get("images/ui_basic/but5.png"), _("OK"));
+ Button* btn =
+ new Button(this, "ok", width / 3, 0, width / 3, 0, UI::ButtonStyle::kWuiPrimary, _("OK"));
btn->sigclicked.connect(boost::bind(&FullscreenHelpWindow::clicked_ok, boost::ref(*this)));
btn->set_pos(Vector2i(btn->get_x(), height - margin - btn->get_h()));
=== modified file 'src/ui_fsmenu/internet_lobby.cc'
--- src/ui_fsmenu/internet_lobby.cc 2018-01-09 18:54:06 +0000
+++ src/ui_fsmenu/internet_lobby.cc 2018-02-13 12:57:13 +0000
@@ -61,7 +61,7 @@
get_h() * 55 / 100,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Join this game")),
hostgame_(this,
"host_game",
@@ -69,7 +69,7 @@
get_h() * 81 / 100,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Open a new game")),
back_(this,
"back",
@@ -77,22 +77,18 @@
get_h() * 90 / 100,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Back")),
// Edit boxes
- edit_servername_(this,
- get_w() * 17 / 25,
- get_h() * 68 / 100,
- butw_,
- buth_,
- 2,
- g_gr->images().get("images/ui_basic/but2.png"),
- fs_),
+ edit_servername_(
+ this, get_w() * 17 / 25, get_h() * 68 / 100, butw_, buth_, 2, UI::PanelStyle::kFsMenu, fs_),
// List
- clientsonline_list_(this, get_w() * 4 / 125, get_h() / 5, lisw_, get_h() * 3 / 10),
- opengames_list_(this, get_w() * 17 / 25, get_h() / 5, butw_, get_h() * 7 / 20),
+ clientsonline_list_(
+ this, get_w() * 4 / 125, get_h() / 5, lisw_, get_h() * 3 / 10, UI::PanelStyle::kFsMenu),
+ opengames_list_(
+ this, get_w() * 17 / 25, get_h() / 5, butw_, get_h() * 7 / 20, UI::PanelStyle::kFsMenu),
// The chat UI
chat(this,
@@ -100,7 +96,8 @@
get_h() * 51 / 100,
lisw_,
get_h() * 44 / 100,
- InternetGaming::ref()),
+ InternetGaming::ref(),
+ UI::PanelStyle::kFsMenu),
// Login information
nickname_(nick),
=== modified file 'src/ui_fsmenu/launch_game.cc'
--- src/ui_fsmenu/launch_game.cc 2017-06-18 08:19:06 +0000
+++ src/ui_fsmenu/launch_game.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "base/i18n.h"
#include "base/warning.h"
#include "base/wexception.h"
-#include "graphic/graphic.h"
#include "graphic/text_constants.h"
#include "logic/game.h"
#include "logic/game_controller.h"
@@ -53,23 +52,11 @@
butw_,
get_h() - get_h() * 4 / 10 - buth_,
buth_,
- ""),
- ok_(this,
- "ok",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get("images/ui_basic/but2.png"),
- _("Start game")),
- back_(this,
- "back",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get("images/ui_basic/but0.png"),
- _("Back")),
+ "",
+ UI::DropdownType::kTextual,
+ UI::PanelStyle::kFsMenu),
+ ok_(this, "ok", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuPrimary, _("Start game")),
+ back_(this, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuSecondary, _("Back")),
// Text labels
title_(this, get_w() / 2, get_h() / 25, "", UI::Align::kCenter),
// Variables and objects used in the menu
=== modified file 'src/ui_fsmenu/launch_game.h'
--- src/ui_fsmenu/launch_game.h 2017-11-27 21:21:06 +0000
+++ src/ui_fsmenu/launch_game.h 2018-02-13 12:57:13 +0000
@@ -27,7 +27,6 @@
#include "logic/map.h"
#include "ui_basic/button.h"
#include "ui_basic/dropdown.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "ui_fsmenu/base.h"
=== modified file 'src/ui_fsmenu/launch_mpg.cc'
--- src/ui_fsmenu/launch_mpg.cc 2017-12-19 07:17:15 +0000
+++ src/ui_fsmenu/launch_mpg.cc 2018-02-13 12:57:13 +0000
@@ -59,24 +59,24 @@
uint32_t space = y;
uint32_t butw = get_inner_w() - 2 * space;
uint32_t buth = (get_inner_h() - 2 * space) / 5;
- UI::Button* btn = new UI::Button(this, "map", space, y, butw, buth,
- g_gr->images().get("images/ui_basic/but0.png"), _("Map"),
- _("Select a map"));
+ UI::Button* btn =
+ new UI::Button(this, "map", space, y, butw, buth, UI::ButtonStyle::kFsMenuSecondary,
+ _("Map"), _("Select a map"));
btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
boost::ref(*this),
FullscreenMenuBase::MenuTarget::kNormalGame));
btn = new UI::Button(this, "saved_game", space, y + buth + space, butw, buth,
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
/** Translators: This is a button to select a savegame */
_("Saved Game"), _("Select a saved game"));
btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
boost::ref(*this),
FullscreenMenuBase::MenuTarget::kScenarioGame));
- btn = new UI::Button(this, "cancel", space + butw / 4, y + 3 * buth + 2 * space, butw / 2,
- buth, g_gr->images().get("images/ui_basic/but1.png"), _("Cancel"),
- _("Cancel selection"));
+ btn =
+ new UI::Button(this, "cancel", space + butw / 4, y + 3 * buth + 2 * space, butw / 2, buth,
+ UI::ButtonStyle::kFsMenuSecondary, _("Cancel"), _("Cancel selection"));
btn->sigclicked.connect(boost::bind(&MapOrSaveSelectionWindow::pressedButton,
boost::ref(*this),
FullscreenMenuBase::MenuTarget::kBack));
@@ -114,7 +114,7 @@
get_h() * 3 / 20,
buth_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
g_gr->images().get("images/wui/menus/menu_toggle_minimap.png"),
_("Change map or saved game")),
help_button_(this,
@@ -123,7 +123,7 @@
get_h() / 100,
buth_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
g_gr->images().get("images/ui_basic/menu_help.png"),
_("Show the help window")),
@@ -151,10 +151,18 @@
_("Type of game"),
UI::Align::kCenter),
- map_info_(
- this, right_column_x_, get_h() * 2 / 10, butw_, get_h() * 23 / 80 - 2 * label_height_),
- client_info_(
- this, right_column_x_, get_h() * 13 / 20 - 2 * label_height_, butw_, 2 * label_height_),
+ map_info_(this,
+ right_column_x_,
+ get_h() * 2 / 10,
+ butw_,
+ get_h() * 23 / 80 - 2 * label_height_,
+ UI::PanelStyle::kFsMenu),
+ client_info_(this,
+ right_column_x_,
+ get_h() * 13 / 20 - 2 * label_height_,
+ butw_,
+ 2 * label_height_,
+ UI::PanelStyle::kFsMenu),
help_(nullptr),
// Variables and objects used in the menu
@@ -215,8 +223,8 @@
*/
void FullscreenMenuLaunchMPG::set_chat_provider(ChatProvider& chat) {
delete chat_;
- chat_ = new GameChatPanel(
- this, get_w() / 50, get_h() * 13 / 20, get_w() * 57 / 80, get_h() * 3 / 10, chat);
+ chat_ = new GameChatPanel(this, get_w() / 50, get_h() * 13 / 20, get_w() * 57 / 80,
+ get_h() * 3 / 10, chat, UI::PanelStyle::kFsMenu);
}
/**
=== modified file 'src/ui_fsmenu/launch_mpg.h'
--- src/ui_fsmenu/launch_mpg.h 2017-11-27 21:21:06 +0000
+++ src/ui_fsmenu/launch_mpg.h 2018-02-13 12:57:13 +0000
@@ -25,7 +25,6 @@
#include "logic/game_settings.h"
#include "ui_basic/button.h"
-#include "ui_basic/dropdown.h"
#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "ui_fsmenu/helpwindow.h"
=== modified file 'src/ui_fsmenu/launch_spg.cc'
--- src/ui_fsmenu/launch_spg.cc 2017-06-15 05:48:10 +0000
+++ src/ui_fsmenu/launch_spg.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "base/i18n.h"
#include "base/warning.h"
#include "base/wexception.h"
-#include "graphic/graphic.h"
#include "graphic/text_constants.h"
#include "helper.h"
#include "io/filesystem/layered_filesystem.h"
@@ -52,7 +51,7 @@
get_h() * 3 / 10,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Select map")),
// Text labels
@@ -106,8 +105,8 @@
pos_[i] =
new UI::Button(this, "switch_to_position", get_w() / 100, y += buth_, get_h() * 17 / 500,
- get_h() * 17 / 500, g_gr->images().get("images/ui_basic/but1.png"),
- player_image, _("Switch to position"));
+ get_h() * 17 / 500, UI::ButtonStyle::kFsMenuSecondary, player_image,
+ _("Switch to position"));
pos_[i]->sigclicked.connect(
boost::bind(&FullscreenMenuLaunchSPG::switch_to_position, boost::ref(*this), i));
players_[i] = new PlayerDescriptionGroup(
=== modified file 'src/ui_fsmenu/launch_spg.h'
--- src/ui_fsmenu/launch_spg.h 2017-11-27 21:21:06 +0000
+++ src/ui_fsmenu/launch_spg.h 2018-02-13 12:57:13 +0000
@@ -26,8 +26,6 @@
#include "graphic/playercolor.h"
#include "logic/map.h"
#include "ui_basic/button.h"
-#include "ui_basic/dropdown.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "ui_fsmenu/launch_game.h"
=== modified file 'src/ui_fsmenu/load_map_or_game.cc'
--- src/ui_fsmenu/load_map_or_game.cc 2017-08-30 09:37:24 +0000
+++ src/ui_fsmenu/load_map_or_game.cc 2018-02-13 12:57:13 +0000
@@ -22,10 +22,8 @@
#include <memory>
#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
#include "ui_basic/button.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
/// Select a Map, Saved Game or Replay in Fullscreen Mode.
@@ -34,8 +32,8 @@
FullscreenMenuLoadMapOrGame::FullscreenMenuLoadMapOrGame()
: FullscreenMenuBase(),
// Main buttons
- back_(this, "back", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but0.png"), _("Back")),
- ok_(this, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")) {
+ back_(this, "back", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Back")),
+ ok_(this, "ok", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("OK")) {
layout();
}
=== modified file 'src/ui_fsmenu/load_map_or_game.h'
--- src/ui_fsmenu/load_map_or_game.h 2017-08-30 09:37:24 +0000
+++ src/ui_fsmenu/load_map_or_game.h 2018-02-13 12:57:13 +0000
@@ -27,10 +27,8 @@
#include <boost/algorithm/string.hpp>
#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
#include "ui_basic/button.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/table.h"
#include "ui_basic/textarea.h"
#include "wui/maptable.h"
=== modified file 'src/ui_fsmenu/loadgame.cc'
--- src/ui_fsmenu/loadgame.cc 2017-11-24 09:19:52 +0000
+++ src/ui_fsmenu/loadgame.cc 2018-02-13 12:57:13 +0000
@@ -27,7 +27,7 @@
FullscreenMenuLoadGame::FullscreenMenuLoadGame(Widelands::Game& g,
GameSettingsProvider* gsp,
bool is_replay)
- : FullscreenMenuLoadMapOrGame(),
+ : FullscreenMenuLoadMapOrGame(),
main_box_(this, 0, 0, UI::Box::Vertical),
info_box_(&main_box_, 0, 0, UI::Box::Horizontal),
@@ -45,7 +45,7 @@
LoadOrSaveGame::FileType::kReplay :
(gsp->settings().multiplayer ? LoadOrSaveGame::FileType::kGameMultiPlayer :
LoadOrSaveGame::FileType::kGameSinglePlayer),
- GameDetails::Style::kFsMenu,
+ UI::PanelStyle::kFsMenu,
true),
is_replay_(is_replay) {
=== modified file 'src/ui_fsmenu/main.cc'
--- src/ui_fsmenu/main.cc 2017-02-26 12:16:09 +0000
+++ src/ui_fsmenu/main.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include "base/i18n.h"
#include "build_info.h"
-#include "graphic/graphic.h"
FullscreenMenuMain::FullscreenMenuMain()
: FullscreenMenuMainMenu(),
@@ -35,7 +34,7 @@
0,
butw_,
buth_,
- g_gr->images().get(button_background_),
+ UI::ButtonStyle::kFsMenuMenu,
_("Play Tutorial")),
singleplayer(&vbox_,
"single_player",
@@ -43,50 +42,15 @@
0,
butw_,
buth_,
- g_gr->images().get(button_background_),
+ UI::ButtonStyle::kFsMenuMenu,
_("Single Player")),
- multiplayer(&vbox_,
- "multi_player",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Multiplayer")),
- replay(&vbox_,
- "replay",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Watch Replay")),
- editor(
- &vbox_, "editor", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Editor")),
- options(&vbox_,
- "options",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Options")),
- about(&vbox_,
- "about",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("About Widelands")),
- exit(&vbox_,
- "exit",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Exit Widelands")),
+ multiplayer(
+ &vbox_, "multi_player", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Multiplayer")),
+ replay(&vbox_, "replay", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Watch Replay")),
+ editor(&vbox_, "editor", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Editor")),
+ options(&vbox_, "options", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Options")),
+ about(&vbox_, "about", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("About Widelands")),
+ exit(&vbox_, "exit", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Exit Widelands")),
// Textlabels
version(
=== modified file 'src/ui_fsmenu/main_menu.cc'
--- src/ui_fsmenu/main_menu.cc 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/main_menu.cc 2018-02-13 12:57:13 +0000
@@ -29,7 +29,6 @@
buth_(get_h() * 9 / 200),
title_y_(get_h() * 3 / 40),
padding_(buth_ / 3),
- button_background_("images/ui_basic//but3.png"),
vbox_(this, 0, 0, UI::Box::Vertical, 0, 0, padding_) {
}
=== modified file 'src/ui_fsmenu/main_menu.h'
--- src/ui_fsmenu/main_menu.h 2017-01-25 18:55:59 +0000
+++ src/ui_fsmenu/main_menu.h 2018-02-13 12:57:13 +0000
@@ -40,7 +40,6 @@
uint32_t title_y_;
uint32_t padding_;
- const std::string button_background_;
UI::Box vbox_;
};
=== modified file 'src/ui_fsmenu/mapselect.cc'
--- src/ui_fsmenu/mapselect.cc 2017-11-26 17:26:55 +0000
+++ src/ui_fsmenu/mapselect.cc 2018-02-13 12:57:13 +0000
@@ -27,7 +27,6 @@
#include "base/log.h"
#include "base/wexception.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/filesystem_constants.h"
#include "logic/game_controller.h"
@@ -50,13 +49,13 @@
// Main title
title_(this, 0, 0, _("Choose a map"), UI::Align::kCenter),
checkboxes_(this, 0, 0, UI::Box::Vertical, 0, 0, 2 * padding_),
- table_(this, tablex_, tabley_, tablew_, tableh_),
+ table_(this, tablex_, tabley_, tablew_, tableh_, UI::PanelStyle::kFsMenu),
map_details_(this,
right_column_x_,
tabley_,
get_right_column_w(right_column_x_),
tableh_ - buth_ - 4 * padding_,
- MapDetails::Style::kFsMenu),
+ UI::PanelStyle::kFsMenu),
scenario_types_(settings->settings().multiplayer ? Map::MP_SCENARIO : Map::SP_SCENARIO),
basedir_(kMapsDir),
=== modified file 'src/ui_fsmenu/multiplayer.cc'
--- src/ui_fsmenu/multiplayer.cc 2017-11-28 20:54:16 +0000
+++ src/ui_fsmenu/multiplayer.cc 2018-02-13 12:57:13 +0000
@@ -35,24 +35,11 @@
title(this, 0, 0, _("Choose game type"), UI::Align::kCenter),
// Buttons
- metaserver(&vbox_,
- "metaserver",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Internet game")),
+ metaserver(
+ &vbox_, "metaserver", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Internet game")),
showloginbox(nullptr),
- lan(&vbox_,
- "lan",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("LAN / Direct IP")),
- back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
+ lan(&vbox_, "lan", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("LAN / Direct IP")),
+ back(&vbox_, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Back")) {
metaserver.sigclicked.connect(
boost::bind(&FullscreenMenuMultiPlayer::internet_login, boost::ref(*this)));
@@ -74,9 +61,9 @@
Section& s = g_options.pull_section("global");
auto_log_ = s.get_bool("auto_log", false);
if (auto_log_) {
- showloginbox = new UI::Button(
- this, "login_dialog", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but1.png"),
- g_gr->images().get("images/ui_basic/continue.png"), _("Show login dialog"));
+ showloginbox =
+ new UI::Button(this, "login_dialog", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary,
+ g_gr->images().get("images/ui_basic/continue.png"), _("Show login dialog"));
showloginbox->sigclicked.connect(
boost::bind(&FullscreenMenuMultiPlayer::show_internet_login, boost::ref(*this)));
}
=== modified file 'src/ui_fsmenu/netsetup_lan.cc'
--- src/ui_fsmenu/netsetup_lan.cc 2017-11-11 14:27:22 +0000
+++ src/ui_fsmenu/netsetup_lan.cc 2018-02-13 12:57:13 +0000
@@ -50,7 +50,7 @@
get_h() * 5333 / 10000,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Join this game")),
hostgame(this,
"host_game",
@@ -58,7 +58,7 @@
get_h() * 6083 / 10000,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Host a new game")),
back(this,
"back",
@@ -66,7 +66,7 @@
get_h() * 8333 / 10000,
butw_,
buth_,
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
_("Back")),
loadlasthost(this,
"load_previous_host",
@@ -74,7 +74,7 @@
get_h() * 19 / 40,
buth_,
buth_,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
g_gr->images().get("images/ui_fsmenu/menu_load_game.png"),
_("Load previous host")),
@@ -85,7 +85,7 @@
butw_,
buth_,
2,
- g_gr->images().get("images/ui_basic/but2.png"),
+ UI::PanelStyle::kFsMenu,
fs_small()),
hostname(this,
get_w() * 16 / 25,
@@ -93,11 +93,16 @@
get_w() * 17 / 80,
buth_,
2,
- g_gr->images().get("images/ui_basic/but2.png"),
+ UI::PanelStyle::kFsMenu,
fs_small()),
// List
- opengames(this, get_w() * 3 / 50, get_h() * 3333 / 10000, listw_, get_h() * 5433 / 10000) {
+ opengames(this,
+ get_w() * 3 / 50,
+ get_h() * 3333 / 10000,
+ listw_,
+ get_h() * 5433 / 10000,
+ UI::PanelStyle::kFsMenu) {
joingame.sigclicked.connect(
boost::bind(&FullscreenMenuNetSetupLAN::clicked_joingame, boost::ref(*this)));
hostgame.sigclicked.connect(
=== modified file 'src/ui_fsmenu/options.cc'
--- src/ui_fsmenu/options.cc 2017-12-14 09:02:31 +0000
+++ src/ui_fsmenu/options.cc 2018-02-13 12:57:13 +0000
@@ -83,26 +83,12 @@
// Buttons
button_box_(this, 0, 0, UI::Box::Horizontal),
- cancel_(&button_box_,
- "cancel",
- 0,
- 0,
- 0,
- 0,
- g_gr->images().get("images/ui_basic/but0.png"),
- _("Cancel")),
- apply_(&button_box_,
- "apply",
- 0,
- 0,
- 0,
- 0,
- g_gr->images().get("images/ui_basic/but0.png"),
- _("Apply")),
- ok_(&button_box_, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but2.png"), _("OK")),
+ cancel_(&button_box_, "cancel", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Cancel")),
+ apply_(&button_box_, "apply", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuSecondary, _("Apply")),
+ ok_(&button_box_, "ok", 0, 0, 0, 0, UI::ButtonStyle::kFsMenuPrimary, _("OK")),
// Tabs
- tabs_(this, g_gr->images().get("images/ui_basic/but1.png"), UI::TabPanel::Type::kBorder),
+ tabs_(this, UI::TabPanelStyle::kFsMenu),
box_interface_(&tabs_, 0, 0, UI::Box::Horizontal, 0, 0, padding_),
box_interface_left_(&box_interface_, 0, 0, UI::Box::Vertical, 0, 0, padding_),
@@ -118,19 +104,23 @@
100, // 100 is arbitrary, will be resized in layout().
100, // 100 is arbitrary, will be resized in layout().
24,
- _("Language")),
+ _("Language"),
+ UI::DropdownType::kTextual,
+ UI::PanelStyle::kFsMenu),
resolution_dropdown_(&box_interface_left_,
0,
0,
100, // 100 is arbitrary, will be resized in layout().
100, // 100 is arbitrary, will be resized in layout().
24,
- _("Window Size")),
+ _("Window Size"),
+ UI::DropdownType::kTextual,
+ UI::PanelStyle::kFsMenu),
fullscreen_(&box_interface_left_, Vector2i::zero(), _("Fullscreen"), "", 0),
- inputgrab_(&box_interface_left_, Vector2i::zero(), _("Grab input"), "", 0),
- sb_maxfps_(&box_interface_left_, 0, 0, 0, 0, opt.maxfps, 0, 99, _("Maximum FPS:")),
- translation_info_(&box_interface_, 0, 0, 100, 100),
+ inputgrab_(&box_interface_left_, Vector2i::zero(), _("Grab Input"), "", 0),
+ sb_maxfps_(&box_interface_left_, 0, 0, 0, 0, opt.maxfps, 0, 99, UI::PanelStyle::kFsMenu, _("Maximum FPS:")),
+ translation_info_(&box_interface_, 0, 0, 100, 100, UI::PanelStyle::kFsMenu),
// Windows options
snap_win_overlap_only_(
@@ -147,6 +137,7 @@
opt.panel_snap_distance,
0,
99,
+ UI::PanelStyle::kFsMenu,
_("Distance for windows to snap to other panels:"),
UI::SpinBox::Units::kPixels),
@@ -158,6 +149,7 @@
opt.border_snap_distance,
0,
99,
+ UI::PanelStyle::kFsMenu,
_("Distance for windows to snap to borders:"),
UI::SpinBox::Units::kPixels),
@@ -175,9 +167,9 @@
opt.autosave / 60,
0,
100,
+ UI::PanelStyle::kFsMenu,
_("Save game automatically every:"),
UI::SpinBox::Units::kMinutes,
- g_gr->images().get("images/ui_basic/but3.png"),
UI::SpinBox::Type::kBig),
sb_rolling_autosave_(&box_saving_,
@@ -188,9 +180,9 @@
opt.rolling_autosave,
1,
20,
+ UI::PanelStyle::kFsMenu,
_("Maximum number of autosave files:"),
UI::SpinBox::Units::kNone,
- g_gr->images().get("images/ui_basic/but3.png"),
UI::SpinBox::Type::kBig),
zip_(&box_saving_,
=== modified file 'src/ui_fsmenu/singleplayer.cc'
--- src/ui_fsmenu/singleplayer.cc 2017-02-25 13:27:40 +0000
+++ src/ui_fsmenu/singleplayer.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,6 @@
#include "ui_fsmenu/singleplayer.h"
#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "graphic/text_constants.h"
FullscreenMenuSinglePlayer::FullscreenMenuSinglePlayer()
@@ -30,31 +29,12 @@
title(this, 0, 0, _("Single Player"), UI::Align::kCenter),
// Buttons
- new_game(&vbox_,
- "new_game",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("New Game")),
- campaign(&vbox_,
- "campaigns",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Campaigns")),
- load_game(&vbox_,
- "load_game",
- 0,
- 0,
- butw_,
- buth_,
- g_gr->images().get(button_background_),
- _("Load Game")),
- back(&vbox_, "back", 0, 0, butw_, buth_, g_gr->images().get(button_background_), _("Back")) {
+ new_game(&vbox_, "new_game", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("New Game")),
+ campaign(
+ &vbox_, "campaigns", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Campaigns")),
+ load_game(
+ &vbox_, "load_game", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Load Game")),
+ back(&vbox_, "back", 0, 0, butw_, buth_, UI::ButtonStyle::kFsMenuMenu, _("Back")) {
new_game.sigclicked.connect(
boost::bind(&FullscreenMenuSinglePlayer::end_modal<FullscreenMenuBase::MenuTarget>,
boost::ref(*this), FullscreenMenuBase::MenuTarget::kNewGame));
=== modified file 'src/wui/actionconfirm.cc'
--- src/wui/actionconfirm.cc 2017-03-04 09:14:37 +0000
+++ src/wui/actionconfirm.cc 2018-02-13 12:57:13 +0000
@@ -132,20 +132,18 @@
UI::Box* main_box = new UI::Box(this, padding, padding, UI::Box::Vertical);
UI::Box* button_box = new UI::Box(main_box, 0, 0, UI::Box::Horizontal);
- UI::MultilineTextarea* textarea =
- new UI::MultilineTextarea(main_box, 0, 0, 200, 74, message, UI::Align::kCenter,
- g_gr->images().get("images/ui_basic/but1.png"),
- UI::MultilineTextarea::ScrollMode::kNoScrolling);
+ UI::MultilineTextarea* textarea = new UI::MultilineTextarea(
+ main_box, 0, 0, 200, 74, UI::PanelStyle::kWui, message, UI::Align::kCenter,
+ UI::MultilineTextarea::ScrollMode::kNoScrolling);
textarea->force_new_renderer();
- UI::Button* okbtn =
- new UI::Button(button_box, "ok", 0, 0, 80, 34, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/menu_okay.png"));
+ UI::Button* okbtn = new UI::Button(button_box, "ok", 0, 0, 80, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/wui/menu_okay.png"));
okbtn->sigclicked.connect(boost::bind(&ActionConfirm::ok, this));
- UI::Button* cancelbtn = new UI::Button(button_box, "abort", 0, 0, 80, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/menu_abort.png"));
+ UI::Button* cancelbtn =
+ new UI::Button(button_box, "abort", 0, 0, 80, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/wui/menu_abort.png"));
cancelbtn->sigclicked.connect(boost::bind(&ActionConfirm::die, this));
button_box->add(
=== modified file 'src/wui/attack_box.cc'
--- src/wui/attack_box.cc 2017-11-24 21:34:17 +0000
+++ src/wui/attack_box.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "base/macros.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "graphic/text/font_set.h"
#include "graphic/text_constants.h"
#include "logic/map_objects/tribes/soldier.h"
@@ -60,10 +59,9 @@
uint32_t min,
uint32_t max,
uint32_t initial,
- char const* picname,
char const* hint) {
std::unique_ptr<UI::HorizontalSlider> result(new UI::HorizontalSlider(
- &parent, 0, 0, width, height, min, max, initial, g_gr->images().get(picname), hint));
+ &parent, 0, 0, width, height, min, max, initial, UI::SliderStyle::kWuiDark, hint));
parent.add(result.get());
return result;
}
@@ -81,7 +79,7 @@
void (AttackBox::*fn)(),
const std::string& tooltip_text) {
std::unique_ptr<UI::Button> button(new UI::Button(&parent, text, 8, 8, 26, 26,
- g_gr->images().get("images/ui_basic/but2.png"),
+ UI::ButtonStyle::kWuiPrimary,
text, tooltip_text));
button->sigclicked.connect(boost::bind(fn, boost::ref(*this)));
parent.add(button.get());
@@ -144,8 +142,8 @@
soldiers_text_.reset(
&add_text(columnbox, attack_string, UI::Align::kCenter, UI_FONT_SIZE_ULTRASMALL));
- soldiers_slider_ = add_slider(columnbox, 100, 10, 0, max_attackers, max_attackers > 0 ? 1 : 0,
- "images/ui_basic/but2.png", _("Number of soldiers"));
+ soldiers_slider_ = add_slider(
+ columnbox, 100, 10, 0, max_attackers, max_attackers > 0 ? 1 : 0, _("Number of soldiers"));
soldiers_slider_->changed.connect(boost::bind(&AttackBox::update_attack, this));
more_soldiers_ = add_button(linebox, std::to_string(max_attackers),
=== modified file 'src/wui/attack_box.h'
--- src/wui/attack_box.h 2017-08-19 22:22:20 +0000
+++ src/wui/attack_box.h 2018-02-13 12:57:13 +0000
@@ -61,7 +61,6 @@
uint32_t min,
uint32_t max,
uint32_t initial,
- char const* picname,
char const* hint);
// TODO(GunChleoc): This should also return a unique_ptr
UI::Textarea& add_text(UI::Box& parent,
=== modified file 'src/wui/building_statistics_menu.cc'
--- src/wui/building_statistics_menu.cc 2017-12-16 10:48:12 +0000
+++ src/wui/building_statistics_menu.cc 2018-02-13 12:57:13 +0000
@@ -65,7 +65,7 @@
kWindowWidth,
kWindowHeight,
_("Building Statistics")),
- tab_panel_(this, g_gr->images().get("images/ui_basic/but1.png")),
+ tab_panel_(this, UI::TabPanelStyle::kWuiDark),
navigation_panel_(this, 0, 0, kWindowWidth, 4 * kButtonRowHeight),
building_name_(
&navigation_panel_, get_inner_w() / 2, 0, 0, kButtonHeight, "", UI::Align::kCenter),
@@ -89,7 +89,7 @@
35,
0,
1,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::PanelStyle::kWui,
kLabelFontSize - UI::g_fh1->fontset()->size_offset()), // We need consistent height here
unproductive_label2_(
&unproductive_box_,
@@ -254,36 +254,32 @@
navigation_buttons_[NavigationButton::PrevOwned] = new UI::Button(
&navigation_panel_, "previous_owned", get_inner_w() - 2 * kButtonRowHeight, kButtonRowHeight,
- kButtonHeight, kButtonHeight, g_gr->images().get("images/ui_basic/but4.png"),
+ kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
navigation_buttons_[NavigationButton::NextOwned] = new UI::Button(
&navigation_panel_, "next_owned", get_inner_w() - kButtonRowHeight, kButtonRowHeight,
- kButtonHeight, kButtonHeight, g_gr->images().get("images/ui_basic/but4.png"),
+ kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
navigation_buttons_[NavigationButton::PrevConstruction] = new UI::Button(
&navigation_panel_, "previous_constructed", get_inner_w() - 2 * kButtonRowHeight,
- 2 * kButtonRowHeight, kButtonHeight, kButtonHeight,
- g_gr->images().get("images/ui_basic/but4.png"),
+ 2 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
navigation_buttons_[NavigationButton::NextConstruction] = new UI::Button(
&navigation_panel_, "next_constructed", get_inner_w() - kButtonRowHeight,
- 2 * kButtonRowHeight, kButtonHeight, kButtonHeight,
- g_gr->images().get("images/ui_basic/but4.png"),
+ 2 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
navigation_buttons_[NavigationButton::PrevUnproductive] = new UI::Button(
&navigation_panel_, "previous_unproductive", get_inner_w() - 2 * kButtonRowHeight,
- 3 * kButtonRowHeight, kButtonHeight, kButtonHeight,
- g_gr->images().get("images/ui_basic/but4.png"),
+ 3 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_left.png"), _("Show previous building"));
navigation_buttons_[NavigationButton::NextUnproductive] = new UI::Button(
&navigation_panel_, "next_unproductive", get_inner_w() - kButtonRowHeight,
- 3 * kButtonRowHeight, kButtonHeight, kButtonHeight,
- g_gr->images().get("images/ui_basic/but4.png"),
+ 3 * kButtonRowHeight, kButtonHeight, kButtonHeight, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/ui_basic/scrollbar_right.png"), _("Show next building"));
navigation_buttons_[NavigationButton::PrevOwned]->sigclicked.connect(boost::bind(
@@ -326,11 +322,11 @@
DescriptionIndex id, const BuildingDescr& descr, int tab_index, UI::Box& row, int* column) {
UI::Box* button_box = new UI::Box(&row, 0, 0, UI::Box::Vertical);
- building_buttons_[id] = new UI::Button(
- button_box, (boost::format("building_button%s") % id).str(), 0, 0, kBuildGridCellWidth,
- kBuildGridCellHeight, g_gr->images().get("images/ui_basic/but1.png"),
- descr.representative_image(&iplayer().get_player()->get_playercolor()), "",
- UI::Button::Style::kFlat);
+ building_buttons_[id] =
+ new UI::Button(button_box, (boost::format("building_button%s") % id).str(), 0, 0,
+ kBuildGridCellWidth, kBuildGridCellHeight, UI::ButtonStyle::kWuiBuildingStats,
+ descr.representative_image(&iplayer().get_player()->get_playercolor()), "",
+ UI::Button::VisualState::kFlat);
building_buttons_[id]->set_disable_style(UI::ButtonDisableStyle::kMonochrome |
UI::ButtonDisableStyle::kFlat);
button_box->add(building_buttons_[id]);
@@ -724,7 +720,7 @@
if (building_button == nullptr) {
continue;
}
- building_button->set_style(UI::Button::Style::kFlat);
+ building_button->set_visual_state(UI::Button::VisualState::kFlat);
}
// Update for current button
=== modified file 'src/wui/buildingwindow.cc'
--- src/wui/buildingwindow.cc 2017-11-30 13:07:13 +0000
+++ src/wui/buildingwindow.cc 2018-02-13 12:57:13 +0000
@@ -94,7 +94,7 @@
vbox_.reset(new UI::Box(this, 0, 0, UI::Box::Vertical));
- tabs_ = new UI::TabPanel(vbox_.get(), nullptr);
+ tabs_ = new UI::TabPanel(vbox_.get(), UI::TabPanelStyle::kWuiLight);
vbox_->add(tabs_, UI::Box::Resizing::kFullSize);
capsbuttons_ = new UI::Box(vbox_.get(), 0, 0, UI::Box::Horizontal);
@@ -188,10 +188,9 @@
// Check if this is a port building and if yes show expedition button
if (upcast(Widelands::Warehouse const, warehouse, building)) {
if (Widelands::PortDock* pd = warehouse->get_portdock()) {
- expeditionbtn_ =
- new UI::Button(capsbuttons, "start_or_cancel_expedition", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/buildings/start_expedition.png"));
+ expeditionbtn_ = new UI::Button(
+ capsbuttons, "start_or_cancel_expedition", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/wui/buildings/start_expedition.png"));
update_expedition_button(!pd->expedition_started());
expeditionbtn_->sigclicked.connect(
boost::bind(&BuildingWindow::act_start_or_cancel_expedition, boost::ref(*this)));
@@ -211,7 +210,7 @@
const bool is_stopped = productionsite->is_stopped();
UI::Button* stopbtn = new UI::Button(
capsbuttons, is_stopped ? "continue" : "stop", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
g_gr->images().get(
(is_stopped ? "images/ui_basic/continue.png" : "images/ui_basic/stop.png")),
is_stopped ?
@@ -243,9 +242,9 @@
"<br><font size=11>" + _("Construction costs:") + "</font><br>" +
waremap_to_richtext(tribe, building_descr.enhancement_cost());
- UI::Button* enhancebtn = new UI::Button(capsbuttons, "enhance", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- building_descr.icon(), enhance_tooltip);
+ UI::Button* enhancebtn =
+ new UI::Button(capsbuttons, "enhance", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ building_descr.icon(), enhance_tooltip);
// button id = building id
enhancebtn->sigclicked.connect([this, enhancement] { act_enhance(enhancement); });
@@ -255,9 +254,9 @@
}
if (capscache_ & Widelands::Building::PCap_Bulldoze) {
- UI::Button* destroybtn = new UI::Button(capsbuttons, "destroy", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get(pic_bulldoze), _("Destroy"));
+ UI::Button* destroybtn =
+ new UI::Button(capsbuttons, "destroy", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get(pic_bulldoze), _("Destroy"));
destroybtn->sigclicked.connect(
boost::bind(&BuildingWindow::act_bulldoze, boost::ref(*this)));
capsbuttons->add(destroybtn);
@@ -269,11 +268,11 @@
const Widelands::Buildcost wares =
Widelands::DismantleSite::count_returned_wares(building);
if (!wares.empty()) {
- UI::Button* dismantlebtn = new UI::Button(
- capsbuttons, "dismantle", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"), g_gr->images().get(pic_dismantle),
- std::string(_("Dismantle")) + "<br><font size=11>" + _("Returns:") + "</font><br>" +
- waremap_to_richtext(owner.tribe(), wares));
+ UI::Button* dismantlebtn =
+ new UI::Button(capsbuttons, "dismantle", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get(pic_dismantle),
+ std::string(_("Dismantle")) + "<br><font size=11>" + _("Returns:") +
+ "</font><br>" + waremap_to_richtext(owner.tribe(), wares));
dismantlebtn->sigclicked.connect(
boost::bind(&BuildingWindow::act_dismantle, boost::ref(*this)));
capsbuttons->add(dismantlebtn);
@@ -299,7 +298,7 @@
}
if (!wa_info->empty()) {
toggle_workarea_ = new UI::Button(
- capsbuttons, "workarea", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
+ capsbuttons, "workarea", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/overlays/workarea123.png"), _("Hide work area"));
toggle_workarea_->sigclicked.connect(
boost::bind(&BuildingWindow::toggle_workarea, boost::ref(*this)));
@@ -310,15 +309,15 @@
}
if (igbase()->get_display_flag(InteractiveBase::dfDebug)) {
- UI::Button* debugbtn = new UI::Button(
- capsbuttons, "debug", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get(pic_debug), _("Show Debug Window"));
+ UI::Button* debugbtn =
+ new UI::Button(capsbuttons, "debug", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get(pic_debug), _("Show Debug Window"));
debugbtn->sigclicked.connect(boost::bind(&BuildingWindow::act_debug, boost::ref(*this)));
capsbuttons->add(debugbtn);
}
UI::Button* gotobtn = new UI::Button(
- capsbuttons, "goto", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
+ capsbuttons, "goto", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/menus/menu_goto.png"), _("Center view on this"));
gotobtn->sigclicked.connect(boost::bind(&BuildingWindow::clicked_goto, boost::ref(*this)));
capsbuttons->add(gotobtn);
@@ -329,9 +328,9 @@
capsbuttons->add_inf_space();
}
- UI::Button* helpbtn = new UI::Button(
- capsbuttons, "help", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/ui_basic/menu_help.png"), _("Help"));
+ UI::Button* helpbtn =
+ new UI::Button(capsbuttons, "help", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/ui_basic/menu_help.png"), _("Help"));
UI::UniqueWindow::Registry& registry =
igbase()->unique_windows().get_registry(building->descr().name() + "_help");
=== modified file 'src/wui/buildingwindow.h'
--- src/wui/buildingwindow.h 2017-12-02 08:04:31 +0000
+++ src/wui/buildingwindow.h 2018-02-13 12:57:13 +0000
@@ -27,6 +27,7 @@
#include "logic/map_objects/tribes/building.h"
#include "notifications/notifications.h"
#include "ui_basic/button.h"
+#include "ui_basic/tabpanel.h"
#include "ui_basic/unique_window.h"
#include "wui/interactive_gamebase.h"
#include "wui/waresdisplay.h"
=== modified file 'src/wui/constructionsitewindow.cc'
--- src/wui/constructionsitewindow.cc 2017-12-01 09:17:44 +0000
+++ src/wui/constructionsitewindow.cc 2018-02-13 12:57:13 +0000
@@ -22,7 +22,6 @@
#include <boost/format.hpp>
#include "graphic/graphic.h"
-#include "ui_basic/tabpanel.h"
#include "wui/inputqueuedisplay.h"
static const char pic_tab_wares[] = "images/wui/buildings/menu_tab_wares.png";
=== modified file 'src/wui/dismantlesitewindow.cc'
--- src/wui/dismantlesitewindow.cc 2017-11-30 13:07:13 +0000
+++ src/wui/dismantlesitewindow.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,6 @@
#include "wui/dismantlesitewindow.h"
#include "graphic/graphic.h"
-#include "ui_basic/tabpanel.h"
static const char pic_tab_wares[] = "images/wui/buildings/menu_tab_wares.png";
=== modified file 'src/wui/economy_options_window.cc'
--- src/wui/economy_options_window.cc 2017-12-02 16:19:16 +0000
+++ src/wui/economy_options_window.cc 2018-02-13 12:57:13 +0000
@@ -37,9 +37,11 @@
bool can_act)
: UI::Window(parent, "economy_options", 0, 0, 0, 0, _("Economy options")),
economy_(economy),
- tabpanel_(this, g_gr->images().get("images/ui_basic/but1.png")),
- ware_panel_(new EconomyOptionsPanel(&tabpanel_, can_act, Widelands::wwWARE, economy)),
- worker_panel_(new EconomyOptionsPanel(&tabpanel_, can_act, Widelands::wwWORKER, economy)) {
+ tabpanel_(this, UI::TabPanelStyle::kWuiDark),
+ ware_panel_(
+ new EconomyOptionsPanel(&tabpanel_, can_act, Widelands::wwWARE, economy)),
+ worker_panel_(new EconomyOptionsPanel(
+ &tabpanel_, can_act, Widelands::wwWORKER, economy)) {
set_center_panel(&tabpanel_);
tabpanel_.add("wares", g_gr->images().get(pic_tab_wares), ware_panel_, _("Wares"));
@@ -134,23 +136,22 @@
UI::Box* buttons = new UI::Box(this, 0, 0, UI::Box::Horizontal);
add(buttons);
- UI::Button* b =
- new UI::Button(buttons, "decrease_target", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"), "-", _("Decrease target"));
+ UI::Button* b = new UI::Button(buttons, "decrease_target", 0, 0, 34, 34,
+ UI::ButtonStyle::kWuiMenu, "-", _("Decrease target"));
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, -1));
buttons->add(b);
b->set_repeating(true);
buttons->add_space(8);
- b = new UI::Button(buttons, "increase_target", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"), "+", _("Increase target"));
+ b = new UI::Button(buttons, "increase_target", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, "+",
+ _("Increase target"));
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::change_target, this, 1));
buttons->add(b);
b->set_repeating(true);
buttons->add_space(8);
- b = new UI::Button(buttons, "reset_target", 0, 0, 34, 34,
- g_gr->images().get("images/ui_basic/but4.png"), "R", _("Reset to default"));
+ b = new UI::Button(
+ buttons, "reset_target", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, "R", _("Reset to default"));
b->sigclicked.connect(boost::bind(&EconomyOptionsPanel::reset_target, this));
buttons->add(b);
}
=== modified file 'src/wui/encyclopedia_window.cc'
--- src/wui/encyclopedia_window.cc 2018-01-05 13:07:26 +0000
+++ src/wui/encyclopedia_window.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include <boost/format.hpp>
#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/map_objects/tribes/tribe_descr.h"
#include "scripting/lua_coroutine.h"
@@ -50,7 +49,7 @@
LuaInterface* const lua)
: UI::UniqueWindow(&parent, "encyclopedia", ®istry, WINDOW_WIDTH, WINDOW_HEIGHT, ""),
lua_(lua),
- tabs_(this, nullptr) {
+ tabs_(this, UI::TabPanelStyle::kWuiLight) {
}
void EncyclopediaWindow::init(InteractiveBase& parent, std::unique_ptr<LuaTable> table) {
@@ -78,14 +77,16 @@
lists_.insert(std::make_pair(
tab_name, std::unique_ptr<UI::Listselect<EncyclopediaEntry>>(
- new UI::Listselect<EncyclopediaEntry>(
- boxes_.at(tab_name).get(), 0, 0, contents_width, contents_height))));
- lists_.at(tab_name)
- ->selected.connect(boost::bind(&EncyclopediaWindow::entry_selected, this, tab_name));
+ new UI::Listselect<EncyclopediaEntry>(boxes_.at(tab_name).get(), 0, 0,
+ contents_width, contents_height,
+ UI::PanelStyle::kWui))));
+ lists_.at(tab_name)->selected.connect(
+ boost::bind(&EncyclopediaWindow::entry_selected, this, tab_name));
contents_.insert(std::make_pair(
- tab_name, std::unique_ptr<UI::MultilineTextarea>(new UI::MultilineTextarea(
- boxes_.at(tab_name).get(), 0, 0, contents_width, contents_height))));
+ tab_name, std::unique_ptr<UI::MultilineTextarea>(
+ new UI::MultilineTextarea(boxes_.at(tab_name).get(), 0, 0, contents_width,
+ contents_height, UI::PanelStyle::kWui))));
boxes_.at(tab_name)->add(lists_.at(tab_name).get());
boxes_.at(tab_name)->add_space(kPadding);
@@ -119,8 +120,9 @@
entry_name.c_str());
}
- EncyclopediaEntry entry(entry_script, entry_table->get_table("script_parameters")
- ->array_entries<std::string>());
+ EncyclopediaEntry entry(
+ entry_script,
+ entry_table->get_table("script_parameters")->array_entries<std::string>());
if (entry_icon.empty()) {
lists_.at(tab_name)->add(entry_title, entry);
=== modified file 'src/wui/fieldaction.cc'
--- src/wui/fieldaction.cc 2017-12-11 17:09:48 +0000
+++ src/wui/fieldaction.cc 2018-02-13 12:57:13 +0000
@@ -246,7 +246,7 @@
player_(plr),
map_(ib->egbase().map()),
node_(ib->get_sel_pos().node, &map_[ib->get_sel_pos().node]),
- tabpanel_(this, g_gr->images().get("images/ui_basic/but1.png")),
+ tabpanel_(this, UI::TabPanelStyle::kWuiDark),
fastclick_(true),
best_tab_(0),
showing_workarea_preview_(false),
@@ -510,9 +510,8 @@
void (FieldActionWindow::*fn)(),
const std::string& tooltip_text,
bool repeating) {
- UI::Button& button =
- *new UI::Button(box, name, 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but2.png"),
- g_gr->images().get(picname), tooltip_text);
+ UI::Button& button = *new UI::Button(box, name, 0, 0, 34, 34, UI::ButtonStyle::kWuiPrimary,
+ g_gr->images().get(picname), tooltip_text);
button.sigclicked.connect(boost::bind(fn, this));
button.set_repeating(repeating);
box->add(&button);
=== modified file 'src/wui/game_chat_menu.cc'
--- src/wui/game_chat_menu.cc 2017-01-25 18:55:59 +0000
+++ src/wui/game_chat_menu.cc 2018-02-13 12:57:13 +0000
@@ -34,7 +34,7 @@
ChatProvider& chat,
const std::string& title)
: UI::UniqueWindow(parent, "chat", ®istry, 440, 235, title),
- chat_(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat) {
+ chat_(this, 5, 5, get_inner_w() - 10, get_inner_h() - 10, chat, UI::PanelStyle::kWui) {
if (get_usedefaultpos())
center_to_parent();
=== modified file 'src/wui/game_debug_ui.cc'
--- src/wui/game_debug_ui.cc 2017-11-27 08:21:32 +0000
+++ src/wui/game_debug_ui.cc 2018-02-13 12:57:13 +0000
@@ -67,9 +67,9 @@
0,
350,
200,
+ UI::PanelStyle::kWui,
"",
UI::Align::kLeft,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollLog) {
obj.set_logsink(this);
}
@@ -139,7 +139,7 @@
: UI::Window(&parent, "map_object_debug", 0, 0, 100, 100, ""),
log_general_info_(true),
object_(&obj),
- tabs_(this, g_gr->images().get("images/ui_basic/but4.png")) {
+ tabs_(this, UI::TabPanelStyle::kWuiLight) {
serial_ = obj.serial();
set_title(std::to_string(serial_));
@@ -213,12 +213,11 @@
coords_(map_.get_fcoords(coords)),
// setup child panels
- ui_field_(this, 0, 0, 300, 280, ""),
-
- ui_immovable_(
- this, "immovable", 0, 280, 300, 24, g_gr->images().get("images/ui_basic/but4.png"), ""),
-
- ui_bobs_(this, 0, 304, 300, 96) {
+ ui_field_(this, 0, 0, 300, 280, UI::PanelStyle::kWui, ""),
+
+ ui_immovable_(this, "immovable", 0, 280, 300, 24, UI::ButtonStyle::kWuiMenu, ""),
+
+ ui_bobs_(this, 0, 304, 300, 96, UI::PanelStyle::kWui) {
ui_immovable_.sigclicked.connect(boost::bind(&FieldDebugWindow::open_immovable, this));
assert(0 <= coords_.x);
=== modified file 'src/wui/game_main_menu_save_game.cc'
--- src/wui/game_main_menu_save_game.cc 2017-11-30 07:19:41 +0000
+++ src/wui/game_main_menu_save_game.cc 2018-02-13 12:57:13 +0000
@@ -57,13 +57,13 @@
load_or_save_(&info_box_,
igbase().game(),
LoadOrSaveGame::FileType::kGame,
- GameDetails::Style::kWui,
+ UI::PanelStyle::kWui,
false),
filename_box_(load_or_save_.table_box(), 0, 0, UI::Box::Horizontal),
filename_label_(&filename_box_, 0, 0, 0, 0, _("Filename:"), UI::Align::kLeft),
filename_editbox_(
- &filename_box_, 0, 0, 0, 0, 2, g_gr->images().get("images/ui_basic/but1.png")),
+ &filename_box_, 0, 0, 0, 0, 2, UI::PanelStyle::kWui),
buttons_box_(load_or_save_.game_details()->button_box(), 0, 0, UI::Box::Horizontal),
cancel_(&buttons_box_,
@@ -72,9 +72,9 @@
0,
0,
0,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kWuiSecondary,
_("Cancel")),
- ok_(&buttons_box_, "ok", 0, 0, 0, 0, g_gr->images().get("images/ui_basic/but5.png"), _("OK")),
+ ok_(&buttons_box_, "ok", 0, 0, 0, 0, UI::ButtonStyle::kWuiPrimary, _("OK")),
curdir_(kSaveDir) {
=== modified file 'src/wui/game_message_menu.cc'
--- src/wui/game_message_menu.cc 2017-11-24 21:34:17 +0000
+++ src/wui/game_message_menu.cc 2018-02-13 12:57:13 +0000
@@ -54,15 +54,15 @@
kMessageBodyY,
kWindowWidth - 2 * kPadding,
get_inner_h() - kMessageBodyY - 2 * kPadding - kButtonSize,
+ UI::PanelStyle::kWui,
"",
UI::Align::kLeft,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollNormalForced),
mode(Inbox) {
- list = new UI::Table<uintptr_t>(
- this, kPadding, kButtonSize + 2 * kPadding, kWindowWidth - 2 * kPadding, kTableHeight,
- g_gr->images().get("images/ui_basic/but1.png"), UI::TableRows::kMulti);
+ list = new UI::Table<uintptr_t>(this, kPadding, kButtonSize + 2 * kPadding,
+ kWindowWidth - 2 * kPadding, kTableHeight, UI::PanelStyle::kWui,
+ UI::TableRows::kMulti);
list->selected.connect(boost::bind(&GameMessageMenu::selected, this, _1));
list->double_clicked.connect(boost::bind(&GameMessageMenu::double_clicked, this, _1));
list->add_column(kWindowWidth - 2 * kPadding - 60 - 60 - 75, _("Title"));
@@ -76,38 +76,34 @@
list->focus();
// Buttons for message types
- geologistsbtn_ =
- new UI::Button(this, "filter_geologists_messages", kPadding, kPadding, kButtonSize,
- kButtonSize, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/fieldaction/menu_geologist.png"));
+ geologistsbtn_ = new UI::Button(this, "filter_geologists_messages", kPadding, kPadding,
+ kButtonSize, kButtonSize, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/fieldaction/menu_geologist.png"));
geologistsbtn_->sigclicked.connect(
boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kGeologists));
- economybtn_ =
- new UI::Button(this, "filter_economy_messages", 2 * kPadding + kButtonSize, kPadding,
- kButtonSize, kButtonSize, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/stats/genstats_nrwares.png"));
+ economybtn_ = new UI::Button(this, "filter_economy_messages", 2 * kPadding + kButtonSize,
+ kPadding, kButtonSize, kButtonSize, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/stats/genstats_nrwares.png"));
economybtn_->sigclicked.connect(
boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kEconomy));
seafaringbtn_ =
new UI::Button(this, "filter_seafaring_messages", 3 * kPadding + 2 * kButtonSize, kPadding,
- kButtonSize, kButtonSize, g_gr->images().get("images/ui_basic/but0.png"),
+ kButtonSize, kButtonSize, UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/buildings/start_expedition.png"));
seafaringbtn_->sigclicked.connect(
boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kSeafaring));
- warfarebtn_ =
- new UI::Button(this, "filter_warfare_messages", 4 * kPadding + 3 * kButtonSize, kPadding,
- kButtonSize, kButtonSize, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/messages/messages_warfare.png"));
+ warfarebtn_ = new UI::Button(this, "filter_warfare_messages", 4 * kPadding + 3 * kButtonSize,
+ kPadding, kButtonSize, kButtonSize, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/messages/messages_warfare.png"));
warfarebtn_->sigclicked.connect(
boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kWarfare));
- scenariobtn_ =
- new UI::Button(this, "filter_scenario_messages", 5 * kPadding + 4 * kButtonSize, kPadding,
- kButtonSize, kButtonSize, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/menus/menu_objectives.png"));
+ scenariobtn_ = new UI::Button(this, "filter_scenario_messages", 5 * kPadding + 4 * kButtonSize,
+ kPadding, kButtonSize, kButtonSize, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/menus/menu_objectives.png"));
scenariobtn_->sigclicked.connect(
boost::bind(&GameMessageMenu::filter_messages, this, Widelands::Message::Type::kScenario));
@@ -117,7 +113,7 @@
archivebtn_ = new UI::Button(this, "archive_or_restore_selected_messages", kPadding,
kWindowHeight - kPadding - kButtonSize, kButtonSize, kButtonSize,
- g_gr->images().get("images/ui_basic/but2.png"),
+ UI::ButtonStyle::kWuiPrimary,
g_gr->images().get("images/wui/messages/message_archive.png"));
update_archive_button_tooltip();
archivebtn_->sigclicked.connect(boost::bind(&GameMessageMenu::archive_or_restore, this));
@@ -125,14 +121,13 @@
togglemodebtn_ = new UI::Button(
this, "toggle_between_inbox_or_archive",
archivebtn_->get_x() + archivebtn_->get_w() + kPadding, archivebtn_->get_y(), kButtonSize,
- kButtonSize, g_gr->images().get("images/ui_basic/but2.png"),
+ kButtonSize, UI::ButtonStyle::kWuiPrimary,
g_gr->images().get("images/wui/messages/message_archived.png"), _("Show Archive"));
togglemodebtn_->sigclicked.connect(boost::bind(&GameMessageMenu::toggle_mode, this));
centerviewbtn_ =
new UI::Button(this, "center_main_mapview_on_location", kWindowWidth - kPadding - kButtonSize,
- archivebtn_->get_y(), kButtonSize, kButtonSize,
- g_gr->images().get("images/ui_basic/but2.png"),
+ archivebtn_->get_y(), kButtonSize, kButtonSize, UI::ButtonStyle::kWuiPrimary,
g_gr->images().get("images/wui/menus/menu_goto.png"),
/** TRANSLATORS: %s is a tooltip, G is the corresponding hotkey */
(boost::format(_("G: %s"))
@@ -506,7 +501,7 @@
void GameMessageMenu::toggle_filter_messages_button(UI::Button& button,
Widelands::Message::Type msgtype) {
set_filter_messages_tooltips();
- if (button.style() == UI::Button::Style::kPermpressed) {
+ if (button.style() == UI::Button::VisualState::kPermpressed) {
button.set_perm_pressed(false);
message_filter_ = Widelands::Message::Type::kAllMessages;
} else {
=== modified file 'src/wui/game_objectives_menu.cc'
--- src/wui/game_objectives_menu.cc 2018-01-07 18:04:57 +0000
+++ src/wui/game_objectives_menu.cc 2018-02-13 12:57:13 +0000
@@ -40,15 +40,15 @@
580,
5 + OBJECTIVE_LIST + 5 + FULL_OBJECTIVE_TEXT + 5 + BUTTON_HEIGHT + 5,
_("Objectives")),
- list(this, 5, 5, get_inner_w() - 10, OBJECTIVE_LIST),
+ list(this, 5, 5, get_inner_w() - 10, OBJECTIVE_LIST, UI::PanelStyle::kWui),
objectivetext(this,
5,
130,
get_inner_w() - 10,
FULL_OBJECTIVE_TEXT,
+ UI::PanelStyle::kWui,
"",
UI::Align::kLeft,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollNormalForced) {
list.selected.connect(boost::bind(&GameObjectivesMenu::selected, this, _1));
if (get_usedefaultpos())
=== modified file 'src/wui/game_options_menu.cc'
--- src/wui/game_options_menu.cc 2017-11-30 07:41:06 +0000
+++ src/wui/game_options_menu.cc 2018-02-13 12:57:13 +0000
@@ -73,7 +73,7 @@
0,
width,
0,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
_("Sound Options"),
/** TRANSLATORS: Button tooltip */
_("Set sound effect and music options")),
@@ -83,7 +83,7 @@
0,
width,
35,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/menus/menu_save_game.png"),
/** TRANSLATORS: Button tooltip */
_("Save Game")),
@@ -93,7 +93,7 @@
0,
width,
35,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/menus/menu_exit_game.png"),
/** TRANSLATORS: Button tooltip */
_("Exit Game")) {
@@ -115,12 +115,12 @@
boost::bind(&GameOptionsMenu::clicked_exit_game, boost::ref(*this)));
if (windows_.sound_options.window) {
- sound_.set_style(UI::Button::Style::kPermpressed);
+ sound_.set_perm_pressed(true);
}
windows_.sound_options.opened.connect(
- boost::bind(&UI::Button::set_style, &sound_, UI::Button::Style::kPermpressed));
+ boost::bind(&UI::Button::set_perm_pressed, &sound_, true));
windows_.sound_options.closed.connect(
- boost::bind(&UI::Button::set_style, &sound_, UI::Button::Style::kRaised));
+ boost::bind(&UI::Button::set_perm_pressed, &sound_, false));
if (get_usedefaultpos())
center_to_parent();
=== modified file 'src/wui/game_options_sound_menu.cc'
--- src/wui/game_options_sound_menu.cc 2017-12-14 09:02:31 +0000
+++ src/wui/game_options_sound_menu.cc 2018-02-13 12:57:13 +0000
@@ -19,7 +19,6 @@
#include "wui/game_options_sound_menu.h"
#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "sound/sound_handler.h"
GameOptionsSoundMenu::GameOptionsSoundMenu(InteractiveGameBase& gb,
@@ -42,7 +41,7 @@
0,
g_sound_handler.get_max_volume(),
g_sound_handler.get_music_volume(),
- g_gr->images().get("images/ui_basic/but1.png")),
+ UI::SliderStyle::kWuiLight),
ingame_sound_volume_label(this,
hmargin(),
vmargin() + 2 * (kStateboxSize + vspacing()) + vbigspacing() +
@@ -58,7 +57,7 @@
0,
g_sound_handler.get_max_volume(),
g_sound_handler.get_fx_volume(),
- g_gr->images().get("images/ui_basic/but1.png")) {
+ UI::SliderStyle::kWuiLight) {
ingame_music.set_state(!g_sound_handler.get_disable_music());
ingame_sound.set_state(!g_sound_handler.get_disable_fx());
=== modified file 'src/wui/game_statistics_menu.cc'
--- src/wui/game_statistics_menu.cc 2017-12-16 10:48:12 +0000
+++ src/wui/game_statistics_menu.cc 2018-02-13 12:57:13 +0000
@@ -68,17 +68,17 @@
const std::string& tooltip_text,
UI::UniqueWindow::Registry* window) {
UI::Button* button =
- new UI::Button(&box_, name, 0, 0, 34U, 34U, g_gr->images().get("images/ui_basic/but4.png"),
+ new UI::Button(&box_, name, 0, 0, 34U, 34U, UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/" + image_basename + ".png"), tooltip_text);
box_.add(button);
if (window) {
if (window->window) {
- button->set_style(UI::Button::Style::kPermpressed);
+ button->set_perm_pressed(true);
}
window->opened.connect(
- boost::bind(&UI::Button::set_style, button, UI::Button::Style::kPermpressed));
+ boost::bind(&UI::Button::set_perm_pressed, button, true));
window->closed.connect(
- boost::bind(&UI::Button::set_style, button, UI::Button::Style::kRaised));
+ boost::bind(&UI::Button::set_perm_pressed, button, false));
button->sigclicked.connect(
boost::bind(&UI::UniqueWindow::Registry::toggle, boost::ref(*window)));
}
=== modified file 'src/wui/game_summary.cc'
--- src/wui/game_summary.cc 2017-08-09 19:25:04 +0000
+++ src/wui/game_summary.cc 2018-02-13 12:57:13 +0000
@@ -52,7 +52,7 @@
vbox->add_space(PADDING);
UI::Box* hbox1 = new UI::Box(this, 0, 0, UI::Box::Horizontal);
- players_table_ = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0);
+ players_table_ = new UI::Table<uintptr_t const>(hbox1, 0, 0, 0, 0, UI::PanelStyle::kWui);
players_table_->fit_height(game_.player_manager()->get_players_end_status().size());
hbox1->add_space(PADDING);
hbox1->add(players_table_);
@@ -63,7 +63,8 @@
info_box->add(info_area_label_);
info_area_ = new UI::MultilineTextarea(
info_box, 0, 0, 130,
- std::max(130, players_table_->get_h() - info_area_label_->get_h() - PADDING), "");
+ std::max(130, players_table_->get_h() - info_area_label_->get_h() - PADDING),
+ UI::PanelStyle::kWui, "");
info_box->add(info_area_, UI::Box::Resizing::kFullSize);
info_box->add_space(PADDING);
hbox1->add(info_box);
@@ -82,14 +83,14 @@
bottom_box->add_inf_space();
- continue_button_ = new UI::Button(
- bottom_box, "continue_button", 0, 0, 35, 35, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/ui_basic/continue.png"), _("Continue playing"));
+ continue_button_ =
+ new UI::Button(bottom_box, "continue_button", 0, 0, 35, 35, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/ui_basic/continue.png"), _("Continue playing"));
bottom_box->add(continue_button_);
bottom_box->add_space(PADDING);
- stop_button_ = new UI::Button(
- bottom_box, "stop_button", 0, 0, 35, 35, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/menus/menu_exit_game.png"), _("Exit Game"));
+ stop_button_ =
+ new UI::Button(bottom_box, "stop_button", 0, 0, 35, 35, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/wui/menus/menu_exit_game.png"), _("Exit Game"));
bottom_box->add(stop_button_);
bottom_box->add_space(PADDING);
=== modified file 'src/wui/gamechatpanel.cc'
--- src/wui/gamechatpanel.cc 2017-02-23 17:58:25 +0000
+++ src/wui/gamechatpanel.cc 2018-02-13 12:57:13 +0000
@@ -32,7 +32,8 @@
int32_t const y,
uint32_t const w,
uint32_t const h,
- ChatProvider& chat)
+ ChatProvider& chat,
+ UI::PanelStyle style)
: UI::Panel(parent, x, y, w, h),
chat_(chat),
chatbox(this,
@@ -40,11 +41,11 @@
0,
w,
h - 25,
+ style,
"",
UI::Align::kLeft,
- g_gr->images().get("images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kScrollLogForced),
- editbox(this, 0, h - 20, w, 20, 2),
+ editbox(this, 0, h - 20, w, 20, 2, style),
chat_message_counter(std::numeric_limits<uint32_t>::max()) {
editbox.ok.connect(boost::bind(&GameChatPanel::key_enter, this));
editbox.cancel.connect(boost::bind(&GameChatPanel::key_escape, this));
=== modified file 'src/wui/gamechatpanel.h'
--- src/wui/gamechatpanel.h 2017-01-25 18:55:59 +0000
+++ src/wui/gamechatpanel.h 2018-02-13 12:57:13 +0000
@@ -33,7 +33,13 @@
* entry field.
*/
struct GameChatPanel : public UI::Panel {
- GameChatPanel(UI::Panel*, int32_t x, int32_t y, uint32_t w, uint32_t h, ChatProvider&);
+ GameChatPanel(UI::Panel*,
+ int32_t x,
+ int32_t y,
+ uint32_t w,
+ uint32_t h,
+ ChatProvider&,
+ UI::PanelStyle style);
// Signal is called when a message has been sent by the user.
boost::signals2::signal<void()> sent;
=== modified file 'src/wui/gamedetails.cc'
--- src/wui/gamedetails.cc 2017-11-24 09:19:52 +0000
+++ src/wui/gamedetails.cc 2018-02-13 12:57:13 +0000
@@ -40,18 +40,18 @@
// 'noescape' is needed for error message formatting and does not call richtext_escape.
std::string as_header_with_content(const std::string& header,
const std::string& content,
- GameDetails::Style style,
+ UI::PanelStyle style,
bool is_first = false,
bool noescape = false) {
switch (style) {
- case GameDetails::Style::kFsMenu:
+ case UI::PanelStyle::kFsMenu:
return (boost::format(
"<p><font size=%i bold=1 shadow=1>%s%s <font color=D1D1D1>%s</font></font></p>") %
UI_FONT_SIZE_SMALL % (is_first ? "" : "<vspace gap=9>") %
(noescape ? header : richtext_escape(header)) %
(noescape ? content : richtext_escape(content)))
.str();
- case GameDetails::Style::kWui:
+ case UI::PanelStyle::kWui:
return (boost::format(
"<p><font size=%i>%s<font bold=1 color=D1D1D1>%s</font> %s</font></p>") %
UI_FONT_SIZE_SMALL % (is_first ? "" : "<vspace gap=6>") %
@@ -82,7 +82,7 @@
mapname = _(input_mapname);
}
-GameDetails::GameDetails(Panel* parent, Style style, Mode mode)
+GameDetails::GameDetails(Panel* parent, UI::PanelStyle style, Mode mode)
: UI::Box(parent, 0, 0, UI::Box::Vertical),
style_(style),
mode_(mode),
@@ -93,20 +93,18 @@
0,
0,
0,
+ style,
"",
UI::Align::kLeft,
- g_gr->images().get(style == GameDetails::Style::kFsMenu ? "images/ui_basic/but3.png" :
- "images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
descr_(this,
0,
0,
0,
0,
+ style,
"",
UI::Align::kLeft,
- g_gr->images().get(style == GameDetails::Style::kFsMenu ? "images/ui_basic/but3.png" :
- "images/ui_basic/but1.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
minimap_icon_(this, 0, 0, 0, 0, nullptr),
button_box_(new UI::Box(this, 0, 0, UI::Box::Vertical)) {
=== modified file 'src/wui/gamedetails.h'
--- src/wui/gamedetails.h 2017-05-03 07:59:44 +0000
+++ src/wui/gamedetails.h 2018-02-13 12:57:13 +0000
@@ -76,10 +76,9 @@
*/
class GameDetails : public UI::Box {
public:
- enum class Style { kFsMenu, kWui };
enum class Mode { kSavegame, kReplay };
- GameDetails(Panel* parent, Style style, Mode mode);
+ GameDetails(Panel* parent, UI::PanelStyle style, Mode mode);
/// Reset the data
void clear();
@@ -96,7 +95,7 @@
/// Layout the information on screen
void layout() override;
- const Style style_;
+ const UI::PanelStyle style_;
const Mode mode_;
const int padding_;
=== modified file 'src/wui/general_statistics_menu.cc'
--- src/wui/general_statistics_menu.cc 2017-11-06 20:19:56 +0000
+++ src/wui/general_statistics_menu.cc 2018-02-13 12:57:13 +0000
@@ -115,9 +115,9 @@
iterate_players_existing_const(p, nr_players, game, player) {
const Image* player_image = playercolor_image(p - 1, "images/players/genstats_player.png");
assert(player_image);
- UI::Button& cb = *new UI::Button(hbox1, "playerbutton", 0, 0, 25, 25,
- g_gr->images().get("images/ui_basic/but4.png"), player_image,
- player->get_name().c_str());
+ UI::Button& cb =
+ *new UI::Button(hbox1, "playerbutton", 0, 0, 25, 25, UI::ButtonStyle::kWuiMenu,
+ player_image, player->get_name().c_str());
cb.sigclicked.connect(boost::bind(&GeneralStatisticsMenu::cb_changed_to, this, p));
cb.set_perm_pressed(my_registry_->selected_players[p - 1]);
@@ -198,8 +198,7 @@
box_.add(hbox2, UI::Box::Resizing::kFullSize);
- WuiPlotAreaSlider* slider = new WuiPlotAreaSlider(
- &box_, plot_, 0, 0, 100, 45, g_gr->images().get("images/ui_basic/but1.png"));
+ WuiPlotAreaSlider* slider = new WuiPlotAreaSlider(&box_, plot_, 0, 0, 100, 45);
slider->changedto.connect(boost::bind(&WuiPlotArea::set_time_id, &plot_, _1));
box_.add(slider, UI::Box::Resizing::kFullSize);
}
@@ -213,7 +212,7 @@
PlayerNumber const nr_players = game.map().get_nrplayers();
iterate_players_existing_novar(p, nr_players, game) {
my_registry_->selected_players[p - 1] =
- cbs_[p - 1]->style() == UI::Button::Style::kPermpressed;
+ cbs_[p - 1]->style() == UI::Button::VisualState::kPermpressed;
}
}
}
@@ -225,7 +224,7 @@
// This represents our player number
cbs_[id - 1]->toggle();
plot_.show_plot((id - 1) * ndatasets_ + selected_information_,
- cbs_[id - 1]->style() == UI::Button::Style::kPermpressed);
+ cbs_[id - 1]->style() == UI::Button::VisualState::kPermpressed);
}
/*
@@ -236,7 +235,8 @@
dynamic_cast<InteractiveGameBase&>(*get_parent()).game().get_general_statistics().size();
for (uint32_t i = 0; i < statistics_size; ++i)
if (cbs_[i]) {
- plot_.show_plot(i * ndatasets_ + id, cbs_[i]->style() == UI::Button::Style::kPermpressed);
+ plot_.show_plot(
+ i * ndatasets_ + id, cbs_[i]->style() == UI::Button::VisualState::kPermpressed);
plot_.show_plot(i * ndatasets_ + selected_information_, false);
}
selected_information_ = id;
=== modified file 'src/wui/helpwindow.cc'
--- src/wui/helpwindow.cc 2018-02-10 19:00:32 +0000
+++ src/wui/helpwindow.cc 2018-02-13 12:57:13 +0000
@@ -44,7 +44,7 @@
width,
height,
(boost::format(_("Help: %s")) % building_description.descname()).str()),
- textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 10)) {
+ textarea_(new MultilineTextarea(this, 5, 5, width - 10, height - 10, UI::PanelStyle::kWui)) {
assert(tribe.has_building(tribe.building_index(building_description.name())) ||
building_description.type() == Widelands::MapObjectType::MILITARYSITE);
try {
=== modified file 'src/wui/inputqueuedisplay.cc'
--- src/wui/inputqueuedisplay.cc 2017-12-18 10:45:01 +0000
+++ src/wui/inputqueuedisplay.cc 2018-02-13 12:57:13 +0000
@@ -230,20 +230,18 @@
uint32_t x = Border;
uint32_t y = Border + (total_height_ - 2 * Border - WARE_MENU_PIC_WIDTH) / 2;
- decrease_max_fill_ =
- new UI::Button(this, "decrease_max_fill", x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/ui_basic/scrollbar_left.png"),
- _("Decrease the number of wares you want to be stored here."));
+ decrease_max_fill_ = new UI::Button(
+ this, "decrease_max_fill", x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
+ UI::ButtonStyle::kWuiMenu, g_gr->images().get("images/ui_basic/scrollbar_left.png"),
+ _("Decrease the number of wares you want to be stored here."));
decrease_max_fill_->sigclicked.connect(
boost::bind(&InputQueueDisplay::decrease_max_fill_clicked, boost::ref(*this)));
x = Border + (cache_size_ + 1) * (CellWidth + CellSpacing);
- increase_max_fill_ =
- new UI::Button(this, "increase_max_fill", x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
- g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/ui_basic/scrollbar_right.png"),
- _("Increase the number of wares you want to be stored here."));
+ increase_max_fill_ = new UI::Button(
+ this, "increase_max_fill", x, y, WARE_MENU_PIC_WIDTH, WARE_MENU_PIC_HEIGHT,
+ UI::ButtonStyle::kWuiMenu, g_gr->images().get("images/ui_basic/scrollbar_right.png"),
+ _("Increase the number of wares you want to be stored here."));
increase_max_fill_->sigclicked.connect(
boost::bind(&InputQueueDisplay::increase_max_fill_clicked, boost::ref(*this)));
=== modified file 'src/wui/interactive_base.cc'
--- src/wui/interactive_base.cc 2017-12-05 08:28:51 +0000
+++ src/wui/interactive_base.cc 2018-02-13 12:57:13 +0000
@@ -278,14 +278,14 @@
const std::string& tooltip_text,
UI::UniqueWindow::Registry* window,
bool bind_default_toggle) {
- UI::Button* button = new UI::Button(
- &toolbar_, name, 0, 0, 34U, 34U, g_gr->images().get("images/ui_basic/but2.png"),
- g_gr->images().get("images/" + image_basename + ".png"), tooltip_text);
+ UI::Button* button =
+ new UI::Button(&toolbar_, name, 0, 0, 34U, 34U, UI::ButtonStyle::kWuiPrimary,
+ g_gr->images().get("images/" + image_basename + ".png"), tooltip_text);
toolbar_.add(button);
if (window) {
window->opened.connect(
- [this, button] { button->set_style(UI::Button::Style::kPermpressed); });
- window->closed.connect([this, button] { button->set_style(UI::Button::Style::kRaised); });
+ [this, button] { button->set_perm_pressed(true); });
+ window->closed.connect([this, button] { button->set_perm_pressed(false); });
if (bind_default_toggle) {
button->sigclicked.connect(
=== modified file 'src/wui/interactive_base.h'
--- src/wui/interactive_base.h 2017-12-02 08:04:31 +0000
+++ src/wui/interactive_base.h 2018-02-13 12:57:13 +0000
@@ -25,7 +25,6 @@
#include <SDL_keycode.h>
-#include "graphic/graphic.h"
#include "logic/editor_game_base.h"
#include "logic/map.h"
#include "notifications/notifications.h"
=== modified file 'src/wui/interactive_player.h'
--- src/wui/interactive_player.h 2017-09-01 14:12:58 +0000
+++ src/wui/interactive_player.h 2018-02-13 12:57:13 +0000
@@ -27,14 +27,8 @@
#include "logic/message_id.h"
#include "profile/profile.h"
#include "ui_basic/button.h"
-#include "ui_basic/textarea.h"
#include "wui/interactive_gamebase.h"
-namespace UI {
-struct MultilineTextarea;
-struct Textarea;
-}
-
/**
* This is the interactive player. this one is
* responsible to show the correct map
=== modified file 'src/wui/interactive_spectator.cc'
--- src/wui/interactive_spectator.cc 2017-12-16 10:48:12 +0000
+++ src/wui/interactive_spectator.cc 2018-02-13 12:57:13 +0000
@@ -22,12 +22,9 @@
#include "base/i18n.h"
#include "base/macros.h"
#include "chat/chat.h"
-#include "graphic/graphic.h"
#include "logic/game_controller.h"
#include "logic/player.h"
#include "profile/profile.h"
-#include "ui_basic/editbox.h"
-#include "ui_basic/multilinetextarea.h"
#include "ui_basic/textarea.h"
#include "ui_basic/unique_window.h"
#include "wui/fieldaction.h"
=== modified file 'src/wui/load_or_save_game.cc'
--- src/wui/load_or_save_game.cc 2017-12-19 07:17:15 +0000
+++ src/wui/load_or_save_game.cc 2018-02-13 12:57:13 +0000
@@ -68,7 +68,7 @@
LoadOrSaveGame::LoadOrSaveGame(UI::Panel* parent,
Widelands::Game& g,
FileType filetype,
- GameDetails::Style style,
+ UI::PanelStyle style,
bool localize_autosave)
: parent_(parent),
table_box_(new UI::Box(parent, 0, 0, UI::Box::Vertical)),
@@ -77,8 +77,7 @@
0,
0,
0,
- g_gr->images().get(style == GameDetails::Style::kFsMenu ? "images/ui_basic/but3.png" :
- "images/ui_basic/but1.png"),
+ style,
UI::TableRows::kMultiDescending),
filetype_(filetype),
localize_autosave_(localize_autosave),
@@ -93,7 +92,7 @@
0,
0,
0,
- g_gr->images().get("images/ui_basic/but0.png"),
+ style == UI::PanelStyle::kFsMenu ? UI::ButtonStyle::kFsMenuSecondary : UI::ButtonStyle::kWuiSecondary,
_("Delete"))),
game_(g) {
table_.add_column(130, _("Save Date"), _("The date this game was saved"), UI::Align::kLeft);
=== modified file 'src/wui/load_or_save_game.h'
--- src/wui/load_or_save_game.h 2017-11-24 09:19:52 +0000
+++ src/wui/load_or_save_game.h 2018-02-13 12:57:13 +0000
@@ -41,7 +41,7 @@
LoadOrSaveGame(UI::Panel* parent,
Widelands::Game& g,
FileType filetype,
- GameDetails::Style style,
+ UI::PanelStyle style,
bool localize_autosave);
/// Update gamedetails and tooltips and return information about the current selection
=== modified file 'src/wui/login_box.cc'
--- src/wui/login_box.cc 2017-02-26 12:16:09 +0000
+++ src/wui/login_box.cc 2018-02-13 12:57:13 +0000
@@ -33,13 +33,12 @@
ta_nickname = new UI::Textarea(this, margin, margin, _("Nickname:"));
ta_password = new UI::Textarea(this, margin, 40, _("Password:"));
- eb_nickname = new UI::EditBox(
- this, 150, margin, 330, 20, 2, g_gr->images().get("images/ui_basic/but2.png"));
- eb_password =
- new UI::EditBox(this, 150, 40, 330, 20, 2, g_gr->images().get("images/ui_basic/but2.png"));
+ eb_nickname = new UI::EditBox(this, 150, margin, 330, 20, 2, UI::PanelStyle::kWui);
+ eb_password = new UI::EditBox(this, 150, 40, 330, 20, 2, UI::PanelStyle::kWui);
- pwd_warning = new UI::MultilineTextarea(
- this, margin, 65, 505, 50, _("WARNING: Password will be shown and saved readable!"));
+ pwd_warning =
+ new UI::MultilineTextarea(this, margin, 65, 505, 50, UI::PanelStyle::kWui,
+ _("WARNING: Password will be shown and saved readable!"));
cb_register = new UI::Checkbox(this, Vector2i(margin, 110), _("Log in to a registered account"),
"", get_inner_w() - 2 * margin);
@@ -47,18 +46,17 @@
_("Automatically use this login information from now on."), "",
get_inner_w() - 2 * margin);
- UI::Button* loginbtn =
- new UI::Button(this, "login", UI::g_fh1->fontset()->is_rtl() ?
- (get_inner_w() / 2 - 200) / 2 :
+ UI::Button* loginbtn = new UI::Button(
+ this, "login",
+ UI::g_fh1->fontset()->is_rtl() ? (get_inner_w() / 2 - 200) / 2 :
(get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2,
- get_inner_h() - 20 - margin, 200, 20,
- g_gr->images().get("images/ui_basic/but5.png"), _("Login"));
+ get_inner_h() - 20 - margin, 200, 20, UI::ButtonStyle::kWuiPrimary, _("Login"));
loginbtn->sigclicked.connect(boost::bind(&LoginBox::clicked_ok, boost::ref(*this)));
- UI::Button* cancelbtn = new UI::Button(
- this, "cancel",
- UI::g_fh1->fontset()->is_rtl() ? (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2 :
- (get_inner_w() / 2 - 200) / 2,
- loginbtn->get_y(), 200, 20, g_gr->images().get("images/ui_basic/but1.png"), _("Cancel"));
+ UI::Button* cancelbtn =
+ new UI::Button(this, "cancel", UI::g_fh1->fontset()->is_rtl() ?
+ (get_inner_w() / 2 - 200) / 2 + get_inner_w() / 2 :
+ (get_inner_w() / 2 - 200) / 2,
+ loginbtn->get_y(), 200, 20, UI::ButtonStyle::kWuiSecondary, _("Cancel"));
cancelbtn->sigclicked.connect(boost::bind(&LoginBox::clicked_back, boost::ref(*this)));
Section& s = g_options.pull_section("global");
=== modified file 'src/wui/mapdetails.cc'
--- src/wui/mapdetails.cc 2017-06-13 04:33:53 +0000
+++ src/wui/mapdetails.cc 2018-02-13 12:57:13 +0000
@@ -28,7 +28,6 @@
#include "base/log.h"
#include "base/wexception.h"
#include "graphic/font_handler1.h"
-#include "graphic/graphic.h"
#include "graphic/text_constants.h"
#include "io/filesystem/layered_filesystem.h"
#include "logic/game_controller.h"
@@ -39,27 +38,26 @@
#include "wui/map_tags.h"
namespace {
-std::string as_header(const std::string& txt, MapDetails::Style style, bool is_first = false) {
+std::string as_header(const std::string& txt, UI::PanelStyle style, bool is_first = false) {
switch (style) {
- case MapDetails::Style::kFsMenu:
+ case UI::PanelStyle::kFsMenu:
return (boost::format("<p><font size=%i bold=1 shadow=1>%s%s</font></p>") %
UI_FONT_SIZE_SMALL % (is_first ? "" : "<vspace gap=9>") % richtext_escape(txt))
.str();
- case MapDetails::Style::kWui:
+ case UI::PanelStyle::kWui:
return (boost::format("<p><font size=%i bold=1 color=D1D1D1>%s%s</font></p>") %
UI_FONT_SIZE_SMALL % (is_first ? "" : "<vspace gap=6>") % richtext_escape(txt))
.str();
}
NEVER_HERE();
}
-std::string as_content(const std::string& txt, MapDetails::Style style) {
+std::string as_content(const std::string& txt, UI::PanelStyle style) {
switch (style) {
- case MapDetails::Style::kFsMenu:
- return (boost::format(
- "<p><font size=%i bold=1 color=D1D1D1 shadow=1><vspace gap=2>%s</font></p>") %
+ case UI::PanelStyle::kFsMenu:
+ return (boost::format("<p><font size=%i color=D1D1D1 shadow=1><vspace gap=2>%s</font></p>") %
UI_FONT_SIZE_SMALL % richtext_escape(txt))
.str();
- case MapDetails::Style::kWui:
+ case UI::PanelStyle::kWui:
return (boost::format("<p><font size=%i><vspace gap=2>%s</font></p>") %
(UI_FONT_SIZE_SMALL - 2) % richtext_escape(txt))
.str();
@@ -68,7 +66,8 @@
}
} // namespace
-MapDetails::MapDetails(Panel* parent, int32_t x, int32_t y, int32_t w, int32_t h, Style style)
+MapDetails::MapDetails(
+ Panel* parent, int32_t x, int32_t y, int32_t w, int32_t h, UI::PanelStyle style)
: UI::Panel(parent, x, y, w, h),
style_(style),
@@ -79,11 +78,11 @@
0,
UI::Scrollbar::kSize,
0,
+ style,
"",
UI::Align::kLeft,
- g_gr->images().get("images/ui_basic/but3.png"),
UI::MultilineTextarea::ScrollMode::kNoScrolling),
- descr_(&main_box_, 0, 0, UI::Scrollbar::kSize, 0, ""),
+ descr_(&main_box_, 0, 0, UI::Scrollbar::kSize, 0, style, ""),
suggested_teams_box_(
new UI::SuggestedTeamsBox(this, 0, 0, UI::Box::Vertical, padding_, 0, w)) {
name_label_.force_new_renderer();
=== modified file 'src/wui/mapdetails.h'
--- src/wui/mapdetails.h 2017-01-25 18:55:59 +0000
+++ src/wui/mapdetails.h 2018-02-13 12:57:13 +0000
@@ -31,16 +31,14 @@
*/
class MapDetails : public UI::Panel {
public:
- enum class Style { kFsMenu, kWui };
-
- MapDetails(Panel* parent, int32_t x, int32_t y, int32_t w, int32_t h, Style style);
+ MapDetails(UI::Panel* parent, int32_t x, int32_t y, int32_t w, int32_t h, UI::PanelStyle style);
void clear();
void update(const MapData& mapdata, bool localize_mapname);
private:
void layout() override;
- const Style style_;
+ const UI::PanelStyle style_;
const int padding_;
UI::Box main_box_;
=== modified file 'src/wui/maptable.cc'
--- src/wui/maptable.cc 2017-05-18 20:50:42 +0000
+++ src/wui/maptable.cc 2018-02-13 12:57:13 +0000
@@ -26,8 +26,9 @@
#include "graphic/graphic.h"
#include "io/filesystem/filesystem.h"
-MapTable::MapTable(UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h)
- : UI::Table<uintptr_t>(parent, x, y, w, h, g_gr->images().get("images/ui_basic/but3.png")) {
+MapTable::MapTable(
+ UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, UI::PanelStyle style)
+ : UI::Table<uintptr_t>(parent, x, y, w, h, style) {
/** TRANSLATORS: Column title for number of players in map list */
add_column(35, _("Pl."), _("Number of players"), UI::Align::kCenter);
=== modified file 'src/wui/maptable.h'
--- src/wui/maptable.h 2017-01-26 09:28:40 +0000
+++ src/wui/maptable.h 2018-02-13 12:57:13 +0000
@@ -32,7 +32,7 @@
*/
class MapTable : public UI::Table<uintptr_t> {
public:
- MapTable(UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h);
+ MapTable(UI::Panel* parent, int32_t x, int32_t y, uint32_t w, uint32_t h, UI::PanelStyle style);
/// Fill the table with maps and directories.
void fill(const std::vector<MapData>& entries, MapData::DisplayType type);
=== modified file 'src/wui/militarysitewindow.cc'
--- src/wui/militarysitewindow.cc 2017-11-30 20:56:22 +0000
+++ src/wui/militarysitewindow.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,6 @@
#include "wui/militarysitewindow.h"
#include "graphic/graphic.h"
-#include "ui_basic/tabpanel.h"
#include "wui/soldiercapacitycontrol.h"
#include "wui/soldierlist.h"
=== modified file 'src/wui/minimap.cc'
--- src/wui/minimap.cc 2017-08-18 15:14:48 +0000
+++ src/wui/minimap.cc 2018-02-13 12:57:13 +0000
@@ -116,10 +116,10 @@
view_.get_h() + but_h() * 0,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_terrn.png"),
_("Terrain"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled),
button_owner(this,
"owner",
@@ -127,10 +127,10 @@
view_.get_h() + but_h() * 0,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_owner.png"),
_("Owner"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled),
button_flags(this,
"flags",
@@ -138,10 +138,10 @@
view_.get_h() + but_h() * 0,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_flags.png"),
_("Flags"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled),
button_roads(this,
"roads",
@@ -149,10 +149,10 @@
view_.get_h() + but_h() * 1,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_roads.png"),
_("Roads"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled),
button_bldns(this,
"buildings",
@@ -160,10 +160,10 @@
view_.get_h() + but_h() * 1,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_bldns.png"),
_("Buildings"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled),
button_zoom(this,
"zoom",
@@ -171,10 +171,10 @@
view_.get_h() + but_h() * 1,
but_w(),
but_h(),
- g_gr->images().get("images/ui_basic/but0.png"),
+ UI::ButtonStyle::kWuiSecondary,
g_gr->images().get("images/wui/minimap/button_zoom.png"),
_("Zoom"),
- UI::Button::Style::kRaised,
+ UI::Button::VisualState::kRaised,
UI::Button::ImageMode::kUnscaled) {
button_terrn.sigclicked.connect(
boost::bind(&MiniMap::toggle, boost::ref(*this), MiniMapLayer::Terrain));
=== modified file 'src/wui/multiplayersetupgroup.cc'
--- src/wui/multiplayersetupgroup.cc 2017-12-02 12:43:38 +0000
+++ src/wui/multiplayersetupgroup.cc 2018-02-13 12:57:13 +0000
@@ -56,7 +56,7 @@
PlayerSlot id,
GameSettingsProvider* const settings)
: UI::Box(parent, 0, 0, UI::Box::Horizontal, w, h, kPadding),
- slot_dropdown_(this, 0, 0, h, 200, h, _("Role"), UI::DropdownType::kPictorial),
+ slot_dropdown_(this, 0, 0, h, 200, h, _("Role"), UI::DropdownType::kPictorial, UI::PanelStyle::kFsMenu),
// Name needs to be initialized after the dropdown, otherwise the layout function will
// crash.
name(this, 0, 0, w - h - UI::Scrollbar::kSize * 11 / 5, h),
@@ -64,7 +64,6 @@
id_(id),
slot_selection_locked_(false) {
set_size(w, h);
-
add(&slot_dropdown_);
add(&name, UI::Box::Resizing::kAlign, UI::Align::kCenter);
@@ -184,15 +183,15 @@
0,
h,
h,
- g_gr->images().get("images/ui_basic/but1.png"),
+ UI::ButtonStyle::kFsMenuSecondary,
playercolor_image(id, "images/players/player_position_menu.png"),
- (boost::format(_("Player %u")) % static_cast<unsigned int>(id_ + 1)).str(),
- UI::Button::Style::kFlat),
- type_dropdown_(this, 0, 0, 50, 200, h, _("Type"), UI::DropdownType::kPictorial),
- tribes_dropdown_(this, 0, 0, 50, 200, h, _("Tribe"), UI::DropdownType::kPictorial),
+ (boost::format(_("Player %u")) % static_cast<unsigned int>(id_ + 1)).str(),
+ UI::Button::VisualState::kFlat),
+ type_dropdown_(this, 0, 0, 50, 200, h, _("Type"), UI::DropdownType::kPictorial, UI::PanelStyle::kFsMenu),
+ tribes_dropdown_(this, 0, 0, 50, 200, h, _("Tribe"), UI::DropdownType::kPictorial, UI::PanelStyle::kFsMenu),
init_dropdown_(
- this, 0, 0, w - 4 * h - 3 * kPadding, 200, h, "", UI::DropdownType::kTextualNarrow),
- team_dropdown_(this, 0, 0, h, 200, h, _("Team"), UI::DropdownType::kPictorial),
+ this, 0, 0, w - 4 * h - 3 * kPadding, 200, h, "", UI::DropdownType::kTextualNarrow, UI::PanelStyle::kFsMenu),
+ team_dropdown_(this, 0, 0, h, 200, h, _("Team"), UI::DropdownType::kPictorial, UI::PanelStyle::kFsMenu),
last_state_(PlayerSettings::State::kClosed),
type_selection_locked_(false),
tribe_selection_locked_(false),
=== modified file 'src/wui/playerdescrgroup.cc'
--- src/wui/playerdescrgroup.cc 2017-11-20 13:50:51 +0000
+++ src/wui/playerdescrgroup.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "ai/computer_player.h"
#include "base/i18n.h"
#include "base/wexception.h"
-#include "graphic/graphic.h"
#include "graphic/text_constants.h"
#include "logic/game_settings.h"
#include "logic/map_objects/tribes/tribe_basic_info.h"
@@ -69,21 +68,21 @@
boost::bind(&PlayerDescriptionGroup::enable_player, this, _1));
d->btnPlayerType =
new UI::Button(this, "player_type", xplayertype, 0, xplayertribe - xplayertype - 2, h / 2,
- g_gr->images().get("images/ui_basic/but1.png"), "");
+ UI::ButtonStyle::kFsMenuSecondary, "");
d->btnPlayerType->sigclicked.connect(
boost::bind(&PlayerDescriptionGroup::toggle_playertype, boost::ref(*this)));
d->btnPlayerTeam =
new UI::Button(this, "player_team", xplayerteam, h / 2, xplayerinit - xplayerteam - 2, h / 2,
- g_gr->images().get("images/ui_basic/but1.png"), "");
+ UI::ButtonStyle::kFsMenuSecondary, "");
d->btnPlayerTeam->sigclicked.connect(
boost::bind(&PlayerDescriptionGroup::toggle_playerteam, boost::ref(*this)));
d->btnPlayerTribe = new UI::Button(this, "player_tribe", xplayertribe, 0, w - xplayertribe,
- h / 2, g_gr->images().get("images/ui_basic/but1.png"), "");
+ h / 2, UI::ButtonStyle::kFsMenuSecondary, "");
d->btnPlayerTribe->sigclicked.connect(
boost::bind(&PlayerDescriptionGroup::toggle_playertribe, boost::ref(*this)));
d->btnPlayerInit =
new UI::Button(this, "player_initialization", xplayerinit, h / 2, w - xplayerinit, h / 2,
- g_gr->images().get("images/ui_basic/but1.png"), "", _("Initialization"));
+ UI::ButtonStyle::kFsMenuSecondary, "", _("Initialization"));
d->btnPlayerInit->sigclicked.connect(
boost::bind(&PlayerDescriptionGroup::toggle_playerinit, boost::ref(*this)));
=== modified file 'src/wui/plot_area.h'
--- src/wui/plot_area.h 2018-01-17 10:25:28 +0000
+++ src/wui/plot_area.h 2018-02-13 12:57:13 +0000
@@ -156,7 +156,6 @@
const int32_t y,
const uint32_t w,
const uint32_t h,
- const Image* background_picture_id,
const std::string& tooltip_text = std::string(),
const uint32_t cursor_size = 20,
const bool enabled = true)
@@ -167,7 +166,7 @@
h,
plot_area.get_labels(),
plot_area.get_time_id(),
- background_picture_id,
+ UI::SliderStyle::kWuiLight,
tooltip_text,
cursor_size,
enabled),
=== modified file 'src/wui/productionsitewindow.cc'
--- src/wui/productionsitewindow.cc 2017-12-13 15:49:48 +0000
+++ src/wui/productionsitewindow.cc 2018-02-13 12:57:13 +0000
@@ -26,7 +26,6 @@
#include "graphic/graphic.h"
#include "logic/map_objects/tribes/tribe_descr.h"
#include "logic/map_objects/tribes/worker.h"
-#include "ui_basic/tabpanel.h"
#include "ui_basic/textarea.h"
#include "wui/inputqueuedisplay.h"
@@ -93,7 +92,7 @@
worker_table_ = nullptr;
} else {
UI::Box* worker_box = new UI::Box(get_tabs(), 0, 0, UI::Box::Vertical);
- worker_table_ = new UI::Table<uintptr_t>(worker_box, 0, 0, 0, 100);
+ worker_table_ = new UI::Table<uintptr_t>(worker_box, 0, 0, 0, 100, UI::PanelStyle::kWui);
worker_caps_ = new UI::Box(worker_box, 0, 0, UI::Box::Horizontal);
worker_table_->add_column(
@@ -108,10 +107,10 @@
if (igbase()->can_act(production_site->owner().player_number())) {
worker_caps_->add_inf_space();
- UI::Button* evict_button = new UI::Button(
- worker_caps_, "evict", 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get("images/wui/buildings/menu_drop_soldier.png"),
- _("Terminate the employment of the selected worker"));
+ UI::Button* evict_button =
+ new UI::Button(worker_caps_, "evict", 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu,
+ g_gr->images().get("images/wui/buildings/menu_drop_soldier.png"),
+ _("Terminate the employment of the selected worker"));
evict_button->sigclicked.connect(
boost::bind(&ProductionSiteWindow::evict_worker, boost::ref(*this)));
worker_caps_->add(evict_button);
=== modified file 'src/wui/shipwindow.cc'
--- src/wui/shipwindow.cc 2017-12-14 09:02:31 +0000
+++ src/wui/shipwindow.cc 2018-02-13 12:57:13 +0000
@@ -270,9 +270,8 @@
const std::string& title,
const std::string& picname,
boost::function<void()> callback) {
- UI::Button* btn =
- new UI::Button(parent, name, 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"),
- g_gr->images().get(picname), title);
+ UI::Button* btn = new UI::Button(
+ parent, name, 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, g_gr->images().get(picname), title);
btn->sigclicked.connect(callback);
return btn;
}
=== modified file 'src/wui/soldiercapacitycontrol.cc'
--- src/wui/soldiercapacitycontrol.cc 2017-06-19 06:46:53 +0000
+++ src/wui/soldiercapacitycontrol.cc 2018-02-13 12:57:13 +0000
@@ -67,7 +67,7 @@
0,
32,
32,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/buildings/menu_down_train.png"),
_("Decrease capacity")),
increase_(this,
@@ -76,7 +76,7 @@
0,
32,
32,
- g_gr->images().get("images/ui_basic/but4.png"),
+ UI::ButtonStyle::kWuiMenu,
g_gr->images().get("images/wui/buildings/menu_up_train.png"),
_("Increase capacity")),
value_(this, "199", UI::Align::kCenter) {
=== modified file 'src/wui/stock_menu.cc'
--- src/wui/stock_menu.cc 2017-08-08 17:39:40 +0000
+++ src/wui/stock_menu.cc 2018-02-13 12:57:13 +0000
@@ -34,7 +34,7 @@
StockMenu::StockMenu(InteractivePlayer& plr, UI::UniqueWindow::Registry& registry)
: UI::UniqueWindow(&plr, "stock_menu", ®istry, 480, 640, _("Stock")), player_(plr) {
- UI::TabPanel* tabs = new UI::TabPanel(this, g_gr->images().get("images/ui_basic/but1.png"));
+ UI::TabPanel* tabs = new UI::TabPanel(this, UI::TabPanelStyle::kWuiDark);
set_center_panel(tabs);
all_wares_ = new WaresDisplay(tabs, 0, 0, plr.player().tribe(), Widelands::wwWARE, false);
=== modified file 'src/wui/story_message_box.cc'
--- src/wui/story_message_box.cc 2017-12-17 11:22:30 +0000
+++ src/wui/story_message_box.cc 2018-02-13 12:57:13 +0000
@@ -19,8 +19,6 @@
#include "wui/story_message_box.h"
-#include "base/i18n.h"
-#include "graphic/graphic.h"
#include "logic/game_controller.h"
#include "logic/save_handler.h"
#include "ui_basic/button.h"
@@ -43,8 +41,8 @@
: UI::Window(game->get_ipl(), "story_message_box", x, y, w, h, title.c_str()),
main_box_(this, kPadding, kPadding, UI::Box::Vertical, 0, 0, kPadding),
button_box_(&main_box_, kPadding, kPadding, UI::Box::Horizontal, 0, 0, kPadding),
- textarea_(&main_box_, 0, 0, 100, 100, ""),
- ok_(&button_box_, "ok", 0, 0, 120, 0, g_gr->images().get("images/ui_basic/but5.png"), _("OK")),
+ textarea_(&main_box_, 0, 0, 100, 100, UI::PanelStyle::kWui),
+ ok_(&button_box_, "ok", 0, 0, 120, 0, UI::ButtonStyle::kWuiPrimary, _("OK")),
desired_speed_(game->game_controller()->desired_speed()),
game_(game) {
=== modified file 'src/wui/trainingsitewindow.cc'
--- src/wui/trainingsitewindow.cc 2017-11-30 20:56:22 +0000
+++ src/wui/trainingsitewindow.cc 2018-02-13 12:57:13 +0000
@@ -20,7 +20,6 @@
#include "wui/trainingsitewindow.h"
#include "graphic/graphic.h"
-#include "ui_basic/tabpanel.h"
#include "wui/soldiercapacitycontrol.h"
#include "wui/soldierlist.h"
=== modified file 'src/wui/ware_statistics_menu.cc'
--- src/wui/ware_statistics_menu.cc 2017-12-16 10:48:12 +0000
+++ src/wui/ware_statistics_menu.cc 2018-02-13 12:57:13 +0000
@@ -117,7 +117,7 @@
// Setup plot widgets
// Create a tabbed environment for the different plots
- UI::TabPanel* tabs = new UI::TabPanel(box, g_gr->images().get("images/ui_basic/but1.png"));
+ UI::TabPanel* tabs = new UI::TabPanel(box, UI::TabPanelStyle::kWuiDark);
plot_production_ =
new WuiPlotArea(tabs, 0, 0, kPlotWidth, kPlotHeight + kSpacing,
@@ -184,8 +184,7 @@
UI::Box::Resizing::kFullSize);
WuiPlotAreaSlider* slider =
- new WuiPlotAreaSlider(this, *plot_production_, 0, 0, kPlotWidth, 45,
- g_gr->images().get("images/ui_basic/but1.png"));
+ new WuiPlotAreaSlider(this, *plot_production_, 0, 0, kPlotWidth, 45);
slider->changedto.connect([this](const int32_t timescale) { set_time(timescale); });
box->add(slider, UI::Box::Resizing::kFullSize);
}
=== modified file 'src/wui/ware_statistics_menu.h'
--- src/wui/ware_statistics_menu.h 2017-09-21 08:57:39 +0000
+++ src/wui/ware_statistics_menu.h 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include <vector>
#include "logic/widelands.h"
-#include "ui_basic/slider.h"
#include "ui_basic/unique_window.h"
#include "wui/plot_area.h"
=== modified file 'src/wui/warehousewindow.cc'
--- src/wui/warehousewindow.cc 2017-11-30 20:56:22 +0000
+++ src/wui/warehousewindow.cc 2018-02-13 12:57:13 +0000
@@ -23,7 +23,6 @@
#include "graphic/rendertarget.h"
#include "logic/player.h"
#include "logic/playercommand.h"
-#include "ui_basic/tabpanel.h"
#include "wui/buildingwindow.h"
#include "wui/portdockwaresdisplay.h"
#include "wui/waresdisplay.h"
@@ -137,7 +136,7 @@
#define ADD_POLICY_BUTTON(policy, policyname, tooltip) \
b = new UI::Button( \
- buttons, #policy, 0, 0, 34, 34, g_gr->images().get("images/ui_basic/but4.png"), \
+ buttons, #policy, 0, 0, 34, 34, UI::ButtonStyle::kWuiMenu, \
g_gr->images().get("images/wui/buildings/stock_policy_button_" #policy ".png"), tooltip), \
b->sigclicked.connect(boost::bind( \
&WarehouseWaresPanel::set_policy, this, Widelands::Warehouse::StockPolicy::k##policyname)), \
=== modified file 'src/wui/watchwindow.cc'
--- src/wui/watchwindow.cc 2017-11-27 08:21:32 +0000
+++ src/wui/watchwindow.cc 2018-02-13 12:57:13 +0000
@@ -103,27 +103,26 @@
last_visit_(game().get_gametime()),
single_window_(init_single_window),
cur_index_(0) {
- UI::Button* followbtn = new UI::Button(
- this, "follow", 0, h - 34, 34, 34, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/menus/menu_watch_follow.png"), _("Follow"));
+ UI::Button* followbtn =
+ new UI::Button(this, "follow", 0, h - 34, 34, 34, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/menus/menu_watch_follow.png"), _("Follow"));
followbtn->sigclicked.connect(boost::bind(&WatchWindow::do_follow, this));
- UI::Button* gotobtn = new UI::Button(this, "center_mainview_here", 34, h - 34, 34, 34,
- g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/menus/menu_goto.png"),
- _("Center the main view on this"));
+ UI::Button* gotobtn = new UI::Button(
+ this, "center_mainview_here", 34, h - 34, 34, 34, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/menus/menu_goto.png"), _("Center the main view on this"));
gotobtn->sigclicked.connect(boost::bind(&WatchWindow::do_goto, this));
if (init_single_window) {
for (uint8_t i = 0; i < NUM_VIEWS; ++i) {
- view_btns_[i] = new UI::Button(this, "view", 74 + (17 * i), 200 - 34, 17, 34,
- g_gr->images().get("images/ui_basic/but0.png"), "-");
+ view_btns_[i] = new UI::Button(
+ this, "view", 74 + (17 * i), 200 - 34, 17, 34, UI::ButtonStyle::kWuiSecondary, "-");
view_btns_[i]->sigclicked.connect(boost::bind(&WatchWindow::view_button_clicked, this, i));
}
- UI::Button* closebtn = new UI::Button(
- this, "close", w - 34, h - 34, 34, 34, g_gr->images().get("images/ui_basic/but0.png"),
- g_gr->images().get("images/wui/menu_abort.png"), _("Close"));
+ UI::Button* closebtn =
+ new UI::Button(this, "close", w - 34, h - 34, 34, 34, UI::ButtonStyle::kWuiSecondary,
+ g_gr->images().get("images/wui/menu_abort.png"), _("Close"));
closebtn->sigclicked.connect(boost::bind(&WatchWindow::close_cur_view, this));
}
Follow ups
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: noreply, 2018-05-13
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-05-13
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-05-13
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-05-12
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-05-08
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: Benedikt Straub, 2018-05-07
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-05-07
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-05-07
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: Benedikt Straub, 2018-05-06
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-05-02
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-04-22
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-04-19
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-03-16
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: kaputtnik, 2018-03-15
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-02-19
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: GunChleoc, 2018-02-14
-
[Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: bunnybot, 2018-02-13
-
Re: [Merge] lp:~widelands-dev/widelands/background_images into lp:widelands
From: kaputtnik, 2018-02-13