riched20: Use a row ptr in the run drawing function.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2020-10-27 08:23:28 +00:00 committed by Alexandre Julliard
parent 0d50e0182d
commit 30ad0b936a
3 changed files with 23 additions and 22 deletions

View File

@ -264,7 +264,7 @@ int ME_GetParaBorderWidth(const ME_Context *c, int flags) DECLSPEC_HIDDEN;
/* richole.c */ /* richole.c */
LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN; LRESULT CreateIRichEditOle(IUnknown *outer_unk, ME_TextEditor *editor, LPVOID *ppvObj) DECLSPEC_HIDDEN;
void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run* run, BOOL selected) DECLSPEC_HIDDEN; void draw_ole( ME_Context *c, int x, int y, ME_Run* run, BOOL selected ) DECLSPEC_HIDDEN;
void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN; void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize) DECLSPEC_HIDDEN;
void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN; void ME_CopyReObject(REOBJECT *dst, const REOBJECT *src, DWORD flags) DECLSPEC_HIDDEN;
void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN; void ME_DeleteReObject(struct re_object *re_object) DECLSPEC_HIDDEN;

View File

@ -359,7 +359,7 @@ static void draw_text( ME_Context *c, ME_Run *run, int x, int y, BOOL selected,
} }
static void ME_DrawTextWithStyle(ME_Context *c, ME_Run *run, int x, int y, static void draw_text_with_style( ME_Context *c, ME_Run *run, int x, int y,
int nSelFrom, int nSelTo, int ymin, int cy ) int nSelFrom, int nSelTo, int ymin, int cy )
{ {
HDC hDC = c->hDC; HDC hDC = c->hDC;
@ -434,16 +434,16 @@ static void ME_DebugWrite(HDC hDC, const POINT *pt, LPCWSTR szText) {
SetTextColor(hDC, color); SetTextColor(hDC, color);
} }
static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph *para ) static void draw_run( ME_Context *c, int x, int y, ME_Cursor *cursor )
{ {
ME_DisplayItem *start; ME_Row *row;
int runofs = run->nCharOfs+para->nCharOfs; ME_Run *run = &cursor->pRun->member.run;
int runofs = run_char_ofs( run, cursor->nOffset );
int nSelFrom, nSelTo; int nSelFrom, nSelTo;
if (run->nFlags & MERF_HIDDEN) if (run->nFlags & MERF_HIDDEN) return;
return;
start = ME_FindItemBack( run_get_di( run ), diStartRow ); row = row_from_cursor( cursor );
ME_GetSelectionOfs(c->editor, &nSelFrom, &nSelTo); ME_GetSelectionOfs(c->editor, &nSelFrom, &nSelTo);
/* Draw selected end-of-paragraph mark */ /* Draw selected end-of-paragraph mark */
@ -452,8 +452,7 @@ static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph *
if (runofs >= nSelFrom && runofs < nSelTo) if (runofs >= nSelFrom && runofs < nSelTo)
{ {
draw_space( c, run, x, y, TRUE, FALSE, draw_space( c, run, x, y, TRUE, FALSE,
c->pt.y + para->pt.y + start->member.row.pt.y, c->pt.y + run->para->pt.y + row->pt.y, row->nHeight );
start->member.row.nHeight );
} }
return; return;
} }
@ -463,19 +462,15 @@ static void ME_DrawRun( ME_Context *c, int x, int y, ME_Run *run, ME_Paragraph *
BOOL selected = runofs >= nSelFrom && runofs < nSelTo; BOOL selected = runofs >= nSelFrom && runofs < nSelTo;
draw_space( c, run, x, y, selected, TRUE, draw_space( c, run, x, y, selected, TRUE,
c->pt.y + para->pt.y + start->member.row.pt.y, c->pt.y + run->para->pt.y + row->pt.y, row->nHeight );
start->member.row.nHeight );
return; return;
} }
if (run->nFlags & MERF_GRAPHICS) if (run->nFlags & MERF_GRAPHICS)
ME_DrawOLE(c, x, y, run, (runofs >= nSelFrom) && (runofs < nSelTo)); draw_ole( c, x, y, run, (runofs >= nSelFrom) && (runofs < nSelTo) );
else else
{ draw_text_with_style( c, run, x, y, nSelFrom - runofs, nSelTo - runofs,
ME_DrawTextWithStyle(c, run, x, y, nSelFrom - runofs, nSelTo - runofs, c->pt.y + run->para->pt.y + row->pt.y, row->nHeight );
c->pt.y + para->pt.y + start->member.row.pt.y,
start->member.row.nHeight);
}
} }
/* The documented widths are in points (72 dpi), but converting them to /* The documented widths are in points (72 dpi), but converting them to
@ -1001,8 +996,14 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT)); FrameRect(c->hDC, &rc, GetSysColorBrush(COLOR_GRAYTEXT));
} }
if (visible) if (visible)
ME_DrawRun( c, c->pt.x + run->pt.x, {
c->pt.y + para->pt.y + run->pt.y + baseline, run, para ); ME_Cursor cursor;
cursor.pRun = run_get_di( run );
cursor.pPara = para_get_di( para );
cursor.nOffset = 0;
draw_run( c, c->pt.x + run->pt.x, c->pt.y + para->pt.y + run->pt.y + baseline, &cursor );
}
if (me_debug) if (me_debug)
{ {
static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0}; static const WCHAR wszRunDebug[] = {'[','%','d',':','%','x',']',' ','%','l','s',0};

View File

@ -5846,7 +5846,7 @@ void ME_GetOLEObjectSize(const ME_Context *c, ME_Run *run, SIZE *pSize)
} }
} }
void ME_DrawOLE(ME_Context *c, int x, int y, ME_Run *run, BOOL selected) void draw_ole( ME_Context *c, int x, int y, ME_Run *run, BOOL selected )
{ {
IDataObject* ido; IDataObject* ido;
FORMATETC fmt; FORMATETC fmt;