From 9ce6fbd0d7faf05fcd62cd9a6ee953cdc63d53cf Mon Sep 17 00:00:00 2001 From: Borja Lorente Date: Fri, 29 Jul 2016 12:05:46 +0200 Subject: [PATCH] GRAPHICS: Move MacMenu constants --- engines/wage/design.cpp | 28 ++++++++--------- engines/wage/design.h | 25 ++++++++-------- engines/wage/gui.cpp | 4 +-- engines/wage/gui.h | 45 ++++++++++++++++++++++++---- engines/wage/world.cpp | 2 +- engines/wage/world.h | 4 +-- graphics/macgui/macmenu.cpp | 19 ++++++++++++ graphics/macgui/macmenu.h | 41 ------------------------- graphics/macgui/macwindowmanager.cpp | 4 +-- graphics/macgui/macwindowmanager.h | 10 +++---- 10 files changed, 97 insertions(+), 85 deletions(-) diff --git a/engines/wage/design.cpp b/engines/wage/design.cpp index a578a84f793..6255932f37b 100644 --- a/engines/wage/design.cpp +++ b/engines/wage/design.cpp @@ -55,12 +55,12 @@ namespace Wage { struct PlotData { Graphics::ManagedSurface *surface; - Graphics::Patterns *patterns; + Graphics::MacPatterns *patterns; uint fillType; int thickness; Design *design; - PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t, Design *d) : + PlotData(Graphics::ManagedSurface *s, Graphics::MacPatterns *p, int f, int t, Design *d) : surface(s), patterns(p), fillType(f), thickness(t), design(d) {} }; @@ -85,7 +85,7 @@ Design::~Design() { delete _surface; } -void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, int y) { +void Design::paint(Graphics::ManagedSurface *surface, Graphics::MacPatterns &patterns, int x, int y) { bool needRender = false; if (_surface == NULL) { @@ -141,7 +141,7 @@ void Design::paint(Graphics::ManagedSurface *surface, Patterns &patterns, int x, } } -void Design::render(Patterns &patterns) { +void Design::render(Graphics::MacPatterns &patterns) { Common::MemoryReadStream in(_data, _len); bool needRender = true; @@ -265,7 +265,7 @@ void drawPixelPlain(int x, int y, int color, void *data) { } void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { int16 y1 = in.readSint16BE(); int16 x1 = in.readSint16BE(); int16 y2 = in.readSint16BE(); @@ -294,7 +294,7 @@ void Design::drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in, } void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { int16 y1 = in.readSint16BE(); int16 x1 = in.readSint16BE(); int16 y2 = in.readSint16BE(); @@ -320,7 +320,7 @@ void Design::drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream } void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { byte ignored = in.readSint16BE(); // ignored @@ -397,7 +397,7 @@ void Design::drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream & } void Design::drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType) { int16 y1 = in.readSint16BE(); int16 x1 = in.readSint16BE(); int16 y2 = in.readSint16BE(); @@ -501,11 +501,11 @@ void Design::drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadS tmp.free(); } -void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Patterns &patterns, byte fillType) { +void Design::drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) { drawRect(surface, rect.left, rect.top, rect.right, rect.bottom, thickness, color, patterns, fillType); } -void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Patterns &patterns, byte fillType) { +void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) { PlotData pd(surface, &patterns, fillType, thickness, nullptr); Graphics::drawLine(x1, y1, x2, y1, kColorBlack, drawPixel, &pd); @@ -515,26 +515,26 @@ void Design::drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, } -void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Patterns &patterns, byte fillType) { +void Design::drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType) { PlotData pd(surface, &patterns, fillType, 1, nullptr); for (int y = rect.top; y <= rect.bottom; y++) Graphics::drawHLine(rect.left, rect.right, y, color, drawPixel, &pd); } -void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Patterns &patterns, byte fillType) { +void Design::drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType) { PlotData pd(surface, &patterns, fillType, 1, nullptr); Graphics::drawRoundRect(rect, arc, color, true, drawPixel, &pd); } -void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Patterns &patterns, byte fillType) { +void Design::drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) { PlotData pd(surface, &patterns, fillType, thickness, nullptr); Graphics::drawHLine(x1, x2, y, color, drawPixel, &pd); } -void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Patterns &patterns, byte fillType) { +void Design::drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType) { PlotData pd(surface, &patterns, fillType, thickness, nullptr); Graphics::drawVLine(x, y1, y2, color, drawPixel, &pd); diff --git a/engines/wage/design.h b/engines/wage/design.h index 7a422a48f00..948476b43c4 100644 --- a/engines/wage/design.h +++ b/engines/wage/design.h @@ -56,7 +56,6 @@ namespace Wage { using namespace Graphics::MacGUIConstants; -using Graphics::Patterns; class Design { public: @@ -71,14 +70,14 @@ public: return _bounds; } - void paint(Graphics::ManagedSurface *canvas, Graphics::Patterns &patterns, int x, int y); + void paint(Graphics::ManagedSurface *canvas, Graphics::MacPatterns &patterns, int x, int y); bool isPointOpaque(int x, int y); - 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); + static void drawRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType); + static void drawRect(Graphics::ManagedSurface *surface, int x1, int y1, int x2, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType); + static void drawFilledRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int color, Graphics::MacPatterns &patterns, byte fillType); + static void drawFilledRoundRect(Graphics::ManagedSurface *surface, Common::Rect &rect, int arc, int color, Graphics::MacPatterns &patterns, byte fillType); + static void drawHLine(Graphics::ManagedSurface *surface, int x1, int x2, int y, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType); + static void drawVLine(Graphics::ManagedSurface *surface, int x, int y1, int y2, int thickness, int color, Graphics::MacPatterns &patterns, byte fillType); bool isBoundsCalculation() { return _boundsCalculationMode; } void adjustBounds(int16 x, int16 y); @@ -91,15 +90,15 @@ private: bool _boundsCalculationMode; private: - void render(Patterns &patterns); + void render(Graphics::MacPatterns &patterns); void drawRect(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType); + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType); void drawRoundRect(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType); + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType); void drawPolygon(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType); + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType); void drawOval(Graphics::ManagedSurface *surface, Common::ReadStream &in, - Patterns &patterns, byte fillType, byte borderThickness, byte borderFillType); + Graphics::MacPatterns &patterns, byte fillType, byte borderThickness, byte borderFillType); void drawBitmap(Graphics::ManagedSurface *surface, Common::SeekableReadStream &in); }; diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp index 49f56f36693..a8d22840d94 100644 --- a/engines/wage/gui.cpp +++ b/engines/wage/gui.cpp @@ -73,8 +73,8 @@ static const Graphics::MenuData menuSubItems[] = { { kMenuFile, "Quit", kMenuActionQuit, 0, true }, { kMenuEdit, "Undo", kMenuActionUndo, 'Z', false }, - { kMenuEdit, NULL, 0, 0, false }, - { kMenuEdit, "Cut", kMenuActionCut, 'K', 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 }, diff --git a/engines/wage/gui.h b/engines/wage/gui.h index 8536a76fe1d..cf30c577c14 100644 --- a/engines/wage/gui.h +++ b/engines/wage/gui.h @@ -59,12 +59,9 @@ #include "common/rect.h" namespace Wage { - -// Import the enum definitions -using namespace Graphics::MacMenuConstants; -using namespace Graphics::MacWindowConstants; -using namespace Graphics::MacGUIConstants; +using namespace Graphics::MacWindowConstants; + class Scene; class WageEngine; @@ -72,6 +69,44 @@ enum { kCursorHeight = 12 }; +enum { + kFontStyleBold = 1, + kFontStyleItalic = 2, + kFontStyleUnderline = 4, + kFontStyleOutline = 8, + kFontStyleShadow = 16, + kFontStyleCondensed = 32, + kFontStyleExtended = 64 +}; + +enum { + kMenuHighLevel = -1, + kMenuAbout = 0, + kMenuFile = 1, + kMenuEdit = 2, + kMenuCommands = 3, + kMenuWeapons = 4 +}; + +enum { + kMenuActionAbout, + kMenuActionNew, + kMenuActionOpen, + kMenuActionClose, + kMenuActionSave, + kMenuActionSaveAs, + kMenuActionRevert, + kMenuActionQuit, + + kMenuActionUndo, + kMenuActionCut, + kMenuActionCopy, + kMenuActionPaste, + kMenuActionClear, + + kMenuActionCommand +}; + class Gui { public: Gui(WageEngine *engine); diff --git a/engines/wage/world.cpp b/engines/wage/world.cpp index 286ecddf4d3..acc2a83d97f 100644 --- a/engines/wage/world.cpp +++ b/engines/wage/world.cpp @@ -75,7 +75,7 @@ World::World(WageEngine *engine) { _engine = engine; - _patterns = new Patterns; + _patterns = new Graphics::MacPatterns; } World::~World() { diff --git a/engines/wage/world.h b/engines/wage/world.h index e0e044822ce..5c1aaf319e1 100644 --- a/engines/wage/world.h +++ b/engines/wage/world.h @@ -54,7 +54,7 @@ namespace Wage { // Import the enum definitions -using Graphics::Patterns; +using Graphics::MacPatterns; class Script; class Sound; @@ -92,7 +92,7 @@ public: ObjArray _orderedObjs; ChrArray _orderedChrs; Common::Array _orderedSounds; - Graphics::Patterns *_patterns; + Graphics::MacPatterns *_patterns; Scene *_storageScene; Chr *_player; int _signature; diff --git a/graphics/macgui/macmenu.cpp b/graphics/macgui/macmenu.cpp index 3a4d6243560..6169b3e3cdf 100644 --- a/graphics/macgui/macmenu.cpp +++ b/graphics/macgui/macmenu.cpp @@ -66,6 +66,25 @@ enum { kMenuItemHeight = 20 }; +enum { + kMenuHighLevel = -1 +}; + +enum { + kFontStyleBold = 1, + kFontStyleItalic = 2, + kFontStyleUnderline = 4, + kFontStyleOutline = 8, + kFontStyleShadow = 16, + kFontStyleCondensed = 32, + kFontStyleExtended = 64 +}; + +enum { + kMenuActionCommand +}; + + struct MenuSubItem { Common::String text; int action; diff --git a/graphics/macgui/macmenu.h b/graphics/macgui/macmenu.h index ce0b0ed8dbc..5c08f4feed1 100644 --- a/graphics/macgui/macmenu.h +++ b/graphics/macgui/macmenu.h @@ -53,47 +53,6 @@ namespace Graphics { struct MenuItem; struct MenuSubItem; -namespace MacMenuConstants { - enum MacMenuFontStyle { - kFontStyleBold = 1, - kFontStyleItalic = 2, - kFontStyleUnderline = 4, - kFontStyleOutline = 8, - kFontStyleShadow = 16, - kFontStyleCondensed = 32, - kFontStyleExtended = 64 - }; - - enum MacMenuTab { - kMenuHighLevel = -1, - kMenuAbout = 0, - kMenuFile = 1, - kMenuEdit = 2, - kMenuCommands = 3, - kMenuWeapons = 4 - }; - - enum MacMenuAction { - kMenuActionAbout, - kMenuActionNew, - kMenuActionOpen, - kMenuActionClose, - kMenuActionSave, - kMenuActionSaveAs, - kMenuActionRevert, - kMenuActionQuit, - - kMenuActionUndo, - kMenuActionCut, - kMenuActionCopy, - kMenuActionPaste, - kMenuActionClear, - - kMenuActionCommand - }; -} -using namespace MacMenuConstants; - struct MenuData { int menunum; const char *title; diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp index 6c6e4282b73..3d4ef3bc71a 100644 --- a/graphics/macgui/macwindowmanager.cpp +++ b/graphics/macgui/macwindowmanager.cpp @@ -186,11 +186,11 @@ void MacWindowManager::setActive(int id) { struct PlotData { Graphics::ManagedSurface *surface; - Patterns *patterns; + MacPatterns *patterns; uint fillType; int thickness; - PlotData(Graphics::ManagedSurface *s, Patterns *p, int f, int t) : + PlotData(Graphics::ManagedSurface *s, MacPatterns *p, int f, int t) : surface(s), patterns(p), fillType(f), thickness(t) {} }; diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h index d5b817bdca8..5be82e39a3c 100644 --- a/graphics/macgui/macwindowmanager.h +++ b/graphics/macgui/macwindowmanager.h @@ -63,7 +63,7 @@ namespace MacGUIConstants { kDesktopArc = 7 }; - enum MacGUIColor { + enum { kColorBlack = 0, kColorGray = 1, kColorWhite = 2, @@ -71,7 +71,7 @@ namespace MacGUIConstants { kColorGreen2 = 4 }; - enum MacGUIPattern { + enum { kPatternSolid = 1, kPatternStripes = 2, kPatternCheckers = 3, @@ -84,7 +84,7 @@ class ManagedSurface; class Menu; -typedef Common::Array Patterns; +typedef Common::Array MacPatterns; class MacWindowManager { public: @@ -107,7 +107,7 @@ public: BaseMacWindow *getWindow(int id) { return _windows[id]; } - Patterns &getPatterns() { return _patterns; } + MacPatterns &getPatterns() { return _patterns; } void drawFilledRoundRect(ManagedSurface *surface, Common::Rect &rect, int arc, int color); void pushArrowCursor(); @@ -128,7 +128,7 @@ private: bool _fullRefresh; - Patterns _patterns; + MacPatterns _patterns; Menu *_menu;