aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--engines/wage/dialog.cpp4
-rw-r--r--engines/wage/gui.cpp69
-rw-r--r--engines/wage/gui.h4
-rw-r--r--engines/wage/macmenu.cpp2
-rw-r--r--engines/wage/macwindow.cpp7
-rw-r--r--engines/wage/macwindow.h7
-rw-r--r--engines/wage/macwindowmanager.cpp70
-rw-r--r--engines/wage/macwindowmanager.h6
8 files changed, 87 insertions, 82 deletions
diff --git a/engines/wage/dialog.cpp b/engines/wage/dialog.cpp
index 981f42beaf..7a7ed37416 100644
--- a/engines/wage/dialog.cpp
+++ b/engines/wage/dialog.cpp
@@ -145,7 +145,7 @@ int Dialog::run() {
Common::Rect r(_bbox);
_tempSurface.copyRectToSurface(_gui->_screen.getBasePtr(_bbox.left, _bbox.top), _gui->_screen.pitch, 0, 0, _bbox.width() + 1, _bbox.height() + 1);
- _gui->pushArrowCursor();
+ _gui->_wm.pushArrowCursor();
while (!shouldQuit) {
Common::Event event;
@@ -189,7 +189,7 @@ int Dialog::run() {
_gui->_screen.copyRectToSurface(_tempSurface.getBasePtr(0, 0), _tempSurface.pitch, _bbox.left, _bbox.top, _bbox.width() + 1, _bbox.height() + 1);
g_system->copyRectToScreen(_gui->_screen.getBasePtr(r.left, r.top), _gui->_screen.pitch, r.left, r.top, r.width() + 1, r.height() + 1);
- _gui->popCursor();
+ _gui->_wm.popCursor();
return _pressedButton;
}
diff --git a/engines/wage/gui.cpp b/engines/wage/gui.cpp
index 9689788162..afc61c4a27 100644
--- a/engines/wage/gui.cpp
+++ b/engines/wage/gui.cpp
@@ -61,44 +61,6 @@
namespace Wage {
-static const byte macCursorArrow[] = {
- 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 0, 2, 3, 3, 3, 3, 3, 3, 3, 3,
- 2, 0, 0, 2, 3, 3, 3, 3, 3, 3, 3,
- 2, 0, 0, 0, 2, 3, 3, 3, 3, 3, 3,
- 2, 0, 0, 0, 0, 2, 3,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 -156,18 +118,14 @@ Gui::Gui(WageEngine *engine) {
_inputTextLineNum = 0;
- CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
- _cursorIsArrow = true;
- CursorMan.showMouse(true);
-
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "wageCursor");
_menu = _wm.addMenu(this);
- _sceneWindow = _wm.addWindow(false, false);
+ _sceneWindow = _wm.addWindow(false, false, false);
_sceneWindow->setCallback(sceneWindowCallback, this);
- _consoleWindow = _wm.addWindow(true, true);
+ _consoleWindow = _wm.addWindow(true, true, true);
_consoleWindow->setCallback(consoleWindowCallback, this);
}
@@ -243,11 +201,6 @@ static bool sceneWindowCallback(WindowClick click, Common::Event &event, void *g
}
bool Gui::processSceneEvents(WindowClick click, Common::Event &event) {
- if (_cursorIsArrow == false) {
- CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
- _cursorIsArrow = true;
- }
-
if (click == kBorderInner && event.type == Common::EVENT_LBUTTONUP) {
Designed *obj = _scene->lookUpEntity(event.mouse.x - _sceneWindow->getDimensions().left,
event.mouse.y - _sceneWindow->getDimensions().top);
@@ -278,11 +231,6 @@ static bool consoleWindowCallback(WindowClick click, Common::Event &event, void
}
bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) {
- if (click != kBorderInner && _cursorIsArrow == false) {
- CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
- _cursorIsArrow = true;
- }
-
if (click == kBorderScrollUp || click == kBorderScrollDown) {
if (event.type == Common::EVENT_LBUTTONDOWN) {
int consoleHeight = _consoleWindow->getInnerDimensions().height();
@@ -361,11 +309,6 @@ bool Gui::processConsoleEvents(WindowClick click, Common::Event &event) {
updateTextSelection(event.mouse.x, event.mouse.y);
return true;
}
-
- if (_cursorIsArrow) {
- CursorMan.replaceCursor(macCursorBeam, 11, 16, 3, 8, 3);
- _cursorIsArrow = false;
- }
}
return false;
@@ -382,14 +325,6 @@ void Gui::regenWeaponsMenu() {
_menu->regenWeaponsMenu();
}
-void Gui::pushArrowCursor() {
- CursorMan.pushCursor(macCursorArrow, 11, 16, 1, 1, 3);
-}
-
-void Gui::popCursor() {
- CursorMan.popCursor();
-}
-
bool Gui::processEvent(Common::Event &event) {
return _wm.processEvent(event);
}
diff --git a/engines/wage/gui.h b/engines/wage/gui.h
index 448f0b44f7..5c3c281bc5 100644
--- a/engines/wage/gui.h
+++ b/engines/wage/gui.h
@@ -89,8 +89,6 @@ public:
void setSceneDirty() { _sceneDirty = true; }
void regenCommandsMenu();
void regenWeaponsMenu();
- void pushArrowCursor();
- void popCursor();
void actionCopy();
void actionPaste();
@@ -147,8 +145,6 @@ private:
uint _consoleNumLines;
bool _consoleFullRedraw;
- bool _cursorIsArrow;
-
bool _inTextSelection;
int _selectionStartX;
int _selectionStartY;
diff --git a/engines/wage/macmenu.cpp b/engines/wage/macmenu.cpp
index 15831825c7..bc8718b179 100644
--- a/engines/wage/macmenu.cpp
+++ b/engines/wage/macmenu.cpp
@@ -105,7 +105,7 @@ struct MenuData {
};
Menu::Menu(int id, const Common::Rect &bounds, MacWindowManager *wm, Gui *gui)
- : BaseMacWindow(id, wm), _gui(gui) {
+ : BaseMacWindow(id, false, wm), _gui(gui) {
_font = getMenuFont();
_screen.create(bounds.width(), bounds.height(), Graphics::PixelFormat::createFormatCLUT8());
diff --git a/engines/wage/macwindow.cpp b/engines/wage/macwindow.cpp
index c46def61b8..c021836032 100644
--- a/engines/wage/macwindow.cpp
+++ b/engines/wage/macwindow.cpp
@@ -54,7 +54,8 @@
namespace Wage {
-BaseMacWindow::BaseMacWindow(int id, MacWindowManager *wm) : _id(id), _wm(wm) {
+BaseMacWindow::BaseMacWindow(int id, bool editable, MacWindowManager *wm) :
+ _id(id), _editable(editable), _wm(wm) {
_callback = 0;
_dataPtr = 0;
@@ -63,8 +64,8 @@ BaseMacWindow::BaseMacWindow(int id, MacWindowManager *wm) : _id(id), _wm(wm) {
_type = kWindowUnknown;
}
-MacWindow::MacWindow(int id, bool scrollable, bool resizable, MacWindowManager *wm) :
- BaseMacWindow(id, wm), _scrollable(scrollable), _resizable(resizable) {
+MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, 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 4b2f71e82c..8d2fda30c9 100644
--- a/engines/wage/macwindow.h
+++ b/engines/wage/macwindow.h
@@ -76,12 +76,13 @@ enum WindowClick {
class BaseMacWindow {
public:
- BaseMacWindow(int id, 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; }
virtual void setActive(bool active) = 0;
void setDirty(bool dirty) { _contentIsDirty = dirty; }
@@ -97,6 +98,8 @@ protected:
int _id;
WindowType _type;
+ bool _editable;
+
Graphics::ManagedSurface _surface;
bool _contentIsDirty;
@@ -110,7 +113,7 @@ protected:
class MacWindow : public BaseMacWindow {
public:
- MacWindow(int id, bool scrollable, bool resizable, 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);
diff --git a/engines/wage/macwindowmanager.cpp b/engines/wage/macwindowmanager.cpp
index c98c63532f..b70ebd24b8 100644
--- a/engines/wage/macwindowmanager.cpp
+++ b/engines/wage/macwindowmanager.cpp
@@ -79,6 +79,44 @@ static byte fillPatterns[][8] = { { 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0xff, 0x
{ 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa, 0x55, 0xaa } // kPatternCheckers2
};
+static const byte macCursorArrow[] = {
+ 2, 2, 3, 3, 3, 3, 3, 3, 3, 3, 3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 3, 3,
+ 3, 3, 3, 0, 3, 3, 3, 3, 3, 3, 3,
+ 3, 3, 0, 3, 0, 3, 3, 3, 3, 3, 3,
+ 0, 0, 3, 3, 3, 0, 0, 3, 3, 3, 3,
+};
+
MacWindowManager::MacWindowManager() {
_screen = 0;
_lastId = 0;
@@ -98,6 +136,9 @@ MacWindowManager::MacWindowManager() {
g_system->getPaletteManager()->setPalette(palette, 0, ARRAYSIZE(palette) / 3);
CursorMan.replaceCursorPalette(palette, 0, ARRAYSIZE(palette) / 3);
+ CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
+ _cursorIsArrow = true;
+ CursorMan.showMouse(true);
}
MacWindowManager::~MacWindowManager() {
@@ -105,8 +146,8 @@ MacWindowManager::~MacWindowManager() {
delete _windows[i];
}
-MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable) {
- MacWindow *w = new MacWindow(_lastId, scrollable, resizable, this);
+MacWindow *MacWindowManager::addWindow(bool scrollable, bool resizable, bool editable) {
+ MacWindow *w = new MacWindow(_lastId, scrollable, resizable, editable, this);
_windows.push_back(w);
_windowStack.push_back(w);
@@ -186,6 +227,19 @@ bool MacWindowManager::processEvent(Common::Event &event) {
event.type != Common::EVENT_LBUTTONUP)
return false;
+ if (_windows[_activeWindow]->isEditable() && _windows[_activeWindow]->getType() == kWindowWindow &&
+ ((MacWindow *)_windows[_activeWindow])->getInnerDimensions().contains(event.mouse.x, event.mouse.y)) {
+ if (_cursorIsArrow) {
+ CursorMan.replaceCursor(macCursorBeam, 11, 16, 3, 8, 3);
+ _cursorIsArrow = false;
+ }
+ } else {
+ if (_cursorIsArrow == false) {
+ CursorMan.replaceCursor(macCursorArrow, 11, 16, 1, 1, 3);
+ _cursorIsArrow = true;
+ }
+ }
+
for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.end(); it != _windowStack.begin();) {
it--;
BaseMacWindow *w = *it;
@@ -264,4 +318,16 @@ const Graphics::Font *MacWindowManager::getFont(const char *name, Graphics::Font
return font;
}
+/////////////////
+// Cursor stuff
+/////////////////
+void MacWindowManager::pushArrowCursor() {
+ CursorMan.pushCursor(macCursorArrow, 11, 16, 1, 1, 3);
+}
+
+void MacWindowManager::popCursor() {
+ CursorMan.popCursor();
+}
+
+
} // End of namespace Wage
diff --git a/engines/wage/macwindowmanager.h b/engines/wage/macwindowmanager.h
index d570264679..fe85f8e530 100644
--- a/engines/wage/macwindowmanager.h
+++ b/engines/wage/macwindowmanager.h
@@ -69,7 +69,7 @@ public:
bool hasBuiltInFonts() { return _builtInFonts; }
const Graphics::Font *getFont(const char *name, Graphics::FontManager::FontUsage fallback);
- MacWindow *addWindow(bool scrollable, bool resizable);
+ MacWindow *addWindow(bool scrollable, bool resizable, bool editable);
Menu *addMenu(Gui *gui);
void setActive(int id);
@@ -83,6 +83,9 @@ public:
Patterns &getPatterns() { return _patterns; }
+ void pushArrowCursor();
+ void popCursor();
+
private:
void drawDesktop();
void loadFonts();
@@ -103,6 +106,7 @@ private:
Menu *_menu;
bool _builtInFonts;
+ bool _cursorIsArrow;
};
} // End of namespace Wage