[dasher] Many tidies to DasherViewSquare



commit faa935c3e1990b4906864ef402694834c6fefd83
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Dec 9 16:16:20 2009 +0000

    Many tidies to DasherViewSquare
    
      *GC e.g. xmax, bInBox, iBoxStart, iBoxEntered, Get_node_under_mouse(),
        CanvasX, CanvasWidth, CanvasBorder, m_dXmpd
      *xmap & ixmap work directly on myints, converting to/from doubles internally
      *Cymap class merged into DasherViewSquare
      *Remove defunct / never-implemented (??) LP_TRUNCATION & LP_TRUNCATIONTYPE
      *Removed unused game mode parameter to various Render methods

 Src/DasherCore/DasherModel.cpp      |   17 +++----
 Src/DasherCore/DasherModel.h        |    2 -
 Src/DasherCore/DasherView.cpp       |    4 +-
 Src/DasherCore/DasherView.h         |    4 +-
 Src/DasherCore/DasherViewSquare.cpp |   84 ++++++++--------------------------
 Src/DasherCore/DasherViewSquare.h   |   48 +++++++-------------
 Src/DasherCore/DasherViewSquare.inl |   28 +++++++-----
 Src/DasherCore/Parameters.h         |    6 +--
 8 files changed, 67 insertions(+), 126 deletions(-)
---
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 383ce8b..3ed20bb 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -277,12 +277,6 @@ CDasherNode *CDasherModel::Get_node_under_crosshair() {
   return m_Root->Get_node_under(GetLongParameter(LP_NORMALIZATION), m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, GetLongParameter(LP_OX), GetLongParameter(LP_OY));
 }
 
-CDasherNode *CDasherModel::Get_node_under_mouse(myint Mousex, myint Mousey) {
-  DASHER_ASSERT(m_Root != NULL);
-
-  return m_Root->Get_node_under(GetLongParameter(LP_NORMALIZATION), m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, Mousex, Mousey);
-}
-
 void CDasherModel::DeleteTree() {
   ClearRootQueue();
   delete m_Root;
@@ -625,17 +619,22 @@ bool CDasherModel::RenderToView(CDasherView *pView, CExpansionPolicy &policy) {
   // DASHER_ASSERT(Get_node_under_crosshair() == m_pLastOutput);
 
   bool bReturnValue = false;
-  std::vector<std::pair<myint,bool> > vGameTargetY;
   
   // The Render routine will fill iGameTargetY with the Dasher Coordinate of the 
   // youngest node with NF_GAME set. The model is responsible for setting NF_GAME on
   // the appropriate Nodes.
-  pView->Render(m_Root, m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, policy, true, &vGameTargetY);  
+  pView->Render(m_Root, m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, policy, true);  
 
   /////////GAME MODE TEMP//////////////
   if(m_bGameMode)
-    if(GameMode::CDasherGameMode* pTeacher = GameMode::CDasherGameMode::GetTeacher())
+    if(GameMode::CDasherGameMode* pTeacher = GameMode::CDasherGameMode::GetTeacher()) {
+      //ACL 27/10/09 I note the following vector:
+      std::vector<std::pair<myint,bool> > vGameTargetY;
+      //was declared earlier and passed to pView->Render, above; but pView->Render
+      //would never do _anything_ to it. Hence the below seems a bit redundant too,
+      //but leaving around for now as a reminder that Game Mode generally is a TODO.
       pTeacher->SetTargetY(vGameTargetY);
+    }
   //////////////////////////////////////
 
   // TODO: Fix up stats
diff --git a/Src/DasherCore/DasherModel.h b/Src/DasherCore/DasherModel.h
index b23b2d4..9692dbe 100644
--- a/Src/DasherCore/DasherModel.h
+++ b/Src/DasherCore/DasherModel.h
@@ -282,8 +282,6 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   double m_dTotalNats; 
 
 
-  CDasherNode *Get_node_under_mouse(myint smousex, myint smousey);
-
   ///
   /// Go directly to a given coordinate - check semantics
   ///
diff --git a/Src/DasherCore/DasherView.cpp b/Src/DasherCore/DasherView.cpp
index bb20f21..1c83283 100644
--- a/Src/DasherCore/DasherView.cpp
+++ b/Src/DasherCore/DasherView.cpp
@@ -55,11 +55,11 @@ void CDasherView::ChangeScreen(CDasherScreen *NewScreen) {
 
 /////////////////////////////////////////////////////////////////////////////
 
-void CDasherView::Render(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, bool bRedrawDisplay, std::vector<std::pair<myint,bool> >* pvGameTargetY) {
+void CDasherView::Render(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, bool bRedrawDisplay) {
 
   m_iRenderCount = 0;
   Screen()->SetLoadBackground(false);
-  RenderNodes(pRoot, iRootMin, iRootMax, policy, pvGameTargetY);
+  RenderNodes(pRoot, iRootMin, iRootMax, policy);
 }
 
 int CDasherView::GetCoordinateCount() {
diff --git a/Src/DasherCore/DasherView.h b/Src/DasherCore/DasherView.h
index 22e5780..9d45981 100644
--- a/Src/DasherCore/DasherView.h
+++ b/Src/DasherCore/DasherView.h
@@ -121,7 +121,7 @@ public:
 
   /// Renders Dasher with mouse-dependent items
   /// \todo Clarify relationship between Render functions and probably only expose one
-  virtual void Render(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, bool bRedrawDisplay, std::vector<std::pair<myint,bool> >* pvGameTargetY);
+  virtual void Render(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, bool bRedrawDisplay);
 
   /// @}
 
@@ -180,7 +180,7 @@ private:
   CDasherInput *m_pInput;       // Input device abstraction
 
   /// Renders the Dasher node structure
-  virtual void RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, std::vector<std::pair<myint,bool> > *pvGamePointer) = 0;
+  virtual void RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy) = 0;
 
 
   /// Get the co-ordinates from the input device
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index 86b9493..309da14 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -60,7 +60,7 @@ static char THIS_FILE[] = __FILE__;
 // FIXME - duplicated 'mode' code throught - needs to be fixed (actually, mode related stuff, Input2Dasher etc should probably be at least partially in some other class)
 
 CDasherViewSquare::CDasherViewSquare(CEventHandler *pEventHandler, CSettingsStore *pSettingsStore, CDasherScreen *DasherScreen)
- : CDasherView(pEventHandler, pSettingsStore, DasherScreen) {
+: CDasherView(pEventHandler, pSettingsStore, DasherScreen),   m_Y1(4), m_Y2(0.95 * GetLongParameter(LP_MAX_Y)), m_Y3(0.05 * GetLongParameter((LP_MAX_Y))) {
 
   // TODO - AutoOffset should be part of the eyetracker input filter
   // Make sure that the auto calibration is set to zero berfore we start
@@ -73,9 +73,6 @@ CDasherViewSquare::CDasherViewSquare(CEventHandler *pEventHandler, CSettingsStor
   m_dXmpa = 0.2;                // these are for the x non-linearity
   m_dXmpb = 0.5;
   m_dXmpc = 0.9;
-  m_dXmpd = 0.5;                // slow X movement when accelerating Y
-
-  m_ymap = Cymap((myint)GetLongParameter(LP_MAX_Y));
 
   m_bVisibleRegionValid = false;
   
@@ -226,8 +223,7 @@ void CDasherViewSquare::DasherDrawText(myint iAnchorX1, myint iAnchorY1, myint i
 }
 
 void CDasherViewSquare::RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iRootMax,
-				    CExpansionPolicy &policy,
-				    std::vector<std::pair<myint,bool> > *pvGamePointer) {
+				    CExpansionPolicy &policy) {
   DASHER_ASSERT(pRoot != 0);
   myint iDasherMinX;
   myint iDasherMinY;
@@ -277,7 +273,7 @@ void CDasherViewSquare::RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iR
   //		  0, -1, Nodes1, false, true, 1);
 
   // Render the root node (and children)
-  RecursiveRender(pRoot, iRootMin, iRootMax, iDasherMaxX, policy, std::numeric_limits<double>::infinity(), pvGamePointer,iDasherMaxX,0,0);
+  RecursiveRender(pRoot, iRootMin, iRootMax, iDasherMaxX, policy, std::numeric_limits<double>::infinity(), iDasherMaxX,0,0);
 
   // Labels are drawn in a second parse to get the overlapping right
   m_DelayDraw.Draw(Screen());
@@ -293,7 +289,6 @@ void CDasherViewSquare::RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iR
 
 bool CDasherViewSquare::CheckRender(CDasherNode *pRender, myint y1, myint y2,
 									int mostleft, CExpansionPolicy &policy, double dMaxCost,
-									std::vector<std::pair<myint,bool> > *pvGamePointer,
 									myint parent_width, int parent_color, int iDepth)
 {
   if (y2-y1 >= QUICK_REJECT)
@@ -320,7 +315,7 @@ bool CDasherViewSquare::CheckRender(CDasherNode *pRender, myint y1, myint y2,
 	  {
 		  //node should be rendered!
 		  
-		  RecursiveRender(pRender, y1, y2, mostleft, policy, dMaxCost, pvGamePointer, parent_width, parent_color, iDepth);
+		  RecursiveRender(pRender, y1, y2, mostleft, policy, dMaxCost, parent_width, parent_color, iDepth);
 		  return true;
 	  }
 	}
@@ -340,7 +335,6 @@ bool CDasherViewSquare::CheckRender(CDasherNode *pRender, myint y1, myint y2,
 
 void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2,
 					int mostleft, CExpansionPolicy &policy, double dMaxCost,
-					std::vector<std::pair<myint,bool> > *pvGamePointer,
 					myint parent_width,int parent_color, int iDepth)
 {
   DASHER_ASSERT_VALIDPTR_RW(pRender);
@@ -376,10 +370,8 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
   myint iDasherMaxY;
   VisibleRegion(iDasherMinX, iDasherMinY, iDasherMaxX, iDasherMaxY);
 
-  if(GetLongParameter(LP_TRUNCATION) == 0) {        // Regular squares
-    DasherDrawRectangle(std::min(parent_width,iDasherMaxX), std::max(y1,iDasherMinY), std::min(y2-y1,iDasherMaxX), std::min(y2,iDasherMaxY), parent_color, -1, Nodes1, 0);
-  }
-	
+  DasherDrawRectangle(std::min(parent_width,iDasherMaxX), std::max(y1,iDasherMinY), std::min(y2-y1,iDasherMaxX), std::min(y2,iDasherMaxY), parent_color, -1, Nodes1, 0);
+  
   const std::string &sDisplayText(pRender->GetDisplayInfo()->strDisplayText);
   if( sDisplayText.size() > 0 )
   {  
@@ -391,12 +383,7 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
 
   // If there are no children then we still need to render the parent
   if(pRender->ChildCount() == 0) {
-	  int iTruncation(GetLongParameter(LP_TRUNCATION));     // Trucation farction times -x100;
-	  //  int iTruncationType(GetLongParameter(LP_TRUNCATIONTYPE));
-	  
-	  if(iTruncation == 0) {        // Regular squares
-      DasherDrawRectangle(std::min(y2-y1,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), pRender->GetDisplayInfo()->iColour, -1, Nodes1, 0);
-	  }
+    DasherDrawRectangle(std::min(y2-y1,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), pRender->GetDisplayInfo()->iColour, -1, Nodes1, 0);
 	  //also allow it to be expanded, it's big enough.
 	  policy.pushNode(pRender, y1, y2, true, dMaxCost);
 	  return;
@@ -433,7 +420,7 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
       
       //don't inc iDepth, meaningless when covers the screen
       RecursiveRender(pChild, newy1, newy2, mostleft, 
-						policy, dMaxCost, pvGamePointer, 
+						policy, dMaxCost,
 						temp_parentwidth, temp_parentcolor, iDepth);
       //leave pRender->onlyChildRendered set, so remaining children are skipped
     }
@@ -453,13 +440,13 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
     if (newy1 < iDasherMinY && newy2 > iDasherMaxY) {
       DASHER_ASSERT(dMaxCost == std::numeric_limits<double>::infinity());
       pRender->onlyChildRendered = pChild;
-      RecursiveRender(pChild, newy1, newy2, mostleft, policy, dMaxCost, pvGamePointer, temp_parentwidth, temp_parentcolor, iDepth);
+      RecursiveRender(pChild, newy1, newy2, mostleft, policy, dMaxCost, temp_parentwidth, temp_parentcolor, iDepth);
       //ensure we don't blank over this child in "finishing off" the parent (!)
       lasty=newy2;
       break; //no need to render any more children!
     }
 		if (CheckRender(pChild, newy1, newy2, mostleft, policy, dMaxCost,
-						pvGamePointer, temp_parentwidth, temp_parentcolor, iDepth+1))
+						temp_parentwidth, temp_parentcolor, iDepth+1))
 		{
 		
           if (lasty<newy1) {
@@ -498,20 +485,6 @@ void CDasherViewSquare::RecursiveRender(CDasherNode *pRender, myint y1, myint y2
     //  }
 }
 
-
-
-
-CDasherViewSquare::Cymap::Cymap(myint iScale) {
-  double dY1 = 0.25;            // Amount of acceleration
-  double dY2 = 0.95;            // Accelerate Y movement below this point
-  double dY3 = 0.05;            // Accelerate Y movement above this point
-
-  m_Y2 = myint(dY2 * iScale);
-  m_Y3 = myint(dY3 * iScale);
-  m_Y1 = myint(1.0 / dY1);
-}
-
-
 bool CDasherViewSquare::IsNodeVisible(myint y1, myint y2) {
   myint iDasherMinX;
   myint iDasherMinY;
@@ -571,7 +544,6 @@ int CDasherViewSquare::RenderNodeOutlineFast(const int Color, myint y1, myint y2
 //   // FIXME - get rid of pointless assignment below
 
 //   int iTruncation(GetLongParameter(LP_TRUNCATION));     // Trucation farction times 100;
-//   //  int iTruncationType(GetLongParameter(LP_TRUNCATIONTYPE));
 
 //   if(iTruncation == 0) {        // Regular squares
 
@@ -623,19 +595,8 @@ int CDasherViewSquare::RenderNodePartFast(const int Color, myint y1, myint y2, i
     return 0;                   // We're entirely off screen, so don't render.
   }
 
-  //  myint iDasherSize(y2 - y1);
-
-  // FIXME - get rid of pointless assignment below
-
-  int iTruncation(GetLongParameter(LP_TRUNCATION));     // Trucation farction times -x100;
-  //  int iTruncationType(GetLongParameter(LP_TRUNCATIONTYPE));
-
-  if(iTruncation == 0) {        // Regular squares
-    DasherDrawRectangle(std::min(iParentWidth,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), Color, -1, Nodes1, 0);
-  }
-  else {
-   
-  }
+  DasherDrawRectangle(std::min(iParentWidth,iDasherMaxX), std::min(y2,iDasherMaxY),0, std::max(y1,iDasherMinY), Color, -1, Nodes1, 0);
+  
   return 1;
 }
 
@@ -681,8 +642,8 @@ void CDasherViewSquare::Screen2Dasher(screenint iInputX, screenint iInputY, myin
   }
 
   if (GetBoolParameter(BP_NONLINEAR_Y)) {
-    iDasherX = myint(ixmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * (myint)GetLongParameter(LP_MAX_Y));
-    iDasherY = m_ymap.unmap(iDasherY);
+    iDasherX = ixmap(iDasherX);
+    iDasherY = iymap(iDasherY);
   }
   
 }
@@ -770,8 +731,8 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
   // Apply the nonlinearities
 
   if (GetBoolParameter(BP_NONLINEAR_Y)) {
-    iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * (myint)GetLongParameter(LP_MAX_Y));
-    iDasherY = m_ymap.map(iDasherY);
+    iDasherX = xmap(iDasherX);
+    iDasherY = ymap(iDasherY);
   }
 
   // Things we're likely to need:
@@ -823,11 +784,11 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
 }
 
 void CDasherViewSquare::Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta) {
-	iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * GetLongParameter(LP_MAX_Y));
-    iDasherY = myint(m_ymap.map(iDasherY));
+	iDasherX = xmap(iDasherX);
+    iDasherY = ymap(iDasherY);
 	
-    myint iDasherOX = myint(xmap(GetLongParameter(LP_OX) / static_cast < double >(GetLongParameter(LP_MAX_Y))) * GetLongParameter(LP_MAX_Y));
-    myint iDasherOY = myint(m_ymap.map(GetLongParameter(LP_OY)));
+  myint iDasherOX = xmap(GetLongParameter(LP_OX));
+    myint iDasherOY = ymap(GetLongParameter(LP_OY));
 	
     double x = -(iDasherX - iDasherOX) / double(iDasherOX); //Use normalised coords so min r works 
     double y = -(iDasherY - iDasherOY) / double(iDasherOY); 
@@ -900,11 +861,6 @@ void CDasherViewSquare::VisibleRegion( myint &iDasherMinX, myint &iDasherMinY, m
 void CDasherViewSquare::ChangeScreen(CDasherScreen *NewScreen) {
   CDasherView::ChangeScreen(NewScreen);
   m_bVisibleRegionValid = false;
-  screenint Width = Screen()->GetWidth();
-  screenint Height = Screen()->GetHeight();
-  CanvasX = 9 * Width / 10;
-  CanvasBorder = Width - CanvasX;
-  CanvasY = Height;
   m_iScalingFactor = 100000000;
   SetScaleFactor();
 }
diff --git a/Src/DasherCore/DasherViewSquare.h b/Src/DasherCore/DasherViewSquare.h
index 7bbbe1f..156383c 100644
--- a/Src/DasherCore/DasherViewSquare.h
+++ b/Src/DasherCore/DasherViewSquare.h
@@ -98,13 +98,6 @@ public:
   /// @}
 
 
-  /// @name High level drawing
-  /// Drawing more complex structures, generally implemented by derived class
-  /// @{
-
-  /// @}
-
-
 private:
   ///
   /// Draw text specified in Dasher co-ordinates
@@ -117,17 +110,17 @@ private:
   ///
   /// Render the current state of the model.
   ///
-  virtual void RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy, std::vector<std::pair<myint,bool> > *pvGamePointer);
+  virtual void RenderNodes(CDasherNode *pRoot, myint iRootMin, myint iRootMax, CExpansionPolicy &policy);
   
   ///
   /// Recursively render all nodes in a tree. Responsible for all the Render_node calls
   ///
 
-  void RecursiveRender(CDasherNode * Render, myint y1, myint y2, int mostleft, CExpansionPolicy &policy, double dMaxCost, std::vector<std::pair<myint,bool> > *pvGamePointer, myint parent_width,int parent_color, int iDepth);
+  void RecursiveRender(CDasherNode * Render, myint y1, myint y2, int mostleft, CExpansionPolicy &policy, double dMaxCost, myint parent_width,int parent_color, int iDepth);
 
   ///Check that a node is large enough, and onscreen, to render;
   ///calls RecursiveRender if so, or collapses the node immediately if not
-  bool CheckRender(CDasherNode * Render, myint y1, myint y2, int mostleft, CExpansionPolicy &policy, double dMaxCost, std::vector<std::pair<myint,bool> > *pvGamePointer, myint parent_width,int parent_color, int iDepth);
+  bool CheckRender(CDasherNode * Render, myint y1, myint y2, int mostleft, CExpansionPolicy &policy, double dMaxCost, myint parent_width,int parent_color, int iDepth);
 
   /// Render a single node
   /// \param Color The colour to draw it
@@ -159,21 +152,20 @@ private:
   };
 #endif
 
-  // Class definitions
-  ///Implements the non-linearity near the extremes of the Y axis
-  class Cymap {
-  public:
-    Cymap(myint iScale);
-    Cymap() {}
-    inline myint map(myint y) const;
-    myint unmap(myint y) const;
-  private:
-    myint m_Y1, m_Y2, m_Y3;
-  };
+  /// @name Nonlinearity
+  /// Implements the non-linear part of the coordinate space mapping
+  
+  /// Maps a dasher Y coordinate to the Y value in a linear version of Dasher space (i.e. still not screen pixels)
+  /// (i.e. screen coordinate = scale(ymap(dasher coord)))
+  inline myint ymap(myint iDasherY) const;
+  
+  /// Inverse of the previous - i.e. dasher coord = iymap(scale(screen coord))
+  myint iymap(myint y) const;
+  ///parameters used by previous
+  const myint m_Y1, m_Y2, m_Y3;
 
-  double xmap(double x) const;
-  double xmax(double x, double y) const;
-  double ixmap(double x) const;
+  myint xmap(myint x) const;
+  myint ixmap(myint x) const;
   inline void Crosshair(myint sx);
   
   inline myint CustomIDiv(myint iNumerator, myint iDenominator);
@@ -189,15 +181,9 @@ private:
 
 
   // Data
-
-  bool bInBox;                  // Whether we're in the mouseposstart box
-  int iBoxStart;                // Time that the current box was drawn
-  int iBoxEntered;              // Time when the user enttered the current box
  
-  double m_dXmpa, m_dXmpb, m_dXmpc, m_dXmpd;
-  screenint CanvasX, CanvasY, CanvasBorder;
+  double m_dXmpa, m_dXmpb, m_dXmpc;
   screenint iCenterX;
-  Cymap m_ymap;
 
   // Cached values for scaling
   myint iLRScaleFactorX;
diff --git a/Src/DasherCore/DasherViewSquare.inl b/Src/DasherCore/DasherViewSquare.inl
index b20fff6..99856bc 100644
--- a/Src/DasherCore/DasherViewSquare.inl
+++ b/Src/DasherCore/DasherViewSquare.inl
@@ -43,23 +43,27 @@ namespace Dasher {
     DasherPolyline(x, y, 2, 1, 5);
   }
 
-  inline double CDasherViewSquare::ixmap(double x) const
+  inline myint CDasherViewSquare::ixmap(myint x) const
   {
-      if(x < m_dXmpb * m_dXmpc)
-        return x / m_dXmpc;
-      else
-        return m_dXmpb - m_dXmpa + m_dXmpa * exp((x / m_dXmpc - m_dXmpb) / m_dXmpa);
+    double dx = x / static_cast<double>(GetLongParameter(LP_MAX_Y));
+    if(dx < m_dXmpb * m_dXmpc)
+      dx /= m_dXmpc;
+    else
+      dx =m_dXmpb - m_dXmpa + m_dXmpa * exp((dx / m_dXmpc - m_dXmpb) / m_dXmpa);
+    return myint(dx * GetLongParameter(LP_MAX_Y));
   }
 
-  inline double CDasherViewSquare::xmap(double x) const
+  inline myint CDasherViewSquare::xmap(myint x) const
   {
-      if(x < m_dXmpb)
-        return m_dXmpc * x;
-      else
-        return m_dXmpc * (m_dXmpa * log((x + m_dXmpa - m_dXmpb) / m_dXmpa) + m_dXmpb);
+    double dx = x / static_cast<double>(GetLongParameter(LP_MAX_Y));
+    if(dx < m_dXmpb)
+      dx *= m_dXmpc;
+    else
+      dx = m_dXmpc * (m_dXmpa * log((dx + m_dXmpa - m_dXmpb) / m_dXmpa) + m_dXmpb);
+    return myint(dx * GetLongParameter(LP_MAX_Y));
   }
 
-  inline myint CDasherViewSquare::Cymap::map(myint y) const {
+  inline myint CDasherViewSquare::ymap(myint y) const {
     if(y > m_Y2)
       return m_Y2 + (y - m_Y2) / m_Y1;
     else if(y < m_Y3)
@@ -68,7 +72,7 @@ namespace Dasher {
       return y;
   }
 
-  inline myint CDasherViewSquare::Cymap::unmap(myint ydash) const {
+  inline myint CDasherViewSquare::iymap(myint ydash) const {
     if(ydash > m_Y2)
       return (ydash - m_Y2) * m_Y1 + m_Y2;
     else if(ydash < m_Y3)
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index e252930..55189e5 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -54,8 +54,8 @@ enum {
 enum { 
   LP_ORIENTATION = END_OF_BPS, LP_REAL_ORIENTATION, LP_MAX_BITRATE, LP_FRAMERATE,
   LP_VIEW_ID, LP_LANGUAGE_MODEL_ID, LP_DASHER_FONTSIZE,
-  LP_UNIFORM, LP_YSCALE, LP_MOUSEPOSDIST, LP_STOP_IDLETIME, LP_TRUNCATION, 
-  LP_TRUNCATIONTYPE, LP_LM_MAX_ORDER, LP_LM_EXCLUSION,
+  LP_UNIFORM, LP_YSCALE, LP_MOUSEPOSDIST, LP_STOP_IDLETIME,
+  LP_LM_MAX_ORDER, LP_LM_EXCLUSION,
   LP_LM_UPDATE_EXCLUSION, LP_LM_ALPHA, LP_LM_BETA,
   LP_LM_MIXTURE, LP_MOUSE_POS_BOX, LP_NORMALIZATION, LP_LINE_WIDTH, 
   LP_LM_WORD_ALPHA, LP_USER_LOG_LEVEL_MASK, 
@@ -199,8 +199,6 @@ static lp_table longparamtable[] = {
   {LP_YSCALE, "YScaling", PERS, 0, "YScaling"},
   {LP_MOUSEPOSDIST, "MousePositionBoxDistance", PERS, 50, "MousePositionBoxDistance"},
   {LP_STOP_IDLETIME, "StopIdleTime", PERS, 1000, "StopIdleTime" },
-  {LP_TRUNCATION, "Truncation", PERS, 0, "Truncation"},
-  {LP_TRUNCATIONTYPE, "TruncationType", PERS, 0, "TruncationType"},
   {LP_LM_MAX_ORDER, "LMMaxOrder", PERS, 5, "LMMaxOrder"},
   {LP_LM_EXCLUSION, "LMExclusion", PERS, 0, "LMExclusion"},
   {LP_LM_UPDATE_EXCLUSION, "LMUpdateExclusion", PERS, 1, "LMUpdateExclusion"},



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