[dasher: 2/43] Win32 fixes, avoid SendMessage for Dasher::CEvent's coming from DasherCore



commit c1137c5279ad94cf54da340be51759a3169ed817
Author: Alan Lawrence <acl33 inf phy cam ac uk>
Date:   Sat Apr 9 22:40:55 2011 +0100

    Win32 fixes, avoid SendMessage for Dasher::CEvent's coming from DasherCore
    
    CDashEditbox doesn't exist; rm EV_EDIT_CONTEXT
    
    CDasher (constructed by Window) given ptrs to editor & window in constructor;
      ExternalEventHandler calls HandleXXXEvent methods on window and
      editor directly => bypass+RM generic CEdit::HandleEvent and WM_DASHER_EVENT!
      (CDasherWindow::m_pGameModeHelper made public as a temporary hack:( )
    
    + misc compile fixes

 Src/DasherCore/Alphabet/AlphIO.cpp      |    2 +-
 Src/DasherCore/DasherCore_vc80.vcproj   |  152 +-----------------------------
 Src/DasherCore/DasherModel.cpp          |    2 +-
 Src/DasherCore/DasherViewSquare.cpp     |    6 +-
 Src/DasherCore/EventHandler.cpp         |    2 +-
 Src/DasherCore/OneDimensionalFilter.cpp |    4 +-
 Src/Win32/AppSettings.cpp               |    6 +-
 Src/Win32/Dasher.cpp                    |   43 ++++++---
 Src/Win32/Dasher.h                      |   13 +--
 Src/Win32/DasherWindow.cpp              |   45 +--------
 Src/Win32/DasherWindow.h                |   17 ++--
 Src/Win32/Dasher_vc80.sln               |   24 +++---
 Src/Win32/Widgets/AlphabetBox.h         |    2 +-
 Src/Win32/Widgets/Edit.cpp              |   25 +-----
 Src/Win32/Widgets/Edit.h                |   11 +-
 Src/Win32/Widgets/Screen.inl            |    2 +-
 Src/Win32/Widgets/ViewPage.cpp          |    8 +-
 17 files changed, 90 insertions(+), 274 deletions(-)
---
diff --git a/Src/DasherCore/Alphabet/AlphIO.cpp b/Src/DasherCore/Alphabet/AlphIO.cpp
index d52b772..a9fdc1e 100644
--- a/Src/DasherCore/Alphabet/AlphIO.cpp
+++ b/Src/DasherCore/Alphabet/AlphIO.cpp
@@ -614,7 +614,7 @@ void CAlphIO::XmlEndHandler(const XML_Char *name) {
     finished->iEnd = InputInfo->m_vCharacters.size()+1;
     if (finished->iEnd == finished->iStart) {
       //empty group. Delete it now, and elide from sibling chain
-      SGroupInfo *&ptr(m_vGroups.size()==0 ? InputInfo->m_pBaseGroup : m_vGroups.back()->pChild);
+      SGroupInfo *&ptr=(m_vGroups.empty() ? InputInfo->m_pBaseGroup : m_vGroups.back()->pChild);
       DASHER_ASSERT(ptr == finished);
       ptr = finished->pNext;
       delete finished;
diff --git a/Src/DasherCore/DasherCore_vc80.vcproj b/Src/DasherCore/DasherCore_vc80.vcproj
index ca16602..c2fb1ba 100644
--- a/Src/DasherCore/DasherCore_vc80.vcproj
+++ b/Src/DasherCore/DasherCore_vc80.vcproj
@@ -1006,14 +1006,6 @@
 			Name="LanguageModelling"
 			>
 			<File
-				RelativePath="LanguageModelling\BigramLanguageModel.cpp"
-				>
-			</File>
-			<File
-				RelativePath="LanguageModelling\BigramLanguageModel.h"
-				>
-			</File>
-			<File
 				RelativePath=".\LanguageModelling\CTWLanguageModel.cpp"
 				>
 			</File>
@@ -1038,106 +1030,6 @@
 				>
 			</File>
 			<File
-				RelativePath="LanguageModelling\LanguageModel.cpp"
-				>
-				<FileConfiguration
-					Name="Release|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Pocket PC 2003 (ARMV4)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Pocket PC 2003 (ARMV4)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Mobile Debug|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Mobile Debug|Pocket PC 2003 (ARMV4)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Mobile Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release (W2K)|Win32"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release (W2K)|Pocket PC 2003 (ARMV4)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-				<FileConfiguration
-					Name="Release (W2K)|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)"
-					>
-					<Tool
-						Name="VCCLCompilerTool"
-						ObjectFile="$(IntDir)/$(InputName)1.obj"
-					/>
-				</FileConfiguration>
-			</File>
-			<File
 				RelativePath="LanguageModelling\LanguageModel.h"
 				>
 			</File>
@@ -1759,27 +1651,27 @@
 			>
 		</File>
 		<File
-			RelativePath="Alphabet\Alphabet.cpp"
+			RelativePath=".\AlphabetManager.cpp"
 			>
 		</File>
 		<File
-			RelativePath="Alphabet\Alphabet.h"
+			RelativePath=".\AlphabetManager.h"
 			>
 		</File>
 		<File
-			RelativePath=".\AlphabetManager.cpp"
+			RelativePath="Alphabet\AlphabetMap.cpp"
 			>
 		</File>
 		<File
-			RelativePath=".\AlphabetManager.h"
+			RelativePath="Alphabet\AlphabetMap.h"
 			>
 		</File>
 		<File
-			RelativePath="Alphabet\AlphabetMap.cpp"
+			RelativePath=".\Alphabet\AlphInfo.cpp"
 			>
 		</File>
 		<File
-			RelativePath="Alphabet\AlphabetMap.h"
+			RelativePath=".\Alphabet\AlphInfo.h"
 			>
 		</File>
 		<File
@@ -1975,14 +1867,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\DelayedDraw.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\View\DelayedDraw.h"
-			>
-		</File>
-		<File
 			RelativePath=".\DynamicFilter.cpp"
 			>
 		</File>
@@ -2011,14 +1895,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\EyetrackerFilter.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\EyetrackerFilter.h"
-			>
-		</File>
-		<File
 			RelativePath=".\FrameRate.cpp"
 			>
 		</File>
@@ -2166,14 +2042,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\PinyinParser.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\PinyinParser.h"
-			>
-		</File>
-		<File
 			RelativePath=".\SCENode.cpp"
 			>
 		</File>
@@ -2246,14 +2114,6 @@
 			>
 		</File>
 		<File
-			RelativePath=".\TrainingHelper.cpp"
-			>
-		</File>
-		<File
-			RelativePath=".\TrainingHelper.h"
-			>
-		</File>
-		<File
 			RelativePath=".\TwoButtonDynamicFilter.cpp"
 			>
 		</File>
diff --git a/Src/DasherCore/DasherModel.cpp b/Src/DasherCore/DasherModel.cpp
index b997302..844c5ec 100644
--- a/Src/DasherCore/DasherModel.cpp
+++ b/Src/DasherCore/DasherModel.cpp
@@ -375,7 +375,7 @@ void CDasherModel::Get_new_root_coords(dasherint X, dasherint Y, dasherint &r1,
   //We prefer to compute C from the _original_ (y1,y2) pair, as this is more
   // accurate (and avoids drifting up/down when heading straight along the
   // x-axis in dynamic button modes). However...
-  if ((y2-y1) < Y2 ^ (oy2-oy1) < Y2) {
+  if (((y2-y1) < Y2) ^ ((oy2-oy1) < Y2)) {
     //Sometimes (very occasionally), the calculation of a single-step above
     // can turn a zoom-in into a zoom-out, or vice versa, when the movement
     // is mostly translation. In which case, must compute C consistently with
diff --git a/Src/DasherCore/DasherViewSquare.cpp b/Src/DasherCore/DasherViewSquare.cpp
index f2e4004..8330ef7 100644
--- a/Src/DasherCore/DasherViewSquare.cpp
+++ b/Src/DasherCore/DasherViewSquare.cpp
@@ -345,7 +345,7 @@ void CDasherViewSquare::Circle(myint Range, myint y1, myint y2, int fCol, int oC
     Dasher2Screen(0, iDasherMinY, p.x, p.y);
     pts.push_back(p);
     //intersect with bottom edge
-    x1 = min(iDasherMaxX, myint(sqrt(r*r - sq(cy-iDasherMinY))));
+    x1 = min(iDasherMaxX, myint(sqrt(double(r*r - sq(cy-iDasherMinY)))));
     y1 = iDasherMinY;
   } else {
     x1=0;
@@ -356,7 +356,7 @@ void CDasherViewSquare::Circle(myint Range, myint y1, myint y2, int fCol, int oC
   //and along top...
   if (y2 > iDasherMaxY) {
     //intersect...
-    x2 = min(iDasherMaxX, myint(sqrt(r*r - sq(iDasherMaxY-cy))));
+    x2 = min(iDasherMaxX, myint(sqrt(double(r*r - sq(iDasherMaxY-cy)))));
     Dasher2Screen(x2, y2=iDasherMaxY, p.x, p.y);
     //that's target point for end of curved section.
     if (x2==iDasherMaxX && x1==iDasherMaxX) {
@@ -382,7 +382,7 @@ void CDasherViewSquare::Circle(myint Range, myint y1, myint y2, int fCol, int oC
 
 void CDasherViewSquare::CircleTo(myint cy, myint r, myint y1, myint x1, myint y3, myint x3, CDasherScreen::point dest, vector<CDasherScreen::point> &pts) {
   myint y2((y1+y3)/2);
-  myint x2(sqrt(sq(r)-sq(cy-y2))*2);
+  myint x2(sqrt(double(sq(r)-sq(cy-y2)))*2);
   CDasherScreen::point mid; //where midpoint of circle/arc should be
   Dasher2Screen(x2, y2, mid.x, mid.y); //(except "midpoint" measured along y axis)
   int lmx=(pts.back().x + dest.x)/2, lmy = (pts.back().y + dest.y)/2; //midpoint of straight line
diff --git a/Src/DasherCore/EventHandler.cpp b/Src/DasherCore/EventHandler.cpp
index 2b9cafb..027ffce 100644
--- a/Src/DasherCore/EventHandler.cpp
+++ b/Src/DasherCore/EventHandler.cpp
@@ -53,7 +53,7 @@ void CEventHandler::RegisterListener(CDasherComponent *pListener) {
 
   if((std::find(m_vListeners.begin(), m_vListeners.end(), pListener) == m_vListeners.end()) &&
      (std::find(m_vListenerQueue.begin(), m_vListenerQueue.end(), pListener) == m_vListenerQueue.end())) {
-    if(!m_iInHandler > 0)
+    if(m_iInHandler <= 0)
       m_vListeners.push_back(pListener);
     else
       m_vListenerQueue.push_back(pListener);
diff --git a/Src/DasherCore/OneDimensionalFilter.cpp b/Src/DasherCore/OneDimensionalFilter.cpp
index 990bc6e..2085e2d 100644
--- a/Src/DasherCore/OneDimensionalFilter.cpp
+++ b/Src/DasherCore/OneDimensionalFilter.cpp
@@ -78,7 +78,7 @@ CStartHandler *COneDimensionalFilter::MakeStartHandler() {
   if (GetBoolParameter(BP_CIRCLE_START)) {
     class C1DCircleStartHandler : public CCircleStartHandler {
     public:
-      C1DCircleStartHandler(COneDimensionalFilter *f) : CCircleStartHandler(f->m_pEventHandler, f->m_pSettingsStore, f->m_pInterface), filter(f) {
+      C1DCircleStartHandler(CEventHandler *pEvtH, CSettingsStore *pSets, COneDimensionalFilter *f) : CCircleStartHandler(pEvtH, pSets, f->m_pInterface), filter(f) {
       }
       void ComputeScreenLoc(CDasherView *pView) {
         if (m_iScreenRadius!=-1) return;
@@ -102,7 +102,7 @@ CStartHandler *COneDimensionalFilter::MakeStartHandler() {
     private:
       const COneDimensionalFilter *filter;
     };
-    return new C1DCircleStartHandler(this);
+    return new C1DCircleStartHandler(m_pEventHandler,m_pSettingsStore,this);
   }
   return CDefaultFilter::MakeStartHandler();
 }
diff --git a/Src/Win32/AppSettings.cpp b/Src/Win32/AppSettings.cpp
index 0b2db41..47946b1 100644
--- a/Src/Win32/AppSettings.cpp
+++ b/Src/Win32/AppSettings.cpp
@@ -103,7 +103,7 @@ void CAppSettings::SetBoolParameter(int iParameter, bool bValue) {
     SaveSetting(m_pBoolTable[iParameter - FIRST_APP_BP].regName, bValue);
 
     Dasher::CParameterNotificationEvent oEvent(iParameter);
-    SendMessage(m_hWnd, WM_DASHER_EVENT, 0, (LPARAM)&oEvent);
+    m_pDasher->ExternalEventHandler(&oEvent);
   }
 }
 
@@ -121,7 +121,7 @@ void CAppSettings::SetLongParameter(int iParameter, long iValue) {
     m_pLongTable[iParameter - FIRST_APP_LP].value = iValue;
     SaveSetting(m_pLongTable[iParameter - FIRST_APP_LP].regName, iValue); 
     Dasher::CParameterNotificationEvent oEvent(iParameter);
-    SendMessage(m_hWnd, WM_DASHER_EVENT, 0, (LPARAM)&oEvent);
+    m_pDasher->ExternalEventHandler(&oEvent);
   }
 }
 
@@ -139,7 +139,7 @@ void CAppSettings::SetStringParameter(int iParameter, const std::string &strValu
     m_pStringTable[iParameter - FIRST_APP_SP].value = strValue;
     SaveSetting(m_pStringTable[iParameter - FIRST_APP_SP].regName, strValue);
     Dasher::CParameterNotificationEvent oEvent(iParameter);
-    SendMessage(m_hWnd, WM_DASHER_EVENT, 0, (LPARAM)&oEvent);
+    m_pDasher->ExternalEventHandler(&oEvent);
   }
 }
 
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index 342463c..f850219 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -31,13 +31,12 @@ using namespace WinUTF8;
 // shouldn't collide with anything else in our code.
 #define WM_DASHER_TIMER WM_USER + 128
 
-CONST UINT WM_DASHER_EVENT = RegisterWindowMessage(_WM_DASHER_EVENT);
 CONST UINT WM_DASHER_FOCUS = RegisterWindowMessage(_WM_DASHER_FOCUS);
 CONST UINT WM_DASHER_GAME_MESSAGE = RegisterWindowMessage(_WM_DASHER_GAME_MESSAGE);
 
-CDasher::CDasher(HWND Parent):m_hParent(Parent) {
+CDasher::CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit)
+ : m_hParent(Parent), m_pWindow(pWindow), m_pEdit(pEdit) {
   // This class will be a wrapper for the Dasher 'control' - think ActiveX
-  m_pEdit = 0;
 
 #ifndef _WIN32_WCE
   // Set up COM for the accessibility stuff
@@ -109,8 +108,35 @@ void CDasher::Log() {
 
 }
 
-void Dasher::CDasher::ExternalEventHandler(CEvent* pEvent) {
-  SendMessage(m_hParent, WM_DASHER_EVENT, 0, (LPARAM)pEvent);
+void Dasher::CDasher::ExternalEventHandler(CEvent* pEvent) {  
+  switch(pEvent->m_iEventType) {
+    case EV_PARAM_NOTIFY: {
+      int iParam(static_cast<CParameterNotificationEvent *> (pEvent)->m_iParameter);
+      m_pWindow->HandleParameterChange(iParam);
+      m_pEdit->HandleParameterChange(iParam);
+      break;
+    case EV_CONTROL:
+      m_pWindow->HandleControlEvent(((CControlEvent *)pEvent)->m_iID);
+      break;
+    }
+    case EV_EDIT:  {
+      CEditEvent *pEvt(static_cast<CEditEvent *> (pEvent));
+      if(m_pWindow->m_pGameModeHelper) {
+        switch (pEvt->m_iEditType) {
+          case 1:
+            m_pWindow->m_pGameModeHelper->Output(pEvt->m_sText);
+            break;
+          case 2:
+            m_pWindow->m_pGameModeHelper->Delete(pEvt->m_sText.size());
+            break;
+        }
+      }
+      m_pEdit->HandleEditEvent(pEvt);
+      break;
+    }
+    default:
+      break;
+  }
 }
 
 void Dasher::CDasher::GameMessageOut(int message, const void *messagedata)
@@ -136,13 +162,6 @@ bool Dasher::CDasher::GetWindowSize(int* pTop, int* pLeft, int* pBottom, int* pR
     return false;
 }
 
-void Dasher::CDasher::SetEdit(CDashEditbox * pEdit) {
-  // FIXME - we really need to make sure we have a
-  // more sensible way of passing messages out here.
-
-  m_pEdit = pEdit;
-}
-
 void Dasher::CDasher::WriteTrainFile(const std::string &filename, const std::string &strNewText) {
   const std::string TrainFile = GetStringParameter(SP_USER_LOC) + filename;
 
diff --git a/Src/Win32/Dasher.h b/Src/Win32/Dasher.h
index df69899..ffc4a08 100644
--- a/Src/Win32/Dasher.h
+++ b/Src/Win32/Dasher.h
@@ -8,9 +8,6 @@
 #include <string>
 #include <vector>
 
-extern CONST UINT WM_DASHER_EVENT;
-#define _WM_DASHER_EVENT (LPCWSTR)"wm_dasher_event"
-
 extern CONST UINT WM_DASHER_FOCUS;
 #define _WM_DASHER_FOCUS (LPCWSTR)"wm_dasher_focus"
 
@@ -20,13 +17,14 @@ extern CONST UINT WM_DASHER_GAME_MESSAGE;
 
 class CCanvas;
 class CSlidebar;
-class CDashEditbox;
+class CEdit;
+class CDasherWindow;
 
 namespace Dasher {
 class CDasher : public CDasherInterfaceBase 
 {
 public:
-  CDasher(HWND Parent);
+  CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit);
   ~CDasher(void);
 
   // The following functions will not be part of the final interface
@@ -41,8 +39,6 @@ public:
   void Move(int iX, int iY, int iWidth, int iHeight);
   void TakeFocus();
 
-  void SetEdit(CDashEditbox * pEdit);
-
   void ExternalEventHandler(Dasher::CEvent *pEvent);
   void GameMessageOut(int message, const void* messagedata);
   
@@ -77,8 +73,9 @@ private:
   void                    Log();                        // Does the logging
 
   CCanvas *m_pCanvas;
-  CDashEditbox *m_pEdit;
   HWND m_hParent;
+  CDasherWindow *m_pWindow;
+  CEdit *m_pEdit;
 #ifndef _WIN32_WCE
   ISpVoice *pVoice;
   bool attemptedSpeech;
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index 1e8e2ee..8660e99 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -97,17 +97,18 @@ HWND CDasherWindow::Create() {
 
 
 
-  // Create Widgets
-  m_pDasher = new CDasher(hWnd);
 
   // Create a CAppSettings
   m_pAppSettings->SetHwnd(hWnd);
   m_pAppSettings->SetDasher(m_pDasher);
 
+  // Create Widgets
   m_pEdit = new CEdit(m_pAppSettings);
   m_pEdit->Create(hWnd, m_pAppSettings->GetBoolParameter(APP_BP_TIME_STAMP));
   m_pEdit->SetFont(m_pAppSettings->GetStringParameter(APP_SP_EDIT_FONT), m_pAppSettings->GetLongParameter(APP_LP_EDIT_FONT_SIZE));
  
+  m_pDasher = new CDasher(hWnd, this, m_pEdit);
+
 #ifdef PJC_EXPERIMENTAL
   g_hWnd = m_pEdit->GetHwnd();
 #endif
@@ -405,42 +406,6 @@ LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOO
   return 0;
 }
 
-LRESULT CDasherWindow::OnDasherEvent(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
-  // Apparently putting the typecast directly in the switch doesn't work
-  CEvent *pEvent( (CEvent *)lParam );
-  
-  // TODO: return if handled?
-  switch(pEvent->m_iEventType) {
-  case EV_PARAM_NOTIFY:
-    HandleParameterChange(((CParameterNotificationEvent *)pEvent)->m_iParameter);
-    break;
-  case EV_CONTROL:
-    HandleControlEvent(((CControlEvent *)pEvent)->m_iID);
-    break;
-  case EV_EDIT: 
-    if(m_pGameModeHelper) {
-      Dasher::CEditEvent * pEvt(static_cast< Dasher::CEditEvent * >(pEvent));
-      
-      switch (pEvt->m_iEditType) {
-      case 1:
-	      m_pGameModeHelper->Output(pEvt->m_sText);
-	      break;
-      case 2:
-	      m_pGameModeHelper->Delete(pEvt->m_sText.size());
-	      break;
-      }
-    }
-    break;
-  default:
-    break;
-  }
-  
-  if(m_pEdit) 
-    m_pEdit->HandleEvent(pEvent);
-  
-  return 0;
-}
-
 LRESULT CDasherWindow::OnGameMessage(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled) {
   m_pGameGroup->Message(static_cast<int>(wParam), reinterpret_cast<const void*>(lParam));
   bHandled=true;
@@ -517,9 +482,7 @@ LRESULT CDasherWindow::OnOther(UINT message, WPARAM wParam, LPARAM lParam, BOOL&
 	// A switch statement would be preferable, except the message ids are
   // not constant-expressions since they are provided by the system at
   // runtime.
-  if (message == WM_DASHER_EVENT)
-    return OnDasherEvent( message, wParam, lParam, bHandled);
-  else if (message == WM_DASHER_FOCUS)
+  if (message == WM_DASHER_FOCUS)
     return OnDasherFocus(message, wParam, lParam, bHandled);
   else if (message == WM_DASHER_GAME_MESSAGE)
     return OnGameMessage(message, wParam, lParam, bHandled);
diff --git a/Src/Win32/DasherWindow.h b/Src/Win32/DasherWindow.h
index 0a6fba9..8f99204 100644
--- a/Src/Win32/DasherWindow.h
+++ b/Src/Win32/DasherWindow.h
@@ -69,7 +69,6 @@ public:
 	LRESULT OnGetMinMaxInfo(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 #endif
 	LRESULT OnOther(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
-	LRESULT OnDasherEvent(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 	LRESULT OnGameMessage(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 	LRESULT OnDasherFocus(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
 	LRESULT OnSize(UINT message, WPARAM wParam, LPARAM lParam, BOOL& bHandled);
@@ -91,6 +90,11 @@ public:
     LONG idObject, LONG idChild, DWORD dwEventThread, DWORD dwmsEventTime);
 #endif
 
+  ///ACL making these public so can be called directly from CDasher,
+  /// rather than sending a windows message.
+  void HandleControlEvent(int iID);
+  void HandleParameterChange(int iParameter);
+  
 private:
  
 	// Main processing function, called by MessageLoop
@@ -103,14 +107,6 @@ private:
 
 	HACCEL hAccelTable;
 
-	/// 
-	/// Handle control events
-	///
-
-	void HandleControlEvent(int iID);
-
-	void HandleParameterChange(int iParameter);
-
 	// Widgets:
 	CToolbar *m_pToolbar;
 	CEdit *m_pEdit;
@@ -133,7 +129,8 @@ private:
 
 	// Misc window handling
 	void Layout();
-
+public:
+  // ACL temporary hack to allow CDasher to send it edit events.
   CGameModeHelper *m_pGameModeHelper;
 
 };
diff --git a/Src/Win32/Dasher_vc80.sln b/Src/Win32/Dasher_vc80.sln
index 388a8d6..a81f019 100644
--- a/Src/Win32/Dasher_vc80.sln
+++ b/Src/Win32/Dasher_vc80.sln
@@ -102,9 +102,9 @@ Global
 	GlobalSection(ProjectConfigurationPlatforms) = postSolution
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Any CPU.Build.0 = Debug|Win32
-		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
@@ -149,9 +149,9 @@ Global
 		{4A4CEB83-FBC8-4E93-831E-009875E54794}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Any CPU.Build.0 = Debug|Win32
-		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
@@ -194,9 +194,9 @@ Global
 		{752501D3-5B04-4F3C-A141-DE426E354D23}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Any CPU.Build.0 = Debug|Win32
-		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
@@ -241,9 +241,9 @@ Global
 		{3998D966-9B9E-4214-ACEA-B777985AF4DD}.Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I).Build.0 = Release|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
 		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Any CPU.ActiveCfg = Debug|Win32
 		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Any CPU.Build.0 = Debug|Win32
-		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.Build.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
-		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.Deploy.0 = Debug|Windows Mobile 5.0 Pocket PC SDK (ARMV4I)
+		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.ActiveCfg = Debug|Win32
+		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.Build.0 = Debug|Win32
+		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Mixed Platforms.Deploy.0 = Debug|Win32
 		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Pocket PC 2003 (ARMV4).ActiveCfg = Debug|Pocket PC 2003 (ARMV4)
 		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Pocket PC 2003 (ARMV4).Build.0 = Debug|Pocket PC 2003 (ARMV4)
 		{192C1E5C-2D1E-4AA3-91C3-FF2D7ABD67F8}.Debug|Pocket PC 2003 (ARMV4).Deploy.0 = Debug|Pocket PC 2003 (ARMV4)
diff --git a/Src/Win32/Widgets/AlphabetBox.h b/Src/Win32/Widgets/AlphabetBox.h
index 9eb33f5..2590bd8 100644
--- a/Src/Win32/Widgets/AlphabetBox.h
+++ b/Src/Win32/Widgets/AlphabetBox.h
@@ -26,7 +26,7 @@ private:
 
   std::vector < std::string > AlphabetList;
   std::string m_CurrentAlphabet;
-  Dasher::CAlphIO::AlphInfo CurrentInfo;
+  //Dasher::CAlphInfo CurrentInfo;//for editing alphabets
 
   std::vector < std::string > ColourList;
   
diff --git a/Src/Win32/Widgets/Edit.cpp b/Src/Win32/Widgets/Edit.cpp
index 2bf5823..853a864 100644
--- a/Src/Win32/Widgets/Edit.cpp
+++ b/Src/Win32/Widgets/Edit.cpp
@@ -873,21 +873,6 @@ void CEdit::SetNewWithDate(bool bNewWithDate) {
     m_FilenameGUI->SetNewWithDate(bNewWithDate);
 }
 
-void CEdit::HandleEvent(Dasher::CEvent *pEvent) {
-  switch(pEvent->m_iEventType) {
-  case EV_PARAM_NOTIFY:
-    HandleParameterChange(((CParameterNotificationEvent *)pEvent)->m_iParameter);
-    break;
-  case EV_EDIT:
-    HandleEditEvent(pEvent);
-    break;
-  case EV_EDIT_CONTEXT:
-    // TODO: Make this return the context properly. cf Linux 
-    //m_pDasherInterface->SetContext("");
-    break;
-  }
-}
-
 void CEdit::HandleParameterChange(int iParameter) {
   switch(iParameter) {
   case APP_SP_EDIT_FONT:
@@ -899,9 +884,7 @@ void CEdit::HandleParameterChange(int iParameter) {
   }
 }
 
-void CEdit::HandleEditEvent(Dasher::CEvent *pEvent) {
-  Dasher::CEditEvent * pEvt(static_cast< Dasher::CEditEvent * >(pEvent));
-
+void CEdit::HandleEditEvent(Dasher::CEditEvent *pEvt) {
   switch (pEvt->m_iEditType) {
     case 1:
       output(pEvt->m_sText);
@@ -910,8 +893,4 @@ void CEdit::HandleEditEvent(Dasher::CEvent *pEvent) {
       deletetext(pEvt->m_sText);
       break;
   }
-}
-
-void CEdit::HandleStop() {
-  //speech and copy-to-clipboard are now global/platform-independent...
-}
+}
\ No newline at end of file
diff --git a/Src/Win32/Widgets/Edit.h b/Src/Win32/Widgets/Edit.h
index c6d0773..3f39545 100644
--- a/Src/Win32/Widgets/Edit.h
+++ b/Src/Win32/Widgets/Edit.h
@@ -137,17 +137,16 @@ class CEdit : public ATL::CWindowImpl<CEdit> {
   void deletetext(const std::string & sText);
   
   void SetNewWithDate(bool bNewWithDate);
-  void HandleEvent(Dasher::CEvent *pEvent);
+
+  //ACL Making these public so can be called directly from CDasher
+  void HandleParameterChange(int iParameter);
+  void HandleEditEvent(Dasher::CEditEvent *pEvent);
 
  protected:
   bool m_dirty;
   LRESULT WndProc(HWND Window, UINT message, WPARAM wParam, LPARAM lParam);
   
- private:
-  void HandleParameterChange(int iParameter);
-  void HandleEditEvent(Dasher::CEvent *pEvent);
-  void HandleStop();
-  
+ private:  
   Dasher::CDasherInterfaceBase *m_pDasherInterface;
   
   HWND Parent;
diff --git a/Src/Win32/Widgets/Screen.inl b/Src/Win32/Widgets/Screen.inl
index a30af70..1fa2046 100644
--- a/Src/Win32/Widgets/Screen.inl
+++ b/Src/Win32/Widgets/Screen.inl
@@ -39,7 +39,7 @@ inline void CScreen::DrawRectangle(screenint x1, screenint y1, screenint x2, scr
 
 inline void CScreen::DrawCircle(screenint iCX, screenint iCY, screenint iR, int iFillColour, int iLineColour, int iThickness) {
   HGDIOBJ hpOld;
-  hpOld = (HPEN) SelectObject(m_hDCBuffer, GetPen(iColour, iThickness));
+  hpOld = (HPEN) SelectObject(m_hDCBuffer, GetPen(iLineColour, iThickness));
 
   if(iFillColour!=-1) {
     HBRUSH hBrush = CScreen::GetBrush(iFillColour);
diff --git a/Src/Win32/Widgets/ViewPage.cpp b/Src/Win32/Widgets/ViewPage.cpp
index 408d09a..dcaecd5 100644
--- a/Src/Win32/Widgets/ViewPage.cpp
+++ b/Src/Win32/Widgets/ViewPage.cpp
@@ -39,7 +39,6 @@ struct menuentry {
 
 // List of menu items that will be displayed in the General Preferences
 static menuentry menutable[] = {
-  {BP_OUTLINE_MODE, IDC_OUTLINE},
   {BP_DRAW_MOUSE, IDC_DRAWMOUSE},
   {BP_DRAW_MOUSE_LINE, IDC_DRAWMOUSELINE},
 };
@@ -97,8 +96,8 @@ void CViewPage::PopulateList() {
   else
     SendMessage(GetDlgItem(m_hwnd, IDC_THICKLINE), BM_SETCHECK, BST_UNCHECKED, 0);
 
- 
-
+  SendMessage(GetDlgItem(m_hwnd, IDC_OUTLINE), BM_SETCHECK,
+	  m_pAppSettings->GetLongParameter(LP_OUTLINE_WIDTH) ? BST_CHECKED : BST_UNCHECKED, 0); 
   
   if(m_pAppSettings->GetLongParameter(LP_DASHER_FONTSIZE) == Dasher::Opts::Normal) {
     SendMessage(GetDlgItem(m_hwnd, IDC_FONT_SMALL), BM_SETCHECK, BST_CHECKED, 0);
@@ -119,6 +118,9 @@ bool CViewPage::Apply() {
       SendMessage(GetDlgItem(m_hwnd, menutable[ii].idcNum), BM_GETCHECK, 0, 0) == BST_CHECKED );
   }
 
+  m_pAppSettings->SetLongParameter(LP_OUTLINE_WIDTH,
+	  SendMessage(GetDlgItem(m_hwnd, IDC_OUTLINE), BM_GETCHECK, 0, 0) ? 1 : 0);
+
   if(SendMessage(GetDlgItem(m_hwnd, IDC_THICKLINE), BM_GETCHECK, 0, 0))
     m_pAppSettings->SetLongParameter(LP_LINE_WIDTH, 3);
   else



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