From 7fe8cc5f84b3e2a85aab07907b5cc19714b39ef8 Mon Sep 17 00:00:00 2001 From: Charles Dang Date: Sat, 8 Jun 2013 22:51:40 +1100 Subject: [PATCH] Use grayscale IPF for disabled widget variations instead of specific images --- data/gui/default/widget/button_25x25.cfg | 2 +- data/gui/default/widget/button_default.cfg | 2 +- .../widget/horizontal_scrollbar_default.cfg | 2 +- .../default/widget/repeating_button_default.cfg | 2 +- data/gui/default/widget/toggle_button_default.cfg | 4 ++-- .../default/widget/vertical_scrollbar_default.cfg | 2 +- src/widgets/button.cpp | 14 +++++++------- src/widgets/slider.cpp | 2 +- 8 files changed, 15 insertions(+), 15 deletions(-) diff --git a/data/gui/default/widget/button_25x25.cfg b/data/gui/default/widget/button_25x25.cfg index 579bbf9481a..b7bc2f7dbff 100644 --- a/data/gui/default/widget/button_25x25.cfg +++ b/data/gui/default/widget/button_25x25.cfg @@ -45,7 +45,7 @@ [image] w = {SIZE} h = {SIZE} - name = {IMAGE} + "-disabled.png{IPF}" + name = {IMAGE} + ".png~GS(){IPF}" [/image] [image] diff --git a/data/gui/default/widget/button_default.cfg b/data/gui/default/widget/button_default.cfg index f35d2106a5f..f976dc33dba 100644 --- a/data/gui/default/widget/button_default.cfg +++ b/data/gui/default/widget/button_default.cfg @@ -44,7 +44,7 @@ [image] w = "(width)" h = "(height)" - name = "buttons/{BASE_NAME}-disabled.png{IPF}" + name = "buttons/{BASE_NAME}.png~GS(){IPF}" [/image] {GUI__CENTERED_TEXT ({FONT_SIZE}) () ({GUI__FONT_COLOR_DISABLED__TITLE})} diff --git a/data/gui/default/widget/horizontal_scrollbar_default.cfg b/data/gui/default/widget/horizontal_scrollbar_default.cfg index 42c8dab5621..f915e060d38 100644 --- a/data/gui/default/widget/horizontal_scrollbar_default.cfg +++ b/data/gui/default/widget/horizontal_scrollbar_default.cfg @@ -89,7 +89,7 @@ if(positioner_length - {POSITIONER_LEFT} - {POSITIONER_RIGHT} < 0 [/state_enabled] [state_disabled] - {_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) "-disabled.png" ({IMAGE_MIDDLE}) } + {_GUI_STATE ({GROOVE_LEFT}) ({GROOVE_RIGHT}) ({POSITIONER_LEFT}) ({POSITIONER_RIGHT}) ".png~GS()" ({IMAGE_MIDDLE}) } [/state_disabled] [state_pressed] diff --git a/data/gui/default/widget/repeating_button_default.cfg b/data/gui/default/widget/repeating_button_default.cfg index ec8b837a99e..6a0b5bee7d2 100644 --- a/data/gui/default/widget/repeating_button_default.cfg +++ b/data/gui/default/widget/repeating_button_default.cfg @@ -45,7 +45,7 @@ [image] w = {SIZE} h = {SIZE} - name = {IMAGE} + "-disabled.png{IPF}" + name = {IMAGE} + ".png~GS(){IPF}" [/image] [image] diff --git a/data/gui/default/widget/toggle_button_default.cfg b/data/gui/default/widget/toggle_button_default.cfg index 2911675df08..f2080a6fa76 100644 --- a/data/gui/default/widget/toggle_button_default.cfg +++ b/data/gui/default/widget/toggle_button_default.cfg @@ -52,7 +52,7 @@ [draw] [image] - name = "buttons/checkbox-disabled.png" + name = "buttons/checkbox.png~GS()" [/image] {_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) } @@ -98,7 +98,7 @@ [draw] [image] - name = "buttons/checkbox-disabled-pressed.png" + name = "buttons/checkbox-pressed.png~GS()" [/image] {_GUI_TEXT ({EXTRA_WIDTH}) ({FONT_SIZE}) ({GUI__FONT_COLOR_DISABLED__TITLE}) } diff --git a/data/gui/default/widget/vertical_scrollbar_default.cfg b/data/gui/default/widget/vertical_scrollbar_default.cfg index bf0b618c334..fd7482503db 100644 --- a/data/gui/default/widget/vertical_scrollbar_default.cfg +++ b/data/gui/default/widget/vertical_scrollbar_default.cfg @@ -88,7 +88,7 @@ if(positioner_length - {POSITIONER_TOP} - {POSITIONER_BOTTOM} < 0 [/state_enabled] [state_disabled] - {_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) "-disabled.png" ({IMAGE_MIDDLE}) } + {_GUI_STATE ({GROOVE_TOP}) ({GROOVE_BOTTOM}) ({POSITIONER_TOP}) ({POSITIONER_BOTTOM}) ".png~GS()" ({IMAGE_MIDDLE}) } [/state_disabled] [state_pressed] diff --git a/src/widgets/button.cpp b/src/widgets/button.cpp index 665aaad5f66..6d9e1c2b3e9 100644 --- a/src/widgets/button.cpp +++ b/src/widgets/button.cpp @@ -97,8 +97,8 @@ void button::load_images() { surface pressed_image(image::get_image(button_image_name_ + "-pressed.png")); surface active_image(image::get_image(button_image_name_ + "-active.png")); surface disabled_image; - if (file_exists(game_config::path + "/images/" + button_image_name_ + "-disabled.png")) - disabled_image.assign((image::get_image(button_image_name_ + "-disabled.png"))); + if (file_exists(game_config::path + "/images/" + button_image_name_ + ".png~GS()")) + disabled_image.assign((image::get_image(button_image_name_ + ".png~GS()"))); surface pressed_disabled_image, pressed_active_image, touched_image; static const Uint32 disabled_btn_color = 0xAAAAAA; @@ -109,10 +109,10 @@ void button::load_images() { overlayPressedImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed.png")); if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-active.png")) overlayActiveImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-active.png")); - if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-pressed-disabled.png")) - overlayPressedDisabledImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed-disabled.png")); - if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + "_30-disabled.png")) - overlayDisabledImage_.assign(image::get_image(button_overlay_image_name_ + "_30-disabled.png")); + if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + size_postfix + "-pressed.png~GS()")) + overlayPressedDisabledImage_.assign(image::get_image(button_overlay_image_name_ + size_postfix + "-pressed.png~GS()")); + if (file_exists(game_config::path + "/images/" + button_overlay_image_name_ + "_30.png~GS()")) + overlayDisabledImage_.assign(image::get_image(button_overlay_image_name_ + "_30.png~GS()")); if (overlayDisabledImage_.null()) overlayDisabledImage_ = blend_surface(greyscale_image(overlayImage_), disabled_btn_adjust, disabled_btn_color); @@ -143,7 +143,7 @@ void button::load_images() { if (pressed_active_image.null()) pressed_active_image.assign(pressed_image); - pressed_disabled_image.assign(image::get_image(button_image_name_ + "-disabled-pressed.png")); + pressed_disabled_image.assign(image::get_image(button_image_name_ + "pressed.png~GS()")); if (pressed_disabled_image.null()) pressed_disabled_image = blend_surface(greyscale_image(pressed_image), disabled_btn_adjust, disabled_btn_color); diff --git a/src/widgets/slider.cpp b/src/widgets/slider.cpp index bbc6c5cbe4d..db8a3f4704e 100644 --- a/src/widgets/slider.cpp +++ b/src/widgets/slider.cpp @@ -26,7 +26,7 @@ namespace { const std::string slider_image = ".png"; - const std::string disabled_image = "-disabled.png"; + const std::string disabled_image = ".png~GS()"; const std::string pressed_image = "-pressed.png"; const std::string active_image = "-active.png"; }