The format rect is recalculated for each font change. MoveEnd &

MoveHome improved.
This commit is contained in:
Pascal Lessard 1999-09-04 10:59:07 +00:00 committed by Alexandre Julliard
parent 41875795cc
commit 3405f5c6cd
1 changed files with 11 additions and 8 deletions

View File

@ -1463,8 +1463,9 @@ static void EDIT_MoveEnd(WND *wnd, EDITSTATE *es, BOOL extend)
BOOL after_wrap = FALSE; BOOL after_wrap = FALSE;
INT e; INT e;
/* Pass a high value in x to make sure of receiving the en of the line */
if (es->style & ES_MULTILINE) if (es->style & ES_MULTILINE)
e = EDIT_CharFromPos(wnd, es, 0x7fffffff, e = EDIT_CharFromPos(wnd, es, 0x3fffffff,
HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap); HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), &after_wrap);
else else
e = lstrlenA(es->text); e = lstrlenA(es->text);
@ -1507,8 +1508,9 @@ static void EDIT_MoveHome(WND *wnd, EDITSTATE *es, BOOL extend)
{ {
INT e; INT e;
/* Pass the x_offset in x to make sure of receiving the first position of the line */
if (es->style & ES_MULTILINE) if (es->style & ES_MULTILINE)
e = EDIT_CharFromPos(wnd, es, 0x80000000, e = EDIT_CharFromPos(wnd, es, -es->x_offset,
HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL); HIWORD(EDIT_EM_PosFromChar(wnd, es, es->selection_end, es->flags & EF_AFTER_WRAP)), NULL);
else else
e = 0; e = 0;
@ -3665,7 +3667,6 @@ static void EDIT_WM_Paint(WND *wnd, EDITSTATE *es, WPARAM wParam)
BOOL rev = es->bEnableState && BOOL rev = es->bEnableState &&
((es->flags & EF_FOCUSED) || ((es->flags & EF_FOCUSED) ||
(es->style & ES_NOHIDESEL)); (es->style & ES_NOHIDESEL));
if (es->flags & EF_UPDATE) if (es->flags & EF_UPDATE)
EDIT_NOTIFY_PARENT(wnd, EN_UPDATE, "EN_UPDATE"); EDIT_NOTIFY_PARENT(wnd, EN_UPDATE, "EN_UPDATE");
@ -3800,6 +3801,7 @@ static void EDIT_WM_SetFont(WND *wnd, EDITSTATE *es, HFONT font, BOOL redraw)
TEXTMETRICA tm; TEXTMETRICA tm;
HDC dc; HDC dc;
HFONT old_font = 0; HFONT old_font = 0;
RECT r;
es->font = font; es->font = font;
dc = GetDC(wnd->hwndSelf); dc = GetDC(wnd->hwndSelf);
@ -3814,13 +3816,14 @@ static void EDIT_WM_SetFont(WND *wnd, EDITSTATE *es, HFONT font, BOOL redraw)
if (font && (TWEAK_WineLook > WIN31_LOOK)) if (font && (TWEAK_WineLook > WIN31_LOOK))
EDIT_EM_SetMargins(wnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN, EDIT_EM_SetMargins(wnd, es, EC_LEFTMARGIN | EC_RIGHTMARGIN,
EC_USEFONTINFO, EC_USEFONTINFO); EC_USEFONTINFO, EC_USEFONTINFO);
if (es->style & ES_MULTILINE)
EDIT_BuildLineDefs_ML(wnd, es); /* Force the recalculation of the format rect for each font change */
else {
RECT r;
GetClientRect(wnd->hwndSelf, &r); GetClientRect(wnd->hwndSelf, &r);
EDIT_SetRectNP(wnd, es, &r); EDIT_SetRectNP(wnd, es, &r);
}
if (es->style & ES_MULTILINE)
EDIT_BuildLineDefs_ML(wnd, es);
if (redraw) if (redraw)
InvalidateRect(wnd->hwndSelf, NULL, TRUE); InvalidateRect(wnd->hwndSelf, NULL, TRUE);
if (es->flags & EF_FOCUSED) { if (es->flags & EF_FOCUSED) {