riched20: Add support for TXTBACK_TRANSPARENT.

Signed-off-by: Huw Davies <huw@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
Huw Davies 2021-03-25 09:10:26 +00:00 committed by Alexandre Julliard
parent 909b2ced71
commit e668aa9dcb
3 changed files with 49 additions and 31 deletions

View File

@ -3037,6 +3037,9 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->wheel_remain = 0; ed->wheel_remain = 0;
ed->back_style = TXTBACK_OPAQUE;
ITextHost_TxGetBackStyle( texthost, &ed->back_style );
list_init( &ed->reobj_list ); list_init( &ed->reobj_list );
OleInitialize(NULL); OleInitialize(NULL);

View File

@ -436,6 +436,7 @@ typedef struct tagME_TextEditor
BOOL caret_hidden; BOOL caret_hidden;
BOOL bMouseCaptured; BOOL bMouseCaptured;
int wheel_remain; int wheel_remain;
TXTBACKSTYLE back_style;
struct list style_list; struct list style_list;
struct list reobj_list; struct list reobj_list;
struct wine_rb_tree marked_paras; struct wine_rb_tree marked_paras;

View File

@ -25,6 +25,11 @@ WINE_DEFAULT_DEBUG_CHANNEL(richedit);
static void draw_paragraph( ME_Context *c, ME_Paragraph *para ); static void draw_paragraph( ME_Context *c, ME_Paragraph *para );
static inline BOOL editor_opaque( ME_TextEditor *editor )
{
return editor->back_style != TXTBACK_TRANSPARENT;
}
void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update ) void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
{ {
ME_Paragraph *para; ME_Paragraph *para;
@ -78,23 +83,26 @@ void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
draw_paragraph( &c, para ); draw_paragraph( &c, para );
para = para_next( para ); para = para_next( para );
} }
if (c.pt.y + editor->nTotalLength < c.rcView.bottom) if (editor_opaque( editor ))
{ /* space after the end of the text */ {
rc.top = c.pt.y + editor->nTotalLength; if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
rc.left = c.rcView.left; { /* space after the end of the text */
rc.bottom = c.rcView.bottom; rc.top = c.pt.y + editor->nTotalLength;
rc.right = c.rcView.right; rc.left = c.rcView.left;
if (IntersectRect( &rc, &rc, update )) rc.bottom = c.rcView.bottom;
PatBlt(hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); rc.right = c.rcView.right;
} if (IntersectRect( &rc, &rc, update ))
if (editor->selofs) PatBlt(hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
{ /* selection bar */ }
rc.left = c.rcView.left - editor->selofs; if (editor->selofs)
rc.top = c.rcView.top; { /* selection bar */
rc.right = c.rcView.left; rc.left = c.rcView.left - editor->selofs;
rc.bottom = c.rcView.bottom; rc.top = c.rcView.top;
if (IntersectRect( &rc, &rc, update )) rc.right = c.rcView.left;
PatBlt( hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY ); rc.bottom = c.rcView.bottom;
if (IntersectRect( &rc, &rc, update ))
PatBlt( hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY );
}
} }
if (editor->nTotalLength != editor->nLastTotalLength || editor->nTotalWidth != editor->nLastTotalWidth) if (editor->nTotalLength != editor->nLastTotalLength || editor->nTotalWidth != editor->nLastTotalWidth)
ME_SendRequestResize(editor, FALSE); ME_SendRequestResize(editor, FALSE);
@ -597,22 +605,28 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
if (para->fmt.dwMask & PFM_SPACEBEFORE) if (para->fmt.dwMask & PFM_SPACEBEFORE)
{ {
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.top = y;
bounds->top = ME_twips2pointsY(c, para->fmt.dySpaceBefore); bounds->top = ME_twips2pointsY(c, para->fmt.dySpaceBefore);
rc.bottom = y + bounds->top + top_border; if (editor_opaque( c->editor ))
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); {
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.top = y;
rc.bottom = y + bounds->top + top_border;
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
}
} }
if (para->fmt.dwMask & PFM_SPACEAFTER) if (para->fmt.dwMask & PFM_SPACEAFTER)
{ {
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.bottom = y + para->nHeight;
bounds->bottom = ME_twips2pointsY(c, para->fmt.dySpaceAfter); bounds->bottom = ME_twips2pointsY(c, para->fmt.dySpaceAfter);
rc.top = rc.bottom - bounds->bottom - bottom_border; if (editor_opaque( c->editor ))
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); {
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.bottom = y + para->nHeight;
rc.top = rc.bottom - bounds->bottom - bottom_border;
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
}
} }
/* Native richedit doesn't support paragraph borders in v1.0 - 4.1, /* Native richedit doesn't support paragraph borders in v1.0 - 4.1,
@ -730,7 +744,7 @@ static void draw_table_borders( ME_Context *c, ME_Paragraph *para )
rc.top = top + width; rc.top = top + width;
width = cell->yTextOffset - width; width = cell->yTextOffset - width;
rc.bottom = rc.top + width; rc.bottom = rc.top + width;
if (width) if (width && editor_opaque( c->editor ))
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
} }
/* Draw cell borders. /* Draw cell borders.
@ -973,7 +987,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
rc.bottom = y + p->member.row.nHeight; rc.bottom = y + p->member.row.nHeight;
} }
visible = RectVisible(c->hDC, &rc); visible = RectVisible(c->hDC, &rc);
if (visible) if (editor_opaque( c->editor ) && visible)
PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY); PatBlt(c->hDC, rc.left, rc.top, rc.right - rc.left, rc.bottom - rc.top, PATCOPY);
if (bounds.right) if (bounds.right)
{ {
@ -982,7 +996,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
RECT after_bdr = rc; RECT after_bdr = rc;
after_bdr.left = rc.right + bounds.right; after_bdr.left = rc.right + bounds.right;
after_bdr.right = c->rcView.right; after_bdr.right = c->rcView.right;
if (RectVisible(c->hDC, &after_bdr)) if (editor_opaque( c->editor ) && RectVisible( c->hDC, &after_bdr ))
PatBlt(c->hDC, after_bdr.left, after_bdr.top, after_bdr.right - after_bdr.left, PatBlt(c->hDC, after_bdr.left, after_bdr.top, after_bdr.right - after_bdr.left,
after_bdr.bottom - after_bdr.top, PATCOPY); after_bdr.bottom - after_bdr.top, PATCOPY);
} }
@ -1035,7 +1049,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
no++; no++;
} }
if (para_cell( para )) if (editor_opaque( c->editor ) && para_cell( para ))
{ {
/* Clear any space at the bottom of the cell after the text. */ /* Clear any space at the bottom of the cell after the text. */
rc.top = c->pt.y + para->pt.y + para->nHeight; rc.top = c->pt.y + para->pt.y + para->nHeight;