Phil Krylov : riched20: Select word on double click.

Alexandre Julliard julliard at wine.codeweavers.com
Fri Jan 13 07:31:16 CST 2006


Module: wine
Branch: refs/heads/master
Commit: 6e3a72549af5bbf01f0e6d5dcfeed0d5258f5aa8
URL:    http://source.winehq.org/git/?p=wine.git;a=commit;h=6e3a72549af5bbf01f0e6d5dcfeed0d5258f5aa8

Author: Phil Krylov <phil at newstar.rinet.ru>
Date:   Fri Jan 13 13:54:11 2006 +0100

riched20: Select word on double click.

---

 dlls/riched20/caret.c  |   11 +++++++++++
 dlls/riched20/editor.c |    8 ++++++--
 dlls/riched20/editor.h |    1 +
 3 files changed, 18 insertions(+), 2 deletions(-)

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);




More information about the wine-cvs mailing list