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->back_style = TXTBACK_OPAQUE;
ITextHost_TxGetBackStyle( texthost, &ed->back_style );
list_init( &ed->reobj_list );
OleInitialize(NULL);

View File

@ -436,6 +436,7 @@ typedef struct tagME_TextEditor
BOOL caret_hidden;
BOOL bMouseCaptured;
int wheel_remain;
TXTBACKSTYLE back_style;
struct list style_list;
struct list reobj_list;
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 inline BOOL editor_opaque( ME_TextEditor *editor )
{
return editor->back_style != TXTBACK_TRANSPARENT;
}
void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
{
ME_Paragraph *para;
@ -78,6 +83,8 @@ void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
draw_paragraph( &c, para );
para = para_next( para );
}
if (editor_opaque( editor ))
{
if (c.pt.y + editor->nTotalLength < c.rcView.bottom)
{ /* space after the end of the text */
rc.top = c.pt.y + editor->nTotalLength;
@ -96,6 +103,7 @@ void editor_draw( ME_TextEditor *editor, HDC hDC, const RECT *update )
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)
ME_SendRequestResize(editor, FALSE);
editor->nLastTotalLength = editor->nTotalLength;
@ -596,24 +604,30 @@ static void ME_DrawParaDecoration(ME_Context* c, ME_Paragraph* para, int y, RECT
}
if (para->fmt.dwMask & PFM_SPACEBEFORE)
{
bounds->top = ME_twips2pointsY(c, para->fmt.dySpaceBefore);
if (editor_opaque( c->editor ))
{
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.top = y;
bounds->top = ME_twips2pointsY(c, para->fmt.dySpaceBefore);
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)
{
bounds->bottom = ME_twips2pointsY(c, para->fmt.dySpaceAfter);
if (editor_opaque( c->editor ))
{
rc.left = c->rcView.left;
rc.right = c->rcView.right;
rc.bottom = y + para->nHeight;
bounds->bottom = ME_twips2pointsY(c, para->fmt.dySpaceAfter);
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,
* but might support it in later versions. */
@ -730,7 +744,7 @@ static void draw_table_borders( ME_Context *c, ME_Paragraph *para )
rc.top = top + width;
width = cell->yTextOffset - 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);
}
/* Draw cell borders.
@ -973,7 +987,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
rc.bottom = y + p->member.row.nHeight;
}
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);
if (bounds.right)
{
@ -982,7 +996,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
RECT after_bdr = rc;
after_bdr.left = rc.right + bounds.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,
after_bdr.bottom - after_bdr.top, PATCOPY);
}
@ -1035,7 +1049,7 @@ static void draw_paragraph( ME_Context *c, ME_Paragraph *para )
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. */
rc.top = c->pt.y + para->pt.y + para->nHeight;