richedit: Added support for EM_SETTARGETDEVICE with a NULL DC.

This commit is contained in:
Eric Pouech 2008-03-16 21:48:05 +01:00 committed by Alexandre Julliard
parent 3502e28604
commit 33d7cea120
3 changed files with 25 additions and 6 deletions

View File

@ -114,7 +114,7 @@
+ EM_SETSEL + EM_SETSEL
+ EM_SETSCROLLPOS 3.0 + EM_SETSCROLLPOS 3.0
- EM_SETTABSTOPS 3.0 - EM_SETTABSTOPS 3.0
- EM_SETTARGETDEVICE - EM_SETTARGETDEVICE (partial)
+ EM_SETTEXTEX 3.0 (no rich text insertion handling, proper style?) + EM_SETTEXTEX 3.0 (no rich text insertion handling, proper style?)
- EM_SETTEXTMODE 2.0 - EM_SETTEXTMODE 2.0
- EM_SETTYPOGRAPHYOPTIONS 3.0 - EM_SETTYPOGRAPHYOPTIONS 3.0
@ -1590,6 +1590,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd) {
ed->nLastSelStart = ed->nLastSelEnd = 0; ed->nLastSelStart = ed->nLastSelEnd = 0;
ed->pLastSelStartPara = ed->pLastSelEndPara = ME_FindItemFwd(ed->pBuffer->pFirst, diParagraph); ed->pLastSelStartPara = ed->pLastSelEndPara = ME_FindItemFwd(ed->pBuffer->pFirst, diParagraph);
ed->bRedraw = TRUE; ed->bRedraw = TRUE;
ed->bWordWrap = FALSE;
ed->bHideSelection = FALSE; ed->bHideSelection = FALSE;
ed->nInvalidOfs = -1; ed->nInvalidOfs = -1;
ed->pfnWordBreak = NULL; ed->pfnWordBreak = NULL;
@ -1901,7 +1902,6 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
UNSUPPORTED_MSG(EM_SETLANGOPTIONS) UNSUPPORTED_MSG(EM_SETLANGOPTIONS)
UNSUPPORTED_MSG(EM_SETPALETTE) UNSUPPORTED_MSG(EM_SETPALETTE)
UNSUPPORTED_MSG(EM_SETTABSTOPS) UNSUPPORTED_MSG(EM_SETTABSTOPS)
UNSUPPORTED_MSG(EM_SETTARGETDEVICE)
UNSUPPORTED_MSG(EM_SETTYPOGRAPHYOPTIONS) UNSUPPORTED_MSG(EM_SETTYPOGRAPHYOPTIONS)
UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX) UNSUPPORTED_MSG(EM_SETWORDBREAKPROCEX)
UNSUPPORTED_MSG(WM_STYLECHANGING) UNSUPPORTED_MSG(WM_STYLECHANGING)
@ -3188,6 +3188,18 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
ME_RewrapRepaint(editor); ME_RewrapRepaint(editor);
return 0; 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: default:
do_default: do_default:
return DefWindowProcW(hWnd, msg, wParam, lParam); return DefWindowProcW(hWnd, msg, wParam, lParam);

View File

@ -312,6 +312,7 @@ typedef struct tagME_TextEditor
int nZoomNumerator, nZoomDenominator; int nZoomNumerator, nZoomDenominator;
RECT rcFormat; RECT rcFormat;
BOOL bRedraw; BOOL bRedraw;
BOOL bWordWrap;
int nInvalidOfs; int nInvalidOfs;
int nTextLimit; int nTextLimit;
EDITWORDBREAKPROCW pfnWordBreak; EDITWORDBREAKPROCW pfnWordBreak;
@ -350,7 +351,7 @@ typedef struct tagME_WrapContext
ME_Style *style; ME_Style *style;
ME_Context *context; ME_Context *context;
int nLeftMargin, nRightMargin, nFirstMargin; int nLeftMargin, nRightMargin, nFirstMargin;
int nTotalWidth, nAvailWidth; int nAvailWidth;
int nRow; int nRow;
POINT pt; POINT pt;
BOOL bOverflown; BOOL bOverflown;

View File

@ -47,7 +47,11 @@ static void ME_BeginRow(ME_WrapContext *wc)
wc->pRowStart = NULL; wc->pRowStart = NULL;
wc->bOverflown = FALSE; wc->bOverflown = FALSE;
wc->pLastSplittableRun = NULL; 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; 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.pt.y += border;
} }
wc.nTotalWidth = c->rcView.right - c->rcView.left; if (c->editor->bWordWrap)
wc.nAvailWidth = wc.nTotalWidth - wc.nFirstMargin - wc.nRightMargin; wc.nAvailWidth = c->rcView.right - c->rcView.left - wc.nFirstMargin - wc.nRightMargin;
else
wc.nAvailWidth = ~0u >> 1;
wc.pRowStart = NULL; wc.pRowStart = NULL;
linespace = ME_GetParaLineSpace(c, &tp->member.para); linespace = ME_GetParaLineSpace(c, &tp->member.para);