[dasher: 194/217] Cleanup unused CEdit variables.
- From: Patrick Welche <pwelche src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [dasher: 194/217] Cleanup unused CEdit variables.
- Date: Sat, 27 Feb 2016 12:16:38 +0000 (UTC)
commit a15713e6c8d3d3d58c4d70207a7373e6d7357e47
Author: Ada Majorek <amajorek google com>
Date: Tue Jan 26 12:52:34 2016 -0800
Cleanup unused CEdit variables.
Src/Win32/DasherWindow.cpp | 4 ++--
Src/Win32/Widgets/Edit.cpp | 39 ++++++---------------------------------
Src/Win32/Widgets/Edit.h | 13 -------------
3 files changed, 8 insertions(+), 48 deletions(-)
---
diff --git a/Src/Win32/DasherWindow.cpp b/Src/Win32/DasherWindow.cpp
index 1c54c35..ab313f1 100644
--- a/Src/Win32/DasherWindow.cpp
+++ b/Src/Win32/DasherWindow.cpp
@@ -206,7 +206,7 @@ LRESULT CDasherWindow::OnCommand(UINT message, WPARAM wParam, LPARAM lParam, BOO
// Tell edit box if it has changed. It should know itself really, but this is easier
// This shouldn't be here - it should be in the edit box class
- if (((HWND)lParam == m_pEdit->GetHwnd()) && (HIWORD(wParam) == EN_CHANGE)) {
+ if (((HWND)lParam == *m_pEdit) && (HIWORD(wParam) == EN_CHANGE)) {
m_pEdit->SetDirty();
return 0;
}
@@ -288,7 +288,7 @@ LRESULT CDasherWindow::OnDasherFocus(UINT message, WPARAM wParam, LPARAM lParam,
return 0;
}
- ::SetFocus(m_pEdit->GetHwnd());
+ m_pEdit->SetFocus();
// TODO: Is this obsolete?
HWND *pHwnd((HWND *)lParam);
diff --git a/Src/Win32/Widgets/Edit.cpp b/Src/Win32/Widgets/Edit.cpp
index d9d92d6..4c565e0 100644
--- a/Src/Win32/Widgets/Edit.cpp
+++ b/Src/Win32/Widgets/Edit.cpp
@@ -38,31 +38,26 @@ using namespace WinLocalisation;
using namespace WinUTF8;
CEdit::CEdit(CAppSettings *pAppSettings) {
- m_FontSize = 0;
- m_FontName = "";
m_FilenameGUI = 0;
// TODO: Check that this is all working okay (it quite probably
// isn't). In the long term need specialised editor classes.
targetwindow = 0;
- textentry = false;
m_pAppSettings = pAppSettings;
- CodePage = GetUserCodePage();
-#ifndef _WIN32_WCE
+ UINT CodePage = GetUserCodePage();
m_Font = GetCodePageFont(CodePage, 14);
-#endif
}
HWND CEdit::Create(HWND hParent, bool bNewWithDate) {
- m_hWnd = CWindowImpl<CEdit>::Create(hParent, NULL, NULL, ES_NOHIDESEL | WS_CHILD | ES_MULTILINE |
WS_VSCROLL | WS_VISIBLE, WS_EX_CLIENTEDGE);
+ CWindowImpl<CEdit>::Create(hParent, NULL, NULL, ES_NOHIDESEL | WS_CHILD | ES_MULTILINE | WS_VSCROLL |
WS_VISIBLE, WS_EX_CLIENTEDGE);
Tstring WindowTitle;
WinLocalisation::GetResourceString(IDS_APP_TITLE, &WindowTitle);
m_FilenameGUI = new CFilenameGUI(hParent, WindowTitle.c_str(), bNewWithDate);
- return m_hWnd;
+ return *this;
}
@@ -277,10 +272,6 @@ void CEdit::Clear() {
}
void CEdit::SetFont(string Name, long Size) {
-#ifndef _WIN32_WCE
- m_FontName = Name;
- m_FontSize = Size;
-
Tstring FontName;
UTF8string_to_wstring(Name, FontName);
@@ -288,25 +279,18 @@ void CEdit::SetFont(string Name, long Size) {
Size = 14;
DeleteObject(m_Font);
- if(Name == "")
+ if (Name == "") {
+ UINT CodePage = GetUserCodePage();
m_Font = GetCodePageFont(CodePage, -Size);
+ }
else
m_Font = CreateFont(-Size, 0, 0, 0, FW_DONTCARE, FALSE, FALSE, FALSE, DEFAULT_CHARSET,
OUT_DEFAULT_PRECIS, CLIP_DEFAULT_PRECIS, DEFAULT_QUALITY, FF_DONTCARE, FontName.c_str()); //
DEFAULT_CHARSET => font made just from Size and FontName
SendMessage(WM_SETFONT, (WPARAM) m_Font, true);
-#else
- // not implemented
-#pragma message ( "CEdit::SetFot not implemented on WinCE")
- //DASHER_ASSERT(0);
-#endif
}
void CEdit::SetInterface(Dasher::CDasherInterfaceBase *DasherInterface) {
m_pDasherInterface = DasherInterface;
-#ifndef _WIN32_WCE
- // TODO: What on Earth is this doing here?
- //SetFont(m_FontName, m_FontSize);
-#endif
}
void CEdit::output(const std::string &sText) {
@@ -328,11 +312,7 @@ void CEdit::output(const std::string &sText) {
else {
for(std::wstring::iterator it(String.begin()); it != String.end(); ++it) {
fakekey[0].type = INPUT_KEYBOARD;
-#ifdef _WIN32_WCE
- fakekey[0].ki.dwFlags = KEYEVENTF_KEYUP;
-#else
fakekey[0].ki.dwFlags = KEYEVENTF_UNICODE;
-#endif
fakekey[0].ki.wVk = 0;
fakekey[0].ki.time = NULL;
fakekey[0].ki.wScan = *it;
@@ -602,10 +582,8 @@ void CEdit::deletetext(const std::string &sText) {
// newline pair, but we're now assuming we'll never have two real characters for
// a single symbol
-// if(targetwindow != NULL && textentry == true) {
if(m_pAppSettings->GetLongParameter(APP_LP_STYLE) == APP_STYLE_DIRECT) {
-#ifdef _UNICODE
fakekey[0].type = fakekey[1].type = INPUT_KEYBOARD;
fakekey[0].ki.wVk = fakekey[1].ki.wVk = VK_BACK;
fakekey[0].ki.time = fakekey[1].ki.time = 0;
@@ -613,11 +591,6 @@ if(m_pAppSettings->GetLongParameter(APP_LP_STYLE) == APP_STYLE_DIRECT) {
::SetFocus(targetwindow);
SendInput(2, fakekey, sizeof(INPUT));
-#else
- SetFocus(targetwindow);
- keybd_event(VK_BACK, 0, NULL, NULL);
- keybd_event(VK_BACK, 0, KEYEVENTF_KEYUP, NULL);
-#endif
}
// And the output buffer (?)
diff --git a/Src/Win32/Widgets/Edit.h b/Src/Win32/Widgets/Edit.h
index 6b85786..68138b5 100644
--- a/Src/Win32/Widgets/Edit.h
+++ b/Src/Win32/Widgets/Edit.h
@@ -77,10 +77,6 @@ class CEdit : public ATL::CWindowImpl<CEdit> {
void Move(int x, int y, int Width, int Height);
- HWND GetHwnd() {
- return m_hWnd;
- }
-
int Move(bool bForwards, Dasher::CControlManager::EditDistance iDist);
int Delete(bool bForwards, Dasher::CControlManager::EditDistance iDist);
std::string GetTextAroundCursor(Dasher::CControlManager::EditDistance iDist);
@@ -123,36 +119,27 @@ class CEdit : public ATL::CWindowImpl<CEdit> {
Dasher::CDasherInterfaceBase *m_pDasherInterface;
HWND Parent;
- WNDPROC TextWndFunc;
HWND m_hTarget;
bool m_bForwardKeyboard;
CFilenameGUI *m_FilenameGUI;
Tstring m_filename;
- HWND textwindow;
void TNew(const Tstring & filename);
bool TOpen(const Tstring & filename);
bool TSaveAs(const Tstring & filename);
void GetRange(bool bForwards, Dasher::CControlManager::EditDistance iDist, int* iStart, int* iEnd);
HFONT m_Font;
- std::string m_FontName;
- long m_FontSize;
std::string m_Output; // UTF-8 to go to training file
- UINT CodePage; // for font and possible for finding the encoding
HWND targetwindow;
- bool textentry;
-#ifdef _UNICODE
INPUT fakekey[2];
-#endif
void InsertText(Tstring InsertText); // add symbol to edit control
CAppSettings *m_pAppSettings;
- HWND m_hWnd;
};
#endif /* #ifndef __Edit_h__ */
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]