[dasher: 18/38] Handle Space Symbol special colour in AlphIO, rather than duplicate



commit e9bd12df43f80b8fafe48b09ffe83c435ca1d9ea
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Dec 17 10:36:55 2011 +0000

    Handle Space Symbol special colour in AlphIO, rather than duplicate

 Src/DasherCore/Alphabet/AlphIO.cpp |    1 +
 Src/DasherCore/Alphabet/AlphInfo.h |    4 ++++
 Src/DasherCore/AlphabetManager.cpp |    8 +-------
 3 files changed, 6 insertions(+), 7 deletions(-)
---
diff --git a/Src/DasherCore/Alphabet/AlphIO.cpp b/Src/DasherCore/Alphabet/AlphIO.cpp
index a5b356a..e8f3d6b 100644
--- a/Src/DasherCore/Alphabet/AlphIO.cpp
+++ b/Src/DasherCore/Alphabet/AlphIO.cpp
@@ -213,6 +213,7 @@ void CAlphIO::XmlStartHandler(const XML_Char *name, const XML_Char **atts) {
   if(strcmp(name, "space") == 0) {
     if (!SpaceCharacter) SpaceCharacter = new CAlphInfo::character();
     ReadCharAtts(atts,*SpaceCharacter);
+    if (SpaceCharacter->Colour==-1) SpaceCharacter->Colour = 9;
     return;
   }
   if(strcmp(name, "paragraph") == 0) {
diff --git a/Src/DasherCore/Alphabet/AlphInfo.h b/Src/DasherCore/Alphabet/AlphInfo.h
index 888ef71..9b5d9fe 100644
--- a/Src/DasherCore/Alphabet/AlphInfo.h
+++ b/Src/DasherCore/Alphabet/AlphInfo.h
@@ -83,6 +83,10 @@ public:
 
   symbol GetParagraphSymbol() const {return iParagraphCharacter;}
 
+  ///Space symbol is special in three ways:
+  /// (1) defines word boundaries for speak-as-we-go, i.e. we speak when we see a space;
+  /// (2) Unknown characters in game mode text file are converted into spaces;
+  /// (3) Default colour is 9 if none specified
   symbol GetSpaceSymbol() const {return iSpaceCharacter;}
 
   //symbol GetStartConversionSymbol() const;
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 213f714..fd069ba 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -262,14 +262,8 @@ int CAlphabetManager::GetColour(symbol sym, int iOffset) const {
   // ideally make this log a warning (unrelated TODO: automate
   // validation of alphabet files, plus maintenance of repository
   // etc.)
-  if(iColour == -1) {
-    if(sym == m_pAlphabet->GetSpaceSymbol()) {
-      iColour = 9;
-    }
-    else {
+  if(iColour == -1)
       iColour = (sym % 3) + 10;
-    }
-  }
 
   // Loop on low colours for nodes (TODO: go back to colour namespaces?)
   if((iOffset&1) == 0 && iColour < 130)



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