From 6be0dbe016d83f64168166d520bcc4a942d59087 Mon Sep 17 00:00:00 2001
From: Paul Gilbert
Date: Sat, 2 Mar 2019 16:07:10 -0800
Subject: GLK: Move input caret drawing into base FontInfo class

---
 engines/glk/conf.cpp  |  3 +++
 engines/glk/fonts.cpp | 18 ++++++++----------
 engines/glk/fonts.h   | 19 ++++++++++---------
 3 files changed, 21 insertions(+), 19 deletions(-)

(limited to 'engines/glk')

diff --git a/engines/glk/conf.cpp b/engines/glk/conf.cpp
index 5c6bc761bc..4e7ed24b02 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 cdac7c0b2b..12ae7c6489 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 4a9253023c..156f4d44f8 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
-- 
cgit v1.2.3