[dasher] Make CDasherNode::m_iOffset private, rather than protected
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Make CDasherNode::m_iOffset private, rather than protected
- Date: Wed, 9 Jun 2010 12:50:41 +0000 (UTC)
commit 5050cc867ec3451724218d0f6a98008e6c670144
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Tue May 4 20:02:32 2010 +0100
Make CDasherNode::m_iOffset private, rather than protected
For now this requires putting CControlManager::CContNode's implementation of
SetControlOffset directly in CDasherNode, which is even worse, but hopefully
both these hacks will be removed ASAP...
Src/DasherCore/AlphabetManager.cpp | 10 +++++-----
Src/DasherCore/ControlManager.cpp | 8 ++------
Src/DasherCore/ControlManager.h | 1 -
Src/DasherCore/ConversionHelper.cpp | 2 +-
Src/DasherCore/ConversionManager.cpp | 16 ++++++++--------
Src/DasherCore/DasherNode.h | 11 ++++++++---
Src/DasherCore/MandarinAlphMgr.cpp | 2 +-
7 files changed, 25 insertions(+), 25 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index a39c35d..bd5ce3e 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -160,7 +160,7 @@ CLanguageModel::Context CAlphabetManager::CAlphNode::CloneAlphContext(CLanguageM
}
void CAlphabetManager::CSymbolNode::GetContext(CDasherInterfaceBase *pInterface, vector<symbol> &vContextSymbols, int iOffset, int iLength) {
- if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == m_iOffset) {
+ if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == offset()) {
if (iLength > 1) Parent()->GetContext(pInterface, vContextSymbols, iOffset, iLength-1);
vContextSymbols.push_back(iSymbol);
} else {
@@ -391,7 +391,7 @@ const std::string &CAlphabetManager::CSymbolNode::outputText() {
void CAlphabetManager::CSymbolNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {
//std::cout << this << " " << Parent() << ": Output at offset " << m_iOffset << " *" << m_pMgr->m_pNCManager->GetAlphabet()->GetText(t) << "* " << std::endl;
- Dasher::CEditEvent oEvent(1, outputText(), m_iOffset);
+ Dasher::CEditEvent oEvent(1, outputText(), offset());
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
// Track this symbol and its probability for logging purposes
@@ -405,7 +405,7 @@ void CAlphabetManager::CSymbolNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
}
void CAlphabetManager::CSymbolNode::Undo(int *pNumDeleted) {
- Dasher::CEditEvent oEvent(2, outputText(), m_iOffset);
+ Dasher::CEditEvent oEvent(2, outputText(), offset());
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
if (pNumDeleted) (*pNumDeleted)++;
}
@@ -416,12 +416,12 @@ CDasherNode *CAlphabetManager::CGroupNode::RebuildParent() {
// m_pGroup==NULL => "root" node where Alphabet->m_pBaseGroup is the *first*child*...
if (m_pGroup == NULL) return NULL;
//offset of group node is same as parent...
- return CAlphNode::RebuildParent(m_iOffset);
+ return CAlphNode::RebuildParent(offset());
}
CDasherNode *CAlphabetManager::CSymbolNode::RebuildParent() {
//parent's offset is one less than this.
- return CAlphNode::RebuildParent(m_iOffset-1);
+ return CAlphNode::RebuildParent(offset()-1);
}
CDasherNode *CAlphabetManager::CAlphNode::RebuildParent(int iNewOffset) {
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 5589384..da580f9 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -298,11 +298,11 @@ void CControlManager::CContNode::PopulateChildren() {
if( *it == NULL ) {
// Escape back to alphabet
- pNewNode = m_pMgr->m_pNCManager->GetAlphRoot(this, iLbnd, iHbnd, false, m_iOffset);
+ pNewNode = m_pMgr->m_pNCManager->GetAlphRoot(this, iLbnd, iHbnd, false, offset());
}
else {
- pNewNode = new CContNode(this, m_iOffset, iLbnd, iHbnd, *it, m_pMgr);
+ pNewNode = new CContNode(this, offset(), iLbnd, iHbnd, *it, m_pMgr);
}
iLbnd=iHbnd;
@@ -370,7 +370,3 @@ void CControlManager::XmlEndHandler(void *pUserData, const XML_Char *szName) {
void CControlManager::XmlCDataHandler(void *pUserData, const XML_Char *szData, int iLength){
return;
}
-
-void CControlManager::CContNode::SetControlOffset(int iOffset) {
- m_iOffset = iOffset;
-}
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 9593e0e..377f94c 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -105,7 +105,6 @@ namespace Dasher {
virtual void Enter();
virtual void Leave();
- void SetControlOffset(int iOffset);
const SControlItem *m_pControlItem;
private:
CControlManager *m_pMgr;
diff --git a/Src/DasherCore/ConversionHelper.cpp b/Src/DasherCore/ConversionHelper.cpp
index 2dc38ea..4fe6d84 100644
--- a/Src/DasherCore/ConversionHelper.cpp
+++ b/Src/DasherCore/ConversionHelper.cpp
@@ -121,7 +121,7 @@ void CConversionHelper::CConvHNode::PopulateChildren() {
// std::cout << "#" << pCurrentSCEChild->pszConversion << "#" << std::endl;
- CConvNode *pNewNode = mgr()->makeNode(this, m_iOffset+1, iLbnd, iHbnd, mgr()->AssignColour(parentClr, pCurrentSCEChild, iIdx), string(pCurrentSCEChild->pszConversion));
+ CConvNode *pNewNode = mgr()->makeNode(this, offset()+1, iLbnd, iHbnd, mgr()->AssignColour(parentClr, pCurrentSCEChild, iIdx), string(pCurrentSCEChild->pszConversion));
// TODO: Reimplement ----
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index 66729fc..b71fef6 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -97,7 +97,7 @@ void CConversionManager::CConvNode::PopulateChildren() {
unsigned int iLbnd(0);
unsigned int iHbnd(m_pMgr->m_pNCManager->GetLongParameter(LP_NORMALIZATION));
- CDasherNode *pNewNode = m_pMgr->m_pNCManager->GetAlphRoot(this, iLbnd, iHbnd, false, m_iOffset + 1);
+ CDasherNode *pNewNode = m_pMgr->m_pNCManager->GetAlphRoot(this, iLbnd, iHbnd, false, offset() + 1);
DASHER_ASSERT(GetChildren().back()==pNewNode);
}
@@ -122,7 +122,7 @@ void CConversionManager::RecursiveDumpTree(SCENode *pCurrent, unsigned int iDept
}
void CConversionManager::CConvNode::GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength) {
- if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == m_iOffset) {
+ if (!GetFlag(NF_SEEN) && iOffset+iLength-1 == offset()) {
//ACL I'm extrapolating from PinYinConversionHelper (in which root nodes have their
// Symbol set by SetConvSymbol, and child nodes are created in PopulateChildren
// from SCENode's with Symbols having been set in in AssignSizes); not really sure
@@ -146,7 +146,7 @@ void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
SCENode *pCurrentSCENode(pSCENode);
if(pCurrentSCENode){
- Dasher::CEditEvent oEvent(1, pCurrentSCENode->pszConversion, m_iOffset);
+ Dasher::CEditEvent oEvent(1, pCurrentSCENode->pszConversion, offset());
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
if((GetChildren())[0]->mgr() == m_pMgr) {
@@ -158,11 +158,11 @@ void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
}
else {
if(!bisRoot) {
- Dasher::CEditEvent oOPEvent(1, "|", m_iOffset);
+ Dasher::CEditEvent oOPEvent(1, "|", offset());
m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
}
else {
- Dasher::CEditEvent oOPEvent(1, ">", m_iOffset);
+ Dasher::CEditEvent oOPEvent(1, ">", offset());
m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
}
@@ -178,17 +178,17 @@ void CConversionManager::CConvNode::Undo(int *pNumDeleted) {
if(pCurrentSCENode) {
if(pCurrentSCENode->pszConversion && (strlen(pCurrentSCENode->pszConversion) > 0)) {
- Dasher::CEditEvent oEvent(2, pCurrentSCENode->pszConversion, m_iOffset);
+ Dasher::CEditEvent oEvent(2, pCurrentSCENode->pszConversion, offset());
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
}
}
else {
if(!bisRoot) {
- Dasher::CEditEvent oOPEvent(2, "|", m_iOffset);
+ Dasher::CEditEvent oOPEvent(2, "|", offset());
m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
}
else {
- Dasher::CEditEvent oOPEvent(2, ">", m_iOffset);
+ Dasher::CEditEvent oOPEvent(2, ">", offset());
m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
}
}
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 720369b..b700500 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -248,7 +248,11 @@ class Dasher::CDasherNode:private NoClones {
///
virtual void GetContext(CDasherInterfaceBase *pInterface, std::vector<symbol> &vContextSymbols, int iOffset, int iLength);
- virtual void SetControlOffset(int iOffset) {};
+ /// ACL Not really sure why we should have to have this, but seems it's needed for something
+ /// to do with speech on Linux. I'm preserving it for now (indeed, making it part of CDasherNode,
+ /// rather than CControlManager::CContNode, where it should be - but that would require making
+ /// m_iOffset visible), as hopefully all speech functionality will be redone shortly...
+ void SetControlOffset(int iOffset) {m_iOffset = iOffset;};
///
/// See if this node represents the specified alphanumeric character; if so, set it's NF_GAME flag and
@@ -281,10 +285,11 @@ class Dasher::CDasherNode:private NoClones {
// Binary flags representing the state of the node
int m_iFlags;
-
+
+ int m_iOffset;
+
protected:
int m_iColour;
- int m_iOffset;
std::string m_strDisplayText;
};
/// @}
diff --git a/Src/DasherCore/MandarinAlphMgr.cpp b/Src/DasherCore/MandarinAlphMgr.cpp
index 93b3926..7f186a8 100644
--- a/Src/DasherCore/MandarinAlphMgr.cpp
+++ b/Src/DasherCore/MandarinAlphMgr.cpp
@@ -136,7 +136,7 @@ void CMandarinAlphMgr::CConvRoot::PopulateChildren() {
// std::cout << "#" << pCurrentSCEChild->pszConversion << "#" << std::endl;
- CMandNode *pNewNode = new CMandSym(this, m_iOffset+1, iLbnd, iHbnd, iColour, m_pMgr, it->first);
+ CMandNode *pNewNode = new CMandSym(this, offset()+1, iLbnd, iHbnd, iColour, m_pMgr, it->first);
// TODO: Reimplement ----
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]