Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-cw
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
wine
wine-cw
Commits
46ff4a6f
Commit
46ff4a6f
authored
Apr 21, 2008
by
Alex Villacís Lasso
Committed by
Alexandre Julliard
Apr 21, 2008
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: EM_SETTEXTEX supports RTF strings, with tests.
parent
dfcebfb2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
63 additions
and
4 deletions
+63
-4
editor.c
dlls/riched20/editor.c
+7
-4
editor.c
dlls/riched20/tests/editor.c
+56
-0
No files found.
dlls/riched20/editor.c
View file @
46ff4a6f
...
...
@@ -115,7 +115,7 @@
+ EM_SETSCROLLPOS 3.0
- EM_SETTABSTOPS 3.0
- EM_SETTARGETDEVICE (partial)
+ EM_SETTEXTEX 3.0 (
no rich text insertion handling,
proper style?)
+ EM_SETTEXTEX 3.0 (proper style?)
- EM_SETTEXTMODE 2.0
- EM_SETTYPOGRAPHYOPTIONS 3.0
+ EM_SETUNDOLIMIT 2.0
...
...
@@ -2117,17 +2117,20 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
wszText
=
lParam
?
ME_ToUnicode
(
pStruct
->
codepage
==
1200
,
(
void
*
)
lParam
)
:
NULL
;
len
=
wszText
?
lstrlenW
(
wszText
)
:
0
;
/* FIXME: this should support RTF strings too, according to MSDN */
if
(
pStruct
->
flags
&
ST_SELECTION
)
{
ME_GetSelection
(
editor
,
&
from
,
&
to
);
style
=
ME_GetSelectionInsertStyle
(
editor
);
ME_InternalDeleteText
(
editor
,
from
,
to
-
from
);
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
))
ME_StreamInRTFString
(
editor
,
0
,
(
char
*
)
lParam
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
style
);
ME_ReleaseStyle
(
style
);
}
else
{
ME_InternalDeleteText
(
editor
,
0
,
ME_GetTextLength
(
editor
));
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
if
(
pStruct
->
codepage
!=
1200
&&
lParam
&&
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf"
,
5
))
ME_StreamInRTFString
(
editor
,
0
,
(
char
*
)
lParam
);
else
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
len
,
editor
->
pBuffer
->
pDefaultStyle
);
len
=
1
;
}
ME_CommitUndo
(
editor
);
...
...
dlls/riched20/tests/editor.c
View file @
46ff4a6f
...
...
@@ -1041,6 +1041,20 @@ static void test_ES_PASSWORD(void)
DestroyWindow
(
hwndRichEdit
);
}
static
DWORD
CALLBACK
test_WM_SETTEXT_esCallback
(
DWORD_PTR
dwCookie
,
LPBYTE
pbBuff
,
LONG
cb
,
LONG
*
pcb
)
{
char
**
str
=
(
char
**
)
dwCookie
;
*
pcb
=
cb
;
if
(
*
pcb
>
0
)
{
memcpy
(
*
str
,
pbBuff
,
*
pcb
);
*
str
+=
*
pcb
;
}
return
0
;
}
static
void
test_WM_SETTEXT
()
{
HWND
hwndRichEdit
=
new_richedit
(
NULL
);
...
...
@@ -1057,8 +1071,11 @@ static void test_WM_SETTEXT()
const
char
*
TestItem6_after
=
"TestSomeText
\r\n
TestSomeText"
;
const
char
*
TestItem7
=
"TestSomeText
\r\n\r\r\n\r
TestSomeText"
;
const
char
*
TestItem7_after
=
"TestSomeText
\r\n
\r\n
TestSomeText"
;
char
buf
[
1024
]
=
{
0
};
LRESULT
result
;
EDITSTREAM
es
;
char
*
p
;
/* This test attempts to show that WM_SETTEXT on a riched20 control causes
any solitary \r to be converted to \r\n on return. Properly paired
...
...
@@ -1086,6 +1103,18 @@ static void test_WM_SETTEXT()
TEST_SETTEXT
(
TestItem6
,
TestItem6_after
)
TEST_SETTEXT
(
TestItem7
,
TestItem7_after
)
/* The following test demonstrates that WM_SETTEXT supports RTF strings */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
TestItem1
);
p
=
buf
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
p
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_WM_SETTEXT_esCallback
;
memset
(
buf
,
0
,
sizeof
(
buf
));
SendMessage
(
hwndRichEdit
,
EM_STREAMOUT
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
trace
(
"EM_STREAMOUT produced:
\n
%s
\n
"
,
buf
);
TEST_SETTEXT
(
buf
,
TestItem1
)
#undef TEST_SETTEXT
DestroyWindow
(
hwndRichEdit
);
}
...
...
@@ -1126,8 +1155,10 @@ static void test_EM_SETTEXTEX(void)
' '
,
'\r'
,
0
};
#define MAX_BUF_LEN 1024
WCHAR
buf
[
MAX_BUF_LEN
];
char
*
p
;
int
result
;
CHARRANGE
cr
;
EDITSTREAM
es
;
setText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
codepage
=
1200
;
/* no constant for unicode */
...
...
@@ -1274,6 +1305,31 @@ static void test_EM_SETTEXTEX(void)
"EM_SETTEXTEX to replace selection with more text failed: %i.
\n
"
,
lstrlenW
(
buf
)
);
/* The following test demonstrates that EM_SETTEXTEX supports RTF strings */
SendMessage
(
hwndRichEdit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
"TestSomeText"
);
/* TestItem1 */
p
=
(
char
*
)
buf
;
es
.
dwCookie
=
(
DWORD_PTR
)
&
p
;
es
.
dwError
=
0
;
es
.
pfnCallback
=
test_WM_SETTEXT_esCallback
;
memset
(
buf
,
0
,
sizeof
(
buf
));
SendMessage
(
hwndRichEdit
,
EM_STREAMOUT
,
(
WPARAM
)(
SF_RTF
),
(
LPARAM
)
&
es
);
trace
(
"EM_STREAMOUT produced:
\n
%s
\n
"
,
(
char
*
)
buf
);
setText
.
codepage
=
CP_ACP
;
/* EM_STREAMOUT saved as ANSI string */
getText
.
codepage
=
1200
;
/* no constant for unicode */
getText
.
cb
=
MAX_BUF_LEN
;
getText
.
flags
=
GT_DEFAULT
;
getText
.
lpDefaultChar
=
NULL
;
getText
.
lpUsedDefChar
=
NULL
;
setText
.
flags
=
0
;
SendMessage
(
hwndRichEdit
,
EM_SETTEXTEX
,
(
WPARAM
)
&
setText
,
(
LPARAM
)
buf
);
SendMessage
(
hwndRichEdit
,
EM_GETTEXTEX
,
(
WPARAM
)
&
getText
,
(
LPARAM
)
buf
);
ok
(
lstrcmpW
(
buf
,
TestItem1
)
==
0
,
"EM_GETTEXTEX results not what was set by EM_SETTEXTEX
\n
"
);
DestroyWindow
(
hwndRichEdit
);
}
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment