[dasher] CDefaultFilter::ApplyTransform takes CDasherView as extra param



commit c47a295de2da1af1d2a3c60eb79fbb2e7142e9b2
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Nov 20 21:41:48 2010 +0000

    CDefaultFilter::ApplyTransform takes CDasherView as extra param
    
    Simplifies OneDimensionalFilter - remove Timer(), m_iDasherMaxX.
    Also change InputFilter::KeyUp/Down (w/out bPos, x, y) from private => protected

 Src/DasherCore/DefaultFilter.cpp        |    6 +++---
 Src/DasherCore/DefaultFilter.h          |    2 +-
 Src/DasherCore/InputFilter.h            |    1 -
 Src/DasherCore/OneDimensionalFilter.cpp |   11 ++++-------
 Src/DasherCore/OneDimensionalFilter.h   |    4 +---
 5 files changed, 9 insertions(+), 15 deletions(-)
---
diff --git a/Src/DasherCore/DefaultFilter.cpp b/Src/DasherCore/DefaultFilter.cpp
index 7c8141b..1a03ab8 100644
--- a/Src/DasherCore/DefaultFilter.cpp
+++ b/Src/DasherCore/DefaultFilter.cpp
@@ -46,7 +46,7 @@ bool CDefaultFilter::DecorateView(CDasherView *pView, CDasherInput *pInput) {
   if (GetBoolParameter(BP_DASHER_PAUSED)) {
     //Timer() is not retrieving input coordinates, so we'd better do so here...
     if (!pInput->GetDasherCoords(m_iLastX, m_iLastY, pView)) return false;
-    ApplyTransform(m_iLastX, m_iLastY);
+    ApplyTransform(m_iLastX, m_iLastY, pView);
   }
 
   if(GetBoolParameter(BP_DRAW_MOUSE)) {
@@ -114,7 +114,7 @@ bool CDefaultFilter::Timer(int Time, CDasherView *pView, CDasherInput *pInput, C
       m_pInterface->Stop();
       return false;
     };
-    ApplyTransform(m_iLastX, m_iLastY);
+    ApplyTransform(m_iLastX, m_iLastY, pView);
 
     if(GetBoolParameter(BP_STOP_OUTSIDE)) {
       myint iDasherMinX;
@@ -205,7 +205,7 @@ double xmax(double y) {
   //cout << "xmax = " << xmax << endl;
 }
 
-void CDefaultFilter::ApplyTransform(myint &iDasherX, myint &iDasherY) {
+void CDefaultFilter::ApplyTransform(myint &iDasherX, myint &iDasherY, CDasherView *pView) {
   ApplyOffset(iDasherX, iDasherY);
   if (GetBoolParameter(BP_REMAP_XTREME)) {
     // Y co-ordinate...
diff --git a/Src/DasherCore/DefaultFilter.h b/Src/DasherCore/DefaultFilter.h
index 3e97bf2..38ccf69 100644
--- a/Src/DasherCore/DefaultFilter.h
+++ b/Src/DasherCore/DefaultFilter.h
@@ -22,7 +22,7 @@ class CDefaultFilter : public CInputFilter {
   bool GetSettings(SModuleSettings **, int *);
  protected:
   virtual void CreateStartHandler();
-  virtual void ApplyTransform(myint &iDasherX, myint &iDasherY);
+  virtual void ApplyTransform(myint &iDasherX, myint &iDasherY, CDasherView *pView);
   void ApplyOffset(myint &iDasherX, myint &iDasherY);
   
 protected:
diff --git a/Src/DasherCore/InputFilter.h b/Src/DasherCore/InputFilter.h
index 552a613..b94ebd6 100644
--- a/Src/DasherCore/InputFilter.h
+++ b/Src/DasherCore/InputFilter.h
@@ -43,7 +43,6 @@ class CInputFilter : public CDasherModule {
  protected:
   CDasherInterfaceBase *m_pInterface;
 
- private:
   virtual void KeyDown(int Time, int iId, CDasherView *pDasherView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog) {};
   virtual void KeyUp(int Time, int iId, CDasherView *pDasherView, CDasherInput *pInput, CDasherModel *pModel) {};
 };
diff --git a/Src/DasherCore/OneDimensionalFilter.cpp b/Src/DasherCore/OneDimensionalFilter.cpp
index 8367f94..6d2777d 100644
--- a/Src/DasherCore/OneDimensionalFilter.cpp
+++ b/Src/DasherCore/OneDimensionalFilter.cpp
@@ -11,20 +11,17 @@ COneDimensionalFilter::COneDimensionalFilter(Dasher::CEventHandler * pEventHandl
   : CDefaultFilter(pEventHandler, pSettingsStore, pInterface, iID, szName), forwardmax(GetLongParameter(LP_MAX_Y)/2.5) {
 }
 
-bool COneDimensionalFilter::Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol) {
-  myint iDasherMinX,iDasherMaxY,iDasherMinY;
-  pView->VisibleRegion(iDasherMinX, iDasherMinY, m_iDasherMaxX, iDasherMaxY);
-  return CDefaultFilter::Timer(Time,pView,pInput,pModel,pAdded,pNumDeleted,pol);
-}
+void COneDimensionalFilter::ApplyTransform(myint &iDasherX, myint &iDasherY, CDasherView *pView) {
 
-void COneDimensionalFilter::ApplyTransform(myint &iDasherX, myint &iDasherY) {
+  myint iDasherMaxX,temp;
+  pView->VisibleRegion(temp, temp, iDasherMaxX, temp);
 
   double disty,circlesize,yfullrange,yforwardrange,angle,ellipse_eccentricity,ybackrange,yb,x;	
   
   // The distance between the Y coordinate and the centreline in pixels
   disty=(myint)GetLongParameter(LP_OY)-iDasherY;
   
-  circlesize=    forwardmax*(1.0-max(0.0,min(1.0,(double)iDasherX/m_iDasherMaxX)));
+  circlesize=    forwardmax*(1.0-max(0.0,min(1.0,(double)iDasherX/iDasherMaxX)));
   yforwardrange= (myint)GetLongParameter(LP_MAX_Y)/3.2; // Was 1.6
   yfullrange=    yforwardrange*1.6;
   ybackrange=    yfullrange-yforwardrange;
diff --git a/Src/DasherCore/OneDimensionalFilter.h b/Src/DasherCore/OneDimensionalFilter.h
index c2d6bb2..1c06789 100644
--- a/Src/DasherCore/OneDimensionalFilter.h
+++ b/Src/DasherCore/OneDimensionalFilter.h
@@ -10,13 +10,11 @@ class COneDimensionalFilter : public CDefaultFilter {
  public:
 //  COneDimensionalFilter(Dasher::CEventHandler * pEventHandler, CSettingsStore *pSettingsStore, CDasherInterfaceBase *pInterface, CDasherModel *m_pDasherModel);
   COneDimensionalFilter(Dasher::CEventHandler * pEventHandler, CSettingsStore *pSettingsStore, CDasherInterfaceBase *pInterface,  ModuleID_t iID = 4, const char *szName = _("One Dimensional Mode"));
-  bool Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol);
   ///Override to remove DefaultFilters BP_REMAP_XTREME, BP_AUTOCALIBRATE, LP_OFFSET
   bool GetSettings(SModuleSettings **pSettings, int *iCount);
  protected:
-   virtual void ApplyTransform(myint &iDasherX, myint &iDasherY);
+   virtual void ApplyTransform(myint &iDasherX, myint &iDasherY, CDasherView *pView);
    const myint forwardmax;
-   myint m_iDasherMaxX;
 };
 }
 /// @}



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