[dasher: 23/38] Minor Refactor: AlphMgr passes ctx into CreateSymbolRoot



commit 6c4c3485ec08ab40bf30665504207b2390093e54
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Tue Dec 13 13:28:56 2011 +0000

    Minor Refactor: AlphMgr passes ctx into CreateSymbolRoot

 Src/DasherCore/AlphabetManager.cpp |    5 ++---
 Src/DasherCore/AlphabetManager.h   |    2 +-
 Src/DasherCore/MandarinAlphMgr.cpp |    2 +-
 Src/DasherCore/MandarinAlphMgr.h   |    8 ++++----
 4 files changed, 8 insertions(+), 9 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index fd069ba..3504ff3 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -322,16 +322,15 @@ CAlphabetManager::CAlphNode *CAlphabetManager::GetRoot(CDasherNode *pParent, boo
     //new node represents a symbol that's already happened - i.e. user has already steered through it;
     // so either we're rebuilding, or else creating a new root from existing text (in edit box)
     DASHER_ASSERT(!pParent);
-    pNewNode = CreateSymbolRoot(iNewOffset, p.first);
+    pNewNode = CreateSymbolRoot(iNewOffset, p.second, p.first);
     pNewNode->SetFlag(NF_SEEN, true);
     pNewNode->CDasherNode::SetFlag(NF_COMMITTED, true); //do NOT commit!
   }
-
   pNewNode->iContext = p.second;
   return pNewNode;
 }
 
-CAlphabetManager::CAlphNode *CAlphabetManager::CreateSymbolRoot(int iOffset, symbol sym) {
+CAlphabetManager::CAlphNode *CAlphabetManager::CreateSymbolRoot(int iOffset, CLanguageModel::Context ctx, symbol sym) {
   return new CSymbolNode(iOffset, m_vLabels[sym], this, sym);
 }
 
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index f3ceeb6..74370d7 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -259,7 +259,7 @@ namespace Dasher {
     ///Called to create a new symbol root, e.g. for going backwards
     /// \param iOffset index of symbol entered by the node
     /// \param sym symbol number as returned as first element of GetContextSymbols
-    virtual CAlphNode *CreateSymbolRoot(int iOffset, symbol sym);
+    virtual CAlphNode *CreateSymbolRoot(int iOffset, CLanguageModel::Context ctx, symbol sym);
     
     ///Called to compute colour for a symbol at a specified offset.
     /// Wraps CAlphabet::GetColour(sym), but (a) implements a default
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 13eaec5..3ba913f 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -257,7 +257,7 @@ CTrainer *CMandarinAlphMgr::GetTrainer() {
   return new CMandarinTrainer(m_pInterface, this);
 }
 
-CAlphabetManager::CAlphNode *CMandarinAlphMgr::CreateSymbolRoot(int iOffset, symbol chSym) {
+CAlphabetManager::CAlphNode *CMandarinAlphMgr::CreateSymbolRoot(int iOffset, CLanguageModel::Context ctx, symbol chSym) {
   return new CMandSym(iOffset, this, chSym, 0);
 }
 
diff --git a/Src/DasherCore/MandarinAlphMgr.h b/Src/DasherCore/MandarinAlphMgr.h
index e6a24ee..8c50c42 100644
--- a/Src/DasherCore/MandarinAlphMgr.h
+++ b/Src/DasherCore/MandarinAlphMgr.h
@@ -94,10 +94,6 @@ namespace Dasher {
     ///ACL: returns a MandarinTrainer too.
     CTrainer *GetTrainer();
     
-    ///Override to create a CMandSym; context and sym both obtained from the
-    // ChineseAlphabet's (hashed) symbols stored in m_map.
-    CAlphNode *CreateSymbolRoot(int iOffset, symbol sym);
-    
     ///Disable game mode. The target sentence might appear in several places...!!
     CWordGeneratorBase *GetGameWords() {return NULL;}
 
@@ -130,6 +126,10 @@ namespace Dasher {
     // identified entirely by the PY groups around it.
     const std::string &GetLabelText(symbol i) const;
 
+    ///Override to create a CMandSym; context and sym both obtained from the
+    // ChineseAlphabet's (hashed) symbols stored in m_map.
+    CAlphNode *CreateSymbolRoot(int iOffset, CLanguageModel::Context ctx, symbol sym);
+
     class CConvRoot;
     ///Subclass of CSymbolNode for (converted) chinese-alphabet symbols:
     /// we need to keep track of the pinyin used to enter it, to output



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