mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-17 19:06:44 +00:00
GUI2/Main Menu: make it easier to restore the tips panel
Resolves #9852
This commit is contained in:
parent
3774da4d79
commit
85f47f0a7e
|
@ -49,6 +49,17 @@ where
|
|||
resize_mode = "scale"
|
||||
[/image]
|
||||
|
||||
[text]
|
||||
x = "5"
|
||||
y = "(height - text_height - 5)"
|
||||
w = "(text_width)"
|
||||
h = "(text_height)"
|
||||
text = "(revision_number)"
|
||||
color = "255, 255, 255, 255"
|
||||
outline = true
|
||||
font_size = {GUI_FONT_SIZE_SMALL}
|
||||
[/text]
|
||||
|
||||
[/draw]
|
||||
|
||||
[/background]
|
||||
|
@ -71,15 +82,13 @@ where
|
|||
#define _GUI_TIP_SECTION
|
||||
[panel]
|
||||
id = "tip_panel"
|
||||
definition = "title"
|
||||
definition = "title_padded"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = "15"
|
||||
horizontal_grow = true
|
||||
|
||||
[multi_page]
|
||||
|
@ -138,32 +147,17 @@ where
|
|||
[row]
|
||||
|
||||
[column]
|
||||
horizontal_grow = true
|
||||
border = "bottom,left,right"
|
||||
border_size = "15"
|
||||
border = "top"
|
||||
border_size = 15
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
grow_factor = 1
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[button]
|
||||
id = "close"
|
||||
definition = "titlescreen_button_noicon"
|
||||
label = _ "Hide"
|
||||
tooltip = _ "Hide tip of the day"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
grow_factor = 0
|
||||
|
||||
[button]
|
||||
id = "previous_tip"
|
||||
|
@ -177,7 +171,6 @@ where
|
|||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
grow_factor = 0
|
||||
|
||||
[button]
|
||||
id = "next_tip"
|
||||
|
@ -202,6 +195,64 @@ where
|
|||
[/panel]
|
||||
#enddef
|
||||
|
||||
#define _GUI_ABOUT_SECTION
|
||||
[panel]
|
||||
definition = "title_padded"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
grow_factor = 1
|
||||
horizontal_alignment = "left"
|
||||
|
||||
[button]
|
||||
id = "toggle_tip_panel"
|
||||
definition = "titlescreen_button_noicon"
|
||||
label = _ "Tip of the Day"
|
||||
tooltip = _ "Show tip of the day"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "about"
|
||||
definition = "titlescreen_about"
|
||||
linked_group = "about_and_language"
|
||||
label = _ "About"
|
||||
tooltip = _ "General information about Battle for Wesnoth"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "language"
|
||||
definition = "titlescreen_language"
|
||||
linked_group = "about_and_language"
|
||||
label = _ "Language"
|
||||
tooltip = _ "Change the language"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
|
||||
[/panel]
|
||||
#enddef
|
||||
|
||||
#define _GUI_BUTTON ID CAPTION TOOLTIP
|
||||
#arg DEF
|
||||
"title_small" #endarg
|
||||
|
@ -431,60 +482,11 @@ where
|
|||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 10
|
||||
horizontal_alignment = "right"
|
||||
|
||||
[grid]
|
||||
|
||||
[row]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[label]
|
||||
id = "revision_number"
|
||||
definition = "default_outline"
|
||||
[/label]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "about"
|
||||
definition = "titlescreen_about"
|
||||
linked_group = "about_and_language"
|
||||
label = _ "About"
|
||||
tooltip = _ "General information about Battle for Wesnoth"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
[column]
|
||||
border = "all"
|
||||
border_size = 5
|
||||
|
||||
[button]
|
||||
id = "language"
|
||||
definition = "titlescreen_language"
|
||||
linked_group = "about_and_language"
|
||||
label = _ "Language"
|
||||
tooltip = _ "Change the language"
|
||||
[/button]
|
||||
|
||||
[/column]
|
||||
|
||||
# Align with buttons in tips panel
|
||||
{GUI_FILLER WIDTH=5}
|
||||
|
||||
[/row]
|
||||
|
||||
[/grid]
|
||||
border = "top"
|
||||
border_size = 15
|
||||
horizontal_grow = true
|
||||
|
||||
{_GUI_ABOUT_SECTION}
|
||||
[/column]
|
||||
|
||||
[/row]
|
||||
|
@ -502,6 +504,7 @@ where
|
|||
[/window]
|
||||
|
||||
#undef _GUI_TIP_SECTION
|
||||
#undef _GUI_ABOUT_SECTION
|
||||
#undef _GUI_MENU_SECTION
|
||||
#undef _GUI_BUTTON_GRID
|
||||
#undef _GUI_BUTTON
|
||||
|
|
|
@ -3,27 +3,20 @@
|
|||
### Default definition of a panel.
|
||||
###
|
||||
|
||||
[panel_definition]
|
||||
|
||||
id = "title"
|
||||
description = "Panel used in titlescreen"
|
||||
|
||||
#define _GUI_RESOLUTION _BORDER
|
||||
[resolution]
|
||||
|
||||
left_border = {_BORDER}
|
||||
right_border = {_BORDER}
|
||||
top_border = {_BORDER}
|
||||
bottom_border = {_BORDER}
|
||||
|
||||
[background]
|
||||
|
||||
[draw]
|
||||
|
||||
{DEFAULT_BLUR}
|
||||
|
||||
#[image]
|
||||
# x = 0
|
||||
# y = 0
|
||||
# w = "(width)"
|
||||
# h = "(height)"
|
||||
# name = "panels/background-title.png"
|
||||
#[/image]
|
||||
|
||||
[rectangle]
|
||||
x = 0
|
||||
y = 0
|
||||
|
@ -45,5 +38,24 @@
|
|||
[/foreground]
|
||||
|
||||
[/resolution]
|
||||
#enddef
|
||||
|
||||
[panel_definition]
|
||||
|
||||
id = "title"
|
||||
description = "Panel used in titlescreen"
|
||||
|
||||
{_GUI_RESOLUTION 0}
|
||||
|
||||
[/panel_definition]
|
||||
|
||||
[panel_definition]
|
||||
|
||||
id = "title_padded"
|
||||
description = "Panel used in titlescreen"
|
||||
|
||||
{_GUI_RESOLUTION 15}
|
||||
|
||||
[/panel_definition]
|
||||
|
||||
#undef _GUI_RESOLUTION
|
||||
|
|
|
@ -244,17 +244,23 @@ void title_screen::init_callbacks()
|
|||
|
||||
// Tip panel visiblity and close button
|
||||
panel& tip_panel = find_widget<panel>("tip_panel");
|
||||
if (!prefs::get().show_tips()) {
|
||||
tip_panel.set_visible(false);
|
||||
} else {
|
||||
auto close = find_widget<button>("close", false, false);
|
||||
if (close) {
|
||||
connect_signal_mouse_left_click(*close, [&](auto&&...) {
|
||||
prefs::get().set_show_tips(false);
|
||||
tip_panel.set_visible(false);
|
||||
|
||||
tip_panel.set_visible(prefs::get().show_tips()
|
||||
? widget::visibility::visible
|
||||
: widget::visibility::hidden);
|
||||
|
||||
if(auto toggle_tips = find_widget<button>("toggle_tip_panel", false, false)) {
|
||||
connect_signal_mouse_left_click(*toggle_tips, [&tip_panel](auto&&...) {
|
||||
const bool currently_hidden = tip_panel.get_visible() == widget::visibility::hidden;
|
||||
|
||||
tip_panel.set_visible(currently_hidden
|
||||
? widget::visibility::visible
|
||||
: widget::visibility::hidden);
|
||||
|
||||
// If previously hidden, will now be visible, so we can reuse the same value
|
||||
prefs::get().set_show_tips(currently_hidden);
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// Help
|
||||
|
|
Loading…
Reference in New Issue
Block a user