mirror of
https://github.com/wesnoth/wesnoth
synced 2025-04-19 05:58:55 +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"
|
resize_mode = "scale"
|
||||||
[/image]
|
[/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]
|
[/draw]
|
||||||
|
|
||||||
[/background]
|
[/background]
|
||||||
|
@ -71,15 +82,13 @@ where
|
||||||
#define _GUI_TIP_SECTION
|
#define _GUI_TIP_SECTION
|
||||||
[panel]
|
[panel]
|
||||||
id = "tip_panel"
|
id = "tip_panel"
|
||||||
definition = "title"
|
definition = "title_padded"
|
||||||
|
|
||||||
[grid]
|
[grid]
|
||||||
|
|
||||||
[row]
|
[row]
|
||||||
|
|
||||||
[column]
|
[column]
|
||||||
border = "all"
|
|
||||||
border_size = "15"
|
|
||||||
horizontal_grow = true
|
horizontal_grow = true
|
||||||
|
|
||||||
[multi_page]
|
[multi_page]
|
||||||
|
@ -138,32 +147,17 @@ where
|
||||||
[row]
|
[row]
|
||||||
|
|
||||||
[column]
|
[column]
|
||||||
horizontal_grow = true
|
border = "top"
|
||||||
border = "bottom,left,right"
|
border_size = 15
|
||||||
border_size = "15"
|
horizontal_alignment = "left"
|
||||||
|
|
||||||
[grid]
|
[grid]
|
||||||
|
|
||||||
[row]
|
[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]
|
[column]
|
||||||
border = "all"
|
border = "all"
|
||||||
border_size = 5
|
border_size = 5
|
||||||
grow_factor = 0
|
|
||||||
|
|
||||||
[button]
|
[button]
|
||||||
id = "previous_tip"
|
id = "previous_tip"
|
||||||
|
@ -177,7 +171,6 @@ where
|
||||||
[column]
|
[column]
|
||||||
border = "all"
|
border = "all"
|
||||||
border_size = 5
|
border_size = 5
|
||||||
grow_factor = 0
|
|
||||||
|
|
||||||
[button]
|
[button]
|
||||||
id = "next_tip"
|
id = "next_tip"
|
||||||
|
@ -202,6 +195,64 @@ where
|
||||||
[/panel]
|
[/panel]
|
||||||
#enddef
|
#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
|
#define _GUI_BUTTON ID CAPTION TOOLTIP
|
||||||
#arg DEF
|
#arg DEF
|
||||||
"title_small" #endarg
|
"title_small" #endarg
|
||||||
|
@ -431,60 +482,11 @@ where
|
||||||
[row]
|
[row]
|
||||||
|
|
||||||
[column]
|
[column]
|
||||||
border = "all"
|
border = "top"
|
||||||
border_size = 10
|
border_size = 15
|
||||||
horizontal_alignment = "right"
|
horizontal_grow = true
|
||||||
|
|
||||||
[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]
|
|
||||||
|
|
||||||
|
{_GUI_ABOUT_SECTION}
|
||||||
[/column]
|
[/column]
|
||||||
|
|
||||||
[/row]
|
[/row]
|
||||||
|
@ -502,6 +504,7 @@ where
|
||||||
[/window]
|
[/window]
|
||||||
|
|
||||||
#undef _GUI_TIP_SECTION
|
#undef _GUI_TIP_SECTION
|
||||||
|
#undef _GUI_ABOUT_SECTION
|
||||||
#undef _GUI_MENU_SECTION
|
#undef _GUI_MENU_SECTION
|
||||||
#undef _GUI_BUTTON_GRID
|
#undef _GUI_BUTTON_GRID
|
||||||
#undef _GUI_BUTTON
|
#undef _GUI_BUTTON
|
||||||
|
|
|
@ -3,27 +3,20 @@
|
||||||
### Default definition of a panel.
|
### Default definition of a panel.
|
||||||
###
|
###
|
||||||
|
|
||||||
[panel_definition]
|
#define _GUI_RESOLUTION _BORDER
|
||||||
|
|
||||||
id = "title"
|
|
||||||
description = "Panel used in titlescreen"
|
|
||||||
|
|
||||||
[resolution]
|
[resolution]
|
||||||
|
|
||||||
|
left_border = {_BORDER}
|
||||||
|
right_border = {_BORDER}
|
||||||
|
top_border = {_BORDER}
|
||||||
|
bottom_border = {_BORDER}
|
||||||
|
|
||||||
[background]
|
[background]
|
||||||
|
|
||||||
[draw]
|
[draw]
|
||||||
|
|
||||||
{DEFAULT_BLUR}
|
{DEFAULT_BLUR}
|
||||||
|
|
||||||
#[image]
|
|
||||||
# x = 0
|
|
||||||
# y = 0
|
|
||||||
# w = "(width)"
|
|
||||||
# h = "(height)"
|
|
||||||
# name = "panels/background-title.png"
|
|
||||||
#[/image]
|
|
||||||
|
|
||||||
[rectangle]
|
[rectangle]
|
||||||
x = 0
|
x = 0
|
||||||
y = 0
|
y = 0
|
||||||
|
@ -45,5 +38,24 @@
|
||||||
[/foreground]
|
[/foreground]
|
||||||
|
|
||||||
[/resolution]
|
[/resolution]
|
||||||
|
#enddef
|
||||||
|
|
||||||
|
[panel_definition]
|
||||||
|
|
||||||
|
id = "title"
|
||||||
|
description = "Panel used in titlescreen"
|
||||||
|
|
||||||
|
{_GUI_RESOLUTION 0}
|
||||||
|
|
||||||
[/panel_definition]
|
[/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
|
// Tip panel visiblity and close button
|
||||||
panel& tip_panel = find_widget<panel>("tip_panel");
|
panel& tip_panel = find_widget<panel>("tip_panel");
|
||||||
if (!prefs::get().show_tips()) {
|
|
||||||
tip_panel.set_visible(false);
|
tip_panel.set_visible(prefs::get().show_tips()
|
||||||
} else {
|
? widget::visibility::visible
|
||||||
auto close = find_widget<button>("close", false, false);
|
: widget::visibility::hidden);
|
||||||
if (close) {
|
|
||||||
connect_signal_mouse_left_click(*close, [&](auto&&...) {
|
if(auto toggle_tips = find_widget<button>("toggle_tip_panel", false, false)) {
|
||||||
prefs::get().set_show_tips(false);
|
connect_signal_mouse_left_click(*toggle_tips, [&tip_panel](auto&&...) {
|
||||||
tip_panel.set_visible(false);
|
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
|
// Help
|
||||||
|
|
Loading…
Reference in New Issue
Block a user