mirror of
https://github.com/reactos/reactos.git
synced 2025-02-22 16:36:33 +00:00
[RICHED20]
* Sync to Wine 1.5.4. svn path=/trunk/; revision=56602
This commit is contained in:
parent
afdef27ca3
commit
5356fc0985
9 changed files with 164 additions and 127 deletions
|
@ -4,8 +4,6 @@ include_directories(${REACTOS_SOURCE_DIR}/include/reactos/wine)
|
|||
|
||||
spec2def(riched20.dll riched20.spec ADD_IMPORTLIB)
|
||||
|
||||
set_rc_compiler()
|
||||
|
||||
list(APPEND SOURCE
|
||||
caret.c
|
||||
clipboard.c
|
||||
|
@ -51,5 +49,4 @@ add_importlibs(riched20
|
|||
ntdll)
|
||||
|
||||
add_pch(riched20 editor.h)
|
||||
|
||||
add_cd_file(TARGET riched20 DESTINATION reactos/system32 FOR all)
|
||||
|
|
|
@ -146,8 +146,11 @@ int ME_SetSelection(ME_TextEditor *editor, int from, int to)
|
|||
{
|
||||
int start, end;
|
||||
ME_GetSelectionOfs(editor, &start, &end);
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_Repaint(editor);
|
||||
if (start != end)
|
||||
{
|
||||
editor->pCursors[1] = editor->pCursors[0];
|
||||
ME_Repaint(editor);
|
||||
}
|
||||
ME_ClearTempStyle(editor);
|
||||
return end;
|
||||
}
|
||||
|
|
|
@ -2180,6 +2180,7 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
|
|||
ME_DisplayItem *para = cursor.pPara;
|
||||
int from, to;
|
||||
const WCHAR endl = '\r';
|
||||
const WCHAR endlv10[] = {'\r','\n'};
|
||||
ME_Style *style;
|
||||
|
||||
if (editor->styleFlags & ES_READONLY) {
|
||||
|
@ -2282,7 +2283,10 @@ ME_KeyDown(ME_TextEditor *editor, WORD nKey)
|
|||
if (shift_is_down)
|
||||
ME_InsertEndRowFromCursor(editor, 0);
|
||||
else
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1, style);
|
||||
if (!editor->bEmulateVersion10)
|
||||
ME_InsertTextFromCursor(editor, 0, &endl, 1, style);
|
||||
else
|
||||
ME_InsertTextFromCursor(editor, 0, endlv10, 2, style);
|
||||
ME_ReleaseStyle(style);
|
||||
ME_CommitCoalescingUndo(editor);
|
||||
SetCursor(NULL);
|
||||
|
@ -4459,7 +4463,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
|
|||
ps.rcPaint.right = editor->rcFormat.right;
|
||||
}
|
||||
|
||||
ME_PaintContent(editor, hDC, FALSE, &ps.rcPaint);
|
||||
ME_PaintContent(editor, hDC, &ps.rcPaint);
|
||||
EndPaint(editor->hWnd, &ps);
|
||||
return 0;
|
||||
}
|
||||
|
|
|
@ -187,7 +187,7 @@ void ME_DestroyContext(ME_Context *c) DECLSPEC_HIDDEN;
|
|||
|
||||
/* wrap.c */
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor, ME_DisplayItem *start_para, ME_DisplayItem *end_para) DECLSPEC_HIDDEN;
|
||||
void ME_SendRequestResize(ME_TextEditor *editor, BOOL force) DECLSPEC_HIDDEN;
|
||||
|
||||
/* para.c */
|
||||
|
@ -207,7 +207,7 @@ void ME_MarkAllForWrapping(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
|||
void ME_SetDefaultParaFormat(PARAFORMAT2 *pFmt) DECLSPEC_HIDDEN;
|
||||
|
||||
/* paint.c */
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate) DECLSPEC_HIDDEN;
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate) DECLSPEC_HIDDEN;
|
||||
void ME_Repaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_RewrapRepaint(ME_TextEditor *editor) DECLSPEC_HIDDEN;
|
||||
void ME_UpdateRepaint(ME_TextEditor *editor, BOOL update_now) DECLSPEC_HIDDEN;
|
||||
|
|
|
@ -25,7 +25,7 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
|||
|
||||
static void ME_DrawParagraph(ME_Context *c, ME_DisplayItem *paragraph);
|
||||
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *rcUpdate)
|
||||
void ME_PaintContent(ME_TextEditor *editor, HDC hDC, const RECT *rcUpdate)
|
||||
{
|
||||
ME_DisplayItem *item;
|
||||
ME_Context c;
|
||||
|
@ -71,18 +71,9 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
|
|||
ys -= item->member.para.pCell->member.cell.yTextOffset;
|
||||
}
|
||||
|
||||
if (!bOnlyNew || (item->member.para.nFlags & MEPF_REPAINT))
|
||||
{
|
||||
/* Draw the paragraph if any of the paragraph is in the update region. */
|
||||
if (ys < rcUpdate->bottom && ye > rcUpdate->top)
|
||||
{
|
||||
ME_DrawParagraph(&c, item);
|
||||
/* Clear the repaint flag if the whole paragraph is in the
|
||||
* update region. */
|
||||
if (rcUpdate->top <= ys && rcUpdate->bottom >= ye)
|
||||
item->member.para.nFlags &= ~MEPF_REPAINT;
|
||||
}
|
||||
}
|
||||
/* Draw the paragraph if any of the paragraph is in the update region. */
|
||||
if (ys < rcUpdate->bottom && ye > rcUpdate->top)
|
||||
ME_DrawParagraph(&c, item);
|
||||
item = item->member.para.next_para;
|
||||
}
|
||||
if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
|
||||
|
@ -94,15 +85,6 @@ void ME_PaintContent(ME_TextEditor *editor, HDC hDC, BOOL bOnlyNew, const RECT *
|
|||
rc.bottom = c.rcView.bottom;
|
||||
rc.right = c.rcView.right;
|
||||
|
||||
if (bOnlyNew)
|
||||
{
|
||||
/* Only erase region drawn from previous call to ME_PaintContent */
|
||||
if (editor->nTotalLength < editor->nLastTotalLength)
|
||||
rc.bottom = c.pt.y + editor->nLastTotalLength;
|
||||
else
|
||||
SetRectEmpty(&rc);
|
||||
}
|
||||
|
||||
IntersectRect(&rc, &rc, rcUpdate);
|
||||
|
||||
if (!IsRectEmpty(&rc))
|
||||
|
@ -316,7 +298,7 @@ static void ME_DrawTextWithStyle(ME_Context *c, int x, int y, LPCWSTR szText,
|
|||
hPen = CreatePen(PS_DOT, 1, rgb);
|
||||
break;
|
||||
default:
|
||||
WINE_FIXME("Unknown underline type (%u)\n", s->fmt.bUnderlineType);
|
||||
FIXME("Unknown underline type (%u)\n", s->fmt.bUnderlineType);
|
||||
/* fall through */
|
||||
case CFU_CF1UNDERLINE: /* this type is supported in the font, do nothing */
|
||||
case CFU_UNDERLINENONE:
|
||||
|
@ -1275,7 +1257,8 @@ void ME_EnsureVisible(ME_TextEditor *editor, ME_Cursor *pCursor)
|
|||
void
|
||||
ME_InvalidateSelection(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *para1, *para2;
|
||||
ME_DisplayItem *sel_start, *sel_end;
|
||||
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
|
||||
int nStart, nEnd;
|
||||
int len = ME_GetTextLength(editor);
|
||||
|
||||
|
@ -1285,32 +1268,39 @@ ME_InvalidateSelection(ME_TextEditor *editor)
|
|||
if (nStart == nEnd && editor->nLastSelStart == editor->nLastSelEnd)
|
||||
return;
|
||||
ME_WrapMarkedParagraphs(editor);
|
||||
ME_GetSelectionParas(editor, ¶1, ¶2);
|
||||
assert(para1->type == diParagraph);
|
||||
assert(para2->type == diParagraph);
|
||||
ME_GetSelectionParas(editor, &sel_start, &sel_end);
|
||||
assert(sel_start->type == diParagraph);
|
||||
assert(sel_end->type == diParagraph);
|
||||
/* last selection markers aren't always updated, which means
|
||||
* they can point past the end of the document */
|
||||
if (editor->nLastSelStart > len || editor->nLastSelEnd > len) {
|
||||
ME_MarkForPainting(editor,
|
||||
ME_FindItemFwd(editor->pBuffer->pFirst, diParagraph),
|
||||
editor->pBuffer->pLast);
|
||||
repaint_start = ME_FindItemFwd(editor->pBuffer->pFirst, diParagraph);
|
||||
repaint_end = editor->pBuffer->pLast;
|
||||
ME_MarkForPainting(editor, repaint_start, repaint_end);
|
||||
} else {
|
||||
/* if the start part of selection is being expanded or contracted... */
|
||||
if (nStart < editor->nLastSelStart) {
|
||||
ME_MarkForPainting(editor, para1, editor->pLastSelStartPara->member.para.next_para);
|
||||
repaint_start = sel_start;
|
||||
repaint_end = editor->pLastSelStartPara->member.para.next_para;
|
||||
} else if (nStart > editor->nLastSelStart) {
|
||||
ME_MarkForPainting(editor, editor->pLastSelStartPara, para1->member.para.next_para);
|
||||
repaint_start = editor->pLastSelStartPara;
|
||||
repaint_end = sel_start->member.para.next_para;
|
||||
}
|
||||
ME_MarkForPainting(editor, repaint_start, repaint_end);
|
||||
|
||||
/* if the end part of selection is being contracted or expanded... */
|
||||
if (nEnd < editor->nLastSelEnd) {
|
||||
ME_MarkForPainting(editor, para2, editor->pLastSelEndPara->member.para.next_para);
|
||||
if (!repaint_start) repaint_start = sel_end;
|
||||
repaint_end = editor->pLastSelEndPara->member.para.next_para;
|
||||
ME_MarkForPainting(editor, sel_end, repaint_end);
|
||||
} else if (nEnd > editor->nLastSelEnd) {
|
||||
ME_MarkForPainting(editor, editor->pLastSelEndPara, para2->member.para.next_para);
|
||||
if (!repaint_start) repaint_start = editor->pLastSelEndPara;
|
||||
repaint_end = sel_end->member.para.next_para;
|
||||
ME_MarkForPainting(editor, editor->pLastSelEndPara, repaint_end);
|
||||
}
|
||||
}
|
||||
|
||||
ME_InvalidateMarkedParagraphs(editor);
|
||||
ME_InvalidateMarkedParagraphs(editor, repaint_start, repaint_end);
|
||||
/* remember the last invalidated position */
|
||||
ME_GetSelectionOfs(editor, &editor->nLastSelStart, &editor->nLastSelEnd);
|
||||
ME_GetSelectionParas(editor, &editor->pLastSelStartPara, &editor->pLastSelEndPara);
|
||||
|
|
|
@ -1669,6 +1669,7 @@ void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run,
|
|||
hMemDC, 0, 0, dibsect.dsBm.bmWidth,
|
||||
dibsect.dsBm.bmHeight, SRCCOPY);
|
||||
}
|
||||
DeleteDC(hMemDC);
|
||||
if (!stgm.pUnkForRelease) DeleteObject(stgm.u.hBitmap);
|
||||
break;
|
||||
case TYMED_ENHMF:
|
||||
|
|
|
@ -54,96 +54,57 @@
|
|||
WINE_DEFAULT_DEBUG_CHANNEL(richedit);
|
||||
|
||||
typedef struct ITextServicesImpl {
|
||||
IUnknown IUnknown_inner;
|
||||
ITextServices ITextServices_iface;
|
||||
ITextHost *pMyHost;
|
||||
IUnknown *outer_unk;
|
||||
LONG ref;
|
||||
ITextHost *pMyHost;
|
||||
CRITICAL_SECTION csTxtSrv;
|
||||
ME_TextEditor *editor;
|
||||
char spare[256];
|
||||
} ITextServicesImpl;
|
||||
|
||||
static const ITextServicesVtbl textservices_Vtbl;
|
||||
|
||||
/******************************************************************
|
||||
* CreateTextServices (RICHED20.4)
|
||||
*/
|
||||
HRESULT WINAPI CreateTextServices(IUnknown * pUnkOuter,
|
||||
ITextHost * pITextHost,
|
||||
IUnknown **ppUnk)
|
||||
static inline ITextServicesImpl *impl_from_IUnknown(IUnknown *iface)
|
||||
{
|
||||
ITextServicesImpl *ITextImpl;
|
||||
HRESULT hres;
|
||||
TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
|
||||
if (pITextHost == NULL)
|
||||
return E_POINTER;
|
||||
return CONTAINING_RECORD(iface, ITextServicesImpl, IUnknown_inner);
|
||||
}
|
||||
|
||||
ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
|
||||
if (ITextImpl == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
InitializeCriticalSection(&ITextImpl->csTxtSrv);
|
||||
ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
|
||||
ITextImpl->ref = 1;
|
||||
ITextHost_AddRef(pITextHost);
|
||||
ITextImpl->pMyHost = pITextHost;
|
||||
ITextImpl->ITextServices_iface.lpVtbl = &textservices_Vtbl;
|
||||
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
|
||||
ITextImpl->editor->exStyleFlags = 0;
|
||||
ITextImpl->editor->rcFormat.left = 0;
|
||||
ITextImpl->editor->rcFormat.top = 0;
|
||||
ITextImpl->editor->rcFormat.right = 0;
|
||||
ITextImpl->editor->rcFormat.bottom = 0;
|
||||
static HRESULT WINAPI ITextServicesImpl_QueryInterface(IUnknown *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
||||
|
||||
ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres);
|
||||
TRACE("(%p)->(%s, %p)\n", iface, debugstr_guid(riid), ppv);
|
||||
|
||||
if (pUnkOuter)
|
||||
{
|
||||
FIXME("Support aggregation\n");
|
||||
return CLASS_E_NOAGGREGATION;
|
||||
if (IsEqualIID(riid, &IID_IUnknown))
|
||||
*ppv = &This->IUnknown_inner;
|
||||
else if IsEqualIID(riid, &IID_ITextServices)
|
||||
*ppv = &This->ITextServices_iface;
|
||||
else {
|
||||
*ppv = NULL;
|
||||
FIXME("Unknown interface: %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
*ppUnk = (IUnknown *)&ITextImpl->ITextServices_iface;
|
||||
IUnknown_AddRef((IUnknown*)*ppv);
|
||||
return S_OK;
|
||||
}
|
||||
|
||||
static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
|
||||
static ULONG WINAPI ITextServicesImpl_AddRef(IUnknown *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
|
||||
}
|
||||
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
||||
LONG ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
TRACE("(%p/%p)->(%s, %p)\n", This, iface, debugstr_guid(riid), ppv);
|
||||
*ppv = NULL;
|
||||
if (IsEqualIID(riid, &IID_IUnknown) || IsEqualIID(riid, &IID_ITextServices))
|
||||
*ppv = This;
|
||||
|
||||
if (*ppv)
|
||||
{
|
||||
IUnknown_AddRef((IUnknown *)(*ppv));
|
||||
TRACE ("-- Interface = %p\n", *ppv);
|
||||
return S_OK;
|
||||
}
|
||||
FIXME("Unknown interface: %s\n", debugstr_guid(riid));
|
||||
return E_NOINTERFACE;
|
||||
}
|
||||
|
||||
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
DWORD ref = InterlockedIncrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() AddRef from %d\n", This, iface, ref - 1);
|
||||
return ref;
|
||||
}
|
||||
|
||||
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
|
||||
static ULONG WINAPI ITextServicesImpl_Release(IUnknown *iface)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
DWORD ref = InterlockedDecrement(&This->ref);
|
||||
ITextServicesImpl *This = impl_from_IUnknown(iface);
|
||||
LONG ref = InterlockedDecrement(&This->ref);
|
||||
|
||||
TRACE("(%p/%p)->() Release from %d\n", This, iface, ref + 1);
|
||||
TRACE("(%p) ref=%d\n", This, ref);
|
||||
|
||||
if (!ref)
|
||||
{
|
||||
|
@ -155,6 +116,36 @@ static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
|
|||
return ref;
|
||||
}
|
||||
|
||||
static const IUnknownVtbl textservices_inner_vtbl =
|
||||
{
|
||||
ITextServicesImpl_QueryInterface,
|
||||
ITextServicesImpl_AddRef,
|
||||
ITextServicesImpl_Release
|
||||
};
|
||||
|
||||
static inline ITextServicesImpl *impl_from_ITextServices(ITextServices *iface)
|
||||
{
|
||||
return CONTAINING_RECORD(iface, ITextServicesImpl, ITextServices_iface);
|
||||
}
|
||||
|
||||
static HRESULT WINAPI fnTextSrv_QueryInterface(ITextServices *iface, REFIID riid, void **ppv)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
return IUnknown_QueryInterface(This->outer_unk, riid, ppv);
|
||||
}
|
||||
|
||||
static ULONG WINAPI fnTextSrv_AddRef(ITextServices *iface)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
return IUnknown_AddRef(This->outer_unk);
|
||||
}
|
||||
|
||||
static ULONG WINAPI fnTextSrv_Release(ITextServices *iface)
|
||||
{
|
||||
ITextServicesImpl *This = impl_from_ITextServices(iface);
|
||||
return IUnknown_Release(This->outer_unk);
|
||||
}
|
||||
|
||||
DECLSPEC_HIDDEN HRESULT WINAPI fnTextSrv_TxSendMessage(ITextServices *iface, UINT msg, WPARAM wparam,
|
||||
LPARAM lparam, LRESULT *plresult)
|
||||
{
|
||||
|
@ -370,7 +361,7 @@ DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetDropTarget,8)
|
|||
DEFINE_THISCALL_WRAPPER(fnTextSrv_OnTxPropertyBitsChange,12)
|
||||
DEFINE_THISCALL_WRAPPER(fnTextSrv_TxGetCachedSize,12)
|
||||
|
||||
static const ITextServicesVtbl textservices_Vtbl =
|
||||
static const ITextServicesVtbl textservices_vtbl =
|
||||
{
|
||||
fnTextSrv_QueryInterface,
|
||||
fnTextSrv_AddRef,
|
||||
|
@ -394,3 +385,42 @@ static const ITextServicesVtbl textservices_Vtbl =
|
|||
THISCALL(fnTextSrv_OnTxPropertyBitsChange),
|
||||
THISCALL(fnTextSrv_TxGetCachedSize)
|
||||
};
|
||||
|
||||
/******************************************************************
|
||||
* CreateTextServices (RICHED20.4)
|
||||
*/
|
||||
HRESULT WINAPI CreateTextServices(IUnknown *pUnkOuter, ITextHost *pITextHost, IUnknown **ppUnk)
|
||||
{
|
||||
ITextServicesImpl *ITextImpl;
|
||||
HRESULT hres;
|
||||
TRACE("%p %p --> %p\n", pUnkOuter, pITextHost, ppUnk);
|
||||
if (pITextHost == NULL)
|
||||
return E_POINTER;
|
||||
|
||||
ITextImpl = CoTaskMemAlloc(sizeof(*ITextImpl));
|
||||
if (ITextImpl == NULL)
|
||||
return E_OUTOFMEMORY;
|
||||
InitializeCriticalSection(&ITextImpl->csTxtSrv);
|
||||
ITextImpl->csTxtSrv.DebugInfo->Spare[0] = (DWORD_PTR)(__FILE__ ": ITextServicesImpl.csTxtSrv");
|
||||
ITextImpl->ref = 1;
|
||||
ITextHost_AddRef(pITextHost);
|
||||
ITextImpl->pMyHost = pITextHost;
|
||||
ITextImpl->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
|
||||
ITextImpl->ITextServices_iface.lpVtbl = &textservices_vtbl;
|
||||
ITextImpl->editor = ME_MakeEditor(pITextHost, FALSE);
|
||||
ITextImpl->editor->exStyleFlags = 0;
|
||||
ITextImpl->editor->rcFormat.left = 0;
|
||||
ITextImpl->editor->rcFormat.top = 0;
|
||||
ITextImpl->editor->rcFormat.right = 0;
|
||||
ITextImpl->editor->rcFormat.bottom = 0;
|
||||
|
||||
ME_HandleMessage(ITextImpl->editor, WM_CREATE, 0, 0, TRUE, &hres);
|
||||
|
||||
if (pUnkOuter)
|
||||
ITextImpl->outer_unk = pUnkOuter;
|
||||
else
|
||||
ITextImpl->outer_unk = &ITextImpl->IUnknown_inner;
|
||||
|
||||
*ppUnk = &ITextImpl->IUnknown_inner;
|
||||
return S_OK;
|
||||
}
|
||||
|
|
|
@ -583,12 +583,22 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp) {
|
|||
tp->member.para.nRows = wc.nRow;
|
||||
}
|
||||
|
||||
static void ME_MarkRepaintEnd(ME_DisplayItem *para,
|
||||
ME_DisplayItem **repaint_start,
|
||||
ME_DisplayItem **repaint_end)
|
||||
{
|
||||
if (!*repaint_start)
|
||||
*repaint_start = para;
|
||||
*repaint_end = para->member.para.next_para;
|
||||
para->member.para.nFlags |= MEPF_REPAINT;
|
||||
}
|
||||
|
||||
BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
||||
{
|
||||
ME_DisplayItem *item;
|
||||
ME_Context c;
|
||||
BOOL bModified = FALSE;
|
||||
int totalWidth = 0;
|
||||
ME_DisplayItem *repaint_start = NULL, *repaint_end = NULL;
|
||||
|
||||
ME_InitContext(&c, editor, ITextHost_TxGetDC(editor->texthost));
|
||||
c.pt.x = 0;
|
||||
|
@ -605,9 +615,7 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
|||
ME_WrapTextParagraph(&c, item);
|
||||
|
||||
if (bRedraw)
|
||||
item->member.para.nFlags |= MEPF_REPAINT;
|
||||
|
||||
bModified = bModified | bRedraw;
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
|
||||
if (item->member.para.nFlags & MEPF_ROWSTART)
|
||||
{
|
||||
|
@ -678,10 +686,10 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
|||
{
|
||||
/* The height of the cells has grown, so invalidate the bottom of
|
||||
* the cells. */
|
||||
item->member.para.nFlags |= MEPF_REPAINT;
|
||||
ME_MarkRepaintEnd(item, &repaint_start, &repaint_end);
|
||||
cell = ME_FindItemBack(item, diCell);
|
||||
while (cell) {
|
||||
ME_FindItemBack(cell, diParagraph)->member.para.nFlags |= MEPF_REPAINT;
|
||||
ME_MarkRepaintEnd(ME_FindItemBack(cell, diParagraph), &repaint_start, &repaint_end);
|
||||
cell = cell->member.cell.prev_cell;
|
||||
}
|
||||
}
|
||||
|
@ -729,12 +737,17 @@ BOOL ME_WrapMarkedParagraphs(ME_TextEditor *editor)
|
|||
|
||||
ME_DestroyContext(&c);
|
||||
|
||||
if (bModified || editor->nTotalLength < editor->nLastTotalLength)
|
||||
ME_InvalidateMarkedParagraphs(editor);
|
||||
return bModified;
|
||||
if (repaint_start || editor->nTotalLength < editor->nLastTotalLength)
|
||||
{
|
||||
if (!repaint_start) repaint_start = editor->pBuffer->pFirst;
|
||||
ME_InvalidateMarkedParagraphs(editor, repaint_start, repaint_end);
|
||||
}
|
||||
return !!repaint_start;
|
||||
}
|
||||
|
||||
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor)
|
||||
void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor,
|
||||
ME_DisplayItem *start_para,
|
||||
ME_DisplayItem *end_para)
|
||||
{
|
||||
ME_Context c;
|
||||
RECT rc;
|
||||
|
@ -745,14 +758,13 @@ void ME_InvalidateMarkedParagraphs(ME_TextEditor *editor)
|
|||
rc = c.rcView;
|
||||
ofs = editor->vert_si.nPos;
|
||||
|
||||
item = editor->pBuffer->pFirst;
|
||||
while(item != editor->pBuffer->pLast) {
|
||||
item = start_para;
|
||||
while(item && item != end_para) {
|
||||
if (item->member.para.nFlags & MEPF_REPAINT) {
|
||||
rc.top = c.rcView.top + item->member.para.pt.y - ofs;
|
||||
rc.bottom = max(c.rcView.top + item->member.para.pt.y
|
||||
+ item->member.para.nHeight - ofs,
|
||||
c.rcView.bottom);
|
||||
rc.bottom = max(rc.top + item->member.para.nHeight, c.rcView.bottom);
|
||||
ITextHost_TxInvalidateRect(editor->texthost, &rc, TRUE);
|
||||
item->member.para.nFlags &= ~MEPF_REPAINT;
|
||||
}
|
||||
item = item->member.para.next_para;
|
||||
}
|
||||
|
|
|
@ -139,7 +139,7 @@ reactos/dll/win32/pstorec # Synced to Wine-1.3.37
|
|||
reactos/dll/win32/query # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/rasapi32 # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/resutils # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/riched20 # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/riched20 # Synced to Wine-1.5.4
|
||||
reactos/dll/win32/riched32 # Synced to Wine-1.3.37
|
||||
reactos/dll/win32/rpcrt4 # Synced to Wine-1.3.26
|
||||
reactos/dll/win32/rsabase # Autosync
|
||||
|
|
Loading…
Reference in a new issue