diff options
-rw-r--r-- | base/main.cpp | 4 | ||||
-rw-r--r-- | engines/scumm/dialogs.cpp | 2 | ||||
-rw-r--r-- | engines/scumm/input.cpp | 4 | ||||
-rw-r--r-- | gui/dialog.cpp | 2 | ||||
-rw-r--r-- | gui/dialog.h | 4 | ||||
-rw-r--r-- | gui/newgui.cpp | 42 | ||||
-rw-r--r-- | gui/newgui.h | 8 | ||||
-rw-r--r-- | gui/widget.cpp | 4 |
8 files changed, 26 insertions, 44 deletions
diff --git a/base/main.cpp b/base/main.cpp index acba304c9e..6a589eb0fb 100644 --- a/base/main.cpp +++ b/base/main.cpp @@ -74,7 +74,7 @@ static bool launcherDialog(OSystem &system) { // a --gui-theme option, to allow that option to be working, we need to initialize // GUI here. // FIXME: Find a nicer way to allow --gui-theme to be working - GUI::NewGui::instance(); + GUI::GuiManager::instance(); // Discard any command line options. Those that affect the graphics // mode and the others (like bootparam etc.) should not @@ -341,7 +341,7 @@ extern "C" int scummvm_main(int argc, char *argv[]) { PluginManager::destroy(); Common::ConfigManager::destroy(); Common::SearchManager::destroy(); - GUI::NewGui::destroy(); + GUI::GuiManager::destroy(); return 0; } diff --git a/engines/scumm/dialogs.cpp b/engines/scumm/dialogs.cpp index 42020dd4dc..05a677601b 100644 --- a/engines/scumm/dialogs.cpp +++ b/engines/scumm/dialogs.cpp @@ -22,8 +22,6 @@ * $Id$ */ - - #include "common/config-manager.h" #include "common/savefile.h" #include "common/system.h" diff --git a/engines/scumm/input.cpp b/engines/scumm/input.cpp index bb67f2b31d..9f9326da72 100644 --- a/engines/scumm/input.cpp +++ b/engines/scumm/input.cpp @@ -23,8 +23,6 @@ * */ - - #include "common/config-manager.h" #include "common/events.h" #include "common/system.h" @@ -471,7 +469,7 @@ void ScummEngine::processKeyboard(Common::KeyState lastKeyHit) { if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) runScript(VAR(VAR_SAVELOAD_SCRIPT), 0, 0, 0); - scummMenuDialog(); // Display NewGui + scummMenuDialog(); // Display GUI if (VAR_SAVELOAD_SCRIPT != 0xFF && _currentRoom != 0) runScript(VAR(VAR_SAVELOAD_SCRIPT2), 0, 0, 0); diff --git a/gui/dialog.cpp b/gui/dialog.cpp index dc2e270f44..1296ef7bbe 100644 --- a/gui/dialog.cpp +++ b/gui/dialog.cpp @@ -131,7 +131,7 @@ void Dialog::draw() { // Update: called on tab drawing, mainly... // we can pass this as open a new dialog or something // g_gui._needRedraw = true; - g_gui._redrawStatus = GUI::NewGui::kRedrawTopDialog; + g_gui._redrawStatus = GUI::GuiManager::kRedrawTopDialog; } void Dialog::drawDialog() { diff --git a/gui/dialog.h b/gui/dialog.h index 726ba85cd0..018677d82b 100644 --- a/gui/dialog.h +++ b/gui/dialog.h @@ -33,7 +33,7 @@ namespace GUI { -class NewGui; +class GuiManager; class PopUpWidget; // Some "common" commands sent to handleCommand() @@ -42,7 +42,7 @@ enum { }; class Dialog : public GuiObject { - friend class NewGui; + friend class GuiManager; protected: Widget *_mouseWidget; Widget *_focusedWidget; diff --git a/gui/newgui.cpp b/gui/newgui.cpp index 900ac21d36..32e67fe360 100644 --- a/gui/newgui.cpp +++ b/gui/newgui.cpp @@ -34,29 +34,17 @@ #include "common/config-manager.h" -DECLARE_SINGLETON(GUI::NewGui); +DECLARE_SINGLETON(GUI::GuiManager); namespace GUI { -/* - * TODO list - * - add more widgets: edit field, popup, radio buttons, ... - * - * Other ideas: - * - allow multi line (l/c/r aligned) text via StaticTextWidget ? - * - add "close" widget to all dialogs (with a flag to turn it off) ? - * - make dialogs "moveable" ? - * - come up with a new look & feel / theme for the GUI - * - ... - */ - enum { kDoubleClickDelay = 500, // milliseconds kCursorAnimateDelay = 250 }; // Constructor -NewGui::NewGui() : _redrawStatus(kRedrawDisabled), +GuiManager::GuiManager() : _redrawStatus(kRedrawDisabled), _stateIsSaved(false), _cursorAnimateCounter(0), _cursorAnimateTimer(0) { _theme = 0; _useStdCursor = false; @@ -80,11 +68,11 @@ NewGui::NewGui() : _redrawStatus(kRedrawDisabled), _themeChange = false; } -NewGui::~NewGui() { +GuiManager::~GuiManager() { delete _theme; } -bool NewGui::loadNewTheme(Common::String filename, ThemeEngine::GraphicsMode gfx) { +bool GuiManager::loadNewTheme(Common::String filename, ThemeEngine::GraphicsMode gfx) { if (_theme && filename == _theme->getThemeFileName() && gfx == _theme->getGraphicsMode()) return true; @@ -117,7 +105,7 @@ bool NewGui::loadNewTheme(Common::String filename, ThemeEngine::GraphicsMode gfx return true; } -void NewGui::redraw() { +void GuiManager::redraw() { int i; if (_redrawStatus == kRedrawDisabled) @@ -154,13 +142,13 @@ void NewGui::redraw() { _redrawStatus = kRedrawDisabled; } -Dialog *NewGui::getTopDialog() const { +Dialog *GuiManager::getTopDialog() const { if (_dialogStack.empty()) return 0; return _dialogStack.top(); } -void NewGui::runLoop() { +void GuiManager::runLoop() { Dialog *activeDialog = getTopDialog(); bool didSaveState = false; int button; @@ -294,7 +282,7 @@ void NewGui::runLoop() { #pragma mark - -void NewGui::saveState() { +void GuiManager::saveState() { // Backup old cursor _lastClick.x = _lastClick.y = 0; _lastClick.time = 0; @@ -303,7 +291,7 @@ void NewGui::saveState() { _stateIsSaved = true; } -void NewGui::restoreState() { +void GuiManager::restoreState() { if (_useStdCursor) { CursorMan.popCursor(); CursorMan.popCursorPalette(); @@ -314,7 +302,7 @@ void NewGui::restoreState() { _stateIsSaved = false; } -void NewGui::openDialog(Dialog *dialog) { +void GuiManager::openDialog(Dialog *dialog) { _dialogStack.push(dialog); _redrawStatus = kRedrawOpenDialog; @@ -336,7 +324,7 @@ void NewGui::openDialog(Dialog *dialog) { } } -void NewGui::closeTopDialog() { +void GuiManager::closeTopDialog() { // Don't do anything if no dialog is open if (_dialogStack.empty()) return; @@ -346,7 +334,7 @@ void NewGui::closeTopDialog() { _redrawStatus = kRedrawCloseDialog; } -void NewGui::setupCursor() { +void GuiManager::setupCursor() { const byte palette[] = { 255, 255, 255, 0, 255, 255, 255, 0, @@ -363,7 +351,7 @@ void NewGui::setupCursor() { // SCUMM games, but the code no longer resembles what we have in cursor.cpp // very much. We could plug in a different cursor here if we like to. -void NewGui::animateCursor() { +void GuiManager::animateCursor() { int time = _system->getMillis(); if (time > _cursorAnimateTimer + kCursorAnimateDelay) { for (int i = 0; i < 15; i++) { @@ -380,12 +368,12 @@ void NewGui::animateCursor() { } } -void NewGui::clearDragWidget() { +void GuiManager::clearDragWidget() { if (!_dialogStack.empty()) _dialogStack.top()->_dragWidget = 0; } -void NewGui::screenChange() { +void GuiManager::screenChange() { _lastScreenChangeID = _system->getScreenChangeID(); // reinit the whole theme diff --git a/gui/newgui.h b/gui/newgui.h index cec22d2335..948edc3ec2 100644 --- a/gui/newgui.h +++ b/gui/newgui.h @@ -43,7 +43,7 @@ class Dialog; class Eval; class ThemeEval; -#define g_gui (GUI::NewGui::instance()) +#define g_gui (GUI::GuiManager::instance()) // Height of a single text line @@ -59,11 +59,11 @@ typedef Common::FixedStack<Dialog *> DialogStack; /** * GUI manager singleton. */ -class NewGui : public Common::Singleton<NewGui> { +class GuiManager : public Common::Singleton<GuiManager> { friend class Dialog; friend class Common::Singleton<SingletonBaseType>; - NewGui(); - ~NewGui(); + GuiManager(); + ~GuiManager(); public: // Main entry for the GUI: this will start an event loop that keeps running diff --git a/gui/widget.cpp b/gui/widget.cpp index 5754c12dd1..de81d9fc56 100644 --- a/gui/widget.cpp +++ b/gui/widget.cpp @@ -83,8 +83,6 @@ void Widget::updateState(int oldFlags, int newFlags) { } void Widget::draw() { - NewGui *gui = &g_gui; - if (!isVisible() || !_boss->isVisible()) return; @@ -96,7 +94,7 @@ void Widget::draw() { // Draw border if (_flags & WIDGET_BORDER) { - gui->theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), 0, ThemeEngine::kWidgetBackgroundBorder); + g_gui.theme()->drawWidgetBackground(Common::Rect(_x, _y, _x+_w, _y+_h), 0, ThemeEngine::kWidgetBackgroundBorder); _x += 4; _y += 4; _w -= 8; |