[Scummvm-git-logs] scummvm master -> 8393faf036e07f8844ee01e94173da5cdcbb7f77
dreammaster
paulfgilbert at gmail.com
Sun Mar 3 04:35:53 CET 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:
6be0dbe016 GLK: Move input caret drawing into base FontInfo class
3b8d006c8b GLK: Add support for input cursors in text grid windows
8393faf036 GLK: Switch focus window immediately after requesting lines or chars
Commit: 6be0dbe016d83f64168166d520bcc4a942d59087
https://github.com/scummvm/scummvm/commit/6be0dbe016d83f64168166d520bcc4a942d59087
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-02T18:11:51-08:00
Commit Message:
GLK: Move input caret drawing into base FontInfo class
Changed paths:
engines/glk/conf.cpp
engines/glk/fonts.cpp
engines/glk/fonts.h
diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp
index 5c6bc76..4e7ed24 100644
--- a/engines/glk/conf.cpp
+++ b/engines/glk/conf.cpp
@@ -124,6 +124,9 @@ Conf::Conf(InterpreterType interpType) {
get("caretcolor", _propInfo._caretColor, nullptr);
get("caretcolor", _propInfo._caretSave, nullptr);
get("caretshape", _propInfo._caretShape, 2);
+ _monoInfo._caretColor = _propInfo._caretColor;
+ _monoInfo._caretSave = _propInfo._caretSave;
+ _monoInfo._caretShape = _propInfo._caretShape;
_propInfo._linkStyle = _monoInfo._linkStyle = ConfMan.hasKey("linkstyle")
&& !strToInt(ConfMan.get("linkstyle").c_str()) ? 0 : 1;
diff --git a/engines/glk/fonts.cpp b/engines/glk/fonts.cpp
index cdac7c0..12ae7c6 100644
--- a/engines/glk/fonts.cpp
+++ b/engines/glk/fonts.cpp
@@ -29,18 +29,10 @@ namespace Glk {
FontInfo::FontInfo() : _size(0), _aspect(0), _cellW(0), _cellH(0), _leading(0), _baseLine(0),
_linkStyle(0), _moreFont(PROPB), _moreAlign(0), _caps(0), _linkColor(0), _linkSave(0),
- _moreColor(0), _moreSave(0) {
+ _moreColor(0), _moreSave(0), _caretShape(0), _caretColor(0), _caretSave(0) {
}
-/*--------------------------------------------------------------------------*/
-
-PropFontInfo::PropFontInfo() : _justify(0), _quotes(0), _dashes(0), _spaces(0), _caretShape(0),
- _lineSeparation(2), _caretColor(0), _caretSave(0) {
-}
-
-/*--------------------------------------------------------------------------*/
-
-void PropFontInfo::drawCaret(const Point &pos) {
+void FontInfo::drawCaret(const Point &pos) {
uint color = _caretColor;
Graphics::Screen &s = *g_vm->_screen;
int x = pos.x / GLI_SUBPIX, y = pos.y;
@@ -75,4 +67,10 @@ void PropFontInfo::drawCaret(const Point &pos) {
}
+/*--------------------------------------------------------------------------*/
+
+PropFontInfo::PropFontInfo() : _justify(0), _quotes(0), _dashes(0), _spaces(0),
+ _lineSeparation(2) {
+}
+
} // End of namespace Glk
diff --git a/engines/glk/fonts.h b/engines/glk/fonts.h
index 4a92530..156f4d4 100644
--- a/engines/glk/fonts.h
+++ b/engines/glk/fonts.h
@@ -48,11 +48,21 @@ struct FontInfo {
int _moreAlign;
Common::String _morePrompt;
int _caps;
+ uint _caretColor, _caretSave;
+ int _caretShape;
/**
* Constructor
*/
FontInfo();
+
+
+ /**
+ * Draws the text input caret at the given position
+ * @remarks The position specifies the caret's bottom-left corner,
+ * and the X position is in multiples of GLI_SUBPIX
+ */
+ void drawCaret(const Point &pos);
};
/**
@@ -65,8 +75,6 @@ struct MonoFontInfo : public FontInfo {
* Font info for proportional (variable size) fonts
*/
struct PropFontInfo : public MonoFontInfo {
- uint _caretColor, _caretSave;
- int _caretShape;
int _justify;
int _quotes;
int _dashes;
@@ -77,13 +85,6 @@ struct PropFontInfo : public MonoFontInfo {
* Constructor
*/
PropFontInfo();
-
- /**
- * Draws the text input caret at the given position
- * @remarks The position specifies the caret's bottom-left corner,
- * and the X position is in multiples of GLI_SUBPIX
- */
- void drawCaret(const Point &pos);
};
} // End of namespace Glk
Commit: 3b8d006c8b7091f6e65a4c4865cc9aebb6452d38
https://github.com/scummvm/scummvm/commit/3b8d006c8b7091f6e65a4c4865cc9aebb6452d38
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-02T18:11:51-08:00
Commit Message:
GLK: Add support for input cursors in text grid windows
This is initially primarily for Bureaucracy.. the starting form
is drawn in the text grid window, and visible cursor is needed
so you can tell which line you're filling in
Changed paths:
engines/glk/conf.cpp
engines/glk/fonts.cpp
engines/glk/fonts.h
engines/glk/window_text_grid.cpp
diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp
index 4e7ed24..5c6bc76 100644
--- a/engines/glk/conf.cpp
+++ b/engines/glk/conf.cpp
@@ -124,9 +124,6 @@ Conf::Conf(InterpreterType interpType) {
get("caretcolor", _propInfo._caretColor, nullptr);
get("caretcolor", _propInfo._caretSave, nullptr);
get("caretshape", _propInfo._caretShape, 2);
- _monoInfo._caretColor = _propInfo._caretColor;
- _monoInfo._caretSave = _propInfo._caretSave;
- _monoInfo._caretShape = _propInfo._caretShape;
_propInfo._linkStyle = _monoInfo._linkStyle = ConfMan.hasKey("linkstyle")
&& !strToInt(ConfMan.get("linkstyle").c_str()) ? 0 : 1;
diff --git a/engines/glk/fonts.cpp b/engines/glk/fonts.cpp
index 12ae7c6..6ef500c 100644
--- a/engines/glk/fonts.cpp
+++ b/engines/glk/fonts.cpp
@@ -27,9 +27,17 @@
namespace Glk {
+uint FontInfo::_caretColor;
+uint FontInfo::_caretSave;
+int FontInfo::_caretShape;
+
+
FontInfo::FontInfo() : _size(0), _aspect(0), _cellW(0), _cellH(0), _leading(0), _baseLine(0),
_linkStyle(0), _moreFont(PROPB), _moreAlign(0), _caps(0), _linkColor(0), _linkSave(0),
- _moreColor(0), _moreSave(0), _caretShape(0), _caretColor(0), _caretSave(0) {
+ _moreColor(0), _moreSave(0) {
+ _caretShape = 0;
+ _caretColor = 0;
+ _caretSave = 0;
}
void FontInfo::drawCaret(const Point &pos) {
diff --git a/engines/glk/fonts.h b/engines/glk/fonts.h
index 156f4d4..afe2825 100644
--- a/engines/glk/fonts.h
+++ b/engines/glk/fonts.h
@@ -36,6 +36,10 @@ enum STYLES { FONTR, FONTB, FONTI, FONTZ };
* Font configuration info
*/
struct FontInfo {
+public:
+ static uint _caretColor, _caretSave;
+ static int _caretShape;
+public:
double _size;
double _aspect;
int _cellW, _cellH;
@@ -48,8 +52,6 @@ struct FontInfo {
int _moreAlign;
Common::String _morePrompt;
int _caps;
- uint _caretColor, _caretSave;
- int _caretShape;
/**
* Constructor
diff --git a/engines/glk/window_text_grid.cpp b/engines/glk/window_text_grid.cpp
index be09725..e0459e0 100644
--- a/engines/glk/window_text_grid.cpp
+++ b/engines/glk/window_text_grid.cpp
@@ -624,6 +624,13 @@ void TextGridWindow::redraw() {
w += _bbox.right - (x + w);
screen.fillRect(Rect::fromXYWH(x, y, w, _font._leading), bgcolor);
+ // Draw the caret if necessary
+ if (_windows->getFocusWindow() == this && i == _curY &&
+ (_lineRequest || _lineRequestUni || _charRequest || _charRequestUni)) {
+ _font.drawCaret(Point((x0 + _curX * _font._cellW) * GLI_SUBPIX, y + _font._baseLine));
+ }
+
+ // Write out the text
for (k = a, o = x; k < b; k++, o += _font._cellW) {
screen.drawStringUni(Point(o * GLI_SUBPIX, y + _font._baseLine), font,
fgcolor, Common::U32String(&ln->_chars[k], 1));
Commit: 8393faf036e07f8844ee01e94173da5cdcbb7f77
https://github.com/scummvm/scummvm/commit/8393faf036e07f8844ee01e94173da5cdcbb7f77
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2019-03-02T19:35:36-08:00
Commit Message:
GLK: Switch focus window immediately after requesting lines or chars
Changed paths:
engines/glk/window_text_buffer.cpp
engines/glk/window_text_buffer.h
engines/glk/window_text_grid.cpp
engines/glk/window_text_grid.h
diff --git a/engines/glk/window_text_buffer.cpp b/engines/glk/window_text_buffer.cpp
index 788f8ca..2638302 100644
--- a/engines/glk/window_text_buffer.cpp
+++ b/engines/glk/window_text_buffer.cpp
@@ -653,6 +653,9 @@ void TextBufferWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
if (g_vm->gli_register_arr)
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn");
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
}
void TextBufferWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
@@ -707,6 +710,23 @@ void TextBufferWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initle
if (g_vm->gli_register_arr)
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Iu");
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
+}
+
+void TextBufferWindow::requestCharEvent() {
+ _charRequest = true;
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
+}
+
+void TextBufferWindow::requestCharEventUni() {
+ _charRequestUni = true;
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
}
void TextBufferWindow::cancelLineEvent(Event *ev) {
diff --git a/engines/glk/window_text_buffer.h b/engines/glk/window_text_buffer.h
index 0ac74d2..9020c1a 100644
--- a/engines/glk/window_text_buffer.h
+++ b/engines/glk/window_text_buffer.h
@@ -220,13 +220,9 @@ public:
virtual void getSize(uint *width, uint *height) const override;
- virtual void requestCharEvent() override {
- _charRequest = true;
- }
+ virtual void requestCharEvent() override;
- virtual void requestCharEventUni() override {
- _charRequestUni = true;
- }
+ virtual void requestCharEventUni() override;
virtual void setEchoLineEvent(uint val) override {
_echoLineInput = val != 0;
diff --git a/engines/glk/window_text_grid.cpp b/engines/glk/window_text_grid.cpp
index e0459e0..226b2f1 100644
--- a/engines/glk/window_text_grid.cpp
+++ b/engines/glk/window_text_grid.cpp
@@ -265,6 +265,9 @@ void TextGridWindow::requestLineEvent(char *buf, uint maxlen, uint initlen) {
if (g_vm->gli_register_arr)
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Cn");
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
}
void TextGridWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen) {
@@ -317,6 +320,23 @@ void TextGridWindow::requestLineEventUni(uint32 *buf, uint maxlen, uint initlen)
if (g_vm->gli_register_arr)
_inArrayRock = (*g_vm->gli_register_arr)(buf, maxlen, "&+#!Iu");
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
+}
+
+void TextGridWindow::requestCharEvent() {
+ _charRequest = true;
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
+}
+
+void TextGridWindow::requestCharEventUni() {
+ _charRequestUni = true;
+
+ // Switch focus to the new window
+ _windows->inputGuessFocus();
}
void TextGridWindow::cancelLineEvent(Event *ev) {
diff --git a/engines/glk/window_text_grid.h b/engines/glk/window_text_grid.h
index f5568cd..de64ab3 100644
--- a/engines/glk/window_text_grid.h
+++ b/engines/glk/window_text_grid.h
@@ -171,9 +171,9 @@ public:
virtual void getSize(uint *width, uint *height) const override;
- virtual void requestCharEvent() override {
- _charRequest = true;
- }
+ virtual void requestCharEvent() override;
+
+ virtual void requestCharEventUni() override;
/**
* Prepare for inputing a line
@@ -197,10 +197,6 @@ public:
_mouseRequest = false;
}
- virtual void requestCharEventUni() override {
- _charRequestUni = true;
- }
-
virtual void requestMouseEvent() override {
_mouseRequest = true;
}
More information about the Scummvm-git-logs
mailing list