[dasher: 3/16] Made Y-axis non-linearity a parameter (rather than an #ifdef)



commit 98754c78a2dbb5e006bf5e7effd970d46ef2b566
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Wed Sep 2 14:59:40 2009 +0100

    Made Y-axis non-linearity a parameter (rather than an #ifdef)

 ...s-non-linearity-a-parameter-rather-than-a.patch |   81 ++++++++++++++++++++
 Src/DasherCore/DasherView.cpp                      |    5 -
 Src/DasherCore/DasherViewSquare.cpp                |   15 ++--
 Src/DasherCore/Parameters.h                        |    7 ++-
 4 files changed, 93 insertions(+), 15 deletions(-)
---
diff --git a/Src/DasherCore/0002-Made-Y-axis-non-linearity-a-parameter-rather-than-a.patch b/Src/DasherCore/0002-Made-Y-axis-non-linearity-a-parameter-rather-than-a.patch
new file mode 100644
index 0000000..5aba05d
--- /dev/null
+++ b/Src/DasherCore/0002-Made-Y-axis-non-linearity-a-parameter-rather-than-a.patch
@@ -0,0 +1,81 @@
+From 5d5c967327a0bae559c0d221e4a6333b46d43382 Mon Sep 17 00:00:00 2001
+From: Alan Lawrence <acl33 inf phy cam ac uk>
+Date: Wed, 2 Sep 2009 14:53:17 +0100
+Subject: [PATCH 2/2] Made Y-axis non-linearity a parameter (rather than an #ifdef)
+
+---
+ Src/DasherCore/DasherView.cpp       |    5 -----
+ Src/DasherCore/DasherViewSquare.cpp |   15 ++++++---------
+ Src/DasherCore/Parameters.h         |    7 ++++++-
+ 3 files changed, 12 insertions(+), 15 deletions(-)
+
+diff --git a/Src/DasherCore/DasherView.cpp b/Src/DasherCore/DasherView.cpp
+index 6051609..daa01f1 100644
+--- a/Src/DasherCore/DasherView.cpp
++++ b/Src/DasherCore/DasherView.cpp
+@@ -361,11 +361,6 @@ int CDasherView::GetCoordinates(myint &iDasherX, myint &iDasherY) {
+     break;
+   }
+ 
+-#ifndef WITH_MAEMO
+-  // FIXME
+-  //  iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * GetLongParameter(LP_MAX_Y));
+-  // iDasherY = m_ymap.map(iDasherY);
+-#endif
+   ///GAME///
+   if(m_bGameMode)
+     {
+diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
+index 5632d99..378e6b3 100644
+--- a/Src/DasherCore/DasherViewSquare.cpp
++++ b/Src/DasherCore/DasherViewSquare.cpp
+@@ -579,11 +579,10 @@ void CDasherViewSquare::Screen2Dasher(screenint iInputX, screenint iInputY, myin
+     break;
+   }
+ 
+-#ifndef WITH_MAEMO
+-  // FIXME - disabled to avoid floating point
++  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);
+-#endif
++  }
+   
+ }
+ 
+@@ -668,12 +667,10 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
+ 
+   // Apply the nonlinearities
+ 
+-#ifndef WITH_MAEMO
+-  // FIXME
+-  iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * (myint)GetLongParameter(LP_MAX_Y));
+-  iDasherY = m_ymap.map(iDasherY);
+-#endif
+-
++  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);
++  }
+ 
+   // Things we're likely to need:
+ 
+diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
+index 4024731..c6d9224 100644
+--- a/Src/DasherCore/Parameters.h
++++ b/Src/DasherCore/Parameters.h
+@@ -158,6 +158,11 @@ static bp_table boolparamtable[] = {
+   {BP_SOCKET_DEBUG, "SocketInputDebug", PERS, false, "Print information about socket input processing to console"},
+   {BP_CIRCLE_START, "CircleStart", PERS, false, "Start on circle mode"},
+   {BP_GLOBAL_KEYBOARD, "GlobalKeyboard", PERS, false, "Whether to assume global control of the keyboard"},
++#ifdef WITH_MAEMO
++  {BP_NONLINEAR_Y, "NonlinearY", PERS, false, "Apply nonlinearities to Y axis (i.e. compress top & bottom)"},
++#else
++  {BP_NONLINEAR_Y, "NonlinearY", PERS, true, "Apply nonlinearities to Y axis (i.e. compress top & bottom)"},
++#endif
+   {BP_SMOOTH_OFFSET, "DelayView", !PERS, false, "Smooth dynamic-button-mode jumps over several frames"},
+   {BP_CONVERSION_MODE, "ConversionMode", !PERS, false, "Whether Dasher is operating in conversion (eg Japanese) mode"},
+   {BP_PAUSE_OUTSIDE, "PauseOutside", PERS, false, "Whether to pause when pointer leaves canvas area"},
+-- 
+1.6.2.2
+
diff --git a/Src/DasherCore/DasherView.cpp b/Src/DasherCore/DasherView.cpp
index 6051609..daa01f1 100644
--- a/Src/DasherCore/DasherView.cpp
+++ b/Src/DasherCore/DasherView.cpp
@@ -361,11 +361,6 @@ int CDasherView::GetCoordinates(myint &iDasherX, myint &iDasherY) {
     break;
   }
 
-#ifndef WITH_MAEMO
-  // FIXME
-  //  iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * GetLongParameter(LP_MAX_Y));
-  // iDasherY = m_ymap.map(iDasherY);
-#endif
   ///GAME///
   if(m_bGameMode)
     {
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index 5632d99..378e6b3 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -579,11 +579,10 @@ void CDasherViewSquare::Screen2Dasher(screenint iInputX, screenint iInputY, myin
     break;
   }
 
-#ifndef WITH_MAEMO
-  // FIXME - disabled to avoid floating point
+  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);
-#endif
+  }
   
 }
 
@@ -668,12 +667,10 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
 
   // Apply the nonlinearities
 
-#ifndef WITH_MAEMO
-  // FIXME
-  iDasherX = myint(xmap(iDasherX / static_cast < double >(GetLongParameter(LP_MAX_Y))) * (myint)GetLongParameter(LP_MAX_Y));
-  iDasherY = m_ymap.map(iDasherY);
-#endif
-
+  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);
+  }
 
   // Things we're likely to need:
 
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index 4024731..c6d9224 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -42,7 +42,7 @@ enum {
   BP_BUTTONMENU, BP_BUTTONPULSING, BP_BUTTONSTEADY, 
   BP_BUTTONDIRECT, BP_BUTTONFOURDIRECT, BP_BUTTONALTERNATINGDIRECT,
   BP_COMPASSMODE, BP_SOCKET_INPUT_ENABLE, BP_SOCKET_DEBUG, 
-  BP_CIRCLE_START, BP_GLOBAL_KEYBOARD, 
+  BP_CIRCLE_START, BP_GLOBAL_KEYBOARD, BP_NONLINEAR_Y,
   BP_SMOOTH_OFFSET, BP_CONVERSION_MODE, BP_PAUSE_OUTSIDE, BP_BACKOFF_BUTTON,
   BP_TWOBUTTON_REVERSE, BP_2B_INVERT_DOUBLE, BP_SLOW_START, END_OF_BPS
 };
@@ -158,6 +158,11 @@ static bp_table boolparamtable[] = {
   {BP_SOCKET_DEBUG, "SocketInputDebug", PERS, false, "Print information about socket input processing to console"},
   {BP_CIRCLE_START, "CircleStart", PERS, false, "Start on circle mode"},
   {BP_GLOBAL_KEYBOARD, "GlobalKeyboard", PERS, false, "Whether to assume global control of the keyboard"},
+#ifdef WITH_MAEMO
+  {BP_NONLINEAR_Y, "NonlinearY", PERS, false, "Apply nonlinearities to Y axis (i.e. compress top & bottom)"},
+#else
+  {BP_NONLINEAR_Y, "NonlinearY", PERS, true, "Apply nonlinearities to Y axis (i.e. compress top & bottom)"},
+#endif
   {BP_SMOOTH_OFFSET, "DelayView", !PERS, false, "Smooth dynamic-button-mode jumps over several frames"},
   {BP_CONVERSION_MODE, "ConversionMode", !PERS, false, "Whether Dasher is operating in conversion (eg Japanese) mode"},
   {BP_PAUSE_OUTSIDE, "PauseOutside", PERS, false, "Whether to pause when pointer leaves canvas area"},



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