[Scummvm-git-logs] scummvm master -> 0f4ca41dad11b97bc563f55b354db6a8006478a9

dreammaster dreammaster at scummvm.org
Wed Nov 2 03:30:29 CET 2016


This automated email contains information about 1 new commit which have been
pushed to the 'scummvm' repo located at https://github.com/scummvm/scummvm .

Summary:
0f4ca41dad TITANIC: Add support for mouse wheel scrolling conversations log


Commit: 0f4ca41dad11b97bc563f55b354db6a8006478a9
    https://github.com/scummvm/scummvm/commit/0f4ca41dad11b97bc563f55b354db6a8006478a9
Author: Paul Gilbert (dreammaster at scummvm.org)
Date: 2016-11-01T22:30:21-04:00

Commit Message:
TITANIC: Add support for mouse wheel scrolling conversations log

Changed paths:
    engines/titanic/core/saveable_object.cpp
    engines/titanic/events.cpp
    engines/titanic/events.h
    engines/titanic/input_translator.cpp
    engines/titanic/input_translator.h
    engines/titanic/main_game_window.cpp
    engines/titanic/main_game_window.h
    engines/titanic/messages/mouse_messages.h
    engines/titanic/pet_control/pet_control.cpp
    engines/titanic/pet_control/pet_control.h
    engines/titanic/pet_control/pet_conversations.cpp
    engines/titanic/pet_control/pet_conversations.h
    engines/titanic/pet_control/pet_section.h



diff --git a/engines/titanic/core/saveable_object.cpp b/engines/titanic/core/saveable_object.cpp
index 7522a34..c4fdb49 100644
--- a/engines/titanic/core/saveable_object.cpp
+++ b/engines/titanic/core/saveable_object.cpp
@@ -835,6 +835,7 @@ DEFFN(CMouseDragMsg);
 DEFFN(CMouseDragStartMsg);
 DEFFN(CMouseDragMoveMsg);
 DEFFN(CMouseDragEndMsg);
+DEFFN(CMouseWheelMsg);
 DEFFN(CMoveToStartPosMsg);
 DEFFN(CMovieEndMsg);
 DEFFN(CMovieFrameMsg);
@@ -1426,6 +1427,7 @@ void CSaveableObject::initClassList() {
 	ADDFN(CMouseDragStartMsg, CMouseDragMsg);
 	ADDFN(CMouseDragMoveMsg, CMouseDragMsg);
 	ADDFN(CMouseDragEndMsg, CMouseDragMsg);
+	ADDFN(CMouseWheelMsg, CMouseMsg);
 	ADDFN(CMoveToStartPosMsg, CMessage);
 	ADDFN(CMovieEndMsg, CMessage);
 	ADDFN(CMovieFrameMsg, CMessage);
diff --git a/engines/titanic/events.cpp b/engines/titanic/events.cpp
index 9a246eb..6ca1b61 100644
--- a/engines/titanic/events.cpp
+++ b/engines/titanic/events.cpp
@@ -70,6 +70,11 @@ void Events::pollEvents() {
 		_mousePos = event.mouse;
 		eventTarget()->rightButtonUp(_mousePos);
 		break;
+	case Common::EVENT_WHEELUP:
+	case Common::EVENT_WHEELDOWN:
+		_mousePos = event.mouse;
+		eventTarget()->mouseWheel(_mousePos, event.type == Common::EVENT_WHEELUP);
+		break;
 	case Common::EVENT_KEYDOWN:
 		eventTarget()->keyDown(event.kbd);
 		break;
diff --git a/engines/titanic/events.h b/engines/titanic/events.h
index 497c867..03b2715 100644
--- a/engines/titanic/events.h
+++ b/engines/titanic/events.h
@@ -65,6 +65,7 @@ public:
 	virtual void middleButtonDoubleClick(const Point &mousePos) {}
 	virtual void rightButtonDown(const Point &mousePos) {}
 	virtual void rightButtonUp(const Point &mousePos) {}
+	virtual void mouseWheel(const Point &mousePos, bool wheelUp) {}
 	virtual void keyDown(Common::KeyState keyState) {}
 	virtual void keyUp(Common::KeyState keyState) {}
 };
diff --git a/engines/titanic/input_translator.cpp b/engines/titanic/input_translator.cpp
index ce272d1..a909b80 100644
--- a/engines/titanic/input_translator.cpp
+++ b/engines/titanic/input_translator.cpp
@@ -90,6 +90,11 @@ void CInputTranslator::rightButtonUp(int special, const Point &pt) {
 	_inputHandler->handleMessage(msg);
 }
 
+void CInputTranslator::mouseWheel(bool wheelUp, const Point &pt) {
+	CMouseWheelMsg msg(pt, wheelUp);
+	_inputHandler->handleMessage(msg);
+}
+
 void CInputTranslator::rightButtonDoubleClick(int special, const Point &pt) {
 	CMouseDoubleClickMsg msg(pt, MB_RIGHT);
 	_inputHandler->handleMessage(msg);
diff --git a/engines/titanic/input_translator.h b/engines/titanic/input_translator.h
index d92157b..66dcaa1 100644
--- a/engines/titanic/input_translator.h
+++ b/engines/titanic/input_translator.h
@@ -50,6 +50,7 @@ public:
 	void middleButtonDoubleClick(int special, const Point &pt);
 	void rightButtonDown(int special, const Point &pt);
 	void rightButtonUp(int special, const Point &pt);
+	void mouseWheel(bool wheelUp, const Point &pt);
 	void rightButtonDoubleClick(int special, const Point &pt);
 	void keyDown(const Common::KeyState &keyState);
 
diff --git a/engines/titanic/main_game_window.cpp b/engines/titanic/main_game_window.cpp
index 8785921..4ee7154 100644
--- a/engines/titanic/main_game_window.cpp
+++ b/engines/titanic/main_game_window.cpp
@@ -341,6 +341,14 @@ void CMainGameWindow::rightButtonUp(const Point &mousePos) {
 	HANDLE_MESSAGE(rightButtonUp)
 }
 
+void CMainGameWindow::mouseWheel(const Point &mousePos, bool wheelUp) {
+	if (!isMouseControlEnabled())
+		return;
+
+	_gameManager->_inputTranslator.mouseWheel(wheelUp, mousePos);
+	mouseChanged();
+}
+
 void CMainGameWindow::rightButtonDoubleClick(const Point &mousePos) {
 	if (!isMouseControlEnabled())
 		return;
diff --git a/engines/titanic/main_game_window.h b/engines/titanic/main_game_window.h
index 5065b9f..c70aa47 100644
--- a/engines/titanic/main_game_window.h
+++ b/engines/titanic/main_game_window.h
@@ -103,6 +103,7 @@ public:
 	virtual void middleButtonUp(const Point &mousePos);
 	virtual void rightButtonDown(const Point &mousePos);
 	virtual void rightButtonUp(const Point &mousePos);
+	virtual void mouseWheel(const Point &mousePos, bool wheelUp);
 	virtual void keyDown(Common::KeyState keyState);
 	virtual void keyUp(Common::KeyState keyState);
 
diff --git a/engines/titanic/messages/mouse_messages.h b/engines/titanic/messages/mouse_messages.h
index a10f3b4..05f9685 100644
--- a/engines/titanic/messages/mouse_messages.h
+++ b/engines/titanic/messages/mouse_messages.h
@@ -101,6 +101,20 @@ public:
 	static void generate();
 };
 
+class CMouseWheelMsg : public CMouseMsg {
+public:
+	bool _wheelUp;
+public:
+	CLASSDEF;
+	CMouseWheelMsg() : CMouseMsg(), _wheelUp(false) {}
+	CMouseWheelMsg(const Point &pt, bool wheelUp) :
+		CMouseMsg(pt, 0), _wheelUp(wheelUp) {}
+
+	static bool isSupportedBy(const CTreeItem *item) {
+		return supports(item, _type);
+	}
+};
+
 class CMouseDoubleClickMsg : public CMouseButtonMsg {
 public:
 	CLASSDEF;
diff --git a/engines/titanic/pet_control/pet_control.cpp b/engines/titanic/pet_control/pet_control.cpp
index d9f00c2..689ff01 100644
--- a/engines/titanic/pet_control/pet_control.cpp
+++ b/engines/titanic/pet_control/pet_control.cpp
@@ -37,6 +37,7 @@ BEGIN_MESSAGE_MAP(CPetControl, CGameObject)
 	ON_MESSAGE(MouseDragEndMsg)
 	ON_MESSAGE(MouseButtonUpMsg)
 	ON_MESSAGE(MouseDoubleClickMsg)
+	ON_MESSAGE(MouseWheelMsg)
 	ON_MESSAGE(KeyCharMsg)
 	ON_MESSAGE(VirtualKeyCharMsg)
 	ON_MESSAGE(TimerMsg)
@@ -317,6 +318,13 @@ bool CPetControl::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
 	return _sections[_currentArea]->MouseDoubleClickMsg(msg);
 }
 
+bool CPetControl::MouseWheelMsg(CMouseWheelMsg *msg) {
+	if (!containsPt(msg->_mousePos) || isInputLocked())
+		return false;
+
+	return _sections[_currentArea]->MouseWheelMsg(msg);
+}
+
 bool CPetControl::KeyCharMsg(CKeyCharMsg *msg) {
 	if (isInputLocked())
 		return false;
diff --git a/engines/titanic/pet_control/pet_control.h b/engines/titanic/pet_control/pet_control.h
index d42dff5..e95643b 100644
--- a/engines/titanic/pet_control/pet_control.h
+++ b/engines/titanic/pet_control/pet_control.h
@@ -116,6 +116,7 @@ protected:
 	bool MouseDragEndMsg(CMouseDragEndMsg *msg);
 	bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
 	bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
+	bool MouseWheelMsg(CMouseWheelMsg *msg);
 	bool KeyCharMsg(CKeyCharMsg *msg);
 	bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
 	bool TimerMsg(CTimerMsg *msg);
diff --git a/engines/titanic/pet_control/pet_conversations.cpp b/engines/titanic/pet_control/pet_conversations.cpp
index 58dcd57..10b3637 100644
--- a/engines/titanic/pet_control/pet_conversations.cpp
+++ b/engines/titanic/pet_control/pet_conversations.cpp
@@ -203,6 +203,15 @@ bool CPetConversations::MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) {
 		|| _scrollUp.MouseDoubleClickMsg(msg->_mousePos);
 }
 
+bool CPetConversations::MouseWheelMsg(CMouseWheelMsg *msg) {
+	if (msg->_wheelUp)
+		scrollUp();
+	else
+		scrollDown();
+
+	return true;
+}
+
 bool CPetConversations::KeyCharMsg(CKeyCharMsg *msg) {
 	Common::KeyState keyState;
 	keyState.ascii = msg->_key;
diff --git a/engines/titanic/pet_control/pet_conversations.h b/engines/titanic/pet_control/pet_conversations.h
index efb7db4..1837e5d 100644
--- a/engines/titanic/pet_control/pet_conversations.h
+++ b/engines/titanic/pet_control/pet_conversations.h
@@ -164,6 +164,7 @@ public:
 	virtual bool MouseButtonDownMsg(CMouseButtonDownMsg *msg);
 	virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg);
 	virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg);
+	virtual bool MouseWheelMsg(CMouseWheelMsg *msg);
 	virtual bool KeyCharMsg(CKeyCharMsg *msg);
 	virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg);
 
diff --git a/engines/titanic/pet_control/pet_section.h b/engines/titanic/pet_control/pet_section.h
index 9e9afe6..c68aa90 100644
--- a/engines/titanic/pet_control/pet_section.h
+++ b/engines/titanic/pet_control/pet_section.h
@@ -106,6 +106,7 @@ public:
 	virtual bool MouseDragEndMsg(CMouseDragEndMsg *msg) { return false; }
 	virtual bool MouseButtonUpMsg(CMouseButtonUpMsg *msg) { return false; }
 	virtual bool MouseDoubleClickMsg(CMouseDoubleClickMsg *msg) { return false; }
+	virtual bool MouseWheelMsg(CMouseWheelMsg *msg) { return false; }
 	virtual bool KeyCharMsg(CKeyCharMsg *msg) { return false; }
 	virtual bool VirtualKeyCharMsg(CVirtualKeyCharMsg *msg) { return false; }
 





More information about the Scummvm-git-logs mailing list