Split message.cfg.

This commit is contained in:
Mark de Wever 2009-01-24 11:21:21 +00:00
parent 35127c0a58
commit f62feb05f5
2 changed files with 459 additions and 454 deletions

View file

@ -1,449 +1,8 @@
#textdomain wesnoth-lib
###
### Test window to show messages to the user, test version to test with Jetryl's
### new message dialog and Kitty's portraits.
### In game normal message dialog with some optional buttons and an icon.
###
# These might become global have to evaluate later.
#define _GUI_WIDTH_OFFSET
142#enddef
# These might become global have to evaluate later.
#define _GUI_HEIGHT_OFFSET
25#enddef
# helper convert the scale factor, since we use it in two places define it as
# helper value. (Two the not working and working version, but want to avoid
# surprises when the not working version is fixed).
#define __GUI_SIZE_FACTOR
3#enddef
# This is the function I want to use for the image width, but the formula system
# has no way to create variables (outside the AI scope). So instead of this
# macro there's a more verbose version which doesn't use variable.
#define __GUI_IMAGE_WIDTH
([
max_width = screen_width - {_GUI_WIDTH_OFFSET},
max_height = screen_height - {_GUI_HEIGHT_OFFSET},
best_width = max_width / {__GUI_SIZE_FACTOR},
best_width = if(best_width > max_height, max_height, best_width),
if(best_width < 250, 250,
if(best_width > 500, 500, best_width))
][4])#enddef
#undef __GUI_IMAGE_WIDTH
###
### The verbose version
###
#define __GUI_MAX_WIDTH
(screen_width - {_GUI_WIDTH_OFFSET})
#enddef
#define __GUI_MAX_HEIGHT
(screen_height - {_GUI_HEIGHT_OFFSET})
#enddef
#define BEST_WIDTH
({__GUI_MAX_WIDTH} / {__GUI_SIZE_FACTOR})
#enddef
#define __GUI_BEST_SIZE
(if({BEST_WIDTH} > {__GUI_MAX_HEIGHT}, {__GUI_MAX_HEIGHT}, {BEST_WIDTH}))
#enddef
#define ___GUI_IMAGE_WIDTH
if({__GUI_BEST_SIZE} < 250, 250,
if({__GUI_BEST_SIZE} > 500, 500, {__GUI_BEST_SIZE})
)
#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('__GUI_MAX_WIDTH ', {__GUI_MAX_WIDTH}),
debug_print('__GUI_MAX_HEIGHT ', {__GUI_MAX_HEIGHT}),
debug_print('BEST_WIDTH ', {BEST_WIDTH}),
debug_print('__GUI_BEST_SIZE ', {__GUI_BEST_SIZE})
],
{___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
[window_definition]
id = "wml_message_left"
description = "bar"
[resolution]
[background]
[draw]
[/draw]
[/background]
[foreground]
[draw]
[image]
x = 0
y = "(height - image_height)"
w = "(if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500)))"
h = "(if((image_original_width < 300) and (image_original_height < 300), image_original_height, ((image_original_height * {__GUI_IMAGE_WIDTH}) / 500)))"
name = "(portrait_image)"
vertical_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 - (if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500))))"
y = "(height - image_height)"
w = "(if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500)))"
h = "(if((image_original_width < 300) and (image_original_height < 300), image_original_height, ((image_original_height * {__GUI_IMAGE_WIDTH}) / 500)))"
name = "(portrait_image)"
vertical_mirror = "(portrait_mirror)"
[/image]
[/draw]
[/foreground]
[/resolution]
[/window_definition]
[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 = 0
y = 30
width = "(screen_width - 142)"
height = "(screen_height - 30)"
easy_close = "true"
[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]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[scroll_label] # NOTE maybe change the code to use message instead of label as id
id = "label"
definition = "default"
[/scroll_label]
[/column]
[/row]
[row]
[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 = "default"
label = "close"
[/button]
[/column]
[/row]
[/grid]
[/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 = 0
y = 30
width = "(screen_width - 142)"
height = "(screen_height - 30)"
easy_close = "true"
[grid]
[row]
[column]
vertical_alignment = "bottom"
horizontal_grow = "true"
[panel]
definition = "wml_message"
[grid]
[row]
[column]
horizontal_grow = "true"
[grid]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[scroll_label] # NOTE maybe change the code to use message instead of label as id
id = "label"
definition = "default"
[/scroll_label]
[/column]
[/row]
[row]
[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 = "default"
label = "close"
[/button]
[/column]
[/row]
[/grid]
[/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 = "message"
description = "Message dialog with 1 ok button for now."
@ -552,15 +111,3 @@
[/resolution]
[/window]
#undef _GUI_IMAGE_SCALE_FACTOR
#undef _GUI_IMAGE_WIDTH
#undef __GUI_IMAGE_WIDTH
#undef ___GUI_IMAGE_WIDTH
#undef __GUI_BEST_SIZE
#undef __GUI_MAX_HEIGHT
#undef __GUI_MAX_WIDTH
#undef __GUI_SIZE_FACTOR
#undef _GUI_HEIGHT_OFFSET
#undef _GUI_WIDTH_OFFSET

View file

@ -0,0 +1,458 @@
#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.
###
# These might become global have to evaluate later.
#define _GUI_WIDTH_OFFSET
142#enddef
# These might become global have to evaluate later.
#define _GUI_HEIGHT_OFFSET
25#enddef
# helper convert the scale factor, since we use it in two places define it as
# helper value. (Two the not working and working version, but want to avoid
# surprises when the not working version is fixed).
#define __GUI_SIZE_FACTOR
3#enddef
# This is the function I want to use for the image width, but the formula system
# has no way to create variables (outside the AI scope). So instead of this
# macro there's a more verbose version which doesn't use variable.
#define __GUI_IMAGE_WIDTH
([
max_width = screen_width - {_GUI_WIDTH_OFFSET},
max_height = screen_height - {_GUI_HEIGHT_OFFSET},
best_width = max_width / {__GUI_SIZE_FACTOR},
best_width = if(best_width > max_height, max_height, best_width),
if(best_width < 250, 250,
if(best_width > 500, 500, best_width))
][4])#enddef
#undef __GUI_IMAGE_WIDTH
###
### The verbose version
###
#define __GUI_MAX_WIDTH
(screen_width - {_GUI_WIDTH_OFFSET})
#enddef
#define __GUI_MAX_HEIGHT
(screen_height - {_GUI_HEIGHT_OFFSET})
#enddef
#define BEST_WIDTH
({__GUI_MAX_WIDTH} / {__GUI_SIZE_FACTOR})
#enddef
#define __GUI_BEST_SIZE
(if({BEST_WIDTH} > {__GUI_MAX_HEIGHT}, {__GUI_MAX_HEIGHT}, {BEST_WIDTH}))
#enddef
#define ___GUI_IMAGE_WIDTH
if({__GUI_BEST_SIZE} < 250, 250,
if({__GUI_BEST_SIZE} > 500, 500, {__GUI_BEST_SIZE})
)
#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('__GUI_MAX_WIDTH ', {__GUI_MAX_WIDTH}),
debug_print('__GUI_MAX_HEIGHT ', {__GUI_MAX_HEIGHT}),
debug_print('BEST_WIDTH ', {BEST_WIDTH}),
debug_print('__GUI_BEST_SIZE ', {__GUI_BEST_SIZE})
],
{___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
[window_definition]
id = "wml_message_left"
description = "bar"
[resolution]
[background]
[draw]
[/draw]
[/background]
[foreground]
[draw]
[image]
x = 0
y = "(height - image_height)"
w = "(if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500)))"
h = "(if((image_original_width < 300) and (image_original_height < 300), image_original_height, ((image_original_height * {__GUI_IMAGE_WIDTH}) / 500)))"
name = "(portrait_image)"
vertical_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 - (if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500))))"
y = "(height - image_height)"
w = "(if((image_original_width < 300) and (image_original_height < 300), image_original_width, ((image_original_width * {__GUI_IMAGE_WIDTH}) / 500)))"
h = "(if((image_original_width < 300) and (image_original_height < 300), image_original_height, ((image_original_height * {__GUI_IMAGE_WIDTH}) / 500)))"
name = "(portrait_image)"
vertical_mirror = "(portrait_mirror)"
[/image]
[/draw]
[/foreground]
[/resolution]
[/window_definition]
[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 = 0
y = 30
width = "(screen_width - 142)"
height = "(screen_height - 30)"
easy_close = "true"
[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]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[scroll_label] # NOTE maybe change the code to use message instead of label as id
id = "label"
definition = "default"
[/scroll_label]
[/column]
[/row]
[row]
[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 = "default"
label = "close"
[/button]
[/column]
[/row]
[/grid]
[/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 = 0
y = 30
width = "(screen_width - 142)"
height = "(screen_height - 30)"
easy_close = "true"
[grid]
[row]
[column]
vertical_alignment = "bottom"
horizontal_grow = "true"
[panel]
definition = "wml_message"
[grid]
[row]
[column]
horizontal_grow = "true"
[grid]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[label]
id = "title"
definition = "title"
[/label]
[/column]
[/row]
[row]
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
[scroll_label] # NOTE maybe change the code to use message instead of label as id
id = "label"
definition = "default"
[/scroll_label]
[/column]
[/row]
[row]
[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 = "default"
label = "close"
[/button]
[/column]
[/row]
[/grid]
[/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_IMAGE_SCALE_FACTOR
#undef _GUI_IMAGE_WIDTH
#undef __GUI_IMAGE_WIDTH
#undef ___GUI_IMAGE_WIDTH
#undef __GUI_BEST_SIZE
#undef __GUI_MAX_HEIGHT
#undef __GUI_MAX_WIDTH
#undef __GUI_SIZE_FACTOR
#undef _GUI_HEIGHT_OFFSET
#undef _GUI_WIDTH_OFFSET