scummvm/engines/macventure/gui.cpp

716 lines
21 KiB
C++
Raw Normal View History

2016-06-08 17:13:02 +02:00
/* 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.
*
*/
2016-06-08 11:02:21 +02:00
#include "common/file.h"
#include "image/bmp.h"
2016-06-08 16:07:53 +02:00
#include "macventure/macventure.h"
#include "macventure/gui.h"
2016-06-08 11:02:21 +02:00
namespace MacVenture {
2016-06-09 11:31:19 +02:00
enum MenuAction;
enum {
kMenuHighLevel = -1,
kMenuAbout = 0,
kMenuFile = 1,
kMenuEdit = 2,
kMenuSpecial = 3
};
2016-06-08 16:07:53 +02:00
static const Graphics::MenuData menuSubItems[] = {
2016-06-09 11:31:19 +02:00
{ kMenuHighLevel, "File", 0, 0, false },
{ kMenuHighLevel, "Edit", 0, 0, false },
2016-06-09 11:31:19 +02:00
{ kMenuHighLevel, "Special", 0, 0, false },
{ kMenuHighLevel, "Font", 0, 0, false },
{ kMenuHighLevel, "FontSize", 0, 0, false },
//{ kMenuAbout, "About", kMenuActionAbout, 0, true},
{ kMenuFile, "New", kMenuActionNew, 0, true },
{ kMenuFile, NULL, 0, 0, false },
{ kMenuFile, "Open...", kMenuActionOpen, 0, true },
{ kMenuFile, "Save", kMenuActionSave, 0, true },
{ kMenuFile, "Save as...", kMenuActionSaveAs, 0, true },
{ kMenuFile, NULL, 0, 0, false },
{ kMenuFile, "Quit", kMenuActionQuit, 0, true },
{ kMenuEdit, "Undo", kMenuActionUndo, 'Z', true },
{ kMenuEdit, NULL, 0, 0, false },
{ kMenuEdit, "Cut", kMenuActionCut, 'K', true },
{ kMenuEdit, "Copy", kMenuActionCopy, 'C', true },
{ kMenuEdit, "Paste", kMenuActionPaste, 'V', true },
{ kMenuEdit, "Clear", kMenuActionClear, 'B', true },
{ kMenuSpecial, "Clean Up", kMenuActionCleanUp, 0, true },
{ kMenuSpecial, "Mess Up", kMenuActionMessUp, 0, true },
{ 0, NULL, 0, 0, false }
2016-06-08 16:07:53 +02:00
};
2016-06-17 12:44:52 +02:00
bool commandsWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool mainGameWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
2016-06-09 11:31:19 +02:00
bool outConsoleWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool selfWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool exitsWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool diplomaWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
bool inventoryWindowCallback(Graphics::WindowClick, Common::Event &event, void *gui);
2016-06-09 11:31:19 +02:00
void menuCommandsCallback(int action, Common::String &text, void *data);
2016-06-08 17:13:02 +02:00
Gui::Gui(MacVentureEngine *engine, Common::MacResManager *resman) {
2016-06-08 16:07:53 +02:00
_engine = engine;
2016-06-08 17:13:02 +02:00
_resourceManager = resman;
2016-06-08 11:02:21 +02:00
initGUI();
}
Gui::~Gui() {
}
void Gui::draw() {
2016-06-13 00:36:24 +02:00
drawWindows();
2016-06-11 23:57:35 +02:00
_wm.draw();
2016-06-08 11:02:21 +02:00
}
2016-06-20 08:59:53 +02:00
void Gui::drawMenu() {
_menu->draw(&_screen);
}
2016-06-08 17:13:02 +02:00
bool Gui::processEvent(Common::Event &event) {
return _wm.processEvent(event);
}
const WindowData& Gui::getWindowData(WindowReference reference) {
return findWindowData(reference);
}
const Graphics::Font& Gui::getCurrentFont() {
return *_wm.getFont("Chicago-12", Graphics::FontManager::kBigGUIFont);
}
void Gui::bringToFront(WindowReference winID) {
// FIXME: There has to be a better way to do this, maybe with the _wm
switch (winID) {
case MacVenture::kCommandsWindow:
_controlsWindow->setActive(true);
break;
case MacVenture::kMainGameWindow:
_mainGameWindow->setActive(true);
break;
case MacVenture::kOutConsoleWindow:
_outConsoleWindow->setActive(true);
break;
case MacVenture::kSelfWindow:
_selfWindow->setActive(true);
break;
case MacVenture::kExitsWindow:
_exitsWindow->setActive(true);
break;
case MacVenture::kDiplomaWindow:
_diplomaWindow->setActive(true);
break;
default:
break;
}
}
void Gui::setWindowTitle(WindowReference winID, Common::String string) {
findWindowData(winID).title = string;
findWindowData(winID).titleLength = string.size();
}
2016-06-08 11:02:21 +02:00
void Gui::initGUI() {
_screen.create(kScreenWidth, kScreenHeight, Graphics::PixelFormat::createFormatCLUT8());
_wm.setScreen(&_screen);
2016-06-09 11:31:19 +02:00
// Menu
2016-06-08 16:07:53 +02:00
_menu = _wm.addMenu();
2016-06-08 17:13:02 +02:00
if (!loadMenus())
error("Could not load menus");
2016-06-09 11:31:19 +02:00
_menu->setCommandsCallback(menuCommandsCallback, this);
2016-06-08 16:07:53 +02:00
_menu->calcDimensions();
if (!loadWindows())
error("Could not load windows");
initWindows();
if (!loadControls())
error("Could not load controls");
draw();
}
void Gui::initWindows() {
// Game Controls Window
_controlsWindow = _wm.addWindow(false, false, false);
_controlsWindow->setDimensions(getWindowData(kCommandsWindow).bounds);
_controlsWindow->setActive(false);
2016-06-17 12:44:52 +02:00
_controlsWindow->setCallback(commandsWindowCallback, this);
loadBorder(_controlsWindow, "border_command.bmp", false);
2016-06-11 23:57:35 +02:00
loadBorder(_controlsWindow, "border_command.bmp", true);
2016-06-12 22:09:06 +02:00
// Main Game Window
_mainGameWindow = _wm.addWindow(false, false, false);
_mainGameWindow->setDimensions(getWindowData(kMainGameWindow).bounds);
_mainGameWindow->setActive(false);
_mainGameWindow->setCallback(mainGameWindowCallback, this);
loadBorder(_mainGameWindow, "border_command.bmp", false);
loadBorder(_mainGameWindow, "border_command.bmp", true);
2016-06-12 22:09:06 +02:00
// In-game Output Console
_outConsoleWindow = _wm.addWindow(false, true, true);
_outConsoleWindow->setDimensions(Common::Rect(20, 20, 120, 120));
_outConsoleWindow->setActive(false);
_outConsoleWindow->setCallback(outConsoleWindowCallback, this);
loadBorder(_outConsoleWindow, "border_command.bmp", false);
// Self Window
_selfWindow = _wm.addWindow(false, true, true);
_selfWindow->setDimensions(getWindowData(kSelfWindow).bounds);
_selfWindow->setActive(false);
_selfWindow->setCallback(selfWindowCallback, this);
2016-06-13 00:36:24 +02:00
loadBorder(_selfWindow, "border_self_inac.bmp", false);
loadBorder(_selfWindow, "border_self_act.bmp", true);
// Exits Window
_exitsWindow = _wm.addWindow(false, true, true);
_exitsWindow->setDimensions(getWindowData(kExitsWindow).bounds);
_exitsWindow->setActive(false);
_exitsWindow->setCallback(exitsWindowCallback, this);
loadBorder(_exitsWindow, "border_title_inac.bmp", false);
loadBorder(_exitsWindow, "border_title_inac.bmp", true);
// Diploma Window (we can go without it for now)
/*
_diplomaWindow = _wm.addWindow(false, true, true);
_diplomaWindow->setDimensions(getWindowData(kDiplomaWindow).bounds);
_diplomaWindow->setActive(false);
_diplomaWindow->setCallback(diplomaWindowCallback, this);
loadBorder(_diplomaWindow, "border_command.bmp", false);
// Render invisible for now
_diplomaWindow->getSurface()->fillRect(_diplomaWindow->getSurface()->getBounds(), kColorGreen2);
*/
2016-06-08 11:02:21 +02:00
}
void Gui::loadBorder(Graphics::MacWindow * target, Common::String filename, bool active) {
Common::File borderfile;
if (!borderfile.open(filename)) {
debug(1, "Cannot open border file");
return;
}
Image::BitmapDecoder bmpDecoder;
Common::SeekableReadStream *stream = borderfile.readStream(borderfile.size());
Graphics::Surface source;
Graphics::TransparentSurface *surface = new Graphics::TransparentSurface();
if (stream) {
debug(4, "Loading %s border from %s", (active ? "active" : "inactive"), filename);
bmpDecoder.loadStream(*stream);
source = *(bmpDecoder.getSurface());
source.convertToInPlace(surface->getSupportedPixelFormat(), bmpDecoder.getPalette());
surface->create(source.w, source.h, source.format);
surface->copyFrom(source);
surface->applyColorKey(255, 0, 255, false);
target->setBorder(*surface, active);
borderfile.close();
delete stream;
}
}
2016-06-08 17:13:02 +02:00
bool Gui::loadMenus() {
2016-06-09 11:31:19 +02:00
// We assume that, if there are static menus, we don't need dynamic ones
if (menuSubItems) {
_menu->addStaticMenus(menuSubItems);
return true;
}
2016-06-08 17:13:02 +02:00
Common::MacResIDArray resArray;
Common::SeekableReadStream *res;
Common::MacResIDArray::const_iterator iter;
if ((resArray = _resourceManager->getResIDArray(MKTAG('M', 'E', 'N', 'U'))).size() == 0)
return false;
2016-06-08 17:13:02 +02:00
2016-06-09 11:31:19 +02:00
_menu->addMenuSubItem(0, "Abb", kMenuActionAbout, 0, 'A', true);
2016-06-08 17:13:02 +02:00
int i = 1;
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
res = _resourceManager->getResource(MKTAG('M', 'E', 'N', 'U'), *iter);
2016-06-08 19:02:15 +02:00
bool enabled;
uint16 key;
2016-06-09 11:31:19 +02:00
uint16 style;
2016-06-08 19:02:15 +02:00
uint8 titleLength;
char* title;
2016-06-08 17:13:02 +02:00
/* Skip menuID, width, height, resourceID, placeholder */
for (int skip = 0; skip < 5; skip++) { res->readUint16BE(); }
2016-06-08 19:02:15 +02:00
enabled = res->readUint32BE();
titleLength = res->readByte();
title = new char[titleLength + 1];
2016-06-08 17:13:02 +02:00
res->read(title, titleLength);
title[titleLength] = '\0';
2016-06-09 11:31:19 +02:00
if (titleLength > 1) {
2016-06-08 17:13:02 +02:00
_menu->addMenuItem(title);
// Read submenu items
while (titleLength = res->readByte()) {
title = new char[titleLength + 1];
res->read(title, titleLength);
title[titleLength] = '\0';
2016-06-08 19:02:15 +02:00
// Skip icon
res->readUint16BE();
2016-06-09 11:31:19 +02:00
// Read key
2016-06-08 19:02:15 +02:00
key = res->readUint16BE();
2016-06-09 11:31:19 +02:00
// Skip mark
res->readUint16BE();
// Read style
style = res->readUint16BE();
_menu->addMenuSubItem(i, title, 0, style, key, false);
2016-06-08 17:13:02 +02:00
}
}
2016-06-08 17:13:02 +02:00
i++;
2016-06-09 11:31:19 +02:00
}
2016-06-08 17:13:02 +02:00
return true;
2016-06-09 11:31:19 +02:00
}
2016-06-12 20:22:01 +02:00
bool Gui::loadWindows() {
Common::MacResIDArray resArray;
Common::SeekableReadStream *res;
Common::MacResIDArray::const_iterator iter;
_windowData = new Common::List<WindowData>();
if ((resArray = _resourceManager->getResIDArray(MKTAG('W', 'I', 'N', 'D'))).size() == 0)
return false;
uint32 id = kCommandsWindow;
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
res = _resourceManager->getResource(MKTAG('W', 'I', 'N', 'D'), *iter);
WindowData data;
2016-06-20 08:59:53 +02:00
uint16 top, left, bottom, right;
2016-06-12 20:22:01 +02:00
top = res->readUint16BE();
left = res->readUint16BE();
bottom = res->readUint16BE();
right = res->readUint16BE();
data.type = (MVWindowType)res->readUint16BE();
data.bounds = Common::Rect(
left - borderBounds(data.type).leftOffset,
top - borderBounds(data.type).topOffset,
right + borderBounds(data.type).rightOffset * 2,
bottom + borderBounds(data.type).bottomOffset * 2);
2016-06-12 20:22:01 +02:00
data.visible = res->readUint16BE();
data.hasCloseBox = res->readUint16BE();
data.refcon = (WindowReference)id; id++;
res->readUint32BE(); // Skip the true id. For some reason it's reading 0
data.titleLength = res->readByte();
if (data.titleLength) {
char* newTitle = new char[data.titleLength + 1];
res->read(newTitle, data.titleLength);
newTitle[data.titleLength] = '\0';
data.title = Common::String(newTitle);
2016-06-12 20:22:01 +02:00
}
debug(5, "Window loaded: %s", data.title);
2016-06-12 20:22:01 +02:00
_windowData->push_back(data);
}
return true;
}
bool Gui::loadControls() {
Common::MacResIDArray resArray;
Common::SeekableReadStream *res;
Common::MacResIDArray::const_iterator iter;
_controlData = new Common::List<CommandButton>();
if ((resArray = _resourceManager->getResIDArray(MKTAG('C', 'N', 'T', 'L'))).size() == 0)
return false;
uint16 commandsBorder = borderBounds(kPlainDBox).topOffset;
2016-06-12 20:22:01 +02:00
uint32 id = kControlExitBox;
for (iter = resArray.begin(); iter != resArray.end(); ++iter) {
res = _resourceManager->getResource(MKTAG('C', 'N', 'T', 'L'), *iter);
ControlData data;
uint16 top, left, bottom, right;
top = res->readUint16BE();
left = res->readUint16BE();
bottom = res->readUint16BE();
right = res->readUint16BE();
data.scrollValue = res->readUint16BE();
data.visible = res->readByte();
res->readByte(); // Unused
data.scrollMax = res->readUint16BE();
data.scrollMin = res->readUint16BE();
data.cdef = res->readUint16BE();
data.refcon = (ControlReference)id; id++;
res->readUint32BE();
data.titleLength = res->readByte();
if (data.titleLength) {
data.title = new char[data.titleLength + 1];
res->read(data.title, data.titleLength);
data.title[data.titleLength] = '\0';
}
2016-06-12 22:09:06 +02:00
if (data.refcon != kControlExitBox)
data.border = commandsBorder;
Common::Rect bounds(left, top, right, bottom); // For some reason, if I remove this it segfaults
data.bounds = Common::Rect(left + data.border, top + data.border, right + data.border, bottom + data.border);
2016-06-12 20:22:01 +02:00
i++;
}
return true;
}
2016-06-13 00:36:24 +02:00
void Gui::drawWindows() {
drawCommandsWindow();
drawMainGameWindow();
drawSelfWindow();
}
2016-06-12 22:09:06 +02:00
void Gui::drawCommandsWindow() {
if (_engine->isPaused()) {
Graphics::ManagedSurface *srf = _controlsWindow->getSurface();
WindowData data = getWindowData(kCommandsWindow);
uint16 border = borderBounds(data.type).topOffset;
2016-06-12 22:09:06 +02:00
srf->fillRect(Common::Rect(border * 2, border * 2, srf->w - (border * 3), srf->h - (border * 3)), kColorWhite);
getCurrentFont().drawString(
srf,
_engine->getCommandsPausedString(),
0,
(srf->h / 2) - getCurrentFont().getFontHeight(),
data.bounds.right - data.bounds.left,
kColorBlack,
Graphics::kTextAlignCenter);
}
else {
Common::List<CommandButton>::const_iterator it = _controlData->begin();
for (; it != _controlData->end(); ++it) {
CommandButton button = *it;
if (button.getData().refcon != kControlExitBox)
button.draw(*_controlsWindow->getSurface());
}
}
}
2016-06-13 00:36:24 +02:00
void Gui::drawMainGameWindow() {
Graphics::ManagedSurface *srf = _mainGameWindow->getSurface();
BorderBounds border = borderBounds(getWindowData(kMainGameWindow).type);
srf->fillRect(
Common::Rect(
border.leftOffset * 2,
border.topOffset * 2,
srf->w - (border.rightOffset * 3),
srf->h - (border.bottomOffset * 3)),
kColorWhite);
getCurrentFont().drawString(
srf,
Common::String("Main Game Window"),
0,
(srf->h / 2) - getCurrentFont().getFontHeight(),
srf->w,
kColorBlack,
Graphics::kTextAlignCenter);
}
void Gui::drawSelfWindow() {
warning("drawSelfWindow: Unimplemented");
}
WindowData & Gui::findWindowData(WindowReference reference) {
assert(_windowData);
2016-06-13 00:36:24 +02:00
Common::List<WindowData>::iterator iter = _windowData->begin();
while (iter->refcon != reference && iter != _windowData->end()) {
iter++;
}
if (iter->refcon == reference)
return *iter;
error("Could not locate the desired window data");
2016-06-13 00:36:24 +02:00
}
2016-06-12 22:09:06 +02:00
2016-06-09 11:31:19 +02:00
/* CALLBACKS */
2016-06-17 12:44:52 +02:00
bool commandsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
return g->processCommandEvents(click, event);
}
bool mainGameWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
return g->processMainGameEvents(click, event);
}
2016-06-11 23:57:35 +02:00
bool outConsoleWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
return g->processOutConsoleEvents(click, event);
2016-06-09 11:31:19 +02:00
}
bool selfWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
2016-06-11 23:57:35 +02:00
Gui *g = (Gui*)gui;
return g->processSelfEvents(click, event);
}
bool exitsWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
return g->processExitsEvents(click, event);
}
bool diplomaWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
return g->processDiplomaEvents(click, event);
}
bool inventoryWindowCallback(Graphics::WindowClick click, Common::Event &event, void *gui) {
Gui *g = (Gui*)gui;
2016-06-20 08:59:53 +02:00
return g->processInventoryEvents(click, event);
2016-06-11 23:57:35 +02:00
}
2016-06-09 11:31:19 +02:00
void menuCommandsCallback(int action, Common::String &text, void *data) {
Gui *g = (Gui *)data;
g->handleMenuAction((MenuAction)action);
}
/* HANDLERS */
void Gui::handleMenuAction(MenuAction action) {
switch (action) {
case MacVenture::kMenuActionAbout:
debug("MacVenture Menu Action: About");
break;
case MacVenture::kMenuActionNew:
debug("MacVenture Menu Action: New");
break;
case MacVenture::kMenuActionOpen:
debug("MacVenture Menu Action: Open");
break;
case MacVenture::kMenuActionSave:
debug("MacVenture Menu Action: Save");
break;
case MacVenture::kMenuActionSaveAs:
debug("MacVenture Menu Action: Save As");
break;
case MacVenture::kMenuActionQuit:
debug("MacVenture Menu Action: Quit");
break;
case MacVenture::kMenuActionUndo:
debug("MacVenture Menu Action: Undo");
break;
case MacVenture::kMenuActionCut:
debug("MacVenture Menu Action: Cut");
break;
case MacVenture::kMenuActionCopy:
debug("MacVenture Menu Action: Copy");
break;
case MacVenture::kMenuActionPaste:
debug("MacVenture Menu Action: Paste");
break;
case MacVenture::kMenuActionClear:
debug("MacVenture Menu Action: Clear");
break;
case MacVenture::kMenuActionCleanUp:
debug("MacVenture Menu Action: Clean Up");
break;
case MacVenture::kMenuActionMessUp:
debug("MacVenture Menu Action: Mess Up");
break;
case MacVenture::kMenuActionCommand:
debug("MacVenture Menu Action: GENERIC");
break;
default:
break;
}
2016-06-08 16:07:53 +02:00
}
void Gui::updateWindow(WindowReference winID, bool containerOpen) {
if (winID > 0x90) return;
if (winID == kSelfWindow || containerOpen) {
if (winID == kMainGameWindow) {
warning("Unimplemented: draw main game window");
} else {
warning("Unimplemented: fill window with background");
}
WindowData &data = findWindowData(winID);
Common::Array<ObjID> children = data.children;
for (Common::Array<ObjID>::const_iterator it = children.begin(); it != children.end(); it++) {
warning("Unimplemented: draw object %x", *it);
}
if (data.type == kZoomDoc && data.updateScroll) {
warning("Unimplemented: update scroll");
}
}
}
WindowReference Gui::createInventoryWindow() {
Graphics::MacWindow *newWindow = _wm.addWindow(true, true, true);
WindowData newData;
GlobalSettings settings = _engine->getGlobalSettings();
newData.refcon = (WindowReference)ABS(_inventoryWindows.size()); // This is a hack
if (_windowData->back().refcon < 0x80) { // There is already another inventory window
newData.bounds = _windowData->back().bounds; // Inventory windows are always last
newData.bounds.translate(newData.bounds.left + settings.invOffsetX, newData.bounds.top + settings.invOffsetY);
} else {
newData.bounds = Common::Rect(
settings.invLeft,
settings.invTop,
settings.invLeft + settings.invWidth,
settings.invTop + settings.invHeight);
}
newData.type = kZoomDoc;
newData.hasCloseBox = true;
newData.visible = true;
_windowData->push_back(newData);
newWindow->setDimensions(newData.bounds);
newWindow->setCallback(inventoryWindowCallback, this);
loadBorder(newWindow, "border_self_inac.bmp", false);
loadBorder(newWindow, "border_self_act.bmp", true);
_inventoryWindows.push_back(newWindow);
return newData.refcon;
}
2016-06-11 23:57:35 +02:00
bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
if (event.type == Common::EVENT_LBUTTONUP) {
if (_engine->isPaused())
2016-06-17 12:44:52 +02:00
return true;
2016-06-17 12:44:52 +02:00
Common::Point position(
event.mouse.x - _controlsWindow->getDimensions().left,
event.mouse.y - _controlsWindow->getDimensions().top);
CommandButton data;
Common::List<CommandButton>::const_iterator it = _controlData->begin();
for (; it != _controlData->end(); ++it) {
if (it->isInsideBounds(position)) {
debug("Command active: %s", it->getData().title);
data = *it;
2016-06-11 23:57:35 +02:00
}
}
2016-06-17 12:44:52 +02:00
_engine->selectControl((ControlReference)data.getData().refcon);
_engine->activateCommand((ControlReference)data.getData().refcon);
_engine->refreshReady();
_engine->preparedToRun();
2016-06-11 23:57:35 +02:00
}
return false;
}
bool MacVenture::Gui::processMainGameEvents(WindowClick click, Common::Event & event) {
debug(6, "Processing event in Main Game Window");
return getWindowData(kMainGameWindow).visible;
}
bool MacVenture::Gui::processOutConsoleEvents(WindowClick click, Common::Event & event) {
debug(6, "Processing event in Out Console Window");
return getWindowData(kOutConsoleWindow).visible;
}
bool MacVenture::Gui::processSelfEvents(WindowClick click, Common::Event & event) {
debug(6, "Processing event in Self Window");
return getWindowData(kSelfWindow).visible;
}
bool MacVenture::Gui::processExitsEvents(WindowClick click, Common::Event & event) {
debug(6, "Processing event in Exits Window");
return getWindowData(kExitsWindow).visible;
}
bool MacVenture::Gui::processDiplomaEvents(WindowClick click, Common::Event & event) {
debug(6, "Processing event in Diploma Window");
return getWindowData(kDiplomaWindow).visible;
}
2016-06-20 08:59:53 +02:00
bool Gui::processInventoryEvents(WindowClick click, Common::Event & event) {
return false;
}
2016-06-12 20:22:01 +02:00
/* Ugly switches */
BorderBounds Gui::borderBounds(MVWindowType type) {
2016-06-12 20:22:01 +02:00
switch (type) {
case MacVenture::kDocument:
break;
case MacVenture::kDBox:
break;
case MacVenture::kPlainDBox:
return BorderBounds(6, 6, 6, 6);
2016-06-12 20:22:01 +02:00
case MacVenture::kAltBox:
2016-06-13 00:36:24 +02:00
//return BorderBounds(8, 9, 11, 10); // For now, I'll stick to the original bmp, it's gorgeous
2016-06-12 20:22:01 +02:00
break;
case MacVenture::kNoGrowDoc:
return BorderBounds(1, 17, 1, 1);
2016-06-12 20:22:01 +02:00
case MacVenture::kMovableDBox:
break;
case MacVenture::kZoomDoc:
return BorderBounds(1, 19, 16, 1);
2016-06-12 20:22:01 +02:00
case MacVenture::kZoomNoGrow:
break;
case MacVenture::kRDoc16:
break;
case MacVenture::kRDoc4:
return BorderBounds(1, 19, 1, 1);
2016-06-12 20:22:01 +02:00
case MacVenture::kRDoc6:
break;
case MacVenture::kRDoc10:
break;
default:
break;
}
return BorderBounds(0, 0, 0, 0);
2016-06-12 20:22:01 +02:00
}
2016-06-08 11:02:21 +02:00
} // End of namespace MacVenture