[dasher] whitespace



commit 4dc1f2c3923e94ddee1d309766b7e2d67d50cee9
Author: Patrick Welche <prlw1 cam ac uk>
Date:   Sun Apr 10 10:55:34 2011 +0200

    whitespace

 Src/DasherCore/ActionButton.h            |    4 +-
 Src/DasherCore/Alphabet/AlphIO.cpp       |   20 ++--
 Src/DasherCore/Alphabet/AlphIO.h         |   18 ++--
 Src/DasherCore/Alphabet/AlphInfo.h       |   62 ++++++------
 Src/DasherCore/AlphabetManager.cpp       |   66 +++++++-------
 Src/DasherCore/AlphabetManager.h         |   22 ++--
 Src/DasherCore/AlternatingDirectMode.h   |    8 +-
 Src/DasherCore/AutoSpeedControl.cpp      |   52 +++++-----
 Src/DasherCore/ButtonMode.cpp            |   18 ++--
 Src/DasherCore/ButtonMultiPress.cpp      |    4 +-
 Src/DasherCore/ButtonMultiPress.h        |    4 +-
 Src/DasherCore/CannaConversionHelper.cpp |    4 +-
 Src/DasherCore/CircleStartHandler.cpp    |   14 ++--
 Src/DasherCore/ClickFilter.cpp           |    2 +-
 Src/DasherCore/ClickFilter.h             |    2 +-
 Src/DasherCore/ColourIO.cpp              |    2 +-
 Src/DasherCore/CompassMode.cpp           |   16 ++--
 Src/DasherCore/CompassMode.h             |    8 +-
 Src/DasherCore/ControlManager.cpp        |   98 ++++++++++----------
 Src/DasherCore/ControlManager.h          |   58 ++++++------
 Src/DasherCore/ConversionHelper.cpp      |   14 ++--
 Src/DasherCore/ConversionHelper.h        |   50 +++++-----
 Src/DasherCore/ConversionManager.h       |   36 ++++----
 Src/DasherCore/DasherInterfaceBase.cpp   |   16 ++--
 Src/DasherCore/DasherInterfaceBase.h     |   76 ++++++++--------
 Src/DasherCore/DasherModel.cpp           |   86 +++++++++---------
 Src/DasherCore/DasherModel.h             |   42 ++++----
 Src/DasherCore/DasherNode.cpp            |   20 ++--
 Src/DasherCore/DasherNode.h              |   36 ++++----
 Src/DasherCore/DasherViewSquare.cpp      |  148 +++++++++++++++---------------
 Src/DasherCore/DasherViewSquare.h        |   38 ++++----
 Src/DasherCore/DefaultFilter.cpp         |   38 ++++----
 Src/DasherCore/DynamicFilter.h           |   10 +-
 Src/DasherCore/OneDimensionalFilter.cpp  |    2 +-
 Src/Gtk2/DasherAppSettings.cpp           |    2 +-
 Src/Gtk2/dasher_main.cpp                 |    2 +-
 36 files changed, 549 insertions(+), 549 deletions(-)
---
diff --git a/Src/DasherCore/ActionButton.h b/Src/DasherCore/ActionButton.h
index 76bd3b6..f0837a5 100644
--- a/Src/DasherCore/ActionButton.h
+++ b/Src/DasherCore/ActionButton.h
@@ -20,12 +20,12 @@ class CActionButton {
   bool HandleClickDown(int iTime, int iX, int iY, bool bVisible);
   bool HandleClickUp(int iTime, int iX, int iY, bool bVisible);
   void Execute(int iTime);
-  
+
  private:
   std::string m_strCommand;
 
   bool m_bAlwaysVisible;
-  
+
   int m_iX;
   int m_iY;
   int m_iWidth;
diff --git a/Src/DasherCore/Alphabet/AlphIO.cpp b/Src/DasherCore/Alphabet/AlphIO.cpp
index 17462e6..9f360d4 100644
--- a/Src/DasherCore/Alphabet/AlphIO.cpp
+++ b/Src/DasherCore/Alphabet/AlphIO.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "AlphIO.h"
@@ -237,7 +237,7 @@ void CAlphIO::Save(const std::string &AlphID) {
 
     //TODO presumably should write out characters & groups at some point?!
     // In which case, must exclude para/space, as these written out here:
-    
+
     // Write out the space character
     if (Info.iSpaceCharacter!=0) {
       CAlphInfo::character &spC(Info.m_vCharacters[Info.iSpaceCharacter]);
@@ -347,7 +347,7 @@ CAlphInfo *CAlphIO::CreateDefault() {
   // ---
   Default.m_pBaseGroup = 0;
   Default.Orientation = Opts::LeftToRight;
-  
+
   //The following creates Chars.size()+2 actual character structs in the vector,
   // all initially blank. The extra 2 are for paragraph and space.
   Default.m_vCharacters.resize(Chars.size()+2);
@@ -368,12 +368,12 @@ CAlphInfo *CAlphIO::CreateDefault() {
   Default.m_vCharacters[Chars.size()].Text = "\n";
 #endif
   Default.m_vCharacters[Chars.size()].Colour = 9;
-  
+
   Default.iSpaceCharacter = Chars.size()+2;
   Default.m_vCharacters[Chars.size()+1].Display = "_";
   Default.m_vCharacters[Chars.size()+1].Text = " ";
   Default.m_vCharacters[Chars.size()+1].Colour = 9;
-  
+
   Default.ControlCharacter = new CAlphInfo::character();
   Default.ControlCharacter->Display = "Control";
   Default.ControlCharacter->Text = "";
@@ -506,7 +506,7 @@ void CAlphIO::XML_StartElement(void *userData, const XML_Char *name, const XML_C
   if(strcmp(name, "group") == 0) {
     SGroupInfo *pNewGroup(new SGroupInfo);
     pNewGroup->iNumChildNodes=0;
-    pNewGroup->iColour = (Me->iGroupIdx % 3) + 110; 
+    pNewGroup->iColour = (Me->iGroupIdx % 3) + 110;
     ++Me->iGroupIdx;
     if (Me->m_vGroups.empty()) Me->InputInfo->iNumChildNodes++; else Me->m_vGroups.back()->iNumChildNodes++;
 
@@ -613,7 +613,7 @@ void CAlphIO::XML_StartElement(void *userData, const XML_Char *name, const XML_C
     if (Me->m_vGroups.empty()) Me->InputInfo->iNumChildNodes++; else Me->m_vGroups.back()->iNumChildNodes++;
     Me->InputInfo->m_vCharacters.resize(Me->InputInfo->m_vCharacters.size()+1);
     CAlphInfo::character &Ch(Me->InputInfo->m_vCharacters.back());
-    
+
     // FIXME - need to do a more sensible job of ensuring that
     // defaults are correct (plus more generally fixing behaviour when
     // incomplete/invalid XML is supplied)
@@ -633,7 +633,7 @@ void CAlphIO::ReadCharAtts(const XML_Char **atts, CAlphInfo::character &ch) {
 }
 
 void Reverse(SGroupInfo *&pList) {
-  SGroupInfo *pFirst = pList;  
+  SGroupInfo *pFirst = pList;
   SGroupInfo *pPrev = NULL;
   while (pFirst) {
     SGroupInfo *pNext = pFirst->pNext;
@@ -649,7 +649,7 @@ void CAlphIO::XML_EndElement(void *userData, const XML_Char *name) {
 
   if(strcmp(name, "alphabet") == 0) {
     Reverse(Me->InputInfo->m_pBaseGroup);
-    
+
     if (Me->ParagraphCharacter) {
       Me->InputInfo->iParagraphCharacter = Me->InputInfo->m_vCharacters.size()+1;
       Me->InputInfo->m_vCharacters.push_back(*(Me->ParagraphCharacter));
@@ -662,7 +662,7 @@ void CAlphIO::XML_EndElement(void *userData, const XML_Char *name) {
       Me->InputInfo->iNumChildNodes++;
       delete Me->SpaceCharacter;
     }
-    
+
     //if (Me->InputInfo->StartConvertCharacter.Text != "") Me->InputInfo->iNumChildNodes++;
     //if (Me->InputInfo->EndConvertCharacter.Text != "") Me->InputInfo->iNumChildNodes++;
     Me->Alphabets[Me->InputInfo->AlphID] = Me->InputInfo;
diff --git a/Src/DasherCore/Alphabet/AlphIO.h b/Src/DasherCore/Alphabet/AlphIO.h
index 709f6bf..ac01426 100644
--- a/Src/DasherCore/Alphabet/AlphIO.h
+++ b/Src/DasherCore/Alphabet/AlphIO.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __AlphIO_h__
@@ -54,7 +54,7 @@ namespace Dasher {
 /// implemented...
 class Dasher::CAlphIO {
 public:
-  
+
   CAlphIO(std::string SystemLocation, std::string UserLocation, std::vector < std::string > &Filenames);
   ~CAlphIO();
   void GetAlphabets(std::vector < std::string > *AlphabetList) const;
@@ -69,31 +69,31 @@ private:
   std::string UserLocation;
   std::map < std::string, const CAlphInfo* > Alphabets; // map short names (file names) to descriptions. We own all the values but it's easier this way...
   std::vector < std::string > Filenames;
-  
+
   void Save(const std::string & AlphID);
   CAlphInfo *CreateDefault();         // Give the user an English alphabet rather than nothing if anything goes horribly wrong.
-  
+
   void DeleteAlphabet(CAlphInfo *Alphabet);
-  
+
   // XML handling:
   /////////////////////////
-  
+
   bool LoadMutable;
   void ParseFile(std::string Filename);
   void ReadCharAtts(const XML_Char **atts, CAlphInfo::character &ch);
   // Alphabet types:
   std::map < std::string, Opts::AlphabetTypes > StoT;
   std::map < Opts::AlphabetTypes, std::string > TtoS;
-  
+
   // & to &amp;  < to &lt; and > to &gt;  and if (Attribute) ' to &apos; and " to &quot;
   void XML_Escape(std::string * Text, bool Attribute);
-  
+
   // Data gathered
   std::string CData;            // Text gathered from when an elemnt starts to when it ends
   CAlphInfo *InputInfo;
   bool bFirstGroup;
   int iGroupIdx;
-  
+
   // Callback functions. These involve the normal dodgy casting to a pointer
   // to an instance to get a C++ class to work with a plain C library.
   static void XML_StartElement(void *userData, const XML_Char * name, const XML_Char ** atts);
diff --git a/Src/DasherCore/Alphabet/AlphInfo.h b/Src/DasherCore/Alphabet/AlphInfo.h
index 698baa4..03abd44 100644
--- a/Src/DasherCore/Alphabet/AlphInfo.h
+++ b/Src/DasherCore/Alphabet/AlphInfo.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __ALPHINFO_H__
@@ -37,7 +37,7 @@
 namespace Dasher {
   class CAlphInfo;
   class CAlphIO;
-} 
+}
 
 /// \ingroup Alphabet
 /// @{
@@ -64,53 +64,53 @@ private:
     std::string Text;
     int Colour;
     std::string Foreground;
-  };  
+  };
 public:
   /// Return number of text symbols - inc space and para, but no control/conversion start/end
   /// Note symbol numbers are 1-indexed; 0 is reserved to indicate an "unknown symbol" (-1 = End-Of-Stream),
   /// and for element 0 of the probability array to contain a 0.
   int GetNumberTextSymbols() const {return m_vCharacters.size();}
-  
-  Opts::ScreenOrientations GetOrientation() const {return Orientation;} 
-  
+
+  Opts::ScreenOrientations GetOrientation() const {return Orientation;}
+
   Opts::AlphabetTypes GetType() const {return Type;}
-  
+
   const std::string & GetTrainingFile() const {return TrainingFile;}
-  
+
   const std::string &GetGameModeFile() const {return GameModeFile;}
-  
+
   const std::string & GetPalette() const {return PreferredColours;}
-  
+
   symbol GetParagraphSymbol() const {return iParagraphCharacter;}
-  
+
   symbol GetSpaceSymbol() const {return iSpaceCharacter;}
-  
+
   //symbol GetStartConversionSymbol() const;
   //symbol GetEndConversionSymbol() const;
-  
+
   /// return display string for i'th symbol
   const std::string & GetDisplayText(symbol i) const {return m_vCharacters[i-1].Display;}
-  
+
   /// return text for edit box for i'th symbol
-  const std::string & GetText(symbol i) const {return m_vCharacters[i-1].Text;} 
-  
-  // return colour specified for i'th symbol, or -1 if nothing in the XML  
+  const std::string & GetText(symbol i) const {return m_vCharacters[i-1].Text;}
+
+  // return colour specified for i'th symbol, or -1 if nothing in the XML
   int GetColour(symbol i) const {
     return m_vCharacters[i-1].Colour;
   };
-  
+
   /// Text foreground colour for i'th symbol; default 4 if unspecified
   int GetTextColour(symbol i) const;
   /// Text foreground colour for i'th symbol, as specified in XML
   const std::string & GetForeground(symbol i) const {return m_vCharacters[i-1].Foreground;}
-    
+
   const std::string &GetDefaultContext() const {return m_strDefaultContext;}
-  
+
   ///A single unicode character to use as an escape sequence in training files
-  ///to indicate context-switching commands; 0-length => don't use context-switching commands. 
+  ///to indicate context-switching commands; 0-length => don't use context-switching commands.
   /// Defaults to § if not specified in alphabet.
   const std::string &GetContextEscapeChar() const {return m_strCtxChar;}
-  
+
   SGroupInfo *m_pBaseGroup;
   int iNumChildNodes;
   ///0 = normal alphabet, contains symbols to output
@@ -120,7 +120,7 @@ public:
   /// which contains actual output symbols possibly including duplicates;
   /// all this handled by MandarinAlphMgr (+MandarinTrainer, PPMPYLanguageModel).
   int m_iConversionID;
-  
+
   ///The name of the alphabet containing the actual text symbols into which
   /// this alphabet will be converted. Only used (atm) if m_iConversionID==2.
   std::string m_strConversionTarget;
@@ -128,17 +128,17 @@ public:
   ///Single-unicode character used to indicate an upcoming PY-then-CH pair
   /// in the training file (see MandarinTrainer). Only used if m_iConversionID==2.
   std::string m_strConversionTrainingDelimiter;
-  
+
   CAlphabetMap *MakeMap() const;
-  
+
   ~CAlphInfo();
-  
+
 private:
   CAlphInfo();
   // Basic information
   std::string AlphID;
   bool Mutable;               // If from user we may play. If from system defaults this is immutable. User should take a copy.
-  
+
   // Complete description of the alphabet:
   std::string TrainingFile;
   std::string GameModeFile;
@@ -146,20 +146,20 @@ private:
   Opts::AlphabetTypes Encoding;
   Opts::AlphabetTypes Type;
   Opts::ScreenOrientations Orientation;
-  
+
   ///If true, alphabet should not be displayed in list of available alphabets;
   /// it exists only for internal use, e.g. as a target for conversion from
   /// another alphabet (a la MandarinDasher).
   bool m_bHidden;
-  
+
   std::vector<character> m_vCharacters;
-  
+
   symbol iParagraphCharacter;       // symbol number (index into m_vCharacters +1) of paragraph char (for display and default edit-text), 0 for none.
   symbol iSpaceCharacter;   // symbol number (index into m_vCharacters +1) of space char (display and edit text), 0 for none.
   character *ControlCharacter; // display and edit text of Control character. Typically ("", "Control"). Use ("", "") if no control character.
   character *StartConvertCharacter;
   character *EndConvertCharacter;
-  
+
   std::string m_strDefaultContext;
   std::string m_strCtxChar;
 };
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 85b950d..dc1c72e 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -69,7 +69,7 @@ void CAlphabetManager::CreateLanguageModel(CEventHandler *pEventHandler, CSettin
   switch (m_pInterface->GetLongParameter(LP_LANGUAGE_MODEL_ID)) {
     default:
       // If there is a bogus value for the language model ID, we'll default
-      // to our trusty old PPM language model.      
+      // to our trusty old PPM language model.
     case 0:
       m_pLanguageModel = new CPPMLanguageModel(pEventHandler, pSettingsStore, m_pAlphabet->GetNumberTextSymbols());
       break;
@@ -78,7 +78,7 @@ void CAlphabetManager::CreateLanguageModel(CEventHandler *pEventHandler, CSettin
       break;
     case 3:
       m_pLanguageModel = new CMixtureLanguageModel(pEventHandler, pSettingsStore, m_pAlphabet, m_pAlphabetMap);
-      break;  
+      break;
     case 4:
       m_pLanguageModel = new CCTWLanguageModel(m_pAlphabet->GetNumberTextSymbols());
       break;
@@ -122,7 +122,7 @@ void CAlphabetManager::WriteTrainFileFull(CDasherInterfaceBase *pInterface) {
 
 int CAlphabetManager::GetColour(symbol sym, int iOffset) const {
   int iColour = m_pAlphabet->GetColour(sym);
-  
+
   // This is for backwards compatibility with old alphabet files -
   // ideally make this log a warning (unrelated TODO: automate
   // validation of alphabet files, plus maintenance of repository
@@ -135,11 +135,11 @@ int CAlphabetManager::GetColour(symbol sym, int iOffset) const {
       iColour = (sym % 3) + 10;
     }
   }
-  
+
   // Loop on low colours for nodes (TODO: go back to colour namespaces?)
   if((iOffset&1) == 0 && iColour < 130)
     iColour += 130;
-  
+
   return iColour;
 }
 
@@ -183,7 +183,7 @@ CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, uns
   int iNewOffset(max(-1,iOffset-1));
 
   pair<symbol, CLanguageModel::Context> p = GetContextSymbols(pParent, iNewOffset, m_pAlphabetMap);
-  
+
   CAlphNode *pNewNode;
   if(p.first==0 || !bEnteredLast) {
     //couldn't extract last symbol (so probably using default context), or shouldn't
@@ -210,7 +210,7 @@ pair<symbol, CLanguageModel::Context> CAlphabetManager::GetContextSymbols(CDashe
     } else {
       pAlphMap->GetSymbols(vContextSymbols, m_pInterface->GetContext(iStart, iRootOffset+1 - iStart));
     }
-  
+
     for (std::vector<symbol>::iterator it = vContextSymbols.end(); it!=vContextSymbols.begin();) {
       if (*(--it) == 0) {
         //found an impossible symbol! erase from beginning up to it (inclusive)
@@ -223,9 +223,9 @@ pair<symbol, CLanguageModel::Context> CAlphabetManager::GetContextSymbols(CDashe
     bHaveFinalSymbol = false;
     pAlphMap->GetSymbols(vContextSymbols, m_pAlphabet->GetDefaultContext());
   }
-  
+
   CLanguageModel::Context iContext = m_pLanguageModel->CreateEmptyContext();
-  
+
   //enter the symbols we could make sense of, into the LM context...
   for (vector<symbol>::iterator it=vContextSymbols.begin(); it != vContextSymbols.end(); it++) {
     m_pLanguageModel->EnterSymbol(iContext, *it);
@@ -277,31 +277,31 @@ int CAlphabetManager::CAlphNode::ExpectedNumChildren() {
 void CAlphabetManager::GetProbs(vector<unsigned int> *pProbInfo, CLanguageModel::Context context) {
   const unsigned int iSymbols = m_pAlphabet->GetNumberTextSymbols();
   unsigned long iNorm(m_pNCManager->GetLongParameter(LP_NORMALIZATION));
-  
+
   // TODO - sort out size of control node - for the timebeing I'll fix the control node at 5%
   // TODO: New method (see commented code) has been removed as it wasn' working.
-  
+
   const int iControlSpace = m_pNCManager->GetBoolParameter(BP_CONTROL_MODE) ? iNorm / 20 : 0;
-  
+
   iNorm -= iControlSpace;
-  
-  const unsigned long uniform(m_pNCManager->GetLongParameter(LP_UNIFORM)); 
+
+  const unsigned long uniform(m_pNCManager->GetLongParameter(LP_UNIFORM));
   //the case for control mode on, generalizes to handle control mode off also,
   // as then iNorm - control_space == iNorm...
   const unsigned int iUniformAdd = ((iNorm * uniform) / 1000) / iSymbols;
   const unsigned long iNonUniformNorm = iNorm - iSymbols * iUniformAdd;
   //  m_pLanguageModel->GetProbs(context, Probs, iNorm, ((iNorm * uniform) / 1000));
-  
+
   //ACL used to test explicitly for MandarinDasher and if so called GetPYProbs instead
   // (by statically casting to PPMPYLanguageModel). However, have renamed PPMPYLanguageModel::GetPYProbs
   // to GetProbs as per ordinary language model, so no need to test....
   m_pLanguageModel->GetProbs(context, *pProbInfo, iNonUniformNorm, 0);
-  
+
   DASHER_ASSERT(pProbInfo->size() == m_pAlphabet->GetNumberTextSymbols()+1);//initial 0
-  
+
   for(unsigned int k(1); k < pProbInfo->size(); ++k)
     (*pProbInfo)[k] += iUniformAdd;
-  
+
 #ifdef DEBUG
   {
     int iTotal = 0;
@@ -309,7 +309,7 @@ void CAlphabetManager::GetProbs(vector<unsigned int> *pProbInfo, CLanguageModel:
       iTotal += (*pProbInfo)[k];
     DASHER_ASSERT(iTotal == m_pNCManager->GetLongParameter(LP_NORMALIZATION) - iControlSpace);
   }
-#endif  
+#endif
 }
 
 std::vector<unsigned int> *CAlphabetManager::CAlphNode::GetProbInfo() {
@@ -346,7 +346,7 @@ CAlphabetManager::CGroupNode *CAlphabetManager::CreateGroupNode(CAlphNode *pPare
 
   // When creating a group node...
   // ...the offset is the same as the parent...
-  
+
   CGroupNode *pNewNode = new CGroupNode(pParent, pParent->offset(), iLbnd, iHbnd, strEnc, iBkgCol, this, pInfo);
 
   //...as is the context!
@@ -386,13 +386,13 @@ bool CAlphabetManager::CSymbolNode::isInGroup(const SGroupInfo *pInfo) {
 CDasherNode *CAlphabetManager::CreateSymbolNode(CAlphNode *pParent, unsigned int iLbnd, unsigned int iHbnd, const std::string &strGroup, int iBkgCol, symbol iSymbol) {
 
     // TODO: Exceptions / error handling in general
-    
+
     // Uniquely, a paragraph symbol can be two characters
     // (and we can't call numChars() on the symbol before we've constructed it!)
     int iNewOffset = pParent->offset()+1;
     if (m_pAlphabet->GetText(iSymbol)=="\r\n") iNewOffset++;
     CSymbolNode *pAlphNode = new CSymbolNode(pParent, iNewOffset, iLbnd, iHbnd, "", this, iSymbol);
-  
+
     //     std::stringstream ssLabel;
 
     //     ssLabel << m_pAlphabet->GetDisplayText(iSymbol) << ": " << pNewNode;
@@ -425,12 +425,12 @@ void CAlphabetManager::IterateChildGroups(CAlphNode *pParent, const SGroupInfo *
   const int iMin(pParentGroup ? pParentGroup->iStart : 1);
   const int iMax(pParentGroup ? pParentGroup->iEnd : m_pAlphabet->GetNumberTextSymbols()+1);
   unsigned int iRange(pParentGroup ? ((*pCProb)[iMax-1] - (*pCProb)[iMin-1]) : m_pNCManager->GetLongParameter(LP_NORMALIZATION));
-  
+
   // TODO: Think through alphabet file formats etc. to make this class easier.
   // TODO: Throw a warning if parent node already has children
-  
+
   // Create child nodes and add them
-  
+
   int i(iMin); //lowest index of child which we haven't yet added
   const SGroupInfo *pCurrentNode(pParentGroup ? pParentGroup->pChild : m_pAlphabet->m_pBaseGroup);
   // The SGroupInfo structure has something like linked list behaviour
@@ -469,7 +469,7 @@ void CAlphabetManager::IterateChildGroups(CAlphNode *pParent, const SGroupInfo *
       // creation/destruction of the child would cause the node's colour to flash
       // between that for parent group and child.
       // Hence, instead we elide the group node and create the child _here_...
-      
+
       //1. however we also have to take account of the appearance of the elided group. Hence:
       groupPrefix += pInner->strLabel;
       if (pInner->bVisible) iBackgroundColour=pInner->iColour;
@@ -531,7 +531,7 @@ void CAlphabetManager::CSymbolNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
     if (m_pMgr->m_pLastOutput != Parent()) {
       //Context changed. Flush to disk the old context + text written in it...
       m_pMgr->WriteTrainFileFull(m_pMgr->m_pInterface);
-      
+
       ///Now extract the context in which this node was written.
       /// Since this node is being output now, its parent must already have been,
       /// so the simplest thing is to read from the edit buffer!
@@ -578,13 +578,13 @@ void CAlphabetManager::CSymbolNode::Undo(int *pNumDeleted) {
 }
 
 CDasherNode *CAlphabetManager::CGroupNode::RebuildParent() {
-  
+
   if (Parent()) return Parent();
-  
+
   // CGroupNodes with an m_pGroup have a container i.e. the parent group, unless
   // m_pGroup==NULL => "root" node where Alphabet->m_pBaseGroup is the *first*child*...
   if (m_pGroup == NULL) return NULL;
-    
+
   return CAlphBase::RebuildParent();
 }
 
@@ -594,9 +594,9 @@ CDasherNode *CAlphabetManager::CAlphBase::RebuildParent() {
     int iNewOffset = offset()-numChars();
 
     CAlphNode *pNewNode = m_pMgr->GetRoot(NULL, 0, 0, iNewOffset!=-1, iNewOffset+1);
-    
+
     RebuildForwardsFromAncestor(pNewNode);
-    
+
     if (int flags=(GetFlag(NF_SEEN) ? NF_SEEN : 0) | (GetFlag(NF_COMMITTED) ? NF_COMMITTED : 0)) {
       for (CDasherNode *pNode=this; (pNode=pNode->Parent()); pNode->SetFlag(flags, true));
     }
@@ -618,7 +618,7 @@ void CAlphabetManager::CSymbolNode::SetFlag(int iFlag, bool bValue) {
     if (Parent()) {
       if (Parent()->mgr() != mgr()) return; //do not set flag
       CLanguageModel *pLM(m_pMgr->m_pLanguageModel);
-      // (Note: for first symbol after startup: parent is (root) group node, which'll have the alphabet default context) 
+      // (Note: for first symbol after startup: parent is (root) group node, which'll have the alphabet default context)
       CLanguageModel::Context ctx = pLM->CloneContext(static_cast<CAlphabetManager::CAlphNode *>(Parent())->iContext);
       pLM->LearnSymbol(ctx, iSymbol);
       //could: pLM->ReleaseContext(ctx);
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index 459d996..1b95573 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __alphabetmanager_h__
@@ -35,7 +35,7 @@ struct SGroupInfo;
 namespace Dasher {
 
   class CDasherInterfaceBase;
-  
+
   /// \ingroup Model
   /// @{
 
@@ -84,7 +84,7 @@ namespace Dasher {
       /// Default implementation calls the manager's CreateGroupNode method to create a new node,
       /// but then populates that group (i.e. further descends the hierarchy) _if_ that group
       /// would contain this node (see IsInGroup). Subclasses can override to graft themselves into the hierarchy, if appropriate.
-      /// \param pParent parent of the symbol node to create; could be the previous root, or an intervening node (e.g. group)      
+      /// \param pParent parent of the symbol node to create; could be the previous root, or an intervening node (e.g. group)
       virtual CDasherNode *RebuildGroup(CAlphNode *pParent, unsigned int iLbnd, unsigned int iHbnd, const std::string &strEnc, int iBkgCol, const SGroupInfo *pInfo);
       ///Just keep track of the last node output (for training file purposes)
       void Undo(int *pNumDeleted);
@@ -115,7 +115,7 @@ namespace Dasher {
       CLanguageModel::Context iContext;
       ///
       /// Delete any storage alocated for this node
-      ///      
+      ///
       virtual ~CAlphNode();
       virtual CLanguageModel::Context CloneAlphContext(CLanguageModel *pLanguageModel);
       ///Have to call this from CAlphabetManager, and from CGroupNode on a _different_ CAlphNode, hence public...
@@ -151,7 +151,7 @@ namespace Dasher {
       virtual std::string trainText() {return outputText();}
       /// Number of unicode _characters_ (not octets) for this symbol.
       /// Uniquely, a paragraph symbol can enter two distinct unicode characters
-      /// (i.e. '\r' and '\n'); every other symbol enters only a single 
+      /// (i.e. '\r' and '\n'); every other symbol enters only a single
       /// unicode char, even if that might take >1 octet.
       int numChars();
       ///Compatibility constructor, so that subclasses can specify their own colour & label
@@ -164,10 +164,10 @@ namespace Dasher {
     class CGroupNode : public CAlphNode {
     public:
       CGroupNode(CDasherNode *pParent, int iOffset, unsigned int iLbnd, unsigned int iHbnd, const std::string &strEnc, int iBkgCol, CAlphabetManager *pMgr, const SGroupInfo *pGroup);
-      
+
       ///Override: if m_pGroup==NULL, i.e. whole/root-of alphabet, cannot rebuild.
       virtual CDasherNode *RebuildParent();
-      
+
       ///Create children of this group node, by traversing the section of the alphabet
       /// indicated by m_pGroup.
       virtual void PopulateChildren();
@@ -182,7 +182,7 @@ namespace Dasher {
     private:
       const SGroupInfo *m_pGroup;
     };
-    
+
   public:
     ///
     /// Get a new root node owned by this manager
@@ -193,7 +193,7 @@ namespace Dasher {
     virtual CAlphNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, bool bEnteredLast, int iOffset);
 
     const CAlphInfo *GetAlphabet() const;
-    
+
   protected:
     ///Called to get the symbols in the context for (preceding) a new node
     /// \param pParent node to assume has been output, when obtaining context
@@ -205,7 +205,7 @@ namespace Dasher {
     /// could be extracted, else 0 (=> couldn't get context, using alphabet default); second
     /// element is the result of entering the symbols retrieved, into a fresh LM context.
     std::pair<symbol, CLanguageModel::Context> GetContextSymbols(CDasherNode *pParent, int iRootOffset, const CAlphabetMap *pAlphMap);
-    
+
     ///Called to create a node for a given symbol (leaf), as a child of a specified parent node
     /// \param strGroup caption of any group containing this node, that will not be created:
     /// thus, should be prepended onto the caption of the node created.
@@ -222,7 +222,7 @@ namespace Dasher {
     ///  scheme for symbols not specifying a colour, and (b) implements
     /// colour-cycling by phase (two cycles, using the LSBit of offset)
     virtual int GetColour(symbol sym, int iOffset) const;
-    
+
     CLanguageModel *m_pLanguageModel;
 
     CNodeCreationManager *m_pNCManager;
diff --git a/Src/DasherCore/AlternatingDirectMode.h b/Src/DasherCore/AlternatingDirectMode.h
index 3ab6e4f..ef0ddfc 100644
--- a/Src/DasherCore/AlternatingDirectMode.h
+++ b/Src/DasherCore/AlternatingDirectMode.h
@@ -1,5 +1,5 @@
 
-// DasherButtons.h 
+// DasherButtons.h
 // Copyright 2005 by Chris Ball
 
 #ifndef __ALTERNATING_DIRECT_MODE_H__
@@ -26,17 +26,17 @@ namespace Dasher {
 {
  public:
   CAlternatingDirectMode(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore, CDasherInterfaceBase *pInterface);
-  
+
   bool DecorateView(CDasherView *pView, CDasherInput *pInput);
 
   bool GetSettings(SModuleSettings **pSettings, int *iCount);
 
  protected:
   void SetupBoxes();
-  
+
  private:
   void DirectKeyDown(int iTime, int iId, CDasherView *pView, CDasherModel *pModel, CUserLogBase *pUserLog);
-    
+
   int m_iLastBox;
 };
 }
diff --git a/Src/DasherCore/AutoSpeedControl.cpp b/Src/DasherCore/AutoSpeedControl.cpp
index afafc18..5c5de33 100644
--- a/Src/DasherCore/AutoSpeedControl.cpp
+++ b/Src/DasherCore/AutoSpeedControl.cpp
@@ -24,7 +24,7 @@ double round(double dVal) {
 
 using namespace Dasher;
 
-CAutoSpeedControl::CAutoSpeedControl(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore) 
+CAutoSpeedControl::CAutoSpeedControl(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore)
   : CDasherComponent(pEventHandler, pSettingsStore) {
   //scale #samples by #samples = m_dSamplesScale / (current bitrate) + m_dSampleOffset
   m_dSampleScale = 1.5;
@@ -45,19 +45,19 @@ CAutoSpeedControl::CAutoSpeedControl(Dasher::CEventHandler * pEventHandler, CSet
   m_dSpeedMax = 8.0;
   m_dSpeedMin = 0.1;
   //variance of two-centred-gaussians for adaptive radius
-  m_dSigma1 = 0.5; 
+  m_dSigma1 = 0.5;
   m_dSigma2 = 0.05;
   //Initialise auto-speed control
   m_nSpeedCounter = 0;
   m_dBitrate = double(round(GetLongParameter(LP_MAX_BITRATE) / 100.0));
 
   UpdateMinRadius();
-  UpdateSampleSize(GetLongParameter(LP_FRAMERATE) / 100.0); 
+  UpdateSampleSize(GetLongParameter(LP_FRAMERATE) / 100.0);
 }
 
   ////////////////////////////////////////////////
   ///
-  ///  Change max bitrate based on variance of angle 
+  ///  Change max bitrate based on variance of angle
   ///  in dasher space.
   ///
   /////////////////////////////////////////////////
@@ -85,11 +85,11 @@ inline double CAutoSpeedControl::UpdateBitrate()
   //    nothing happens! ;
 
   //always keep bitrate values sane
-  if(m_dBitrate > m_dSpeedMax) 
+  if(m_dBitrate > m_dSpeedMax)
   {
     m_dBitrate = m_dSpeedMax;
   }
-  else if(m_dBitrate < m_dSpeedMin) 
+  else if(m_dBitrate < m_dSpeedMin)
   {
     m_dBitrate = m_dSpeedMin;
   }
@@ -101,13 +101,13 @@ inline double CAutoSpeedControl::UpdateBitrate()
   ///  Finds variance for automatic speed control
   ///
   //////////////////////////////////////////////
-       
+
 inline double CAutoSpeedControl::Variance()
-{      
+{
   double avgcos, avgsin;
   avgsin = avgcos = 0.0;
   DOUBLE_DEQUE::iterator i;
-  // find average of cos(theta) and sin(theta) 
+  // find average of cos(theta) and sin(theta)
   for(i = m_dequeAngles.begin(); i != m_dequeAngles.end(); i++) {
     avgcos += cos(*i);
     avgsin += sin(*i);
@@ -121,7 +121,7 @@ inline double CAutoSpeedControl::Variance()
 //////////////////////////////////////////////////////////////////////
 ///
 ///  The number of samples depends on the clock rate of the
-///  machine (framerate) and the user's speed (bitrate). See 
+///  machine (framerate) and the user's speed (bitrate). See
 ///  speedcontrol.tex in dasher/Doc/ dir.
 ///
 /////////////////////////////////////////////////////////////////////
@@ -132,9 +132,9 @@ inline int CAutoSpeedControl::UpdateSampleSize(double dFrameRate)
   // for the purposes of this function
   // we don't care exactly how slow we're going
   // *really* low speeds are ~ equivalent?
-  double dBitrate = std::max(1.0,m_dBitrate); 
+  double dBitrate = std::max(1.0,m_dBitrate);
   double dSpeedSamples = dFrameRate * (m_dSampleScale / dBitrate + m_dSampleOffset);
- 
+
   m_nSpeedSamples = int(round(dSpeedSamples));
 
   return m_nSpeedSamples;
@@ -147,16 +147,16 @@ inline int CAutoSpeedControl::UpdateSampleSize(double dFrameRate)
   ///
   ///////////////////////////////////////////////////////////
 
-inline double CAutoSpeedControl::UpdateMinRadius() 
+inline double CAutoSpeedControl::UpdateMinRadius()
 {
-  m_dMinRadius = sqrt( log( (m_dSigma2 * m_dSigma2) / (m_dSigma1 * m_dSigma1) ) / 
+  m_dMinRadius = sqrt( log( (m_dSigma2 * m_dSigma2) / (m_dSigma1 * m_dSigma1) ) /
                 ( 1 / (m_dSigma1 * m_dSigma1) - 1 / (m_dSigma2 * m_dSigma2)) );
   return m_dMinRadius;
 }
 
 //////////////////////////////////////////////////////////////
 ///
-///  NB: updates VARIANCES of two populations of 
+///  NB: updates VARIANCES of two populations of
 ///  mixture-of-2-centred-Gaussians model!
 ///
 //////////////////////////////////////////////////////////////
@@ -166,7 +166,7 @@ inline void CAutoSpeedControl::UpdateSigmas(double r, double dFrameRate)
   double dSamples = m_dMinRRate* dFrameRate / m_dBitrate;
   if(r > m_dMinRadius)
     m_dSigma1 = m_dSigma1 - (m_dSigma1 - r * r) / dSamples;
-  else 
+  else
     m_dSigma2 = m_dSigma2 - (m_dSigma2 - r * r) / dSamples;
 }
 
@@ -180,7 +180,7 @@ inline void CAutoSpeedControl::UpdateSigmas(double r, double dFrameRate)
 
 void CAutoSpeedControl::SpeedControl(myint iDasherX, myint iDasherY, CDasherView *pView) {
   if(GetBoolParameter(BP_AUTO_SPEEDCONTROL)) {
-    
+
 //  Coordinate transforms:
 	double r,theta;
 	pView->Dasher2Polar(iDasherX, iDasherY, r, theta);
@@ -190,28 +190,28 @@ void CAutoSpeedControl::SpeedControl(myint iDasherX, myint iDasherY, CDasherView
     UpdateSigmas(r, dFrameRate);
 
 //  Data collection:
-    
+
     if(r > m_dMinRadius && fabs(theta) < 1.25) {
       m_nSpeedCounter++;
       m_dequeAngles.push_back(theta);
       while(m_dequeAngles.size() > m_nSpeedSamples) {
 	    m_dequeAngles.pop_front();
       }
-      
+
     }
     m_dSensitivity = GetLongParameter(LP_AUTOSPEED_SENSITIVITY) / 100.0;
     if(m_nSpeedCounter > round(m_nSpeedSamples / m_dSensitivity)) {
       //do speed control every so often!
-      
+
       UpdateSampleSize(dFrameRate);
       UpdateMinRadius();
       UpdateBitrate();
       long lBitrateTimes100 =  long(round(m_dBitrate * 100)); //Dasher settings want long numerical parameters
       SetLongParameter(LP_MAX_BITRATE, lBitrateTimes100);
-      m_nSpeedCounter = 0;	  
-    
-    }	
-  
-  }  
-  
+      m_nSpeedCounter = 0;
+
+    }
+
+  }
+
 }
diff --git a/Src/DasherCore/ButtonMode.cpp b/Src/DasherCore/ButtonMode.cpp
index 2d12c59..9ff9714 100644
--- a/Src/DasherCore/ButtonMode.cpp
+++ b/Src/DasherCore/ButtonMode.cpp
@@ -56,7 +56,7 @@ void CButtonMode::SetupBoxes()
 
   double dRatio;
   double dNorm;
-  
+
   // FIXME - implement this using DJCM's integer method?
   // See ~mackay/dasher/buttons/
   dRatio = pow(129/127.0, -static_cast<double>(GetLongParameter(LP_R)));
@@ -67,11 +67,11 @@ void CButtonMode::SetupBoxes()
     if(dRatio == 1.0)
       dMaxSize = iDasherY / static_cast<double>(iForwardBoxes);
     else
-      dMaxSize = ((dRatio - 1)/(pow(dRatio, iForwardBoxes) - 1)) * iDasherY; 
-    
+      dMaxSize = ((dRatio - 1)/(pow(dRatio, iForwardBoxes) - 1)) * iDasherY;
+
     double dMin(0.0);
     double dMax;
-    
+
     for(int i(0); i < m_iNumBoxes - 1; ++i) { // One button reserved for backoff
       dMax = dMin + dMaxSize * pow(dRatio, i);
 
@@ -88,7 +88,7 @@ void CButtonMode::SetupBoxes()
     }
 
   }
-  else {      
+  else {
     if(iForwardBoxes == 2+1) { // Special case for two forwards buttons
       dNorm = 1+dRatio;
 
@@ -158,10 +158,10 @@ void CButtonMode::SetupBoxes()
     m_pBoxes[i].iTop = m_pBoxes[i].iDisplayTop - GetLongParameter(LP_S);
     m_pBoxes[i].iBottom = m_pBoxes[i].iDisplayBottom + GetLongParameter(LP_S);
   }
-  
+
   m_pBoxes[m_iNumBoxes-1].iDisplayTop = 0;
   m_pBoxes[m_iNumBoxes-1].iDisplayBottom = iDasherY;
-  
+
   m_pBoxes[m_iNumBoxes-1].iTop = int(- iDasherY / 2);
   m_pBoxes[m_iNumBoxes-1].iBottom = int(iDasherY * 1.5);
 }
@@ -181,9 +181,9 @@ bool CButtonMode::DecorateView(CDasherView *pView, CDasherInput *pInput) {
 bool CButtonMode::Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol) {
   bool m_bOldHighlight(m_bHighlight);
   m_bHighlight = (Time - m_iLastTime < 200);
-  
+
   if(m_bOldHighlight != m_bHighlight)
-    m_bDecorationChanged = true;  
+    m_bDecorationChanged = true;
 
   return CDasherButtons::Timer(Time, pView, pInput, pModel, pAdded, pNumDeleted, pol);
 }
diff --git a/Src/DasherCore/ButtonMultiPress.cpp b/Src/DasherCore/ButtonMultiPress.cpp
index 90fe40e..8b70ea5 100644
--- a/Src/DasherCore/ButtonMultiPress.cpp
+++ b/Src/DasherCore/ButtonMultiPress.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "DasherInterfaceBase.h"
@@ -30,7 +30,7 @@ CButtonMultiPress::CButtonMultiPress(Dasher::CEventHandler * pEventHandler, CSet
 void CButtonMultiPress::KeyDown(int iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog) {
 
   if (m_bKeyDown) return;
-      
+
   // Check for multiple clicks
   if(iId == m_iQueueId && m_deQueueTimes.size()) {
     if ( (iTime - m_deQueueTimes.back()) > GetLongParameter(LP_MULTIPRESS_TIME) )
diff --git a/Src/DasherCore/ButtonMultiPress.h b/Src/DasherCore/ButtonMultiPress.h
index 3da6077..cd936e4 100644
--- a/Src/DasherCore/ButtonMultiPress.h
+++ b/Src/DasherCore/ButtonMultiPress.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __ButtonMultiPress_h__
@@ -32,7 +32,7 @@ namespace Dasher {
 class CButtonMultiPress : public CDynamicFilter {
  public:
   CButtonMultiPress(Dasher::CEventHandler * pEventHandler, CSettingsStore *pSettingsStore, CDasherInterfaceBase *pInterface, ModuleID_t iID, const char *szName);
-  
+
   virtual void KeyDown(int iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog);
 
  protected:
diff --git a/Src/DasherCore/CannaConversionHelper.cpp b/Src/DasherCore/CannaConversionHelper.cpp
index c2867d8..e012564 100644
--- a/Src/DasherCore/CannaConversionHelper.cpp
+++ b/Src/DasherCore/CannaConversionHelper.cpp
@@ -179,9 +179,9 @@ void CCannaConversionHelper::ProcessCandidate(std::string strCandidate, SCENode
       
   // TODO: Need phrase-based conversion
   while(iIdx < strCandidate.size()) {
-	
+
     int iLength;
-	
+
     // TODO: Really dodgy UTF-8 parser - find a library routine to do this
     if((static_cast<int>(strCandidate[iIdx]) & 0x80) == 0)
       iLength = 1;
diff --git a/Src/DasherCore/CircleStartHandler.cpp b/Src/DasherCore/CircleStartHandler.cpp
index 5da2c7f..3857e67 100644
--- a/Src/DasherCore/CircleStartHandler.cpp
+++ b/Src/DasherCore/CircleStartHandler.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "../Common/Common.h"
@@ -26,7 +26,7 @@
 
 using namespace Dasher;
 
-CCircleStartHandler::CCircleStartHandler(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore, CDasherInterfaceBase *pInterface) 
+CCircleStartHandler::CCircleStartHandler(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore, CDasherInterfaceBase *pInterface)
 : CStartHandler(pEventHandler, pSettingsStore, pInterface), m_iEnterTime(std::numeric_limits<long>::max()), m_iScreenRadius(-1) {
 }
 
@@ -38,9 +38,9 @@ void CCircleStartHandler::ComputeScreenLoc(CDasherView *pView) {
   // - should we?
   screenint iEdgeX, iEdgeY;
   pView->Dasher2Screen(GetLongParameter(LP_OX), GetLongParameter(LP_OY) + (GetLongParameter(LP_MAX_Y)*GetLongParameter(LP_CIRCLE_PERCENT))/100, iEdgeX, iEdgeY);
-  
+
   int iDirection = GetLongParameter(LP_REAL_ORIENTATION);
-  
+
   if((iDirection == 2) || (iDirection == 3)) {
     m_iScreenRadius = iEdgeX - m_screenCircleCenter.x;
   }
@@ -61,7 +61,7 @@ bool CCircleStartHandler::DecorateView(CDasherView *pView) {
     lineColor=240; fillColor=-1; //don't fill
     lineWidth = bAboutToChange ? 3 : 1;
   }
-  
+
   pView->Screen()->DrawCircle(m_screenCircleCenter.x, m_screenCircleCenter.y, m_iScreenRadius, fillColor, lineColor, lineWidth);
 
   return true;
@@ -73,7 +73,7 @@ void CCircleStartHandler::Timer(int iTime, dasherint mouseX, dasherint mouseY,CD
   pView->Dasher2Screen(mouseX, mouseY, x, y);
   x-=m_screenCircleCenter.x; y-=m_screenCircleCenter.y;
   const bool inCircleNow = x*x + y*y <= (m_iScreenRadius * m_iScreenRadius);
-  
+
   if (inCircleNow) {
     if (m_bInCircle) {
       //still in circle...check they aren't still in there after prev. activation
@@ -101,7 +101,7 @@ void CCircleStartHandler::Timer(int iTime, dasherint mouseX, dasherint mouseY,CD
 void CCircleStartHandler::HandleEvent(Dasher::CEvent * pEvent) {
   if(pEvent->m_iEventType == EV_PARAM_NOTIFY) {
     Dasher::CParameterNotificationEvent * pEvt(static_cast < Dasher::CParameterNotificationEvent * >(pEvent));
-   
+
     switch (pEvt->m_iParameter) {
     case LP_REAL_ORIENTATION:
     case LP_CIRCLE_PERCENT:
diff --git a/Src/DasherCore/ClickFilter.cpp b/Src/DasherCore/ClickFilter.cpp
index 6e71287..eca5d04 100644
--- a/Src/DasherCore/ClickFilter.cpp
+++ b/Src/DasherCore/ClickFilter.cpp
@@ -63,7 +63,7 @@ void CClickFilter::AdjustZoomCoords(myint &iDasherX, myint &iDasherY, CDasherVie
   //safety param. Used to be just added onto DasherX,
   // but comments suggested should be interpreted as a fraction. Hence...
   myint iNewDasherX = (iDasherX*1024 + ox*safety) / (1024+safety);
-  
+
   //max zoom parameter...
   iNewDasherX = std::max(ox/pView->GetLongParameter(LP_MAXZOOM),iNewDasherX);
   //force x>=2 (what's wrong with x==1?)
diff --git a/Src/DasherCore/ClickFilter.h b/Src/DasherCore/ClickFilter.h
index 7e63fca..158f984 100644
--- a/Src/DasherCore/ClickFilter.h
+++ b/Src/DasherCore/ClickFilter.h
@@ -15,7 +15,7 @@ class CClickFilter : public CInputFilter {
   virtual bool Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol);
   virtual void KeyDown(int iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog, bool bPos, int iX, int iY);
   virtual bool GetSettings(SModuleSettings **pSettings, int *iCount);
-  
+
   static void AdjustZoomCoords(myint &iDasherX, myint &iDasherY, CDasherView *comp);
   
  private:
diff --git a/Src/DasherCore/ColourIO.cpp b/Src/DasherCore/ColourIO.cpp
index 37353f5..2a68326 100644
--- a/Src/DasherCore/ColourIO.cpp
+++ b/Src/DasherCore/ColourIO.cpp
@@ -133,7 +133,7 @@ void CColourIO::Save(const std::string &ColourID) {
 
 void CColourIO::CreateDefault() {
   // TODO: Urgh - replace with a table
-  
+
   ColourInfo & Default = Colours["Default"];
   Default.ColourID = "Default";
   Default.Mutable = false;
diff --git a/Src/DasherCore/CompassMode.cpp b/Src/DasherCore/CompassMode.cpp
index 1880ddf..78617ab 100644
--- a/Src/DasherCore/CompassMode.cpp
+++ b/Src/DasherCore/CompassMode.cpp
@@ -38,7 +38,7 @@ CCompassMode::CCompassMode(Dasher::CEventHandler * pEventHandler, CSettingsStore
   : CDasherButtons(pEventHandler, pSettingsStore, pInterface, false /*bMenu*/, 13, _("Compass Mode")) {}
 
 void CCompassMode::SetupBoxes()
-{  
+{
   int iDasherY(GetLongParameter(LP_MAX_Y));
 
   m_pBoxes = new SBoxInfo[m_iNumBoxes = 4];
@@ -62,13 +62,13 @@ void CCompassMode::SetupBoxes()
   m_pBoxes[2].iTop = iTargetWidth;
   m_pBoxes[2].iBottom = iDasherY + iTargetWidth;
 
-  m_pBoxes[0].iDisplayTop = m_pBoxes[0].iTop; 
+  m_pBoxes[0].iDisplayTop = m_pBoxes[0].iTop;
   m_pBoxes[0].iDisplayBottom = m_pBoxes[0].iBottom;
-  m_pBoxes[1].iDisplayTop = m_pBoxes[1].iTop; 
+  m_pBoxes[1].iDisplayTop = m_pBoxes[1].iTop;
   m_pBoxes[1].iDisplayBottom = m_pBoxes[1].iBottom;
-  m_pBoxes[2].iDisplayTop = m_pBoxes[2].iTop; 
+  m_pBoxes[2].iDisplayTop = m_pBoxes[2].iTop;
   m_pBoxes[2].iDisplayBottom = m_pBoxes[2].iBottom;
-  m_pBoxes[3].iDisplayTop = m_pBoxes[3].iTop; 
+  m_pBoxes[3].iDisplayTop = m_pBoxes[3].iTop;
   m_pBoxes[3].iDisplayBottom = m_pBoxes[3].iBottom;
 }
 
@@ -92,7 +92,7 @@ bool CCompassMode::DecorateView(CDasherView *pView, CDasherInput *pInput) {
 
     iDasherX = -1000;
     iDasherY = iPos;
-    
+
     pView->Dasher2Screen(iDasherX, iDasherY, p[1].x, p[1].y);
 
     if(bFirst)
@@ -107,7 +107,7 @@ bool CCompassMode::DecorateView(CDasherView *pView, CDasherInput *pInput) {
 
     iDasherX = -1000;
     iDasherY = 4096 - iPos;
-    
+
     pView->Dasher2Screen(iDasherX, iDasherY, p[1].x, p[1].y);
 
     if(bFirst)
@@ -123,7 +123,7 @@ bool CCompassMode::DecorateView(CDasherView *pView, CDasherInput *pInput) {
   m_bDecorationChanged = false;
   return bRV;
 }
- 
+
 void CCompassMode::HandleEvent(Dasher::CEvent * pEvent) {
   if(pEvent->m_iEventType == 1) {
     Dasher::CParameterNotificationEvent * pEvt(static_cast < Dasher::CParameterNotificationEvent * >(pEvent));
diff --git a/Src/DasherCore/CompassMode.h b/Src/DasherCore/CompassMode.h
index 9fc984e..0e949b9 100644
--- a/Src/DasherCore/CompassMode.h
+++ b/Src/DasherCore/CompassMode.h
@@ -1,5 +1,5 @@
 
-// DasherButtons.h 
+// DasherButtons.h
 // Copyright 2005 by Chris Ball
 
 #ifndef __COMPASS_MODE_H__
@@ -25,15 +25,15 @@ class CCompassMode : public CDasherButtons
   CCompassMode(Dasher::CEventHandler * pEventHandler, CSettingsStore * pSettingsStore, CDasherInterfaceBase *pInterface);
 
   virtual void HandleEvent(Dasher::CEvent * pEvent);
-  
+
   bool DecorateView(CDasherView *pView, CDasherInput *pInput);
 
   bool GetSettings(SModuleSettings **pSettings, int *iCount);
 
  protected:
   void SetupBoxes();
-  
- private: 
+
+ private:
   int iTargetWidth;
 };
 }
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 83159dd..62752ec 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "../Common/Common.h"
@@ -52,7 +52,7 @@ CDasherNode *CControlBase::GetRoot(CDasherNode *pParent, unsigned int iLower, un
   if (!m_pRoot) return m_pNCManager->GetAlphabetManager()->GetRoot(pParent, iLower, iUpper, false, iOffset);
 
   CContNode *pNewNode = new CContNode(pParent, iOffset, iLower, iUpper, m_pRoot, this);
- 
+
   // FIXME - handle context properly
 
   //  pNewNode->SetContext(m_pLanguageModel->CreateEmptyContext());
@@ -66,7 +66,7 @@ CControlBase::NodeTemplate::NodeTemplate(const string &strLabel,int iColour)
 
 CControlBase::EventBroadcast::EventBroadcast(int iEvent, const string &strLabel, int iColour)
 : NodeTemplate(strLabel, iColour), m_iEvent(iEvent) {
-  
+
 }
 
 void CControlBase::EventBroadcast::happen(CContNode *pNode) {
@@ -81,31 +81,31 @@ CControlBase::CContNode::CContNode(CDasherNode *pParent, int iOffset, unsigned i
 }
 
 void CControlBase::CContNode::PopulateChildren() {
-  
+
   CDasherNode *pNewNode;
-  
+
   const unsigned int iNChildren( m_pTemplate->successors.size() );
   const unsigned int iNorm(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION));
   unsigned int iLbnd(0), iIdx(0);
-  
+
   for (vector<NodeTemplate *>::iterator it = m_pTemplate->successors.begin(); it!=m_pTemplate->successors.end(); it++) {
-    
-    const unsigned int iHbnd((++iIdx*iNorm)/iNChildren); 
-    
+
+    const unsigned int iHbnd((++iIdx*iNorm)/iNChildren);
+
     if( *it == NULL ) {
       // Escape back to alphabet
-      
+
       pNewNode = m_pMgr->m_pNCManager->GetAlphabetManager()->GetRoot(this, iLbnd, iHbnd, false, offset()+1);
     }
     else {
-      
+
       pNewNode = new CContNode(this, offset(), iLbnd, iHbnd, *it, m_pMgr);
     }
     iLbnd=iHbnd;
     DASHER_ASSERT(GetChildren().back()==pNewNode);
   }
 }
-    
+
 int CControlBase::CContNode::ExpectedNumChildren() {
   return m_pTemplate->successors.size();
 }
@@ -118,7 +118,7 @@ void CControlBase::CContNode::Enter() {
   // Slow down to half the speed we were at
   m_pMgr->m_pNCManager->SetLongParameter(LP_BOOSTFACTOR, 50);
   //Disable auto speed control!
-  m_pMgr->bDisabledSpeedControl = m_pMgr->m_pNCManager->GetBoolParameter(BP_AUTO_SPEEDCONTROL); 
+  m_pMgr->bDisabledSpeedControl = m_pMgr->m_pNCManager->GetBoolParameter(BP_AUTO_SPEEDCONTROL);
   m_pMgr->m_pNCManager->SetBoolParameter(BP_AUTO_SPEEDCONTROL, 0);
 }
 
@@ -136,7 +136,7 @@ void CControlBase::CContNode::Leave() {
 
 COrigNodes::COrigNodes(CNodeCreationManager *pNCManager, CDasherInterfaceBase *pInterface) : CControlBase(pNCManager), m_pInterface(pInterface) {
   m_iNextID = 0;
-  
+
   // TODO: Need to fix this on WinCE build
 #ifndef _WIN32_WCE
   if(!LoadLabelsFromFile(m_pNCManager->GetStringParameter(SP_USER_LOC) + "controllabels.xml")) {
@@ -163,11 +163,11 @@ bool COrigNodes::LoadLabelsFromFile(string strFileName) {
   ifstream oFile(strFileName.c_str());
   oFile.read(szFileBuffer, iFileSize);
   XML_Parser Parser = XML_ParserCreate(NULL);
-  
+
   // Members passed as callbacks must be static, so don't have a "this" pointer.
   // We give them one through horrible casting so they can effect changes.
   XML_SetUserData(Parser, this);
-  
+
   XML_SetElementHandler(Parser, XmlStartHandler, XmlEndHandler);
   XML_SetCharacterDataHandler(Parser, XmlCDataHandler);
   XML_Parse(Parser, szFileBuffer, iFileSize, false);
@@ -193,7 +193,7 @@ void COrigNodes::Stop::happen(CContNode *pNode) {
 bool COrigNodes::LoadDefaultLabels() {
   //hmmm. This is probably not the most flexible policy...
   if (!m_perId.empty()) return false;
-  
+
   // TODO: Need to figure out how to handle offset changes here
   RegisterNode(CTL_ROOT, "Control", 8);
   RegisterNode(CTL_STOP, "Stop", 242);
@@ -229,99 +229,99 @@ void COrigNodes::ConnectNodes() {
   ConnectNode(CTL_PAUSE, CTL_ROOT, -2);
   ConnectNode(CTL_MOVE, CTL_ROOT, -2);
   ConnectNode(CTL_DELETE, CTL_ROOT, -2);
-  
+
   ConnectNode(-1, CTL_STOP, -2);
   ConnectNode(CTL_ROOT, CTL_STOP, -2);
-  
+
   ConnectNode(-1, CTL_PAUSE, -2);
   ConnectNode(CTL_ROOT, CTL_PAUSE, -2);
-  
+
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE, -2);
-  
+
   ConnectNode(CTL_MOVE_FORWARD_CHAR, CTL_MOVE_FORWARD, -2);
   ConnectNode(CTL_MOVE_FORWARD_WORD, CTL_MOVE_FORWARD, -2);
   ConnectNode(CTL_MOVE_FORWARD_LINE, CTL_MOVE_FORWARD, -2);
   ConnectNode(CTL_MOVE_FORWARD_FILE, CTL_MOVE_FORWARD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_FORWARD_CHAR, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_FORWARD_CHAR, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_FORWARD_CHAR, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_FORWARD_WORD, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_FORWARD_WORD, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_FORWARD_WORD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_FORWARD_LINE, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_FORWARD_LINE, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_FORWARD_LINE, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_FORWARD_FILE, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_FORWARD_FILE, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_FORWARD_FILE, -2);
-  
+
   ConnectNode(CTL_MOVE_BACKWARD_CHAR, CTL_MOVE_BACKWARD, -2);
   ConnectNode(CTL_MOVE_BACKWARD_WORD, CTL_MOVE_BACKWARD, -2);
   ConnectNode(CTL_MOVE_BACKWARD_LINE, CTL_MOVE_BACKWARD, -2);
   ConnectNode(CTL_MOVE_BACKWARD_FILE, CTL_MOVE_BACKWARD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_BACKWARD_CHAR, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_BACKWARD_CHAR, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_CHAR, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_BACKWARD_WORD, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_BACKWARD_WORD, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_WORD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_BACKWARD_LINE, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_BACKWARD_LINE, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_LINE, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_MOVE_BACKWARD_FILE, -2);
   ConnectNode(CTL_MOVE_FORWARD, CTL_MOVE_BACKWARD_FILE, -2);
   ConnectNode(CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_FILE, -2);
-  
+
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE, -2);
-  
+
   ConnectNode(CTL_DELETE_FORWARD_CHAR, CTL_DELETE_FORWARD, -2);
   ConnectNode(CTL_DELETE_FORWARD_WORD, CTL_DELETE_FORWARD, -2);
   ConnectNode(CTL_DELETE_FORWARD_LINE, CTL_DELETE_FORWARD, -2);
   ConnectNode(CTL_DELETE_FORWARD_FILE, CTL_DELETE_FORWARD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_FORWARD_CHAR, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_FORWARD_CHAR, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_FORWARD_CHAR, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_FORWARD_WORD, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_FORWARD_WORD, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_FORWARD_WORD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_FORWARD_LINE, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_FORWARD_LINE, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_FORWARD_LINE, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_FORWARD_FILE, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_FORWARD_FILE, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_FORWARD_FILE, -2);
-  
+
   ConnectNode(CTL_DELETE_BACKWARD_CHAR, CTL_DELETE_BACKWARD, -2);
   ConnectNode(CTL_DELETE_BACKWARD_WORD, CTL_DELETE_BACKWARD, -2);
   ConnectNode(CTL_DELETE_BACKWARD_LINE, CTL_DELETE_BACKWARD, -2);
   ConnectNode(CTL_DELETE_BACKWARD_FILE, CTL_DELETE_BACKWARD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_BACKWARD_CHAR, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_BACKWARD_CHAR, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_BACKWARD_CHAR, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_BACKWARD_WORD, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_BACKWARD_WORD, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_BACKWARD_WORD, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_BACKWARD_LINE, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_BACKWARD_LINE, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_BACKWARD_LINE, -2);
-  
+
   ConnectNode(CTL_ROOT, CTL_DELETE_BACKWARD_FILE, -2);
   ConnectNode(CTL_DELETE_FORWARD, CTL_DELETE_BACKWARD_FILE, -2);
   ConnectNode(CTL_DELETE_BACKWARD, CTL_DELETE_BACKWARD_FILE, -2);
@@ -344,7 +344,7 @@ void COrigNodes::ConnectNode(int iChild, int iParent, int iAfter) {
   // something with iAfter "(eventually -1 = start, -2 = end)", but
   // since this wasn't used, and this is all legacy code anyway ;-),
   // I'm leaving as is...
-  
+
   NodeTemplate *pParent(m_perId[iParent]);
   if (pParent) //Note - old code only checked this if iChild==-1...?!
     pParent->successors.push_back(iChild==-1 ? NULL : m_perId[iChild]);
@@ -376,7 +376,7 @@ void COrigNodes::XmlStartHandler(void *pUserData, const XML_Char *szName, const
       if(0==strcmp(aszAttr[i],"color"))
       {
         colour = atoi(aszAttr[i+1]);
-      }  
+      }
     }
     pMgr->RegisterNode(pMgr->m_iNextID++, str, colour);
   }
@@ -390,7 +390,7 @@ void COrigNodes::XmlCDataHandler(void *pUserData, const XML_Char *szData, int iL
 
 CControlManager::CControlManager(CEventHandler *pEventHandler, CSettingsStore *pSettingsStore, CNodeCreationManager *pNCManager, CDasherInterfaceBase *pInterface)
 : CDasherComponent(pEventHandler, pSettingsStore), COrigNodes(pNCManager, pInterface), m_pSpeech(NULL), m_pCopy(NULL) {
-  
+
   updateActions();
 }
 
@@ -453,27 +453,27 @@ void CControlManager::updateActions() {
   vector<NodeTemplate *>::iterator it=vOldRootSuccessors.begin();
   DASHER_ASSERT(*it == NULL); //escape back to alphabet
   vRootSuccessors.push_back(*it++);
-  
+
   //stop does something, and we're told to add a node for it
   // (either a dynamic filter where the user can't use the normal stop mechanism precisely,
   //  or a static filter but a 'stop' action is easier than using speak->all / copy->all then pause)
   if (m_pInterface->hasStopTriggers() && m_pInterface->GetBoolParameter(BP_CONTROL_MODE_HAS_HALT))
     vRootSuccessors.push_back(m_perId[CTL_STOP]);
   if (it!=vOldRootSuccessors.end() && *it == m_perId[CTL_STOP]) it++;
-  
+
   //filter is pauseable, and either 'stop' would do something (so pause is different),
   // or we're told to have a stop node but it would be indistinguishable from pause (=>have pause)
   CInputFilter *pInput(static_cast<CInputFilter *>(m_pInterface->GetModuleByName(m_pInterface->GetStringParameter(SP_INPUT_FILTER))));
   if (pInput->supportsPause() && (m_pInterface->hasStopTriggers() || m_pInterface->GetBoolParameter(BP_CONTROL_MODE_HAS_HALT)))
     vRootSuccessors.push_back(m_perId[CTL_PAUSE]);
   if (it!=vOldRootSuccessors.end() && *it == m_perId[CTL_PAUSE]) it++;
-  
+
   if (m_pInterface->GetBoolParameter(BP_CONTROL_MODE_HAS_SPEECH) && m_pInterface->SupportsSpeech()) {
     if (!m_pSpeech) m_pSpeech = new SpeechHeader(m_pInterface, GetRootTemplate());
     vRootSuccessors.push_back(m_pSpeech);
   }
   if (it!=vOldRootSuccessors.end() && *it == m_pSpeech) it++;
-  
+
   if (m_pInterface->GetBoolParameter(BP_CONTROL_MODE_HAS_COPY) && m_pInterface->SupportsClipboard()) {
     if (!m_pCopy) m_pCopy = new CopyHeader(m_pInterface, GetRootTemplate());
     vRootSuccessors.push_back(m_pCopy);
@@ -486,7 +486,7 @@ void CControlManager::updateActions() {
   }
   if (it!=vOldRootSuccessors.end() && *it == m_perId[CTL_MOVE]) it++;
   if (it!=vOldRootSuccessors.end() && *it == m_perId[CTL_DELETE]) it++;
-  
+
   //copy anything else (custom) that might have been added...
   while (it != vOldRootSuccessors.end()) vRootSuccessors.push_back(*it++);
 }
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index a33c24f..70db150 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __controlmanager_h__
@@ -56,11 +56,11 @@ namespace Dasher {
   class CControlBase : public CNodeManager {
   public:
 
-    enum { CTL_ROOT, CTL_STOP, CTL_PAUSE, CTL_MOVE, CTL_MOVE_FORWARD, 
+    enum { CTL_ROOT, CTL_STOP, CTL_PAUSE, CTL_MOVE, CTL_MOVE_FORWARD,
 	   CTL_MOVE_FORWARD_CHAR, CTL_MOVE_FORWARD_WORD, CTL_MOVE_FORWARD_LINE,
-	   CTL_MOVE_FORWARD_FILE, CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_CHAR, 
+	   CTL_MOVE_FORWARD_FILE, CTL_MOVE_BACKWARD, CTL_MOVE_BACKWARD_CHAR,
 	   CTL_MOVE_BACKWARD_WORD, CTL_MOVE_BACKWARD_LINE, CTL_MOVE_BACKWARD_FILE,
-	   CTL_DELETE, CTL_DELETE_FORWARD, 
+	   CTL_DELETE, CTL_DELETE_FORWARD,
 	   CTL_DELETE_FORWARD_CHAR, CTL_DELETE_FORWARD_WORD, CTL_DELETE_FORWARD_LINE,
 	   CTL_DELETE_FORWARD_FILE, CTL_DELETE_BACKWARD, CTL_DELETE_BACKWARD_CHAR,
 	   CTL_DELETE_BACKWARD_WORD, CTL_DELETE_BACKWARD_LINE, CTL_DELETE_BACKWARD_FILE,
@@ -68,39 +68,39 @@ namespace Dasher {
     };
 
     class NodeTemplate;
-    
+
   protected:
     ///Sets the root - should be called by subclass constructor to make
     /// superclass ready for use.
     ///Note, may only be called once, and with a non-null pRoot, or will throw an error message.
     void SetRootTemplate(NodeTemplate *pRoot);
-    
+
     CNodeCreationManager *m_pNCManager;
-    
+
     class CContNode : public CDasherNode {
     public:
       CControlBase *mgr() {return m_pMgr;}
       CContNode(CDasherNode *pParent, int iOffset, unsigned int iLbnd, unsigned int iHbnd, NodeTemplate *pTemplate, CControlBase *pMgr);
-      
+
       bool bShove() {return false;}
       ///
       /// Provide children for the supplied node
       ///
-      
+
       virtual void PopulateChildren();
       virtual int ExpectedNumChildren();
-      
+
       virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization );
-      
+
       virtual void Enter();
       virtual void Leave();
-      
+
     private:
       NodeTemplate *m_pTemplate;
       CControlBase *m_pMgr;
     };
-    
-  public:    
+
+  public:
     class NodeTemplate {
     public:
       NodeTemplate(const std::string &strLabel, int iColour);
@@ -113,7 +113,7 @@ namespace Dasher {
       std::string m_strLabel;
       int m_iColour;
     };
-    
+
     template <typename T> class MethodTemplate : public NodeTemplate {
     public:
       ///pointer to a function "void X()", that is a member of a T...
@@ -128,7 +128,7 @@ namespace Dasher {
       T *m_pRecv;
       Method m_f;
     };
-    
+
     class EventBroadcast : public NodeTemplate {
     public:
       EventBroadcast(int iEvent, const std::string &strLabel, int iColour);
@@ -136,9 +136,9 @@ namespace Dasher {
     private:
       const int m_iEvent;
     };
-    
+
     NodeTemplate *GetRootTemplate();
-    
+
     CControlBase(CNodeCreationManager *pNCManager);
 
     ///
@@ -153,20 +153,20 @@ namespace Dasher {
     ///Whether we'd temporarily disabled Automatic Speed Control
     ///(if _and only if_ so, should re-enable it when leaving a node)
     bool bDisabledSpeedControl;
-    
+
   };
-  
+
   ///subclass attempts to recreate interface of previous control manager...
   class COrigNodes : public CControlBase {
   public:
     COrigNodes(CNodeCreationManager *pNCManager, CDasherInterfaceBase *pInterface);
     ~COrigNodes();
-    
+
     //keep these around for now, as this might let Win32/Gtk2 work?
     void RegisterNode( int iID, std::string strLabel, int iColour );
     void ConnectNode(int iChild, int iParent, int iAfter);
     void DisconnectNode(int iChild, int iParent);
-    
+
     class Pause : public NodeTemplate {
     public:
       Pause(const std::string &strLabel, int iColour);
@@ -181,18 +181,18 @@ namespace Dasher {
   private:
     //For now, make all the loading routines private:
     // they are called from the constructor in the same fashion as in old ControlManager.
-    
+
     // The possibility of loading labels/layouts from different files/formats
     // remains, but is left to alternative subclasses of ControlBase.
-    
+
     ///Attempts to load control labels from specified file.
     /// Returns true for success, false for failure (e.g. no such file!)
     bool LoadLabelsFromFile(string strFileName);
-    
+
     ///Load a default set of labels. Return true for success, or false
     /// if labels already loaded
     bool LoadDefaultLabels();
-    
+
     void ConnectNodes();
 
     static void XmlStartHandler(void *pUserData, const XML_Char *szName, const XML_Char **aszAttr);
@@ -204,13 +204,13 @@ namespace Dasher {
     std::map<int,NodeTemplate *> m_perId;
     CDasherInterfaceBase *m_pInterface;
   };
-  
+
   ///subclass which we actually construct...
   class CControlManager : public CDasherComponent, public COrigNodes {
   public:
     CControlManager(CEventHandler *pEventHandler, CSettingsStore *pSettingsStore, CNodeCreationManager *pNCManager, CDasherInterfaceBase *pInterface);
     void HandleEvent(CEvent *pEvent);
-    
+
     ///Recomputes which of pause, stop, speak and copy the root control node should have amongst its children.
     /// Automatically called whenever copy-on-stop/speak-on-stop or input filter changes;
     /// subclasses of CDasherInterfaceBase should also call this if
@@ -219,7 +219,7 @@ namespace Dasher {
     ///  (b) the values returned by SupportsSpeech() and/or SupportsClipboard() ever change.
     void updateActions();
     ~CControlManager();
-    
+
   private:
     ///group headers, with three children each (all/new/repeat)
     NodeTemplate *m_pSpeech, *m_pCopy;
diff --git a/Src/DasherCore/ConversionHelper.cpp b/Src/DasherCore/ConversionHelper.cpp
index 257f827..305ba3e 100644
--- a/Src/DasherCore/ConversionHelper.cpp
+++ b/Src/DasherCore/ConversionHelper.cpp
@@ -60,7 +60,7 @@ CConversionManager::CConvNode *CConversionHelper::GetRoot(CDasherNode *pParent,
   // by calling makeNode(), which we override to create a CConvHNode, and then just
   // fills in some of the fields; however, short of duplicating the code of
   // CConversionManager::GetRoot here, we can't get the type to reflect that...
-	
+
   pConvNode->pLanguageModel = m_pLanguageModel;
 
   // context of a conversion node (e.g. ^) is the context of the
@@ -96,7 +96,7 @@ void CConversionHelper::CConvHNode::PopulateChildren() {
     const std::vector<SCENode *> &vChildren = pSCENode->GetChildren();
     //    RecursiveDumpTree(pSCENode, 1);
     mgr()->AssignChildSizes(vChildren, iContext);
-    
+
     int iIdx(0);
     int iCum(0);
 
@@ -136,11 +136,11 @@ void CConversionHelper::CConvHNode::PopulateChildren() {
       if(pLanguageModel) {
         CLanguageModel::Context iContext;
         iContext = pLanguageModel->CloneContext(this->iContext);
-        
+
         if(pCurrentSCEChild ->Symbol !=-1)
           pNewNode->pLanguageModel->EnterSymbol(iContext, pCurrentSCEChild->Symbol); // TODO: Don't use symbols?
-        
-        
+
+
         pNewNode->iContext = iContext;
       }
 
@@ -162,7 +162,7 @@ void CConversionHelper::CConvHNode::PopulateChildren() {
   }
 }
 int CConversionHelper::CConvHNode::ExpectedNumChildren() {
-  if(bisRoot && !pSCENode) mgr()->BuildTree(this);  
+  if(bisRoot && !pSCENode) mgr()->BuildTree(this);
   if (pSCENode && !pSCENode->GetChildren().empty()) return pSCENode->GetChildren().size();
   return CConvNode::ExpectedNumChildren();
 }
@@ -174,7 +174,7 @@ void CConversionHelper::BuildTree(CConvHNode *pRoot) {
   for (CDasherNode *pNode = pRoot->Parent();
        pNode && pNode->mgr() == this;
        pNode = pNode->Parent()) {
-      
+
     // TODO: Need to make this the edit text rather than the display text
     strCurrentString =
               m_pAlphabet->GetText(pNode->GetAlphSymbol())
diff --git a/Src/DasherCore/ConversionHelper.h b/Src/DasherCore/ConversionHelper.h
index f13701d..4e07af7 100644
--- a/Src/DasherCore/ConversionHelper.h
+++ b/Src/DasherCore/ConversionHelper.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __CONVERSION_HELPER_H__
@@ -44,7 +44,7 @@ namespace Dasher{
   class CConversionHelper : public CConversionManager {
   public:
 	CConversionHelper(CNodeCreationManager *pNCManager, const CAlphInfo *pAlphabet, CLanguageModel *pLanguageModel);
-	
+
 	/// Convert a given string to a lattice of candidates. Sizes for
 	/// candidates aren't assigned at this point. The input string
 	/// should be UTF-8 encoded.
@@ -56,7 +56,7 @@ namespace Dasher{
 	///
 	/// @return True if conversion succeeded, false otherwise
 	virtual bool Convert(const std::string &strSource, SCENode ** pRoot) = 0;
-	
+
 	/// Assign sizes to the children of a given conversion node. This
 	/// happens when the conversion manager populates the children of
 	/// the Dasher node so as to avoid unnecessary computation.
@@ -67,38 +67,38 @@ namespace Dasher{
 	/// @param uniform Unsure - document this.
 	///
   virtual void AssignSizes(const std::vector<SCENode *> &vChildren, Dasher::CLanguageModel::Context context, long normalization, int uniform)=0;
-		
+
 	/// Assign colours to the children of a given conversion node.
 	/// This function needs a rethink.
 	///
-	/// @param parentClr 
-	/// @param pNode 
-	/// @param childIndex 
+	/// @param parentClr
+	/// @param pNode
+	/// @param childIndex
+	///
+	/// @return
 	///
-	/// @return 
-	/// 
 	virtual int AssignColour(int parentClr, SCENode * pNode, int childIndex) {
 		int which = -1;
-		
+
 		for (int i=0; i<2; i++)
 			for(int j=0; j<3; j++)
 				if (parentClr == colourStore[i][j])
 					which = i;
-		
+
 		if(which == -1)
 			return colourStore[0][childIndex%3];
 		else if(which == 0)
 			return colourStore[1][childIndex%3];
-		else 
-			return colourStore[0][childIndex%3]; 
+		else
+			return colourStore[0][childIndex%3];
 	};
-	
+
     ///
     /// Get a new root node owned by this manager
     ///
-	
+
     virtual CConvNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
-	
+
     ///
     /// Calculate sizes for each of the children - default
     /// implementation assigns decending probabilities in a power law
@@ -107,9 +107,9 @@ namespace Dasher{
     /// that sizes should be positive and sum to the appropriate
     /// normalisation constant
     ///
-    
+
     virtual void AssignChildSizes(const std::vector<SCENode *> &vChildren, CLanguageModel::Context context);
-	
+
 	protected:
     class CConvHNode : public CConvNode {
     public:
@@ -124,24 +124,24 @@ namespace Dasher{
       inline CConversionHelper *mgr() {return static_cast<CConversionHelper *>(m_pMgr);}
     };
 	  virtual CConvHNode *makeNode(CDasherNode *pParent, int iOffset, unsigned int iLbnd, unsigned int iHbnd, int iColour, const std::string &strDisplayText);
-    /// 
+    ///
     /// Build the conversion tree (lattice) for the given string -
     /// evaluated late to prevent unnecessary conversions when the
     /// children of the root node are never instantiated
     ///
-    
+
     virtual void BuildTree(CConvHNode *pRoot);
-	
+
     virtual Dasher::CLanguageModel *GetLanguageModel() {
       return m_pLanguageModel;
     }
-    
+
   private:
     CLanguageModel *m_pLanguageModel;
-	
+
     CLanguageModel::Context m_iLearnContext;
-	
-	int colourStore[2][3]; 
+
+	int colourStore[2][3];
   };
 /// @}
 }
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index de526f4..4bbd531 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __conversion_manager_h__
@@ -38,7 +38,7 @@ namespace Dasher {
 
   /// This class manages nodes in conversion subtrees, typically used
   /// for languages where complex characters are entered through a
-  /// composition process, for example Japanese and Chinese. 
+  /// composition process, for example Japanese and Chinese.
   ///
   /// A new CConversionManager is created for each subtree, and
   /// therefore represents the conversion of a single phrase. The
@@ -62,11 +62,11 @@ namespace Dasher {
   public:
     // TODO: We shouldn't need to know about this stuff, but the code is somewhat in knots at the moment
     CConversionManager(CNodeCreationManager *pNCManager, const CAlphInfo *pAlphabet);
-    
+
     ///
     /// Decrement reference count
     ///
-    
+
     virtual void Unref() {
       --m_iRefCount;
 
@@ -90,14 +90,14 @@ namespace Dasher {
 
     virtual void PopulateChildren();
     virtual int ExpectedNumChildren();
-    
+
     ~CConvNode();
 
     ///Attempts to fill vContextSymbols with the context that would exist _after_ this node has been entered
     void GetContext(CDasherInterfaceBase *pInterface, const CAlphabetMap *pAlphabetMap, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
 
     ///
-    /// Called whenever a node belonging to this manager first 
+    /// Called whenever a node belonging to this manager first
     /// moves under the crosshair
     ///
 
@@ -112,14 +112,14 @@ namespace Dasher {
     protected:
       CConversionManager *m_pMgr;
     public: //to ConversionManager and subclasses only, of course...
-        
+
     //TODO: REVISE
       symbol iSymbol;
       //     int iPhase;
       CLanguageModel *pLanguageModel;
       CLanguageModel::Context iContext;
       SCENode * pSCENode;
-      bool bisRoot; // True for root conversion nodes 
+      bool bisRoot; // True for root conversion nodes
       //int iGameOffset;
     };
 
@@ -127,30 +127,30 @@ namespace Dasher {
     ///
     /// Get a new root node owned by this manager
     ///
-    
+
     virtual CConvNode *GetRoot(CDasherNode *pParent, unsigned int iLower, unsigned int iUpper, int iOffset);
-  protected:    
-    
+  protected:
+
     virtual CConvNode *makeNode(CDasherNode *pParent, int iOffset, unsigned int iLbnd, unsigned int iHbnd, int iColour, const std::string &strDisplayText);
 
-	  
+
 	CNodeCreationManager *m_pNCManager;
 	const CAlphInfo *m_pAlphabet;
 	
   private:
 
-    /// 
+    ///
     /// Dump tree to stdout (debug)
     ///
-    
+
     void RecursiveDumpTree(SCENode *pCurrent, unsigned int iDepth);
-	  
+
 	///
-	/// Reference count 
+	/// Reference count
 	///
-	  
+
     int m_iRefCount;
-   
+
   };
   /// @}
 }
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index f91f0b9..5a0ee0d 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -162,7 +162,7 @@ void CDasherInterfaceBase::Realize() {
 
   CreateInput();
   CreateInputFilter();
-  
+
   ChangeAlphabet(); // This creates the NodeCreationManager, the Alphabet,
   //and the tree of nodes in the model. Now we can
   // Notify the teacher of the new model...ACL TODO pending merging of new
@@ -330,7 +330,7 @@ void CDasherInterfaceBase::InterfaceEventHandler(Dasher::CEvent *pEvent) {
         break;
     case LP_NODE_BUDGET:
       delete m_defaultPolicy;
-      m_defaultPolicy = new AmortizedPolicy(GetLongParameter(LP_NODE_BUDGET));  
+      m_defaultPolicy = new AmortizedPolicy(GetLongParameter(LP_NODE_BUDGET));
     default:
       break;
     }
@@ -372,7 +372,7 @@ void CDasherInterfaceBase::CreateNCManager() {
 
   //and start a new tree of nodes from it (retaining old offset -
   // this will be a sensible default of 0 if no nodes previously existed).
-  // This deletes the old tree of nodes... 
+  // This deletes the old tree of nodes...
   m_pDasherModel->SetOffset(m_pDasherModel->GetOffset(), m_pNCManager->GetAlphabetManager(), m_pDasherView, true);
 
   //...so now we can delete the old manager
@@ -424,7 +424,7 @@ void CDasherInterfaceBase::Stop() {
   if (m_pUserLog != NULL)
     m_pUserLog->StopWriting((float) GetNats());
 #endif
-  
+
   if (GetBoolParameter(BP_COPY_ALL_ON_STOP) && SupportsClipboard()) {
     CopyToClipboard(GetAllContext());
   }
@@ -515,7 +515,7 @@ void CDasherInterfaceBase::NewFrame(unsigned long iTime, bool bForceRedraw) {
   //check: if we were paused before, and the input filter didn't unpause,
   // then nothing can have changed:
   DASHER_ASSERT(!bWasPaused || !GetBoolParameter(BP_DASHER_PAUSED) || !bChanged);
-                
+
   // Flags at this stage:
   //
   // - bChanged = the display was updated, so needs to be rendered to the display
@@ -587,7 +587,7 @@ void CDasherInterfaceBase::ChangeAlphabet() {
   if (m_pNCManager) WriteTrainFileFull(); //can't/don't before creating first NCManager
 
   // Send a lock event
-  
+
   // Lock Dasher to prevent changes from happening while we're training.
 
   SetBoolParameter( BP_TRAINING, true );
@@ -950,8 +950,8 @@ void CDasherInterfaceBase::ChangeState(ETransition iTransition) {
 
   if(iNewState != ST_FORBIDDEN) {
     if (iNewState == ST_SHUTDOWN) {
-      ShutdownTimer();  
-      WriteTrainFileFull();      
+      ShutdownTimer();
+      WriteTrainFileFull();
     }
 
     m_iCurrentState = iNewState;
diff --git a/Src/DasherCore/DasherInterfaceBase.h b/Src/DasherCore/DasherInterfaceBase.h
index aa25183..1898726 100644
--- a/Src/DasherCore/DasherInterfaceBase.h
+++ b/Src/DasherCore/DasherInterfaceBase.h
@@ -15,14 +15,14 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __DasherInterfaceBase_h__
 #define __DasherInterfaceBase_h__
 
 ///
-/// \mainpage 
+/// \mainpage
 ///
 /// This is the Dasher source code documentation. Please try to keep
 /// it up to date!
@@ -51,7 +51,7 @@ namespace Dasher {
   class CDasherModel;
   class CEventHandler;
   class CEvent;
-  
+
   class CDasherInterfaceBase;
 }
 
@@ -167,7 +167,7 @@ public:
   ///
 
   void ResetParameter(int iParmater);
-  
+
   ///
   /// Obtain the permitted values for a string parameter - used to
   /// geneate preferences dialogues etc.
@@ -175,9 +175,9 @@ public:
 
   void GetPermittedValues(int iParameter, std::vector<std::string> &vList);
 
-  /// 
+  ///
   /// Get a list of settings which apply to a particular module
-  /// 
+  ///
 
   bool GetModuleSettings(const std::string &strName, SModuleSettings **pSettings, int *iCount);
 
@@ -208,15 +208,15 @@ public:
   ///Does this subclass support clipboard copying (i.e. the copyToClipboard(string) method?)
   /// Default is just to return false.
   virtual bool SupportsClipboard() {return false;}
-  
+
   ///Subclasses supporting speech should override to speak the supplied text
   /// (Default implementation does nothing)
   virtual void Speak(const std::string &text, bool bInterrupt) {}
-  
+
   ///Subclasses supporting clipboard operations should override to copy
   /// the specified text to the clipboard. (Default implementation does nothing).
   virtual void CopyToClipboard(const std::string &text) {}
-  
+
   class TextAction {
   public:
     TextAction(CDasherInterfaceBase *pMgr);
@@ -232,11 +232,11 @@ public:
     int m_iStartOffset;
     std::string strLast;
   };
-  
+
 
   /// @name Starting and stopping
   /// Methods used to instruct dynamic motion of Dasher to start or stop
-  /// @{ 
+  /// @{
 
   /// Stop Dasher - Sets BP_DASHER_PAUSED and executes any on-stop actions
   ///  (speech, clipboard - subclasses may override to do more).
@@ -260,7 +260,7 @@ public:
   /// \param filename name of training file, without path (e.g. "training_english_GB.txt")
   /// \param strNewText text to append
   ///
-  
+
   virtual void WriteTrainFile(const std::string &filename, const std::string &strNewText) {
   };
 
@@ -318,13 +318,13 @@ public:
   /// \retval The rate in characters per minute.
   /// TODO: Check that this is still used
 
-  double GetCurCPM();  
+  double GetCurCPM();
 
   /// Get current refresh rate.
   /// \retval The rate in frames per second
   /// TODO: Check that this is still used
 
-  double GetCurFPS();   
+  double GetCurFPS();
 
   /// Get the total number of nats (base-e bits) entered.
   /// \retval The current total
@@ -388,30 +388,30 @@ public:
 
   virtual void GameMessageOut(int message, const void* messagedata) {}
 
-  void ScheduleRedraw() { 
-    m_bRedrawScheduled = true; 
-  }; 
+  void ScheduleRedraw() {
+    m_bRedrawScheduled = true;
+  };
 
   ///Subclasses should return the contents of (the specified subrange of) the edit buffer
   virtual std::string GetContext(unsigned int iStart, unsigned int iLength)=0;
-  
+
   ///Subclasses should override to clear text edit box, etc., etc., but then
   /// call this (superclass) implementation as well to rebuild the model...
   virtual void ClearAllContext();
   virtual std::string GetAllContext()=0;
 
   /// Set a key value pair by name - designed to allow operation from
-  /// the command line.  Returns 0 on success, an error string on failure. 
+  /// the command line.  Returns 0 on success, an error string on failure.
   ///
   const char* ClSet(const std::string &strKey, const std::string &strValue);
 
   void ImportTrainingText(const std::string &strPath);
-  
+
   /// Flush the/all currently-written text to the user's training file(s).
   /// Just calls through to WriteTrainFileFull(this) on the AlphabetManager;
   /// public so e.g. iPhone can flush the buffer when app is backgrounded.
   void WriteTrainFileFull();
-  
+
 protected:
 
   /// @name Startup
@@ -431,11 +431,11 @@ protected:
   ///
 
   void OnUIRealised();
-	
+
   ///
   /// Creates a default set of modules. Override in subclasses to create any
   /// extra/different modules specific to the platform (eg input device drivers)
-  ///	
+  ///
   virtual void CreateModules();
 
   /// @}
@@ -444,7 +444,7 @@ protected:
 
   /// Draw a new Dasher frame, regardless of whether we're paused etc.
   /// \param iTime Current time in ms.
-  /// \param bForceRedraw 
+  /// \param bForceRedraw
   /// \todo See comments in cpp file for some functionality which needs to be re-implemented
   void NewFrame(unsigned long iTime, bool bForceRedraw);
 
@@ -483,23 +483,23 @@ protected:
 
  private:
 
-  //The default expansion policy to use - an amortized policy depending on the LP_NODE_BUDGET parameter. 
+  //The default expansion policy to use - an amortized policy depending on the LP_NODE_BUDGET parameter.
   CExpansionPolicy *m_defaultPolicy;
-  
-  /// @name Platform dependent utility functions 
+
+  /// @name Platform dependent utility functions
   /// These functions provide various platform dependent functions
   /// required by the core. A derived class is created for each
   /// supported platform which implements these.
   // @{
-  
-  /// 
+
+  ///
   /// Initialise the SP_SYSTEM_LOC and SP_USER_LOC paths - the exact
   /// method of doing this will be OS dependent
   ///
 
   virtual void SetupPaths() = 0;
 
-  /// 
+  ///
   /// Produce a list of filenames for alphabet files
   ///
 
@@ -508,7 +508,7 @@ protected:
   ///
   /// Produce a list of filenames for colour files
   ///
-  
+
   virtual void ScanColourFiles(std::vector<std::string> &vFileList) = 0;
 
   ///
@@ -541,7 +541,7 @@ protected:
   ///
 
   virtual void StartTimer() = 0;
-  
+
   ///
   /// Shutdown the callback timer (permenantly - this is called once
   /// Dasher is committed to closing).
@@ -555,7 +555,7 @@ protected:
   /// Provide a new CDasherInput input device object.
 
   void CreateInput();
-	
+
   void CreateInputFilter();
 
   void CreateModel(int iOffset);
@@ -569,7 +569,7 @@ protected:
   void DestroyActionButtons();
   void PositionActionButtons();
   bool DrawActionButtons();
-  
+
   std::deque<std::string> m_deGameModeStrings;
 
   std::vector<CActionButton *> m_vLeftButtons;
@@ -577,7 +577,7 @@ protected:
 
 
   /// @name Child components
-  /// Various objects which are 'owned' by the core. 
+  /// Various objects which are 'owned' by the core.
   /// @{
   CDasherModel *m_pDasherModel;
   CDasherScreen *m_DasherScreen;
@@ -588,9 +588,9 @@ protected:
   CAlphIO *m_AlphIO;
   CColourIO *m_ColourIO;
   CNodeCreationManager *m_pNCManager;
-  CUserLogBase *m_pUserLog; 
+  CUserLogBase *m_pUserLog;
   /// @}
-  
+
   ///builds up the word currently being entered for speech.
   std::string m_strCurrentWord;
 
@@ -605,7 +605,7 @@ protected:
   /// @}
 
   bool m_bLastChanged;
-  
+
   std::set<TextAction *> m_vTextActions;
 };
 /// @}
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index f603d39..b997302 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "../Common/Common.h"
@@ -66,7 +66,7 @@ CDasherModel::CDasherModel(CEventHandler *pEventHandler,
   m_Rootmax = 0;
   m_iDisplayOffset = 0;
   m_dTotalNats = 0.0;
- 
+
   // TODO: Need to rationalise the require conversion methods
 #ifdef JAPANESE
   m_bRequireConversion = true;
@@ -86,7 +86,7 @@ CDasherModel::CDasherModel(CEventHandler *pEventHandler,
 
 CDasherModel::~CDasherModel() {
   if (m_pLastOutput) m_pLastOutput->Leave();
-  
+
   if(oldroots.size() > 0) {
     delete oldroots[0];
     oldroots.clear();
@@ -131,7 +131,7 @@ void CDasherModel::Make_root(CDasherNode *pNewRoot) {
 
   DASHER_ASSERT(pNewRoot != NULL);
   DASHER_ASSERT(pNewRoot->Parent() == m_Root);
-  
+
   m_Root->DeleteNephews(pNewRoot);
   m_Root->SetFlag(NF_COMMITTED, true);
 
@@ -152,7 +152,7 @@ void CDasherModel::Make_root(CDasherNode *pNewRoot) {
   const myint range = m_Rootmax - m_Rootmin;
   m_Rootmax = m_Rootmin + (range * m_Root->Hbnd()) / GetLongParameter(LP_NORMALIZATION);
   m_Rootmin = m_Rootmin + (range * m_Root->Lbnd()) / GetLongParameter(LP_NORMALIZATION);
-  
+
   for(std::deque<SGotoItem>::iterator it(m_deGotoQueue.begin()); it != m_deGotoQueue.end(); ++it) {
     //Some of these co-ordinate pairs can be bigger than m_Rootmin_min - m_Rootmax_max,
     // hence using unsigned type...
@@ -190,27 +190,27 @@ bool CDasherModel::Reparent_root() {
   const myint lower(m_Root->Lbnd()), upper(m_Root->Hbnd());
   const myint iRange(upper-lower);
   myint iRootWidth(m_Rootmax - m_Rootmin);
-    
+
   // Fail if the new root is bigger than allowed by normalisation
   if(((myint((GetLongParameter(LP_NORMALIZATION) - upper)) / static_cast<double>(iRange)) >
-           (m_Rootmax_max - m_Rootmax)/static_cast<double>(iRootWidth)) || 
-      ((myint(lower) / static_cast<double>(iRange)) > 
+           (m_Rootmax_max - m_Rootmax)/static_cast<double>(iRootWidth)) ||
+      ((myint(lower) / static_cast<double>(iRange)) >
            (m_Rootmin - m_Rootmin_min) / static_cast<double>(iRootWidth))) {
-    //but cache the (currently-unusable) root node - else we'll keep recreating (and deleting) it on every frame... 
+    //but cache the (currently-unusable) root node - else we'll keep recreating (and deleting) it on every frame...
     oldroots.push_back(pNewRoot);
     return false;
   }
-  
+
   //don't uncommit until they reverse out of the node
   // (or committing would enter the node into the LM a second time)
-  
+
   //Update the root coordinates to reflect the new root
   DASHER_ASSERT(pNewRoot->GetFlag(NF_SEEN));
   m_Root = pNewRoot;
-    
+
   m_Rootmax = m_Rootmax + ((GetLongParameter(LP_NORMALIZATION) - upper) * iRootWidth) / iRange;
   m_Rootmin = m_Rootmin - (lower * iRootWidth) / iRange;
-    
+
   for(std::deque<SGotoItem>::iterator it(m_deGotoQueue.begin()); it != m_deGotoQueue.end(); ++it) {
     iRootWidth = it->iN2 - it->iN1;
     it->iN2 = it->iN2 + (myint((GetLongParameter(LP_NORMALIZATION) - upper)) * iRootWidth / iRange);
@@ -238,10 +238,10 @@ void CDasherModel::SetOffset(int iOffset, CAlphabetManager *pMgr, CDasherView *p
   if (m_Root && iOffset == GetOffset() && !bForce) return;
 
   if (m_pLastOutput) m_pLastOutput->Leave();
-  
+
   ClearRootQueue();
   delete m_Root;
-  
+
   m_Root = pMgr->GetRoot(NULL, 0,GetLongParameter(LP_NORMALIZATION), iOffset!=0, iOffset);
   if (iOffset) {
     //there were preceding characters. It's nonetheless possible that they weren't
@@ -252,16 +252,16 @@ void CDasherModel::SetOffset(int iOffset, CAlphabetManager *pMgr, CDasherView *p
     m_Root->Enter();
     // (of course, we don't do Output() - the context contains it already!)
     m_pLastOutput = m_Root;
-    
+
     //We also want to avoid training the LM on nodes representing already-written context
     m_Root->SetFlag(NF_COMMITTED, true);
-    
+
   } else
     m_pLastOutput = NULL;
-  
+
   // Create children of the root...
   ExpandNode(m_Root);
-	
+
   // Set the root coordinates so that the root node is an appropriate
   // size and we're not in any of the children
 
@@ -270,7 +270,7 @@ void CDasherModel::SetOffset(int iOffset, CAlphabetManager *pMgr, CDasherView *p
   //TODO somewhere round here, old code checked whether the InputFilter implemented
   // GetMinWidth, if so called LimitRoot w/that width - i.e., make sure iWidth
   // is no more than that minimum. Should we do something similar here???
-  
+
   int iWidth( static_cast<int>( (GetLongParameter(LP_MAX_Y) / (2.0*dFraction)) ) );
 
   m_Rootmin = GetLongParameter(LP_MAX_Y) / 2 - iWidth / 2;
@@ -298,7 +298,7 @@ void CDasherModel::Get_new_root_coords(dasherint X, dasherint Y, dasherint &r1,
   if(GetBoolParameter(BP_SLOW_START) &&
      ((iTime - m_iStartTime) < GetLongParameter(LP_SLOW_START_TIME)))
     dFactor = 0.1 * (1 + 9 * ((iTime - m_iStartTime) / static_cast<double>(GetLongParameter(LP_SLOW_START_TIME))));
-  else 
+  else
     dFactor = 1.0;
 
   iSteps = static_cast<int>(iSteps / dFactor);
@@ -321,7 +321,7 @@ void CDasherModel::Get_new_root_coords(dasherint X, dasherint Y, dasherint &r1,
 
 
   // Calculate what the extremes of the viewport will be when the
-  // point under the cursor is at the cross-hair. This is where 
+  // point under the cursor is at the cross-hair. This is where
   // we want to be in iSteps updates
 
   dasherint y1(Y - (Y2 * X) / (2 * iOX));
@@ -371,7 +371,7 @@ void CDasherModel::Get_new_root_coords(dasherint X, dasherint Y, dasherint &r1,
   // into the same proportions as it divides the screen (0-Y2). I.e., this
   // is the center of expansion - the point on the y-axis which everything
   // moves away from (or towards, if reversing).
-  
+
   //We prefer to compute C from the _original_ (y1,y2) pair, as this is more
   // accurate (and avoids drifting up/down when heading straight along the
   // x-axis in dynamic button modes). However...
@@ -410,22 +410,22 @@ void CDasherModel::OneStepTowards(myint miMousex, myint miMousey, unsigned long
   myint iNewMin, iNewMax;
   // works out next viewpoint
   Get_new_root_coords(miMousex, miMousey, iNewMin, iNewMax, iTime);
-  
+
   UpdateBounds(iNewMin, iNewMax, iTime, pAdded, pNumDeleted);
 }
 
 void CDasherModel::UpdateBounds(myint newRootmin, myint newRootmax, unsigned long iTime, Dasher::VECTOR_SYMBOL_PROB* pAdded, int* pNumDeleted) {
-  
+
   m_dTotalNats += log((newRootmax - newRootmin) / static_cast<double>(m_Rootmax - m_Rootmin));
 
   m_iDisplayOffset = (m_iDisplayOffset * 90) / 100;
-  
+
   // Now actually zoom to the new location
-  
+
   while (newRootmax >= m_Rootmax_max || newRootmin <= m_Rootmin_min) {
     // can't make existing root any bigger because of overflow. So force a new root
     // to be chosen (so that Dasher doesn't just stop!)...
-    
+
     //pick _child_ covering crosshair...
     const myint iWidth(m_Rootmax-m_Rootmin);
     for (CDasherNode::ChildMap::const_iterator it = m_Root->GetChildren().begin(), E = m_Root->GetChildren().end(); ;) {
@@ -438,7 +438,7 @@ void CDasherModel::UpdateBounds(myint newRootmin, myint newRootmax, unsigned lon
           // having Dasher stop seems reasonable!
           return;
         }
-        
+
         //make pChild the root node...
         //first we're gonna have to force it to be output, as a non-output root won't work...
         if (!pChild->GetFlag(NF_SEEN)) {
@@ -462,13 +462,13 @@ void CDasherModel::UpdateBounds(myint newRootmin, myint newRootmax, unsigned lon
       DASHER_ASSERT (it != E); //must find a child!
     }
   }
-  
+
   // Check that we haven't drifted too far. The rule is that we're not
   // allowed to let the root max and min cross the midpoint of the
   // screen.
   newRootmin = min(newRootmin, (myint)GetLongParameter(LP_OY) - 1 - m_iDisplayOffset);
-  newRootmax = max(newRootmax, (myint)GetLongParameter(LP_OY) + 1 - m_iDisplayOffset);  
-  
+  newRootmax = max(newRootmax, (myint)GetLongParameter(LP_OY) + 1 - m_iDisplayOffset);
+
   // Only allow the update if it won't make the
   // root too small. We should have re-generated a deeper root
   // before now already, but the original root is an exception.
@@ -495,7 +495,7 @@ void CDasherModel::OutputTo(CDasherNode *pNewNode, Dasher::VECTOR_SYMBOL_PROB* p
     OutputTo(pNewNode->Parent(), pAdded, pNumDeleted);
     if (pNewNode->Parent()) pNewNode->Parent()->Leave();
     pNewNode->Enter();
-    
+
     m_pLastOutput = pNewNode;
     pNewNode->Output(pAdded, GetLongParameter(LP_NORMALIZATION));
     pNewNode->SetFlag(NF_SEEN, true); //becomes NF_SEEN after output.
@@ -514,7 +514,7 @@ void CDasherModel::OutputTo(CDasherNode *pNewNode, Dasher::VECTOR_SYMBOL_PROB* p
       m_pLastOutput->Undo(pNumDeleted);
       m_pLastOutput->Leave(); //Should we? I think so, but the old code didn't...?
       m_pLastOutput->SetFlag(NF_SEEN, false);
-      
+
       m_pLastOutput = m_pLastOutput->Parent();
       if (m_pLastOutput) m_pLastOutput->Enter();
       else DASHER_ASSERT (!pNewNode); //both null
@@ -557,18 +557,18 @@ void CDasherModel::ExpandNode(CDasherNode *pNode) {
   if(m_bGameMode && pNode->GetFlag(NF_GAME) && pTeacher )
   {
     std::string strTargetUtf8Char(pTeacher->GetSymbolAtOffset(pNode->offset() + 1));
-      
+
     // Check if this is the last node in the sentence...
     if(strTargetUtf8Char == "GameEnd")
 	    pNode->SetFlag(NF_END_GAME, true);
 	  else if (!pNode->GameSearchChildren(strTargetUtf8Char)) {
       // Target character not found - not in our current alphabet?!?!
       // Let's give up!
-      pNode->SetFlag(NF_END_GAME, true); 
+      pNode->SetFlag(NF_END_GAME, true);
     }
   }
   ////////////////////////////
-  
+
 
 }
 
@@ -580,11 +580,11 @@ void CDasherModel::RenderToView(CDasherView *pView, CExpansionPolicy &policy) {
   while(pView->IsSpaceAroundNode(m_Rootmin,m_Rootmax)) {
     if (!Reparent_root()) break;
   }
-  
-  // The Render routine will fill iGameTargetY with the Dasher Coordinate of the 
+
+  // 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.
-  CDasherNode *pOutput = pView->Render(m_Root, m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, policy);  
+  CDasherNode *pOutput = pView->Render(m_Root, m_Rootmin + m_iDisplayOffset, m_Rootmax + m_iDisplayOffset, policy);
 
   /////////GAME MODE TEMP//////////////
   if(m_bGameMode)
@@ -601,7 +601,7 @@ void CDasherModel::RenderToView(CDasherView *pView, CExpansionPolicy &policy) {
   // TODO: Fix up stats
   // TODO: Is this the right way to handle this?
   OutputTo(pOutput, NULL, NULL);
-  
+
   while (CDasherNode *pNewRoot = m_Root->onlyChildRendered) {
 #ifdef DEBUG
     //if only one child was rendered, no other child covers the screen -
@@ -617,7 +617,7 @@ void CDasherModel::RenderToView(CDasherView *pView, CExpansionPolicy &policy) {
     } else
       break;
   }
-  
+
 }
 
 void CDasherModel::ScheduleZoom(long time, dasherint y1, dasherint y2) {
@@ -679,7 +679,7 @@ void CDasherModel::Offset(int iOffset) {
 
   if (GetBoolParameter(BP_SMOOTH_OFFSET))
     m_iDisplayOffset -= iOffset;
-} 
+}
 
 void CDasherModel::AbortOffset() {
   m_Rootmin += m_iDisplayOffset;
diff --git a/Src/DasherCore/DasherModel.h b/Src/DasherCore/DasherModel.h
index 17eeb39..30f0780 100644
--- a/Src/DasherCore/DasherModel.h
+++ b/Src/DasherCore/DasherModel.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __DasherModel_h__
@@ -42,7 +42,7 @@ namespace Dasher {
   class CDasherModel;
   class CDasherInterfaceBase;
   class CDasherView;
-  
+
   struct SLockData;
 }
 
@@ -77,7 +77,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   ///
   /// Update the root location with *one step* towards the specified
   /// co-ordinates - used by timer callbacks (for non-button modes)
-  void OneStepTowards(myint, myint, unsigned long iTime, Dasher::VECTOR_SYMBOL_PROB* pAdded = NULL, int* pNumDeleted = NULL);  
+  void OneStepTowards(myint, myint, unsigned long iTime, Dasher::VECTOR_SYMBOL_PROB* pAdded = NULL, int* pNumDeleted = NULL);
 
   ///
   /// Notify the framerate class that a new frame has occurred
@@ -90,7 +90,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   /// two button dynamic mode.
   ///
   void Offset(int iOffset);
- 
+
   ///
   /// Make the 'target' root coordinates match those currently visible, so any
   /// Offset(int) currently in progress (i.e. being smoothed over several
@@ -103,7 +103,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   ///
   /// Reset counter of total nats entered
   ///
- 
+
   void ResetNats() {
     m_dTotalNats = 0.0;
   }
@@ -116,12 +116,12 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
     return m_dTotalNats;
   }
 
-  /// 
+  ///
   /// @name Rendering
   /// Methods to do with rendering the model to a view
   /// @{
 
-  /// 
+  ///
   /// Render the model to a given view, and cause output to happen.
   /// Note, enqueues nodes onto the Expansion Policy, but does not apply it.
   ///
@@ -129,7 +129,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
 
   /// @}
 
-  /// 
+  ///
   /// @name Scheduled operation
   /// E.g. response to button mode
   /// @{
@@ -145,7 +145,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   void ScheduleZoom(long time, dasherint y1, dasherint y2);
 
   void ClearScheduledSteps();
-  
+
   ///
   /// Update the bounds of the root node for the next step in any
   /// still-in-progress zoom scheduled by ScheduleZoom (does nothing
@@ -173,10 +173,10 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   };
 
   ///
-  /// Rebuild the tree of nodes (may reuse the existing ones if !bForce). 
+  /// Rebuild the tree of nodes (may reuse the existing ones if !bForce).
   /// @param iLocation offset (cursor position) in attached buffer from which to obtain context
   /// @param pMgr Manager to use to create nodes
-  /// @param bForce if true, model should be completely rebuilt (even for 
+  /// @param bForce if true, model should be completely rebuilt (even for
   /// same offset) - characters at old offsets may have changed, or we have
   /// a new AlphabetManager. If false, assume buffer and alphabet unchanged,
   /// so no need to rebuild the model if an existing node covers this point.
@@ -192,8 +192,8 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   int GetOffset();
 
   /// Create the children of a Dasher node
-  void ExpandNode(CDasherNode * pNode); 
-  
+  void ExpandNode(CDasherNode * pNode);
+
  private:
 
   /// Common portion of OneStepTowards / NextScheduledStep, taking
@@ -206,7 +206,7 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
     myint iN1;
     myint iN2;
   };
-  
+
   // Pointers to various auxilliary objects
   CDasherInterfaceBase *m_pDasherInterface;
 
@@ -266,18 +266,18 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   //   framerate, used for control mode (ControlManager.cpp), but that's all I could find
   //   - and that seemed even worse, so I've removed it in favour of this here....?
   unsigned long m_iStartTime;
-  
+
   // Debug/performance information...
 
   // Information entered so far in this model
-  double m_dTotalNats; 
+  double m_dTotalNats;
 
   ///
   /// CDasherModel::Get_new_root_coords( myint Mousex,myint Mousey )
-  /// 
+  ///
   /// Calculate the new co-ordinates for the root node after a single
   /// update step. For further information, see Doc/geometry.tex.
-  /// 
+  ///
   /// \param mousex x mouse co-ordinate measured right to left.
   /// \param mousey y mouse co-ordinate measured top to bottom.
   /// \param iNewMin New root min
@@ -286,17 +286,17 @@ class Dasher::CDasherModel:public Dasher::CFrameRate, private NoClones
   ///
   void Get_new_root_coords(myint mousex, myint mousey, myint &iNewMin, myint &iNewMax, unsigned long iTime);
 
-  /// 
+  ///
   /// Make a child of the root into a new root
   ///
 
-  void Make_root(CDasherNode *pNewRoot); 
+  void Make_root(CDasherNode *pNewRoot);
 
   ///
   /// Make the parent of the current root into the new root (rebuilding if necessary) - used during backing off
   /// Return true if successful, false if couldn't.
   ///
-  bool Reparent_root(); 
+  bool Reparent_root();
 
   /// Handle the output caused by a change in node over the crosshair. Specifically,
   /// deletes from m_pLastOutput back to closest ancestor of pNewNode,
diff --git a/Src/DasherCore/DasherNode.cpp b/Src/DasherCore/DasherNode.cpp
index 4d7ab60..ef247fe 100644
--- a/Src/DasherCore/DasherNode.cpp
+++ b/Src/DasherCore/DasherNode.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "../Common/Common.h"
@@ -45,17 +45,17 @@ int Dasher::currentNumNodeObjects() {return iNumNodes;}
 CDasherNode::CDasherNode(CDasherNode *pParent, int iOffset, unsigned int iLbnd, unsigned int iHbnd, int iColour, const string &strDisplayText)
 : m_pParent(pParent), m_iOffset(iOffset), m_iLbnd(iLbnd), m_iHbnd(iHbnd), m_iColour(iColour), m_strDisplayText(strDisplayText) {
   DASHER_ASSERT(iHbnd >= iLbnd);
-	
+
   if (pParent) {
     DASHER_ASSERT(!pParent->GetFlag(NF_ALLCHILDREN));
     pParent->Children().push_back(this);
   }
 
   onlyChildRendered = NULL;
-	
+
   // Default flags (make a definition somewhere, pass flags to constructor?)
   m_iFlags = 0;
-	
+
   m_iRefCount = 0;
   iNumNodes++;
 }
@@ -83,7 +83,7 @@ void CDasherNode::Trace() const {
      OutputDebugString(out);
 
      if (m_Children) {
-     unsigned int i; 
+     unsigned int i;
      for (i=1;i<m_iChars;i++)
      m_Children[i]->Dump_node();
      }
@@ -128,7 +128,7 @@ void CDasherNode::OrphanChild(CDasherNode *pChild) {
       delete (*i);
     }
   }
-  
+
   pChild->m_pParent=NULL;
 
   Children().clear();
@@ -171,7 +171,7 @@ void CDasherNode::SetFlag(int iFlag, bool bValue) {
   else
     m_iFlags = m_iFlags & (~iFlag);
 }
- 
+
 void CDasherNode::SetParent(CDasherNode *pNewParent) {
   DASHER_ASSERT(pNewParent);
   DASHER_ASSERT(!pNewParent->GetFlag(NF_ALLCHILDREN));
@@ -182,14 +182,14 @@ void CDasherNode::SetParent(CDasherNode *pNewParent) {
 int CDasherNode::MostProbableChild() {
   int iMax(0);
   int iCurrent;
-  
+
   for(ChildMap::iterator it(m_mChildren.begin()); it != m_mChildren.end(); ++it) {
     iCurrent = (*it)->Range();
-    
+
     if(iCurrent > iMax)
       iMax = iCurrent;
   }
-  
+
   return iMax;
 }
 
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 3e809b8..f503208 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __DasherNode_h__
@@ -70,7 +70,7 @@ class Dasher::CDasherNode:private NoClones {
   ///Whether labels on child nodes should be displaced to the right of this node's label.
   /// (Default implementation returns true, subclasses should override if appropriate)
   virtual bool bShove() {return true;}
-  
+
   inline int offset() {return m_iOffset;}
   CDasherNode *onlyChildRendered; //cache that only one child was rendered (as it filled the screen)
 
@@ -115,7 +115,7 @@ class Dasher::CDasherNode:private NoClones {
   ///
   /// NF_END_GAME - Node is the last one of the phrase in game mode
   ///
-  /// 
+  ///
   /// @param iFlag The flag to set
   /// @param bValue The new value of the flag
   ///
@@ -176,11 +176,11 @@ class Dasher::CDasherNode:private NoClones {
   inline const ChildMap & GetChildren() const;
   inline unsigned int ChildCount() const;
   inline CDasherNode *Parent() const;
-  void SetParent(CDasherNode *pNewParent); 
+  void SetParent(CDasherNode *pNewParent);
   // TODO: Should this be here?
   CDasherNode *const Get_node_under(int, myint y1, myint y2, myint smousex, myint smousey);   // find node under given co-ords
-  
-  /// @brief Orphan a child of this node 
+
+  /// @brief Orphan a child of this node
   ///
   /// Deletes all other children, and the node itself
   ///
@@ -199,14 +199,14 @@ class Dasher::CDasherNode:private NoClones {
   ///
   void Delete_children();
   /// @}
-  
+
   ///
   /// Sees if a *child* / descendant of the specified node (not that node itself)
   /// represents the specified character. If so, set the child & intervening nodes'
   /// NF_GAME flag, and return true; otherwise, return false.
   ///
   bool GameSearchChildren(std::string strTargetUtf8Char);
-  
+
   /// @name Management routines (once accessed via NodeManager)
   /// @{
   /// Gets the node manager for this object. Meaning defined by subclasses,
@@ -216,41 +216,41 @@ class Dasher::CDasherNode:private NoClones {
   ///
   /// Provide children for the supplied node
   ///
-  
+
   virtual void PopulateChildren() = 0;
-  
+
   /// The number of children which a call to PopulateChildren can be expected to generate.
   /// (This is not required to be 100% accurate, but any discrepancies will likely cause
   /// the node budgetting algorithm to behave sub-optimally)
   virtual int ExpectedNumChildren() = 0;
-    
+
   ///
-  /// Called whenever a node belonging to this manager first 
+  /// Called whenever a node belonging to this manager first
   /// moves under the crosshair
   ///
-  
+
   virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {};
   virtual void Undo(int *pNumDeleted) {};
-  
+
   virtual void Enter() {};
   virtual void Leave() {};
-  
+
   virtual CDasherNode *RebuildParent() {
     return 0;
   };
-  
+
   ///
   /// Get as many symbols of context, up to the _end_ of the specified range,
   /// as possible from this node and its uncommitted ancestors
   ///
   virtual void GetContext(CDasherInterfaceBase *pInterface, const CAlphabetMap *pAlphabetMap, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
-  
+
   ///
   /// See if this node represents the specified alphanumeric character; if so, set it's NF_GAME flag and
   /// return true; otherwise, return false.
   ///
   virtual bool GameSearchNode(std::string strTargetUtf8Char) {return false;}
-  
+
   /// Clone the context of the specified node, if it's an alphabet node;
   /// else return an empty context. (Used by ConversionManager)
   virtual CLanguageModel::Context CloneAlphContext(CLanguageModel *pLanguageModel) {
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index 3384493..f2e4004 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #include "../Common/Common.h"
@@ -61,7 +61,7 @@ static char THIS_FILE[] = __FILE__;
 CDasherViewSquare::CDasherViewSquare(CEventHandler *pEventHandler, CSettingsStore *pSettingsStore, CDasherScreen *DasherScreen)
 : CDasherView(pEventHandler, pSettingsStore, DasherScreen),   m_Y1(4), m_Y2(0.95 * GetLongParameter(LP_MAX_Y)), m_Y3(0.05 * GetLongParameter((LP_MAX_Y))), m_bVisibleRegionValid(false) {
 
-  //Note, nonlinearity parameters set in SetScaleFactor 
+  //Note, nonlinearity parameters set in SetScaleFactor
   ChangeScreen(DasherScreen);
 }
 
@@ -115,7 +115,7 @@ CDasherNode *CDasherViewSquare::Render(CDasherNode *pRoot, myint iRootMin, myint
   if (GetLongParameter(LP_SHAPE_TYPE)==0) { //disjoint rects, so go round root
     if(iRootMin > iDasherMinY)
       DasherDrawRectangle(iDasherMaxX, iDasherMinY, iDasherMinX, iRootMin, 0, -1, 0);
-  
+
     if(iRootMax < iDasherMaxY)
       DasherDrawRectangle(iDasherMaxX, iRootMax, iDasherMinX, iDasherMaxY, 0, -1, 0);
 
@@ -125,7 +125,7 @@ CDasherNode *CDasherViewSquare::Render(CDasherNode *pRoot, myint iRootMin, myint
 
     //to right (margin)
     DasherDrawRectangle(0, iDasherMinY, iDasherMinX, iDasherMaxY, 0, -1, 0);
-    
+
     //and render root.
     DisjointRender(pRoot, iRootMin, iRootMax, NULL, policy, std::numeric_limits<double>::infinity(), 0, pOutput);
   } else {
@@ -138,7 +138,7 @@ CDasherNode *CDasherViewSquare::Render(CDasherNode *pRoot, myint iRootMin, myint
   for (vector<CTextString *>::iterator it=m_DelayedTexts.begin(), E=m_DelayedTexts.end(); it!=E; it++)
     DoDelayedText(*it);
   m_DelayedTexts.clear();
-  
+
   // Finally decorate the view
   Crosshair((myint)GetLongParameter(LP_OX));
   return pOutput;
@@ -149,10 +149,10 @@ CDasherNode *CDasherViewSquare::Render(CDasherNode *pRoot, myint iRootMin, myint
 /// the leading edge of the containing box.
 
 CDasherViewSquare::CTextString *CDasherViewSquare::DasherDrawText(myint iDasherMaxX, myint iDasherMidY, const std::string &sDisplayText, CTextString *pParent, int iColor) {
-  
+
   screenint x,y;
   Dasher2Screen(iDasherMaxX, iDasherMidY, x, y);
-  
+
   //compute font size...
   int iSize = GetLongParameter(LP_DASHER_FONTSIZE);
   {
@@ -172,7 +172,7 @@ CDasherViewSquare::CTextString *CDasherViewSquare::DasherDrawText(myint iDasherM
         iSize *= 11;
     }
   }
-  
+
   CTextString *pRet = new CTextString(sDisplayText, x, y, iSize, iColor);
   vector<CTextString *> &dest(pParent ? pParent->m_children : m_DelayedTexts);
   dest.push_back(pRet);
@@ -180,9 +180,9 @@ CDasherViewSquare::CTextString *CDasherViewSquare::DasherDrawText(myint iDasherM
 }
 
 void CDasherViewSquare::DoDelayedText(CTextString *pText) {
-  
+
   Dasher::Opts::ScreenOrientations orient = Dasher::Opts::ScreenOrientations(GetLongParameter(LP_REAL_ORIENTATION));
-  
+
   //note that it'd be better to compute old-style font sizes here, or even after shunting
   // across according to the aiMax array, but this needs Dasher co-ordinates, which were
   // more easily available at CTextString creation time. If it really doesn't look as good,
@@ -244,7 +244,7 @@ void CDasherViewSquare::DoDelayedText(CTextString *pText) {
     }
   }
   free(pText);
-}  
+}
 
 CDasherViewSquare::CTextString::~CTextString() {
   for (vector<CTextString *>::iterator it = m_children.begin(); it!=m_children.end(); it++)
@@ -255,8 +255,8 @@ void CDasherViewSquare::TruncateTri(myint x, myint y1, myint y2, myint midy1, my
   DASHER_ASSERT (y1<=midy1 && midy1<=midy2 && midy2<=y2);
   myint iVisibleMinX, iVisibleMaxX, iVisibleMinY, iVisibleMaxY;
   VisibleRegion(iVisibleMinX, iVisibleMinY, iVisibleMaxX, iVisibleMaxY);
-  
-  myint x1(x), x2(x); //(max)x-coords of the two lines 
+
+  myint x1(x), x2(x); //(max)x-coords of the two lines
   myint tempx1(0),tempx2(0); //& min x-coords
   //intersect y1's diagonal with screen
   if (!ClipLineToVisible(x1,midy1,tempx1,y1)) {
@@ -279,7 +279,7 @@ void CDasherViewSquare::TruncateTri(myint x, myint y1, myint y2, myint midy1, my
     // (i.e., the point of max x is off the top/off the bottom), in which case
     // the other line is entirely offscreen:
     DASHER_ASSERT(midy1 == midy2); //point/line of max x has been removed
-    
+
     if (x1<x2) {
       //(0,y1) - (x1,midy1) hit max-y edge of screen
       //(0,y2) - (x2,midy2) entirely offscreen
@@ -303,11 +303,11 @@ void CDasherViewSquare::TruncateTri(myint x, myint y1, myint y2, myint midy1, my
     Dasher2Screen(0, iVisibleMinY, pts.back().x, pts.back().y);
   }
   //that gets us to the min-y (y1) end of the line along the y-axis
-  
+
   //add line along y-axis...
   pts.push_back(CDasherScreen::point());
   Dasher2Screen(0, y2, pts.back().x, pts.back().y);
-  
+
   if (tempx2) {
     //y2's diagonal did not reach y-axis
     DASHER_ASSERT(y2 == iVisibleMaxY);
@@ -316,7 +316,7 @@ void CDasherViewSquare::TruncateTri(myint x, myint y1, myint y2, myint midy1, my
   }
   //and the diagonal part...
   DasherLine2Screen(tempx2, y2, x2, midy2, pts);
-  
+
   if (midy1 != midy2) {
     //is the max-x extent a line, after cropping - i.e. handles both
     // normal triangle (orig midy1==orig midy2) being cropped to screen edge,
@@ -325,7 +325,7 @@ void CDasherViewSquare::TruncateTri(myint x, myint y1, myint y2, myint midy1, my
     pts.push_back(CDasherScreen::point());
     Dasher2Screen(x1, midy1, pts.back().x, pts.back().y);
   } else DASHER_ASSERT(pts.back().x == pts[0].x && pts.back().y == pts[0].y);
-  
+
   CDasherScreen::point *p_array=new CDasherScreen::point[pts.size()];
   for (unsigned int i = 0; i<pts.size(); i++) p_array[i] = pts[i];
   Screen()->Polygon(p_array, pts.size(), fillColor, outlineColor, lineWidth);
@@ -352,7 +352,7 @@ void CDasherViewSquare::Circle(myint Range, myint y1, myint y2, int fCol, int oC
   }
   Dasher2Screen(x1,y1,p.x,p.y);
   pts.push_back(p);
-  
+
   //and along top...
   if (y2 > iDasherMaxY) {
     //intersect...
@@ -416,7 +416,7 @@ void CDasherViewSquare::Quadric(myint Range, myint lowY, myint highY, int fillCo
       Dasher2Screen(min(maxX,myint(of*of*x1 + 2.0*of*f*x2 + f*f*x3)),max(minY,min(maxY,myint(of*of*y1 + 2.0*of*f*y2 + f*f*y3))), p_array[i+NUM_STEPS+1].x, p_array[i+NUM_STEPS+1].y);
     }
   }
-  
+
   Screen()->Polygon(p_array, 2*NUM_STEPS+2, fillColor, outlineColour, lineWidth);
 #undef NUM_STEPS
 }
@@ -431,7 +431,7 @@ bool CDasherViewSquare::IsSpaceAroundNode(myint y1, myint y2) {
   const myint maxX(y2-y1);
   if ((maxX < iVisibleMaxX) || (y1 > iVisibleMinY) || (y2 < iVisibleMaxY))
     return true; //space around sq => space around anything smaller!
-  
+
   //in theory, even if the crosshair is off-screen (!), anything spanning y1-y2 should cover it...
   DASHER_ASSERT (CoversCrosshair(y2-y1, y1, y2));
 
@@ -468,19 +468,19 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
 					int parent_color, CDasherNode *&pOutput)
 {
   DASHER_ASSERT_VALIDPTR_RW(pRender);
-  
+
   ++m_iRenderCount;
- 
+
   // Set the NF_SUPER flag if this node entirely frames the visual
   // area.
-  
+
   myint iDasherMinX;
   myint iDasherMinY;
   myint iDasherMaxX;
   myint iDasherMaxY;
   VisibleRegion(iDasherMinX, iDasherMinY, iDasherMaxX, iDasherMaxY);
   pRender->SetFlag(NF_SUPER, (y2-y1 >= iDasherMaxX) && (y1 <= iDasherMinY) && (y2 >= iDasherMaxY));
-  
+
   const int myColor = pRender->getColour();
 
   const std::string &sDisplayText(pRender->getDisplayText());
@@ -491,7 +491,7 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
           ny2 = std::min(iDasherMaxY, std::max(iDasherMinY, y2));
     CTextString *pText = DasherDrawText(y2-y1, (ny1+ny2)/2, sDisplayText, pPrevText, textColor);
     if (pRender->bShove()) pPrevText = pText;
-  }	
+  }
 
   const myint Range(y2-y1);
 
@@ -517,12 +517,12 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
     // at worst, all kinds of crashes trying to do text output!)
     if (!pRender->GetFlag(NF_GAME) && pRender != pOutput)
       dMaxCost = policy.pushNode(pRender, y1, y2, false, dMaxCost);
-    
-    // Render children  
+
+    // Render children
     int norm = (myint)GetLongParameter(LP_NORMALIZATION);
-    
+
     int id=-1;
-    
+
     if (CDasherNode *pChild = pRender->onlyChildRendered)
     {
       //if child still covers screen, render _just_ it and return
@@ -531,17 +531,17 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
       if (newy1 < iDasherMinY && newy2 > iDasherMaxY) {
         //still covers entire screen. Parent should too...
         DASHER_ASSERT(dMaxCost == std::numeric_limits<double>::infinity());
-        
+
         if (newy2-newy1 < iDasherMaxX) //fill in to it's left...
           DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(y1,iDasherMinY), newy2-newy1, std::min(y2,iDasherMaxY), myColor, -1, 0);
-        DisjointRender(pChild, newy1, newy2, pPrevText, 
+        DisjointRender(pChild, newy1, newy2, pPrevText,
                         policy, dMaxCost, myColor, pOutput);
         //leave pRender->onlyChildRendered set, so remaining children are skipped
       }
       else
         pRender->onlyChildRendered = NULL;
     }
-        
+
     if (!pRender->onlyChildRendered) {
       //render all children...
       myint lasty=y1;
@@ -549,7 +549,7 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
         i != pRender->GetChildren().end(); i++) {
         id++;
         CDasherNode *pChild = *i;
-        
+
         myint newy1 = y1 + (Range * (myint)pChild->Lbnd()) / (myint)norm;/// norm and lbnd are simple ints
         myint newy2 = y1 + (Range * (myint)pChild->Hbnd()) / (myint)norm;
         if (newy1 < iDasherMinY && newy2 > iDasherMaxY) {
@@ -570,7 +570,7 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
           //child should be rendered!
           //fill in to its left
           DasherDrawRectangle(std::min(y2-y1,iDasherMaxX), std::max(newy1,iDasherMinY), std::min(newy2-newy1,iDasherMaxX), std::min(newy2,iDasherMaxY), myColor, -1, 0);
-        
+
           if (std::max(lasty,iDasherMinY)<newy1) //fill in interval above child up to the last drawn child
             DasherDrawRectangle(std::min(Range,iDasherMaxX), std::max(lasty,iDasherMinY),0, std::min(newy1,iDasherMaxY), myColor, -1, 0);
           lasty = newy2;
@@ -578,7 +578,7 @@ void CDasherViewSquare::DisjointRender(CDasherNode *pRender, myint y1, myint y2,
         } else {
           // We get here if the node is too small to render or is off-screen.
           // So, collapse it immediately.
-          // 
+          //
           // In game mode, we get here if the child is too small to draw, but we need the
           // coordinates - if this is the case then we shouldn't delete any children.
           if(!pChild->GetFlag(NF_GAME | NF_SEEN))
@@ -624,7 +624,7 @@ bool CDasherViewSquare::CoversCrosshair(myint Range, myint y1, myint y2) {
         // however, note that the circle is bigger, so this'll output things
         // too soon/aggressively :-(.
         // (hence, fallthrough to:)
-      case 5: { //circles - actually ellipses, as x diameter is twice y diameter, hence the *4 
+      case 5: { //circles - actually ellipses, as x diameter is twice y diameter, hence the *4
         const myint y_dist(GetLongParameter(LP_OY) - (y1+y2)/2);
         return GetLongParameter(LP_OX) * GetLongParameter(LP_OX) + y_dist*y_dist*4 < Range*Range;
       }
@@ -642,21 +642,21 @@ void CDasherViewSquare::NewRender(CDasherNode *pRender, myint y1, myint y2,
 	// pushing another stack frame:
 beginning:
   DASHER_ASSERT_VALIDPTR_RW(pRender);
-  
+
   ++m_iRenderCount;
-  
+
   // Set the NF_SUPER flag if this node entirely frames the visual
   // area.
-  
+
   myint iDasherMinX;
   myint iDasherMinY;
   myint iDasherMaxX;
   myint iDasherMaxY;
   VisibleRegion(iDasherMinX, iDasherMinY, iDasherMaxX, iDasherMaxY);
   pRender->SetFlag(NF_SUPER, !IsSpaceAroundNode(y1, y2));
-  
+
   const int myColor = pRender->getColour();
-  
+
   const std::string &sDisplayText(pRender->getDisplayText());
   if( sDisplayText.size() > 0 )
   {
@@ -665,21 +665,21 @@ beginning:
     ny2 = std::min(iDasherMaxY, std::max(iDasherMinY, y2));
     CTextString *pText = DasherDrawText(y2-y1, (ny1+ny2)/2, sDisplayText, pPrevText, textColor);
     if (pRender->bShove()) pPrevText = pText;
-  }	
-  
+  }
+
   const myint Range(y2-y1);
   // Draw node...we can both fill & outline in one go, since
   // we're drawing the whole node at once (unlike disjoint-rects),
   // as any part of the outline which is obscured by a child node,
   // will have the outline of the child node painted over it,
   // and all outlines are the same colour.
-  
+
   //"invisible" nodes are given same colour as parent, so we neither fill
   // nor outline them. TODO this isn't quite right, as nodes that are
   // _supposed_ to be the same colour as their parent, will have no outlines...
   // (thankfully having 2 "phases" means this doesn't happen in standard
   // colour schemes)
-  if (myColor!=parent_color) { 
+  if (myColor!=parent_color) {
 	//outline width 0 = fill only; >0 = fill + outline; <0 = outline only
 	int fillColour = GetLongParameter(LP_OUTLINE_WIDTH)>=0 ? myColor : -1;
 	int lineWidth = abs(GetLongParameter(LP_OUTLINE_WIDTH));
@@ -701,11 +701,11 @@ beginning:
         break;
     }
   }
-  
+
   //Does node cover crosshair?
   if (pOutput == pRender->Parent() && CoversCrosshair(Range, y1, y2))
     pOutput = pRender;
-  
+
   if (pRender->ChildCount() == 0) {
     if (pOutput==pRender) {
       //covers crosshair! forcibly populate, now!
@@ -726,7 +726,7 @@ beginning:
   }
   //Node has children - either it already did, or else it covers the crosshair,
   // and we've just made them...so render them.
-  
+
   const unsigned int norm(GetLongParameter(LP_NORMALIZATION));
   //first check if there's only one child we need to render
   if (CDasherNode *pChild = pRender->onlyChildRendered) {
@@ -742,13 +742,13 @@ beginning:
     }
     pRender->onlyChildRendered = NULL;
   }
-    
+
   //ok, need to render all children...
   myint newy1=y1,newy2;
   CDasherNode::ChildMap::const_iterator I = pRender->GetChildren().begin(), E = pRender->GetChildren().end();
   while (I!=E) {
     CDasherNode *pChild(*I);
-        
+
     newy2 = y1 + (Range * (myint)pChild->Hbnd()) / (myint)norm;
     if (newy1<=iDasherMaxY && newy2 >= iDasherMinY) { //onscreen
       if (newy2-newy1 > GetLongParameter(LP_MIN_NODE_SIZE)) {
@@ -813,7 +813,7 @@ void CDasherViewSquare::Screen2Dasher(screenint iInputX, screenint iInputY, myin
 
   iDasherX = ixmap(iDasherX);
   iDasherY = iymap(iDasherY);
-  
+
 }
 
 void CDasherViewSquare::SetScaleFactor( void )
@@ -821,23 +821,23 @@ void CDasherViewSquare::SetScaleFactor( void )
   //Parameters for X non-linearity.
   // Set some defaults here, in case we change(d) them later...
   m_iXlogThres=GetLongParameter(LP_MAX_Y)/2; //threshold: DasherX's less than this are linear; those greater are logarithmic
-  
+
   //set log scaling coefficient (unused if LP_NONLINEAR_X==0)
   // note previous value = 1/0.2, i.e. a value of LP_NONLINEAR_X =~= 4.8
-  m_dXlogCoeff = exp(GetLongParameter(LP_NONLINEAR_X)/3.0); 
-  
+  m_dXlogCoeff = exp(GetLongParameter(LP_NONLINEAR_X)/3.0);
+
   const Dasher::Opts::ScreenOrientations eOrientation(Dasher::Opts::ScreenOrientations(GetLongParameter(LP_REAL_ORIENTATION)));
   const bool bHoriz(eOrientation == Dasher::Opts::LeftToRight || eOrientation == Dasher::Opts::RightToLeft);
   const screenint iScreenWidth(Screen()->GetWidth()), iScreenHeight(Screen()->GetHeight());
   const double dPixelsX(bHoriz ? iScreenWidth : iScreenHeight), dPixelsY(bHoriz ? iScreenHeight : iScreenWidth);
-  
+
   const myint lpMaxY(GetLongParameter(LP_MAX_Y));
-  
+
   //Defaults/starting values, will be modified later according to scheme in use...
   iMarginWidth = GetLongParameter(LP_MARGIN_WIDTH);
   double dScaleFactorY(dPixelsY / lpMaxY );
   double dScaleFactorX(dPixelsX / static_cast<double>(lpMaxY + iMarginWidth) );
-      
+
   switch (GetLongParameter(LP_GEOMETRY)) {
     case 0: {
       //old style
@@ -905,13 +905,13 @@ void CDasherViewSquare::SetScaleFactor( void )
       std::cout << "ERROR ScreenY " << y << " becomes " << dy << " back to " << fy << std::endl;
   }
 #endif
-  
+
   CScreenGeomEvent evt;
   InsertEvent(&evt);
 }
 
 
-inline myint CDasherViewSquare::CustomIDiv(myint iNumerator, myint iDenominator) { 
+inline myint CDasherViewSquare::CustomIDiv(myint iNumerator, myint iDenominator) {
   // Integer division rounding away from zero
 
   long long int num, denom, quot, rem;
@@ -931,7 +931,7 @@ inline myint CDasherViewSquare::CustomIDiv(myint iNumerator, myint iDenominator)
   quot = num / denom;
   rem  = num % denom;
 #endif
-  
+
   if (rem < 0)
     res = quot - 1;
   else if (rem > 0)
@@ -950,7 +950,7 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
 
   iDasherX = xmap(iDasherX);
   iDasherY = ymap(iDasherY);
-  
+
   // Things we're likely to need:
 
   //myint iDasherWidth = (myint)GetLongParameter(LP_MAX_Y);
@@ -967,7 +967,7 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
 
   switch( eOrientation ) {
   case Dasher::Opts::LeftToRight:
-    iScreenX = screenint(iScreenWidth - 
+    iScreenX = screenint(iScreenWidth -
 			 CustomIDiv((( iDasherX ) * iScaleFactorX), m_iScalingFactor));
     iScreenY = screenint(iScreenHeight / 2 +
 			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
@@ -975,17 +975,17 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
   case Dasher::Opts::RightToLeft:
     iScreenX = screenint(
 			 CustomIDiv(( iDasherX ) * iScaleFactorX, m_iScalingFactor));
-    iScreenY = screenint(iScreenHeight / 2 + 
+    iScreenY = screenint(iScreenHeight / 2 +
 			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
     break;
   case Dasher::Opts::TopToBottom:
-    iScreenX = screenint(iScreenWidth / 2 + 
+    iScreenX = screenint(iScreenWidth / 2 +
 			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
-    iScreenY = screenint(iScreenHeight - 
+    iScreenY = screenint(iScreenHeight -
 			 CustomIDiv(( iDasherX ) * iScaleFactorX, m_iScalingFactor));
     break;
   case Dasher::Opts::BottomToTop:
-    iScreenX = screenint(iScreenWidth / 2 + 
+    iScreenX = screenint(iScreenWidth / 2 +
 			 CustomIDiv(( iDasherY - iDasherHeight / 2 ) * iScaleFactorY, m_iScalingFactor));
     iScreenY = screenint(
 			 CustomIDiv(( iDasherX ) * iScaleFactorX, m_iScalingFactor));
@@ -996,12 +996,12 @@ void CDasherViewSquare::Dasher2Screen(myint iDasherX, myint iDasherY, screenint
 void CDasherViewSquare::Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta) {
 	iDasherX = xmap(iDasherX);
     iDasherY = ymap(iDasherY);
-	
+
   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); 
+
+    double x = -(iDasherX - iDasherOX) / double(iDasherOX); //Use normalised coords so min r works
+    double y = -(iDasherY - iDasherOY) / double(iDasherOY);
     theta = atan2(y, x);
     r = sqrt(x * x + y * y);
 }
@@ -1035,7 +1035,7 @@ void CDasherViewSquare::DasherLine2Screen(myint x1, myint y1, myint x2, myint y2
         myint xMid=(x1+x2)/2, yMid=(y1+y2)/2;
         CDasherScreen::point pDasherMid;
         Dasher2Screen(xMid, yMid, pDasherMid.x, pDasherMid.y);
-        
+
         //since we know both endpoints are in the same section of the screen wrt. Y nonlinearity,
         //the midpoint along the DasherY axis of both lines should be the same.
         const Dasher::Opts::ScreenOrientations orient(Dasher::Opts::ScreenOrientations(GetLongParameter(LP_REAL_ORIENTATION)));
@@ -1075,7 +1075,7 @@ void CDasherViewSquare::VisibleRegion( myint &iDasherMinX, myint &iDasherMinY, m
   if(!m_bVisibleRegionValid) {
 
     int eOrientation( GetLongParameter(LP_REAL_ORIENTATION) );
-    
+
     switch( eOrientation ) {
     case Dasher::Opts::LeftToRight:
       Screen2Dasher(Screen()->GetWidth(),0,m_iDasherMinX,m_iDasherMinY);
@@ -1094,7 +1094,7 @@ void CDasherViewSquare::VisibleRegion( myint &iDasherMinX, myint &iDasherMinY, m
       Screen2Dasher(Screen()->GetWidth(),Screen()->GetHeight(),m_iDasherMaxX,m_iDasherMaxY);
       break;
     }
-    
+
     m_bVisibleRegionValid = true;
   }
 
diff --git a/Src/DasherCore/DasherViewSquare.h b/Src/DasherCore/DasherViewSquare.h
index 65eae5e..f514a02 100644
--- a/Src/DasherCore/DasherViewSquare.h
+++ b/Src/DasherCore/DasherViewSquare.h
@@ -59,18 +59,18 @@ public:
 
   virtual void HandleEvent(Dasher::CEvent * pEvent);
 
-  /// 
+  ///
   /// Supply a new screen to draw to
   ///
 
   void ChangeScreen(CDasherScreen * NewScreen);
 
-  /// 
+  ///
   /// @name Coordinate system conversion
   /// Convert between screen and Dasher coordinates
   /// @{
 
-  /// 
+  ///
   /// Convert a screen co-ordinate to Dasher co-ordinates
   ///
   void Screen2Dasher(screenint iInputX, screenint iInputY, myint & iDasherX, myint & iDasherY);
@@ -83,9 +83,9 @@ public:
   ///
   /// Convert Dasher co-ordinates to polar co-ordinates (r,theta), with 0<r<1, 0<theta<2*pi
   ///
-  virtual void Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta);	
-	
-  /// 
+  virtual void Dasher2Polar(myint iDasherX, myint iDasherY, double &r, double &theta);
+
+  ///
   /// Return true if there is any space around a node spanning y1 to y2
   /// and the screen boundary; return false if such a node entirely encloses
   /// the screen boundary
@@ -116,7 +116,7 @@ private:
   ///draw isoceles triangle, with baseline from y1-y2 along y axis (x=0), and other point at (x,(y1+y2)/2)
   /// (all in Dasher coords).
   void Triangle(myint x, myint y1, myint y2, int fillColor, int outlineColor, int lineWidth);
-  
+
   class CTextString {
   public: //to CDasherViewSquare...
     ///Creates a request that string str will be drawn.
@@ -130,25 +130,25 @@ private:
     screenint m_ix,m_iy;
     vector<CTextString *> m_children;
     int m_iSize;
-    int m_iColor;    
+    int m_iColor;
   };
-  
+
   std::vector<CTextString *> m_DelayedTexts;
 
   void DoDelayedText(CTextString *pText);
   ///
   /// Draw text specified in Dasher co-ordinates
   ///
-  
+
   CTextString *DasherDrawText(myint iMaxX, myint iMidY, const std::string & sDisplayText, CTextString *pParent, int iColor);
-  
+
   ///
   /// (Recursively) render a node and all contained subnodes, in disjoint rects.
   /// (i.e. appropriate for LP_SHAPE_TYPE==0). Each call responsible for rendering
   /// exactly the area contained within the node.
   /// @param pOutput The innermost node covering the crosshair (if any)
   void DisjointRender(CDasherNode * Render, myint y1, myint y2, CTextString *prevText, CExpansionPolicy &policy, double dMaxCost,int parent_color, CDasherNode *&pOutput);
-  
+
   /// (Recursively) render a node and all contained subnodes, in overlapping shapes
   /// (according to LP_SHAPE_TYPE: 1=rects, 2=triangles, 3=truncated triangles,
   /// 4=quadrics, 5=semicircles)
@@ -167,41 +167,41 @@ private:
  	   return floor(d);
     else
  	   return ceil(d);
- 
+
   };
 #endif
 
   /// @name Nonlinearity
   /// Implements the non-linear part of the coordinate space mapping
-  
+
   /// Maps a dasher coordinate (linear in probability space, -ive x = in margin) to an abstract/resolution-independent
   /// screen coordinate (linear in screen space, -ive x = offscreen) - i.e. pixel coordinate = scale({x,y}map(dasher coord)))
   inline myint ymap(myint iDasherY) const;
   inline myint xmap(myint iDasherX) const;
-  
+
   /// Inverse of the previous - i.e. dasher coord = iymap(scale(screen coord))
   inline myint iymap(myint y) const;
   inline myint ixmap(myint x) const;
-  
+
   ///Parameters for y non-linearity. (TODO Make into preprocessor defines?)
   const myint m_Y1, m_Y2, m_Y3;
 
   inline void Crosshair(myint sx);
   bool CoversCrosshair(myint Range,myint y1,myint y2);
-  
+
   inline myint CustomIDiv(myint iNumerator, myint iDenominator);
 
   void DasherLine2Screen(myint x1, myint y1, myint x2, myint y2, vector<CDasherScreen::point> &vPoints);
 
   bool m_bVisibleRegionValid;
-  
+
   // Called on screen size or orientation changes
   void SetScaleFactor();
 
   // Parameters for x non-linearity
   double m_dXlogCoeff;
   myint m_iXlogThres;
-  
+
   //width of margin, in abstract screen coords
   myint iMarginWidth;
 
diff --git a/Src/DasherCore/DefaultFilter.cpp b/Src/DasherCore/DefaultFilter.cpp
index 4d92fe8..0a149a8 100644
--- a/Src/DasherCore/DefaultFilter.cpp
+++ b/Src/DasherCore/DefaultFilter.cpp
@@ -31,7 +31,7 @@ CDefaultFilter::CDefaultFilter(Dasher::CEventHandler * pEventHandler, CSettingsS
 
   // Initialize autocalibration (i.e. seen nothing yet)
   m_iSum = 0;
-  
+
   m_iCounter = 0;
 }
 
@@ -41,7 +41,7 @@ CDefaultFilter::~CDefaultFilter() {
 }
 
 bool CDefaultFilter::DecorateView(CDasherView *pView, CDasherInput *pInput) {
-  
+
   bool bDidSomething(false);
 
   if(GetBoolParameter(BP_DRAW_MOUSE)) {
@@ -74,13 +74,13 @@ bool CDefaultFilter::DecorateView(CDasherView *pView, CDasherInput *pInput) {
   const int noOfPoints = 18;
   myint X[noOfPoints];
   myint Y[noOfPoints];
-  myint CenterXY[2]; 
+  myint CenterXY[2];
   X[0] = x[0];
   Y[0] = y[0];
   X[noOfPoints-1] = 0;
   Y[noOfPoints-1] = y[1];
   CenterXY[0] = 0; CenterXY[1] = 0.5*((double)(X[0]*X[0])/(double)(Y[0]-Y[noOfPoints-1])+(Y[0]+Y[noOfPoints-1]));
- 
+
   double angle = (((Y[noOfPoints-1]>CenterXY[1])?1.5708:-1.5708) - atan((double)(Y[0]-CenterXY[1])/(double)X[0]))/(double)(noOfPoints-1);
   for(int i = 1; i < noOfPoints-1; ++i)
     {
@@ -120,7 +120,7 @@ bool CDefaultFilter::Timer(int Time, CDasherView *pView, CDasherInput *pInput, C
       myint iDasherMaxX;
       myint iDasherMaxY;
       pView->VisibleRegion(iDasherMinX, iDasherMinY, iDasherMaxX, iDasherMaxY);
-  
+
       if((m_iLastX > iDasherMaxX) || (m_iLastX < iDasherMinX) || (m_iLastY > iDasherMaxY) || (m_iLastY < iDasherMinY)) {
         m_pInterface->Stop();
         return false;
@@ -132,7 +132,7 @@ bool CDefaultFilter::Timer(int Time, CDasherView *pView, CDasherInput *pInput, C
 
     m_pAutoSpeedControl->SpeedControl(m_iLastX, m_iLastY, pView);
   }
-	
+
   if(m_pStartHandler)
     m_pStartHandler->Timer(Time, m_iLastX, m_iLastY, pView);
 
@@ -150,7 +150,7 @@ void CDefaultFilter::KeyDown(int iTime, int iId, CDasherView *pDasherView, CDash
       else
 	m_pInterface->Stop();
     }
-    break; 
+    break;
   case 100: // Start on mouse
     if(GetBoolParameter(BP_START_MOUSE)) {
       if(GetBoolParameter(BP_DASHER_PAUSED))
@@ -167,7 +167,7 @@ void CDefaultFilter::KeyDown(int iTime, int iId, CDasherView *pDasherView, CDash
 void CDefaultFilter::HandleEvent(Dasher::CEvent * pEvent) {
   if(pEvent->m_iEventType == 1) {
     Dasher::CParameterNotificationEvent * pEvt(static_cast < Dasher::CParameterNotificationEvent * >(pEvent));
-   
+
     switch (pEvt->m_iParameter) {
     case BP_CIRCLE_START:
     case BP_MOUSEPOS_MODE:
@@ -202,11 +202,11 @@ CStartHandler *CDefaultFilter::MakeStartHandler() {
 
 double xmax(double y) {
   // DJCM -- define a function xmax(y) thus:
-  // xmax(y) = a*[exp(b*y*y)-1] 
+  // xmax(y) = a*[exp(b*y*y)-1]
   // then:  if(x<xmax(y) [if the mouse is to the RIGHT of the line xmax(y)]
   // set x=xmax(y).  But set xmax=c if(xmax>c).
-  // I would set a=1, b=1, c=16, to start with. 
-  
+  // I would set a=1, b=1, c=16, to start with.
+
   static const int a = 1, b = 1;
   static const double c = 100;
   return min(c,a * (exp(b * y * y) - 1));
@@ -231,35 +231,35 @@ void CDefaultFilter::ApplyTransform(myint &iDasherX, myint &iDasherY, CDasherVie
   }
   if (GetBoolParameter(BP_REMAP_XTREME)) {
     // Y co-ordinate...
-    myint dasherOY=(myint)GetLongParameter(LP_OY); 
+    myint dasherOY=(myint)GetLongParameter(LP_OY);
     double double_y = ((iDasherY-dasherOY)/(double)(dasherOY) ); // Fraction above the crosshair
     static const double repulsionparameter=0.5;
     iDasherY = myint(dasherOY * (1.0 + double_y + (double_y*double_y*double_y * repulsionparameter )));
-    
-    // X co-ordinate...  
+
+    // X co-ordinate...
     iDasherX = max(iDasherX,myint(GetLongParameter(LP_OX) * xmax(double_y)));
   }
 }
 
 void CDefaultFilter::ApplyOffset(myint &iDasherX, myint &iDasherY) {
-  
+
   // TODO: It turns out that this was previously computed in pixels,
   // altough everythign else made use of Dasher coordinates. Hack in a
   // factor of 10 to get the offset in Dasher coordinates, but it
   // would be a good idea at some point to sort this out properly.
-  
+
   iDasherY += 10 * GetLongParameter(LP_TARGET_OFFSET);
 
   if(GetBoolParameter(BP_AUTOCALIBRATE) && !GetBoolParameter(BP_DASHER_PAUSED)) {
     // Auto-update the offset
-  
+
     m_iSum += (myint)GetLongParameter(LP_OY) - iDasherY; // Distance above crosshair
     ++m_iCounter;
-  
+
     //int m_iFilterTimescale=20
     if(++m_iCounter > 20) {
       m_iCounter = 0;
-    
+
       // 'Conditions A', as specified by DJCM.  Only make the auto-offset
       // change if we're past the significance boundary.
       //int m_iSigBiasPixels(GetLongParameter(LP_MAX_Y)/2);
diff --git a/Src/DasherCore/DynamicFilter.h b/Src/DasherCore/DynamicFilter.h
index ae54ffa..4d2f1b5 100644
--- a/Src/DasherCore/DynamicFilter.h
+++ b/Src/DasherCore/DynamicFilter.h
@@ -15,7 +15,7 @@
 // GNU General Public License for more details.
 //
 // You should have received a copy of the GNU General Public License
-// along with Dasher; if not, write to the Free Software 
+// along with Dasher; if not, write to the Free Software
 // Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA  02110-1301  USA
 
 #ifndef __DynamicFilter_h__
@@ -30,11 +30,11 @@ namespace Dasher {
 class CDynamicFilter : public CInputFilter {
  public:
   CDynamicFilter(Dasher::CEventHandler * pEventHandler, CSettingsStore *pSettingsStore, CDasherInterfaceBase *pInterface, ModuleID_t iID, const char *szName);
-  
+
   virtual bool supportsPause() {return true;}
-  
+
   ///when reversing, backs off; when paused, does nothing; when running, delegates to TimerImpl
-  virtual bool Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol); 
+  virtual bool Timer(int Time, CDasherView *pView, CDasherInput *pInput, CDasherModel *m_pDasherModel, Dasher::VECTOR_SYMBOL_PROB *pAdded, int *pNumDeleted, CExpansionPolicy **pol);
 
   virtual void KeyDown(int iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel, CUserLogBase *pUserLog);
   virtual void KeyUp(int iTime, int iId, CDasherView *pView, CDasherInput *pInput, CDasherModel *pModel);
@@ -62,7 +62,7 @@ class CDynamicFilter : public CInputFilter {
     int m_iHeldId;
     int m_iKeyDownTime;
     unsigned int m_uSpeedControlTime;
-	
+
     CUserLogBase *m_pUserLog;
 };
 }
diff --git a/Src/DasherCore/OneDimensionalFilter.cpp b/Src/DasherCore/OneDimensionalFilter.cpp
index 279dbd9..990bc6e 100644
--- a/Src/DasherCore/OneDimensionalFilter.cpp
+++ b/Src/DasherCore/OneDimensionalFilter.cpp
@@ -105,4 +105,4 @@ CStartHandler *COneDimensionalFilter::MakeStartHandler() {
     return new C1DCircleStartHandler(this);
   }
   return CDefaultFilter::MakeStartHandler();
-}
\ No newline at end of file
+}
diff --git a/Src/Gtk2/DasherAppSettings.cpp b/Src/Gtk2/DasherAppSettings.cpp
index 55e4066..1318e48 100644
--- a/Src/Gtk2/DasherAppSettings.cpp
+++ b/Src/Gtk2/DasherAppSettings.cpp
@@ -426,7 +426,7 @@ const gchar *dasher_app_settings_get_string(DasherAppSettings *pSelf, int iParam
   DasherAppSettingsPrivate *pPrivate = (DasherAppSettingsPrivate *)(pSelf->private_data);
  
   if( iParameter < END_OF_SPS ) {
-    if(pPrivate->pDasherWidget) 
+    if(pPrivate->pDasherWidget)
       return gtk_dasher_control_get_parameter_string(pPrivate->pDasherWidget, iParameter);
     else
       return false;
diff --git a/Src/Gtk2/dasher_main.cpp b/Src/Gtk2/dasher_main.cpp
index 056f34c..c23404f 100644
--- a/Src/Gtk2/dasher_main.cpp
+++ b/Src/Gtk2/dasher_main.cpp
@@ -1356,7 +1356,7 @@ dasher_main_key_snooper(GtkWidget *pWidget, GdkEventKey *pEvent,
         else
           gtk_dasher_control_external_key_up(GTK_DASHER_CONTROL(pPrivate->pDasherWidget), iButton);
       }
-      
+
       return TRUE;
     }
     else {



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