Author: mordante Date: Fri Jul 11 21:25:29 2008 New Revision: 27914 URL: http://svn.gna.org/viewcvs/wesnoth?rev=27914&view=rev Log: 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.
Modified:
trunk/data/gui/default/window/message.cfg
trunk/data/scenario-test.cfg
trunk/src/game_events.cpp
Modified: trunk/data/gui/default/window/message.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/gui/default/window/message.cfg?rev=27914&r1=27913&r2=27914&view=diff
==============================================================================
--- trunk/data/gui/default/window/message.cfg (original)
+++ trunk/data/gui/default/window/message.cfg Fri Jul 11 21:25:29 2008
@@ -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,12 +130,109 @@
#unddef BASE_NAME
+#define RESOLUTION WIDTH HEIGHT IMAGE_WIDTH
+ [resolution]
+ window_width = {WIDTH}
+ window_height = {HEIGHT}
+
+ definition = "message_test_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]
+ vertical_alignment = "bottom"
+ horizontal_grow = "true"
+
+ [panel]
+ definition = "message_test"
+
+ [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 = {IMAGE_WIDTH}
+
height = 75
+
[/spacer]
+
+
[/column]
+
+
[column]
+
grow_factor = 1
+
horizontal_grow = "true"
+
+
border = "all"
+
border_size = 5
+
horizontal_alignment = "left"
+
+
[label]
+
id = "message"
+
definition = "default"
+
[/label]
+
+
[/column]
+
+
[/row]
+
+ [/grid]
+
+ [/column]
+
+ [/row]
+
+ [/grid]
+
+ [/panel]
+
+ [/column]
+
+ [/row]
+
+ [/grid]
+
+ [/resolution]
+#enddef
+
[window]
id = "message_test_left"
description = "Test dialog to test Jetryl's new message style and
Kitty's portraits."
- [resolution]
- definition = "message_test_left"
+ {RESOLUTION 1000 700 250}
+ {RESOLUTION 0 0 500}
+
+[/window]
+
+#unddef RESOLUTION
+
+[window]
+ id = "message_test_right"
+ description = "Test dialog to test Jetryl's new message style and
Kitty's portraits."
+
+ [resolution]
+ definition = "message_test_right"
automatic_placement = "true"
vertical_placement = "bottom"
@@ -186,21 +283,6 @@
[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
-
height = 75
-
[/spacer]
-
-
[/column]
-
-
[column]
grow_factor = 1
border = "all"
border_size = 5
@@ -213,104 +295,6 @@
[/column]
-
[/row]
-
- [/grid]
-
- [/column]
-
- [/row]
-
- [/grid]
-
- [/panel]
-
- [/column]
-
- [/row]
-
- [/grid]
-
- [/resolution]
-
-[/window]
-
-
-
-
-
-
-
-
-
-[window]
- id = "message_test_right"
- description = "Test dialog to test Jetryl's new message style and
Kitty's portraits."
-
- [resolution]
- definition = "message_test_right"
-
- automatic_placement = "true"
- vertical_placement = "bottom"
- horizontal_placement = "left"
-
- [grid]
-
- [row]
-
- [column]
-
- # This spacer makes sure the dialog has
a minimum height.
- [spacer]
- width = 0
- height = 250
- [/spacer]
-
- [/column]
-
-
- [column]
- vertical_alignment = "bottom"
-
- [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]
-
- [grid]
-
-
[row]
-
-
[column]
-
grow_factor = 1
-
border = "all"
-
border_size = 5
-
horizontal_alignment = "left"
-
-
[label]
-
id = "message"
-
definition = "default"
-
[/label]
-
-
[/column]
-
[column]
border = "all"
border_size = 5
Modified: trunk/data/scenario-test.cfg
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/data/scenario-test.cfg?rev=27914&r1=27913&r2=27914&view=diff
==============================================================================
--- trunk/data/scenario-test.cfg (original)
+++ trunk/data/scenario-test.cfg Fri Jul 11 21:25:29 2008
@@ -140,7 +140,7 @@
[/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]
Modified: trunk/src/game_events.cpp
URL:
http://svn.gna.org/viewcvs/wesnoth/trunk/src/game_events.cpp?rev=27914&r1=27913&r2=27914&view=diff
==============================================================================
--- trunk/src/game_events.cpp (original)
+++ trunk/src/game_events.cpp Fri Jul 11 21:25:29 2008
@@ -1905,6 +1905,13 @@
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);
_______________________________________________
Wesnoth-commits mailing list
[email protected]
https://mail.gna.org/listinfo/wesnoth-commits
