Huw Davies : riched20: Initialize a copy of the properties in the host.
Alexandre Julliard
julliard at winehq.org
Mon Mar 15 16:59:12 CDT 2021
Module: wine
Branch: master
Commit: 1507f2c8c39a46ce09eefd25fd7b3e50c115f603
URL: https://source.winehq.org/git/wine.git/?a=commit;h=1507f2c8c39a46ce09eefd25fd7b3e50c115f603
Author: Huw Davies <huw at codeweavers.com>
Date: Mon Mar 15 10:03:21 2021 +0000
riched20: Initialize a copy of the properties in the host.
Signed-off-by: Huw Davies <huw at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/riched20/txthost.c | 69 +++++++++++++++++--------------------------------
1 file changed, 23 insertions(+), 46 deletions(-)
diff --git a/dlls/riched20/txthost.c b/dlls/riched20/txthost.c
index 5bd11c5aba2..c810589b4a6 100644
--- a/dlls/riched20/txthost.c
+++ b/dlls/riched20/txthost.c
@@ -41,6 +41,7 @@ struct host
HWND window;
BOOL emulate_10;
PARAFORMAT2 para_fmt;
+ DWORD props;
};
static const ITextHostVtbl textHostVtbl;
@@ -48,6 +49,26 @@ static const ITextHostVtbl textHostVtbl;
static BOOL listbox_registered;
static BOOL combobox_registered;
+static void host_init_props( struct host *host )
+{
+ DWORD style, scrollbar;
+
+ host->props = TXTBIT_RICHTEXT | TXTBIT_AUTOWORDSEL | TXTBIT_ALLOWBEEP;
+
+ style = GetWindowLongW( host->window, GWL_STYLE );
+
+ if (style & ES_MULTILINE) host->props |= TXTBIT_MULTILINE;
+ if (style & ES_READONLY) host->props |= TXTBIT_READONLY;
+ if (style & ES_PASSWORD) host->props |= TXTBIT_USEPASSWORD;
+ if (!(style & ES_NOHIDESEL)) host->props |= TXTBIT_HIDESELECTION;
+ if (style & ES_SAVESEL) host->props |= TXTBIT_SAVESELECTION;
+ if (style & ES_VERTICAL) host->props |= TXTBIT_VERTICAL;
+ if (style & ES_NOOLEDRAGDROP) host->props |= TXTBIT_DISABLEDRAG;
+
+ ITextHost_TxGetScrollBars( &host->ITextHost_iface, &scrollbar );
+ if (!(scrollbar & ES_AUTOHSCROLL)) host->props |= TXTBIT_WORDWRAP;
+}
+
struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
{
struct host *texthost;
@@ -68,6 +89,7 @@ struct host *host_create( HWND hwnd, CREATESTRUCTW *cs, BOOL emulate_10 )
if (cs->style & ES_CENTER)
texthost->para_fmt.wAlignment = PFA_CENTER;
texthost->editor = NULL;
+ host_init_props( texthost );
return texthost;
}
@@ -373,53 +395,8 @@ DEFINE_THISCALL_WRAPPER(ITextHostImpl_TxGetPropertyBits,12)
DECLSPEC_HIDDEN HRESULT __thiscall ITextHostImpl_TxGetPropertyBits( ITextHost *iface, DWORD mask, DWORD *bits )
{
struct host *host = impl_from_ITextHost( iface );
- DWORD style;
- DWORD dwBits = 0;
- DWORD dwScrollBar;
- style = GetWindowLongW( host->window, GWL_STYLE );
- ITextHostImpl_TxGetScrollBars(iface, &dwScrollBar);
-
- dwBits |= TXTBIT_RICHTEXT|TXTBIT_AUTOWORDSEL;
- if (!(dwScrollBar & ES_AUTOHSCROLL))
- dwBits |= TXTBIT_WORDWRAP;
-
- /* Bits that correspond to window styles. */
- if (style & ES_MULTILINE)
- dwBits |= TXTBIT_MULTILINE;
- if (style & ES_READONLY)
- dwBits |= TXTBIT_READONLY;
- if (style & ES_PASSWORD)
- dwBits |= TXTBIT_USEPASSWORD;
- if (!(style & ES_NOHIDESEL))
- dwBits |= TXTBIT_HIDESELECTION;
- if (style & ES_SAVESEL)
- dwBits |= TXTBIT_SAVESELECTION;
- if (style & ES_VERTICAL)
- dwBits |= TXTBIT_VERTICAL;
- if (style & ES_NOOLEDRAGDROP)
- dwBits |= TXTBIT_DISABLEDRAG;
-
- dwBits |= TXTBIT_ALLOWBEEP;
-
- /* The following bits are always FALSE because they are probably only
- * needed for ITextServices_OnTxPropertyBitsChange:
- * TXTBIT_VIEWINSETCHANGE
- * TXTBIT_BACKSTYLECHANGE
- * TXTBIT_MAXLENGTHCHANGE
- * TXTBIT_CHARFORMATCHANGE
- * TXTBIT_PARAFORMATCHANGE
- * TXTBIT_SHOWACCELERATOR
- * TXTBIT_EXTENTCHANGE
- * TXTBIT_SELBARCHANGE
- * TXTBIT_SCROLLBARCHANGE
- * TXTBIT_CLIENTRECTCHANGE
- *
- * Documented by MSDN as not supported:
- * TXTBIT_USECURRENTBKG
- */
-
- *bits = dwBits & mask;
+ *bits = host->props & mask;
return S_OK;
}
More information about the wine-cvs
mailing list