diff options
author | Eugene Sandulenko | 2013-08-22 05:31:23 -0700 |
---|---|---|
committer | Eugene Sandulenko | 2013-08-22 05:31:23 -0700 |
commit | 8a340007ea66983dd2f754c63dbf1afdc5892969 (patch) | |
tree | db62d012f398250eadcbfb05e13d3f01ac1766cd /gui | |
parent | 76fde715df9fc22917243520ab0a6226337e6a43 (diff) | |
parent | 94792d2063b261846b72f7e9c61da52eb59febe4 (diff) | |
download | scummvm-rg350-8a340007ea66983dd2f754c63dbf1afdc5892969.tar.gz scummvm-rg350-8a340007ea66983dd2f754c63dbf1afdc5892969.tar.bz2 scummvm-rg350-8a340007ea66983dd2f754c63dbf1afdc5892969.zip |
Merge pull request #361 from rundfunk47/guiimprovements
GUI: Various GUI Improvements
Diffstat (limited to 'gui')
-rw-r--r-- | gui/ThemeEngine.cpp | 17 | ||||
-rw-r--r-- | gui/ThemeEngine.h | 9 | ||||
-rw-r--r-- | gui/about.cpp | 7 | ||||
-rw-r--r-- | gui/object.cpp | 2 | ||||
-rw-r--r-- | gui/object.h | 7 | ||||
-rw-r--r-- | gui/themes/scummclassic.zip | bin | 110000 -> 113348 bytes | |||
-rw-r--r-- | gui/themes/scummmodern.zip | bin | 1485763 -> 1489429 bytes | |||
-rw-r--r-- | gui/themes/scummmodern/scummmodern_gfx.stx | 42 | ||||
-rw-r--r-- | gui/widgets/editable.cpp | 2 | ||||
-rw-r--r-- | gui/widgets/edittext.cpp | 8 |
10 files changed, 55 insertions, 39 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index 2abf4a545d..688654d208 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -122,15 +122,16 @@ protected: class ThemeItemTextData : public ThemeItem { public: - ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const TextColorData *color, const Common::Rect &area, const Common::String &text, - Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, + ThemeItemTextData(ThemeEngine *engine, const TextDrawData *data, const TextColorData *color, const Common::Rect &area, const Common::Rect &textDrawableArea, + const Common::String &text, Graphics::TextAlign alignH, GUI::ThemeEngine::TextAlignVertical alignV, bool ellipsis, bool restoreBg, int deltaX) : ThemeItem(engine, area), _data(data), _color(color), _text(text), _alignH(alignH), _alignV(alignV), - _ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX) {} + _ellipsis(ellipsis), _restoreBg(restoreBg), _deltax(deltaX), _textDrawableArea(textDrawableArea) {} void drawSelf(bool draw, bool restore); protected: + Common::Rect _textDrawableArea; const TextDrawData *_data; const TextColorData *_color; Common::String _text; @@ -246,7 +247,7 @@ void ThemeItemTextData::drawSelf(bool draw, bool restore) { if (draw) { _engine->renderer()->setFgColor(_color->r, _color->g, _color->b); - _engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis); + _engine->renderer()->drawString(_data->_fontPtr, _text, _area, _alignH, _alignV, _deltax, _ellipsis, _textDrawableArea); } _engine->addDirtyRect(_area); @@ -842,7 +843,7 @@ void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic, } void ThemeEngine::queueDDText(TextData type, TextColor color, const Common::Rect &r, const Common::String &text, bool restoreBg, - bool ellipsis, Graphics::TextAlign alignH, TextAlignVertical alignV, int deltax) { + bool ellipsis, Graphics::TextAlign alignH, TextAlignVertical alignV, int deltax, const Common::Rect &drawableTextArea) { if (_texts[type] == 0) return; @@ -850,7 +851,7 @@ void ThemeEngine::queueDDText(TextData type, TextColor color, const Common::Rect Common::Rect area = r; area.clip(_screen.w, _screen.h); - ThemeItemTextData *q = new ThemeItemTextData(this, _texts[type], _textColors[color], area, text, alignH, alignV, ellipsis, restoreBg, deltax); + ThemeItemTextData *q = new ThemeItemTextData(this, _texts[type], _textColors[color], area, drawableTextArea, text, alignH, alignV, ellipsis, restoreBg, deltax); if (_buffering) { _screenQueue.push_back(q); @@ -1121,7 +1122,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, co } } -void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, Graphics::TextAlign align, TextInversionState inverted, int deltax, bool useEllipsis, FontStyle font, FontColor color, bool restore) { +void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, Graphics::TextAlign align, TextInversionState inverted, int deltax, bool useEllipsis, FontStyle font, FontColor color, bool restore, const Common::Rect &drawableTextArea) { if (!ready()) return; @@ -1191,7 +1192,7 @@ void ThemeEngine::drawText(const Common::Rect &r, const Common::String &str, Wid break; } - queueDDText(textId, colorId, r, str, restore, useEllipsis, align, kTextAlignVCenter, deltax); + queueDDText(textId, colorId, r, str, restore, useEllipsis, align, kTextAlignVCenter, deltax, drawableTextArea); } void ThemeEngine::drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state, FontColor color) { diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index c0e47a19e6..4dffb13e71 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -29,6 +29,7 @@ #include "common/hashmap.h" #include "common/list.h" #include "common/str.h" +#include "common/rect.h" #include "graphics/surface.h" #include "graphics/font.h" @@ -39,10 +40,6 @@ class OSystem; -namespace Common { -struct Rect; -} - namespace Graphics { struct DrawStep; class VectorRenderer; @@ -376,7 +373,7 @@ public: void drawDialogBackground(const Common::Rect &r, DialogBackground type, WidgetStateInfo state = kStateEnabled); - void drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignCenter, TextInversionState inverted = kTextInversionNone, int deltax = 0, bool useEllipsis = true, FontStyle font = kFontStyleBold, FontColor color = kFontColorNormal, bool restore = true); + void drawText(const Common::Rect &r, const Common::String &str, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignCenter, TextInversionState inverted = kTextInversionNone, int deltax = 0, bool useEllipsis = true, FontStyle font = kFontStyleBold, FontColor color = kFontColorNormal, bool restore = true, const Common::Rect &drawableTextArea = Common::Rect(0, 0, 0, 0)); void drawChar(const Common::Rect &r, byte ch, const Graphics::Font *font, WidgetStateInfo state = kStateEnabled, FontColor color = kFontColorNormal); @@ -588,7 +585,7 @@ protected: */ void queueDD(DrawData type, const Common::Rect &r, uint32 dynamic = 0, bool restore = false); void queueDDText(TextData type, TextColor color, const Common::Rect &r, const Common::String &text, bool restoreBg, - bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0); + bool elipsis, Graphics::TextAlign alignH = Graphics::kTextAlignLeft, TextAlignVertical alignV = kTextAlignVTop, int deltax = 0, const Common::Rect &drawableTextArea = Common::Rect(0, 0, 0, 0)); void queueBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha); /** diff --git a/gui/about.cpp b/gui/about.cpp index 20145886c6..3bb1934e28 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -180,9 +180,10 @@ void AboutDialog::close() { } void AboutDialog::drawDialog() { -// g_gui.theme()->setDrawArea(Common::Rect(_x, _y, _x+_w, _y+_h)); Dialog::drawDialog(); + setTextDrawableArea(Common::Rect(_x, _y, _x + _w, _y + _h)); + // Draw text // TODO: Add a "fade" effect for the top/bottom text lines // TODO: Maybe prerender all of the text into another surface, @@ -239,8 +240,8 @@ void AboutDialog::drawDialog() { while (*str && *str == ' ') str++; - if (*str && y > _y && y + g_gui.theme()->getFontHeight() < _y + _h) - g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, ThemeEngine::kTextInversionNone, 0, false); + if (*str) + g_gui.theme()->drawText(Common::Rect(_x + _xOff, y, _x + _w - _xOff, y + g_gui.theme()->getFontHeight()), str, state, align, ThemeEngine::kTextInversionNone, 0, false, ThemeEngine::kFontStyleBold, ThemeEngine::kFontColorNormal, true, _textDrawableArea); y += _lineHeight; } } diff --git a/gui/object.cpp b/gui/object.cpp index 73c4f74d6c..189a286ead 100644 --- a/gui/object.cpp +++ b/gui/object.cpp @@ -29,7 +29,7 @@ namespace GUI { GuiObject::GuiObject(const Common::String &name) - : _x(-1000), _y(-1000), _w(0), _h(0), _name(name), _firstWidget(0) { + : _x(-1000), _y(-1000), _w(0), _h(0), _name(name), _firstWidget(0), _textDrawableArea(Common::Rect(0, 0, 0, 0)) { reflowLayout(); } diff --git a/gui/object.h b/gui/object.h index bce3cd7846..dac3341b5a 100644 --- a/gui/object.h +++ b/gui/object.h @@ -24,6 +24,7 @@ #include "common/scummsys.h" #include "common/str.h" +#include "common/rect.h" namespace GUI { @@ -59,6 +60,8 @@ class Widget; class GuiObject : public CommandReceiver { friend class Widget; protected: + Common::Rect _textDrawableArea; + int16 _x, _y; uint16 _w, _h; const Common::String _name; @@ -66,10 +69,12 @@ protected: Widget *_firstWidget; public: - GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(0) { } + GuiObject(int x, int y, int w, int h) : _x(x), _y(y), _w(w), _h(h), _firstWidget(0), _textDrawableArea(Common::Rect(0, 0, 0, 0)) { } GuiObject(const Common::String &name); ~GuiObject(); + virtual void setTextDrawableArea(const Common::Rect &r) { _textDrawableArea = r; } + virtual int16 getAbsX() const { return _x; } virtual int16 getAbsY() const { return _y; } virtual int16 getChildX() const { return getAbsX(); } diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 4154c6c33a..1085aa64a4 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex 0f10003e94..e40e8b1e26 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index 1b3bcea0d6..3a1ec5a5f0 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -38,6 +38,14 @@ rgb = '203, 126, 107' /> + <color name = 'brightredborder' + rgb = '238, 213, 207' + /> + + <color name = 'darkredborder' + rgb = '30, 7, 1' + /> + <!-- Disabled button/slider --> <color name = 'darkeneddarkred' rgb = '120, 28, 0' @@ -73,7 +81,7 @@ rgb = '255, 255, 255' /> <color name = 'shadowcolor' - rgb = '63, 60, 17' + rgb = '105, 101, 86' /> <color name = 'darkgray' rgb = '176, 168, 144' @@ -170,6 +178,10 @@ color = '128, 128, 128' /> + <text_color id = 'color_button_hover' + color = 'white' + /> + <text_color id = 'color_alternative_inverted' color = 'white' /> @@ -186,10 +198,6 @@ color = 'white' /> - <text_color id = 'color_button_hover' - color = '255, 214, 84' - /> - <text_color id = 'color_button_disabled' color = '192, 192, 192' /> @@ -232,7 +240,7 @@ stroke = '0' gradient_start = 'darkorange' gradient_end = 'brightorange' - shadow = '3' + shadow = '7' gradient_factor = '3' /> </drawdata> @@ -466,7 +474,7 @@ fg_color = 'lightgray2' fill = 'background' bg_color = 'xtrabrightred' - shadow = '2' + shadow = '1' /> <drawstep func = 'triangle' @@ -505,7 +513,7 @@ fg_color = 'lightgray2' fill = 'background' bg_color = 'xtrabrightred' - shadow = '2' + shadow = '1' /> <drawstep func = 'triangle' @@ -663,7 +671,7 @@ fg_color = 'lightgray2' fill = 'background' bg_color = 'xtrabrightred' - shadow = '2' + shadow = '1' /> <drawstep func = 'triangle' @@ -716,7 +724,7 @@ gradient_start = 'blandyellow' gradient_end = 'xtrabrightred' fill = 'gradient' - shadow = '3' + shadow = '7' /> </drawdata> @@ -737,7 +745,7 @@ gradient_start = 'blandyellow' gradient_end = 'xtrabrightred' gradient_factor = '4' - shadow = '3' + shadow = '7' /> </drawdata> @@ -783,18 +791,18 @@ stroke = '1' fill = 'gradient' shadow = '0' - fg_color = 'shadowcolor' + fg_color = 'darkredborder' gradient_start = 'brightred' gradient_end = 'darkred' bevel = '1' - bevel_color = '237, 169, 72' + bevel_color = 'brightredborder' /> </drawdata> <!-- Hovered button --> <drawdata id = 'button_hover' cache = 'false'> <text font = 'text_button' - text_color = 'color_button_hover' + text_color = 'color_button' vertical_align = 'center' horizontal_align = 'center' /> @@ -803,11 +811,11 @@ stroke = '1' fill = 'gradient' shadow = '0' - fg_color = 'shadowcolor' + fg_color = 'darkredborder' gradient_start = 'brightpink' gradient_end = 'darkpink' bevel = '1' - bevel_color = 'xtrabrightred' + bevel_color = 'brightredborder' /> </drawdata> @@ -915,7 +923,7 @@ gradient_factor = '6' fill = 'gradient' bg_color = 'xtrabrightred' - shadow = '3' + shadow = '7' /> </drawdata> diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp index 6fae9346b2..667850d6cc 100644 --- a/gui/widgets/editable.cpp +++ b/gui/widgets/editable.cpp @@ -277,7 +277,7 @@ void EditableWidget::drawCaret(bool erase) { int chrWidth = g_gui.getCharWidth(_editString[_caretPos], _font); const uint last = (_caretPos > 0) ? _editString[_caretPos - 1] : 0; x += g_gui.getKerningOffset(last, _editString[_caretPos], _font); - g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font); + g_gui.theme()->drawText(Common::Rect(x, y, x + chrWidth, y + editRect.height() - 2), chr, _state, Graphics::kTextAlignLeft, _inversion, 0, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea); } } diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp index 3677f02e47..52527effd8 100644 --- a/gui/widgets/edittext.cpp +++ b/gui/widgets/edittext.cpp @@ -93,11 +93,15 @@ void EditTextWidget::drawWidget() { // Draw the text adjustOffset(); - g_gui.theme()->drawText(Common::Rect(_x+2+ _leftPadding,_y+2, _x+_leftPadding+getEditRect().width()+2, _y+_h-2), _editString, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, -_editScrollOffset, false, _font); + + const Common::Rect &r = Common::Rect(_x + 2 + _leftPadding, _y + 2, _x + _leftPadding + getEditRect().width() + 8, _y + _h); + setTextDrawableArea(r); + + g_gui.theme()->drawText(Common::Rect(_x + 2 + _leftPadding, _y + 2, _x + _leftPadding + getEditRect().width() + 2, _y + _h), _editString, _state, Graphics::kTextAlignLeft, ThemeEngine::kTextInversionNone, -_editScrollOffset, false, _font, ThemeEngine::kFontColorNormal, true, _textDrawableArea); } Common::Rect EditTextWidget::getEditRect() const { - Common::Rect r(2 + _leftPadding, 2, _w - 2 - _leftPadding - _rightPadding, _h-1); + Common::Rect r(2 + _leftPadding, 2, _w - 2 - _leftPadding - _rightPadding, _h - 1); return r; } |