Commit c4acdfd3 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

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

parent a15e4515
...@@ -38,7 +38,6 @@ struct text_services ...@@ -38,7 +38,6 @@ struct text_services
ITextServices ITextServices_iface; ITextServices ITextServices_iface;
IUnknown *outer_unk; IUnknown *outer_unk;
LONG ref; LONG ref;
ITextHost *host;
ME_TextEditor *editor; ME_TextEditor *editor;
char spare[256]; /* for bug #12179 */ char spare[256]; /* for bug #12179 */
}; };
...@@ -150,7 +149,7 @@ static HRESULT update_client_rect( struct text_services *services, const RECT *c ...@@ -150,7 +149,7 @@ static HRESULT update_client_rect( struct text_services *services, const RECT *c
if (!client) if (!client)
{ {
if (!services->editor->in_place_active) return E_INVALIDARG; 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; if (FAILED( hr )) return hr;
} }
else rect = *client; else rect = *client;
...@@ -186,7 +185,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD ...@@ -186,7 +185,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
if (hr == S_OK) rewrap = TRUE; if (hr == S_OK) rewrap = TRUE;
if (!dc && services->editor->in_place_active) if (!dc && services->editor->in_place_active)
dc = ITextHost_TxGetDC( services->host ); dc = ITextHost_TxGetDC( services->editor->texthost );
if (!dc) return E_FAIL; if (!dc) return E_FAIL;
if (rewrap) if (rewrap)
...@@ -196,7 +195,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD ...@@ -196,7 +195,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxDraw( ITextServices *iface, DWORD
} }
editor_draw( services->editor, dc, update ); editor_draw( services->editor, dc, update );
if (!draw) ITextHost_TxReleaseDC( services->host, dc ); if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
return S_OK; return S_OK;
} }
...@@ -389,7 +388,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if ...@@ -389,7 +388,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
if (hr == S_OK) rewrap = TRUE; if (hr == S_OK) rewrap = TRUE;
if (!dc && services->editor->in_place_active) if (!dc && services->editor->in_place_active)
dc = ITextHost_TxGetDC( services->host ); dc = ITextHost_TxGetDC( services->editor->texthost );
if (!dc) return E_FAIL; if (!dc) return E_FAIL;
if (rewrap) if (rewrap)
...@@ -401,7 +400,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if ...@@ -401,7 +400,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_TxGetNaturalSize( ITextServices *if
*width = services->editor->nTotalWidth; *width = services->editor->nTotalWidth;
*height = services->editor->nTotalLength; *height = services->editor->nTotalLength;
if (!draw) ITextHost_TxReleaseDC( services->host, dc ); if (!draw) ITextHost_TxReleaseDC( services->editor->texthost, dc );
return S_OK; return S_OK;
} }
...@@ -430,14 +429,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic ...@@ -430,14 +429,14 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
if (mask & TXTBIT_SCROLLBARCHANGE) if (mask & TXTBIT_SCROLLBARCHANGE)
{ {
hr = ITextHost_TxGetScrollBars( services->host, &scrollbars ); hr = ITextHost_TxGetScrollBars( services->editor->texthost, &scrollbars );
if (SUCCEEDED( hr )) if (SUCCEEDED( hr ))
{ {
if ((services->editor->scrollbars ^ scrollbars) & WS_HSCROLL) 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 ); services->editor->nTotalWidth > services->editor->sizeWindow.cx );
if ((services->editor->scrollbars ^ scrollbars) & WS_VSCROLL) 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->nTotalLength > services->editor->sizeWindow.cy );
services->editor->scrollbars = scrollbars; services->editor->scrollbars = scrollbars;
} }
...@@ -449,10 +448,10 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic ...@@ -449,10 +448,10 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
{ {
LONG width; LONG width;
hr = ITextHost_TxGetSelectionBarWidth( services->host, &width ); hr = ITextHost_TxGetSelectionBarWidth( services->editor->texthost, &width );
if (hr == S_OK) 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->rcFormat.left -= services->editor->selofs;
services->editor->selofs = width ? SELECTIONBAR_WIDTH : 0; /* FIXME: convert from HIMETRIC */ services->editor->selofs = width ? SELECTIONBAR_WIDTH : 0; /* FIXME: convert from HIMETRIC */
services->editor->rcFormat.left += services->editor->selofs; services->editor->rcFormat.left += services->editor->selofs;
...@@ -468,7 +467,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic ...@@ -468,7 +467,7 @@ DECLSPEC_HIDDEN HRESULT __thiscall fnTextSrv_OnTxPropertyBitsChange( ITextServic
if (mask & TXTBIT_USEPASSWORD) 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; else services->editor->password_char = 0;
repaint = TRUE; repaint = TRUE;
} }
...@@ -593,7 +592,6 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown ** ...@@ -593,7 +592,6 @@ HRESULT create_text_services( IUnknown *outer, ITextHost *text_host, IUnknown **
services = CoTaskMemAlloc( sizeof(*services) ); services = CoTaskMemAlloc( sizeof(*services) );
if (services == NULL) return E_OUTOFMEMORY; if (services == NULL) return E_OUTOFMEMORY;
services->ref = 1; 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->IUnknown_inner.lpVtbl = &textservices_inner_vtbl;
services->ITextServices_iface.lpVtbl = &textservices_vtbl; services->ITextServices_iface.lpVtbl = &textservices_vtbl;
services->editor = ME_MakeEditor( text_host, emulate_10 ); services->editor = ME_MakeEditor( text_host, emulate_10 );
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment