From 592a6defb7841a11aac2d6f6843e052d56504566 Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Fri, 29 Jul 2016 11:44:38 +0200 Subject: WAGE: Change namespace of MacWindow --- engines/wage/gui-console.cpp | 12 ++++++------ engines/wage/gui.cpp | 14 +++++++------- engines/wage/gui.h | 8 ++++---- engines/wage/macmenu.h | 3 ++- engines/wage/macwindow.cpp | 30 +++++++++++++++--------------- engines/wage/macwindow.h | 35 +++++++++++++++++------------------ 6 files changed, 51 insertions(+), 51 deletions(-) (limited to 'engines') diff --git a/engines/wage/gui-console.cpp b/engines/wage/gui-console.cpp index 8b6fe43a17..a856a0d75a 100644 --- a/engines/wage/gui-console.cpp +++ b/engines/wage/gui-console.cpp @@ -424,8 +424,8 @@ void Gui::enableNewGameMenus() { _menu->enableCommand(kMenuFile, kMenuActionQuit, true); } -bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) { - if (click == kBorderScrollUp || click == kBorderScrollDown) { +bool Gui::processConsoleEvents(Graphics::WindowClick click, Common::Event &event) { + if (click == Graphics::kBorderScrollUp || click == Graphics::kBorderScrollDown) { if (event.type == Common::EVENT_LBUTTONDOWN) { int consoleHeight = _consoleWindow->getInnerDimensions().height(); int textFullSize = _lines.size() * _consoleLineHeight + consoleHeight; @@ -439,14 +439,14 @@ bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) { int oldScrollPos = _scrollPos; switch (click) { - case kBorderScrollUp: + case Graphics::kBorderScrollUp: _scrollPos = MAX(0, _scrollPos - _consoleLineHeight); undrawCursor(); _cursorY -= (_scrollPos - oldScrollPos); _consoleDirty = true; _consoleFullRedraw = true; break; - case kBorderScrollDown: + case Graphics::kBorderScrollDown: _scrollPos = MIN((_lines.size() - 2) * _consoleLineHeight, _scrollPos + _consoleLineHeight); undrawCursor(); _cursorY -= (_scrollPos - oldScrollPos); @@ -463,14 +463,14 @@ bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) { return false; } - if (click == kBorderResizeButton) { + if (click == Graphics::kBorderResizeButton) { _consoleDirty = true; _consoleFullRedraw = true; return true; } - if (click == kBorderInner) { + if (click == Graphics::kBorderInner) { if (event.type == Common::EVENT_LBUTTONDOWN) { startMarking(event.mouse.x, event.mouse.y); diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index b87a28c5f1..5a28835f77 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -110,8 +110,8 @@ static void cursorTimerHandler(void *refCon) { gui->_cursorDirty = true; } -static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *gui); -static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *gui); +static bool sceneWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui); +static bool consoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui); static void menuCommandsCallback(int action, Common::String &text, void *data); @@ -235,14 +235,14 @@ void Gui::drawScene() { _consoleFullRedraw = true; } -static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *g) { +static bool sceneWindowCallback(Graphics::WindowClick click, Common::Event &event, void *g) { Gui *gui = (Gui *)g; return gui->processSceneEvents(click, event); } -bool Gui::processSceneEvents(WindowClick click, Common::Event &event) { - if (click == kBorderInner && event.type == Common::EVENT_LBUTTONUP) { +bool Gui::processSceneEvents(Graphics::WindowClick click, Common::Event &event) { + if (click == Graphics::kBorderInner && event.type == Common::EVENT_LBUTTONUP) { Designed *obj = _scene->lookUpEntity(event.mouse.x - _sceneWindow->getDimensions().left, event.mouse.y - _sceneWindow->getDimensions().top); @@ -260,12 +260,12 @@ void Gui::drawConsole() { if (!_consoleDirty && !_consoleFullRedraw && !_sceneDirty) return; - renderConsole(_consoleWindow->getSurface(), Common::Rect(kBorderWidth - 2, kBorderWidth - 2, + renderConsole(_consoleWindow->getSurface(), Common::Rect(Graphics::kBorderWidth - 2, Graphics::kBorderWidth - 2, _consoleWindow->getDimensions().width(), _consoleWindow->getDimensions().height())); _consoleWindow->setDirty(true); } -static bool consoleWindowCallback(WindowClick click, Common::Event &event, void *g) { +static bool consoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *g) { Gui *gui = (Gui *)g; return gui->processConsoleEvents(click, event); diff --git a/engines/wage/gui.h b/engines/wage/gui.h index ef93f6e014..fd0447acf0 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -92,8 +92,8 @@ public: void disableAllMenus(); void enableNewGameMenus(); - bool processSceneEvents(WindowClick click, Common::Event &event); - bool processConsoleEvents(WindowClick click, Common::Event &event); + bool processSceneEvents(Graphics::WindowClick click, Common::Event &event); + bool processConsoleEvents(Graphics::WindowClick click, Common::Event &event); void executeMenuCommand(int action, Common::String &text); private: @@ -123,8 +123,8 @@ public: Scene *_scene; Graphics::MacWindowManager _wm; - MacWindow *_sceneWindow; - MacWindow *_consoleWindow; + Graphics::MacWindow *_sceneWindow; + Graphics::MacWindow *_consoleWindow; private: Graphics::ManagedSurface _console; diff --git a/engines/wage/macmenu.h b/engines/wage/macmenu.h index 239c4fc75c..793cb27f3d 100644 --- a/engines/wage/macmenu.h +++ b/engines/wage/macmenu.h @@ -50,6 +50,7 @@ namespace Graphics { class MacWindowManager; + class BaseMacWindow; } namespace Wage { @@ -103,7 +104,7 @@ struct MenuData { bool enabled; }; -class Menu : public BaseMacWindow { +class Menu : public Graphics::BaseMacWindow { public: Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm); ~Menu(); diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp index 1100c0ba4b..39ad739942 100644 --- a/engines/wage/macwindow.cpp +++ b/engines/wage/macwindow.cpp @@ -52,9 +52,9 @@ #include "wage/macwindow.h" -namespace Wage { +namespace Graphics { -BaseMacWindow::BaseMacWindow(int id, bool editable, Graphics::MacWindowManager *wm) : +BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) : _id(id), _editable(editable), _wm(wm) { _callback = 0; _dataPtr = 0; @@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, Graphics::MacWindowManager * _type = kWindowUnknown; } -MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Graphics::MacWindowManager *wm) : +MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) : BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) { _active = false; _borderIsDirty = true; @@ -84,8 +84,8 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Gra MacWindow::~MacWindow() { } -const Graphics::Font *MacWindow::getTitleFont() { - return _wm->getFont("Chicago-12", Graphics::FontManager::kBigGUIFont); +const Font *MacWindow::getTitleFont() { + return _wm->getFont("Chicago-12", FontManager::kBigGUIFont); } void MacWindow::setActive(bool active) { @@ -101,11 +101,11 @@ void MacWindow::resize(int w, int h) { return; _surface.free(); - _surface.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); + _surface.create(w, h, PixelFormat::createFormatCLUT8()); _borderSurface.free(); - _borderSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); + _borderSurface.create(w, h, PixelFormat::createFormatCLUT8()); _composeSurface.free(); - _composeSurface.create(w, h, Graphics::PixelFormat::createFormatCLUT8()); + _composeSurface.create(w, h, PixelFormat::createFormatCLUT8()); _dims.setWidth(w); _dims.setHeight(h); @@ -134,7 +134,7 @@ void MacWindow::setDimensions(const Common::Rect &r) { _contentIsDirty = true; } -bool MacWindow::draw(Graphics::ManagedSurface *g, bool forceRedraw) { +bool MacWindow::draw(ManagedSurface *g, bool forceRedraw) { if (!_borderIsDirty && !_contentIsDirty && !forceRedraw) return false; @@ -163,7 +163,7 @@ const int arrowPixels[ARROW_H][ARROW_W] = { {1,1,1,1,1,1,1,1,1,1,1,1}}; static void drawPixelInverted(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 *p = (byte *)surface->getBasePtr(x, y); @@ -186,7 +186,7 @@ void MacWindow::drawBorder() { int y = 0; int width = _borderSurface.w; int height = _borderSurface.h; - Graphics::ManagedSurface *g = &_borderSurface; + ManagedSurface *g = &_borderSurface; // We draw rect with outer kColorGreen2 and inner kColorGreen, so on 2 passes we cut out // scene by external shape of the border @@ -233,7 +233,7 @@ void MacWindow::drawBorder() { int ry2 = ry1 + _dims.height() * _scrollSize; Common::Rect rr(rx1, ry1, rx2, ry2); - Graphics::drawFilledRect(rr, kColorBlack, drawPixelInverted, g); + drawFilledRect(rr, kColorBlack, drawPixelInverted, g); } } if (closeable) { @@ -246,7 +246,7 @@ void MacWindow::drawBorder() { } if (drawTitle) { - const Graphics::Font *font = getTitleFont(); + const Font *font = getTitleFont(); int yOff = _wm->hasBuiltInFonts() ? 3 : 1; int w = font->getStringWidth(_title) + 10; @@ -276,14 +276,14 @@ void MacWindow::setScroll(float scrollPos, float scrollSize) { } -void MacWindow::drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h) { +void MacWindow::drawBox(ManagedSurface *g, int x, int y, int w, int h) { Common::Rect r(x, y, x + w + 1, y + h + 1); g->fillRect(r, kColorWhite); g->frameRect(r, kColorBlack); } -void MacWindow::fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color) { +void MacWindow::fillRect(ManagedSurface *g, int x, int y, int w, int h, int color) { Common::Rect r(x, y, x + w, y + h); g->fillRect(r, color); diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h index 4d824bd399..55f9d5c5ad 100644 --- a/engines/wage/macwindow.h +++ b/engines/wage/macwindow.h @@ -45,16 +45,14 @@ * */ -#ifndef WAGE_MACWINDOW_H -#define WAGE_MACWINDOW_H +#ifndef GRAPHICS_MACWINDOW_H +#define GRAPHICS_MACWINDOW_H #include "graphics/managed_surface.h" namespace Graphics { - class MacWindowManager; -} -namespace Wage { +class MacWindowManager; enum WindowType { kWindowUnknown, @@ -78,18 +76,18 @@ enum WindowClick { class BaseMacWindow { public: - BaseMacWindow(int id, bool editable, Graphics::MacWindowManager *wm); + BaseMacWindow(int id, bool editable, MacWindowManager *wm); virtual ~BaseMacWindow() {} const Common::Rect &getDimensions() { return _dims; } int getId() { return _id; } WindowType getType() { return _type; } bool isEditable() { return _editable; } - Graphics::ManagedSurface *getSurface() { return &_surface; } + ManagedSurface *getSurface() { return &_surface; } virtual void setActive(bool active) = 0; void setDirty(bool dirty) { _contentIsDirty = dirty; } - virtual bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false) = 0; + virtual bool draw(ManagedSurface *g, bool forceRedraw = false) = 0; virtual bool processEvent(Common::Event &event) = 0; virtual bool hasAllFocus() = 0; @@ -102,7 +100,7 @@ protected: bool _editable; - Graphics::ManagedSurface _surface; + ManagedSurface _surface; bool _contentIsDirty; Common::Rect _dims; @@ -110,19 +108,19 @@ protected: bool (*_callback)(WindowClick, Common::Event &, void *); void *_dataPtr; - Graphics::MacWindowManager *_wm; + MacWindowManager *_wm; }; class MacWindow : public BaseMacWindow { public: - MacWindow(int id, bool scrollable, bool resizable, bool editable, Graphics::MacWindowManager *wm); + MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm); virtual ~MacWindow(); void move(int x, int y); void resize(int w, int h); void setDimensions(const Common::Rect &r); const Common::Rect &getInnerDimensions() { return _innerDims; } - bool draw(Graphics::ManagedSurface *g, bool forceRedraw = false); + bool draw(ManagedSurface *g, bool forceRedraw = false); void setActive(bool active); void setTitle(Common::String &title) { _title = title; } @@ -133,15 +131,15 @@ public: private: void drawBorder(); - void drawBox(Graphics::ManagedSurface *g, int x, int y, int w, int h); - void fillRect(Graphics::ManagedSurface *g, int x, int y, int w, int h, int color); - const Graphics::Font *getTitleFont(); + void drawBox(ManagedSurface *g, int x, int y, int w, int h); + void fillRect(ManagedSurface *g, int x, int y, int w, int h, int color); + const Font *getTitleFont(); void updateInnerDims(); WindowClick isInBorder(int x, int y); private: - Graphics::ManagedSurface _borderSurface; - Graphics::ManagedSurface _composeSurface; + ManagedSurface _borderSurface; + ManagedSurface _composeSurface; bool _scrollable; bool _resizable; bool _active; @@ -158,6 +156,7 @@ private: Common::String _title; }; -} // End of namespace Wage +} // End of namespace Graphics + #endif -- cgit v1.2.3