[dasher: 10/16] Two-button dynamic filter operable by mouse



commit 25f620070db46a04100276d8a0d1bce191032239
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Fri Jun 5 12:13:23 2009 +0100

    Two-button dynamic filter operable by mouse
    
    Clicks/taps reinterpreted as presses of button most appropriate to location when
    BP_BACKOFF_BUTTON turned off.

 Src/DasherCore/TwoButtonDynamicFilter.cpp |   19 +++++++++++++++++++
 Src/DasherCore/TwoButtonDynamicFilter.h   |    4 ++++
 2 files changed, 23 insertions(+), 0 deletions(-)
---
diff --git a/Src/DasherCore/TwoButtonDynamicFilter.cpp b/Src/DasherCore/TwoButtonDynamicFilter.cpp
index f1749ef..da1bc2a 100644
--- a/Src/DasherCore/TwoButtonDynamicFilter.cpp
+++ b/Src/DasherCore/TwoButtonDynamicFilter.cpp
@@ -93,6 +93,25 @@ bool CTwoButtonDynamicFilter::DecorateView(CDasherView *pView) {
   return bRV;
 }
 
+void CTwoButtonDynamicFilter::KeyDown(int Time, int iId, CDasherView *pDasherView, CDasherModel *pModel, CUserLogBase *pUserLog, bool bPos, int iX, int iY) {
+	if (iId == 100 && !GetBoolParameter(BP_BACKOFF_BUTTON))
+		//mouse click - will be ignored by superclass method.
+		//simulate press of button 2/3 according to whether click in top/bottom half
+		CButtonMultiPress::KeyDown(Time, (iY < pDasherView->Screen()->GetHeight()/2) ? 2 : 3, pDasherView, pModel, pUserLog);
+	else
+		CInputFilter::KeyDown(Time, iId, pDasherView, pModel, pUserLog, bPos, iX, iY);
+}
+
+void CTwoButtonDynamicFilter::KeyUp(int Time, int iId, CDasherView *pDasherView, CDasherModel *pModel, bool bPos, int iX, int iY) {
+	if (iId == 100 && !GetBoolParameter(BP_BACKOFF_BUTTON))
+		//mouse click - will be ignored by superclass method.
+		//simulate press of button 2/3 according to whether click in top/bottom half
+		CButtonMultiPress::KeyUp(Time, (iY < pDasherView->Screen()->GetHeight()/2) ? 2 : 3, pDasherView, pModel);
+	else
+		CInputFilter::KeyUp(Time, iId, pDasherView, pModel, bPos, iX, iY);
+}
+
+
 bool CTwoButtonDynamicFilter::TimerImpl(int Time, CDasherView *m_pDasherView, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted) {
   return m_pDasherModel->OneStepTowards(100,2048, Time, pAdded, pNumDeleted);
 }
diff --git a/Src/DasherCore/TwoButtonDynamicFilter.h b/Src/DasherCore/TwoButtonDynamicFilter.h
index 0799530..aca5a80 100644
--- a/Src/DasherCore/TwoButtonDynamicFilter.h
+++ b/Src/DasherCore/TwoButtonDynamicFilter.h
@@ -49,6 +49,10 @@ class CTwoButtonDynamicFilter : public CButtonMultiPress {
   virtual void pause();
   virtual void reverse();
 
+  //override to inspect x,y coords of mouse clicks/taps
+  virtual void KeyDown(int Time, int iId, CDasherView *pDasherView, CDasherModel *pModel, CUserLogBase *pUserLog, bool bPos, int iX, int iY);
+  virtual void KeyUp(int Time, int iId, CDasherView *pDasherView, CDasherModel *pModel, bool bPos, int iX, int iY);
+	
  private:
   unsigned int maxClickCount() {return GetBoolParameter(BP_2B_INVERT_DOUBLE) ? 3 : 2;}
   virtual bool TimerImpl(int Time, CDasherView *m_pDasherView, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted);



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]