Commit 8f6ba475 authored by Brian Chang's avatar Brian Chang Committed by Alexandre Julliard

riched20: EM_SETOPTIONS/EM_GETOPTIONS base implementation.

ECO_READONLY implemented and tested.
parent 5d388941
......@@ -56,7 +56,7 @@
+ EM_GETLINECOUNT returns number of rows, not of paragraphs
+ EM_GETMODIFY
- EM_GETOLEINTERFACE
- EM_GETOPTIONS
+ EM_GETOPTIONS
+ EM_GETPARAFORMAT
- EM_GETPASSWORDCHAR 2.0
- EM_GETPUNCTUATION 1.0asian
......@@ -102,7 +102,7 @@
- EM_SETLIMITTEXT
+ EM_SETMODIFY (not sure if implementation is correct)
- EM_SETOLECALLBACK
- EM_SETOPTIONS
+ EM_SETOPTIONS (partially implemented)
- EM_SETPALETTE 2.0
+ EM_SETPARAFORMAT
- EM_SETPASSWORDCHAR 2.0
......@@ -1325,7 +1325,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_GETLIMITTEXT)
UNSUPPORTED_MSG(EM_GETLINE)
/* UNSUPPORTED_MSG(EM_GETOLEINTERFACE) separate stub */
UNSUPPORTED_MSG(EM_GETOPTIONS)
UNSUPPORTED_MSG(EM_GETPASSWORDCHAR)
UNSUPPORTED_MSG(EM_GETREDONAME)
UNSUPPORTED_MSG(EM_GETTEXTMODE)
......@@ -1341,7 +1340,6 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
UNSUPPORTED_MSG(EM_SETEDITSTYLE)
UNSUPPORTED_MSG(EM_SETFONTSIZE)
UNSUPPORTED_MSG(EM_SETLANGOPTIONS)
UNSUPPORTED_MSG(EM_SETOPTIONS)
UNSUPPORTED_MSG(EM_SETPALETTE)
UNSUPPORTED_MSG(EM_SETPASSWORDCHAR)
UNSUPPORTED_MSG(EM_SETSCROLLPOS)
......@@ -1410,6 +1408,59 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
case EM_REDO:
ME_Redo(editor);
return 0;
case EM_GETOPTIONS:
{
/* these flags are equivalent to the ES_* counterparts */
DWORD mask = ECO_VERTICAL | ECO_AUTOHSCROLL | ECO_AUTOVSCROLL |
ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN;
DWORD settings = GetWindowLongW(hWnd, GWL_STYLE) & mask;
return settings;
}
case EM_SETOPTIONS:
{
/* these flags are equivalent to ES_* counterparts
* ECO_READONLY is already implemented in the code, only requires
* setting the bit to work
*/
DWORD mask = ECO_VERTICAL | ECO_AUTOHSCROLL | ECO_AUTOVSCROLL |
ECO_NOHIDESEL | ECO_READONLY | ECO_WANTRETURN;
DWORD raw = GetWindowLongW(hWnd, GWL_STYLE);
DWORD settings = mask & raw;
switch(wParam)
{
case ECOOP_SET:
settings = lParam;
break;
case ECOOP_OR:
settings |= lParam;
break;
case ECOOP_AND:
settings &= lParam;
break;
case ECOOP_XOR:
settings ^= lParam;
}
SetWindowLongW(hWnd, GWL_STYLE, (raw & ~mask) | (settings & mask));
if (lParam & ECO_AUTOWORDSELECTION)
FIXME("ECO_AUTOWORDSELECTION not implemented yet!\n");
if (lParam & ECO_SELECTIONBAR)
FIXME("ECO_SELECTIONBAR not implemented yet!\n");
if (lParam & ECO_VERTICAL)
FIXME("ECO_VERTICAL not implemented yet!\n");
if (lParam & ECO_AUTOHSCROLL)
FIXME("ECO_AUTOHSCROLL not implemented yet!\n");
if (lParam & ECO_AUTOVSCROLL)
FIXME("ECO_AUTOVSCROLL not implemented yet!\n");
if (lParam & ECO_NOHIDESEL)
FIXME("ECO_NOHIDESEL not implemented yet!\n");
if (lParam & ECO_WANTRETURN)
FIXME("ECO_WANTRETURN not implemented yet!\n");
return settings;
}
case EM_SETSEL:
{
ME_InvalidateSelection(editor);
......
......@@ -488,6 +488,54 @@ static void test_TM_PLAINTEXT()
DestroyWindow(hwndRichEdit);
}
/* FIXME: Extra '\r' appended at end of gotten text*/
static void test_WM_GETTEXT()
{
HWND hwndRichEdit = new_richedit(NULL);
static const char text[] = "Hello. My name is RichEdit!";
char buffer[1024] = {0};
int result;
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
result = strcmp(buffer,text);
todo_wine{
ok(result == 0,
"WM_GETTEXT: settext and gettext differ. strcmp: %d\n", result);
}
}
/* FIXME: need to test unimplemented options and robustly test wparam */
static void test_EM_SETOPTIONS()
{
HWND hwndRichEdit = new_richedit(NULL);
static const char text[] = "Hello. My name is RichEdit!";
char buffer[1024] = {0};
/* NEGATIVE TESTING - NO OPTIONS SET */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
SendMessage(hwndRichEdit, EM_SETOPTIONS, ECOOP_SET, 0);
/* testing no readonly by sending 'a' to the control*/
SetFocus(hwndRichEdit);
SendMessage(hwndRichEdit, WM_CHAR, 'a', 0x1E0001);
SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
ok(buffer[0]=='a',
"EM_SETOPTIONS: Text not changed! s1:%s s2:%s\n", text, buffer);
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
/* READONLY - sending 'a' to the control */
SendMessage(hwndRichEdit, WM_SETTEXT, 0, (LPARAM) text);
SendMessage(hwndRichEdit, EM_SETOPTIONS, ECOOP_SET, ECO_READONLY);
SetFocus(hwndRichEdit);
SendMessage(hwndRichEdit, WM_CHAR, 'a', 0x1E0001);
SendMessage(hwndRichEdit, WM_GETTEXT, 1024, (LPARAM) buffer);
ok(buffer[0]==text[0],
"EM_SETOPTIONS: Text changed! s1:%s s2:%s\n", text, buffer);
DestroyWindow(hwndRichEdit);
}
START_TEST( editor )
{
MSG msg;
......@@ -502,6 +550,8 @@ START_TEST( editor )
test_EM_SCROLLCARET();
test_EM_SETTEXTMODE();
test_TM_PLAINTEXT();
test_EM_SETOPTIONS();
test_WM_GETTEXT();
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
......
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