[Scummvm-git-logs] scummvm master -> e01893cfc7ba6e8d281e0425a8addb0f4096f457
sev-
sev at scummvm.org
Fri Apr 24 23:17:04 UTC 2020
This automated email contains information about 4 new commits which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .
Summary:
dafacc4998 GRAPHICS: MACGUI: Inherit MacEditableText surface from MacWidget
22ec4b60ae DIRECTOR: Start to draw editable text widgets
f382d0fd01 GRAPHICS: MACGUI: Clear cursor flag after redrawing
e01893cfc7 GRAPHICS: MACGUI: Properly clean MacEditableText before rendering
Commit: dafacc4998684b0abf5ffb63ac62aea4b48face8
https://github.com/scummvm/scummvm/commit/dafacc4998684b0abf5ffb63ac62aea4b48face8
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-25T00:46:49+02:00
Commit Message:
GRAPHICS: MACGUI: Inherit MacEditableText surface from MacWidget
Changed paths:
graphics/macgui/maceditabletext.cpp
graphics/macgui/maceditabletext.h
graphics/macgui/mactext.h
diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp
index 43c32171bf..5e47f30007 100644
--- a/graphics/macgui/maceditabletext.cpp
+++ b/graphics/macgui/maceditabletext.cpp
@@ -91,12 +91,15 @@ void MacEditableText::init() {
_cursorSurface = new ManagedSurface(1, kCursorHeight);
_cursorSurface->fillRect(*_cursorRect, _wm->_colorBlack);
+ _composeSurface = new ManagedSurface(_dims.width(), _dims.height());
+
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "macEditableText");
}
MacEditableText::~MacEditableText() {
delete _cursorRect;
delete _cursorSurface;
+ delete _composeSurface;
g_system->getTimerManager()->removeTimerProc(&cursorTimerHandler);
}
@@ -155,7 +158,7 @@ bool MacEditableText::draw(bool forceRedraw) {
if (_scrollbarIsDirty || forceRedraw) {
drawScrollbar();
- _composeSurface.clear(_wm->_colorWhite);
+ _composeSurface->clear(_wm->_colorWhite);
}
if (_inputIsDirty || forceRedraw) {
@@ -166,10 +169,10 @@ bool MacEditableText::draw(bool forceRedraw) {
_contentIsDirty = false;
// Compose
- MacText::draw(&_composeSurface, 0, _scrollPos, _surface->w, _scrollPos + _surface->h, kConWOverlap - 2, kConWOverlap - 2);
+ MacText::draw(_composeSurface, 0, _scrollPos, _surface->w, _scrollPos + _surface->h, kConWOverlap - 2, kConWOverlap - 2);
if (_cursorState)
- _composeSurface.blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + kConWOverlap - 2, _cursorY + kConHOverlap - 2));
+ _composeSurface->blitFrom(*_cursorSurface, *_cursorRect, Common::Point(_cursorX + kConWOverlap - 2, _cursorY + kConHOverlap - 2));
if (_selectedText.endY != -1)
drawSelection();
@@ -181,13 +184,13 @@ bool MacEditableText::draw(ManagedSurface *g, bool forceRedraw) {
if (!draw(forceRedraw))
return false;
- g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
+ g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), Common::Point(_dims.left - 2, _dims.top - 2), kColorGreen2);
return true;
}
void MacEditableText::blit(ManagedSurface *g, Common::Rect &dest) {
- g->transBlitFrom(_composeSurface, _composeSurface.getBounds(), dest, kColorGreen2);
+ g->transBlitFrom(*_composeSurface, _composeSurface->getBounds(), dest, kColorGreen2);
}
void MacEditableText::drawSelection() {
@@ -239,7 +242,7 @@ void MacEditableText::drawSelection() {
numLines--;
}
- byte *ptr = (byte *)_composeSurface.getBasePtr(x1 + kConWOverlap - 2, y + kConWOverlap - 2);
+ byte *ptr = (byte *)_composeSurface->getBasePtr(x1 + kConWOverlap - 2, y + kConWOverlap - 2);
for (int x = x1; x < x2; x++, ptr++)
if (*ptr == _wm->_colorBlack)
diff --git a/graphics/macgui/maceditabletext.h b/graphics/macgui/maceditabletext.h
index ae864c9fd2..9345e2d923 100644
--- a/graphics/macgui/maceditabletext.h
+++ b/graphics/macgui/maceditabletext.h
@@ -28,6 +28,7 @@
namespace Graphics {
+class MacMenu;
class MacText;
class MacWidget;
class MacWindow;
@@ -126,7 +127,6 @@ private:
const Font *_fontRef;
ManagedSurface *_cursorSurface;
- ManagedSurface _composeSurface;
bool _inTextSelection;
SelectedText _selectedText;
diff --git a/graphics/macgui/mactext.h b/graphics/macgui/mactext.h
index 9b816250bf..56e80815e8 100644
--- a/graphics/macgui/mactext.h
+++ b/graphics/macgui/mactext.h
@@ -26,6 +26,7 @@
#include "graphics/fontman.h"
#include "graphics/managed_surface.h"
#include "graphics/font.h"
+#include "graphics/macgui/macfontmanager.h"
namespace Graphics {
Commit: 22ec4b60ae2a49b9546cd2bcbd7ec14fb606ccae
https://github.com/scummvm/scummvm/commit/22ec4b60ae2a49b9546cd2bcbd7ec14fb606ccae
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-25T00:47:24+02:00
Commit Message:
DIRECTOR: Start to draw editable text widgets
Changed paths:
engines/director/cast.cpp
engines/director/frame.cpp
diff --git a/engines/director/cast.cpp b/engines/director/cast.cpp
index dd25d68446..1c09c49b91 100644
--- a/engines/director/cast.cpp
+++ b/engines/director/cast.cpp
@@ -22,6 +22,7 @@
#include "common/substream.h"
#include "graphics/surface.h"
+#include "graphics/macgui/maceditabletext.h"
#include "image/image_decoder.h"
#include "director/director.h"
@@ -292,6 +293,11 @@ void TextCast::setText(const char *text) {
_ptext = _ftext = text;
_cachedMacText->forceDirty();
+
+ if (_widget) {
+ ((Graphics::MacEditableText *)_widget)->clearText();
+ ((Graphics::MacEditableText *)_widget)->appendTextDefault(_ftext);
+ }
}
ShapeCast::ShapeCast(Common::ReadStreamEndian &stream, uint16 version) {
diff --git a/engines/director/frame.cpp b/engines/director/frame.cpp
index 6b14ea94b4..e240e16e20 100644
--- a/engines/director/frame.cpp
+++ b/engines/director/frame.cpp
@@ -886,10 +886,10 @@ void Frame::renderText(Graphics::ManagedSurface &surface, uint16 spriteId, Commo
return;
}
- if (sprite->_editable && 0) {
+ if (sprite->_editable) {
if (!textCast->_widget) {
- textCast->_widget = new Graphics::MacEditableText(score->_window, x, y, width, height, g_director->_wm, "", new Graphics::MacFont(), sprite->_foreColor, sprite->_backColor);
- warning("Created MacEditableText");
+ textCast->_widget = new Graphics::MacEditableText(score->_window, x, y, width, height, g_director->_wm, textCast->_ftext, new Graphics::MacFont(), sprite->_foreColor, sprite->_backColor);
+ warning("Created MacEditableText with '%s'", textCast->_ftext.c_str());
}
textCast->_widget->draw();
Commit: f382d0fd01c27537ec96b932ec016f3b6f0094d5
https://github.com/scummvm/scummvm/commit/f382d0fd01c27537ec96b932ec016f3b6f0094d5
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-25T00:57:22+02:00
Commit Message:
GRAPHICS: MACGUI: Clear cursor flag after redrawing
Changed paths:
graphics/macgui/maceditabletext.cpp
graphics/macgui/mactextwindow.cpp
diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp
index 5e47f30007..4b86728c1a 100644
--- a/graphics/macgui/maceditabletext.cpp
+++ b/graphics/macgui/maceditabletext.cpp
@@ -167,6 +167,7 @@ bool MacEditableText::draw(bool forceRedraw) {
}
_contentIsDirty = false;
+ _cursorDirty = false;
// Compose
MacText::draw(_composeSurface, 0, _scrollPos, _surface->w, _scrollPos + _surface->h, kConWOverlap - 2, kConWOverlap - 2);
diff --git a/graphics/macgui/mactextwindow.cpp b/graphics/macgui/mactextwindow.cpp
index 96259c3ff6..9d5f6890b6 100644
--- a/graphics/macgui/mactextwindow.cpp
+++ b/graphics/macgui/mactextwindow.cpp
@@ -151,6 +151,7 @@ bool MacTextWindow::draw(bool forceRedraw) {
}
_contentIsDirty = false;
+ _cursorDirty = false;
// Compose
_mactext->draw(_composeSurface, 0, _scrollPos, _surface.w - 2, _scrollPos + _surface.h - 2, kConWOverlap - 2, kConWOverlap - 2);
Commit: e01893cfc7ba6e8d281e0425a8addb0f4096f457
https://github.com/scummvm/scummvm/commit/e01893cfc7ba6e8d281e0425a8addb0f4096f457
Author: Eugene Sandulenko (sev at scummvm.org)
Date: 2020-04-25T01:16:25+02:00
Commit Message:
GRAPHICS: MACGUI: Properly clean MacEditableText before rendering
Changed paths:
graphics/macgui/maceditabletext.cpp
diff --git a/graphics/macgui/maceditabletext.cpp b/graphics/macgui/maceditabletext.cpp
index 4b86728c1a..cbfa75ee8d 100644
--- a/graphics/macgui/maceditabletext.cpp
+++ b/graphics/macgui/maceditabletext.cpp
@@ -89,9 +89,10 @@ void MacEditableText::init() {
_cursorRect = new Common::Rect(0, 0, 1, kCursorHeight);
_cursorSurface = new ManagedSurface(1, kCursorHeight);
- _cursorSurface->fillRect(*_cursorRect, _wm->_colorBlack);
+ _cursorSurface->clear(_wm->_colorBlack);
_composeSurface = new ManagedSurface(_dims.width(), _dims.height());
+ _composeSurface->clear(_wm->_colorWhite);
g_system->getTimerManager()->installTimerProc(&cursorTimerHandler, 200000, this, "macEditableText");
}
@@ -443,9 +444,6 @@ void MacEditableText::undrawInput() {
for (uint i = 0; i < _inputTextHeight; i++)
MacText::removeLastLine();
- if (_inputTextHeight)
- appendText("\n", _font, true);
-
_inputTextHeight = 0;
}
More information about the Scummvm-git-logs
mailing list