From baf25fc8ab9163af066a49f9b984491c4f473515 Mon Sep 17 00:00:00 2001 From: Phil Krylov Date: Sat, 4 Feb 2006 16:59:48 +0100 Subject: [PATCH] riched20: Simplified ME_InsertGraphicsFromCursor() function. --- dlls/riched20/caret.c | 50 ++++++++++++++----------------------------- 1 file changed, 16 insertions(+), 34 deletions(-) diff --git a/dlls/riched20/caret.c b/dlls/riched20/caret.c index 98655816de2..231a091e84c 100644 --- a/dlls/riched20/caret.c +++ b/dlls/riched20/caret.c @@ -312,40 +312,6 @@ void ME_DeleteTextAtCursor(ME_TextEditor *editor, int nCursor, 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_TextEditor *editor, int nCursor, } +/* 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) {