[dasher: 124/217] Removed unuused stop on idle parameters and related code



commit c312e739203629168572a11e24462c4d1c972030
Author: ipomoena <amajorek google com>
Date:   Mon Nov 16 13:26:34 2015 -0800

    Removed unuused stop on idle parameters and related code

 Src/DasherCore/Parameters.cpp     |    2 -
 Src/DasherCore/Parameters.h       |    4 +-
 Src/Win32/Dasher.cpp              |    4 -
 Src/Win32/Dasher.rc               |    3 -
 Src/Win32/Widgets/Canvas.cpp      |  132 -------------------------------------
 Src/Win32/Widgets/Canvas.h        |  107 ------------------------------
 Src/Win32/Widgets/ControlPage.cpp |   26 -------
 Src/Win32/resource.h              |    3 -
 8 files changed, 2 insertions(+), 279 deletions(-)
---
diff --git a/Src/DasherCore/Parameters.cpp b/Src/DasherCore/Parameters.cpp
index a3c3e7a..643b4d3 100644
--- a/Src/DasherCore/Parameters.cpp
+++ b/Src/DasherCore/Parameters.cpp
@@ -11,7 +11,6 @@ const bp_table boolparamtable[] = {
   {BP_CURVE_MOUSE_LINE, "CurveMouseLine", false, "Curve mouse line according to screen nonlinearity"},
   {BP_START_MOUSE, "StartOnLeft", true, "StartOnLeft"},
   {BP_START_SPACE, "StartOnSpace", false, "StartOnSpace"},
-  {BP_STOP_IDLE, "StopOnIdle", false, "StopOnIdle"},
   {BP_CONTROL_MODE, "ControlMode", false, "ControlMode"},
   {BP_COLOUR_MODE, "ColourMode", true, "ColourMode"},
   {BP_MOUSEPOS_MODE, "StartOnMousePosition", false, "StartOnMousePosition"},
@@ -61,7 +60,6 @@ const lp_table longparamtable[] = {
   {LP_UNIFORM, "UniformTimes1000", 50, "UniformTimes1000"},
   {LP_YSCALE, "YScaling", 0, "YScaling"},
   {LP_MOUSEPOSDIST, "MousePositionBoxDistance", 50, "MousePositionBoxDistance"},
-  {LP_STOP_IDLETIME, "StopIdleTime", 1000, "StopIdleTime" },
   {LP_PY_PROB_SORT_THRES, "PYProbabilitySortThreshold", 85, "Sort converted syms in descending probability 
order up to this percentage"},
   {LP_MESSAGE_TIME, "MessageTime", 2500, "Time for which non-modal messages are displayed, in ms"},
   {LP_LM_MAX_ORDER, "LMMaxOrder", 5, "LMMaxOrder"},
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index c6e098b..c11024a 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -30,7 +30,7 @@
 enum { 
   BP_DRAW_MOUSE_LINE, BP_DRAW_MOUSE, BP_CURVE_MOUSE_LINE,
   BP_START_MOUSE,
-  BP_START_SPACE, BP_STOP_IDLE, BP_CONTROL_MODE, 
+  BP_START_SPACE, BP_CONTROL_MODE, 
   BP_COLOUR_MODE, BP_MOUSEPOS_MODE,
   BP_PALETTE_CHANGE, BP_TURBO_MODE, BP_EXACT_DYNAMICS,
   BP_AUTOCALIBRATE, BP_REMAP_XTREME,
@@ -48,7 +48,7 @@ enum {
 enum { 
   LP_ORIENTATION = END_OF_BPS, LP_MAX_BITRATE, LP_FRAMERATE,
   LP_VIEW_ID, LP_LANGUAGE_MODEL_ID, LP_DASHER_FONTSIZE, LP_MESSAGE_FONTSIZE, LP_SHAPE_TYPE,
-  LP_UNIFORM, LP_YSCALE, LP_MOUSEPOSDIST, LP_STOP_IDLETIME, LP_PY_PROB_SORT_THRES, LP_MESSAGE_TIME,
+  LP_UNIFORM, LP_YSCALE, LP_MOUSEPOSDIST, LP_PY_PROB_SORT_THRES, LP_MESSAGE_TIME,
   LP_LM_MAX_ORDER, LP_LM_EXCLUSION,
   LP_LM_UPDATE_EXCLUSION, LP_LM_ALPHA, LP_LM_BETA,
   LP_LM_MIXTURE, LP_LINE_WIDTH, LP_GEOMETRY,
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index fed7590..1769e3b 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -73,10 +73,6 @@ void CDasher::CreateModules() {
 }
 
 void CDasher::Main() {
-  if(m_pCanvas) {
-               m_pCanvas->DoFrame();
-  }
-
   DWORD dwTicks = GetTickCount();
        NewFrame(dwTicks, false);
 }
diff --git a/Src/Win32/Dasher.rc b/Src/Win32/Dasher.rc
index 6ab899b..eb83307 100644
--- a/Src/Win32/Dasher.rc
+++ b/Src/Win32/Dasher.rc
@@ -151,9 +151,6 @@ BEGIN
     LISTBOX         IDC_CONTROL_LIST,14,18,166,188,LBS_SORT | LBS_NOINTEGRALHEIGHT | WS_VSCROLL | WS_TABSTOP
     GROUPBOX        "Input Device:",IDC_STATIC,194,7,180,70
     PUSHBUTTON      "Options",IDC_BUTTON_PREFS2,319,56,48,14
-    CONTROL         "Stop when idle",IDC_STOPIDLE,"Button",BS_AUTOCHECKBOX | NOT WS_VISIBLE | 
WS_TABSTOP,241,209,65,10
-    EDITTEXT        IDC_IDLETIME,314,204,41,12,ES_AUTOHSCROLL | ES_NUMBER | NOT WS_VISIBLE | WS_DISABLED
-    LTEXT           "Idle time (milliseconds)",IDC_STATICIDLETIME,274,217,76,8,NOT WS_VISIBLE | WS_DISABLED
 END
 
 IDD_APPEARANCEPAGE DIALOGEX 0, 0, 381, 238
diff --git a/Src/Win32/Widgets/Canvas.cpp b/Src/Win32/Widgets/Canvas.cpp
index 543ea20..524f23e 100644
--- a/Src/Win32/Widgets/Canvas.cpp
+++ b/Src/Win32/Widgets/Canvas.cpp
@@ -40,8 +40,6 @@ using namespace Dasher;
 
 CCanvas::CCanvas(CDasher *DI) : m_pDasherInterface(DI) {
  
-  m_dwTicksLastEvent = 0;
-  m_bButtonDown = false;
   m_pScreen = 0;
 #ifndef HAVE_NO_THEME
   m_hTheme = NULL;
@@ -353,7 +351,6 @@ LRESULT CCanvas::OnLButtonDown(UINT message, WPARAM wParam, LPARAM lParam, BOOL&
   
   SetFocus();
 
-  m_bButtonDown = true;
   return 0;
 }
 
@@ -362,20 +359,6 @@ LRESULT CCanvas::OnLButtonUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& b
        bHandled = TRUE;
 
        m_pDasherInterface->KeyUp(GetTickCount(), 100);
-
-  // TODO: Check whether this needs to be reimplemented
-       //endturbo = GetTickCount();
-
-       //if(endturbo - startturbo > 1) 
-       //{
-       //      TCHAR deb[80];
-       //      wsprintf(deb, TEXT("start: %d\nend: %d\nduration: %d"), startturbo, endturbo, endturbo - 
startturbo);
-       //      OutputDebugString(deb);
-       //}
-       //lbuttonheld = 0;
-
-       //m_bButtonDown = false;
-
        return 0;
 
 }
@@ -409,46 +392,6 @@ LRESULT CCanvas::OnCursorOutOfRange(UINT message, WPARAM wParam, LPARAM lParam,
 }
 #endif
 
-LRESULT CCanvas::OnRButtonDown(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-//     bHandled = TRUE;
-//     if( m_pDasherInterface->GetBoolParameter(BP_START_STYLUS)  ) 
-//     {
-//             if( m_pDasherInterface->GetBoolParameter(BP_DASHER_PAUSED) )
-//                     m_pDasherInterface->Unpause(GetTickCount());
-//     }
-//     m_bButtonDown = true;
-       return 0;
-}
-
-
-LRESULT CCanvas::OnRButtonUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-       bHandled = TRUE;
-       m_bButtonDown = false;
-    return 0;
-}
-
-LRESULT CCanvas::OnMouseMove(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled)
-{
-       bHandled = true;
-
-// TODO: Is any of this needed?
-
-  // TODO: Reimplement pause on idle in the core
-
-//     imousex = LOWORD(lParam);
-//     imousey = HIWORD(lParam);
-       m_dwTicksLastEvent      = GetTickCount();
-//     if( m_pDasherInterface->GetBoolParameter(BP_START_STYLUS)  ) 
-//     {
-//             if( m_pDasherInterface->GetBoolParameter(BP_DASHER_PAUSED) )
-//                     m_pDasherInterface->Unpause(GetTickCount());
-//     }
-
-       return 0;
-}
-
 LRESULT CCanvas::OnSize(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
        if (LOWORD(lParam)>0 && HIWORD(lParam) >0) {
                m_pScreen->resize(LOWORD(lParam), HIWORD(lParam));
@@ -478,81 +421,6 @@ LRESULT CCanvas::OnTimer(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHand
   return 0;
 }
 
-void CCanvas::DoFrame()
-{
-// PRLW This function appears to implement pausing dasher after a period
-// of idleness based on a boolean parameter which cannot be set from the GUI
-#if 0
-       //POINT mousepos2;
-       //GetCursorPos(&mousepos2);
-
-       //ScreenToClient(&mousepos2);
-
-       //POINT mousepos;
-       //GetCursorPos(&mousepos);
-
-  DWORD dwTicks = GetTickCount();
-       // If not paused need to consider stop on idle
-       if( !m_pDasherInterface->GetBoolParameter(BP_DASHER_PAUSED)  ) 
-       {
-         // TODO: Pause on idle needs to be moved into the core
-
-               // only pause if button is not down
-               if( !m_bButtonDown && m_pDasherInterface->GetBoolParameter(BP_STOP_IDLE)  ) 
-               {
-      // TODO: Brink this back into core
-                       if (dwTicks - m_dwTicksLastEvent > 
m_pDasherInterface->GetLongParameter(LP_STOP_IDLETIME) )
-                       {
-                               // idle time exceeded, so pause (no stop actions)
-                               m_pDasherInterface->SetBoolParameter(BP_DASHER_PAUSED, true);
-                       }
-               }
-       }
-#endif
-}
-
-// void CCanvas::centrecursor() {
-//   POINT mousepos;
-//   mousepos.x = m_pScreen->GetWidth() / 2;
-
-//   mousepos.y = m_pScreen->GetHeight() / 2;
-
-//   ClientToScreen( &mousepos);
-
-//   SetCursorPos(mousepos.x, mousepos.y);
-
-// };
-
-// void CCanvas::MousePosStart(bool Value) {
-//   if(Value == false) {
-//     firstwindow = false;
-//     secondwindow = false;
-//   }
-// }
-
-/////////////////////////////////////////////////////////////////////////////
-
-// void CCanvas::StartStop() {
-
-//   if(running == 0) {
-//     SetCapture();
-//     running = 1;
-//     m_pDasherInterface->Unpause(GetTickCount());
-//     firstwindow = false;
-//     secondwindow = false;
-//     mousepostime = 0;
-
-//   }
-//   else {
-//     m_pDasherInterface->PauseAt(0, 0);
-//     running = 0;
-// //              if (speakonstop==true) { // FIXME - reimplement this
-// //                      m_DasherEditBox->speak(2);
-// //              }
-//     ReleaseCapture();
-//   }
-// }
-
 /////////////////////////////////////////////////////////////////////////////
 
 // Gets the size of the canvas in screen coordinates.  Need if we
diff --git a/Src/Win32/Widgets/Canvas.h b/Src/Win32/Widgets/Canvas.h
index 4f07406..09624b3 100644
--- a/Src/Win32/Widgets/Canvas.h
+++ b/Src/Win32/Widgets/Canvas.h
@@ -21,13 +21,6 @@
 #ifndef __Canvas_h__
 #define __Canvas_h__
 
-// XXX why lie? #define _WIN32_WINNT 0x0501
-
-// aiming for _WIN32_WINNT < 0x501 => HAVE_NO_THEME
-#ifdef _WIN32_WCE
-#define HAVE_NO_THEME
-#endif
-
 #include <windows.h>
 #include <winuser.h>
 #ifndef HAVE_NO_THEME
@@ -35,10 +28,7 @@
 #define WM_THEMECHANGED                 0x031A
 #endif
 
-#ifndef _WIN32_WCE
 #include "../TabletPC/CursorInRange.h"
-#endif 
-
 #include "../../DasherCore/DasherTypes.h"
 #include "../KeyboardHelper.h"
 
@@ -55,19 +45,11 @@ class CScreen;
 class CCanvas : public ATL::CWindowImpl<CCanvas> {
  public:
   static ATL::CWndClassInfo& GetWndClassInfo() { 
-#ifndef _WIN32_WCE
     static ATL::CWndClassInfo wc = {
       { sizeof(WNDCLASSEX), CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, StartWindowProc,
        0, 0, NULL, NULL, NULL, NULL, NULL, _T("CANVAS"), NULL },
       NULL, NULL, MAKEINTRESOURCE(IDC_CROSS), TRUE, 0, _T("") 
     };
-#else
-  static ATL::CWndClassInfo wc = {
-      {CS_HREDRAW | CS_VREDRAW | CS_DBLCLKS, StartWindowProc,
-       0, 0, NULL, NULL, NULL, NULL, NULL, _T("CANVAS") },
-      NULL, NULL, MAKEINTRESOURCE(IDC_CROSS), TRUE, 0, _T("") 
-    };
-#endif
     return wc;
   }
   
@@ -83,13 +65,8 @@ class CCanvas : public ATL::CWindowImpl<CCanvas> {
     MESSAGE_HANDLER(WM_LBUTTONDBLCLK, OnLButtonDblClk)
     MESSAGE_HANDLER(WM_LBUTTONDOWN, OnLButtonDown)
     MESSAGE_HANDLER(WM_LBUTTONUP, OnLButtonUp)
-#ifndef _WIN32_WCE
     MESSAGE_HANDLER(WM_CURSOR_IN_RANGE, OnCursorInRange)
     MESSAGE_HANDLER(WM_CURSOR_OUT_OF_RANGE, OnCursorOutOfRange)
-#endif
-    MESSAGE_HANDLER(WM_RBUTTONDOWN, OnRButtonDown)
-    MESSAGE_HANDLER(WM_RBUTTONUP, OnRButtonUp)
-    MESSAGE_HANDLER(WM_MOUSEMOVE, OnMouseMove)
     MESSAGE_HANDLER(WM_SIZE, OnSize)
 #ifndef HAVE_NO_THEME
     MESSAGE_HANDLER(WM_THEMECHANGED , OnThemeChanged)
@@ -101,19 +78,12 @@ class CCanvas : public ATL::CWindowImpl<CCanvas> {
 
   HWND Create(HWND hParent);
   
-  void DoFrame();
-  
   LRESULT OnSize(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 #ifndef HAVE_NO_THEME
   LRESULT OnThemeChanged(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 #endif
-  LRESULT OnMouseMove(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-  LRESULT OnRButtonUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-  LRESULT OnRButtonDown(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-#ifndef _WIN32_WCE
   LRESULT OnCursorInRange(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnCursorOutOfRange(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-#endif
   LRESULT OnLButtonDblClk(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnLButtonDown(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
   LRESULT OnLButtonUp(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@@ -132,50 +102,6 @@ class CCanvas : public ATL::CWindowImpl<CCanvas> {
   HWND getwindow() {
     return m_hWnd;
   } 
-/*   void StartOnLeftClick(bool Value) { */
-/*     startonleft = Value; */
-/*   } */
-
-
-  //  void MousePosStart(bool Value);
-
-/*   void setkeycoords(int coords[18]) { */
-/*     for(int i = 0; i < 18; i++) { */
-/*       keycoords[i] = coords[i]; */
-/*     }; */
-/*   } */
-/*   int *getkeycoords() { */
-/*     return keycoords; */
-/*   } */
-
-/*   void setforward(bool value) { */
-/*     forward = value; */
-/*   } */
-/*   void setbackward(bool value) { */
-/*     backward = value; */
-/*   } */
-/*   void setselect(bool value) { */
-/*     select = value; */
-/*   } */
-/*   bool getforward() { */
-/*     return forward; */
-/*   } */
-/*   bool getbackward() { */
-/*     return backward; */
-/*   } */
-/*   bool getselect() { */
-/*     return select; */
-/*   } */
- 
-//  void centrecursor();
-  //  void StartStop();
-
-/*   void Pause() { */
-/*     running = 0; */
-/*   } */
-/*   bool Running() { */
-/*     return running; */
-/*   } */
   
   int OnTimer();
 
@@ -186,8 +112,6 @@ class CCanvas : public ATL::CWindowImpl<CCanvas> {
 private:
 
   HDC m_hdc;
-  //  int keycoords[18], buttonnum, yscaling;
-  // bool forward, backward, select;
 
   CScreen *m_pScreen;
   Dasher::CDasher * m_pDasherInterface;
@@ -196,39 +120,8 @@ private:
   HTHEME m_hTheme;
 #endif
 
-  // Input devices:
-
-  //Dasher::CDasherMouseInput * m_pMouseInput;
-  //Dasher::CSocketInput * m_pSocketInput;
-
-  // TODO: A lot, if not all, of these variables are obsolete
-
-  //Dasher::screenint imousex, imousey;
-  UINT MY_TIMER;
-  //bool startonleft;
-  //  bool direction;
-  //  bool running;
-  //bool firstwindow;
-  //bool secondwindow;
-  //bool lbuttonheld;
-  //bool inturbo;
-  //bool enabletime;
-  //DWORD startturbo;
-  //DWORD endturbo;
-  //DWORD lastlbutton;
-  //DWORD mousepostime;
-  //  DWORD previoustime;
-  //RECT coords;
-
-  // Indicates that a button is depressed, so we dont stop on idle
-  bool m_bButtonDown;
-  // Ticks as last event, for stop on idle
-  DWORD m_dwTicksLastEvent;
-
-#ifndef _WIN32_WCE
   // Enables tablet pc events
   CCursorInRange m_CursorInRange;
-#endif
 
   CKeyboardHelper *m_pKeyboardHelper;
 
diff --git a/Src/Win32/Widgets/ControlPage.cpp b/Src/Win32/Widgets/ControlPage.cpp
index 7ed3157..bf6da83 100644
--- a/Src/Win32/Widgets/ControlPage.cpp
+++ b/Src/Win32/Widgets/ControlPage.cpp
@@ -34,7 +34,6 @@ struct menuentry {
 static menuentry menutable[] = {
   {BP_START_MOUSE, IDC_LEFT},
   {BP_START_SPACE, IDC_SPACE},
-  {BP_STOP_IDLE, IDC_STOPIDLE},
   {BP_STOP_OUTSIDE, IDC_WINDOWPAUSE},
   {BP_AUTO_SPEEDCONTROL, IDC_AUTOSPEED},
   {BP_AUTOCALIBRATE, IDC_AUTOCALIBRATE}
@@ -92,14 +91,6 @@ void CControlPage::PopulateList() {
     }
   }
 
-  // enable idletime control if button checked
-  BOOL bIdle =  m_pAppSettings->GetBoolParameter(BP_STOP_IDLE) ? TRUE : FALSE;
-  EnableWindow( GetDlgItem(m_hwnd, IDC_IDLETIME), bIdle);
-  EnableWindow( GetDlgItem(m_hwnd, IDC_STATICIDLETIME), bIdle);
-                       
-  // Set the idle time data
-  SetDlgItemInt ( m_hwnd, IDC_IDLETIME, m_pAppSettings->GetLongParameter( LP_STOP_IDLETIME) , TRUE);
-
   // List entries:
 
   for(int i(0); i<sizeof(listtable)/sizeof(menuentry); ++i) {
@@ -162,16 +153,6 @@ void CControlPage::PopulateList() {
 
 bool CControlPage::Apply() 
 {
-
-       int iIdle;
-       bool bSuccess = wincommon::GetWindowInt( GetDlgItem(m_hwnd, IDC_IDLETIME) , iIdle);
-       if (bSuccess)
-               m_pAppSettings->SetLongParameter( LP_STOP_IDLETIME, iIdle);
-       else
-       {
-               return FALSE; // TODO notify user
-       }
-
   int NewSpeed = SendMessage(SB_slider, TBM_GETPOS, 0, 0);
   m_pAppSettings->SetLongParameter( LP_MAX_BITRATE, NewSpeed);
 
@@ -320,13 +301,6 @@ LRESULT CControlPage::WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM l
         }
       }
                  break;
-               case IDC_STOPIDLE:
-                       // set activity of the idle time edit control
-                       BOOL bChecked =  SendMessage(GetDlgItem(m_hwnd, IDC_STOPIDLE), BM_GETCHECK, 0, 0) == 
BST_CHECKED;
-                       EnableWindow( GetDlgItem(m_hwnd, IDC_IDLETIME), bChecked);
-                       EnableWindow( GetDlgItem(m_hwnd, IDC_STATICIDLETIME), bChecked);
-                        // don't return: also want to pass event on to superclass to trigger Apply activation
-                       break;
                }
                break;
        case WM_HSCROLL:
diff --git a/Src/Win32/resource.h b/Src/Win32/resource.h
index d271233..dde5700 100644
--- a/Src/Win32/resource.h
+++ b/Src/Win32/resource.h
@@ -47,13 +47,11 @@
 #define IDC_COPYONSTOP                  1020
 #define IDC_SPACE                       1036
 #define IDC_UNIFORMVAL                  1040
-#define IDC_IDLETIME                    1040
 #define IDC_CHECK3                      1071
 #define IDC_LEFT                        1071
 #define IDC_WINDOWPAUSE                 1088
 #define IDC_MOUSEPOS                    1089
 #define IDC_OUTLINE                     1091
-#define IDC_STOPIDLE                    1091
 #define IDC_TIMESTAMP                   1092
 #define IDC_CONFIRM_UNSAVED             1093
 #define IDC_DRAWMOUSE                   1094
@@ -72,7 +70,6 @@
 #define IDC_AUTOSPEED                   1119
 #define IDC_SPEEDSLIDER                 1120
 #define IDC_SPEEDVAL                    1121
-#define IDC_STATICIDLETIME              1122
 #define IDC_STYLE_STANDALONE            1122
 #define IDC_STYLE_COMPOSITION           1123
 #define IDC_STYLE_DIRECT                1124


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