[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[Traverso-commit] traverso/src/core Command.cpp Command.h InputEn...
From: |
Remon Sijrier |
Subject: |
[Traverso-commit] traverso/src/core Command.cpp Command.h InputEn... |
Date: |
Fri, 13 Apr 2007 09:57:35 +0000 |
CVSROOT: /sources/traverso
Module name: traverso
Changes by: Remon Sijrier <r_sijrier> 07/04/13 09:57:35
Modified files:
src/core : Command.cpp Command.h InputEngine.cpp
InputEngine.h
Log message:
* Added cancel support for hold type actions.
Hitting Escape during a hold command will cancel the action, and the
holdcommands cancel_action() function will be called. No Command
classes updated though...
CVSWeb URLs:
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Command.cpp?cvsroot=traverso&r1=1.16&r2=1.17
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/Command.h?cvsroot=traverso&r1=1.10&r2=1.11
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.cpp?cvsroot=traverso&r1=1.46&r2=1.47
http://cvs.savannah.gnu.org/viewcvs/traverso/src/core/InputEngine.h?cvsroot=traverso&r1=1.21&r2=1.22
Patches:
Index: Command.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/Command.cpp,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -b -r1.16 -r1.17
--- Command.cpp 11 Apr 2007 21:19:18 -0000 1.16
+++ Command.cpp 13 Apr 2007 09:57:35 -0000 1.17
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
-$Id: Command.cpp,v 1.16 2007/04/11 21:19:18 r_sijrier Exp $
+$Id: Command.cpp,v 1.17 2007/04/13 09:57:35 r_sijrier Exp $
*/
#include "Command.h"
@@ -233,6 +233,16 @@
return -1;
}
+/**
+ * Cancels the action (makes only sense for hold type of actions).
+ Reimplement to undo any changes allready made, either be it
+ data from the core that has changed, or e.g. gui items who
+ moved in the jog() function.
+ */
+void Command::cancel_action()
+{
+ // reimplement me
+}
/**
* Uses the mouse hints specified in the keymap.xml file to set a cursor
@@ -275,3 +285,4 @@
}
//eof
+
Index: Command.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/Command.h,v
retrieving revision 1.10
retrieving revision 1.11
diff -u -b -r1.10 -r1.11
--- Command.h 2 Apr 2007 21:05:43 -0000 1.10
+++ Command.h 13 Apr 2007 09:57:35 -0000 1.11
@@ -17,7 +17,7 @@
along with this program; if not, write to the Free Software
Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
- $Id: Command.h,v 1.10 2007/04/02 21:05:43 r_sijrier Exp $
+ $Id: Command.h,v 1.11 2007/04/13 09:57:35 r_sijrier Exp $
*/
#ifndef COMMAND_H
@@ -46,6 +46,7 @@
virtual int undo_action();
virtual int jog();
virtual void set_cursor_shape(int useX, int useY);
+ virtual void cancel_action();
void undo() {undo_action();}
void redo() {do_action();}
Index: InputEngine.cpp
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.cpp,v
retrieving revision 1.46
retrieving revision 1.47
diff -u -b -r1.46 -r1.47
--- InputEngine.cpp 12 Apr 2007 18:08:26 -0000 1.46
+++ InputEngine.cpp 13 Apr 2007 09:57:35 -0000 1.47
@@ -516,6 +516,7 @@
fact1_k2 = 0;
isHolding = false;
isPressEventLocked = false;
+ m_cancelHold = false;
stackIndex = 0;
pressEventCounter = 0;
fact2_k1 = 0;
@@ -595,6 +596,12 @@
void InputEngine::process_press_event(int eventcode, bool isAutoRepeat)
{
+ if (eventcode == Qt::Key_Escape && is_holding()) {
+ m_cancelHold = true;
+ finish_hold();
+ return;
+ }
+
if (is_modifier_keyfact(eventcode)) {
if ( (! isAutoRepeat) && (!
m_activeModifierKeys.contains(eventcode)) ) {
m_activeModifierKeys.append(eventcode);
@@ -1097,7 +1104,15 @@
isHolding = false;
+ if (m_cancelHold) {
+ PMESG("Canceling this hold command");
if (holdingCommand) {
+ holdingCommand->cancel_action();
+ delete holdingCommand;
+ holdingCommand = 0;
+ }
+ cpointer().reset_cursor();
+ } else if (holdingCommand) {
holdingCommand->finish_hold();
cpointer().reset_cursor();
@@ -1118,7 +1133,7 @@
delete holdingCommand;
}
- holdingCommand = (Command*) 0;
+ holdingCommand = 0;
}
set_jogging(false);
Index: InputEngine.h
===================================================================
RCS file: /sources/traverso/traverso/src/core/InputEngine.h,v
retrieving revision 1.21
retrieving revision 1.22
diff -u -b -r1.21 -r1.22
--- InputEngine.h 12 Apr 2007 18:08:26 -0000 1.21
+++ InputEngine.h 13 Apr 2007 09:57:35 -0000 1.22
@@ -183,6 +183,7 @@
bool isDoubleKey;
bool isJogging;
bool isCollecting;
+ bool m_cancelHold;
int fact1_k1;
int fact1_k2;
[Prev in Thread] |
Current Thread |
[Next in Thread] |
- [Traverso-commit] traverso/src/core Command.cpp Command.h InputEn...,
Remon Sijrier <=