From 2e4117e388d13af0464f7f4d84c1931dbb040fa5 Mon Sep 17 00:00:00 2001 From: DivyamAhuja <39771050+DivyamAhuja@users.noreply.github.com> Date: Fri, 9 Jul 2021 09:10:25 +0530 Subject: [PATCH] MACVENTURE: Add title to windows --- engines/macventure/gui.cpp | 23 +++++++++++++---------- engines/macventure/windows.cpp | 12 ++++++------ 2 files changed, 19 insertions(+), 16 deletions(-) diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp index 94121ae62f5..d841d601140 100644 --- a/engines/macventure/gui.cpp +++ b/engines/macventure/gui.cpp @@ -254,7 +254,7 @@ void Gui::initWindows() { _outConsoleWindow->move(bounds.left - bbs.leftOffset, bounds.top - bbs.topOffset); _outConsoleWindow->setActive(false); _outConsoleWindow->setCallback(outConsoleWindowCallback, this); - + _outConsoleWindow->setTitle("Untitled"); // Self Window _selfWindow = _wm.addWindow(false, true, false); @@ -278,7 +278,7 @@ void Gui::initWindows() { _exitsWindow->setActive(false); _exitsWindow->setCallback(exitsWindowCallback, this); - + _exitsWindow->setTitle(findWindowData(kExitsWindow).title); // TODO: In the original, the background is actually a clickable // object that can be used to refer to the room itself. In that case, // the background should be kPatternDarkGray. @@ -294,12 +294,13 @@ const Graphics::Font &Gui::getCurrentFont() { } void Gui::bringToFront(WindowReference winID) { - findWindow(winID)->setActive(true); + _wm.setActiveWindow(findWindow(winID)->getId()); } void Gui::setWindowTitle(WindowReference winID, Common::String string) { findWindowData(winID).title = string; findWindowData(winID).titleLength = string.size(); + findWindow(winID)->setTitle(string); } void Gui::updateWindowInfo(WindowReference ref, ObjID objID, const Common::Array &children) { @@ -378,7 +379,8 @@ WindowReference Gui::createInventoryWindow(ObjID objRef) { _windowData->push_back(newData); BorderBounds bbs = borderBounds(newData.type); - newWindow->setDimensions(newData.bounds); + //newWindow->setDimensions(newData.bounds); + //newWindow->setActive(false); loadBorders(newWindow, newData.type); newWindow->resize(newData.bounds.width() - bbs.rightScrollbarWidth, newData.bounds.height() - bbs.bottomScrollbarHeight, true); newWindow->move(newData.bounds.left - bbs.leftOffset, newData.bounds.top - bbs.topOffset); @@ -996,12 +998,13 @@ void Gui::moveDraggedObject(Common::Point target) { WindowReference Gui::findWindowAtPoint(Common::Point point) { Common::List::iterator it; - Graphics::MacWindow *win; - for (it = _windowData->begin(); it != _windowData->end(); it++) { - win = findWindow(it->refcon); - if (win && it->refcon != kDiplomaWindow) { //HACK, diploma should be cosnidered - if (win->getDimensions().contains(point)) { - return it->refcon; + Graphics::MacWindow *win = _wm.findWindowAtPoint(point); + if (win != nullptr) { + for (it = _windowData->begin(); it != _windowData->end(); it++) { + if ( win == findWindow(it->refcon) && it->refcon != kDiplomaWindow) { //HACK, diploma should be cosnidered + if (win->getDimensions().contains(point)) { + return it->refcon; + } } } } diff --git a/engines/macventure/windows.cpp b/engines/macventure/windows.cpp index d76d43b049d..876bd2207a5 100644 --- a/engines/macventure/windows.cpp +++ b/engines/macventure/windows.cpp @@ -97,14 +97,14 @@ Graphics::BorderOffsets borderOffsets(MVWindowType type) { case MacVenture::kNoGrowDoc: offsets.titleTop = 0; offsets.titleBottom = 0; - offsets.titlePos = 10; + offsets.titlePos = 0; break; case MacVenture::kMovableDBox: break; case MacVenture::kZoomDoc: offsets.titleTop = 0; offsets.titleBottom = 0; - offsets.titlePos = 10; + offsets.titlePos = 0; offsets.upperScrollHeight = 20; offsets.lowerScrollHeight = 20; @@ -112,20 +112,20 @@ Graphics::BorderOffsets borderOffsets(MVWindowType type) { case MacVenture::kZoomNoGrow: offsets.titleTop = 0; offsets.titleBottom = 0; - offsets.titlePos = 10; + offsets.titlePos = 0; break; case MacVenture::kInvWindow: offsets.titleTop = 0; offsets.titleBottom = 0; - offsets.titlePos = 10; - + offsets.titlePos = 0; + offsets.upperScrollHeight = 20; offsets.lowerScrollHeight = 20; break; case MacVenture::kRDoc4: offsets.titleTop = 0; offsets.titleBottom = 0; - offsets.titlePos = 10; + offsets.titlePos = 0; break; default: break;