Commit 0ad80117 authored by Huw Davies's avatar Huw Davies Committed by Alexandre Julliard

riched20: Move scrollbar initialisation out of WM_CREATE.

parent 887ffec9
...@@ -3019,6 +3019,20 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10) ...@@ -3019,6 +3019,20 @@ ME_TextEditor *ME_MakeEditor(ITextHost *texthost, BOOL bEmulateVersion10)
ed->horz_si.nPage = 0; ed->horz_si.nPage = 0;
ed->horz_si.nPos = 0; ed->horz_si.nPos = 0;
if (ed->scrollbars & ES_DISABLENOSCROLL)
{
if (ed->scrollbars & WS_VSCROLL)
{
ITextHost_TxSetScrollRange( texthost, SB_VERT, 0, 1, TRUE );
ITextHost_TxEnableScrollBar( texthost, SB_VERT, ESB_DISABLE_BOTH );
}
if (ed->scrollbars & WS_HSCROLL)
{
ITextHost_TxSetScrollRange( texthost, SB_HORZ, 0, 1, TRUE );
ITextHost_TxEnableScrollBar( texthost, SB_HORZ, ESB_DISABLE_BOTH );
}
}
ed->wheel_remain = 0; ed->wheel_remain = 0;
list_init( &ed->reobj_list ); list_init( &ed->reobj_list );
...@@ -3160,33 +3174,6 @@ static void ME_SetText(ME_TextEditor *editor, void *text, BOOL unicode) ...@@ -3160,33 +3174,6 @@ static void ME_SetText(ME_TextEditor *editor, void *text, BOOL unicode)
ME_EndToUnicode(codepage, wszText); ME_EndToUnicode(codepage, wszText);
} }
static LRESULT ME_WmCreate( ME_TextEditor *editor )
{
INT max;
max = (editor->scrollbars & ES_DISABLENOSCROLL) ? 1 : 0;
if (~editor->scrollbars & ES_DISABLENOSCROLL || editor->scrollbars & WS_VSCROLL)
ITextHost_TxSetScrollRange(editor->texthost, SB_VERT, 0, max, TRUE);
if (~editor->scrollbars & ES_DISABLENOSCROLL || editor->scrollbars & WS_HSCROLL)
ITextHost_TxSetScrollRange(editor->texthost, SB_HORZ, 0, max, TRUE);
if (editor->scrollbars & ES_DISABLENOSCROLL)
{
if (editor->scrollbars & WS_VSCROLL)
{
ITextHost_TxEnableScrollBar(editor->texthost, SB_VERT, ESB_DISABLE_BOTH);
ITextHost_TxShowScrollBar(editor->texthost, SB_VERT, TRUE);
}
if (editor->scrollbars & WS_HSCROLL)
{
ITextHost_TxEnableScrollBar(editor->texthost, SB_HORZ, ESB_DISABLE_BOTH);
ITextHost_TxShowScrollBar(editor->texthost, SB_HORZ, TRUE);
}
}
return 0;
}
static LRESULT handle_EM_SETCHARFORMAT( ME_TextEditor *editor, WPARAM flags, const CHARFORMAT2W *fmt_in ) static LRESULT handle_EM_SETCHARFORMAT( ME_TextEditor *editor, WPARAM flags, const CHARFORMAT2W *fmt_in )
{ {
CHARFORMAT2W fmt; CHARFORMAT2W fmt;
...@@ -3891,8 +3878,6 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam, ...@@ -3891,8 +3878,6 @@ LRESULT editor_handle_message( ME_TextEditor *editor, UINT msg, WPARAM wParam,
return (wParam >= 0x40000) ? 0 : MAKELONG( pt.x, pt.y ); return (wParam >= 0x40000) ? 0 : MAKELONG( pt.x, pt.y );
} }
case WM_CREATE:
return ME_WmCreate( editor );
case WM_LBUTTONDBLCLK: case WM_LBUTTONDBLCLK:
case WM_LBUTTONDOWN: case WM_LBUTTONDOWN:
{ {
......
...@@ -3109,11 +3109,9 @@ static void test_scrollbar_visibility(void) ...@@ -3109,11 +3109,9 @@ static void test_scrollbar_visibility(void)
GetScrollInfo(hwndRichEdit, SB_VERT, &si); GetScrollInfo(hwndRichEdit, SB_VERT, &si);
ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0), ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0),
"Vertical scrollbar is invisible, should be visible.\n"); "Vertical scrollbar is invisible, should be visible.\n");
todo_wine {
ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100, ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100,
"reported page/range is %d (%d..%d) expected 0 (0..100)\n", "reported page/range is %d (%d..%d) expected 0 (0..100)\n",
si.nPage, si.nMin, si.nMax); si.nPage, si.nMin, si.nMax);
}
/* Ditto, see above */ /* Ditto, see above */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0);
...@@ -3123,11 +3121,9 @@ static void test_scrollbar_visibility(void) ...@@ -3123,11 +3121,9 @@ static void test_scrollbar_visibility(void)
GetScrollInfo(hwndRichEdit, SB_VERT, &si); GetScrollInfo(hwndRichEdit, SB_VERT, &si);
ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0), ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0),
"Vertical scrollbar is invisible, should be visible.\n"); "Vertical scrollbar is invisible, should be visible.\n");
todo_wine {
ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100, ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100,
"reported page/range is %d (%d..%d) expected 0 (0..100)\n", "reported page/range is %d (%d..%d) expected 0 (0..100)\n",
si.nPage, si.nMin, si.nMax); si.nPage, si.nMin, si.nMax);
}
/* Ditto, see above */ /* Ditto, see above */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a"); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a");
...@@ -3137,11 +3133,9 @@ static void test_scrollbar_visibility(void) ...@@ -3137,11 +3133,9 @@ static void test_scrollbar_visibility(void)
GetScrollInfo(hwndRichEdit, SB_VERT, &si); GetScrollInfo(hwndRichEdit, SB_VERT, &si);
ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0), ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0),
"Vertical scrollbar is invisible, should be visible.\n"); "Vertical scrollbar is invisible, should be visible.\n");
todo_wine {
ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100, ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100,
"reported page/range is %d (%d..%d) expected 0 (0..100)\n", "reported page/range is %d (%d..%d) expected 0 (0..100)\n",
si.nPage, si.nMin, si.nMax); si.nPage, si.nMin, si.nMax);
}
/* Ditto, see above */ /* Ditto, see above */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a\na"); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)"a\na");
...@@ -3151,11 +3145,9 @@ static void test_scrollbar_visibility(void) ...@@ -3151,11 +3145,9 @@ static void test_scrollbar_visibility(void)
GetScrollInfo(hwndRichEdit, SB_VERT, &si); GetScrollInfo(hwndRichEdit, SB_VERT, &si);
ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0), ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0),
"Vertical scrollbar is invisible, should be visible.\n"); "Vertical scrollbar is invisible, should be visible.\n");
todo_wine {
ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100, ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100,
"reported page/range is %d (%d..%d) expected 0 (0..100)\n", "reported page/range is %d (%d..%d) expected 0 (0..100)\n",
si.nPage, si.nMin, si.nMax); si.nPage, si.nMin, si.nMax);
}
/* Ditto, see above */ /* Ditto, see above */
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0);
...@@ -3165,11 +3157,9 @@ static void test_scrollbar_visibility(void) ...@@ -3165,11 +3157,9 @@ static void test_scrollbar_visibility(void)
GetScrollInfo(hwndRichEdit, SB_VERT, &si); GetScrollInfo(hwndRichEdit, SB_VERT, &si);
ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0), ok (((GetWindowLongA(hwndRichEdit, GWL_STYLE) & WS_VSCROLL) != 0),
"Vertical scrollbar is invisible, should be visible.\n"); "Vertical scrollbar is invisible, should be visible.\n");
todo_wine {
ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100, ok(si.nPage == 0 && si.nMin == 0 && si.nMax == 100,
"reported page/range is %d (%d..%d) expected 0 (0..100)\n", "reported page/range is %d (%d..%d) expected 0 (0..100)\n",
si.nPage, si.nMin, si.nMax); si.nPage, si.nMin, si.nMax);
}
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, (LPARAM)text);
SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0); SendMessageA(hwndRichEdit, WM_SETTEXT, 0, 0);
......
...@@ -63,6 +63,10 @@ static void host_init_props( struct host *host ) ...@@ -63,6 +63,10 @@ static void host_init_props( struct host *host )
style = GetWindowLongW( host->window, GWL_STYLE ); style = GetWindowLongW( host->window, GWL_STYLE );
/* text services assumes the scrollbars are originally not shown, so hide them.
However with ES_DISABLENOSCROLL it'll immediately show them, so don't bother */
if (!(style & ES_DISABLENOSCROLL)) ShowScrollBar( host->window, SB_BOTH, FALSE );
host->scrollbars = style & (WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL | host->scrollbars = style & (WS_VSCROLL | WS_HSCROLL | ES_AUTOVSCROLL |
ES_AUTOHSCROLL | ES_DISABLENOSCROLL); ES_AUTOHSCROLL | ES_DISABLENOSCROLL);
if (style & WS_VSCROLL) host->scrollbars |= ES_AUTOVSCROLL; if (style & WS_VSCROLL) host->scrollbars |= ES_AUTOVSCROLL;
...@@ -989,8 +993,6 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam, ...@@ -989,8 +993,6 @@ static LRESULT RichEditWndProc_common( HWND hwnd, UINT msg, WPARAM wparam,
} }
ITextServices_TxSetText( host->text_srv, textW ); ITextServices_TxSetText( host->text_srv, textW );
if (lparam) ME_EndToUnicode( codepage, textW ); if (lparam) ME_EndToUnicode( codepage, textW );
hr = ITextServices_TxSendMessage( host->text_srv, msg, wparam, lparam, &res );
break; break;
} }
case WM_DESTROY: case WM_DESTROY:
......
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