[dasher: 125/217] Cleanup in boolean parameters



commit 5d1c86a868622cf38eaad4247f03a6094a0b98ed
Author: ipomoena <amajorek google com>
Date:   Mon Nov 16 14:08:57 2015 -0800

    Cleanup in boolean parameters

 .../LanguageModelling/WordLanguageModel.cpp        |   46 ++------------------
 Src/DasherCore/Parameters.cpp                      |    4 --
 Src/DasherCore/Parameters.h                        |    7 +--
 Src/Win32/Widgets/Canvas.cpp                       |   37 ----------------
 4 files changed, 7 insertions(+), 87 deletions(-)
---
diff --git a/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp 
b/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
index 5a5207f..9baa5f4 100644
--- a/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
+++ b/Src/DasherCore/LanguageModelling/WordLanguageModel.cpp
@@ -147,38 +147,6 @@ CWordLanguageModel::CWordLanguageModel(CSettingsUser *pCreator,
 
   nextid = iWordStart;          // Start of indices for words - may need to increase this for *really* large 
alphabets
 
-
-  if(GetBoolParameter(BP_LM_DICTIONARY)) {
-
-    std::ifstream DictFile("/usr/share/dict/words");    // FIXME - hardcoded paths == bad
-
-    std::string CurrentWord;
-
-    while(!DictFile.eof()) {
-      DictFile >> CurrentWord;
-
-      CurrentWord = CurrentWord + " ";
-
-      //      std::cout << CurrentWord << std::endl;
-
-      CPPMLanguageModel::Context TempContext(pSpellingModel->CreateEmptyContext());
-
-      //      std::cout << m_pAlphabet << std::endl;
-
-      std::vector < symbol > Symbols;
-      m_pAlphMap->GetSymbols(Symbols, CurrentWord);
-
-      for(std::vector < symbol >::iterator it(Symbols.begin()); it != Symbols.end(); ++it) {
-        pSpellingModel->LearnSymbol(TempContext, *it);
-      }
-
-      pSpellingModel->ReleaseContext(TempContext);
-    }
-
-  }
-
-  //  oSpellingContext = pSpellingModel->CreateEmptyContext();
-
   wordidx = 0;
 
 }
@@ -465,21 +433,15 @@ void CWordLanguageModel::CollapseContext(CWordLanguageModel::CWordContext &conte
 
     // Collapse down word part regardless of whether we're learning or not
 
-    int oldnextid(nextid);
-
     int iNewSymbol(lookup_word(context.current_word));
 
     // Insert into the spelling model if this is a new word
 
-    if((nextid > oldnextid) || (GetBoolParameter(BP_LM_LETTER_EXCLUSION))) {
-      //
-      context.m_pSpellingModel->ReleaseContext(context.oSpellingContext);
-      context.oSpellingContext = context.m_pSpellingModel->CreateEmptyContext();
-
-      for(std::vector < int >::iterator it(oSymbols.begin()); it != oSymbols.end(); ++it) {
-        context.m_pSpellingModel->LearnSymbol(context.oSpellingContext, *it);
-      }
+    context.m_pSpellingModel->ReleaseContext(context.oSpellingContext);
+    context.oSpellingContext = context.m_pSpellingModel->CreateEmptyContext();
 
+    for (std::vector < int >::iterator it(oSymbols.begin()); it != oSymbols.end(); ++it) {
+      context.m_pSpellingModel->LearnSymbol(context.oSpellingContext, *it);
     }
 
     CWordnode *pTmp(context.word_head);
diff --git a/Src/DasherCore/Parameters.cpp b/Src/DasherCore/Parameters.cpp
index 643b4d3..d639239 100644
--- a/Src/DasherCore/Parameters.cpp
+++ b/Src/DasherCore/Parameters.cpp
@@ -12,18 +12,14 @@ const bp_table boolparamtable[] = {
   {BP_START_MOUSE, "StartOnLeft", true, "StartOnLeft"},
   {BP_START_SPACE, "StartOnSpace", false, "StartOnSpace"},
   {BP_CONTROL_MODE, "ControlMode", false, "ControlMode"},
-  {BP_COLOUR_MODE, "ColourMode", true, "ColourMode"},
   {BP_MOUSEPOS_MODE, "StartOnMousePosition", false, "StartOnMousePosition"},
   {BP_PALETTE_CHANGE, "PaletteChange", true, "PaletteChange"},
   {BP_TURBO_MODE, "TurboMode", true, "Boost speed when holding key1 or right mouse button"},
   {BP_EXACT_DYNAMICS, "ExactDynamics", false, "Use exact computation of per-frame movement (slower)"},
   {BP_AUTOCALIBRATE, "Autocalibrate", false, "Automatically learn TargetOffset e.g. gazetracking"},
   {BP_REMAP_XTREME, "RemapXtreme", false, "Pointer at extreme Y translates more and zooms less"},
-  {BP_LM_DICTIONARY, "Dictionary", true, "Whether the word-based language model uses a dictionary"},
-  {BP_LM_LETTER_EXCLUSION, "LetterExclusion", true, "Whether to do letter exclusion in the word-based 
model"},
   {BP_AUTO_SPEEDCONTROL, "AutoSpeedControl", true, "AutoSpeedControl"},
   {BP_LM_ADAPTIVE, "LMAdaptive", true, "Whether language model should learn as you enter text"},
-  {BP_SOCKET_INPUT_ENABLE, "SocketInputEnable", false, "Read pointer coordinates from network socket instead 
of mouse"},
   {BP_SOCKET_DEBUG, "SocketInputDebug", false, "Print information about socket input processing to console"},
   {BP_CIRCLE_START, "CircleStart", false, "Start on circle mode"},
   {BP_GLOBAL_KEYBOARD, "GlobalKeyboard", false, "Whether to assume global control of the keyboard"},
diff --git a/Src/DasherCore/Parameters.h b/Src/DasherCore/Parameters.h
index c11024a..6516920 100644
--- a/Src/DasherCore/Parameters.h
+++ b/Src/DasherCore/Parameters.h
@@ -31,12 +31,11 @@ enum {
   BP_DRAW_MOUSE_LINE, BP_DRAW_MOUSE, BP_CURVE_MOUSE_LINE,
   BP_START_MOUSE,
   BP_START_SPACE, BP_CONTROL_MODE, 
-  BP_COLOUR_MODE, BP_MOUSEPOS_MODE,
+  BP_MOUSEPOS_MODE,
   BP_PALETTE_CHANGE, BP_TURBO_MODE, BP_EXACT_DYNAMICS,
   BP_AUTOCALIBRATE, BP_REMAP_XTREME,
-  BP_LM_DICTIONARY, 
-  BP_LM_LETTER_EXCLUSION, BP_AUTO_SPEEDCONTROL,
-  BP_LM_ADAPTIVE, BP_SOCKET_INPUT_ENABLE, BP_SOCKET_DEBUG, 
+  BP_AUTO_SPEEDCONTROL,
+  BP_LM_ADAPTIVE, BP_SOCKET_DEBUG, 
   BP_CIRCLE_START, BP_GLOBAL_KEYBOARD, BP_NONLINEAR_Y,
   BP_STOP_OUTSIDE, BP_BACKOFF_BUTTON,
   BP_TWOBUTTON_REVERSE, BP_2B_INVERT_DOUBLE, BP_SLOW_START,
diff --git a/Src/Win32/Widgets/Canvas.cpp b/Src/Win32/Widgets/Canvas.cpp
index 524f23e..3fe0497 100644
--- a/Src/Win32/Widgets/Canvas.cpp
+++ b/Src/Win32/Widgets/Canvas.cpp
@@ -61,26 +61,6 @@ HWND CCanvas::Create(HWND hParent) {
 
   // TODO: Check out whether any of this needs to be reimplemented
 
-  // Create input device objects
-  // NB We create the SocketInput object now, even if socket input is not enabled, because
-  // we can't safely create it later in response to a parameter change event (because it itself
-  // needs to register an event listener when it constructs itself).
- 
-
-  // m_pSocketInput = (CSocketInput *)m_pDasherInterface->GetModule(1);
-  // m_pSocketInput->Ref();
-
-  // m_pMouseInput = (CDasherMouseInput *)m_pDasherInterface->GetModule(0); 
-  // m_pMouseInput->Ref();
-  
-  // if(m_pDasherInterface->GetBoolParameter(BP_SOCKET_INPUT_ENABLE)) {
-  //   m_pSocketInput->StartListening();
-  //   m_pDasherInterface->SetInput(1);
-  // }
-  // else {
-  //  m_pDasherInterface->SetInput(0);
-  // }
-
   // TODO: Is this better placed in CDasher?
   m_pKeyboardHelper = new CKeyboardHelper;
 
@@ -444,21 +424,4 @@ bool CCanvas::GetCanvasSize(int& iTop, int& iLeft, int& iBottom, int& iRight) {
 
 void CCanvas::SetFont(const std::string &strFont) {
     m_pScreen->SetFont(strFont);
-  /*  case BP_SOCKET_INPUT_ENABLE:
-      OutputDebugString(TEXT("Processing BP_SOCKET_INPUT_ENABLE change\n"));
-      if(GetBoolParameter(BP_SOCKET_INPUT_ENABLE)) {
-        if(!m_pSocketInput->isListening()) {
-               m_pSocketInput->StartListening();
-        } 
-        m_pDasherInterface->SetInput(1);
-      } 
-      else {
-        if(m_pSocketInput != NULL) {
-               m_pSocketInput->StopListening();
-        }
-        m_pDasherInterface->SetInput(0);
-      }
-      break;
-    }
-  }*/
 }


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