[dasher: 21/43] CUserLogBase tracks symbols added/deleted, rather than DashIntf doing so for it



commit d71b8b2b50d5d284eff31b90e04ba6e3fa5a8935
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Mon Jun 13 18:52:06 2011 +0100

    CUserLogBase tracks symbols added/deleted, rather than DashIntf doing so for it
    
    CEditEvent changed to store pointer to const DasherNode rather than offset
      (allows querying offset() or new GetSymbolProb() if necessary, both const)
    
    CUserLogBase watches CEditEvents; stores in own vectors; DashIntf calls
      CUserLogBase::FrameEnded() which passes to {Delete,Add}Symbols if any.
    
    Also code tidies to CUserLog{,Trial}; add UserLogBase.cpp to Mac+iOS+Makefile.am
    
    MacOSX: delete COSXDasherControl at shutdown so things get flushed out to disk.

 Src/DasherCore/AlphabetManager.cpp          |   12 ++++----
 Src/DasherCore/AlphabetManager.h            |    2 +
 Src/DasherCore/ConversionManager.cpp        |   14 +++++-----
 Src/DasherCore/DasherCore_vc80.vcproj       |    4 +++
 Src/DasherCore/DasherInterfaceBase.cpp      |   31 ++++++---------------
 Src/DasherCore/DasherNode.h                 |   10 ++++++-
 Src/DasherCore/Event.h                      |    9 ++++--
 Src/DasherCore/Makefile.am                  |    1 +
 Src/DasherCore/UserLog.cpp                  |    9 +-----
 Src/DasherCore/UserLogBase.cpp              |   39 +++++++++++++++++++++++++++
 Src/DasherCore/UserLogBase.h                |   19 ++++++++++---
 Src/DasherCore/UserLogTrial.cpp             |   17 -----------
 Src/Gtk2/DasherControl.cpp                  |    4 +-
 Src/MacOSX/Dasher.xcodeproj/project.pbxproj |    4 +++
 Src/MacOSX/DasherApp.mm                     |    2 +
 Src/MacOSX/DasherViewOpenGL.mm              |    5 +++-
 Src/iPhone/Dasher.xcodeproj/project.pbxproj |    4 +++
 17 files changed, 116 insertions(+), 70 deletions(-)
---
diff --git a/Src/DasherCore/AlphabetManager.cpp b/Src/DasherCore/AlphabetManager.cpp
index 1a21635..6a65886 100644
--- a/Src/DasherCore/AlphabetManager.cpp
+++ b/Src/DasherCore/AlphabetManager.cpp
@@ -568,13 +568,13 @@ void CAlphabetManager::CSymbolNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
   }
   //std::cout << this << " " << Parent() << ": Output at offset " << m_iOffset << " *" << m_pMgr->m_pAlphabet->GetText(t) << "* " << std::endl;
 
-  Dasher::CEditEvent oEvent(1, outputText(), offset());
+  Dasher::CEditEvent oEvent(1, outputText(), this);
   m_pMgr->m_pNCManager->InsertEvent(&oEvent);
+}
 
-  // Track this symbol and its probability for logging purposes
-  if (pAdded != NULL) {
-    pAdded->push_back(Dasher::SymbolProb(iSymbol, oEvent.m_sText, Range() / (double)iNormalization));
-  }
+SymbolProb CAlphabetManager::CSymbolNode::GetSymbolProb(int iNormalization) const {
+  //TODO probability here not right - Range() is relative to parent, not prev symbol
+  return Dasher::SymbolProb(iSymbol, m_pMgr->m_pAlphabet->GetText(iSymbol), Range() / (double)iNormalization);
 }
 
 void CAlphabetManager::CSymbolNode::Undo(int *pNumDeleted) {
@@ -591,7 +591,7 @@ void CAlphabetManager::CSymbolNode::Undo(int *pNumDeleted) {
       }
     }
   } else CAlphBase::Undo(pNumDeleted);
-  Dasher::CEditEvent oEvent(2, outputText(), offset());
+  Dasher::CEditEvent oEvent(2, outputText(), this);
   m_pMgr->m_pNCManager->InsertEvent(&oEvent);
   if (pNumDeleted) (*pNumDeleted)++;
 }
diff --git a/Src/DasherCore/AlphabetManager.h b/Src/DasherCore/AlphabetManager.h
index 528d183..709637d 100644
--- a/Src/DasherCore/AlphabetManager.h
+++ b/Src/DasherCore/AlphabetManager.h
@@ -150,6 +150,8 @@ namespace Dasher {
       virtual void PopulateChildren();
       virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization);
       virtual void Undo(int *pNumDeleted);
+      ///Override to provide symbol number, probability, _edit_ text from alphabet
+      virtual SymbolProb GetSymbolProb(int iNormalization) const;
 
       virtual void SetFlag(int iFlag, bool bValue);
 
diff --git a/Src/DasherCore/ConversionManager.cpp b/Src/DasherCore/ConversionManager.cpp
index 8703807..917ab44 100644
--- a/Src/DasherCore/ConversionManager.cpp
+++ b/Src/DasherCore/ConversionManager.cpp
@@ -161,7 +161,7 @@ void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
   SCENode *pCurrentSCENode(pSCENode);
 
   if(pCurrentSCENode){
-    Dasher::CEditEvent oEvent(1, pCurrentSCENode->pszConversion, offset());
+    Dasher::CEditEvent oEvent(1, pCurrentSCENode->pszConversion, this);
     m_pMgr->m_pNCManager->InsertEvent(&oEvent);
 
     if((GetChildren())[0]->mgr() == m_pMgr) {
@@ -173,15 +173,15 @@ void CConversionManager::CConvNode::Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, i
   }
   else {
     if(!bisRoot) {
-      Dasher::CEditEvent oOPEvent(1, "|", offset());
+      Dasher::CEditEvent oOPEvent(1, "|", this);
       m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
     }
     else {
-      Dasher::CEditEvent oOPEvent(1, ">", offset());
+      Dasher::CEditEvent oOPEvent(1, ">", this);
       m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
     }
 
-    Dasher::CEditEvent oEvent(10, "", 0);
+    Dasher::CEditEvent oEvent(10, "", this); //TODO this used to pass in offset 0, now we'll get the node's offset...
     m_pMgr->m_pNCManager->InsertEvent(&oEvent);
   }
 }
@@ -193,17 +193,17 @@ void CConversionManager::CConvNode::Undo(int *pNumDeleted) {
 
   if(pCurrentSCENode) {
     if(pCurrentSCENode->pszConversion && (strlen(pCurrentSCENode->pszConversion) > 0)) {
-      Dasher::CEditEvent oEvent(2, pCurrentSCENode->pszConversion, offset());
+      Dasher::CEditEvent oEvent(2, pCurrentSCENode->pszConversion, this);
       m_pMgr->m_pNCManager->InsertEvent(&oEvent);
     }
   }
   else {
     if(!bisRoot) {
-      Dasher::CEditEvent oOPEvent(2, "|", offset());
+      Dasher::CEditEvent oOPEvent(2, "|", this);
       m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
     }
     else {
-      Dasher::CEditEvent oOPEvent(2, ">", offset());
+      Dasher::CEditEvent oOPEvent(2, ">", this);
       m_pMgr->m_pNCManager->InsertEvent(&oOPEvent);
     }
   }
diff --git a/Src/DasherCore/DasherCore_vc80.vcproj b/Src/DasherCore/DasherCore_vc80.vcproj
index fc64d7d..b010947 100644
--- a/Src/DasherCore/DasherCore_vc80.vcproj
+++ b/Src/DasherCore/DasherCore_vc80.vcproj
@@ -1478,6 +1478,10 @@
 				</FileConfiguration>
 			</File>
 			<File
+				RelativePath=".\UserLogBase.cpp"
+				>
+			</File>
+			<File
 				RelativePath=".\UserLogBase.h"
 				>
 				<FileConfiguration
diff --git a/Src/DasherCore/DasherInterfaceBase.cpp b/Src/DasherCore/DasherInterfaceBase.cpp
index 4d357a8..ebc55bb 100644
--- a/Src/DasherCore/DasherInterfaceBase.cpp
+++ b/Src/DasherCore/DasherInterfaceBase.cpp
@@ -529,28 +529,8 @@ void CDasherInterfaceBase::NewFrame(unsigned long iTime, bool bForceRedraw) {
       CExpansionPolicy *pol=m_defaultPolicy;
   
       //1. Move around in the model
-      if (m_pUserLog != NULL) {
-        //ACL note that as of 15/5/09, splitting UpdatePosition into two,
-        //DasherModel no longer guarantees to empty these two if it didn't do anything.
-        //So initialise appropriately...
-        Dasher::VECTOR_SYMBOL_PROB vAdded;
-        int iNumDeleted = 0;
-
-        if(m_pInputFilter) {
-          bChanged = m_pInputFilter->Timer(iTime, m_pDasherView, m_pInput, m_pDasherModel, &vAdded, &iNumDeleted, &pol);
-        }
-
-      #ifndef _WIN32_WCE
-        if (iNumDeleted > 0)
-          m_pUserLog->DeleteSymbols(iNumDeleted);
-        if (vAdded.size() > 0)
-          m_pUserLog->AddSymbols(&vAdded);
-      #endif
-
-      } else {
-        if(m_pInputFilter) {
-          bChanged = m_pInputFilter->Timer(iTime, m_pDasherView, m_pInput, m_pDasherModel, 0, 0, &pol);
-        }
+      if(m_pInputFilter) {
+        bChanged = m_pInputFilter->Timer(iTime, m_pDasherView, m_pInput, m_pDasherModel, 0, 0, &pol);
       }
       //2. Render...
       //check: if we were paused before, and the input filter didn't unpause,
@@ -570,6 +550,13 @@ void CDasherInterfaceBase::NewFrame(unsigned long iTime, bool bForceRedraw) {
       //2. Render nodes decorations, messages
       bBlit = Redraw(iTime, bForceRedraw, *pol);
 
+      if (m_pUserLog != NULL) {
+        //(any) UserLogBase will have been watching output events to gather information
+        // about symbols added/deleted; this tells it to apply that information at end-of-frame
+        // (previously DashIntf gathered the info, and then passed it to the logger here).
+        m_pUserLog->FrameEnded();
+      }
+
       // This just passes the time through to the framerate tracker, so we
       // know how often new frames are being drawn.
       if(m_pDasherModel != 0)
diff --git a/Src/DasherCore/DasherNode.h b/Src/DasherCore/DasherNode.h
index b8bf2eb..0d80e9f 100644
--- a/Src/DasherCore/DasherNode.h
+++ b/Src/DasherCore/DasherNode.h
@@ -72,7 +72,7 @@ class Dasher::CDasherNode:private NoClones {
   /// (Default implementation returns true, subclasses should override if appropriate)
   virtual bool bShove() {return true;}
 
-  inline int offset() {return m_iOffset;}
+  inline int offset() const {return m_iOffset;}
   CDasherNode *onlyChildRendered; //cache that only one child was rendered (as it filled the screen)
 
   /// Container type for storing children. Note that it's worth
@@ -234,6 +234,14 @@ class Dasher::CDasherNode:private NoClones {
   virtual void Output(Dasher::VECTOR_SYMBOL_PROB* pAdded, int iNormalization) {};
   virtual void Undo(int *pNumDeleted) {};
 
+  ///Called by logging code to get information about node which has just been
+  /// output. Subclasses performing output, should override to return appropriate
+  /// information. (Will only be called if necessary i.e. logging enabled).
+  /// The default returns a very uninformative SymbolProb with just display text.
+  virtual SymbolProb GetSymbolProb(int iNormalization) const {
+    return SymbolProb(0,m_pLabel->m_strText,0.0);
+  }
+
   virtual void Enter() {};
   virtual void Leave() {};
 
diff --git a/Src/DasherCore/Event.h b/Src/DasherCore/Event.h
index 6c7c5a1..24b11ab 100644
--- a/Src/DasherCore/Event.h
+++ b/Src/DasherCore/Event.h
@@ -11,6 +11,7 @@ namespace Dasher {
   class CParameterNotificationEvent;
   class CEditEvent;
   class CScreenGeomEvent;
+  class CDasherNode; //fwd decl, avoid include...we just store ptr
 }
 
 enum {
@@ -39,13 +40,15 @@ public:
 
 class Dasher::CEditEvent:public Dasher::CEvent {
 public:
-  CEditEvent(int iEditType, const std::string & sText, int iOffset)
-  : CEvent(EV_EDIT), m_iEditType(iEditType), m_sText(sText), m_iOffset(iOffset) {
+  CEditEvent(int iEditType, const std::string & sText, CDasherNode *pNode)
+  : CEvent(EV_EDIT), m_iEditType(iEditType), m_sText(sText), m_pNode(pNode) {
   };
 
   const int m_iEditType;
   const std::string m_sText;
-  const int m_iOffset;
+  /// Node causing the event - allows calling GetSymbolProb, offset(), etc.
+  /// _if necessary_
+  const CDasherNode *m_pNode;
 };
 
 ///Generated whenever the screen geometry changes: e.g. aspect ratio,
diff --git a/Src/DasherCore/Makefile.am b/Src/DasherCore/Makefile.am
index 4507093..32e6b18 100644
--- a/Src/DasherCore/Makefile.am
+++ b/Src/DasherCore/Makefile.am
@@ -135,6 +135,7 @@ libdashercore_a_SOURCES = \
 		UserLog.cpp \
 		UserLog.h \
 		UserLogBase.h \
+		UserLogBase.cpp \
 		UserLogParam.cpp \
 		UserLogParam.h \
 		UserLogTrial.cpp \
diff --git a/Src/DasherCore/UserLog.cpp b/Src/DasherCore/UserLog.cpp
index ca9cd95..e49507e 100644
--- a/Src/DasherCore/UserLog.cpp
+++ b/Src/DasherCore/UserLog.cpp
@@ -278,12 +278,7 @@ void CUserLog::AddSymbols(Dasher::VECTOR_SYMBOL_PROB* vpNewSymbols, eUserLogEven
   {
     // Also store a copy in a vector that gets cleared 
     // time StartWriting() is called.
-
-    for (unsigned int i = 0; i < vpNewSymbols->size(); i++)
-    {
-      Dasher::SymbolProb sNewSymbolProb = (Dasher::SymbolProb) (*vpNewSymbols)[i];
-      m_vCycleHistory.push_back(sNewSymbolProb);
-    }
+    m_vCycleHistory.insert(m_vCycleHistory.end(), vpNewSymbols->begin(), vpNewSymbols->end());
   }
 
   if (m_bDetailed)
@@ -702,7 +697,7 @@ void CUserLog::HandleEvent(Dasher::CEvent* pEvent)
     } // end while (s_UserLogParamMaskTable[i].key != -1)
 
   } // end if (pEvent->m_iEventType == 1)
-
+  CUserLogBase::HandleEvent(pEvent);
 }
 
 ////////////////////////////////////////// private methods ////////////////////////////////////////////////
diff --git a/Src/DasherCore/UserLogBase.cpp b/Src/DasherCore/UserLogBase.cpp
new file mode 100644
index 0000000..23f5c99
--- /dev/null
+++ b/Src/DasherCore/UserLogBase.cpp
@@ -0,0 +1,39 @@
+/*
+ *  UserLogBase.cpp
+ *  Dasher
+ *
+ *  Created by Alan Lawrence on 28/03/2011.
+ *  Copyright 2011 Cavendish Laboratory. All rights reserved.
+ *
+ */
+
+#include "UserLogBase.h"
+#include "Event.h"
+#include "DasherNode.h"
+
+using namespace Dasher;
+
+void CUserLogBase::HandleEvent(CEvent *pEvent) {
+  if (pEvent->m_iEventType == EV_EDIT) {
+    Dasher::CEditEvent *evt(static_cast<Dasher::CEditEvent *>(pEvent));
+    if (evt->m_iEditType == 1) {
+      m_vAdded.push_back(evt->m_pNode->GetSymbolProb(GetLongParameter(LP_NORMALIZATION)));
+      //output
+    } else if (evt->m_iEditType == 2) {
+      //delete
+      m_iNumDeleted++;
+    }
+  }
+}
+
+void CUserLogBase::FrameEnded() {
+  //pass on added/deleted if any, and get ready for next frame
+  if (m_iNumDeleted) {
+    DeleteSymbols(m_iNumDeleted);
+    m_iNumDeleted=0;
+  }
+  if (!m_vAdded.empty()) {
+   AddSymbols(&m_vAdded);
+    m_vAdded.clear();
+  }
+}
\ No newline at end of file
diff --git a/Src/DasherCore/UserLogBase.h b/Src/DasherCore/UserLogBase.h
index 7e5b748..6c7c5be 100644
--- a/Src/DasherCore/UserLogBase.h
+++ b/Src/DasherCore/UserLogBase.h
@@ -1,16 +1,19 @@
 #ifndef __UserLogBase_h__
 #define __UserLogBase_h__
 
+#include "DasherTypes.h"
 #include "DasherComponent.h"
 #include "UserLogTrial.h" // Don't want to include this, but needed for event type enum
+#include "Event.h"
 
 #include <string>
-
+#include <vector>
 /// \defgroup Logging Logging routines
 /// @{
 class CUserLogBase : public Dasher::CDasherComponent {
  public:
-  CUserLogBase(Dasher::CEventHandler *pEventHandler, CSettingsStore *pSettingsStore) : Dasher::CDasherComponent(pEventHandler, pSettingsStore) {};
+  CUserLogBase(Dasher::CEventHandler *pEventHandler, CSettingsStore *pSettingsStore)
+  : Dasher::CDasherComponent(pEventHandler, pSettingsStore), m_iNumDeleted(0) {};
 
   virtual void AddParam(const std::string& strName, const std::string& strValue, int iOptionMask = 0) = 0;
   virtual void AddParam(const std::string& strName, double dValue, int iOptionMask = 0) = 0;
@@ -18,8 +21,6 @@ class CUserLogBase : public Dasher::CDasherComponent {
   virtual void StartWriting() = 0;
   virtual void StopWriting(float dNats) = 0;
   virtual void StopWriting() = 0;
-  virtual void AddSymbols(Dasher::VECTOR_SYMBOL_PROB* pVectorNewSymbolProbs, eUserLogEventType iEvent = userLogEventMouse) = 0;
-  virtual void DeleteSymbols(int iNumToDelete, eUserLogEventType iEvent = userLogEventMouse) = 0;    
   virtual void NewTrial() = 0;
   virtual void AddWindowSize(int iTop, int iLeft, int iBottom, int iRight) = 0;
   virtual void AddCanvasSize(int iTop, int iLeft, int iBottom, int iRight) = 0;
@@ -30,6 +31,16 @@ class CUserLogBase : public Dasher::CDasherComponent {
   virtual void SetOuputFilename(const std::string& strFilename = "") = 0;
   virtual int GetLogLevelMask() = 0;
   virtual void KeyDown(int iId, int iType, int iEffect) = 0;
+  ///Watches output events to record symbols added/deleted
+  virtual void HandleEvent(Dasher::CEvent *pEvent);
+  ///Passes record of symbols added/deleted to AddSymbols/DeleteSymbols
+  void FrameEnded();
+protected:
+  virtual void AddSymbols(Dasher::VECTOR_SYMBOL_PROB* pVectorNewSymbolProbs, eUserLogEventType iEvent = userLogEventMouse) = 0;
+  virtual void DeleteSymbols(int iNumToDelete, eUserLogEventType iEvent = userLogEventMouse) = 0;  
+private:
+  std::vector<Dasher::SymbolProb> m_vAdded;
+  int m_iNumDeleted;
 };
 /// @}
 
diff --git a/Src/DasherCore/UserLogTrial.cpp b/Src/DasherCore/UserLogTrial.cpp
index 094d236..5ce7a18 100644
--- a/Src/DasherCore/UserLogTrial.cpp
+++ b/Src/DasherCore/UserLogTrial.cpp
@@ -254,23 +254,6 @@ void CUserLogTrial::StopWriting(double dBits)
 void CUserLogTrial::AddSymbols(Dasher::VECTOR_SYMBOL_PROB* vpNewSymbolProbs, 
                                eUserLogEventType iEvent)
 {
-  //CFunctionLogger f1("CUserLogTrial::AddSymbols", g_pLogger);
-
-  if (vpNewSymbolProbs == NULL)
-  {
-    g_pLogger->Log("CUserLogTrial::AddSymbols, vectorNewSymbolProbs was NULL!", logNORMAL);
-    return;
-  }
-
-  Dasher::VECTOR_SYMBOL_PROB* pVectorAdded = NULL;
-  pVectorAdded = new Dasher::VECTOR_SYMBOL_PROB;
-
-  if (pVectorAdded == NULL)
-  {
-    g_pLogger->Log("CUserLogTrial::AddSymbols, failed to create pVectorAdded!", logNORMAL);
-    return;
-  }
-
   // Add the symbols to our running total of symbols.
   
   // ACL: Old comment said "We track the symbols and not the display text
diff --git a/Src/Gtk2/DasherControl.cpp b/Src/Gtk2/DasherControl.cpp
index a3cfae9..51aa93f 100644
--- a/Src/Gtk2/DasherControl.cpp
+++ b/Src/Gtk2/DasherControl.cpp
@@ -346,11 +346,11 @@ void CDasherControl::ExternalEventHandler(Dasher::CEvent *pEvent) {
     
     if(pEditEvent->m_iEditType == 1) {
       // Insert event
-      g_signal_emit_by_name(GTK_WIDGET(m_pDasherControl), "dasher_edit_insert", pEditEvent->m_sText.c_str(), pEditEvent->m_iOffset);
+      g_signal_emit_by_name(GTK_WIDGET(m_pDasherControl), "dasher_edit_insert", pEditEvent->m_sText.c_str(), pEditEvent->m_pNode->offset());
     }
     else if(pEditEvent->m_iEditType == 2) {
       // Delete event
-      g_signal_emit_by_name(GTK_WIDGET(m_pDasherControl), "dasher_edit_delete", pEditEvent->m_sText.c_str(), pEditEvent->m_iOffset);
+      g_signal_emit_by_name(GTK_WIDGET(m_pDasherControl), "dasher_edit_delete", pEditEvent->m_sText.c_str(), pEditEvent->m_pNode->offset());
     }
     else if(pEditEvent->m_iEditType == 10) {
       g_signal_emit_by_name(GTK_WIDGET(m_pDasherControl), "dasher_edit_convert");
diff --git a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
index 8a82f1d..cae2108 100755
--- a/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
+++ b/Src/MacOSX/Dasher.xcodeproj/project.pbxproj
@@ -334,6 +334,7 @@
 		33135354102C6D8E00E28220 /* CompassMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3313534C102C6D8E00E28220 /* CompassMode.h */; };
 		33135355102C6D8E00E28220 /* ButtonMode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3313534D102C6D8E00E28220 /* ButtonMode.cpp */; };
 		33135356102C6D8E00E28220 /* ButtonMode.h in Headers */ = {isa = PBXBuildFile; fileRef = 3313534E102C6D8E00E28220 /* ButtonMode.h */; };
+		3344F0691341297F001FACAB /* UserLogBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 3344F0681341297F001FACAB /* UserLogBase.cpp */; };
 		334DE238135E3E68007C8D6D /* control.textlabels.xml in Resources */ = {isa = PBXBuildFile; fileRef = 334DE236135E3E68007C8D6D /* control.textlabels.xml */; };
 		334DE239135E3E68007C8D6D /* control.xml in Resources */ = {isa = PBXBuildFile; fileRef = 334DE237135E3E68007C8D6D /* control.xml */; };
 		334DE23B135E3F4B007C8D6D /* control.dtd in Resources */ = {isa = PBXBuildFile; fileRef = 334DE23A135E3F4B007C8D6D /* control.dtd */; };
@@ -732,6 +733,7 @@
 		3313534C102C6D8E00E28220 /* CompassMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = CompassMode.h; sourceTree = "<group>"; };
 		3313534D102C6D8E00E28220 /* ButtonMode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = ButtonMode.cpp; sourceTree = "<group>"; };
 		3313534E102C6D8E00E28220 /* ButtonMode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = ButtonMode.h; sourceTree = "<group>"; };
+		3344F0681341297F001FACAB /* UserLogBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserLogBase.cpp; sourceTree = "<group>"; };
 		334DE236135E3E68007C8D6D /* control.textlabels.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = control.textlabels.xml; sourceTree = "<group>"; };
 		334DE237135E3E68007C8D6D /* control.xml */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = control.xml; sourceTree = "<group>"; };
 		334DE23A135E3F4B007C8D6D /* control.dtd */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.xml; path = control.dtd; sourceTree = "<group>"; };
@@ -871,6 +873,7 @@
 		1948BDF40C226CFC001DFA32 /* DasherCore */ = {
 			isa = PBXGroup;
 			children = (
+				3344F0681341297F001FACAB /* UserLogBase.cpp */,
 				33135349102C6D8E00E28220 /* AlternatingDirectMode.cpp */,
 				3313534A102C6D8E00E28220 /* AlternatingDirectMode.h */,
 				3313534B102C6D8E00E28220 /* CompassMode.cpp */,
@@ -1789,6 +1792,7 @@
 				330B91621292FE520022831C /* ModuleSettingsController.mm in Sources */,
 				33F6C9EB133241A000745B06 /* AbstractXMLParser.cpp in Sources */,
 				33B3431813A8A951009AE0D5 /* DashIntfScreenMsgs.cpp in Sources */,
+				3344F0691341297F001FACAB /* UserLogBase.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};
diff --git a/Src/MacOSX/DasherApp.mm b/Src/MacOSX/DasherApp.mm
index 925c7da..9a3860e 100644
--- a/Src/MacOSX/DasherApp.mm
+++ b/Src/MacOSX/DasherApp.mm
@@ -174,6 +174,8 @@
 
 - (void)applicationWillTerminate:(NSNotification *)aNotification {
   aquaDasherControl->StartShutdown();
+  delete aquaDasherControl;
+  aquaDasherControl=NULL;
 }
 
 - (void)dealloc {
diff --git a/Src/MacOSX/DasherViewOpenGL.mm b/Src/MacOSX/DasherViewOpenGL.mm
index 4f6e3e6..f3383cf 100755
--- a/Src/MacOSX/DasherViewOpenGL.mm
+++ b/Src/MacOSX/DasherViewOpenGL.mm
@@ -257,7 +257,10 @@ protected:
   screenint w=sz.width,h=sz.height;
   [self gl_reshape:w :h];
   aquaDasherScreen->resize(w, h, tc_x, tc_y);
-  [dasherApp aquaDasherControl]->ScreenResized(aquaDasherScreen);
+  //"reshape" gets called at shutdown, after applicationWillTerminate
+  // has deleted the aquaDasherControl...!
+  if (COSXDasherControl *pIntf = [dasherApp aquaDasherControl])
+    pIntf->ScreenResized(aquaDasherScreen);
     
   [self adjustTrackingRect];  
 }
diff --git a/Src/iPhone/Dasher.xcodeproj/project.pbxproj b/Src/iPhone/Dasher.xcodeproj/project.pbxproj
index 162556a..40a85a1 100755
--- a/Src/iPhone/Dasher.xcodeproj/project.pbxproj
+++ b/Src/iPhone/Dasher.xcodeproj/project.pbxproj
@@ -283,6 +283,7 @@
 		33F879F70FB1C27A003E737C /* Dasher.png in Resources */ = {isa = PBXBuildFile; fileRef = 33F879F60FB1C27A003E737C /* Dasher.png */; };
 		33F87A240FB1C775003E737C /* MainWindow.xib in Resources */ = {isa = PBXBuildFile; fileRef = 33F87A230FB1C775003E737C /* MainWindow.xib */; };
 		33F87A720FB1CB91003E737C /* Dasher_small.png in Resources */ = {isa = PBXBuildFile; fileRef = 33F87A710FB1CB91003E737C /* Dasher_small.png */; };
+		33FDB7F5135F310E00D6C952 /* UserLogBase.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 33FDB7F4135F310E00D6C952 /* UserLogBase.cpp */; };
 /* End PBXBuildFile section */
 
 /* Begin PBXFileReference section */
@@ -738,6 +739,7 @@
 		33F879F60FB1C27A003E737C /* Dasher.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Dasher.png; sourceTree = "<group>"; };
 		33F87A230FB1C775003E737C /* MainWindow.xib */ = {isa = PBXFileReference; lastKnownFileType = file.xib; path = MainWindow.xib; sourceTree = "<group>"; };
 		33F87A710FB1CB91003E737C /* Dasher_small.png */ = {isa = PBXFileReference; lastKnownFileType = image.png; path = Dasher_small.png; sourceTree = "<group>"; };
+		33FDB7F4135F310E00D6C952 /* UserLogBase.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = UserLogBase.cpp; sourceTree = "<group>"; };
 		8D1107310486CEB800E47090 /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; path = Info.plist; sourceTree = "<group>"; };
 /* End PBXFileReference section */
 
@@ -1288,6 +1290,7 @@
 				3344FE0A0F71717C00506EAA /* UserLog.cpp */,
 				3344FE0B0F71717C00506EAA /* UserLog.h */,
 				3344FE0C0F71717C00506EAA /* UserLogBase.h */,
+				33FDB7F4135F310E00D6C952 /* UserLogBase.cpp */,
 				3344FE0D0F71717C00506EAA /* UserLogParam.cpp */,
 				3344FE0E0F71717C00506EAA /* UserLogParam.h */,
 				3344FE0F0F71717C00506EAA /* UserLogTrial.cpp */,
@@ -1721,6 +1724,7 @@
 				3378A23F1335425300A96C5D /* AbstractXMLParser.cpp in Sources */,
 				333FDB5A139FB413009D018A /* ConvertingAlphMgr.cpp in Sources */,
 				33B3430813A8A927009AE0D5 /* DashIntfScreenMsgs.cpp in Sources */,
+				33FDB7F5135F310E00D6C952 /* UserLogBase.cpp in Sources */,
 			);
 			runOnlyForDeploymentPostprocessing = 0;
 		};



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