From 33d7cea120bd7d37175cd5c89aa2a66d5c909f37 Mon Sep 17 00:00:00 2001 From: Eric Pouech Date: Sun, 16 Mar 2008 21:48:05 +0100 Subject: [PATCH] richedit: Added support for EM_SETTARGETDEVICE with a NULL DC. --- dlls/riched20/editor.c | 16 ++++++++++++++-- dlls/riched20/editstr.h | 3 ++- dlls/riched20/wrap.c | 12 +++++++++--- 3 files changed, 25 insertions(+), 6 deletions(-) diff --git a/dlls/riched20/editor.c b/dlls/riched20/editor.c index d472e0ffc77..6c493c2a767 100644 --- a/dlls/riched20/editor.c +++ b/dlls/riched20/editor.c @@ -114,7 +114,7 @@ + EM_SETSEL + EM_SETSCROLLPOS 3.0 - EM_SETTABSTOPS 3.0 - - EM_SETTARGETDEVICE + - EM_SETTARGETDEVICE (partial) + EM_SETTEXTEX 3.0 (no rich text insertion handling, proper style?) - EM_SETTEXTMODE 2.0 - EM_SETTYPOGRAPHYOPTIONS 3.0 @@ -1590,6 +1590,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) { ed->nLastSelStart = ed->nLastSelEnd = 0; ed->pLastSelStartPara = ed->pLastSelEndPara = ME_FindItemFwd(ed->pBuffer->pFirst, diParagraph); ed->bRedraw = TRUE; + ed->bWordWrap = FALSE; ed->bHideSelection = FALSE; ed->nInvalidOfs = -1; ed->pfnWordBreak = NULL; @@ -1901,7 +1902,6 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, UNSUPPORTED_MSG(EM_SETLANGOPTIONS) UNSUPPORTED_MSG(EM_SETPALETTE) UNSUPPORTED_MSG(EM_SETTABSTOPS) - UNSUPPORTED_MSG(EM_SETTARGETDEVICE) UNSUPPORTED_MSG(EM_SETTYPOGRAPHYOPTIONS) UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX) UNSUPPORTED_MSG(WM_STYLECHANGING) @@ -3188,6 +3188,18 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam, ME_RewrapRepaint(editor); return 0; } + case EM_SETTARGETDEVICE: + if (wParam == 0) + { + switch (lParam) + { + case 0: editor->bWordWrap = TRUE; break; + case 1: editor->bWordWrap = FALSE; break; + default: FIXME("Unknown option to EM_SETTARGETDEVICE(NULL,%ld)\n", lParam); + } + } + else FIXME("Unsupported yet non NULL device in EM_SETTARGETDEVICE\n"); + break; default: do_default: return DefWindowProcW(hWnd, msg, wParam, lParam); diff --git a/dlls/riched20/editstr.h b/dlls/riched20/editstr.h index 7c1fe7ffaac..964f356dcf6 100644 --- a/dlls/riched20/editstr.h +++ b/dlls/riched20/editstr.h @@ -312,6 +312,7 @@ typedef struct tagME_TextEditor int nZoomNumerator, nZoomDenominator; RECT rcFormat; BOOL bRedraw; + BOOL bWordWrap; int nInvalidOfs; int nTextLimit; EDITWORDBREAKPROCW pfnWordBreak; @@ -350,7 +351,7 @@ typedef struct tagME_WrapContext ME_Style *style; ME_Context *context; int nLeftMargin, nRightMargin, nFirstMargin; - int nTotalWidth, nAvailWidth; + int nAvailWidth; int nRow; POINT pt; BOOL bOverflown; diff --git a/dlls/riched20/wrap.c b/dlls/riched20/wrap.c index 4c24dec2233..49c53660e80 100644 --- a/dlls/riched20/wrap.c +++ b/dlls/riched20/wrap.c @@ -47,7 +47,11 @@ static void ME_BeginRow(ME_WrapContext *wc) wc->pRowStart = NULL; wc->bOverflown = FALSE; wc->pLastSplittableRun = NULL; - wc->nAvailWidth = wc->nTotalWidth - (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin; + if (wc->context->editor->bWordWrap) + wc->nAvailWidth = wc->context->rcView.right - wc->context->rcView.left - + (wc->nRow ? wc->nLeftMargin : wc->nFirstMargin) - wc->nRightMargin; + else + wc->nAvailWidth = ~0u >> 1; wc->pt.x = 0; } @@ -393,8 +397,10 @@ static void ME_WrapTextParagraph(ME_Context *c, ME_DisplayItem *tp, DWORD begino wc.pt.y += border; } - wc.nTotalWidth = c->rcView.right - c->rcView.left; - wc.nAvailWidth = wc.nTotalWidth - wc.nFirstMargin - wc.nRightMargin; + if (c->editor->bWordWrap) + wc.nAvailWidth = c->rcView.right - c->rcView.left - wc.nFirstMargin - wc.nRightMargin; + else + wc.nAvailWidth = ~0u >> 1; wc.pRowStart = NULL; linespace = ME_GetParaLineSpace(c, &tp->member.para);