riched20: Use the text host stored in the editor structure.

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-26 09:08:01 +00:00 committed by Alexandre Julliard
parent a15e45155d
commit c4acdfd3b4
1 changed files with 11 additions and 13 deletions

View File

@ -38,7 +38,6 @@ struct text_services
ITextServices ITextServices_iface;
IUnknown *outer_unk;
LONG ref;
ITextHost *host;
ME_TextEditor *editor;
char spare[256]; /* for bug #12179 */
};
@ -150,7 +149,7 @@ static HRESULT update_client_rect( struct text_services *services, const RECT *c
if (!client)
{
if (!services->editor->in_place_active) return E_INVALIDARG;
hr = ITextHost_TxGetClientRect( services->host, &rect );
hr = ITextHost_TxGetClientRect( services->editor->texthost, &rect );
if (FAILED( hr )) return hr;
}
else rect = *client;
@ -186,7 +185,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
if (hr == S_OK) rewrap = TRUE;
if (!dc && services->editor->in_place_active)
dc = ITextHost_TxGetDC( services->host );
dc = ITextHost_TxGetDC( services->editor->texthost );
if (!dc) return E_FAIL;
if (rewrap)
@ -196,7 +195,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
}
editor_draw( services->editor, dc, update );
if (!draw) ITextHost_TxReleaseDC( services->host, dc );
if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
return S_OK;
}
@ -389,7 +388,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
if (hr == S_OK) rewrap = TRUE;
if (!dc && services->editor->in_place_active)
dc = ITextHost_TxGetDC( services->host );
dc = ITextHost_TxGetDC( services->editor->texthost );
if (!dc) return E_FAIL;
if (rewrap)
@ -401,7 +400,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
*width = services->editor->nTotalWidth;
*height = services->editor->nTotalLength;
if (!draw) ITextHost_TxReleaseDC( services->host, dc );
if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
return S_OK;
}
@ -430,14 +429,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
if (mask & TXTBIT_SCROLLBARCHANGE)
{
hr = ITextHost_TxGetScrollBars( services->host, &scrollbars );
hr = ITextHost_TxGetScrollBars( services->editor->texthost, &scrollbars );
if (SUCCEEDED( hr ))
{
if ((services->editor->scrollbars ^ scrollbars) & WS_HSCROLL)
ITextHost_TxShowScrollBar( services->host, SB_HORZ, (scrollbars & WS_HSCROLL) &&
ITextHost_TxShowScrollBar( services->editor->texthost, SB_HORZ, (scrollbars & WS_HSCROLL) &&
services->editor->nTotalWidth > services->editor->sizeWindow.cx );
if ((services->editor->scrollbars ^ scrollbars) & WS_VSCROLL)
ITextHost_TxShowScrollBar( services->host, SB_VERT, (scrollbars & WS_VSCROLL) &&
ITextHost_TxShowScrollBar( services->editor->texthost, SB_VERT, (scrollbars & WS_VSCROLL) &&
services->editor->nTotalLength > services->editor->sizeWindow.cy );
services->editor->scrollbars = scrollbars;
}
@ -449,10 +448,10 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
{
LONG width;
hr = ITextHost_TxGetSelectionBarWidth( services->host, &width );
hr = ITextHost_TxGetSelectionBarWidth( services->editor->texthost, &width );
if (hr == S_OK)
{
ITextHost_TxInvalidateRect( services->host, &services->editor->rcFormat, TRUE );
ITextHost_TxInvalidateRect( services->editor->texthost, &services->editor->rcFormat, TRUE );
services->editor->rcFormat.left -= services->editor->selofs;
services->editor->selofs = width ? SELECTIONBAR_WIDTH : 0; /* FIXME: convert from HIMETRIC */
services->editor->rcFormat.left += services->editor->selofs;
@ -468,7 +467,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
if (mask & TXTBIT_USEPASSWORD)
{
if (bits & TXTBIT_USEPASSWORD) ITextHost_TxGetPasswordChar( services->host, &services->editor->password_char );
if (bits & TXTBIT_USEPASSWORD) ITextHost_TxGetPasswordChar( services->editor->texthost, &services->editor->password_char );
else services->editor->password_char = 0;
repaint = TRUE;
}
@ -593,7 +592,6 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
services = CoTaskMemAlloc( sizeof(*services) );
if (services == NULL) return E_OUTOFMEMORY;
services->ref = 1;
services->host = text_host; /* Don't take a ref of the host - this would lead to a mutual dependency */
services->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
services->ITextServices_iface.lpVtbl = &textservices_vtbl;
services->editor = ME_MakeEditor( text_host, emulate_10 );