riched20: Select word on double click
Phil Krylov
phil at newstar.rinet.ru
Thu Jan 12 19:33:20 CST 2006
ChangeLog:
Double clicking a word in a rich edit control selects that word.
---
dlls/riched20/caret.c | 11 +++++++++++
dlls/riched20/editor.c | 8 ++++++--
dlls/riched20/editor.h | 1 +
3 files changed, 18 insertions(+), 2 deletions(-)
3a474a6628073c03ce4964478fd9150e7843147c
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index ca58c6d..f3d120e 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -578,6 +578,17 @@ ME_MoveCursorWords(ME_TextEditor *editor
}
+void
+ME_SelectWord(ME_TextEditor *editor)
+{
+ if (!(editor->pCursors[0].pRun->member.run.nFlags & MERF_ENDPARA))
+ ME_MoveCursorWords(editor, &editor->pCursors[0], -1);
+ ME_MoveCursorWords(editor, &editor->pCursors[1], +1);
+ ME_InvalidateSelection(editor);
+ ME_SendSelChange(editor);
+}
+
+
int ME_GetCursorOfs(ME_TextEditor *editor, int nCursor)
{
ME_Cursor *pCursor = &editor->pCursors[nCursor];
diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c
index ad6162f..4fd7d03 100644
--- a/dlls/riched20/editor.c
+++ b/dlls/riched20/editor.c
@@ -3,6 +3,7 @@
*
* Copyright 2004 by Krzysztof Foltman
* Copyright 2005 by Cihan Altinay
+ * Copyright 2005 by Phil Krylov
*
* This library is free software; you can redistribute it and/or
* modify it under the terms of the GNU Lesser General Public
@@ -1837,6 +1838,9 @@ LRESULT WINAPI RichEditANSIWndProc(HWND
if (GetCapture() == hWnd)
ReleaseCapture();
break;
+ case WM_LBUTTONDBLCLK:
+ ME_SelectWord(editor);
+ break;
case WM_PAINT:
if (editor->bRedraw)
{
@@ -2167,7 +2171,7 @@ void ME_RegisterEditorClass(HINSTANCE hI
WNDCLASSW wcW;
WNDCLASSA wcA;
- wcW.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
+ wcW.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcW.lpfnWndProc = RichEditANSIWndProc;
wcW.cbClsExtra = 0;
wcW.cbWndExtra = 4;
@@ -2183,7 +2187,7 @@ void ME_RegisterEditorClass(HINSTANCE hI
bResult = RegisterClassW(&wcW);
assert(bResult);
- wcA.style = CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
+ wcA.style = CS_DBLCLKS | CS_HREDRAW | CS_VREDRAW | CS_GLOBALCLASS;
wcA.lpfnWndProc = RichEditANSIWndProc;
wcA.cbClsExtra = 0;
wcA.cbWndExtra = 4;
diff --git a/dlls/riched20/editor.h b/dlls/riched20/editor.h
index 3ead3c0..95b0a5e 100644
--- a/dlls/riched20/editor.h
+++ b/dlls/riched20/editor.h
@@ -140,6 +140,7 @@ void ME_SetDefaultCharFormat(ME_TextEdit
/* caret.c */
void ME_SetSelection(ME_TextEditor *editor, int from, int to);
+void ME_SelectWord(ME_TextEditor *editor);
void ME_HideCaret(ME_TextEditor *ed);
void ME_ShowCaret(ME_TextEditor *ed);
void ME_MoveCaret(ME_TextEditor *ed);
--
1.0.GIT
More information about the wine-patches
mailing list