wesnoth/data/gui/window/wml_message.cfg
Steve Cotton 1bbce8a610 GUI: fix indentation that uses both tabs and spaces on the same line
This isn't the complete set needed to allow `check_mixed_indent` to
run over the data/gui directory, it's just these small changes:

* Remove the single space from lines indented "tab ... tab space".
* Convert lines indented with "tab ... tab four_spaces".

Although these are WML files, the coding standard for the data/gui
directory is to indent with tabs instead of spaces.
2023-03-07 12:21:28 +01:00

833 lines
14 KiB
INI

#textdomain wesnoth-lib
###
### The in game portrait dialogs.
### Due to the excessive amount of dialogs it's not possible to split off the
### window definitions. So this unit is a bit larger as wanted.
###
# The maximum width of the text
#define MAX_TEXT_WIDTH
675
#enddef
#define ___GUI_IMAGE_WIDTH
(
max(250, min(500, best_size))
where
best_size = (
if((best_width * aspect_ratio) > max_height,
floor(max_height / aspect_ratio),
best_width
)
where
best_width = (
if(gamemap_width > text_width_saturation,
gamemap_width - {MAX_TEXT_WIDTH},
gamemap_width / size_factor
)
where
# gamemap_width width needed to reach the MAX_TEXT_WIDTH #
text_width_saturation = 3 * height_offset / 2 where height_offset = 25,
size_factor = 3
),
aspect_ratio = (
if(image_original_width > 0,
as_decimal(image_original_height) / image_original_width,
0
)
),
#
TODO: this is rather hacky. The old value was gamemap_height - 4 but that caused
crashes with the 727 px high Rithrandil portrait in TRoW. This value seems to work,
but the fact that it crashed at all points to some deeper logic flaw in the size
calculation formulas here. Need to revisit at some point...
-- vultraz, 2018-05-24
#
max_height = (gamemap_height - 30)
)
)#enddef
# This is the version with debug info
#define __GUI_IMAGE_WIDTH
([[
debug_print('screen_width ', screen_width),
debug_print('screen_height ', screen_height),
debug_print('gamemap_width ', gamemap_width),
debug_print('gamemap_height ', gamemap_height),
debug_print('image_original_width ', image_original_width),
debug_print('image_original_height ', image_original_height),
],
{___GUI_IMAGE_WIDTH}
][1]
)
#enddef
#undef __GUI_IMAGE_WIDTH
# This is the version without debug info
#define __GUI_IMAGE_WIDTH
({___GUI_IMAGE_WIDTH})#enddef
# This is the macro for the image width which is can be used as string
# parameter.
#define _GUI_IMAGE_WIDTH
"{__GUI_IMAGE_WIDTH}"#enddef
# the value the image needs to be scaled by, this version can be used as string
# parameter.
#define _GUI_IMAGE_SCALE_FACTOR
(
{__GUI_IMAGE_WIDTH} / 500
)#enddef
# The formula to set the widthe of the real image width depending on the
# image real size
#define __GUI_IMAGE_DISPLAYED_WIDTH
(
if((image_original_width < 300) and (image_original_height < 300),
image_original_width,
((image_original_width * calculated_width) / 500)
)
where calculated_width = {__GUI_IMAGE_WIDTH}
)#enddef
# The formula to set the heighte of the real image height depending on the
# image real size
#define __GUI_IMAGE_DISPLAYED_HEIGHT
(
if((image_original_width < 300) and (image_original_height < 300),
image_original_height,
((image_original_height * calculated_width) / 500)
)
where calculated_width = {__GUI_IMAGE_WIDTH}
)#enddef
# The X location of the image to display, only tested on the left side.
#define __GUI_IMAGE_DISPLAYED_X
(
if(image_original_width > 100,
0,
(calculated_width - image_width) / 2
)
where calculated_width = {__GUI_IMAGE_WIDTH}
)#enddef
# The Y location of the image to display, only tested on the left side.
# Note since we don't know the exact height of the text we can't centre
# the image. Instead we use the centre of the reserved image space.
#
# TODO the Y can't be determined properly since we don't know the height
# of the panel. Disabled the centring for now.
#
#define __GUI_IMAGE_DISPLAYED_Y
(
if(image_original_height > 0,
(height - image_height),
height - ((calculated_width - image_height) / 2)
)
where calculated_width = {__GUI_IMAGE_WIDTH}
)#enddef
[window_definition]
id = "wml_message_left"
description = "bar"
[resolution]
[background]
[draw]
[/draw]
[/background]
[foreground]
[draw]
[image]
x = "{__GUI_IMAGE_DISPLAYED_X}"
y = "{__GUI_IMAGE_DISPLAYED_Y}"
w = "{__GUI_IMAGE_DISPLAYED_WIDTH}"
h = "{__GUI_IMAGE_DISPLAYED_HEIGHT}"
name = "(portrait_image)"
mirror = "(portrait_mirror)"
[/image]
[/draw]
[/foreground]
[/resolution]
[/window_definition]
[window_definition]
id = "wml_message_right"
description = "bar"
[resolution]
[background]
[draw]
[/draw]
[/background]
[foreground]
[draw]
[image]
x = "(width - {__GUI_IMAGE_DISPLAYED_WIDTH})"
y = "(height - image_height)"
w = "{__GUI_IMAGE_DISPLAYED_WIDTH}"
h = "{__GUI_IMAGE_DISPLAYED_HEIGHT}"
name = "(portrait_image)"
mirror = "(portrait_mirror)"
[/image]
[/draw]
[/foreground]
[/resolution]
[/window_definition]
[window_definition]
id = "wml_message_double"
description = "bar"
[resolution]
[background]
[draw]
[/draw]
[/background]
[foreground]
[draw]
[image]
x = "{__GUI_IMAGE_DISPLAYED_X}"
y = "{__GUI_IMAGE_DISPLAYED_Y}"
w = "{__GUI_IMAGE_DISPLAYED_WIDTH}"
h = "{__GUI_IMAGE_DISPLAYED_HEIGHT}"
name = "(portrait_image)"
mirror = "(portrait_mirror)"
[/image]
[image]
x = "(width - {__GUI_IMAGE_DISPLAYED_WIDTH})"
y = "(height - image_height)"
w = "{__GUI_IMAGE_DISPLAYED_WIDTH}"
h = "{__GUI_IMAGE_DISPLAYED_HEIGHT}"
name = "(second_portrait_image)"
mirror = "(second_portrait_mirror)"
[/image]
[/draw]
[/foreground]
[/resolution]
[/window_definition]
#define _GUI_INPUT_LIST
[listbox]
id = "input_list"
definition = "wml_message"
[list_definition]
[row]
[column]
grow_factor = 1
horizontal_grow = true
[toggle_panel]
definition = "wml_message"
return_value_id = "ok"
[grid]
[row]
[column]
grow_factor = 0
horizontal_alignment = "left"
border = "all"
border_size = 5
[image]
id = "icon"
definition = "default"
linked_group = "icon"
[/image]
[/column]
[column]
grow_factor = 0
horizontal_alignment = "left"
border = "all"
border_size = 5
[label]
id = "label"
definition = "default"
linked_group = "label"
[/label]
[/column]
[column]
grow_factor = 1
horizontal_grow = true
border = "all"
border_size = 5
[label]
id = "description"
definition = "default"
linked_group = "description"
[/label]
[/column]
[/row]
[/grid]
[/toggle_panel]
[/column]
[/row]
[/list_definition]
[/listbox]
#enddef
#define _GUI_WML_MESSAGE_CONTENT
[column]
grow_factor = 1
horizontal_grow = true
vertical_grow = true
[grid]
[row]
grow_factor = 0
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
grow_factor = 1
[column]
grow_factor = 1
horizontal_grow = true
border = "all"
border_size = 5
[scroll_label]
id = "message"
definition = "wml_message"
[/scroll_label]
[/column]
[/row]
[row]
grow_factor = 0
[column]
grow_factor = 1
horizontal_grow = true
[grid]
[row]
[column]
border = "all"
border_size = 5
[label]
id = "input_caption"
definition = "default"
[/label]
[/column]
[column]
grow_factor = 1
horizontal_grow = true
border = "all"
border_size = 5
[text_box]
id = "input"
definition = "transparent"
[/text_box]
[/column]
[/row]
[/grid]
[/column]
[/row]
[row]
grow_factor = 0
[column]
border = "all"
border_size = 5
horizontal_grow = true
{_GUI_INPUT_LIST}
[/column]
[/row]
[row]
grow_factor = 0
[column]
border = "all"
border_size = 5
horizontal_alignment = "center"
[button]
# This button will be shown or hidden depending on the
# whether or not a scrollbar is needed to show the
# text.
id = "ok"
definition = "transparent"
label = _ "OK"
[/button]
[/column]
[/row]
[/grid]
[/column]
#enddef
[window]
id = "wml_message_left"
description = "Dialog showing a unit portrait on the left side"
[resolution]
window_width = 0
window_height = 0
definition = "wml_message_left"
automatic_placement = false
x = "(gamemap_x_offset)"
y = 30
width = "(gamemap_width)"
height = "(screen_height - 30)"
click_dismiss = true
[linked_group]
id = "icon"
fixed_width = true
[/linked_group]
[linked_group]
id = "label"
fixed_width = true
[/linked_group]
[linked_group]
id = "description"
fixed_width = true
[/linked_group]
[tooltip]
id = "tooltip"
[/tooltip]
[helptip]
id = "tooltip"
[/helptip]
[grid]
[row]
[column]
vertical_alignment = "bottom"
horizontal_grow = true
[panel]
definition = "wml_message"
[grid]
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
[spacer]
# reserve place for the image and set a minimum height for the text
id = "image_place_holder"
width = {_GUI_IMAGE_WIDTH}
height = 75
[/spacer]
[/column]
{_GUI_WML_MESSAGE_CONTENT}
[column]
[spacer]
width = "(
if(gamemap_width - ({__GUI_IMAGE_WIDTH}) > {MAX_TEXT_WIDTH}
, gamemap_width - (({__GUI_IMAGE_WIDTH}) + {MAX_TEXT_WIDTH})
, 0
))"
height = 75
[/spacer]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/panel]
[/column]
[/row]
[/grid]
[/resolution]
[/window]
[window]
id = "wml_message_right"
description = "Dialog showing a unit portrait on the right side"
[resolution]
window_width = 0
window_height = 0
definition = "wml_message_right"
automatic_placement = false
x = "(gamemap_x_offset)"
y = 30
width = "(gamemap_width)"
height = "(screen_height - 30)"
click_dismiss = true
[linked_group]
id = "icon"
fixed_width = true
[/linked_group]
[linked_group]
id = "label"
fixed_width = true
[/linked_group]
[linked_group]
id = "description"
fixed_width = true
[/linked_group]
[tooltip]
id = "tooltip"
[/tooltip]
[helptip]
id = "tooltip"
[/helptip]
[grid]
[row]
[column]
vertical_alignment = "bottom"
horizontal_grow = true
[panel]
definition = "wml_message"
[grid]
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
[spacer]
width = "(
if(gamemap_width - ({__GUI_IMAGE_WIDTH} + ({__GUI_IMAGE_WIDTH})) > {MAX_TEXT_WIDTH} , {__GUI_IMAGE_WIDTH} , 10)
)"
height = 75
[/spacer]
[/column]
{_GUI_WML_MESSAGE_CONTENT}
[column]
[spacer]
width = "(
if(gamemap_width - (left_padding + ({__GUI_IMAGE_WIDTH})) > {MAX_TEXT_WIDTH}
, gamemap_width - (left_padding + ({__GUI_IMAGE_WIDTH}) + {MAX_TEXT_WIDTH})
, 0
)
where left_padding = if(gamemap_width - ({__GUI_IMAGE_WIDTH} + ({__GUI_IMAGE_WIDTH})) > {MAX_TEXT_WIDTH} , {__GUI_IMAGE_WIDTH} , 10)
)"
height = 75
[/spacer]
[/column]
[column]
[spacer]
# reserve place for the image and set a minimum height for the text
id = "image_place_holder"
width = {_GUI_IMAGE_WIDTH}
height = 75
[/spacer]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/panel]
[/column]
[/row]
[/grid]
[/resolution]
[/window]
[window]
id = "wml_message_double"
description = "Dialog showing a unit portrait on each side"
[resolution]
window_width = 0
window_height = 0
definition = "wml_message_double"
automatic_placement = false
x = "(gamemap_x_offset)"
y = 30
width = "(gamemap_width)"
height = "(screen_height - 30)"
click_dismiss = true
[linked_group]
id = "icon"
fixed_width = true
[/linked_group]
[linked_group]
id = "label"
fixed_width = true
[/linked_group]
[linked_group]
id = "description"
fixed_width = true
[/linked_group]
[tooltip]
id = "tooltip"
[/tooltip]
[helptip]
id = "tooltip"
[/helptip]
[grid]
[row]
[column]
vertical_alignment = "bottom"
horizontal_grow = true
[panel]
definition = "wml_message"
[grid]
[row]
[column]
horizontal_grow = true
[grid]
[row]
[column]
[spacer]
# reserve place for the image and set a minimum height for the text
id = "image_place_holder"
width = {_GUI_IMAGE_WIDTH}
height = 75
[/spacer]
[/column]
{_GUI_WML_MESSAGE_CONTENT}
[column]
[spacer]
width = "(
if(gamemap_width - ({__GUI_IMAGE_WIDTH} + ({__GUI_IMAGE_WIDTH})) > {MAX_TEXT_WIDTH}
, gamemap_width - ({__GUI_IMAGE_WIDTH} + ({__GUI_IMAGE_WIDTH}) + {MAX_TEXT_WIDTH})
, 0
))"
height = 75
[/spacer]
[/column]
[column]
[spacer]
# reserve place for the image and set a minimum height for the text
id = "image_place_holder"
width = {_GUI_IMAGE_WIDTH}
height = 75
[/spacer]
[/column]
[/row]
[/grid]
[/column]
[/row]
[/grid]
[/panel]
[/column]
[/row]
[/grid]
[/resolution]
[/window]
#undef _GUI_INPUT_LIST
#undef __GUI_IMAGE_DISPLAYED_Y
#undef __GUI_IMAGE_DISPLAYED_X
#undef __GUI_IMAGE_DISPLAYED_HEIGHT
#undef __GUI_IMAGE_DISPLAYED_WIDTH
#undef _GUI_IMAGE_SCALE_FACTOR
#undef _GUI_IMAGE_WIDTH
#undef __GUI_IMAGE_WIDTH
#undef ___GUI_IMAGE_WIDTH
#undef MAX_TEXT_WIDTH