[Scummvm-git-logs] scummvm master -> 6d82e7ee26dad9ef0c89e1afdce29e6b955abd2e

sev- sev at scummvm.org
Tue Oct 15 23:58:13 CEST 2019


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:
1a76b548e5 PINK: Disable border for all text windows
695ba47063 GRAPHICS: MACGUI: Added possibility to create read only text windows
6d82e7ee26 PINK: Set text windows to read-only


Commit: 1a76b548e5a50b774646b5e7d959d4fdc083ae8c
    https://github.com/scummvm/scummvm/commit/1a76b548e5a50b774646b5e7d959d4fdc083ae8c
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-15T23:58:00+02:00

Commit Message:
PINK: Disable border for all text windows

Changed paths:
    engines/pink/objects/actions/action_text.cpp


diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index 0c98893..aae783a 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -109,6 +109,9 @@ void ActionText::start() {
 
 		_txtWnd->setBorder(noborder, true);
 
+		Graphics::TransparentSurface *noborder2 = new Graphics::TransparentSurface(*noborder, true);
+		_txtWnd->setBorder(noborder2, false);
+
 		if (_actor->getPage()->getGame()->getLanguage() == Common::EN_ANY)
 			_txtWnd->appendText(str, font);
 	} else {


Commit: 695ba470636ac079bb12e58297b4723c87b630d1
    https://github.com/scummvm/scummvm/commit/695ba470636ac079bb12e58297b4723c87b630d1
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-15T23:58:00+02:00

Commit Message:
GRAPHICS: MACGUI: Added possibility to create read only text windows

Changed paths:
    graphics/macgui/mactextwindow.cpp
    graphics/macgui/mactextwindow.h


diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 8f1c293..ebd3dd2 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -59,6 +59,8 @@ MacTextWindow::MacTextWindow(MacWindowManager *wm, const MacFont *font, int fgco
 	_inTextSelection = false;
 
 	_scrollPos = 0;
+	_editable = true;
+	_selectable = true;
 
 	_cursorX = 0;
 	_cursorY = 0;
@@ -93,9 +95,11 @@ void MacTextWindow::appendText(Common::String str, const MacFont *macFont, bool
 
 	_contentIsDirty = true;
 
-	_scrollPos = MAX(0, _mactext->getTextHeight() - getInnerDimensions().height());
+	if (_editable) {
+		_scrollPos = MAX(0, _mactext->getTextHeight() - getInnerDimensions().height());
 
-	updateCursorPos();
+		updateCursorPos();
+	}
 }
 
 void MacTextWindow::clearText() {
@@ -280,6 +284,9 @@ bool MacTextWindow::processEvent(Common::Event &event) {
 	WindowClick click = isInBorder(event.mouse.x, event.mouse.y);
 
 	if (event.type == Common::EVENT_KEYDOWN) {
+		if (!_editable)
+			return false;
+
 		_wm->setActive(getId());
 
 		if (event.kbd.flags & (Common::KBD_ALT | Common::KBD_CTRL | Common::KBD_META)) {
@@ -355,6 +362,9 @@ bool MacTextWindow::processEvent(Common::Event &event) {
 	}
 
 	if (click == kBorderInner) {
+		if (!_selectable)
+			return false;
+
 		if (event.type == Common::EVENT_LBUTTONDOWN) {
 			startMarking(event.mouse.x, event.mouse.y);
 
@@ -396,7 +406,12 @@ void MacTextWindow::scroll(int delta) {
 	int oldScrollPos = _scrollPos;
 
 	_scrollPos += delta * kConScrollStep;
-	_scrollPos = CLIP<int>(_scrollPos, 0, _mactext->getTextHeight() - kConScrollStep);
+
+	if (_editable)
+		_scrollPos = CLIP<int>(_scrollPos, 0, _mactext->getTextHeight() - kConScrollStep);
+	else
+		_scrollPos = CLIP<int>(_scrollPos, 0, MAX(0, _mactext->getTextHeight() - getInnerDimensions().height()));
+
 	undrawCursor();
 	_cursorY -= (_scrollPos - oldScrollPos);
 	_contentIsDirty = true;
diff --git a/graphics/macgui/mactextwindow.h b/graphics/macgui/mactextwindow.h
index 942fdd4..c236f47 100644
--- a/graphics/macgui/mactextwindow.h
+++ b/graphics/macgui/mactextwindow.h
@@ -63,6 +63,9 @@ public:
 	void appendText(Common::String str, const MacFont *macFont, bool skipAdd = false);
 	void clearText();
 
+	void setEditable(bool editable) { _editable = editable; }
+	void setSelectable(bool selectable) { _selectable = selectable; }
+
 	void undrawCursor();
 
 	const Common::String getInput() { return _inputText; }
@@ -94,6 +97,8 @@ public:
 	bool _cursorDirty;
 	Common::Rect *_cursorRect;
 	bool _cursorOff;
+	bool _editable;
+	bool _selectable;
 
 	int _scrollPos;
 


Commit: 6d82e7ee26dad9ef0c89e1afdce29e6b955abd2e
    https://github.com/scummvm/scummvm/commit/6d82e7ee26dad9ef0c89e1afdce29e6b955abd2e
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2019-10-15T23:58:00+02:00

Commit Message:
PINK: Set text windows to read-only

Changed paths:
    engines/pink/objects/actions/action_text.cpp


diff --git a/engines/pink/objects/actions/action_text.cpp b/engines/pink/objects/actions/action_text.cpp
index aae783a..4ee9cf6 100644
--- a/engines/pink/objects/actions/action_text.cpp
+++ b/engines/pink/objects/actions/action_text.cpp
@@ -97,6 +97,8 @@ void ActionText::start() {
 														  _xRight - _xLeft, align, nullptr, false);
 		_txtWnd->move(_xLeft, _yTop);
 		_txtWnd->resize(_xRight - _xLeft, _yBottom - _yTop);
+		_txtWnd->setEditable(false);
+		_txtWnd->setSelectable(false);
 
 		Graphics::TransparentSurface *noborder = new Graphics::TransparentSurface();
 		noborder->create(3, 3, noborder->getSupportedPixelFormat());





More information about the Scummvm-git-logs mailing list