riched20: Simplified ME_InsertGraphicsFromCursor()

Phil Krylov phil at newstar.rinet.ru
Fri Feb 3 13:23:03 CST 2006


ChangeLog:

Simplified ME_InsertGraphicsFromCursor() function.

---

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

ce8ef0c60439f6b319f4e0c8fffc7a6980710a0a
diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c
index 528e5c0..11fa20e 100644
--- a/dlls/riched20/caret.c
+++ b/dlls/riched20/caret.c
@@ -314,40 +314,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,
@@ -363,6 +329,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)
 {
-- 
1.0.GIT



More information about the wine-patches mailing list