aboutsummaryrefslogtreecommitdiff
path: root/engines/wage
diff options
context:
space:
mode:
authorBorja Lorente2016-07-29 11:43:28 +0200
committerBorja Lorente2016-07-30 09:41:54 +0200
commit3d4087b9d0c199ba48a6f69d7d20a2850215f72f (patch)
tree97a1e03561a21a579246b0054af7ed1c023a28b0 /engines/wage
parentf50d9feee1e04a8ca9271b21859bda48172b7ff5 (diff)
downloadscummvm-rg350-3d4087b9d0c199ba48a6f69d7d20a2850215f72f.tar.gz
scummvm-rg350-3d4087b9d0c199ba48a6f69d7d20a2850215f72f.tar.bz2
scummvm-rg350-3d4087b9d0c199ba48a6f69d7d20a2850215f72f.zip
WAGE: Extract MacWindowManager
Diffstat (limited to 'engines/wage')
-rw-r--r--engines/wage/design.cpp4
-rw-r--r--engines/wage/design.h26
-rw-r--r--engines/wage/dialog.cpp3
-rw-r--r--engines/wage/gui.cpp2
-rw-r--r--engines/wage/gui.h5
-rw-r--r--engines/wage/macmenu.cpp4
-rw-r--r--engines/wage/macmenu.h6
-rw-r--r--engines/wage/macwindow.cpp6
-rw-r--r--engines/wage/macwindow.h12
-rw-r--r--engines/wage/macwindowmanager.h141
-rw-r--r--engines/wage/module.mk1
-rw-r--r--engines/wage/world.h4
12 files changed, 40 insertions, 174 deletions
diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp
index 2bfea9df7d..a578a84f79 100644
--- a/engines/wage/design.cpp
+++ b/engines/wage/design.cpp
@@ -47,15 +47,15 @@
#include "graphics/managed_surface.h"
#include "graphics/primitives.h"
+#include "graphics/macgui/macwindowmanager.h"
-#include "wage/macwindowmanager.h"
#include "wage/design.h"
namespace Wage {
struct PlotData {
Graphics::ManagedSurface *surface;
- Patterns *patterns;
+ Graphics::Patterns *patterns;
uint fillType;
int thickness;
Design *design;
diff --git a/engines/wage/design.h b/engines/wage/design.h
index 86225c9224..c64ae6d065 100644
--- a/engines/wage/design.h
+++ b/engines/wage/design.h
@@ -51,7 +51,7 @@
#include "common/memstream.h"
#include "common/rect.h"
-#include "wage/macwindowmanager.h"
+#include "graphics/macgui/macwindowmanager.h"
namespace Wage {
@@ -68,14 +68,14 @@ public:
return _bounds;
}
- void paint(Graphics::ManagedSurface *canvas, Patterns &patterns, int x, int y);
+ void paint(Graphics::ManagedSurface *canvas, Graphics::Patterns &patterns, int x, int y);
bool isPointOpaque(int x, int y);
- static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType);
- static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType);
- static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType);
- static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType);
- static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType);
- static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType);
+ static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
+ static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
+ static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::Patterns &patterns, byte fillType);
+ static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::Patterns &patterns, byte fillType);
+ static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
+ static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::Patterns &patterns, byte fillType);
bool isBoundsCalculation() { return _boundsCalculationMode; }
void adjustBounds(int16 x, int16 y);
@@ -88,15 +88,15 @@ private:
bool _boundsCalculationMode;
private:
- void render(Patterns &patterns);
+ void render(Graphics::Patterns &patterns);
void drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Graphics::Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Graphics::Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Graphics::Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in,
- Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
+ Graphics::Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType);
void drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in);
};
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index 86080c9a6f..a2013db852 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -48,8 +48,9 @@
#include "common/system.h"
#include "common/events.h"
+#include "graphics/macgui/macwindowmanager.h"
+
#include "wage/wage.h"
-#include "wage/macwindowmanager.h"
#include "wage/design.h"
#include "wage/gui.h"
#include "wage/dialog.h"
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index cdc646f649..b87a28c5f1 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -49,13 +49,13 @@
#include "common/system.h"
#include "graphics/cursorman.h"
#include "graphics/primitives.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "wage/wage.h"
#include "wage/design.h"
#include "wage/entities.h"
#include "wage/gui.h"
#include "wage/macwindow.h"
-#include "wage/macwindowmanager.h"
#include "wage/macmenu.h"
#include "wage/world.h"
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index ba1bb5ef3b..ef93f6e014 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -51,11 +51,12 @@
#include "common/str-array.h"
#include "graphics/font.h"
#include "graphics/managed_surface.h"
+#include "graphics/macgui/macwindowmanager.h"
+
#include "common/events.h"
#include "common/rect.h"
#include "wage/macwindow.h"
-#include "wage/macwindowmanager.h"
namespace Wage {
@@ -121,7 +122,7 @@ public:
Scene *_scene;
- MacWindowManager _wm;
+ Graphics::MacWindowManager _wm;
MacWindow *_sceneWindow;
MacWindow *_consoleWindow;
diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp
index b29903c674..5d799061cc 100644
--- a/engines/wage/macmenu.cpp
+++ b/engines/wage/macmenu.cpp
@@ -50,8 +50,8 @@
#include "graphics/primitives.h"
#include "graphics/font.h"
+#include "graphics/macgui/macwindowmanager.h"
-#include "wage/macwindowmanager.h"
#include "wage/macwindow.h"
#include "wage/macmenu.h"
@@ -89,7 +89,7 @@ struct MenuItem {
MenuItem(const char *n) : name(n) {}
};
-Menu::Menu(int id, const Common::Rect &bounds, MacWindowManager *wm)
+Menu::Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm)
: BaseMacWindow(id, false, wm) {
_font = getMenuFont();
diff --git a/engines/wage/macmenu.h b/engines/wage/macmenu.h
index e73e4c48a9..239c4fc75c 100644
--- a/engines/wage/macmenu.h
+++ b/engines/wage/macmenu.h
@@ -48,6 +48,10 @@
#ifndef WAGE_MACMENU_H
#define WAGE_MACMENU_H
+namespace Graphics {
+ class MacWindowManager;
+}
+
namespace Wage {
struct MenuItem;
@@ -101,7 +105,7 @@ struct MenuData {
class Menu : public BaseMacWindow {
public:
- Menu(int id, const Common::Rect &bounds, MacWindowManager *wm);
+ Menu(int id, const Common::Rect &bounds, Graphics::MacWindowManager *wm);
~Menu();
void setCommandsCallback(void (*callback)(int, Common::String &, void *), void *data) { _ccallback = callback; _cdata = data; }
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index db8ef38c39..1100c0ba4b 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -48,13 +48,13 @@
#include "graphics/font.h"
#include "graphics/primitives.h"
#include "common/events.h"
+#include "graphics/macgui/macwindowmanager.h"
#include "wage/macwindow.h"
-#include "wage/macwindowmanager.h"
namespace Wage {
-BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
+BaseMacWindow::BaseMacWindow(int id, bool editable, Graphics::MacWindowManager *wm) :
_id(id), _editable(editable), _wm(wm) {
_callback = 0;
_dataPtr = 0;
@@ -64,7 +64,7 @@ BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
_type = kWindowUnknown;
}
-MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm) :
+MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Graphics::MacWindowManager *wm) :
BaseMacWindow(id, editable, wm), _scrollable(scrollable), _resizable(resizable) {
_active = false;
_borderIsDirty = true;
diff --git a/engines/wage/macwindow.h b/engines/wage/macwindow.h
index 4c6e9efeff..4d824bd399 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -50,9 +50,11 @@
#include "graphics/managed_surface.h"
-namespace Wage {
+namespace Graphics {
+ class MacWindowManager;
+}
-class MacWindowManager;
+namespace Wage {
enum WindowType {
kWindowUnknown,
@@ -76,7 +78,7 @@ enum WindowClick {
class BaseMacWindow {
public:
- BaseMacWindow(int id, bool editable, MacWindowManager *wm);
+ BaseMacWindow(int id, bool editable, Graphics::MacWindowManager *wm);
virtual ~BaseMacWindow() {}
const Common::Rect &getDimensions() { return _dims; }
@@ -108,12 +110,12 @@ protected:
bool (*_callback)(WindowClick, Common::Event &, void *);
void *_dataPtr;
- MacWindowManager *_wm;
+ Graphics::MacWindowManager *_wm;
};
class MacWindow : public BaseMacWindow {
public:
- MacWindow(int id, bool scrollable, bool resizable, bool editable, MacWindowManager *wm);
+ MacWindow(int id, bool scrollable, bool resizable, bool editable, Graphics::MacWindowManager *wm);
virtual ~MacWindow();
void move(int x, int y);
void resize(int w, int h);
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
deleted file mode 100644
index 13f85cddd4..0000000000
--- a/engines/wage/macwindowmanager.h
+++ /dev/null
@@ -1,141 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
-
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
-
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- * MIT License:
- *
- * Copyright (c) 2009 Alexei Svitkine, Eugene Sandulenko
- *
- * Permission is hereby granted, free of charge, to any person
- * obtaining a copy of this software and associated documentation
- * files (the "Software"), to deal in the Software without
- * restriction, including without limitation the rights to use,
- * copy, modify, merge, publish, distribute, sublicense, and/or sell
- * copies of the Software, and to permit persons to whom the
- * Software is furnished to do so, subject to the following
- * conditions:
- *
- * The above copyright notice and this permission notice shall be
- * included in all copies or substantial portions of the Software.
- *
- * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,
- * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES
- * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND
- * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT
- * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY,
- * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
- * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR
- * OTHER DEALINGS IN THE SOFTWARE.
- *
- */
-
-#ifndef WAGE_MACWINDOWMANAGER_H
-#define WAGE_MACWINDOWMANAGER_H
-
-#include "common/array.h"
-#include "common/list.h"
-#include "common/events.h"
-#include "common/archive.h"
-
-#include "graphics/fontman.h"
-
-namespace Graphics {
-class ManagedSurface;
-}
-
-namespace Wage {
-
-enum {
- kDesktopArc = 7
-};
-
-enum {
- kColorBlack = 0,
- kColorGray = 1,
- kColorWhite = 2,
- kColorGreen = 3,
- kColorGreen2 = 4
-};
-
-enum {
- kPatternSolid = 1,
- kPatternStripes = 2,
- kPatternCheckers = 3,
- kPatternCheckers2 = 4
-};
-
-class BaseMacWindow;
-class MacWindow;
-class Menu;
-
-typedef Common::Array<byte *> Patterns;
-
-class MacWindowManager {
-public:
- MacWindowManager();
- ~MacWindowManager();
-
- void setScreen(Graphics::ManagedSurface *screen) { _screen = screen; }
- bool hasBuiltInFonts() { return _builtInFonts; }
- const Graphics::Font *getFont(const char *name, Graphics::FontManager::FontUsage fallback);
-
- MacWindow *addWindow(bool scrollable, bool resizable, bool editable);
- Menu *addMenu();
- void setActive(int id);
-
- void setFullRefresh(bool redraw) { _fullRefresh = true; }
-
- void draw();
-
- bool processEvent(Common::Event &event);
-
- BaseMacWindow *getWindow(int id) { return _windows[id]; }
-
- Patterns &getPatterns() { return _patterns; }
- void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color);
-
- void pushArrowCursor();
- void popCursor();
-
-private:
- void drawDesktop();
- void loadFonts();
-
-private:
- Graphics::ManagedSurface *_screen;
-
- Common::List<BaseMacWindow *> _windowStack;
- Common::Array<BaseMacWindow *> _windows;
-
- int _lastId;
- int _activeWindow;
-
- bool _fullRefresh;
-
- Patterns _patterns;
-
- Menu *_menu;
-
- bool _builtInFonts;
- bool _cursorIsArrow;
-};
-
-} // End of namespace Wage
-
-#endif
diff --git a/engines/wage/module.mk b/engines/wage/module.mk
index 1f397b5a71..43f0f0fdfc 100644
--- a/engines/wage/module.mk
+++ b/engines/wage/module.mk
@@ -11,7 +11,6 @@ MODULE_OBJS := \
gui-console.o \
macmenu.o \
macwindow.o \
- macwindowmanager.o \
randomhat.o \
saveload.o \
script.o \
diff --git a/engines/wage/world.h b/engines/wage/world.h
index 918616c9c1..b3908be81c 100644
--- a/engines/wage/world.h
+++ b/engines/wage/world.h
@@ -49,7 +49,7 @@
#define WAGE_WORLD_H
#include "wage/entities.h"
-#include "wage/macwindowmanager.h"
+#include "graphics/macgui/macwindowmanager.h"
namespace Wage {
@@ -89,7 +89,7 @@ public:
ObjArray _orderedObjs;
ChrArray _orderedChrs;
Common::Array<Sound *> _orderedSounds;
- Patterns *_patterns;
+ Graphics::Patterns *_patterns;
Scene *_storageScene;
Chr *_player;
int _signature;