aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorPaul Gilbert2016-04-28 22:12:16 -0400
committerPaul Gilbert2016-07-10 16:22:39 -0400
commit487f2cef0f0be9bae3b815623b4dceb02e466ce0 (patch)
tree3cbda169c4d9ad8627d5e8b00fa8a64c5925983f
parent23f5691b97cb53fd45ef411f051b7f10f0523a24 (diff)
downloadscummvm-rg350-487f2cef0f0be9bae3b815623b4dceb02e466ce0.tar.gz
scummvm-rg350-487f2cef0f0be9bae3b815623b4dceb02e466ce0.tar.bz2
scummvm-rg350-487f2cef0f0be9bae3b815623b4dceb02e466ce0.zip
TITANIC: Handle Conversations double click, PET Text key handling
-rw-r--r--engines/titanic/pet_control/pet_conversations.cpp5
-rw-r--r--engines/titanic/pet_control/pet_conversations.h1
-rw-r--r--engines/titanic/pet_control/pet_element.cpp2
-rw-r--r--engines/titanic/pet_control/pet_element.h4
-rw-r--r--engines/titanic/pet_control/pet_text.cpp25
-rw-r--r--engines/titanic/pet_control/pet_text.h12
6 files changed, 41 insertions, 8 deletions
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 3872d840fd..850fec1668 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -95,6 +95,11 @@ bool CPetConversations::MouseButtonUpMsg(CMouseButtonUpMsg *msg) {
return false;
}
+bool CPetConversations::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
+ return _scrollDown.MouseDoubleClickMsg(msg->_mousePos)
+ || _scrollUp.MouseDoubleClickMsg(msg->_mousePos);
+}
+
bool CPetConversations::setupControl(CPetControl *petControl) {
if (petControl) {
_petControl = petControl;
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index 3f396c828a..9b312729fa 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -104,6 +104,7 @@ public:
*/
virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
+ virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
};
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_element.cpp b/engines/titanic/pet_control/pet_element.cpp
index 616877e15e..bc1b8de44d 100644
--- a/engines/titanic/pet_control/pet_element.cpp
+++ b/engines/titanic/pet_control/pet_element.cpp
@@ -47,7 +47,7 @@ bool CPetElement::MouseButtonUpMsg(const Point &pt) {
return result;
}
-bool CPetElement::contains1(const Point &pt) const {
+bool CPetElement::MouseDoubleClickMsg(const Point &pt) const {
return _bounds.contains(pt);
}
diff --git a/engines/titanic/pet_control/pet_element.h b/engines/titanic/pet_control/pet_element.h
index 4e35ee9a24..38f5f539f2 100644
--- a/engines/titanic/pet_control/pet_element.h
+++ b/engines/titanic/pet_control/pet_element.h
@@ -80,9 +80,9 @@ public:
virtual bool MouseButtonUpMsg(const Point &pt);
/**
- * Returns whether the passed point falls inside the item
+ * Handles processing mouse button double click messages
*/
- virtual bool contains1(const Point &pt) const;
+ virtual bool MouseDoubleClickMsg(const Point &pt) const;
virtual int proc9(const Point &pt);
diff --git a/engines/titanic/pet_control/pet_text.cpp b/engines/titanic/pet_control/pet_text.cpp
index c31d4fd851..2ea10994e6 100644
--- a/engines/titanic/pet_control/pet_text.cpp
+++ b/engines/titanic/pet_control/pet_text.cpp
@@ -176,10 +176,10 @@ CString CPetText::getText() const {
void CPetText::setText(const CString &str) {
setup();
- changeText(str);
+ appendText(str);
}
-void CPetText::changeText(const CString &str) {
+void CPetText::appendText(const CString &str) {
int lineSize = _array[_lineCount]._line.size();
int strSize = str.size();
@@ -304,8 +304,27 @@ void CPetText::addLine(const CString &str, byte r, byte g, byte b) {
}
setLineColor(_lineCount, r, g, b);
- changeText(str);
+ appendText(str);
++_lineCount;
}
+bool CPetText::handleKey(const Common::KeyState &keyState) {
+ switch (keyState.keycode) {
+ case Common::KEYCODE_BACKSPACE:
+ deleteLastChar();
+ break;
+
+ case Common::KEYCODE_RETURN:
+ case Common::KEYCODE_KP_ENTER:
+ return true;
+
+ default:
+ if (keyState.ascii >= 32 && keyState.ascii <= 127)
+ appendText(CString(keyState.ascii, 1));
+ break;
+ }
+
+ return false;
+}
+
} // End of namespace Titanic
diff --git a/engines/titanic/pet_control/pet_text.h b/engines/titanic/pet_control/pet_text.h
index 6000dd6d0b..4bb699d58e 100644
--- a/engines/titanic/pet_control/pet_text.h
+++ b/engines/titanic/pet_control/pet_text.h
@@ -23,6 +23,7 @@
#ifndef TITANIC_PET_TEXT_H
#define TITANIC_PET_TEXT_H
+#include "common/keyboard.h"
#include "titanic/support/simple_file.h"
#include "titanic/support/screen_manager.h"
#include "titanic/support/text_cursor.h"
@@ -71,9 +72,9 @@ private:
void mergeStrings();
/**
- * Change the text
+ * Append text to the current text line
*/
- void changeText(const CString &str);
+ void appendText(const CString &str);
void updateStr3(int lineNum);
@@ -192,6 +193,13 @@ public:
* Add a line to the text
*/
void addLine(const CString &str, byte r, byte g, byte b);
+
+ /**
+ * Handles character processing to add or remove characters to
+ * the current text line
+ * @returns True if the Enter key was pressed
+ */
+ bool handleKey(const Common::KeyState &keyState);
};
} // End of namespace Titanic