Phil Krylov : riched20: Simplified ME_InsertGraphicsFromCursor() function.

Alexandre Julliard julliard at wine.codeweavers.com
Sat Feb 4 11:14:57 CST 2006


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

Author: Phil Krylov <phil at newstar.rinet.ru>
Date:   Sat Feb  4 16:59:48 2006 +0100

riched20: Simplified ME_InsertGraphicsFromCursor() function.

---

 dlls/riched20/caret.c |   50 ++++++++++++++++---------------------------------
 1 files changed, 16 insertions(+), 34 deletions(-)

diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 9865581..231a091 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -312,40 +312,6 @@ void ME_DeleteTextAtCursor(ME_TextEditor
   ME_InternalDeleteText(editor, ME_GetCursorOfs(editor, nCursor), nChars);
 }
 
-static const WCHAR wszSpace[] = {' ', 0};
-
-/* FIXME this is temporary, just to have something to test how bad graphics handler is */
-void ME_InsertGraphicsFromCursor(ME_TextEditor *editor, int nCursor)
-{
-  ME_Cursor *pCursor = &editor->pCursors[nCursor];
-  ME_DisplayItem *pItem = NULL;
-  ME_DisplayItem *pNewRun = NULL;
-  ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
-  ME_UndoItem *pUndo;
-  
-  /* FIXME no no no */
-  if (ME_IsSelection(editor))
-    ME_DeleteSelection(editor);
-
-  pUndo = ME_AddUndoItem(editor, diUndoDeleteRun, NULL);
-  if (pUndo) {
-    pUndo->nStart = pCursor->nOffset + pCursor->pRun->member.run.nCharOfs + ME_GetParagraph(pCursor->pRun)->member.para.nCharOfs;
-    pUndo->nLen = 1;
-  }
-  if (pCursor->nOffset)
-  {
-    ME_SplitRunSimple(editor, pCursor->pRun, pCursor->nOffset);
-  }
-  pItem = pCursor->pRun;
-  pNewRun = ME_MakeRun(pStyle, ME_MakeStringN(wszSpace, 1), MERF_GRAPHICS);
-  pNewRun->member.run.nCharOfs = pCursor->pRun->member.run.nCharOfs;
-  ME_InsertBefore(pCursor->pRun, pNewRun);
-  ME_PropagateCharOffset(pItem, 1);
-  ME_CheckCharOffsets(editor);
-  ME_SendSelChange(editor);
-}
-
-
 static void
 ME_InternalInsertTextFromCursor(ME_TextEditor *editor, int nCursor,
                                 const WCHAR *str, int len, ME_Style *style,
@@ -361,6 +327,22 @@ ME_InternalInsertTextFromCursor(ME_TextE
 }
 
 
+/* FIXME this is temporary, just to have something to test how bad graphics handler is */
+void ME_InsertGraphicsFromCursor(ME_TextEditor *editor, int nCursor)
+{
+  ME_Style *pStyle = ME_GetInsertStyle(editor, nCursor);
+  WCHAR space = ' ';
+  
+  /* FIXME no no no */
+  if (ME_IsSelection(editor))
+    ME_DeleteSelection(editor);
+
+  ME_InternalInsertTextFromCursor(editor, nCursor, &space, 1, pStyle,
+                                  MERF_GRAPHICS);
+  ME_SendSelChange(editor);
+}
+
+
 void ME_InsertTextFromCursor(ME_TextEditor *editor, int nCursor, 
   const WCHAR *str, int len, ME_Style *style)
 {




More information about the wine-cvs mailing list