Simplify storyscreen title definition
This commit is contained in:
parent
e46b10af0e
commit
9b2eac1920
1 changed files with 34 additions and 49 deletions
|
@ -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
|
||||
|
|
Loading…
Add table
Reference in a new issue