[Scummvm-git-logs] scummvm master -> 829c3e32f47cc4ec9b0deaab0a89f75ac38be7e9
sev-
noreply at scummvm.org
Thu Jun 1 18:17:29 UTC 2023
This automated email contains information about 3 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dd72dd09ca DIRECTOR: Implement the titleVisible property of window
797803d515 GRAPHICS: MACGUI: Implement lockable widgets
829c3e32f4 DIRECTOR: Implement modal property of window
Commit: dd72dd09ca6a4dd4bd21ece3665f286aa89a2cb3
https://github.com/scummvm/scummvm/commit/dd72dd09ca6a4dd4bd21ece3665f286aa89a2cb3
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-06-01T20:17:23+02:00
Commit Message:
DIRECTOR: Implement the titleVisible property of window
Modifies border of window by first changing title to "", then updating
window border to borderType 2 `ThinNoTitle`.
`titleVisible of window` to verify this behavior.
Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18 at gmail.com>
Changed paths:
engines/director/window.cpp
engines/director/window.h
graphics/macgui/macwindow.cpp
graphics/macgui/macwindow.h
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index e24f4de1c2f..4021a9965c0 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -60,7 +60,6 @@ Window::Window(int id, bool scrollable, bool resizable, bool editable, Graphics:
_startFrame = _vm->getStartMovie().startFrame;
_windowType = -1;
- _titleVisible = true;
updateBorderType();
}
@@ -214,6 +213,13 @@ void Window::setStageColor(uint32 stageColor, bool forceReset) {
}
}
+void Window::setTitleVisible(bool titleVisible) {
+ MacWindow::setTitleVisible(titleVisible);
+ updateBorderType();
+
+ setVisible(true); // Activate this window on top
+}
+
Datum Window::getStageRect() {
Common::Rect rect = getInnerDimensions();
Datum d;
@@ -309,7 +315,7 @@ bool Window::setNextMovie(Common::String &movieFilenameRaw) {
void Window::updateBorderType() {
if (_isStage) {
setBorderType(3);
- } else if (!_titleVisible) {
+ } else if (!isTitleVisible()) {
setBorderType(2);
} else {
setBorderType(MAX(0, MIN(_windowType, 16)));
diff --git a/engines/director/window.h b/engines/director/window.h
index 6e8098a1d96..e6755407567 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -139,8 +139,7 @@ public:
void setWindowType(int type) { _windowType = type; updateBorderType(); }
int getWindowType() const { return _windowType; }
- void setTitleVisible(bool titleVisible) { _titleVisible = titleVisible; updateBorderType(); };
- bool isTitleVisible() { return _titleVisible; };
+ void setTitleVisible(bool titleVisible);
Datum getStageRect();
bool setStageRect(Datum datum);
@@ -215,7 +214,6 @@ private:
int16 _startFrame;
int _windowType;
- bool _titleVisible;
private:
diff --git a/graphics/macgui/macwindow.cpp b/graphics/macgui/macwindow.cpp
index 7f314935e61..52138045c83 100644
--- a/graphics/macgui/macwindow.cpp
+++ b/graphics/macgui/macwindow.cpp
@@ -63,6 +63,7 @@ MacWindow::MacWindow(int id, bool scrollable, bool resizable, bool editable, Mac
_type = kWindowWindow;
_closeable = false;
+ _isTitleVisible = true;
_borderType = -1;
_borderWidth = kBorderWidth;
@@ -286,11 +287,33 @@ void MacWindow::drawBorderFromSurface(ManagedSurface *g, uint32 flags) {
}
void MacWindow::setTitle(const Common::String &title) {
+ if (!_isTitleVisible) {
+ // Title hidden right now, so don't propagate the change but just cache it up for later
+ _shadowedTitle = title;
+ return;
+ }
+
_title = title;
_borderIsDirty = true;
_macBorder.setTitle(title, _borderSurface.w, _wm);
}
+void MacWindow::setTitleVisible(bool visible) {
+ if (_isTitleVisible && !visible) {
+ _shadowedTitle = _title;
+ setTitle("");
+ _isTitleVisible = visible;
+ } else if (!_isTitleVisible && visible) {
+ _title = _shadowedTitle;
+ _isTitleVisible = visible;
+ setTitle(_title);
+ }
+}
+
+bool MacWindow::isTitleVisible() {
+ return _isTitleVisible;
+}
+
void MacWindow::drawPattern() {
byte *pat = _wm->getPatterns()[_pattern - 1];
for (int y = 0; y < _composeSurface->h; y++) {
diff --git a/graphics/macgui/macwindow.h b/graphics/macgui/macwindow.h
index 9b966278fc6..c0e0ee4f4fb 100644
--- a/graphics/macgui/macwindow.h
+++ b/graphics/macgui/macwindow.h
@@ -283,6 +283,18 @@ public:
* @param title Target title.
*/
void setTitle(const Common::String &title);
+
+ /**
+ * Set visibility of window title.
+ * @param visible visibility of window.
+ */
+ virtual void setTitleVisible(bool visible);
+
+ /**
+ * Get visibility of window title.
+ */
+ bool isTitleVisible();
+
/**
* Accessor to get the title of the window.
* @return Title.
@@ -405,6 +417,7 @@ private:
bool _resizable;
bool _closeable;
+ bool _isTitleVisible;
int _borderWidth;
@@ -414,6 +427,7 @@ private:
WindowClick _highlightedPart;
Common::String _title;
+ Common::String _shadowedTitle;
int _borderType;
};
Commit: 797803d51512911d76f048c195597fbc010e0a9b
https://github.com/scummvm/scummvm/commit/797803d51512911d76f048c195597fbc010e0a9b
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-06-01T20:17:23+02:00
Commit Message:
GRAPHICS: MACGUI: Implement lockable widgets
Lockable widgets are those which takes in all input
and if set then no other widget can take any input
its same as them being inactive, no buttons, animations
etc will work.
This is implemented to support `modal` property of window,
which requires a window to take all input and prevent all
others from having any actions.
Changed paths:
graphics/macgui/macwindowmanager.cpp
graphics/macgui/macwindowmanager.h
diff --git a/graphics/macgui/macwindowmanager.cpp b/graphics/macgui/macwindowmanager.cpp
index 555ef40e6ff..215b156a36b 100644
--- a/graphics/macgui/macwindowmanager.cpp
+++ b/graphics/macgui/macwindowmanager.cpp
@@ -164,6 +164,8 @@ MacWindowManager::MacWindowManager(uint32 mode, MacPatterns *patterns, Common::L
_needsRemoval = false;
_activeWidget = nullptr;
+ _lockedWidget = nullptr;
+
_mouseDown = false;
_hoveredWidget = nullptr;
@@ -337,6 +339,13 @@ void MacWindowManager::setActiveWidget(MacWidget *widget) {
_activeWidget->setActive(true);
}
+void MacWindowManager::setLockedWidget(MacWidget *widget) {
+ if (_lockedWidget == widget)
+ return;
+
+ _lockedWidget = widget;
+}
+
void MacWindowManager::clearWidgetRefs(MacWidget *widget) {
if (widget == _hoveredWidget)
_hoveredWidget = nullptr;
@@ -1024,7 +1033,8 @@ bool MacWindowManager::processEvent(Common::Event &event) {
for (Common::List<BaseMacWindow *>::const_iterator it = _windowStack.end(); it != _windowStack.begin();) {
it--;
BaseMacWindow *w = *it;
-
+ if (_lockedWidget != nullptr && w != _lockedWidget)
+ continue;
if (w->hasAllFocus() || (w->isEditable() && event.type == Common::EVENT_KEYDOWN) ||
w->getDimensions().contains(event.mouse.x, event.mouse.y)) {
if (event.type == Common::EVENT_LBUTTONDOWN || event.type == Common::EVENT_LBUTTONUP)
diff --git a/graphics/macgui/macwindowmanager.h b/graphics/macgui/macwindowmanager.h
index 7587149f9ea..d670f908bfb 100644
--- a/graphics/macgui/macwindowmanager.h
+++ b/graphics/macgui/macwindowmanager.h
@@ -292,9 +292,18 @@ public:
*/
void setActiveWidget(MacWidget *widget);
+ /**
+ * Similar to setActiveWidget but in this case no action including animation
+ * hover, etc can work until a window is locked.
+ * Anything outside this window will not respond to user.
+ * @param widget Pointer to the widget to lock, nullptr for no widget
+ */
+ void setLockedWidget(MacWidget *widget);
+
MacPatterns &getBuiltinPatterns() { return _builtinPatterns; }
MacWidget *getActiveWidget() { return _activeWidget; }
+ MacWidget *getLockedWidget() { return _lockedWidget; }
Common::Rect getScreenBounds() { return _screen ? _screen->getBounds() : _screenDims; }
@@ -446,6 +455,7 @@ private:
Cursor *_cursor;
MacWidget *_activeWidget;
+ MacWidget *_lockedWidget;
PauseToken *_screenCopyPauseToken;
Commit: 829c3e32f47cc4ec9b0deaab0a89f75ac38be7e9
https://github.com/scummvm/scummvm/commit/829c3e32f47cc4ec9b0deaab0a89f75ac38be7e9
Author: Harishankar Kumar (hari01584 at gmail.com)
Date: 2023-06-01T20:17:23+02:00
Commit Message:
DIRECTOR: Implement modal property of window
Implements modal property using the locking widgets of macwindowmanager.
`modal of window` in 'workshop' uses this.
Co-authored-by: Pragyansh Chaturvedi <pragyanshchaturvedi18 at gmail.com>
Changed paths:
engines/director/lingo/lingo-object.cpp
engines/director/window.cpp
engines/director/window.h
diff --git a/engines/director/lingo/lingo-object.cpp b/engines/director/lingo/lingo-object.cpp
index 121c3e6b30b..4857b78ba39 100644
--- a/engines/director/lingo/lingo-object.cpp
+++ b/engines/director/lingo/lingo-object.cpp
@@ -597,7 +597,8 @@ Datum Window::getField(int field) {
return getWindowType();
case kTheRect:
return getStageRect();
-
+ case kTheModal:
+ return getModal();
default:
warning("Window::getField: unhandled field '%s'", g_lingo->field2str(field));
return Datum();
@@ -620,6 +621,9 @@ bool Window::setField(int field, const Datum &value) {
return true;
case kTheRect:
return setStageRect(value);
+ case kTheModal:
+ setModal((bool)value.asInt());
+ return true;
default:
warning("Window::setField: unhandled field '%s'", g_lingo->field2str(field));
return false;
diff --git a/engines/director/window.cpp b/engines/director/window.cpp
index 4021a9965c0..3d76bf9ae35 100644
--- a/engines/director/window.cpp
+++ b/engines/director/window.cpp
@@ -60,6 +60,8 @@ Window::Window(int id, bool scrollable, bool resizable, bool editable, Graphics:
_startFrame = _vm->getStartMovie().startFrame;
_windowType = -1;
+ _isModal = false;
+
updateBorderType();
}
@@ -247,6 +249,18 @@ bool Window::setStageRect(Datum datum) {
return true;
}
+void Window::setModal(bool modal) {
+ if (_isModal && !modal) {
+ _wm->setLockedWidget(nullptr);
+ _isModal = false;
+ } else if (!_isModal && modal) {
+ _wm->setLockedWidget(this);
+ _isModal = true;
+ }
+
+ setVisible(true); // Activate this window on top
+}
+
void Window::reset() {
resizeInner(_composeSurface->w, _composeSurface->h);
_contentIsDirty = true;
diff --git a/engines/director/window.h b/engines/director/window.h
index e6755407567..380a70f1ca9 100644
--- a/engines/director/window.h
+++ b/engines/director/window.h
@@ -142,6 +142,8 @@ public:
void setTitleVisible(bool titleVisible);
Datum getStageRect();
bool setStageRect(Datum datum);
+ void setModal(bool modal);
+ bool getModal() { return _isModal; };
void updateBorderType();
@@ -214,6 +216,7 @@ private:
int16 _startFrame;
int _windowType;
+ bool _isModal;
private:
More information about the Scummvm-git-logs
mailing list