diff options
author | Matthew Hoops | 2011-05-03 17:17:27 -0400 |
---|---|---|
committer | Matthew Hoops | 2011-05-03 17:25:41 -0400 |
commit | 9cb600099f4c29298707787cafad2741a1cd6686 (patch) | |
tree | fb1930fa56b611317831d66442cba19b18d2e57a /gui | |
parent | 3b2283daf850605ca897002afbafe44489c35473 (diff) | |
parent | 95a6098f672191dc0792bd4f9bfa18706bbe8e3a (diff) | |
download | scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.gz scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.tar.bz2 scummvm-rg350-9cb600099f4c29298707787cafad2741a1cd6686.zip |
Merge remote branch 'upstream/master' into pegasus
Diffstat (limited to 'gui')
58 files changed, 446 insertions, 345 deletions
diff --git a/gui/ThemeEngine.cpp b/gui/ThemeEngine.cpp index ee83ca620c..78ea43ad79 100644 --- a/gui/ThemeEngine.cpp +++ b/gui/ThemeEngine.cpp @@ -24,7 +24,6 @@ */ #include "common/system.h" -#include "common/events.h" #include "common/config-manager.h" #include "common/file.h" #include "common/fs.h" @@ -32,14 +31,13 @@ #include "common/tokenizer.h" #include "common/translation.h" -#include "graphics/colormasks.h" #include "graphics/cursorman.h" #include "graphics/fontman.h" #include "graphics/imagedec.h" #include "graphics/surface.h" #include "graphics/VectorRenderer.h" -#include "gui/launcher.h" +#include "gui/widget.h" #include "gui/ThemeEngine.h" #include "gui/ThemeEval.h" #include "gui/ThemeParser.h" @@ -69,18 +67,18 @@ struct WidgetDrawData { /** Extra space that the widget occupies when it's drawn. E.g. when taking into account rounded corners, drop shadows, etc - Used when restoring the widget background */ + Used when restoring the widget background */ uint16 _backgroundOffset; bool _buffer; /** - * Calculates the background threshold offset of a given DrawData item. - * After fully loading all DrawSteps of a DrawData item, this function must be - * called in order to calculate if such draw steps would be drawn outside of - * the actual widget drawing zone (e.g. shadows). If this is the case, a constant - * value will be added when restoring the background of the widget. + * Calculates the background threshold offset of a given DrawData item. + * After fully loading all DrawSteps of a DrawData item, this function must be + * called in order to calculate if such draw steps would be drawn outside of + * the actual widget drawing zone (e.g. shadows). If this is the case, a constant + * value will be added when restoring the background of the widget. */ void calcBackgroundOffset(); }; @@ -114,8 +112,8 @@ 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, - bool ellipsis, bool restoreBg, int deltaX) : + 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) {} @@ -147,71 +145,71 @@ protected: /********************************************************** - * Data definitions for theme engine elements + * Data definitions for theme engine elements *********************************************************/ struct DrawDataInfo { - DrawData id; ///< The actual ID of the DrawData item. - const char *name; ///< The name of the DrawData item as it appears in the Theme Description files - bool buffer; ///< Sets whether this item is buffered on the backbuffer or drawn directly to the screen. - DrawData parent; ///< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover + DrawData id; ///< The actual ID of the DrawData item. + const char *name; ///< The name of the DrawData item as it appears in the Theme Description files + bool buffer; ///< Sets whether this item is buffered on the backbuffer or drawn directly to the screen. + DrawData parent; ///< Parent DrawData item, for items that overlay. E.g. kButtonIdle -> kButtonHover }; /** * Default values for each DrawData item. */ static const DrawDataInfo kDrawDataDefaults[] = { - {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone}, - {kDDSpecialColorBackground, "special_bg", true, kDDNone}, - {kDDPlainColorBackground, "plain_bg", true, kDDNone}, - {kDDTooltipBackground, "tooltip_bg", true, kDDNone}, - {kDDDefaultBackground, "default_bg", true, kDDNone}, - {kDDTextSelectionBackground, "text_selection", false, kDDNone}, - {kDDTextSelectionFocusBackground, "text_selection_focus", false, kDDNone}, + {kDDMainDialogBackground, "mainmenu_bg", true, kDDNone}, + {kDDSpecialColorBackground, "special_bg", true, kDDNone}, + {kDDPlainColorBackground, "plain_bg", true, kDDNone}, + {kDDTooltipBackground, "tooltip_bg", true, kDDNone}, + {kDDDefaultBackground, "default_bg", true, kDDNone}, + {kDDTextSelectionBackground, "text_selection", false, kDDNone}, + {kDDTextSelectionFocusBackground, "text_selection_focus", false, kDDNone}, - {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone}, - {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone}, - {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone}, - {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone}, + {kDDWidgetBackgroundDefault, "widget_default", true, kDDNone}, + {kDDWidgetBackgroundSmall, "widget_small", true, kDDNone}, + {kDDWidgetBackgroundEditText, "widget_textedit", true, kDDNone}, + {kDDWidgetBackgroundSlider, "widget_slider", true, kDDNone}, - {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider}, - {kDDButtonHover, "button_hover", false, kDDButtonIdle}, - {kDDButtonDisabled, "button_disabled", true, kDDNone}, + {kDDButtonIdle, "button_idle", true, kDDWidgetBackgroundSlider}, + {kDDButtonHover, "button_hover", false, kDDButtonIdle}, + {kDDButtonDisabled, "button_disabled", true, kDDNone}, - {kDDSliderFull, "slider_full", false, kDDNone}, - {kDDSliderHover, "slider_hover", false, kDDNone}, - {kDDSliderDisabled, "slider_disabled", false, kDDNone}, + {kDDSliderFull, "slider_full", false, kDDNone}, + {kDDSliderHover, "slider_hover", false, kDDNone}, + {kDDSliderDisabled, "slider_disabled", false, kDDNone}, - {kDDCheckboxDefault, "checkbox_default", true, kDDNone}, - {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone}, - {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault}, + {kDDCheckboxDefault, "checkbox_default", true, kDDNone}, + {kDDCheckboxDisabled, "checkbox_disabled", true, kDDNone}, + {kDDCheckboxSelected, "checkbox_selected", false, kDDCheckboxDefault}, - {kDDRadiobuttonDefault, "radiobutton_default", true, kDDNone}, - {kDDRadiobuttonDisabled, "radiobutton_disabled", true, kDDNone}, - {kDDRadiobuttonSelected, "radiobutton_selected", false, kDDRadiobuttonDefault}, + {kDDRadiobuttonDefault, "radiobutton_default", true, kDDNone}, + {kDDRadiobuttonDisabled, "radiobutton_disabled", true, kDDNone}, + {kDDRadiobuttonSelected, "radiobutton_selected", false, kDDRadiobuttonDefault}, - {kDDTabActive, "tab_active", false, kDDTabInactive}, - {kDDTabInactive, "tab_inactive", true, kDDNone}, - {kDDTabBackground, "tab_background", true, kDDNone}, + {kDDTabActive, "tab_active", false, kDDTabInactive}, + {kDDTabInactive, "tab_inactive", true, kDDNone}, + {kDDTabBackground, "tab_background", true, kDDNone}, - {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, + {kDDScrollbarBase, "scrollbar_base", true, kDDNone}, - {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, - {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, + {kDDScrollbarButtonIdle, "scrollbar_button_idle", true, kDDNone}, + {kDDScrollbarButtonHover, "scrollbar_button_hover", false, kDDScrollbarButtonIdle}, - {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone}, - {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase}, + {kDDScrollbarHandleIdle, "scrollbar_handle_idle", false, kDDNone}, + {kDDScrollbarHandleHover, "scrollbar_handle_hover", false, kDDScrollbarBase}, - {kDDPopUpIdle, "popup_idle", true, kDDNone}, - {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle}, - {kDDPopUpDisabled, "popup_disabled", true, kDDNone}, + {kDDPopUpIdle, "popup_idle", true, kDDNone}, + {kDDPopUpHover, "popup_hover", false, kDDPopUpIdle}, + {kDDPopUpDisabled, "popup_disabled", true, kDDNone}, - {kDDCaret, "caret", false, kDDNone}, - {kDDSeparator, "separator", true, kDDNone}, + {kDDCaret, "caret", false, kDDNone}, + {kDDSeparator, "separator", true, kDDNone}, }; /********************************************************** - * ThemeItem functions for drawing queues. + * ThemeItem functions for drawing queues. *********************************************************/ void ThemeItemDrawData::drawSelf(bool draw, bool restore) { @@ -259,7 +257,7 @@ void ThemeItemBitmap::drawSelf(bool draw, bool restore) { /********************************************************** - * ThemeEngine class + * ThemeEngine class *********************************************************/ ThemeEngine::ThemeEngine(Common::String id, GraphicsMode mode) : _system(0), _vectorRenderer(0), @@ -326,7 +324,7 @@ ThemeEngine::~ThemeEngine() { /********************************************************** - * Rendering mode management + * Rendering mode management *********************************************************/ const ThemeEngine::Renderer ThemeEngine::_rendererModes[] = { { _s("Disabled GFX"), _sc("Disabled GFX", "lowres"), "none", kGfxDisabled }, @@ -368,13 +366,13 @@ const char *ThemeEngine::findModeConfigName(GraphicsMode mode) { /********************************************************** - * Theme setup/initialization + * Theme setup/initialization *********************************************************/ bool ThemeEngine::init() { // reset everything and reload the graphics _initOk = false; - setGraphicsMode(_graphicsMode); _overlayFormat = _system->getOverlayFormat(); + setGraphicsMode(_graphicsMode); if (_screen.pixels && _backBuffer.pixels) { _initOk = true; @@ -499,10 +497,10 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) { uint32 height = _system->getOverlayHeight(); _backBuffer.free(); - _backBuffer.create(width, height, _bytesPerPixel); + _backBuffer.create(width, height, _overlayFormat); _screen.free(); - _screen.create(width, height, _bytesPerPixel); + _screen.create(width, height, _overlayFormat); delete _vectorRenderer; _vectorRenderer = Graphics::createRenderer(mode); @@ -512,7 +510,7 @@ void ThemeEngine::setGraphicsMode(GraphicsMode mode) { void WidgetDrawData::calcBackgroundOffset() { uint maxShadow = 0; for (Common::List<Graphics::DrawStep>::const_iterator step = _steps.begin(); - step != _steps.end(); ++step) { + step != _steps.end(); ++step) { if ((step->autoWidth || step->autoHeight) && step->shadow > maxShadow) maxShadow = step->shadow; @@ -531,7 +529,7 @@ void ThemeEngine::restoreBackground(Common::Rect r) { /********************************************************** - * Theme elements management + * Theme elements management *********************************************************/ void ThemeEngine::addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step) { DrawData id = parseDrawDataId(drawDataId); @@ -659,7 +657,7 @@ bool ThemeEngine::addDrawData(const Common::String &data, bool cached) { /********************************************************** - * Theme XML loading + * Theme XML loading *********************************************************/ void ThemeEngine::loadTheme(const Common::String &themeId) { unloadTheme(); @@ -717,9 +715,9 @@ bool ThemeEngine::loadDefaultXML() { #ifndef DISABLE_GUI_BUILTIN_THEME const char *defaultXML = #include "themes/default.inc" - ; + ; - if (!_parser->loadBuffer((const byte*)defaultXML, strlen(defaultXML))) + if (!_parser->loadBuffer((const byte *)defaultXML, strlen(defaultXML))) return false; _themeName = "ScummVM Classic Theme (Builtin Version)"; @@ -793,7 +791,7 @@ bool ThemeEngine::loadThemeXML(const Common::String &themeId) { /********************************************************** - * Drawing Queue management + * Drawing Queue management *********************************************************/ void ThemeEngine::queueDD(DrawData type, const Common::Rect &r, uint32 dynamic, bool restore) { if (_widgets[type] == 0) @@ -820,7 +818,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) { if (_texts[type] == 0) return; @@ -856,7 +854,7 @@ void ThemeEngine::queueBitmap(const Graphics::Surface *bitmap, const Common::Rec /********************************************************** - * Widget drawing functions + * Widget drawing functions *********************************************************/ void ThemeEngine::drawButton(const Common::Rect &r, const Common::String &str, WidgetStateInfo state, uint16 hints) { if (!ready()) @@ -1088,7 +1086,7 @@ void ThemeEngine::drawTab(const Common::Rect &r, int tabHeight, int tabWidth, co } if (active >= 0 && - (r.left + active * tabWidth < r.right) && (r.left + (active + 1) * tabWidth < r.right)) { + (r.left + active * tabWidth < r.right) && (r.left + (active + 1) * tabWidth < r.right)) { Common::Rect tabRect(r.left + active * tabWidth, r.top, r.left + (active + 1) * tabWidth, r.top + tabHeight); const uint16 tabLeft = active * tabWidth; const uint16 tabRight = MAX(r.right - tabRect.right, 0); @@ -1191,25 +1189,25 @@ void ThemeEngine::debugWidgetPosition(const char *name, const Common::Rect &r) { } /********************************************************** - * Screen/overlay management + * Screen/overlay management *********************************************************/ -void ThemeEngine::updateScreen() { +void ThemeEngine::updateScreen(bool render) { if (!_bufferQueue.empty()) { _vectorRenderer->setSurface(&_backBuffer); - for (Common::List<ThemeItem*>::iterator q = _bufferQueue.begin(); q != _bufferQueue.end(); ++q) { + for (Common::List<ThemeItem *>::iterator q = _bufferQueue.begin(); q != _bufferQueue.end(); ++q) { (*q)->drawSelf(true, false); delete *q; } _vectorRenderer->setSurface(&_screen); - memcpy(_screen.getBasePtr(0,0), _backBuffer.getBasePtr(0,0), _screen.pitch * _screen.h); + memcpy(_screen.getBasePtr(0, 0), _backBuffer.getBasePtr(0, 0), _screen.pitch * _screen.h); _bufferQueue.clear(); } if (!_screenQueue.empty()) { _vectorRenderer->disableShadows(); - for (Common::List<ThemeItem*>::iterator q = _screenQueue.begin(); q != _screenQueue.end(); ++q) { + for (Common::List<ThemeItem *>::iterator q = _screenQueue.begin(); q != _screenQueue.end(); ++q) { (*q)->drawSelf(true, false); delete *q; } @@ -1218,7 +1216,8 @@ void ThemeEngine::updateScreen() { _screenQueue.clear(); } - renderDirtyScreen(); + if (render) + renderDirtyScreen(); } void ThemeEngine::addDirtyRect(Common::Rect r) { @@ -1231,7 +1230,7 @@ void ThemeEngine::addDirtyRect(Common::Rect r) { // Check if the new rectangle is contained within another in the list Common::List<Common::Rect>::iterator it; - for (it = _dirtyScreen.begin(); it != _dirtyScreen.end(); ) { + for (it = _dirtyScreen.begin(); it != _dirtyScreen.end();) { // If we find a rectangle which fully contains the new one, // we can abort the search. if (it->contains(r)) @@ -1270,7 +1269,7 @@ void ThemeEngine::openDialog(bool doBuffer, ShadingStyle style) { addDirtyRect(Common::Rect(0, 0, _screen.w, _screen.h)); } - memcpy(_backBuffer.getBasePtr(0,0), _screen.getBasePtr(0,0), _screen.pitch * _screen.h); + memcpy(_backBuffer.getBasePtr(0, 0), _screen.getBasePtr(0, 0), _screen.pitch * _screen.h); _vectorRenderer->setSurface(&_screen); } @@ -1309,8 +1308,8 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int // Now, scan the bitmap. We have to convert it from 16 bit color mode // to 8 bit mode, and have to create a suitable palette on the fly. uint colorsFound = 0; - Common::HashMap<int, int> colorToIndex; - const OverlayColor *src = (const OverlayColor*)cursor->pixels; + Common::HashMap<int, int> colorToIndex; + const OverlayColor *src = (const OverlayColor *)cursor->pixels; for (uint y = 0; y < _cursorHeight; ++y) { for (uint x = 0; x < _cursorWidth; ++x) { byte r, g, b; @@ -1352,7 +1351,7 @@ bool ThemeEngine::createCursor(const Common::String &filename, int hotspotX, int /********************************************************** - * Legacy GUI::Theme support functions + * Legacy GUI::Theme support functions *********************************************************/ const Graphics::Font *ThemeEngine::getFont(FontStyle font) const { @@ -1388,7 +1387,7 @@ DrawData ThemeEngine::parseDrawDataId(const Common::String &name) const { } /********************************************************** - * External data loading + * External data loading *********************************************************/ const Graphics::Font *ThemeEngine::loadFontFromArchive(const Common::String &filename) { @@ -1497,10 +1496,16 @@ Common::String ThemeEngine::genLocalizedFontFilename(const Common::String &filen /********************************************************** - * Static Theme XML functions + * Static Theme XML functions *********************************************************/ bool ThemeEngine::themeConfigParseHeader(Common::String header, Common::String &themeName) { + // Check that header is not corrupted + if ((byte)header[0] > 127) { + warning("Corrupted theme header found"); + return false; + } + header.trim(); if (header.empty()) @@ -1583,7 +1588,9 @@ struct TDComparator { const Common::String _id; TDComparator(const Common::String &id) : _id(id) {} - bool operator()(const ThemeEngine::ThemeDescriptor &r) { return _id == r.id; } + bool operator()(const ThemeEngine::ThemeDescriptor &r) { + return _id == r.id; + } }; } // end of anonymous namespace @@ -1625,7 +1632,7 @@ void ThemeEngine::listUsableThemes(Common::Archive &archive, Common::List<ThemeD Common::ArchiveMemberList fileList; archive.listMatchingMembers(fileList, "*.zip"); for (Common::ArchiveMemberList::iterator i = fileList.begin(); - i != fileList.end(); ++i) { + i != fileList.end(); ++i) { td.name.clear(); if (themeConfigUsable(**i, td.name)) { td.filename = (*i)->getName(); diff --git a/gui/ThemeEngine.h b/gui/ThemeEngine.h index e852760e44..08560c8635 100644 --- a/gui/ThemeEngine.h +++ b/gui/ThemeEngine.h @@ -27,23 +27,33 @@ #define GUI_THEME_ENGINE_H #include "common/scummsys.h" -#include "common/system.h" #include "common/fs.h" +#include "common/hash-str.h" +#include "common/hashmap.h" +#include "common/list.h" +#include "common/str.h" + #include "graphics/surface.h" #include "graphics/font.h" +#include "graphics/pixelformat.h" + + +#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.3" -#define SCUMMVM_THEME_VERSION_STR "SCUMMVM_STX0.8.2" +class OSystem; + +namespace Common { +struct Rect; +} namespace Graphics { - struct DrawStep; - class VectorRenderer; +struct DrawStep; +class VectorRenderer; } namespace GUI { struct WidgetDrawData; -struct DrawDataInfo; -struct TextDataInfo; struct TextDrawData; struct TextColorData; class Dialog; @@ -53,9 +63,9 @@ class ThemeItem; class ThemeParser; /** - * DrawData sets enumeration. - * Each DD set corresponds to the actual looks - * of a widget in a given state. + * DrawData sets enumeration. + * Each DD set corresponds to the actual looks + * of a widget in a given state. */ enum DrawData { kDDMainDialogBackground, @@ -134,7 +144,7 @@ enum TextColor { class ThemeEngine { protected: - typedef Common::HashMap<Common::String, Graphics::Surface*> ImagesMap; + typedef Common::HashMap<Common::String, Graphics::Surface *> ImagesMap; friend class GUI::Dialog; friend class GUI::GuiObject; @@ -150,12 +160,12 @@ public: /// Widget background type enum WidgetBackground { - kWidgetBackgroundNo, ///< No background at all - kWidgetBackgroundPlain, ///< Simple background, this may not include borders - kWidgetBackgroundBorder, ///< Same as kWidgetBackgroundPlain just with a border - kWidgetBackgroundBorderSmall, ///< Same as kWidgetBackgroundPlain just with a small border - kWidgetBackgroundEditText, ///< Background used for edit text fields - kWidgetBackgroundSlider ///< Background used for sliders + kWidgetBackgroundNo, ///< No background at all + kWidgetBackgroundPlain, ///< Simple background, this may not include borders + kWidgetBackgroundBorder, ///< Same as kWidgetBackgroundPlain just with a border + kWidgetBackgroundBorderSmall, ///< Same as kWidgetBackgroundPlain just with a small border + kWidgetBackgroundEditText, ///< Background used for edit text fields + kWidgetBackgroundSlider ///< Background used for sliders }; /// Dialog background type @@ -169,18 +179,18 @@ public: /// State of the widget to be drawn enum State { - kStateDisabled, ///< Indicates that the widget is disabled, that does NOT include that it is invisible - kStateEnabled, ///< Indicates that the widget is enabled - kStateHighlight ///< Indicates that the widget is highlighted by the user + kStateDisabled, ///< Indicates that the widget is disabled, that does NOT include that it is invisible + kStateEnabled, ///< Indicates that the widget is enabled + kStateHighlight ///< Indicates that the widget is highlighted by the user }; typedef State WidgetStateInfo; /// Text inversion state of the text to be draw enum TextInversionState { - kTextInversionNone, ///< Indicates that the text should not be drawn inverted - kTextInversion, ///< Indicates that the text should be drawn inverted, but not focused - kTextInversionFocus ///< Indicates that the text should be drawn inverted, and focused + kTextInversionNone, ///< Indicates that the text should not be drawn inverted + kTextInversion, ///< Indicates that the text should be drawn inverted, but not focused + kTextInversionFocus ///< Indicates that the text should be drawn inverted, and focused }; enum ScrollbarState { @@ -193,34 +203,34 @@ public: /// Font style selector enum FontStyle { - kFontStyleBold = 0, ///< A bold font. This is also the default font. - kFontStyleNormal = 1, ///< A normal font. - kFontStyleItalic = 2, ///< Italic styled font. - kFontStyleFixedNormal = 3, ///< Fixed size font. - kFontStyleFixedBold = 4, ///< Fixed size bold font. - kFontStyleFixedItalic = 5, ///< Fixed size italic font. - kFontStyleTooltip = 6, ///< Tiny console font + kFontStyleBold = 0, ///< A bold font. This is also the default font. + kFontStyleNormal = 1, ///< A normal font. + kFontStyleItalic = 2, ///< Italic styled font. + kFontStyleFixedNormal = 3, ///< Fixed size font. + kFontStyleFixedBold = 4, ///< Fixed size bold font. + kFontStyleFixedItalic = 5, ///< Fixed size italic font. + kFontStyleTooltip = 6, ///< Tiny console font kFontStyleMax }; /// Font color selector enum FontColor { - kFontColorNormal = 0, ///< The default color of the theme - kFontColorAlternate = 1, ///< Alternative font color + kFontColorNormal = 0, ///< The default color of the theme + kFontColorAlternate = 1, ///< Alternative font color kFontColorMax }; /// Function used to process areas other than the current dialog enum ShadingStyle { - kShadingNone, ///< No special post processing - kShadingDim, ///< Dimming unused areas - kShadingLuminance ///< Converting colors to luminance for unused areas + kShadingNone, ///< No special post processing + kShadingDim, ///< Dimming unused areas + kShadingLuminance ///< Converting colors to luminance for unused areas }; // Special image ids for images used in the GUI - static const char * const kImageLogo; ///< ScummVM logo used in the launcher - static const char * const kImageLogoSmall; ///< ScummVM logo used in the GMM - static const char * const kImageSearch; ///< Search tool image used in the launcher + static const char *const kImageLogo; ///< ScummVM logo used in the launcher + static const char *const kImageLogoSmall; ///< ScummVM logo used in the GMM + static const char *const kImageSearch; ///< Search tool image used in the launcher /** * Graphics mode enumeration. @@ -228,9 +238,9 @@ public: * surface. */ enum GraphicsMode { - kGfxDisabled = 0, ///< No GFX - kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer. - kGfxAntialias16bit ///< 2BPP with the optimized AA renderer. + kGfxDisabled = 0, ///< No GFX + kGfxStandard16bit, ///< 2BPP with the standard (aliased) renderer. + kGfxAntialias16bit ///< 2BPP with the optimized AA renderer. }; /** Constant value to expand dirty rectangles, to make sure they are fully copied */ @@ -265,22 +275,22 @@ public: void disable(); /** - * Implementation of the GUI::Theme API. Called when a - * new dialog is opened. Note that the boolean parameter - * meaning has been changed. + * Implementation of the GUI::Theme API. Called when a + * new dialog is opened. Note that the boolean parameter + * meaning has been changed. * * @param enableBuffering If set to true, buffering is enabled for - * drawing this dialog, and will continue enabled - * until disabled. + * drawing this dialog, and will continue enabled + * until disabled. */ void openDialog(bool enableBuffering, ShadingStyle shading = kShadingNone); /** - * The updateScreen() method is called every frame. - * It processes all the drawing queues and then copies dirty rects - * in the current Screen surface to the overlay. + * The updateScreen() method is called every frame. + * It processes all the drawing queues and then copies dirty rects + * in the current Screen surface to the overlay. */ - void updateScreen(); + void updateScreen(bool render = true); /** @name FONT MANAGEMENT METHODS */ @@ -309,35 +319,35 @@ public: //@{ void drawWidgetBackground(const Common::Rect &r, uint16 hints, - WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled); + WidgetBackground background = kWidgetBackgroundPlain, WidgetStateInfo state = kStateEnabled); void drawButton(const Common::Rect &r, const Common::String &str, - WidgetStateInfo state = kStateEnabled, uint16 hints = 0); + WidgetStateInfo state = kStateEnabled, uint16 hints = 0); void drawSurface(const Common::Rect &r, const Graphics::Surface &surface, - WidgetStateInfo state = kStateEnabled, int alpha = 256, bool themeTrans = false); + WidgetStateInfo state = kStateEnabled, int alpha = 256, bool themeTrans = false); void drawSlider(const Common::Rect &r, int width, - WidgetStateInfo state = kStateEnabled); + WidgetStateInfo state = kStateEnabled); void drawCheckbox(const Common::Rect &r, const Common::String &str, - bool checked, WidgetStateInfo state = kStateEnabled); + bool checked, WidgetStateInfo state = kStateEnabled); void drawRadiobutton(const Common::Rect &r, const Common::String &str, - bool checked, WidgetStateInfo state = kStateEnabled); + bool checked, WidgetStateInfo state = kStateEnabled); void drawTab(const Common::Rect &r, int tabHeight, int tabWidth, - const Common::Array<Common::String> &tabs, int active, uint16 hints, - int titleVPad, WidgetStateInfo state = kStateEnabled); + const Common::Array<Common::String> &tabs, int active, uint16 hints, + int titleVPad, WidgetStateInfo state = kStateEnabled); void drawScrollbar(const Common::Rect &r, int sliderY, int sliderHeight, - ScrollbarState, WidgetStateInfo state = kStateEnabled); + ScrollbarState, WidgetStateInfo state = kStateEnabled); void drawPopUpWidget(const Common::Rect &r, const Common::String &sel, - int deltax, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignLeft); + int deltax, WidgetStateInfo state = kStateEnabled, Graphics::TextAlign align = Graphics::kTextAlignLeft); void drawCaret(const Common::Rect &r, bool erase, - WidgetStateInfo state = kStateEnabled); + WidgetStateInfo state = kStateEnabled); void drawLineSeparator(const Common::Rect &r, WidgetStateInfo state = kStateEnabled); @@ -362,13 +372,13 @@ public: /** - * Returns the DrawData enumeration value that represents the given string - * in the DrawDataDefaults enumeration. - * It's slow, but called sparsely. + * Returns the DrawData enumeration value that represents the given string + * in the DrawDataDefaults enumeration. + * It's slow, but called sparsely. * - * @returns The drawdata enum value, or -1 if not found. - * @param name The representing name, as found on Theme Description XML files. - * @see kDrawDataDefaults[] + * @returns The drawdata enum value, or -1 if not found. + * @param name The representing name, as found on Theme Description XML files. + * @see kDrawDataDefaults[] */ DrawData parseDrawDataId(const Common::String &name) const; @@ -377,34 +387,34 @@ public: /** - * Interface for ThemeParser class: Parsed DrawSteps are added via this function. - * There is no return type because DrawSteps can always be added, unless something - * goes horribly wrong. - * The specified step will be added to the Steps list of the given DrawData id. + * Interface for ThemeParser class: Parsed DrawSteps are added via this function. + * There is no return type because DrawSteps can always be added, unless something + * goes horribly wrong. + * The specified step will be added to the Steps list of the given DrawData id. * - * @param drawDataId The representing DrawData name, as found on Theme Description XML files. - * @param step The actual DrawStep struct to be added. + * @param drawDataId The representing DrawData name, as found on Theme Description XML files. + * @param step The actual DrawStep struct to be added. */ void addDrawStep(const Common::String &drawDataId, const Graphics::DrawStep &step); /** - * Interface for the ThemeParser class: Parsed DrawData sets are added via this function. - * The goal of the function is to initialize each DrawData set before their DrawSteps can - * be added, hence this must be called for each DD set before addDrawStep() can be called - * for that given set. + * Interface for the ThemeParser class: Parsed DrawData sets are added via this function. + * The goal of the function is to initialize each DrawData set before their DrawSteps can + * be added, hence this must be called for each DD set before addDrawStep() can be called + * for that given set. * - * @param data The representing DrawData name, as found on Theme Description XML files. - * @param cached Whether this DD set will be cached beforehand. + * @param data The representing DrawData name, as found on Theme Description XML files. + * @param cached Whether this DD set will be cached beforehand. */ bool addDrawData(const Common::String &data, bool cached); /** - * Interface for the ThemeParser class: Loads a font to use on the GUI from the given - * filename. + * Interface for the ThemeParser class: Loads a font to use on the GUI from the given + * filename. * - * @param fontName Identifier name for the font. - * @param file Name of the font file. + * @param fontName Identifier name for the font. + * @param file Name of the font file. */ bool addFont(TextData textId, const Common::String &file); @@ -418,25 +428,25 @@ public: /** - * Interface for the ThemeParser class: Loads a bitmap file to use on the GUI. - * The filename is also used as its identifier. + * Interface for the ThemeParser class: Loads a bitmap file to use on the GUI. + * The filename is also used as its identifier. * - * @param filename Name of the bitmap file. + * @param filename Name of the bitmap file. */ bool addBitmap(const Common::String &filename); /** - * Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the - * new Font API is in place. FIXME: Is that so ??? + * Adds a new TextStep from the ThemeParser. This will be deprecated/removed once the + * new Font API is in place. FIXME: Is that so ??? */ bool addTextData(const Common::String &drawDataId, TextData textId, TextColor id, Graphics::TextAlign alignH, TextAlignVertical alignV); protected: /** - * Returns if the Theme is ready to draw stuff on screen. - * Must be called instead of just checking _initOk, because - * this checks if the renderer is initialized AND if the theme - * is loaded. + * Returns if the Theme is ready to draw stuff on screen. + * Must be called instead of just checking _initOk, because + * this checks if the renderer is initialized AND if the theme + * is loaded. */ bool ready() const { return _initOk && _themeOk; @@ -446,15 +456,15 @@ protected: void loadTheme(const Common::String &themeid); /** - * Changes the active graphics mode of the GUI; may be used to either - * initialize the GUI or to change the mode while the GUI is already running. + * Changes the active graphics mode of the GUI; may be used to either + * initialize the GUI or to change the mode while the GUI is already running. */ void setGraphicsMode(GraphicsMode mode); public: /** - * Finishes buffering: widgets from then on will be drawn straight on the screen - * without drawing queues. + * Finishes buffering: widgets from then on will be drawn straight on the screen + * without drawing queues. */ inline void finishBuffering() { _buffering = false; } inline void startBuffering() { _buffering = true; } @@ -474,21 +484,21 @@ public: } /** - * Interface for the Theme Parser: Creates a new cursor by loading the given - * bitmap and sets it as the active cursor. + * Interface for the Theme Parser: Creates a new cursor by loading the given + * bitmap and sets it as the active cursor. * - * @param filename File name of the bitmap to load. - * @param hotspotX X Coordinate of the bitmap which does the cursor click. - * @param hotspotY Y Coordinate of the bitmap which does the cursor click. - * @param scale Scale at which the bitmap is supposed to be used. + * @param filename File name of the bitmap to load. + * @param hotspotX X Coordinate of the bitmap which does the cursor click. + * @param hotspotY Y Coordinate of the bitmap which does the cursor click. + * @param scale Scale at which the bitmap is supposed to be used. */ bool createCursor(const Common::String &filename, int hotspotX, int hotspotY, int scale); /** - * Wrapper for restoring data from the Back Buffer to the screen. - * The actual processing is done in the VectorRenderer. + * Wrapper for restoring data from the Back Buffer to the screen. + * The actual processing is done in the VectorRenderer. * - * @param r Area to restore. + * @param r Area to restore. */ void restoreBackground(Common::Rect r); @@ -498,33 +508,33 @@ public: protected: /** - * Initializes the drawing screen surfaces, _screen and _backBuffer. - * If the surfaces already exist, they are cleared and re-initialized. + * Initializes the drawing screen surfaces, _screen and _backBuffer. + * If the surfaces already exist, they are cleared and re-initialized. * - * @param backBuffer Sets whether the _backBuffer surface should be initialized. - * @template PixelType C type which specifies the size of each pixel. - * Defaults to uint16 (2 BPP for the surfaces) + * @param backBuffer Sets whether the _backBuffer surface should be initialized. + * @template PixelType C type which specifies the size of each pixel. + * Defaults to uint16 (2 BPP for the surfaces) */ template<typename PixelType> void screenInit(bool backBuffer = true); /** - * Loads the given theme into the ThemeEngine. + * Loads the given theme into the ThemeEngine. * - * @param themeId Theme identifier. - * @returns true if the theme was successfully loaded. + * @param themeId Theme identifier. + * @returns true if the theme was successfully loaded. */ bool loadThemeXML(const Common::String &themeId); /** - * Loads the default theme file (the embedded XML file found - * in ThemeDefaultXML.cpp). - * Called only when no other themes are available. + * Loads the default theme file (the embedded XML file found + * in ThemeDefaultXML.cpp). + * Called only when no other themes are available. */ bool loadDefaultXML(); /** - * Unloads the currently loaded theme so another one can - * be loaded. + * Unloads the currently loaded theme so another one can + * be loaded. */ void unloadTheme(); @@ -535,31 +545,31 @@ protected: Common::String genLocalizedFontFilename(const Common::String &filename) const; /** - * Actual Dirty Screen handling function. - * Handles all the dirty squares in the list, merges and optimizes - * them when possible and draws them to the screen. - * Called from updateScreen() + * Actual Dirty Screen handling function. + * Handles all the dirty squares in the list, merges and optimizes + * them when possible and draws them to the screen. + * Called from updateScreen() */ void renderDirtyScreen(); /** - * Generates a DrawQueue item and enqueues it so it's drawn to the screen - * when the drawing queue is processed. + * Generates a DrawQueue item and enqueues it so it's drawn to the screen + * when the drawing queue is processed. * - * If Buffering is enabled, the DrawQueue item will be automatically placed - * on its corresponding queue. - * If Buffering is disabled, the DrawQueue item will be processed immediately - * and drawn to the screen. + * If Buffering is enabled, the DrawQueue item will be automatically placed + * on its corresponding queue. + * If Buffering is disabled, the DrawQueue item will be processed immediately + * and drawn to the screen. * - * This function is called from all the Widget Drawing methods. + * This function is called from all the Widget Drawing methods. */ 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); void queueBitmap(const Graphics::Surface *bitmap, const Common::Rect &r, bool alpha); /** - * DEBUG: Draws a white square and writes some text next to it. + * DEBUG: Draws a white square and writes some text next to it. */ void debugWidgetPosition(const char *name, const Common::Rect &r); @@ -603,7 +613,7 @@ protected: Graphics::Surface _backBuffer; /** Sets whether the current drawing is being buffered (stored for later - processing) or drawn directly to the screen. */ + processing) or drawn directly to the screen. */ bool _buffering; /** Bytes per pixel of the Active Drawing Surface (i.e. the screen) */ @@ -643,7 +653,7 @@ protected: /** Queue with all the drawing that must be done to the screen */ Common::List<ThemeItem *> _screenQueue; - bool _initOk; ///< Class and renderer properly initialized + bool _initOk; ///< Class and renderer properly initialized bool _themeOk; ///< Theme data successfully loaded. bool _enabled; ///< Whether the Theme is currently shown on the overlay @@ -661,7 +671,7 @@ protected: byte *_cursor; bool _needPaletteUpdates; uint _cursorWidth, _cursorHeight; - byte _cursorPal[3*MAX_CURS_COLORS]; + byte _cursorPal[3 * MAX_CURS_COLORS]; byte _cursorPalSize; }; diff --git a/gui/ThemeEval.cpp b/gui/ThemeEval.cpp index 017d47fd29..64e18f93a3 100644 --- a/gui/ThemeEval.cpp +++ b/gui/ThemeEval.cpp @@ -24,10 +24,10 @@ */ #include "gui/ThemeEval.h" -#include "gui/widget.h" #include "graphics/scaler.h" +#include "common/system.h" #include "common/tokenizer.h" namespace GUI { diff --git a/gui/ThemeEval.h b/gui/ThemeEval.h index ac867512da..65bed3e271 100644 --- a/gui/ThemeEval.h +++ b/gui/ThemeEval.h @@ -30,6 +30,8 @@ #include "common/hashmap.h" #include "common/hash-str.h" #include "common/stack.h" +#include "common/str.h" +#include "common/textconsole.h" #include "graphics/font.h" #include "gui/ThemeLayout.h" diff --git a/gui/ThemeLayout.cpp b/gui/ThemeLayout.cpp index 3c930db73c..fbfc498bcb 100644 --- a/gui/ThemeLayout.cpp +++ b/gui/ThemeLayout.cpp @@ -25,14 +25,12 @@ #include "common/util.h" #include "common/system.h" -#include "common/events.h" -#include "common/xmlparser.h" -#include "gui/ThemeEval.h" #include "gui/ThemeLayout.h" -#ifdef LAYOUT_DEBUG_DIALOG #include "graphics/font.h" + +#ifdef LAYOUT_DEBUG_DIALOG #include "graphics/surface.h" #endif diff --git a/gui/ThemeLayout.h b/gui/ThemeLayout.h index 3d367df147..76d3f7d380 100644 --- a/gui/ThemeLayout.h +++ b/gui/ThemeLayout.h @@ -26,12 +26,13 @@ #ifndef THEME_LAYOUT_H #define THEME_LAYOUT_H +#include "common/array.h" #include "common/rect.h" +#include "graphics/font.h" #ifdef LAYOUT_DEBUG_DIALOG namespace Graphics { - class Font; - class Surface; +class Surface; } #endif diff --git a/gui/ThemeParser.cpp b/gui/ThemeParser.cpp index 70d81a962e..230dad8cc5 100644 --- a/gui/ThemeParser.cpp +++ b/gui/ThemeParser.cpp @@ -26,10 +26,10 @@ #include "gui/ThemeEngine.h" #include "gui/ThemeEval.h" #include "gui/ThemeParser.h" -#include "gui/gui-manager.h" #include "graphics/VectorRenderer.h" +#include "common/system.h" #include "common/tokenizer.h" namespace GUI { @@ -861,30 +861,50 @@ bool ThemeParser::resolutionCheck(const Common::String &resolution) { return true; Common::StringTokenizer globTokenizer(resolution, ", "); - Common::String cur, w, h; - bool definedRes = false; + Common::String cur; while (!globTokenizer.empty()) { - bool ignore = false; cur = globTokenizer.nextToken(); - if (cur[0] == '-') { - ignore = true; - cur.deleteChar(0); + bool lt; + int val; + + if (cur.size() < 5) { + warning("Invalid theme 'resolution' token '%s'", resolution.c_str()); + return false; + } + + if (cur[0] == 'x') { + val = g_system->getOverlayWidth(); + } else if (cur[0] == 'y') { + val = g_system->getOverlayHeight(); + } else { + warning("Error parsing theme 'resolution' token '%s'", resolution.c_str()); + return false; + } + + if (cur[1] == '<') { + lt = true; + } else if (cur[1] == '>') { + lt = false; } else { - definedRes = true; + warning("Error parsing theme 'resolution' token '%s'", resolution.c_str()); + return false; } - Common::StringTokenizer resTokenizer(cur, "x"); - w = resTokenizer.nextToken(); - h = resTokenizer.nextToken(); + int token = atoi(cur.c_str() + 2); - if ((w == "X" || atoi(w.c_str()) == g_system->getOverlayWidth()) && - (h == "Y" || atoi(h.c_str()) == g_system->getOverlayHeight())) - return !ignore; + // check inverse for unfulfilled requirements + if (lt) { + if (val >= token) + return false; + } else { + if (val <= token) + return false; + } } - return !definedRes; + return true; } } // End of namespace GUI diff --git a/gui/Tooltip.cpp b/gui/Tooltip.cpp index 7dec12d522..a7cb0610e7 100644 --- a/gui/Tooltip.cpp +++ b/gui/Tooltip.cpp @@ -23,7 +23,6 @@ */ #include "common/util.h" -#include "graphics/fontman.h" #include "gui/widget.h" #include "gui/dialog.h" #include "gui/gui-manager.h" diff --git a/gui/Tooltip.h b/gui/Tooltip.h index d228ca8a49..f5e2bb08a8 100644 --- a/gui/Tooltip.h +++ b/gui/Tooltip.h @@ -25,11 +25,14 @@ #ifndef GUI_TOOLTIP_H #define GUI_TOOLTIP_H +#include "common/keyboard.h" +#include "common/str-array.h" #include "gui/dialog.h" -#include "gui/widget.h" namespace GUI { +class Widget; + class Tooltip : public Dialog { public: Tooltip(); diff --git a/gui/about.cpp b/gui/about.cpp index c2d9a3f983..0389f4c8da 100644 --- a/gui/about.cpp +++ b/gui/about.cpp @@ -31,8 +31,6 @@ #include "common/util.h" #include "gui/about.h" #include "gui/gui-manager.h" -#include "gui/widget.h" - #include "gui/ThemeEval.h" namespace GUI { diff --git a/gui/about.h b/gui/about.h index fc216a78dc..b49365c5e5 100644 --- a/gui/about.h +++ b/gui/about.h @@ -27,7 +27,8 @@ #include "gui/dialog.h" #include "common/str.h" -#include "graphics/surface.h" +#include "common/array.h" +#include "common/keyboard.h" namespace GUI { diff --git a/gui/browser.cpp b/gui/browser.cpp index 4ee6bafdde..2c7459623f 100644 --- a/gui/browser.cpp +++ b/gui/browser.cpp @@ -23,7 +23,6 @@ */ #include "gui/browser.h" -#include "gui/gui-manager.h" #include "gui/widgets/list.h" #include "common/config-manager.h" diff --git a/gui/browser.h b/gui/browser.h index 1fef041a5a..eb3498e654 100644 --- a/gui/browser.h +++ b/gui/browser.h @@ -26,13 +26,13 @@ #define BROWSER_DIALOG_H #include "gui/dialog.h" -#include "common/str.h" #include "common/fs.h" namespace GUI { class ListWidget; class StaticTextWidget; +class CommandSender; class BrowserDialog : public Dialog { public: diff --git a/gui/chooser.cpp b/gui/chooser.cpp index f5e7d26a32..ecc8ebd894 100644 --- a/gui/chooser.cpp +++ b/gui/chooser.cpp @@ -22,10 +22,9 @@ * $Id$ */ -#include "common/system.h" #include "common/translation.h" #include "gui/chooser.h" -#include "gui/gui-manager.h" +#include "gui/widget.h" #include "gui/widgets/list.h" namespace GUI { diff --git a/gui/chooser.h b/gui/chooser.h index ce67c008df..79a20383c5 100644 --- a/gui/chooser.h +++ b/gui/chooser.h @@ -25,12 +25,14 @@ #ifndef CHOOSER_DIALOG_H #define CHOOSER_DIALOG_H +#include "common/array.h" #include "common/str.h" #include "gui/dialog.h" namespace GUI { class ButtonWidget; +class CommandSender; class ListWidget; /* diff --git a/gui/console.cpp b/gui/console.cpp index cb3319063d..cbab1b212e 100644 --- a/gui/console.cpp +++ b/gui/console.cpp @@ -27,10 +27,8 @@ #include "gui/ThemeEval.h" #include "gui/gui-manager.h" -#include "engines/engine.h" #include "base/version.h" -#include "common/events.h" #include "common/system.h" #include "graphics/fontman.h" diff --git a/gui/credits.h b/gui/credits.h index 926adf4c9c..7ad480032e 100644 --- a/gui/credits.h +++ b/gui/credits.h @@ -158,8 +158,10 @@ static const char *credits[] = { "C0""Filippos Karapetis", "", "C1""Mohawk", +"C0""Bastien Bouclet", "C0""Matthew Hoops", "C0""Filippos Karapetis", +"C0""Alyssa Milburn", "C0""Eugene Sandulenko", "C0""David Turner", "", @@ -204,12 +206,17 @@ static const char *credits[] = { "C1""Touch\351", "C0""Gregory Montoir", "", +"C1""TsAGE", +"C0""Paul Gilbert", +"C0""Arnaud Boutonn\351", +"", "C1""Tucker", "C0""Gregory Montoir", "", "", "C1""Backend Teams", "C1""Android", +"C0""Andre Heider", "C0""Angus Lees", "", "C1""Dreamcast", @@ -259,6 +266,9 @@ static const char *credits[] = { "C0""Jurgen Braam", "C0""Lars Persson", "", +"C1""WebOS", +"C0""Klaus Reimer", +"", "C1""Wii", "C0""Andre Heider", "", @@ -279,7 +289,7 @@ static const char *credits[] = { "C0""David Corrales-Lopez", "C2""Filesystem access improvements (GSoC 2007 task) (retired)", "C0""Jerome Fisher", -"C2""MT-32 emulator (retired)", +"C2""MT-32 emulator", "C0""Benjamin Haisch", "C2""Heavily improved de-/encoder for DXA videos", "C0""Jochen Hoenicke", @@ -294,6 +304,23 @@ static const char *credits[] = { "C0""Fredrik Wendel", "C2""(retired)", "", +"C1""Website (maintenance)", +"C0""James Brown", +"C2""IRC Logs maintainer", +"C0""Thierry Crozat", +"C2""Wiki maintainer", +"C0""Andre Heider", +"C2""Buildbot maintainer", +"C0""Max Horn", +"C2""Forum, IRC channel and Mailing list maintainer", +"C0""Joost Peters", +"C2""Doxygen Project Documentation maintainer", +"C0""Jordi Vilalta Prat", +"C2""Wiki maintainer", +"C0""Eugene Sandulenko", +"C2""Forum, IRC channel, Screen Shots and Mailing list maintainer", +"C0""John Willis", +"", "C1""Website (content)", "C0""All active team members", "C0""", @@ -430,6 +457,9 @@ static const char *credits[] = { "C1""Spanish", "C0""Tom\341s Maidagan", "", +"C1""Swedish", +"C0""Hampus Flink", +"", "C1""Ukrainian", "C0""Lubomyr Lisen", "", @@ -445,6 +475,8 @@ static const char *credits[] = { "C2""ScummVM logo", "C0""Raina", "C2""ScummVM forum buttons", +"C0""William Claydon", +"C2""Skins for doxygen, buildbot and wiki", "", "C1""Code contributions", "C0""Ori Avtalion", @@ -456,7 +488,7 @@ static const char *credits[] = { "C0""Martin Doucha", "C2""CinE engine objectification", "C0""Thomas Fach-Pedersen", -"C2""ProTracker module player", +"C2""ProTracker module player, Smacker video decoder", "C0""Tobias Gunkel", "C2""Sound support for C64 version of MM/Zak, Loom PCE support", "C0""Janne Huttunen", @@ -621,7 +653,7 @@ static const char *credits[] = { "C0""", "C0""Emilio de Paz Aragon from Alcachofa Soft for sharing the source code of Drascula: The Vampire Strikes Back with us and his generosity with freewaring the game.", "C0""", -"C0""David P. Gray from Gray Design Associate for sharing the source code of the Hugo trilogy.", +"C0""David P. Gray from Gray Design Associates for sharing the source code of the Hugo trilogy.", "C0""", "C0""Broken Sword 2.5 team for providing sources of their engine and their great support.", "C0""", diff --git a/gui/debugger.cpp b/gui/debugger.cpp index f113206ea1..2282bc3a1c 100644 --- a/gui/debugger.cpp +++ b/gui/debugger.cpp @@ -26,7 +26,6 @@ // NB: This is really only necessary if USE_READLINE is defined #define FORBIDDEN_SYMBOL_ALLOW_ALL -#include "common/debug.h" #include "common/debug-channels.h" #include "common/system.h" diff --git a/gui/dialog.cpp b/gui/dialog.cpp index 2c2b0603d6..15e47141c8 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -22,14 +22,11 @@ * $Id$ */ -#include "common/events.h" +#include "common/rect.h" #include "gui/gui-manager.h" #include "gui/dialog.h" #include "gui/widget.h" -#include "gui/widgets/popup.h" - -#include "common/system.h" namespace GUI { diff --git a/gui/dialog.h b/gui/dialog.h index 1845786044..c298ef107b 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -27,14 +27,14 @@ #include "common/scummsys.h" #include "common/str.h" +#include "common/keyboard.h" #include "gui/object.h" -#include "gui/widget.h" +#include "gui/ThemeEngine.h" namespace GUI { -class GuiManager; -class PopUpWidget; +class Widget; // Some "common" commands sent to handleCommand() enum { diff --git a/gui/error.cpp b/gui/error.cpp index 3332eb533a..f6da795d40 100644 --- a/gui/error.cpp +++ b/gui/error.cpp @@ -36,10 +36,10 @@ void displayErrorDialog(const char *text) { alert.runModal(); } -void displayErrorDialog(Common::Error error, const char *extraText) { +void displayErrorDialog(const Common::Error &error, const char *extraText) { Common::String errorText(extraText); errorText += " "; - errorText += _(Common::errorToString(error)); + errorText += _(error.getDesc()); GUI::MessageDialog alert(errorText); alert.runModal(); } diff --git a/gui/error.h b/gui/error.h index a55f555bed..f048a0cd09 100644 --- a/gui/error.h +++ b/gui/error.h @@ -36,7 +36,7 @@ namespace GUI { * @param error error code * @param extraText extra text to be displayed in addition to default string description(optional) */ -void displayErrorDialog(Common::Error error, const char *extraText = ""); +void displayErrorDialog(const Common::Error &error, const char *extraText = ""); /** * Displays an error dialog for a given message. diff --git a/gui/gui-manager.cpp b/gui/gui-manager.cpp index 7644cbe7b2..19ca66b7b1 100644 --- a/gui/gui-manager.cpp +++ b/gui/gui-manager.cpp @@ -27,7 +27,8 @@ #include "common/util.h" #include "common/config-manager.h" #include "common/algorithm.h" -#include "common/timer.h" +#include "common/rect.h" +#include "common/textconsole.h" #include "common/translation.h" #include "backends/keymapper/keymapper.h" @@ -37,6 +38,7 @@ #include "gui/ThemeEngine.h" #include "gui/ThemeEval.h" #include "gui/Tooltip.h" +#include "gui/widget.h" #include "graphics/cursorman.h" @@ -201,14 +203,15 @@ void GuiManager::redraw() { _theme->clearAll(); _theme->openDialog(true, ThemeEngine::kShadingNone); - for (i = 0; i < _dialogStack.size() - 1; i++) { + for (i = 0; i < _dialogStack.size() - 1; i++) _dialogStack[i]->drawDialog(); - } _theme->finishBuffering(); + // fall through + case kRedrawOpenDialog: - _theme->updateScreen(); + _theme->updateScreen(false); _theme->openDialog(true, shading); _dialogStack.top()->drawDialog(); _theme->finishBuffering(); @@ -293,7 +296,6 @@ void GuiManager::runLoop() { Common::Event event; while (eventMan->pollEvent(event)) { - // The top dialog can change during the event loop. In that case, flush all the // dialog-related events since they were probably generated while the old dialog // was still visible, and therefore not intended for the new one. @@ -305,12 +307,6 @@ void GuiManager::runLoop() { Common::Point mouse(event.mouse.x - activeDialog->_x, event.mouse.y - activeDialog->_y); - if (lastRedraw + waitTime < _system->getMillis()) { - _theme->updateScreen(); - _system->updateScreen(); - lastRedraw = _system->getMillis(); - } - switch (event.type) { case Common::EVENT_KEYDOWN: activeDialog->handleKeyDown(event.kbd); @@ -365,6 +361,12 @@ void GuiManager::runLoop() { default: break; } + + if (lastRedraw + waitTime < _system->getMillis()) { + _theme->updateScreen(); + _system->updateScreen(); + lastRedraw = _system->getMillis(); + } } if (tooltipCheck && _lastMousePosition.time + kTooltipDelay < _system->getMillis()) { diff --git a/gui/gui-manager.h b/gui/gui-manager.h index a6c90bfe8d..ac4118bb06 100644 --- a/gui/gui-manager.h +++ b/gui/gui-manager.h @@ -30,13 +30,14 @@ #include "common/stack.h" #include "common/str.h" -#include "graphics/font.h" - -#include "gui/widget.h" #include "gui/ThemeEngine.h" class OSystem; +namespace Graphics { +class Font; +} + namespace GUI { class Dialog; diff --git a/gui/launcher.cpp b/gui/launcher.cpp index 1d209ce71a..aed57decd3 100644 --- a/gui/launcher.cpp +++ b/gui/launcher.cpp @@ -28,7 +28,6 @@ #include "common/events.h" #include "common/fs.h" #include "common/util.h" -#include "common/savefile.h" #include "common/system.h" #include "common/translation.h" @@ -49,9 +48,6 @@ #include "graphics/cursorman.h" -#include "audio/mididrv.h" - - using Common::ConfigManager; namespace GUI { diff --git a/gui/launcher.h b/gui/launcher.h index df9a6fb639..274fc45bb4 100644 --- a/gui/launcher.h +++ b/gui/launcher.h @@ -31,10 +31,13 @@ namespace GUI { class BrowserDialog; +class CommandSender; class ListWidget; +class ButtonWidget; class GraphicsWidget; -class SaveLoadChooser; +class StaticTextWidget; class EditTextWidget; +class SaveLoadChooser; Common::String addGameToConf(const GameDescriptor &result); diff --git a/gui/massadd.cpp b/gui/massadd.cpp index 197caae675..80d580d2a0 100644 --- a/gui/massadd.cpp +++ b/gui/massadd.cpp @@ -24,14 +24,13 @@ #include "engines/metaengine.h" #include "common/algorithm.h" -#include "common/events.h" -#include "common/func.h" #include "common/config-manager.h" +#include "common/debug.h" +#include "common/system.h" #include "common/translation.h" #include "gui/launcher.h" // For addGameToConf() #include "gui/massadd.h" -#include "gui/gui-manager.h" #include "gui/widget.h" #include "gui/widgets/list.h" @@ -63,6 +62,7 @@ enum { MassAddDialog::MassAddDialog(const Common::FSNode &startDir) : Dialog("MassAdd"), _dirsScanned(0), + _oldGamesCount(0), _okButton(0), _dirProgressText(0), _gameProgressText(0) { @@ -213,8 +213,10 @@ void MassAddDialog::handleTickle() { break; } } - if (duplicate) + if (duplicate) { + _oldGamesCount++; break; // Skip duplicates + } } result["path"] = path; _games.push_back(result); @@ -244,14 +246,14 @@ void MassAddDialog::handleTickle() { snprintf(buf, sizeof(buf), "%s", _("Scan complete!")); _dirProgressText->setLabel(buf); - snprintf(buf, sizeof(buf), _("Discovered %d new games."), _games.size()); + snprintf(buf, sizeof(buf), _("Discovered %d new games, ignored %d previously added games."), _games.size(), _oldGamesCount); _gameProgressText->setLabel(buf); } else { snprintf(buf, sizeof(buf), _("Scanned %d directories ..."), _dirsScanned); _dirProgressText->setLabel(buf); - snprintf(buf, sizeof(buf), _("Discovered %d new games ..."), _games.size()); + snprintf(buf, sizeof(buf), _("Discovered %d new games, ignored %d previously added games ..."), _games.size(), _oldGamesCount); _gameProgressText->setLabel(buf); } diff --git a/gui/massadd.h b/gui/massadd.h index 31a8821a26..6aad392b0d 100644 --- a/gui/massadd.h +++ b/gui/massadd.h @@ -30,7 +30,6 @@ #include "common/hashmap.h" #include "common/stack.h" #include "common/str.h" -#include "common/hash-str.h" namespace GUI { @@ -63,6 +62,7 @@ private: Common::HashMap<Common::String, StringArray> _pathToTargets; int _dirsScanned; + int _oldGamesCount; Widget *_okButton; StaticTextWidget *_dirProgressText; diff --git a/gui/message.cpp b/gui/message.cpp index 2d097a75a9..5cb4cec3d3 100644 --- a/gui/message.cpp +++ b/gui/message.cpp @@ -22,7 +22,6 @@ * $Id$ */ -#include "common/events.h" #include "common/str.h" #include "common/system.h" #include "gui/message.h" diff --git a/gui/message.h b/gui/message.h index 912e3b0785..5c3308e425 100644 --- a/gui/message.h +++ b/gui/message.h @@ -30,6 +30,8 @@ namespace GUI { +class CommandSender; + enum { kMessageOK = 1, kMessageCancel = 0 diff --git a/gui/object.cpp b/gui/object.cpp index bf8e7a8642..6564fe2b68 100644 --- a/gui/object.cpp +++ b/gui/object.cpp @@ -22,7 +22,8 @@ * $Id$ */ -#include "common/system.h" +#include "common/textconsole.h" + #include "gui/object.h" #include "gui/widget.h" #include "gui/gui-manager.h" diff --git a/gui/object.h b/gui/object.h index fb5ff18290..3b181fd8a3 100644 --- a/gui/object.h +++ b/gui/object.h @@ -25,9 +25,11 @@ #ifndef GUI_OBJECT_H #define GUI_OBJECT_H +#include "common/scummsys.h" +#include "common/str.h" + namespace GUI { -class CommandReceiver; class CommandSender; class CommandReceiver { diff --git a/gui/options.cpp b/gui/options.cpp index a540fbb9d1..547ab0f3c6 100644 --- a/gui/options.cpp +++ b/gui/options.cpp @@ -24,10 +24,8 @@ #include "gui/browser.h" #include "gui/themebrowser.h" -#include "gui/chooser.h" #include "gui/message.h" #include "gui/gui-manager.h" -#include "gui/ThemeEval.h" #include "gui/options.h" #include "gui/widgets/popup.h" #include "gui/widgets/tab.h" @@ -35,10 +33,9 @@ #include "common/fs.h" #include "common/config-manager.h" #include "common/system.h" +#include "common/textconsole.h" #include "common/translation.h" -#include "graphics/scaler.h" - #include "audio/mididrv.h" #include "audio/musicplugin.h" #include "audio/mixer.h" @@ -144,6 +141,7 @@ void OptionsDialog::init() { _subSpeedDesc = 0; _subSpeedSlider = 0; _subSpeedLabel = 0; + _oldTheme = ConfMan.get("gui_theme"); // Retrieve game GUI options _guioptions = 0; @@ -509,6 +507,13 @@ void OptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data setResult(1); close(); break; + case kCloseCmd: + if (g_gui.theme()->getThemeId() != _oldTheme) { + g_gui.loadNewTheme(_oldTheme); + ConfMan.set("gui_theme", _oldTheme); + } + close(); + break; default: Dialog::handleCommand(sender, cmd, data); } @@ -1316,7 +1321,6 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 #ifdef USE_TRANSLATION Common::String lang = TransMan.getCurrentLanguage(); #endif - Common::String oldTheme = g_gui.theme()->getThemeId(); if (g_gui.loadNewTheme(theme)) { #ifdef USE_TRANSLATION // If the charset has changed, it means the font were not found for the @@ -1324,7 +1328,7 @@ void GlobalOptionsDialog::handleCommand(CommandSender *sender, uint32 cmd, uint3 // language without restarting, we let the user know about this. if (lang != TransMan.getCurrentLanguage()) { TransMan.setLanguage(lang.c_str()); - g_gui.loadNewTheme(oldTheme); + g_gui.loadNewTheme(_oldTheme); MessageDialog error(_("The theme you selected does not support your current language. If you want to use this theme you need to switch to another language first.")); error.runModal(); } else { diff --git a/gui/options.h b/gui/options.h index eba1779b69..c097a3a9e9 100644 --- a/gui/options.h +++ b/gui/options.h @@ -27,7 +27,7 @@ #include "gui/dialog.h" #include "common/str.h" -#include "audio/musicplugin.h" +#include "audio/mididrv.h" #ifdef SMALL_SCREEN_DEVICE #include "gui/KeysDialog.h" @@ -35,13 +35,16 @@ namespace GUI { -class BrowserDialog; class CheckboxWidget; class PopUpWidget; class SliderWidget; class StaticTextWidget; -class ListWidget; class TabWidget; +class ButtonWidget; +class CommandSender; +class GuiObject; +class RadiobuttonGroup; +class RadiobuttonWidget; class OptionsDialog : public Dialog { public: @@ -174,6 +177,11 @@ protected: // uint32 _guioptions; Common::String _guioptionsString; + + // + //Theme Options + // + Common::String _oldTheme; }; diff --git a/gui/saveload.h b/gui/saveload.h index b3622c1f13..06f1251e11 100644 --- a/gui/saveload.h +++ b/gui/saveload.h @@ -32,6 +32,10 @@ namespace GUI { class ListWidget; class GraphicsWidget; +class ButtonWidget; +class CommandSender; +class ContainerWidget; +class StaticTextWidget; class SaveLoadChooser : GUI::Dialog { typedef Common::String String; diff --git a/gui/themebrowser.h b/gui/themebrowser.h index aba519886d..bd6b11fb46 100644 --- a/gui/themebrowser.h +++ b/gui/themebrowser.h @@ -33,8 +33,8 @@ namespace GUI { +class CommandSender; class ListWidget; -class StaticTextWidget; class ThemeBrowser : public Dialog { public: diff --git a/gui/themes/default.inc b/gui/themes/default.inc index 3236071055..2716e6ca72 100644 --- a/gui/themes/default.inc +++ b/gui/themes/default.inc @@ -1,5 +1,5 @@ "<?xml version = '1.0'?>" -"<layout_info resolution='-320xY,-256x240,-Xx272,-544x332,-Xx350'> " +"<layout_info resolution='y>399'> " "<globals> " "<def var='Line.Height' value='16' /> " "<def var='Font.Height' value='16' /> " @@ -789,7 +789,7 @@ "</layout> " "</dialog> " "</layout_info> " -"<layout_info resolution='320xY,256x240,Xx272,544x332,Xx350'> " +"<layout_info resolution='y<400'> " "<globals> " "<def var='Line.Height' value='12' /> " "<def var='Font.Height' value='10' /> " @@ -1602,21 +1602,21 @@ "<font id='text_default' " "file='helvb12.bdf' " "/> " -"<font resolution='320xY,256x240' " +"<font resolution='y<400' " "id='text_default' " "file='clR6x12.bdf' " "/> " "<font id='text_button' " "file='helvb12.bdf' " "/> " -"<font resolution='320xY,256x240' " +"<font resolution='y<400' " "id='text_button' " "file='clR6x12.bdf' " "/> " "<font id='text_normal' " "file='helvb12.bdf' " "/> " -"<font resolution='320xY,256x240' " +"<font resolution='y<400' " "id='text_normal' " "file='clR6x12.bdf' " "/> " diff --git a/gui/themes/scummclassic.zip b/gui/themes/scummclassic.zip Binary files differindex 9fd2c187fd..4dbedd4f14 100644 --- a/gui/themes/scummclassic.zip +++ b/gui/themes/scummclassic.zip diff --git a/gui/themes/scummclassic/THEMERC b/gui/themes/scummclassic/THEMERC index f0276969fe..17e934d5ef 100644 --- a/gui/themes/scummclassic/THEMERC +++ b/gui/themes/scummclassic/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.2:ScummVM Classic Theme:No Author] +[SCUMMVM_STX0.8.3:ScummVM Classic Theme:No Author] diff --git a/gui/themes/scummclassic/classic_gfx.stx b/gui/themes/scummclassic/classic_gfx.stx index d672db2540..3fd00abbb9 100644 --- a/gui/themes/scummclassic/classic_gfx.stx +++ b/gui/themes/scummclassic/classic_gfx.stx @@ -46,21 +46,21 @@ <font id = 'text_default' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_default' file = 'clR6x12.bdf' /> <font id = 'text_button' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_button' file = 'clR6x12.bdf' /> <font id = 'text_normal' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_normal' file = 'clR6x12.bdf' /> diff --git a/gui/themes/scummclassic/classic_layout.stx b/gui/themes/scummclassic/classic_layout.stx index 416ffb30eb..f09c29e360 100644 --- a/gui/themes/scummclassic/classic_layout.stx +++ b/gui/themes/scummclassic/classic_layout.stx @@ -23,7 +23,7 @@ - $Id$ - --> -<layout_info resolution = '-320xY, -256x240, -Xx272, -544x332, -Xx350'> +<layout_info resolution = 'y>399'> <globals> <def var = 'Line.Height' value = '16' /> <def var = 'Font.Height' value = '16' /> diff --git a/gui/themes/scummclassic/classic_layout_lowres.stx b/gui/themes/scummclassic/classic_layout_lowres.stx index fe0eb66b8d..a440be7694 100644 --- a/gui/themes/scummclassic/classic_layout_lowres.stx +++ b/gui/themes/scummclassic/classic_layout_lowres.stx @@ -23,7 +23,7 @@ - $Id$ - --> -<layout_info resolution = "320xY, 256x240, Xx272, 544x332, Xx350"> +<layout_info resolution = 'y<400'> <globals> <def var = 'Line.Height' value = '12' /> <def var = 'Font.Height' value = '10' /> diff --git a/gui/themes/scummmodern.zip b/gui/themes/scummmodern.zip Binary files differindex f4e18ef00c..1e44442933 100644 --- a/gui/themes/scummmodern.zip +++ b/gui/themes/scummmodern.zip diff --git a/gui/themes/scummmodern/THEMERC b/gui/themes/scummmodern/THEMERC index b8f41fc207..f947a5685a 100644 --- a/gui/themes/scummmodern/THEMERC +++ b/gui/themes/scummmodern/THEMERC @@ -1 +1 @@ -[SCUMMVM_STX0.8.2:ScummVM Modern Theme:No Author] +[SCUMMVM_STX0.8.3:ScummVM Modern Theme:No Author] diff --git a/gui/themes/scummmodern/scummmodern_gfx.stx b/gui/themes/scummmodern/scummmodern_gfx.stx index cfe00a7016..a325d4982b 100644 --- a/gui/themes/scummmodern/scummmodern_gfx.stx +++ b/gui/themes/scummmodern/scummmodern_gfx.stx @@ -108,21 +108,21 @@ <font id = 'text_default' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_default' file = 'clR6x12.bdf' /> <font id = 'text_button' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_button' file = 'clR6x12.bdf' /> <font id = 'text_normal' file = 'helvb12.bdf' /> - <font resolution = '320xY, 256x240' + <font resolution = 'y<400' id = 'text_normal' file = 'clR6x12.bdf' /> @@ -178,7 +178,7 @@ <!-- <defaults fill = 'gradient' fg_color = 'white'/> --> <cursor file = 'cursor.bmp' hotspot = '0, 0' scale = '3'/> - <cursor resolution = '320xY, 256x240' file = 'cursor_small.bmp' hotspot = '0, 0' scale = '3'/> + <cursor resolution = 'y<400' file = 'cursor_small.bmp' hotspot = '0, 0' scale = '3'/> <!-- Selection (text or list items) --> <drawdata id = 'text_selection' cache = 'false'> diff --git a/gui/themes/scummmodern/scummmodern_layout.stx b/gui/themes/scummmodern/scummmodern_layout.stx index 879be2aafe..c0433ceb9a 100644 --- a/gui/themes/scummmodern/scummmodern_layout.stx +++ b/gui/themes/scummmodern/scummmodern_layout.stx @@ -23,7 +23,7 @@ - $Id$ - --> -<layout_info resolution = '-320xY, -256x240, -Xx272, -544x332, -Xx350'> +<layout_info resolution = 'y>399'> <globals> <def var = 'Line.Height' value = '16' /> <def var = 'Font.Height' value = '16' /> @@ -128,7 +128,7 @@ /> <space /> <widget name = 'Version' - width = '247' + width = '310' height = 'Globals.Line.Height' textalign = 'center' /> diff --git a/gui/themes/scummmodern/scummmodern_layout_lowres.stx b/gui/themes/scummmodern/scummmodern_layout_lowres.stx index 3a7a4b63b9..06916a80f1 100644 --- a/gui/themes/scummmodern/scummmodern_layout_lowres.stx +++ b/gui/themes/scummmodern/scummmodern_layout_lowres.stx @@ -23,7 +23,7 @@ - $Id$ - --> -<layout_info resolution = "320xY, 256x240, Xx272, 544x332, Xx350"> +<layout_info resolution = 'y<400'> <globals> <def var = 'Line.Height' value = '12' /> <def var = 'Font.Height' value = '10' /> diff --git a/gui/themes/translations.dat b/gui/themes/translations.dat Binary files differindex 69e4c80804..86de121d1a 100644 --- a/gui/themes/translations.dat +++ b/gui/themes/translations.dat diff --git a/gui/widget.cpp b/gui/widget.cpp index 61f4a0e249..d3c8d3402d 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -22,10 +22,12 @@ * $Id$ */ -#include "common/util.h" -#include "graphics/fontman.h" +#include "common/scummsys.h" +#include "common/system.h" +#include "common/rect.h" +#include "common/textconsole.h" +#include "graphics/pixelformat.h" #include "gui/widget.h" -#include "gui/dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" @@ -345,7 +347,7 @@ void PicButtonWidget::setGfx(const Graphics::Surface *gfx) { void PicButtonWidget::drawWidget() { g_gui.theme()->drawButton(Common::Rect(_x, _y, _x+_w, _y+_h), "", _state, getFlags()); - if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) { + if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) { const int x = _x + (_w - _gfx.w) / 2; const int y = _y + (_h - _gfx.h) / 2; @@ -573,11 +575,12 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { if (h == -1) h = _h; + Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat(); + _gfx.free(); - _gfx.create(w, h, sizeof(OverlayColor)); + _gfx.create(w, h, overlayFormat); OverlayColor *dst = (OverlayColor *)_gfx.pixels; - Graphics::PixelFormat overlayFormat = g_system->getOverlayFormat(); OverlayColor fillCol = overlayFormat.RGBToColor(r, g, b); while (h--) { for (int i = 0; i < w; ++i) { @@ -587,7 +590,7 @@ void GraphicsWidget::setGfx(int w, int h, int r, int g, int b) { } void GraphicsWidget::drawWidget() { - if (sizeof(OverlayColor) == _gfx.bytesPerPixel && _gfx.pixels) { + if (sizeof(OverlayColor) == _gfx.format.bytesPerPixel && _gfx.pixels) { const int x = _x + (_w - _gfx.w) / 2; const int y = _y + (_h - _gfx.h) / 2; diff --git a/gui/widget.h b/gui/widget.h index 1bb9823fdf..9acccd9684 100644 --- a/gui/widget.h +++ b/gui/widget.h @@ -26,17 +26,16 @@ #define GUI_WIDGET_H #include "common/scummsys.h" +#include "common/array.h" #include "common/str.h" -#include "common/str-array.h" #include "common/keyboard.h" +#include "graphics/font.h" #include "graphics/surface.h" #include "gui/object.h" #include "gui/ThemeEngine.h" namespace GUI { -class Dialog; - enum { WIDGET_ENABLED = 1 << 0, WIDGET_INVISIBLE = 1 << 1, diff --git a/gui/widgets/editable.cpp b/gui/widgets/editable.cpp index 7d6e0fae01..2ee3575bc6 100644 --- a/gui/widgets/editable.cpp +++ b/gui/widgets/editable.cpp @@ -22,9 +22,11 @@ * $Id$ */ -#include "common/events.h" +#include "common/rect.h" +#include "common/system.h" #include "gui/widgets/editable.h" #include "gui/gui-manager.h" +#include "graphics/font.h" namespace GUI { diff --git a/gui/widgets/editable.h b/gui/widgets/editable.h index b394e105d1..e0b6375919 100644 --- a/gui/widgets/editable.h +++ b/gui/widgets/editable.h @@ -25,9 +25,15 @@ #ifndef GUI_WIDGETS_EDITABLE_H #define GUI_WIDGETS_EDITABLE_H +#include "common/keyboard.h" #include "common/str.h" -#include "common/rect.h" #include "gui/widget.h" +#include "gui/ThemeEngine.h" +#include "gui/object.h" + +namespace Common { +struct Rect; +} namespace GUI { diff --git a/gui/widgets/edittext.cpp b/gui/widgets/edittext.cpp index 3ef813283e..106262bafe 100644 --- a/gui/widgets/edittext.cpp +++ b/gui/widgets/edittext.cpp @@ -23,25 +23,26 @@ */ #include "gui/widgets/edittext.h" -#include "gui/dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" namespace GUI { -EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip, uint32 cmd) + EditTextWidget::EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip, uint32 cmd, uint32 finishCmd) : EditableWidget(boss, x, y - 1, w, h + 2, tooltip, cmd) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE); _type = kEditTextWidget; + _finishCmd = finishCmd; setEditString(text); } -EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltip, uint32 cmd) +EditTextWidget::EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltip, uint32 cmd, uint32 finishCmd) : EditableWidget(boss, name, tooltip, cmd) { setFlags(WIDGET_ENABLED | WIDGET_CLEARBG | WIDGET_RETAIN_FOCUS | WIDGET_WANT_TICKLE); _type = kEditTextWidget; + _finishCmd = finishCmd; setEditString(text); } @@ -107,6 +108,8 @@ void EditTextWidget::startEditMode() { void EditTextWidget::endEditMode() { releaseFocus(); + + sendCommand(_finishCmd, 0); } void EditTextWidget::abortEditMode() { diff --git a/gui/widgets/edittext.h b/gui/widgets/edittext.h index a2549882ca..b94e58780c 100644 --- a/gui/widgets/edittext.h +++ b/gui/widgets/edittext.h @@ -41,8 +41,8 @@ protected: int _rightPadding; public: - EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip = 0, uint32 cmd = 0); - EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltp = 0, uint32 cmd = 0); + EditTextWidget(GuiObject *boss, int x, int y, int w, int h, const String &text, const char *tooltip = 0, uint32 cmd = 0, uint32 finishCmd = 0); + EditTextWidget(GuiObject *boss, const String &name, const String &text, const char *tooltp = 0, uint32 cmd = 0, uint32 finishCmd = 0); void setEditString(const String &str); @@ -62,6 +62,8 @@ protected: void abortEditMode(); Common::Rect getEditRect() const; + + uint32 _finishCmd; }; } // End of namespace GUI diff --git a/gui/widgets/list.cpp b/gui/widgets/list.cpp index 1e13226d61..1f7846c503 100644 --- a/gui/widgets/list.cpp +++ b/gui/widgets/list.cpp @@ -23,7 +23,6 @@ */ #include "common/system.h" -#include "common/events.h" #include "common/frac.h" #include "common/tokenizer.h" diff --git a/gui/widgets/popup.cpp b/gui/widgets/popup.cpp index 02cbd940b2..cab556065f 100644 --- a/gui/widgets/popup.cpp +++ b/gui/widgets/popup.cpp @@ -23,11 +23,9 @@ */ #include "common/system.h" -#include "common/events.h" #include "gui/dialog.h" #include "gui/gui-manager.h" #include "gui/widgets/popup.h" -#include "engines/engine.h" #include "gui/ThemeEval.h" diff --git a/gui/widgets/scrollbar.cpp b/gui/widgets/scrollbar.cpp index 5e963e04fe..38383c0e55 100644 --- a/gui/widgets/scrollbar.cpp +++ b/gui/widgets/scrollbar.cpp @@ -22,11 +22,12 @@ * $Id$ */ +#include "common/rect.h" +#include "common/system.h" +#include "common/timer.h" #include "gui/widgets/scrollbar.h" -#include "gui/dialog.h" #include "gui/gui-manager.h" - -#include "common/timer.h" +#include "gui/ThemeEngine.h" namespace GUI { diff --git a/gui/widgets/tab.cpp b/gui/widgets/tab.cpp index 10baeac901..721fb88cf8 100644 --- a/gui/widgets/tab.cpp +++ b/gui/widgets/tab.cpp @@ -24,7 +24,6 @@ #include "common/util.h" #include "gui/widgets/tab.h" -#include "gui/dialog.h" #include "gui/gui-manager.h" #include "gui/ThemeEval.h" |