From 9b2eac1920bbf21fca8a274939b2cb8d1411278c Mon Sep 17 00:00:00 2001 From: Celtic Minstrel Date: Sat, 8 Apr 2017 07:22:37 -0400 Subject: [PATCH] Simplify storyscreen title definition --- data/gui/widget/label_story_screen_title.cfg | 83 ++++++++------------ 1 file changed, 34 insertions(+), 49 deletions(-) diff --git a/data/gui/widget/label_story_screen_title.cfg b/data/gui/widget/label_story_screen_title.cfg index c6ace1daaf3..4242e570601 100644 --- a/data/gui/widget/label_story_screen_title.cfg +++ b/data/gui/widget/label_story_screen_title.cfg @@ -5,7 +5,7 @@ # We can't get the exact size of the text outside a [text] element, so estimate it instead. # Using an average character width of 12 seems to give good results. -# Then we centre the text in the estimated width rather than. +# Then we centre the text in the estimated width rather than in the entire width. #define _GUI_ESTIMATE_TEXT_WIDTH (length(text) * 12)#enddef @@ -14,6 +14,33 @@ (10 + max((box_width - text_width) / 2, 0) where box_width = {_GUI_ESTIMATE_TEXT_WIDTH})#enddef +#define _GUI_BACKGROUND + [rectangle] + x = 10 + y = 10 + w = "{_GUI_ESTIMATE_TEXT_WIDTH}" + h = "(height - 20)" + fill_color = "0, 0, 0, 128" + [/rectangle] +#enddef + +#define _GUI_TEXT MODE + [text] + x = "{_GUI_CENTER_STORY_TEXT}" + y = {GUI__TEXT_VERTICALLY_CENTRED} + w = "(width)" + h = "(text_height)" + maximum_width = "(width)" + font_size = {GUI_FONT_SIZE_LARGE} + color = {GUI__FONT_COLOR_{MODE}__DEFAULT} + text = "(text)" + text_markup = "(text_markup)" + text_alignment = "(text_alignment)" + text_link_aware = "(text_link_aware)" + text_link_color = "(text_link_color)" + [/text] +#enddef + [label_definition] id = "story_screen_title" description = "Large label with translucent background for story screen" @@ -37,30 +64,8 @@ where box_width = {_GUI_ESTIMATE_TEXT_WIDTH})#enddef [state_enabled] [draw] - - [rectangle] - x = 10 - y = 10 - w = "{_GUI_ESTIMATE_TEXT_WIDTH}" - h = "(height - 20)" - fill_color = "0, 0, 0, 128" - [/rectangle] - - [text] - x = "{_GUI_CENTER_STORY_TEXT}" - y = {GUI__TEXT_VERTICALLY_CENTRED} - w = "(width)" - h = "(text_height)" - maximum_width = "(width)" - font_size = {GUI_FONT_SIZE_LARGE} - color = {GUI__FONT_COLOR_ENABLED__DEFAULT} - text = "(text)" - text_markup = "(text_markup)" - text_alignment = "(text_alignment)" - text_link_aware = "(text_link_aware)" - text_link_color = "(text_link_color)" - [/text] - + {_GUI_BACKGROUND} + {_GUI_TEXT ENABLED} [/draw] [/state_enabled] @@ -68,30 +73,8 @@ where box_width = {_GUI_ESTIMATE_TEXT_WIDTH})#enddef [state_disabled] [draw] - - [rectangle] - x = 10 - y = 10 - w = "{_GUI_ESTIMATE_TEXT_WIDTH}" - h = "(height - 20)" - fill_color = "0, 0, 0, 128" - [/rectangle] - - [text] - x = "{_GUI_CENTER_STORY_TEXT}" - y = {GUI__TEXT_VERTICALLY_CENTRED} - w = "(width)" - h = "(text_height)" - maximum_width = "(width)" - font_size = {GUI_FONT_SIZE_LARGE} - color = {GUI__FONT_COLOR_DISABLED__DEFAULT} - text = "(text)" - text_markup = "(text_markup)" - text_alignment = "(text_alignment)" - text_link_aware = "(text_link_aware)" - text_link_color = "(text_link_color)" - [/text] - + {_GUI_BACKGROUND} + {_GUI_TEXT DISABLED} [/draw] [/state_disabled] @@ -102,3 +85,5 @@ where box_width = {_GUI_ESTIMATE_TEXT_WIDTH})#enddef #undef _GUI_ESTIMATE_TEXT_WIDTH #undef _GUI_CENTER_STORY_TEXT +#undef _GUI_BACKGROUND +#undef _GUI_TEXT