Make the new message dialog less hardcoded and tricked in WML.

The dialog now gets a fixed size in C++ but it removes some sizing
spacers.
This commit is contained in:
Mark de Wever 2008-07-11 19:25:29 +00:00
parent 3bb79a0cd9
commit f5c7ed0cca
3 changed files with 35 additions and 44 deletions

View file

@ -23,7 +23,7 @@
[image]
x = 0
y = "(250 - image_height)"
y = "(height - image_height)"
# NOTE this image can be removed once we move to the final code.
name = "shyde200.png"
[/image]
@ -130,71 +130,51 @@
#unddef BASE_NAME
[window]
id = "message_test_left"
description = "Test dialog to test Jetryl's new message style and Kitty's portraits."
#define RESOLUTION WIDTH HEIGHT IMAGE_WIDTH
[resolution]
window_width = {WIDTH}
window_height = {HEIGHT}
definition = "message_test_left"
automatic_placement = "true"
vertical_placement = "bottom"
horizontal_placement = "left"
automatic_placement = "false"
# NOTE the values will be overwritten in the game later on, maybe we should allow
# variables here as well...
x = 0
y = 0
width = 750
height = 400
[grid]
[row]
[column]
# This spacer makes sure the dialog has a minimum height.
[spacer]
width = 0
height = 250
[/spacer]
[/column]
[column]
vertical_alignment = "bottom"
horizontal_grow = "true"
[panel]
definition = "message_test"
[grid]
[row]
[column]
# This spacer makes sure the panel has a minimum width.
[spacer]
width = 658
height = 0
[/spacer]
[/column]
[/row]
[row]
[column]
horizontal_grow = "true"
[grid]
[row]
[column]
border = "all"
border_size = 5
horizontal_alignment = "left"
[spacer]
# reserve place for the image and set a minimum height for the text
id = "image_place_holder"
width = 250
width = {IMAGE_WIDTH}
height = 75
[/spacer]
@ -202,6 +182,8 @@
[column]
grow_factor = 1
horizontal_grow = "true"
border = "all"
border_size = 5
horizontal_alignment = "left"
@ -232,16 +214,18 @@
[/grid]
[/resolution]
#enddef
[window]
id = "message_test_left"
description = "Test dialog to test Jetryl's new message style and Kitty's portraits."
{RESOLUTION 1000 700 250}
{RESOLUTION 0 0 500}
[/window]
#unddef RESOLUTION
[window]
id = "message_test_right"

View file

@ -140,7 +140,7 @@ Xu , Xu , Qxu , Qxu , Ql , Ql
[/filter]
[message_test_left]
message="Test foo bar bla bla bla bla bla bla bla bla bla bla bla"
message="Test message"
[/message_test_left]
[/event]

View file

@ -1905,6 +1905,13 @@ namespace {
const std::string message = cfg["message"];
gui2::init();
gui2::twindow window = gui2::build((screen)->video(), "message_test_left");
/**
* @todo FIXME these fixed sizes should depend on the map size and maybe
* let wml determine the height.
*/
window.set_size(::create_rect(0,
gui2::settings::screen_height - 400,
gui2::settings::screen_width - 140, 400));
gui2::tcontrol* label = dynamic_cast<gui2::tcontrol*>(window.find_widget("message", false));
assert(label);