diff options
author | Borja Lorente | 2016-07-29 11:17:23 +0200 |
---|---|---|
committer | Borja Lorente | 2016-07-30 10:06:14 +0200 |
commit | 8a2aeeecc942b6f8991cbdc6577313a6e8f74d9d (patch) | |
tree | 3b990ec40b79452c5ad327c334e66e83415f575b /engines/wage | |
parent | d8652af84e4f909854d753f0ed6aa1dcc4b0a269 (diff) | |
download | scummvm-rg350-8a2aeeecc942b6f8991cbdc6577313a6e8f74d9d.tar.gz scummvm-rg350-8a2aeeecc942b6f8991cbdc6577313a6e8f74d9d.tar.bz2 scummvm-rg350-8a2aeeecc942b6f8991cbdc6577313a6e8f74d9d.zip |
WAGE: Adapt to MacMenu namespace change
Diffstat (limited to 'engines/wage')
-rw-r--r-- | engines/wage/gui-console.cpp | 28 | ||||
-rw-r--r-- | engines/wage/gui.cpp | 66 | ||||
-rw-r--r-- | engines/wage/gui.h | 3 | ||||
-rw-r--r-- | engines/wage/macmenu.cpp | 22 | ||||
-rw-r--r-- | engines/wage/macmenu.h | 25 |
5 files changed, 69 insertions, 75 deletions
diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 1ae0384f4f..d06b8daf63 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -348,7 +348,7 @@ void Gui::actionCopy() { } } - _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionPaste, true); } void Gui::actionPaste() { @@ -357,14 +357,14 @@ void Gui::actionPaste() { drawInput(); _engine->_inputText = _out.back(); // Set last part of the multiline text - _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); } void Gui::actionUndo() { _engine->_inputText = _undobuffer; drawInput(); - _menu->enableCommand(kMenuEdit, kMenuActionUndo, false); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, false); } void Gui::actionClear() { @@ -381,7 +381,7 @@ void Gui::actionClear() { _engine->_inputText = beg + end; drawInput(); - _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); _selectionStartY = -1; _selectionEndY = -1; @@ -403,15 +403,15 @@ void Gui::actionCut() { _clipboard = mid; drawInput(); - _menu->enableCommand(kMenuEdit, kMenuActionUndo, true); - _menu->enableCommand(kMenuEdit, kMenuActionPaste, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionPaste, true); _selectionStartY = -1; _selectionEndY = -1; } void Gui::disableUndo() { - _menu->enableCommand(kMenuEdit, kMenuActionUndo, false); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionUndo, false); } void Gui::disableAllMenus() { @@ -419,9 +419,9 @@ void Gui::disableAllMenus() { } void Gui::enableNewGameMenus() { - _menu->enableCommand(kMenuFile, kMenuActionNew, true); - _menu->enableCommand(kMenuFile, kMenuActionOpen, true); - _menu->enableCommand(kMenuFile, kMenuActionQuit, true); + _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionNew, true); + _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionOpen, true); + _menu->enableCommand(Graphics::kMenuFile, Graphics::kMenuActionQuit, true); } bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event) { @@ -483,17 +483,17 @@ bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event (_selectionEndX == _selectionStartX && _selectionEndY == _selectionStartY)) { _selectionStartY = _selectionEndY = -1; _consoleFullRedraw = true; - _menu->enableCommand(kMenuEdit, kMenuActionCopy, false); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCopy, false); } else { - _menu->enableCommand(kMenuEdit, kMenuActionCopy, true); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCopy, true); bool cutAllowed = false; if (_selectionStartY == _selectionEndY && _selectionStartY == (int)_lines.size() - 1) cutAllowed = true; - _menu->enableCommand(kMenuEdit, kMenuActionCut, cutAllowed); - _menu->enableCommand(kMenuEdit, kMenuActionClear, cutAllowed); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionCut, cutAllowed); + _menu->enableCommand(Graphics::kMenuEdit, Graphics::kMenuActionClear, cutAllowed); } } diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 532aa5fa98..7d329d245d 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -61,23 +61,23 @@ namespace Wage { -static const MenuData menuSubItems[] = { - { kMenuHighLevel, "File", 0, 0, false }, - { kMenuHighLevel, "Edit", 0, 0, false }, - { kMenuFile, "New", kMenuActionNew, 0, false }, - { kMenuFile, "Open...", kMenuActionOpen, 0, true }, - { kMenuFile, "Close", kMenuActionClose, 0, true }, - { kMenuFile, "Save", kMenuActionSave, 0, true }, - { kMenuFile, "Save as...", kMenuActionSaveAs, 0, true }, - { kMenuFile, "Revert", kMenuActionRevert, 0, false }, - { kMenuFile, "Quit", kMenuActionQuit, 0, true }, - - { kMenuEdit, "Undo", kMenuActionUndo, 'Z', false }, - { kMenuEdit, NULL, 0, 0, false }, - { kMenuEdit, "Cut", kMenuActionCut, 'K', false }, - { kMenuEdit, "Copy", kMenuActionCopy, 'C', false }, - { kMenuEdit, "Paste", kMenuActionPaste, 'V', false }, - { kMenuEdit, "Clear", kMenuActionClear, 'B', false }, +static const Graphics::MenuData menuSubItems[] = { + { Graphics::kMenuHighLevel, "File", 0, 0, false }, + { Graphics::kMenuHighLevel, "Edit", 0, 0, false }, + { Graphics::kMenuFile, "New", Graphics::kMenuActionNew, 0, false }, + { Graphics::kMenuFile, "Open...", Graphics::kMenuActionOpen, 0, true }, + { Graphics::kMenuFile, "Close", Graphics::kMenuActionClose, 0, true }, + { Graphics::kMenuFile, "Save", Graphics::kMenuActionSave, 0, true }, + { Graphics::kMenuFile, "Save as...", Graphics::kMenuActionSaveAs, 0, true }, + { Graphics::kMenuFile, "Revert", Graphics::kMenuActionRevert, 0, false }, + { Graphics::kMenuFile, "Quit", Graphics::kMenuActionQuit, 0, true }, + + { Graphics::kMenuEdit, "Undo", Graphics::kMenuActionUndo, 'Z', false }, + { Graphics::kMenuEdit, NULL, 0, 0, false }, + { Graphics::kMenuEdit, "Cut", Graphics::kMenuActionCut, 'K', false }, + { Graphics::kMenuEdit, "Copy", Graphics::kMenuActionCopy, 'C', false }, + { Graphics::kMenuEdit, "Paste", Graphics::kMenuActionPaste, 'V', false }, + { Graphics::kMenuEdit, "Clear", Graphics::kMenuActionClear, 'B', false }, { 0, NULL, 0, 0, false } }; @@ -148,7 +148,7 @@ Gui::Gui(WageEngine *engine) { _menu->setCommandsCallback(menuCommandsCallback, this); _menu->addStaticMenus(menuSubItems); - _menu->addMenuSubItem(kMenuAbout, _engine->_world->getAboutMenuItemName(), kMenuActionAbout); + _menu->addMenuSubItem(Graphics::kMenuAbout, _engine->_world->getAboutMenuItemName(), Graphics::kMenuActionAbout); _commandsMenuId = _menu->addMenuItem(_engine->_world->_commandsMenuName.c_str()); regenCommandsMenu(); @@ -298,7 +298,7 @@ void Gui::regenWeaponsMenu() { command += " "; command += obj->_name; - _menu->addMenuSubItem(_weaponsMenuId, command.c_str(), kMenuActionCommand, 0, 0, true); + _menu->addMenuSubItem(_weaponsMenuId, command.c_str(), Graphics::kMenuActionCommand, 0, 0, true); empty = false; } @@ -321,39 +321,39 @@ void menuCommandsCallback(int action, Common::String &text, void *data) { void Gui::executeMenuCommand(int action, Common::String &text) { switch(action) { - case kMenuActionAbout: - case kMenuActionNew: - case kMenuActionClose: - case kMenuActionRevert: - case kMenuActionQuit: + case Graphics::kMenuActionAbout: + case Graphics::kMenuActionNew: + case Graphics::kMenuActionClose: + case Graphics::kMenuActionRevert: + case Graphics::kMenuActionQuit: break; - case kMenuActionOpen: + case Graphics::kMenuActionOpen: _engine->scummVMSaveLoadDialog(false); break; - case kMenuActionSave: - case kMenuActionSaveAs: + case Graphics::kMenuActionSave: + case Graphics::kMenuActionSaveAs: _engine->scummVMSaveLoadDialog(true); break; - case kMenuActionUndo: + case Graphics::kMenuActionUndo: actionUndo(); break; - case kMenuActionCut: + case Graphics::kMenuActionCut: actionCut(); break; - case kMenuActionCopy: + case Graphics::kMenuActionCopy: actionCopy(); break; - case kMenuActionPaste: + case Graphics::kMenuActionPaste: actionPaste(); break; - case kMenuActionClear: + case Graphics::kMenuActionClear: actionClear(); break; - case kMenuActionCommand: + case Graphics::kMenuActionCommand: _engine->processTurn(&text, NULL); break; diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 7355797781..ed841b0e0d 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -59,7 +59,6 @@ namespace Wage { -class Menu; class Scene; class WageEngine; @@ -127,7 +126,7 @@ public: private: Graphics::ManagedSurface _console; - Menu *_menu; + Graphics::Menu *_menu; bool _sceneDirty; bool _consoleDirty; diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp index d6dec32269..b776223295 100644 --- a/engines/wage/macmenu.cpp +++ b/engines/wage/macmenu.cpp @@ -55,7 +55,7 @@ #include "wage/macmenu.h" -namespace Wage { +namespace Graphics { enum { kMenuHeight = 20, @@ -89,11 +89,11 @@ struct MenuItem { MenuItem(const char *n) : name(n) {} }; -Menu::Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm) +Menu::Menu(int id, const Common::Rect &bounds, MacWindowManager *wm) : BaseMacWindow(id, false, wm) { _font = getMenuFont(); - _screen.create(bounds.width(), bounds.height(), Graphics::PixelFormat::createFormatCLUT8()); + _screen.create(bounds.width(), bounds.height(), PixelFormat::createFormatCLUT8()); _bbox.left = 0; _bbox.top = 0; @@ -107,7 +107,7 @@ Menu::Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm) _ccallback = NULL; _cdata = NULL; - _tempSurface.create(_screen.w, _font->getFontHeight(), Graphics::PixelFormat::createFormatCLUT8()); + _tempSurface.create(_screen.w, _font->getFontHeight(), PixelFormat::createFormatCLUT8()); } Menu::~Menu() { @@ -250,8 +250,8 @@ void Menu::createSubMenuFromString(int id, const char *str) { calcMenuBounds(menu); } -const Graphics::Font *Menu::getMenuFont() { - return _wm->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont); +const Font *Menu::getMenuFont() { + return _wm->getFont("Chicago-12", FontManager::kBigGUIFont); } const char *Menu::getAcceleratorString(MenuSubItem *item, const char *prefix) { @@ -299,17 +299,17 @@ void Menu::calcMenuBounds(MenuItem *menu) { } static void drawPixelPlain(int x, int y, int color, void *data) { - Graphics::ManagedSurface *surface = (Graphics::ManagedSurface *)data; + ManagedSurface *surface = (ManagedSurface *)data; if (x >= 0 && x < surface->w && y >= 0 && y < surface->h) *((byte *)surface->getBasePtr(x, y)) = (byte)color; } -static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color) { - Graphics::drawRoundRect(rect, arc, color, true, drawPixelPlain, surface); +static void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color) { + drawRoundRect(rect, arc, color, true, drawPixelPlain, surface); } -bool Menu::draw(Graphics::ManagedSurface *g, bool forceRedraw) { +bool Menu::draw(ManagedSurface *g, bool forceRedraw) { Common::Rect r(_bbox); if (!_contentIsDirty && !forceRedraw) @@ -385,7 +385,7 @@ void Menu::renderSubmenu(MenuItem *menu) { } if (!text.empty()) { - Graphics::ManagedSurface *s = &_screen; + ManagedSurface *s = &_screen; int tx = x, ty = y; if (!menu->subitems[i]->enabled) { diff --git a/engines/wage/macmenu.h b/engines/wage/macmenu.h index 793cb27f3d..e0309b25e6 100644 --- a/engines/wage/macmenu.h +++ b/engines/wage/macmenu.h @@ -45,15 +45,10 @@ * */ -#ifndef WAGE_MACMENU_H -#define WAGE_MACMENU_H +#ifndef GRAPHICS_MACMENU_H +#define GRAPHICS_MACMENU_H namespace Graphics { - class MacWindowManager; - class BaseMacWindow; -} - -namespace Wage { struct MenuItem; struct MenuSubItem; @@ -104,9 +99,9 @@ struct MenuData { bool enabled; }; -class Menu : public Graphics::BaseMacWindow { +class Menu : public BaseMacWindow { public: - Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm); + Menu(int id, const Common::Rect &bounds, MacWindowManager *wm); ~Menu(); void setCommandsCallback(void (*callback)(int, Common::String &, void *), void *data) { _ccallback = callback; _cdata = data; } @@ -119,7 +114,7 @@ public: void createSubMenuFromString(int id, const char *string); void clearSubMenu(int id); - bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false); + bool draw(ManagedSurface *g, bool forceRedraw = false); bool processEvent(Common::Event &event); void enableCommand(int menunum, int action, bool state); @@ -131,11 +126,11 @@ public: Common::Rect _bbox; private: - Graphics::ManagedSurface _screen; - Graphics::ManagedSurface _tempSurface; + ManagedSurface _screen; + ManagedSurface _tempSurface; private: - const Graphics::Font *getMenuFont(); + const Font *getMenuFont(); const char *getAcceleratorString(MenuSubItem *item, const char *prefix); int calculateMenuWidth(MenuItem *menu); void calcMenuBounds(MenuItem *menu); @@ -150,7 +145,7 @@ private: Common::Array<MenuItem *> _items; - const Graphics::Font *_font; + const Font *_font; bool _menuActivated; @@ -161,6 +156,6 @@ private: void *_cdata; }; -} // End of namespace Wage +} // End of namespace Graphics #endif |