From 58b2c1bcd077c31056074ebcd46b7f017b3ccef9 Mon Sep 17 00:00:00 2001 From: David Capello Date: Mon, 24 Jan 2011 00:03:38 -0300 Subject: [PATCH] Improve palette editor's RGB/HSV sliders. + Added SkinSliderProperty and ISliderBgPainter to draw a customized background in sliders. + Moved SkinTheme to src/skin/ directory. --- TODO.txt | 5 +- data/skins/default_skin/sheet.png | Bin 6760 -> 6834 bytes data/skins/default_skin/skin.xml | 2 + src/CMakeLists.txt | 4 +- src/commands/cmd_palette_editor.cpp | 104 ++++++++++++++++ src/commands/cmd_refresh.cpp | 2 +- src/dialogs/aniedit.cpp | 2 +- src/gui/jinete.h | 1 + src/modules/gfx.cpp | 2 +- src/modules/gui.cpp | 3 +- src/skin/skin_property.cpp | 87 ++++++++++++++ src/skin/skin_property.h | 54 +++++++++ src/skin/skin_slider_property.cpp | 37 ++++++ src/skin/skin_slider_property.h | 50 ++++++++ src/{ => skin}/skin_theme.cpp | 177 ++++++++++++---------------- src/{ => skin}/skin_theme.h | 34 +----- src/widgets/color_bar.cpp | 2 +- src/widgets/editor/editor.cpp | 2 +- src/widgets/statebar.cpp | 2 +- src/widgets/tabs.cpp | 2 +- src/widgets/toolbar.cpp | 2 +- 21 files changed, 431 insertions(+), 143 deletions(-) create mode 100644 src/skin/skin_property.cpp create mode 100644 src/skin/skin_property.h create mode 100644 src/skin/skin_slider_property.cpp create mode 100644 src/skin/skin_slider_property.h rename src/{ => skin}/skin_theme.cpp (94%) rename src/{ => skin}/skin_theme.h (95%) diff --git a/TODO.txt b/TODO.txt index cafd28906..931310cde 100644 --- a/TODO.txt +++ b/TODO.txt @@ -1,8 +1,9 @@ For next release ---------------- -+ Mini-look for sliders in palette editor (add ISliderBackground to draw RGB/HSV sliders - with a customized background). ++ Add Widget::setDoubleBuffered(bool) to double-buffer some widgets + when ji_screen==real screen (palette editor sliders must contain + this attribute on). + Fix palette editor to avoid generating a lot of consecutive Undo actions. + Move "effect/images_ref" to "raster" and refactor it to a class. + Convert jaccel::key_list to std::vector<> diff --git a/data/skins/default_skin/sheet.png b/data/skins/default_skin/sheet.png index 438b3eb4ae2b517b068148d19c9880eb4b2cbc60..ea0a176383d07d9ee1e1efa9cecac3b4b81034ef 100644 GIT binary patch literal 6834 zcmaiZcQjnz_x7D(7&FS~Eqe445s4BpWAqxGC_$n}2_lF#WYk1&(Yp{`2#GR?s0ky5 zAbJhayHS4g`L6f>_n&*uTIbxe_StvuXYc1ZG5UJyR4_Ie002~)8Y+eW03r@S0F;dQ zvhpr>1OT=GO%)|$|D4U-kyqE$)BA9CXEeWuy01CXaHiWaCqN>-ie2%KECmlczh}9) z=)uJ+HeW)%mpZWYH#(by@0yD>7WlG!w2ZtL=a3NOwNcl93!f;w1bNv8AFBHezgri1 z!S{$JH;E%N4avKw?qI)iOrmMx;9&2lx*WL6yU@-I#$fNE+jozs?Vs*j%!kd)fWouK zRYs4evMqgU@^|J&l|cX+`eUDAT6=m=x3(2DS3fV;VD;K2JN2r_@qrZhAs7(mR}8(h zUKUthc+dH#EmD$_r_}0qx1>s@w=>66C-{_G$?PKvv-=oDMa}R6Gr0Tg`chK8V$w}Oy9lKRU=>a zkI=oXFrxjHz)SyUUxAgT-_&l(M01Ph$>wQCEm>H~&DdCvenXcp;OHXfd8OK0b+?%g z(rw<8=6JMQbT7%Ia~QP-AxO~_9a8&?W|{YD7XCQoYsZX;n^fK?H9qD(2z)jGc2)&l zU$F~w!FnJck72x7)MHF~XI%Zx+9GIDu6j6(?Inh7;z@K<)9t@S zkl*Xlwnpn8QaiREE9SFPc;zA9?Y?@qXTb1_bpw$p8!>hj#11LT_zSgO+ndQwboX)( zf&w{N3v%h1F~C@pzSf8fZEb^ejsf7=wyRa`O=!K_5;FDYBOf%p<*W6^p1Qg^e3?o( z*ftBcBXe~|UfJL~#8QXfOA9hv4RXgX<>+qrWv1KkAP7aFghR75a@^UOB?4{#7{oRz z&9<{RqDV{J^1Ctj<9Wu+;J85<>?o#0CZ`_AdU|nWU5{&hT%xguZF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C8N!)o9ruK%st`vy|@r3w)d|2jF=rBFv4+iK+BH$Y&;JU8qwK}wO-2VZY7=Doe diff --git a/data/skins/default_skin/skin.xml b/data/skins/default_skin/skin.xml index bce14d0b3..61a8b67f1 100644 --- a/data/skins/default_skin/skin.xml +++ b/data/skins/default_skin/skin.xml @@ -87,6 +87,8 @@ + + diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index cc463cf4d..e30f28018 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -79,7 +79,6 @@ add_library(aseprite-library log.cpp recent_files.cpp resource_finder.cpp - skin_theme.cpp ui_context.cpp undoable.cpp xml_exception.cpp @@ -214,6 +213,9 @@ add_library(aseprite-library raster/stock.cpp raster/undo.cpp settings/ui_settings_impl.cpp + skin/skin_theme.cpp + skin/skin_property.cpp + skin/skin_slider_property.cpp tools/tool.cpp tools/toolbox.cpp util/autocrop.cpp diff --git a/src/commands/cmd_palette_editor.cpp b/src/commands/cmd_palette_editor.cpp index 32dea1299..12ac7ad5b 100644 --- a/src/commands/cmd_palette_editor.cpp +++ b/src/commands/cmd_palette_editor.cpp @@ -25,6 +25,7 @@ #include "app.h" #include "app/color.h" +#include "app/color_utils.h" #include "base/bind.h" #include "commands/command.h" #include "commands/params.h" @@ -44,6 +45,7 @@ #include "raster/sprite.h" #include "raster/stock.h" #include "raster/undo.h" +#include "skin/skin_slider_property.h" #include "sprite_wrappers.h" #include "ui_context.h" #include "widgets/color_bar.h" @@ -69,6 +71,68 @@ static void on_exit_delete_this_widget() jwidget_free(window); } +namespace { + + // This class is used as property for RGB/HSV sliders to draw the + // background of them. + class ColorSliderBgPainter : public ISliderBgPainter + { + public: + enum Channel { + Red, Green, Blue, + Hue, Saturation, Value + }; + + ColorSliderBgPainter(Channel channel) + : m_channel(channel) + { } + + void setColor(const Color& color) { + m_color = color; + } + + void paint(Slider* slider, BITMAP* bmp, const gfx::Rect& rc) { + int depth = bitmap_color_depth(bmp); + BITMAP* bg = create_bitmap_ex(depth, rc.w, rc.h); + + int color; + for (int x=0; x < rc.w; ++x) { + switch (m_channel) { + case Red: + color = makecol(255 * x / (rc.w-1), m_color.getGreen(), m_color.getBlue()); + break; + case Green: + color = makecol(m_color.getRed(), 255 * x / (rc.w-1), m_color.getBlue()); + break; + case Blue: + color = makecol(m_color.getRed(), m_color.getGreen(), 255 * x / (rc.w-1)); + break; + case Hue: + color = color_utils::color_for_allegro(Color::fromHsv(360 * x / (rc.w-1), m_color.getSaturation(), m_color.getValue()), depth); + break; + case Saturation: + color = color_utils::color_for_allegro(Color::fromHsv(m_color.getHue(), 100 * x / (rc.w-1), m_color.getValue()), depth); + break; + case Value: + color = color_utils::color_for_allegro(Color::fromHsv(m_color.getHue(), m_color.getSaturation(), 100 * x / (rc.w-1)), depth); + break; + } + + vline(bg, x, 0, rc.h-1, color); + } + + blit(bg, bmp, 0, 0, rc.x, rc.y, rc.w, rc.h); + destroy_bitmap(bg); + } + + private: + Channel m_channel; + BITMAP* m_cachedBg; + Color m_color; + }; + +} + ////////////////////////////////////////////////////////////////////// // palette_editor @@ -118,6 +182,8 @@ static bool hex_entry_change_hook(JWidget widget, void *data); static void update_entries_from_sliders(); static void update_sliders_from_entries(); static void update_hex_entry(); +static void update_slider_bgcolor(Slider* slider, const Color& color); +static void update_slider_bgcolors(); static void update_current_sprite_palette(const char* operationName); static void update_colorbar(); static bool palette_editor_change_hook(JWidget widget, void *data); @@ -241,6 +307,14 @@ void PaletteEditorCommand::onExecute(Context* context) // Set palette editor columns palette_editor->setColumns(16); + + // Setup slider bg painters + R_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Red)))); + G_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Green)))); + B_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Blue)))); + H_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Hue)))); + S_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Saturation)))); + V_slider->setProperty(PropertyPtr(new SkinSliderProperty(new ColorSliderBgPainter(ColorSliderBgPainter::Value)))); // Hook signals jwidget_add_hook(window, -1, window_msg_proc, NULL); @@ -747,6 +821,7 @@ static void sliderRGB_change_hook(Slider* widget) update_entries_from_sliders(); update_hex_entry(); + update_slider_bgcolors(); update_current_sprite_palette("Color Change"); update_colorbar(); } @@ -771,6 +846,7 @@ static void sliderHSV_change_hook(Slider* widget) update_entries_from_sliders(); update_hex_entry(); + update_slider_bgcolors(); update_current_sprite_palette("Color Change"); update_colorbar(); } @@ -798,6 +874,7 @@ static bool entryRGB_change_hook(JWidget widget, void *data) update_sliders_from_entries(); update_hex_entry(); + update_slider_bgcolors(); update_current_sprite_palette("Color Change"); update_colorbar(); return false; @@ -826,6 +903,7 @@ static bool entryHSV_change_hook(JWidget widget, void *data) update_sliders_from_entries(); update_hex_entry(); + update_slider_bgcolors(); update_current_sprite_palette("Color Change"); update_colorbar(); return false; @@ -864,6 +942,7 @@ static bool hex_entry_change_hook(JWidget widget, void *data) S_slider->setValue(hsv.valueInt()); update_entries_from_sliders(); + update_slider_bgcolors(); update_current_sprite_palette("Color Change"); update_colorbar(); return false; @@ -899,6 +978,29 @@ static void update_hex_entry() B_slider->getValue()); } +static void update_slider_bgcolor(Slider* slider, const Color& color) +{ + SharedPtr sliderProperty(slider->getProperty("SkinProperty")); + + static_cast(sliderProperty->getBgPainter())->setColor(color); + + slider->invalidate(); +} + +static void update_slider_bgcolors() +{ + Color color(Color::fromRgb(R_slider->getValue(), + G_slider->getValue(), + B_slider->getValue())); + + update_slider_bgcolor(R_slider, color); + update_slider_bgcolor(G_slider, color); + update_slider_bgcolor(B_slider, color); + update_slider_bgcolor(H_slider, color); + update_slider_bgcolor(S_slider, color); + update_slider_bgcolor(V_slider, color); +} + static void update_current_sprite_palette(const char* operationName) { if (UIContext::instance()->getCurrentSprite()) { @@ -970,6 +1072,7 @@ static bool palette_editor_change_hook(JWidget widget, void *data) update_sliders_from_color(color); // Update sliders update_entries_from_sliders(); // Update entries update_hex_entry(); // Update hex field + update_slider_bgcolors(); return false; } @@ -1145,6 +1248,7 @@ static void on_color_changed(const Color& color) update_sliders_from_color(color); // Update sliders update_entries_from_sliders(); // Update entries update_hex_entry(); // Update hex field + update_slider_bgcolors(); jwidget_flush_redraw(window); } diff --git a/src/commands/cmd_refresh.cpp b/src/commands/cmd_refresh.cpp index 2d44e00c3..da7441746 100644 --- a/src/commands/cmd_refresh.cpp +++ b/src/commands/cmd_refresh.cpp @@ -30,7 +30,7 @@ #include "app.h" #include "commands/command.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "widgets/statebar.h" diff --git a/src/dialogs/aniedit.cpp b/src/dialogs/aniedit.cpp index 79bd37ddd..a11e45eda 100644 --- a/src/dialogs/aniedit.cpp +++ b/src/dialogs/aniedit.cpp @@ -32,7 +32,7 @@ #include "modules/gui.h" #include "modules/rootmenu.h" #include "raster/raster.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "ui_context.h" #include "undoable.h" diff --git a/src/gui/jinete.h b/src/gui/jinete.h index 51f81cff0..4f5bb2524 100644 --- a/src/gui/jinete.h +++ b/src/gui/jinete.h @@ -40,6 +40,7 @@ #include "gui/jview.h" #include "gui/label.h" #include "gui/popup_frame.h" +#include "gui/property.h" #include "gui/slider.h" #include "gui/theme.h" #include "gui/widget.h" diff --git a/src/modules/gfx.cpp b/src/modules/gfx.cpp index 93e67943b..51d620e13 100644 --- a/src/modules/gfx.cpp +++ b/src/modules/gfx.cpp @@ -38,7 +38,7 @@ #include "raster/blend.h" #include "raster/image.h" #include "raster/palette.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "widgets/editor.h" static BITMAP* gfx_bmps[GFX_BITMAP_COUNT]; diff --git a/src/modules/gui.cpp b/src/modules/gui.cpp index 50de3d06b..6c72d5920 100644 --- a/src/modules/gui.cpp +++ b/src/modules/gui.cpp @@ -46,7 +46,8 @@ #include "modules/rootmenu.h" #include "raster/sprite.h" #include "resource_finder.h" -#include "skin_theme.h" +#include "skin/skin_property.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "tools/toolbox.h" #include "ui_context.h" diff --git a/src/skin/skin_property.cpp b/src/skin/skin_property.cpp new file mode 100644 index 000000000..7787b75d6 --- /dev/null +++ b/src/skin/skin_property.cpp @@ -0,0 +1,87 @@ +/* ASE - Allegro Sprite Editor + * Copyright (C) 2001-2011 David Capello + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "skin/skin_property.h" + +const char* SkinProperty::SkinPropertyName = "SkinProperty"; + +SkinProperty::SkinProperty() + : Property(SkinPropertyName) +{ + m_isMiniLook = false; + m_upperLeft = 0; + m_upperRight = 0; + m_lowerLeft = 0; + m_lowerRight = 0; +} + +SkinProperty::~SkinProperty() +{ +} + +bool SkinProperty::isMiniLook() const +{ + return m_isMiniLook; +} + +void SkinProperty::setMiniLook(bool state) +{ + m_isMiniLook = state; +} + +int SkinProperty::getUpperLeft() const +{ + return m_upperLeft; +} + +int SkinProperty::getUpperRight() const +{ + return m_upperRight; +} + +int SkinProperty::getLowerLeft() const +{ + return m_lowerLeft; +} + +int SkinProperty::getLowerRight() const +{ + return m_lowerRight; +} + +void SkinProperty::setUpperLeft(int value) +{ + m_upperLeft = value; +} + +void SkinProperty::setUpperRight(int value) +{ + m_upperRight = value; +} + +void SkinProperty::setLowerLeft(int value) +{ + m_lowerLeft = value; +} + +void SkinProperty::setLowerRight(int value) +{ + m_lowerRight = value; +} diff --git a/src/skin/skin_property.h b/src/skin/skin_property.h new file mode 100644 index 000000000..5ee0028cb --- /dev/null +++ b/src/skin/skin_property.h @@ -0,0 +1,54 @@ +/* ASE - Allegro Sprite Editor + * Copyright (C) 2001-2011 David Capello + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef SKIN_PROPERTY_H_INCLUDED +#define SKIN_PROPERTY_H_INCLUDED + +#include "gui/property.h" + +// Property to show widgets with a special look (e.g.: buttons or sliders with mini-borders) +class SkinProperty : public Property +{ +public: + static const char* SkinPropertyName; + + SkinProperty(); + ~SkinProperty(); + + bool isMiniLook() const; + void setMiniLook(bool state); + + int getUpperLeft() const; + int getUpperRight() const; + int getLowerLeft() const; + int getLowerRight() const; + + void setUpperLeft(int value); + void setUpperRight(int value); + void setLowerLeft(int value); + void setLowerRight(int value); + +private: + bool m_isMiniLook; + int m_upperLeft; + int m_upperRight; + int m_lowerLeft; + int m_lowerRight; +}; + +#endif diff --git a/src/skin/skin_slider_property.cpp b/src/skin/skin_slider_property.cpp new file mode 100644 index 000000000..0167e49d3 --- /dev/null +++ b/src/skin/skin_slider_property.cpp @@ -0,0 +1,37 @@ +/* ASE - Allegro Sprite Editor + * Copyright (C) 2001-2011 David Capello + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include "config.h" + +#include "skin/skin_slider_property.h" + +SkinSliderProperty::SkinSliderProperty(ISliderBgPainter* painter) + : m_painter(painter) +{ +} + +SkinSliderProperty::~SkinSliderProperty() +{ + delete m_painter; +} + +ISliderBgPainter* SkinSliderProperty::getBgPainter() const +{ + return m_painter; +} + diff --git a/src/skin/skin_slider_property.h b/src/skin/skin_slider_property.h new file mode 100644 index 000000000..7e3db59a3 --- /dev/null +++ b/src/skin/skin_slider_property.h @@ -0,0 +1,50 @@ +/* ASE - Allegro Sprite Editor + * Copyright (C) 2001-2011 David Capello + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#ifndef SKIN_SLIDER_PROPERTY_H_INCLUDED +#define SKIN_SLIDER_PROPERTY_H_INCLUDED + +#include "skin/skin_property.h" + +// Forward declaration for gfx::Rect +namespace gfx { class Rect; } + +class Slider; +struct BITMAP; + +class ISliderBgPainter +{ +public: + virtual void paint(Slider* slider, BITMAP* bmp, const gfx::Rect& rc) = 0; +}; + +class SkinSliderProperty : public SkinProperty +{ +public: + // The given painter is deleted automatically when this + // property the destroyed. + SkinSliderProperty(ISliderBgPainter* painter); + ~SkinSliderProperty(); + + ISliderBgPainter* getBgPainter() const; + +private: + ISliderBgPainter* m_painter; +}; + +#endif diff --git a/src/skin_theme.cpp b/src/skin/skin_theme.cpp similarity index 94% rename from src/skin_theme.cpp rename to src/skin/skin_theme.cpp index cfc53d600..392b0aed8 100644 --- a/src/skin_theme.cpp +++ b/src/skin/skin_theme.cpp @@ -23,12 +23,15 @@ #include "base/bind.h" #include "base/shared_ptr.h" +#include "gfx/rect.h" #include "gui/jinete.h" #include "gui/jintern.h" #include "loadpng.h" #include "modules/gui.h" #include "resource_finder.h" -#include "skin_theme.h" +#include "skin/skin_property.h" +#include "skin/skin_slider_property.h" +#include "skin/skin_theme.h" #include "xml_exception.h" #include "tinyxml.h" @@ -110,6 +113,8 @@ SkinTheme::SkinTheme() sheet_mapping["mini_slider_empty"] = PART_MINI_SLIDER_EMPTY_NW; sheet_mapping["mini_slider_full_focused"] = PART_MINI_SLIDER_FULL_FOCUSED_NW; sheet_mapping["mini_slider_empty_focused"] = PART_MINI_SLIDER_EMPTY_FOCUSED_NW; + sheet_mapping["mini_slider_thumb"] = PART_MINI_SLIDER_THUMB; + sheet_mapping["mini_slider_thumb_focused"] = PART_MINI_SLIDER_THUMB_FOCUSED; sheet_mapping["separator_horz"] = PART_SEPARATOR_HORZ; sheet_mapping["separator_vert"] = PART_SEPARATOR_VERT; sheet_mapping["combobox_arrow"] = PART_COMBOBOX_ARROW; @@ -1115,17 +1120,11 @@ void SkinTheme::draw_slider(Slider* widget, JRect clip) widget->getSliderThemeInfo(&min, &max, &value); - // Tool buttons are smaller - bool isMiniLook = false; - SharedPtr skinPropery = widget->getProperty(SkinProperty::SkinPropertyName); - if (skinPropery != NULL) - isMiniLook = skinPropery->isMiniLook(); - x1 = widget->rc->x1 + widget->border_width.l; y1 = widget->rc->y1 + widget->border_width.t; x2 = widget->rc->x2 - widget->border_width.r - 1; y2 = widget->rc->y2 - widget->border_width.b - 1; - + if (min != max) x = x1 + (x2-x1) * (value-min) / (max-min); else @@ -1136,35 +1135,81 @@ void SkinTheme::draw_slider(Slider* widget, JRect clip) x2 = widget->rc->x2 - 1; y2 = widget->rc->y2 - 1; - int full_part_nw; - int empty_part_nw; + // The mini-look is used for sliders with tiny borders. + bool isMiniLook = false; - if (isMiniLook) { - full_part_nw = widget->hasMouseOver() ? PART_MINI_SLIDER_FULL_FOCUSED_NW: - PART_MINI_SLIDER_FULL_NW; - empty_part_nw = widget->hasMouseOver() ? PART_MINI_SLIDER_EMPTY_FOCUSED_NW: - PART_MINI_SLIDER_EMPTY_NW; + // The BG painter is used for sliders without a number-indicator and + // customized background (e.g. RGB sliders) + ISliderBgPainter* bgPainter = NULL; + + SharedPtr skinPropery = widget->getProperty(SkinProperty::SkinPropertyName); + if (skinPropery != NULL) + isMiniLook = skinPropery->isMiniLook(); + + if (SkinSliderProperty* sliderProperty = dynamic_cast(skinPropery.get())) + bgPainter = sliderProperty->getBgPainter(); + + // Draw customized background + if (bgPainter) { + int nw = PART_MINI_SLIDER_EMPTY_NW; + BITMAP* thumb = widget->hasFocus() ? m_part[PART_MINI_SLIDER_THUMB_FOCUSED]: + m_part[PART_MINI_SLIDER_THUMB]; + + // Draw background + rectfill(ji_screen, x1, y1, x2, y2, BGCOLOR); + + // Draw thumb + set_alpha_blender(); + draw_trans_sprite(ji_screen, thumb, x-thumb->w/2, y1+1); + + // Draw borders + x1 += 3 * jguiscale(); + y1 += thumb->h + jguiscale(); + x2 -= 3 * jguiscale(); + y2 -= 1 * jguiscale(); + + draw_bounds_nw(ji_screen, x1, y1, x2, y2, nw, -1); + + // Draw background + x1 += 1 * jguiscale(); + y1 += 1 * jguiscale(); + x2 -= 1 * jguiscale(); + y2 -= 2 * jguiscale(); + + gfx::Rect rc(x1, y1, x2-x1+1, y2-y1+1); + if (rc.w > 0 && rc.h > 0) + bgPainter->paint(widget, ji_screen, rc); } else { - full_part_nw = widget->hasFocus() ? PART_SLIDER_FULL_FOCUSED_NW: - PART_SLIDER_FULL_NW; - empty_part_nw = widget->hasFocus() ? PART_SLIDER_EMPTY_FOCUSED_NW: - PART_SLIDER_EMPTY_NW; - } + // Draw borders + int full_part_nw; + int empty_part_nw; - if (value == min) - draw_bounds_nw(ji_screen, x1, y1, x2, y2, empty_part_nw, get_slider_empty_face_color()); - else if (value == max) - draw_bounds_nw(ji_screen, x1, y1, x2, y2, full_part_nw, get_slider_full_face_color()); - else - draw_bounds_nw2(ji_screen, - x1, y1, x2, y2, x, - full_part_nw, empty_part_nw, - get_slider_full_face_color(), - get_slider_empty_face_color()); + if (isMiniLook) { + full_part_nw = widget->hasMouseOver() ? PART_MINI_SLIDER_FULL_FOCUSED_NW: + PART_MINI_SLIDER_FULL_NW; + empty_part_nw = widget->hasMouseOver() ? PART_MINI_SLIDER_EMPTY_FOCUSED_NW: + PART_MINI_SLIDER_EMPTY_NW; + } + else { + full_part_nw = widget->hasFocus() ? PART_SLIDER_FULL_FOCUSED_NW: + PART_SLIDER_FULL_NW; + empty_part_nw = widget->hasFocus() ? PART_SLIDER_EMPTY_FOCUSED_NW: + PART_SLIDER_EMPTY_NW; + } - /* text */ - { + if (value == min) + draw_bounds_nw(ji_screen, x1, y1, x2, y2, empty_part_nw, get_slider_empty_face_color()); + else if (value == max) + draw_bounds_nw(ji_screen, x1, y1, x2, y2, full_part_nw, get_slider_full_face_color()); + else + draw_bounds_nw2(ji_screen, + x1, y1, x2, y2, x, + full_part_nw, empty_part_nw, + get_slider_full_face_color(), + get_slider_empty_face_color()); + + // Draw text std::string old_text = widget->getText(); JRect r; int cx1, cy1, cx2, cy2; @@ -1750,71 +1795,3 @@ bool SkinTheme::theme_frame_button_msg_proc(JWidget widget, JMessage msg) return false; } - -////////////////////////////////////////////////////////////////////// - -const char* SkinProperty::SkinPropertyName = "SkinProperty"; - -SkinProperty::SkinProperty() - : Property(SkinPropertyName) -{ - m_isMiniLook = false; - m_upperLeft = 0; - m_upperRight = 0; - m_lowerLeft = 0; - m_lowerRight = 0; -} - -SkinProperty::~SkinProperty() -{ -} - -bool SkinProperty::isMiniLook() const -{ - return m_isMiniLook; -} - -void SkinProperty::setMiniLook(bool state) -{ - m_isMiniLook = state; -} - -int SkinProperty::getUpperLeft() const -{ - return m_upperLeft; -} - -int SkinProperty::getUpperRight() const -{ - return m_upperRight; -} - -int SkinProperty::getLowerLeft() const -{ - return m_lowerLeft; -} - -int SkinProperty::getLowerRight() const -{ - return m_lowerRight; -} - -void SkinProperty::setUpperLeft(int value) -{ - m_upperLeft = value; -} - -void SkinProperty::setUpperRight(int value) -{ - m_upperRight = value; -} - -void SkinProperty::setLowerLeft(int value) -{ - m_lowerLeft = value; -} - -void SkinProperty::setLowerRight(int value) -{ - m_lowerRight = value; -} diff --git a/src/skin_theme.h b/src/skin/skin_theme.h similarity index 95% rename from src/skin_theme.h rename to src/skin/skin_theme.h index ed1e7d6a0..f3acd4313 100644 --- a/src/skin_theme.h +++ b/src/skin/skin_theme.h @@ -25,39 +25,8 @@ #include "gfx/rect.h" #include "gui/jrect.h" -#include "gui/property.h" #include "gui/theme.h" -// Property to show widgets with a special look (e.g.: buttons or sliders with mini-borders) -class SkinProperty : public Property -{ -public: - static const char* SkinPropertyName; - - SkinProperty(); - ~SkinProperty(); - - bool isMiniLook() const; - void setMiniLook(bool state); - - int getUpperLeft() const; - int getUpperRight() const; - int getLowerLeft() const; - int getLowerRight() const; - - void setUpperLeft(int value); - void setUpperRight(int value); - void setLowerLeft(int value); - void setLowerRight(int value); - -private: - bool m_isMiniLook; - int m_upperLeft; - int m_upperRight; - int m_lowerLeft; - int m_lowerRight; -}; - // Available parts in the skin sheet enum { @@ -253,6 +222,9 @@ enum { PART_MINI_SLIDER_EMPTY_FOCUSED_SW, PART_MINI_SLIDER_EMPTY_FOCUSED_W, + PART_MINI_SLIDER_THUMB, + PART_MINI_SLIDER_THUMB_FOCUSED, + PART_SEPARATOR_HORZ, PART_SEPARATOR_VERT, diff --git a/src/widgets/color_bar.cpp b/src/widgets/color_bar.cpp index 8c452effe..2fb6527cc 100644 --- a/src/widgets/color_bar.cpp +++ b/src/widgets/color_bar.cpp @@ -38,7 +38,7 @@ #include "raster/palette.h" #include "raster/sprite.h" #include "raster/undo.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "ui_context.h" #include "widgets/color_bar.h" diff --git a/src/widgets/editor/editor.cpp b/src/widgets/editor/editor.cpp index 394d7e7d5..667460962 100644 --- a/src/widgets/editor/editor.cpp +++ b/src/widgets/editor/editor.cpp @@ -36,7 +36,7 @@ #include "modules/palettes.h" #include "raster/raster.h" #include "settings/settings.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "tools/tool.h" #include "ui_context.h" diff --git a/src/widgets/statebar.cpp b/src/widgets/statebar.cpp index 8a5887d6d..a3f38addb 100644 --- a/src/widgets/statebar.cpp +++ b/src/widgets/statebar.cpp @@ -38,7 +38,7 @@ #include "raster/layer.h" #include "raster/sprite.h" #include "raster/undo.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "sprite_wrappers.h" #include "tools/tool.h" #include "ui_context.h" diff --git a/src/widgets/tabs.cpp b/src/widgets/tabs.cpp index 0fc080df7..5240f545e 100644 --- a/src/widgets/tabs.cpp +++ b/src/widgets/tabs.cpp @@ -26,7 +26,7 @@ #include "gui/jintern.h" #include "modules/gfx.h" #include "modules/gui.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "widgets/tabs.h" #define ARROW_W (12*jguiscale()) diff --git a/src/widgets/toolbar.cpp b/src/widgets/toolbar.cpp index d0019a402..6c95b86fc 100644 --- a/src/widgets/toolbar.cpp +++ b/src/widgets/toolbar.cpp @@ -31,7 +31,7 @@ #include "gui/jinete.h" #include "modules/gfx.h" #include "modules/gui.h" -#include "skin_theme.h" +#include "skin/skin_theme.h" #include "tools/toolbox.h" #include "ui_context.h" #include "widgets/groupbut.h"