[dasher] Remove CDasherNode::m_iNumSymbols
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher] Remove CDasherNode::m_iNumSymbols
- Date: Wed, 9 Jun 2010 12:50:16 +0000 (UTC)
commit 6a92981fde4b8b1746e8d3a4dcd0e7ad57edc55e
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date: Wed Jun 2 11:46:46 2010 +0100
Remove CDasherNode::m_iNumSymbols
...by passing pNumDeleted into Undo() & modifying there (for symbol nodes!)
Src/DasherCore/AlphabetManager.cpp | 6 ++----
Src/DasherCore/AlphabetManager.h | 2 +-
Src/DasherCore/ControlManager.cpp | 12 ------------
Src/DasherCore/ControlManager.h | 1 -
Src/DasherCore/ConversionManager.cpp | 4 +++-
Src/DasherCore/ConversionManager.h | 2 +-
Src/DasherCore/DasherModel.cpp | 5 +----
Src/DasherCore/DasherNode.cpp | 1 -
Src/DasherCore/DasherNode.h | 5 +----
9 files changed, 9 insertions(+), 29 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index f7b1132..d8b5aed 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -323,9 +323,6 @@ CDasherNode *CAlphabetManager::CreateSymbolNode(CAlphNode *pParent, symbol iSymb
// pDisplayInfo->strDisplayText = ssLabel.str();
-
- pNewNode->m_iNumSymbols = 1;
-
pNewNode->m_iOffset = pParent->m_iOffset + 1;
pAlphNode->iContext = CreateSymbolContext(pParent, iSymbol);
@@ -413,9 +410,10 @@ void CAlphabetManager::CSymbolNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
}
}
-void CAlphabetManager::CSymbolNode::Undo() {
+void CAlphabetManager::CSymbolNode::Undo(int *pNumDeleted) {
Dasher::CEditEvent oEvent(2, outputText(), m_iOffset);
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
+ if (pNumDeleted) (*pNumDeleted)++;
}
CDasherNode *CAlphabetManager::CGroupNode::RebuildParent() {
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index a301870..dc65355 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -80,7 +80,7 @@ namespace Dasher {
virtual void PopulateChildren();
virtual CDasherNode *RebuildParent();
virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization);
- virtual void Undo();
+ virtual void Undo(int *pNumDeleted);
virtual void SetFlag(int iFlag, bool bValue);
diff --git a/Src/DasherCore/ControlManager.cpp b/Src/DasherCore/ControlManager.cpp
index 0517681..ee64dbc 100644
--- a/Src/DasherCore/ControlManager.cpp
+++ b/Src/DasherCore/ControlManager.cpp
@@ -349,18 +349,6 @@ void CControlManager::CContNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int
m_pMgr->m_pNCManager->InsertEvent(&oEvent);
}
-void CControlManager::CContNode::Undo() {
- // Do we ever need this?
- // One other thing we probably want is notification when we leave a node - that way we can eg speed up again if we slowed down
- m_pMgr->m_pNCManager->SetLongParameter(LP_BOOSTFACTOR, 100);
- //Re-enable auto speed control!
- if (m_pMgr->bDisabledSpeedControl)
- {
- m_pMgr->bDisabledSpeedControl = false;
- m_pMgr->m_pNCManager->SetBoolParameter(BP_AUTO_SPEEDCONTROL, 1);
- }
-}
-
void CControlManager::CContNode::Enter() {
// Slow down to half the speed we were at
m_pMgr->m_pNCManager->SetLongParameter(LP_BOOSTFACTOR, 50);
diff --git a/Src/DasherCore/ControlManager.h b/Src/DasherCore/ControlManager.h
index 3cc47d3..dc01666 100644
--- a/Src/DasherCore/ControlManager.h
+++ b/Src/DasherCore/ControlManager.h
@@ -99,7 +99,6 @@ namespace Dasher {
virtual int ExpectedNumChildren();
virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization );
- virtual void Undo();
virtual void Enter();
virtual void Leave();
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index 2b41eb7..183a5ec 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -176,7 +176,9 @@ void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
}
}
-void CConversionManager::CConvNode::Undo() {
+void CConversionManager::CConvNode::Undo(int *pNumDeleted) {
+ //ACL note: possibly ought to update pNumDeleted here if non-null,
+ // but conversion symbols were not logged by old code so am not starting now!
SCENode *pCurrentSCENode(pSCENode);
if(pCurrentSCENode) {
diff --git a/Src/DasherCore/ConversionManager.h b/Src/DasherCore/ConversionManager.h
index 02d5d05..146304b 100644
--- a/Src/DasherCore/ConversionManager.h
+++ b/Src/DasherCore/ConversionManager.h
@@ -106,7 +106,7 @@ namespace Dasher {
/// Called when a node is left backwards
///
- virtual void Undo();
+ virtual void Undo(int *pNumDeleted);
protected:
CConversionManager *m_pMgr;
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index 7d08ddb..0dc3a75 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -545,12 +545,9 @@ void CDasherModel::HandleOutput(Dasher::VECTOR_SYMBOL_PROB* pAdded, int* pNumDel
pLastSeen = pLastSeen->Parent();
while (m_pLastOutput != pLastSeen) {
- m_pLastOutput->Undo();
+ m_pLastOutput->Undo(pNumDeleted);
m_pLastOutput->Leave(); //Should we? I think so, but the old code didn't...?
m_pLastOutput->SetFlag(NF_SEEN, false);
- // TODO: Is this the right place to trap output?
- if(pNumDeleted != NULL)
- (*pNumDeleted) += m_pLastOutput->m_iNumSymbols;
m_pLastOutput = m_pLastOutput->Parent();
if (m_pLastOutput) m_pLastOutput->Enter();
diff --git a/Src/DasherCore/DasherNode.cpp b/Src/DasherCore/DasherNode.cpp
index 229f529..ab5ed2f 100644
--- a/Src/DasherCore/DasherNode.cpp
+++ b/Src/DasherCore/DasherNode.cpp
@@ -62,7 +62,6 @@ CDasherNode::CDasherNode(CDasherNode *pParent, unsigned int iLbnd, unsigned int
m_iFlags = 0;
m_iRefCount = 0;
- m_iNumSymbols = 0;
iNumNodes++;
}
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index 0d16529..8aebecb 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -229,7 +229,7 @@ class Dasher::CDasherNode:private NoClones {
///
virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {};
- virtual void Undo() {};
+ virtual void Undo(int *pNumDeleted) {};
virtual void Enter() {};
virtual void Leave() {};
@@ -265,9 +265,6 @@ class Dasher::CDasherNode:private NoClones {
/// @}
int m_iOffset;
- // A hack, to allow this node to be tied to a particular number of symbols;
- int m_iNumSymbols;
-
private:
inline ChildMap &Children();
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]