From 33f6bb6f69f5612ea608cbe3bd98ae49e0a3bdbf Mon Sep 17 00:00:00 2001 From: Mark de Wever Date: Mon, 26 Apr 2010 20:32:46 +0000 Subject: [PATCH] Deprecate the stretch parameter for images. Late in the 1.8 cycle a resize mode was added, now is the time to start to remove the old method. --- changelog | 1 + .../widget/horizontal_scrollbar_default.cfg | 4 ++-- data/gui/default/widget/panel_title_screen.cfg | 8 ++++---- data/gui/default/widget/panel_wml_message.cfg | 4 ++-- .../default/widget/vertical_scrollbar_default.cfg | 4 ++-- data/gui/default/widget/window_default.cfg | 8 ++++---- src/gui/auxiliary/canvas.cpp | 14 ++------------ 7 files changed, 17 insertions(+), 26 deletions(-) diff --git a/changelog b/changelog index 793e0b1fe86..32819659390 100644 --- a/changelog +++ b/changelog @@ -50,6 +50,7 @@ Version 1.9.0-svn: * Added the total number of villages to the status table lists * Added a new attack dialog, available for testing with --new-widgets * Patch #1645: Fixed a bug sending keyboard events to deactivated controls + * Deprecated the resize flag for gui2 image, use the resize_mode instead * WML Engine: * Deprecated [set_variable]'s random key, use rand instead * Renamed [unit][status] healable to unhealable so it can default to 'no' diff --git a/data/gui/default/widget/horizontal_scrollbar_default.cfg b/data/gui/default/widget/horizontal_scrollbar_default.cfg index 633b86516b5..eb1e84da2ab 100644 --- a/data/gui/default/widget/horizontal_scrollbar_default.cfg +++ b/data/gui/default/widget/horizontal_scrollbar_default.cfg @@ -23,7 +23,7 @@ w = "(if(width - {GROOVE_LEFT} - {GROOVE_RIGHT} < 0 , 0, width - {GROOVE_LEFT} - {GROOVE_RIGHT}))" h = 0 - stretch = true + resize_mode = "stretch" name = "buttons/scrollgroove{IMAGE_MIDDLE}-horizontal.png" [/image] @@ -51,7 +51,7 @@ w = "( if(positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT} < 0 , 0, positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT}))" - stretch = true + resize_mode = "stretch" name = "buttons/scrollhorizontal{IMAGE_MIDDLE}{IMAGE_SUFFIX}" [/image] diff --git a/data/gui/default/widget/panel_title_screen.cfg b/data/gui/default/widget/panel_title_screen.cfg index 49bdd844b7a..fd451eeb743 100644 --- a/data/gui/default/widget/panel_title_screen.cfg +++ b/data/gui/default/widget/panel_title_screen.cfg @@ -36,7 +36,7 @@ x = {OFFSET_SIDE_1} y = 0 w = "(if(width < {OFFSET_TOTAL}, 0, width - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/translucent54-border-top.png" [/image] @@ -50,7 +50,7 @@ x = "(width - {OFFSET_SIDE_2})" y = {OFFSET_SIDE_1} h = "(if(height < {OFFSET_TOTAL}, 0, height - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/translucent54-border-right.png" [/image] @@ -64,7 +64,7 @@ x = {OFFSET_SIDE_1} y = "(height - {OFFSET_SIDE_2})" w = "(if(width < {OFFSET_TOTAL}, 0, width - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/translucent54-border-bottom.png" [/image] @@ -78,7 +78,7 @@ x = 0 y = {OFFSET_SIDE_1} h = "(if(height < {OFFSET_TOTAL}, 0, height - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/translucent54-border-left.png" [/image] diff --git a/data/gui/default/widget/panel_wml_message.cfg b/data/gui/default/widget/panel_wml_message.cfg index 64cd70222e1..890f2fd041a 100644 --- a/data/gui/default/widget/panel_wml_message.cfg +++ b/data/gui/default/widget/panel_wml_message.cfg @@ -24,7 +24,7 @@ x = 0 y = 0 w = "(width)" - stretch = "true" + resize_mode = "stretch" name = "dialogs/" + {_GUI_BASE_NAME} + "-border-top.png" [/image] @@ -32,7 +32,7 @@ x = 0 y = "(height - {OFFSET_SIDE_2})" w = "(width)" - stretch = "true" + resize_mode = "stretch" name = "dialogs/" + {_GUI_BASE_NAME} + "-border-bottom.png" [/image] diff --git a/data/gui/default/widget/vertical_scrollbar_default.cfg b/data/gui/default/widget/vertical_scrollbar_default.cfg index 205484c82eb..3f3e6ffbd51 100644 --- a/data/gui/default/widget/vertical_scrollbar_default.cfg +++ b/data/gui/default/widget/vertical_scrollbar_default.cfg @@ -22,7 +22,7 @@ y = {GROOVE_TOP} h = "(if(height - {GROOVE_TOP} - {GROOVE_BOTTOM} < 0 , 0, height - {GROOVE_TOP} - {GROOVE_BOTTOM}))" - stretch = true + resize_mode = "stretch" name = "buttons/scrollgroove{IMAGE_MIDDLE}-mid.png" [/image] @@ -50,7 +50,7 @@ h = "( if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0 , 0, positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM}))" - stretch = true + resize_mode = "stretch" name = "buttons/scrollmid{IMAGE_MIDDLE}{IMAGE_SUFFIX}" [/image] diff --git a/data/gui/default/widget/window_default.cfg b/data/gui/default/widget/window_default.cfg index a0cb9ac40c8..4f314ea7afa 100644 --- a/data/gui/default/widget/window_default.cfg +++ b/data/gui/default/widget/window_default.cfg @@ -30,7 +30,7 @@ x = {OFFSET_SIDE_1} y = 0 w = "(if(width < {OFFSET_TOTAL}, 0, width - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/{BASE_NAME}-border-top.png" [/image] @@ -44,7 +44,7 @@ x = "(width - {OFFSET_SIDE_2})" y = {OFFSET_SIDE_1} h = "(if(height < {OFFSET_TOTAL}, 0, height - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/{BASE_NAME}-border-right.png" [/image] @@ -58,7 +58,7 @@ x = {OFFSET_SIDE_1} y = "(height - {OFFSET_SIDE_2})" w = "(if(width < {OFFSET_TOTAL}, 0, width - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/{BASE_NAME}-border-bottom.png" [/image] @@ -72,7 +72,7 @@ x = 0 y = {OFFSET_SIDE_1} h = "(if(height < {OFFSET_TOTAL}, 0, height - {OFFSET_TOTAL}))" - stretch = "true" + resize_mode = "stretch" name = "dialogs/{BASE_NAME}-border-left.png" [/image] diff --git a/src/gui/auxiliary/canvas.cpp b/src/gui/auxiliary/canvas.cpp index 0bac466861a..2043bdd832c 100644 --- a/src/gui/auxiliary/canvas.cpp +++ b/src/gui/auxiliary/canvas.cpp @@ -650,13 +650,6 @@ timage::timage(const config& cfg) * h (f_unsigned = 0) The height of the image, if not zero the * image will be scaled to the desired * height. - * stretch (bool = false) Border images often need to be either - * stretched in the width or the height. If - * that's the case use stretch. It only - * works if only the height or the width is - * not zero. It will copy the first pixel - * to the others. (Note this mode is - * deprecated, use resize_mode instead.) * resize_mode (resize_mode = scale) * Determines how an image is scaled to fit * the wanted size. @@ -692,13 +685,10 @@ timage::timage(const config& cfg) * */ -#if 0 - /** @todo Enable in 1.9. */ if(!cfg["stretch"].empty()) { - ERR_GUI_D << "Image: The field 'strech' is " - "deprecated use 'resize_mode instead.\n"; + ERR_GUI_D << "Image: The field 'stretch' is deprecated and " + "will be removed in 1.9.2. Use 'resize_mode' instead.\n"; } -#endif /** @todo Remove in 1.9. */ if(stretch_ && resize_mode_ != stretch) {