From 44d91bfa81d638a75b81a079edaa046ff4778194 Mon Sep 17 00:00:00 2001 From: Vicent Marti Date: Fri, 1 Aug 2008 20:19:37 +0000 Subject: Massive changes to the renderer in order to replicate the current GUI theme, as requested by Eugene svn-id: r33507 --- graphics/VectorRenderer.cpp | 2 +- gui/ThemeDefaultXML.cpp | 599 +++++++++++++++++++++++++++++++++----------- gui/ThemeRenderer.cpp | 26 +- gui/ThemeRenderer.h | 6 +- gui/theme-config.cpp | 4 +- 5 files changed, 476 insertions(+), 161 deletions(-) diff --git a/graphics/VectorRenderer.cpp b/graphics/VectorRenderer.cpp index 5ac976c251..3bd3b86cf8 100644 --- a/graphics/VectorRenderer.cpp +++ b/graphics/VectorRenderer.cpp @@ -517,7 +517,7 @@ template void VectorRendererSpec:: drawTab(int x, int y, int r, int w, int h) { if (x + w > Base::_activeSurface->w || y + h > Base::_activeSurface->h || - w <= 0 || h <= 0 || x < 0 || y < 0 || (r << 1) > w || (r << 1) > h) + w <= 0 || h <= 0 || x < 0 || y < 0 || r > w || r > h) return; switch (Base::_fillMode) { diff --git a/gui/ThemeDefaultXML.cpp b/gui/ThemeDefaultXML.cpp index 630445a6fd..298f26e782 100644 --- a/gui/ThemeDefaultXML.cpp +++ b/gui/ThemeDefaultXML.cpp @@ -36,158 +36,455 @@ bool ThemeRenderer::loadDefaultXML() { * You may use single quotes (') instead of scaped double quotes. * Remember to indent properly the XML so it's easier to read and * to maintain! + * Also remember to scape the end of each line. :p */ -"" - "" - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - "" - "" - - - "" - "" - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - "" - - "" - "" - "" -"" - -"" - "" - "" - "" - "" - - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - "" - - "" - "" - "" - "" - - "" - "" - "" - "" - "" - "" - "" - "" -""; +" \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ + \ +"; if (!parser()->loadBuffer((const byte*)defaultXML, strlen(defaultXML), false)) return false; diff --git a/gui/ThemeRenderer.cpp b/gui/ThemeRenderer.cpp index 48c5eaf7f3..a81f46cf8e 100644 --- a/gui/ThemeRenderer.cpp +++ b/gui/ThemeRenderer.cpp @@ -58,11 +58,13 @@ const ThemeRenderer::DrawDataInfo ThemeRenderer::kDrawDataDefaults[] = { {kDDSliderFull, "slider_full", false, kDDNone}, - {kDDCheckboxEnabled, "checkbox_enabled", false, kDDCheckboxDisabled}, + {kDDCheckboxDefault, "checkbox_default", true, kDDNone}, {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone}, + {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault}, {kDDTabActive, "tab_active", false, kDDTabInactive}, {kDDTabInactive, "tab_inactive", true, kDDNone}, + {kDDTabBackground, "tab_background", true, kDDNone}, {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, @@ -83,7 +85,9 @@ const ThemeRenderer::TextDataInfo ThemeRenderer::kTextDataDefaults[] = { {kTextDataDefault, "text_default"}, {kTextDataHover, "text_hover"}, {kTextDataDisabled, "text_disabled"}, - {kTextDataInverted, "text_inverted"} + {kTextDataInverted, "text_inverted"}, + {kTextDataButton, "text_button"}, + {kTextDataButtonHover, "text_button_hover"} }; @@ -446,7 +450,15 @@ void ThemeRenderer::drawCheckbox(const Common::Rect &r, const Common::String &st return; Common::Rect r2 = r; - DrawData dd = checked ? kDDCheckboxEnabled : kDDCheckboxDisabled; + DrawData dd = kDDCheckboxDefault; + + if (checked) + dd = kDDCheckboxSelected; + + if (state == kStateDisabled) + dd = kDDCheckboxDisabled; + + TextData td = (state == kStateHighlight) ? kTextDataHover : getTextData(dd); const int checkBoxSize = MIN((int)r.height(), getFontHeight()); r2.bottom = r2.top + checkBoxSize; @@ -457,7 +469,7 @@ void ThemeRenderer::drawCheckbox(const Common::Rect &r, const Common::String &st r2.left = r2.right + checkBoxSize; r2.right = r.right; - queueDDText(getTextData(dd), r2, str, false, false, _widgets[dd]->_textAlignH, _widgets[dd]->_textAlignV); + queueDDText(td, r2, str, false, false, _widgets[kDDCheckboxDefault]->_textAlignH, _widgets[dd]->_textAlignV); } void ThemeRenderer::drawSlider(const Common::Rect &r, int width, WidgetStateInfo state) { @@ -564,12 +576,14 @@ void ThemeRenderer::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, if (!ready()) return; - const int tabOffset = 1; + const int tabOffset = 3; + + queueDD(kDDTabBackground, Common::Rect(r.left, r.top, r.right, r.top + tabHeight)); for (int i = 0; i < (int)tabs.size(); ++i) { if (i == active) continue; - + Common::Rect tabRect(r.left + i * (tabWidth + tabOffset), r.top, r.left + i * (tabWidth + tabOffset) + tabWidth, r.top + tabHeight); queueDD(kDDTabInactive, tabRect); queueDDText(getTextData(kDDTabInactive), tabRect, tabs[i], false, false, _widgets[kDDTabInactive]->_textAlignH, _widgets[kDDTabInactive]->_textAlignV); diff --git a/gui/ThemeRenderer.h b/gui/ThemeRenderer.h index 2b15d7dfa8..2a0f059d41 100644 --- a/gui/ThemeRenderer.h +++ b/gui/ThemeRenderer.h @@ -119,11 +119,13 @@ protected: kDDSliderFull, - kDDCheckboxEnabled, + kDDCheckboxDefault, kDDCheckboxDisabled, + kDDCheckboxSelected, kDDTabActive, kDDTabInactive, + kDDTabBackground, kDDScrollbarBase, kDDScrollbarButtonIdle, @@ -168,6 +170,8 @@ protected: kTextDataHover, kTextDataDisabled, kTextDataInverted, + kTextDataButton, + kTextDataButtonHover, kTextDataMAX }; diff --git a/gui/theme-config.cpp b/gui/theme-config.cpp index 47f60d3d7b..1f52567e3e 100644 --- a/gui/theme-config.cpp +++ b/gui/theme-config.cpp @@ -138,7 +138,7 @@ const char *Theme::_defaultConfigINI = "PopUpWidget.leftPadding=4\n" "PopUpWidget.rightPadding=0\n" "TabWidget.tabWidth=70\n" -"TabWidget.tabHeight=21\n" +"TabWidget.tabHeight=22\n" "TabWidget.titleVPad=2\n" "\n" "###### chooser\n" @@ -183,7 +183,7 @@ const char *Theme::_defaultConfigINI = "globaloptions=insetX insetY insetW insetH\n" "set_parent=globaloptions\n" "vBorder=5\n" -"globaloptions_tabwidget=0 vBorder parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)\n" +"globaloptions_tabwidget=0 0 parent.w (parent.h - buttonHeight - 8 - 2 * vBorder)\n" "\n" "# graphics tab\n" "opYoffset=vBorder\n" -- cgit v1.2.3