[dasher: 18/217] Fix for Win32: control box Delete adds chinese letters instead of deleting content.



commit 885571b6ce415446370ecac19dc5a6793f095f5e
Author: ipomoena <amajorek google com>
Date:   Thu Sep 3 16:01:18 2015 -0700

    Fix for Win32: control box Delete adds chinese letters instead of deleting content.
    
    Fixes https://github.com/ipomoena/dasher/issues/6 and other places I
    found where char* was used where wchar_t*

 .gitignore                          |    2 ++
 Src/Win32/Dasher.cpp                |    2 +-
 Src/Win32/Dasher.h                  |    1 -
 Src/Win32/DasherWindow.cpp          |    3 ---
 Src/Win32/Widgets/Edit.cpp          |    2 +-
 Src/Win32/Widgets/StatusControl.cpp |    6 ++----
 Src/Win32/Widgets/StatusControl.h   |    3 ---
 7 files changed, 6 insertions(+), 13 deletions(-)
---
diff --git a/.gitignore b/.gitignore
index a186017..41dd786 100644
--- a/.gitignore
+++ b/.gitignore
@@ -24,3 +24,5 @@ Template/
 *.sdf
 *~
 *.vcxproj.user
+Src/Win32/Dasher.aps
+Src/Win32/Dasher_vc2013.opensdf
diff --git a/Src/Win32/Dasher.cpp b/Src/Win32/Dasher.cpp
index b8f4d7d..fbcbb1b 100644
--- a/Src/Win32/Dasher.cpp
+++ b/Src/Win32/Dasher.cpp
@@ -30,7 +30,7 @@ using namespace WinUTF8;
 // shouldn't collide with anything else in our code.
 #define WM_DASHER_TIMER WM_USER + 128
 
-CONST UINT WM_DASHER_FOCUS = RegisterWindowMessage(_WM_DASHER_FOCUS);
+CONST UINT WM_DASHER_FOCUS = RegisterWindowMessage(L"WM_DASHER_FOCUS");
 
 CDasher::CDasher(HWND Parent, CDasherWindow *pWindow, CEdit *pEdit)
  : CDashIntfScreenMsgs(new CWinOptions( "Inference Group", "Dasher3")), m_hParent(Parent), 
m_pWindow(pWindow), m_pEdit(pEdit) {
diff --git a/Src/Win32/Dasher.h b/Src/Win32/Dasher.h
index 23eb8e2..6f64b23 100644
--- a/Src/Win32/Dasher.h
+++ b/Src/Win32/Dasher.h
@@ -17,7 +17,6 @@
 #include <vector>
 
 extern CONST UINT WM_DASHER_FOCUS;
-#define _WM_DASHER_FOCUS (LPCWSTR)"wm_dasher_focus"
 
 class CCanvas;
 class CEdit;
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index 1667a5b..ff42efd 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -355,9 +355,6 @@ LRESULT CDasherWindow::OnOther(UINT message, WPARAM wParam, LPARAM lParam, BOOL&
   // runtime.
   if (message == WM_DASHER_FOCUS)
     return OnDasherFocus(message, wParam, lParam, bHandled);
-  else if (message == DASHER_SHOW_PREFS) {
-    CPrefs Prefs(m_hWnd, m_pDasher, m_pAppSettings);
-  }
 
   return 0;
 }
diff --git a/Src/Win32/Widgets/Edit.cpp b/Src/Win32/Widgets/Edit.cpp
index 6525f4e..4a2c81a 100644
--- a/Src/Win32/Widgets/Edit.cpp
+++ b/Src/Win32/Widgets/Edit.cpp
@@ -719,7 +719,7 @@ int CEdit::Delete(bool bForwards, CControlManager::EditDistance iDist) {
   }
 
   SendMessage(EM_SETSEL, (WPARAM)iStart, (LPARAM)iEnd);
-  SendMessage(EM_REPLACESEL, (WPARAM)true, (LPARAM)"");
+  SendMessage(EM_REPLACESEL, (WPARAM)true, (LPARAM)TEXT(""));
   return min(iStart, iEnd);
 }
 
diff --git a/Src/Win32/Widgets/StatusControl.cpp b/Src/Win32/Widgets/StatusControl.cpp
index 858357d..30263a2 100644
--- a/Src/Win32/Widgets/StatusControl.cpp
+++ b/Src/Win32/Widgets/StatusControl.cpp
@@ -1,11 +1,9 @@
 #include "StatusControl.h"
 #include "WinCommon.h"
+#include "../resource.h"
 
 #include <string>
 
-// TODO: Make this a notify?
-CONST UINT DASHER_SHOW_PREFS = RegisterWindowMessage(_DASHER_SHOW_PREFS);
-
 CStatusControl::CStatusControl(CAppSettings *pAppSettings) : m_pAppSettings(pAppSettings) {
 }
 
@@ -219,7 +217,7 @@ void CStatusControl::SelectAlphabet() {
   SendMessage(m_hCombo, CB_GETLBTEXT, iIndex, (LPARAM)szSelection);
 
   if(!_tcscmp(szSelection, L"More Alphabets...")) {
-    SendMessage(GetParent().m_hWnd, DASHER_SHOW_PREFS, 0, 0);
+    GetParent().SendMessage(WM_COMMAND, ID_OPTIONS_PREFS, 0);
   }
   else {
     std::string strNewValue;
diff --git a/Src/Win32/Widgets/StatusControl.h b/Src/Win32/Widgets/StatusControl.h
index 14b8456..2a02b7f 100644
--- a/Src/Win32/Widgets/StatusControl.h
+++ b/Src/Win32/Widgets/StatusControl.h
@@ -7,9 +7,6 @@
 #include <atlbase.h>
 #include <atlwin.h>
 
-extern CONST UINT DASHER_SHOW_PREFS;
-#define _DASHER_SHOW_PREFS (LPCWSTR)"dasher_show_prefs"
-
 class CStatusControl : public ATL::CWindowImpl<CStatusControl> {
 public:
        CStatusControl(CAppSettings *pAppSettings);


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