[dasher] Make both one-button dynamic modes operable by mouse if extra backoff buttons



commit 43271e728d8dbd3ea7ef7a07ae1e1b56ec97f330
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Aug 8 22:29:07 2009 +0200

    Make both one-button dynamic modes operable by mouse if extra backoff buttons
    are disabled. (13-Jul-2009)

 ChangeLog                                 |    2 ++
 Src/DasherCore/OneButtonDynamicFilter.cpp |   18 ++++++++++++++++++
 Src/DasherCore/OneButtonDynamicFilter.h   |    4 ++++
 Src/DasherCore/TwoPushDynamicFilter.cpp   |   18 ++++++++++++++++++
 Src/DasherCore/TwoPushDynamicFilter.h     |    5 +++++
 5 files changed, 47 insertions(+), 0 deletions(-)
---
diff --git a/ChangeLog b/ChangeLog
index e87db22..f72ef32 100644
--- a/ChangeLog
+++ b/ChangeLog
@@ -3,6 +3,8 @@
 	* Tidy up ConversionManager and use a single instance per Factory.
 	* Make CConversionHelper a subclass of CConversionManager, rather than a
 	  delegate.
+	* Make both one-button dynamic modes operable by mouse if extra backoff
+	  buttons are disabled.
 
 2009-08-07  Alan Lawrence <acl33 inf phy cam ac uk>
 
diff --git a/Src/DasherCore/OneButtonDynamicFilter.cpp b/Src/DasherCore/OneButtonDynamicFilter.cpp
index dfc40e8..a5de472 100644
--- a/Src/DasherCore/OneButtonDynamicFilter.cpp
+++ b/Src/DasherCore/OneButtonDynamicFilter.cpp
@@ -95,6 +95,24 @@ bool COneButtonDynamicFilter::DecorateView(CDasherView *pView) {
   return bRV;
 }
 
+void COneButtonDynamicFilter::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...
+    CButtonMultiPress::KeyDown(Time, 2, pDasherView, pModel, pUserLog);
+  else
+    CInputFilter::KeyDown(Time, iId, pDasherView, pModel, pUserLog, bPos, iX, iY);
+}
+
+void COneButtonDynamicFilter::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...
+    CButtonMultiPress::KeyUp(Time, 2, pDasherView, pModel);
+  else
+    CInputFilter::KeyUp(Time, iId, pDasherView, pModel, bPos, iX, iY);
+}
+
 bool COneButtonDynamicFilter::TimerImpl(int Time, CDasherView *m_pDasherView, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted) {
   return m_pDasherModel->OneStepTowards(m_iTargetX[m_iTarget], m_iTargetY[m_iTarget], Time, pAdded, pNumDeleted);
 }
diff --git a/Src/DasherCore/OneButtonDynamicFilter.h b/Src/DasherCore/OneButtonDynamicFilter.h
index 4d43410..461f2cc 100644
--- a/Src/DasherCore/OneButtonDynamicFilter.h
+++ b/Src/DasherCore/OneButtonDynamicFilter.h
@@ -34,6 +34,10 @@ class COneButtonDynamicFilter : public CButtonMultiPress {
 
   virtual bool GetSettings(SModuleSettings **pSettings, int *iCount);
 
+  //override to get mouse clicks / taps back again...
+  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 2;} //double-click to reverse
   virtual bool TimerImpl(int Time, CDasherView *m_pDasherView, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted);
diff --git a/Src/DasherCore/TwoPushDynamicFilter.cpp b/Src/DasherCore/TwoPushDynamicFilter.cpp
index b7ba7f1..350639e 100644
--- a/Src/DasherCore/TwoPushDynamicFilter.cpp
+++ b/Src/DasherCore/TwoPushDynamicFilter.cpp
@@ -171,6 +171,24 @@ void CTwoPushDynamicFilter::HandleEvent(Dasher::CEvent * pEvent)
 
 };
 
+void CTwoPushDynamicFilter::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...
+    CDynamicFilter::KeyDown(Time, 2, pDasherView, pModel, pUserLog);
+  else
+    CInputFilter::KeyDown(Time, iId, pDasherView, pModel, pUserLog, bPos, iX, iY);
+}
+
+void CTwoPushDynamicFilter::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...
+    CDynamicFilter::KeyUp(Time, 2, pDasherView, pModel);
+  else
+    CInputFilter::KeyUp(Time, iId, pDasherView, pModel, bPos, iX, iY);
+}
+
 void CTwoPushDynamicFilter::ActionButton(int iTime, int iButton, int iType, CDasherModel *pModel, CUserLogBase *pUserLog) {
   // Types:
   // 0 = ordinary click
diff --git a/Src/DasherCore/TwoPushDynamicFilter.h b/Src/DasherCore/TwoPushDynamicFilter.h
index d79ef75..00e1c91 100644
--- a/Src/DasherCore/TwoPushDynamicFilter.h
+++ b/Src/DasherCore/TwoPushDynamicFilter.h
@@ -36,6 +36,11 @@ class CTwoPushDynamicFilter : public CDynamicFilter /*long push, but do our own
   virtual void Deactivate();
   virtual bool GetMinWidth(int &iMinWidth);
   virtual bool GetSettings(SModuleSettings **pSettings, int *iCount);
+
+  //override to get mouse clicks / taps back again...
+  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);
+
  protected:
   virtual bool TimerImpl(int Time, CDasherView *m_pDasherView, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted);
   virtual void ActionButton(int iTime, int iButton, int iType, CDasherModel *pModel, CUserLogBase *pUserLog);



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