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
9761b457
Commit
9761b457
authored
Feb 14, 2006
by
Phil Krylov
Committed by
Alexandre Julliard
Feb 14, 2006
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Support RTF text in WM_SETTEXT.
parent
9acfd6be
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
48 additions
and
6 deletions
+48
-6
editor.c
dlls/riched20/editor.c
+48
-6
No files found.
dlls/riched20/editor.c
View file @
9761b457
...
...
@@ -697,6 +697,40 @@ static LRESULT ME_StreamIn(ME_TextEditor *editor, DWORD format, EDITSTREAM *stre
}
typedef
struct
tagME_RTFStringStreamStruct
{
char
*
string
;
int
pos
;
int
length
;
}
ME_RTFStringStreamStruct
;
static
DWORD
CALLBACK
ME_ReadFromRTFString
(
DWORD_PTR
dwCookie
,
LPBYTE
lpBuff
,
LONG
cb
,
LONG
*
pcb
)
{
ME_RTFStringStreamStruct
*
pStruct
=
(
ME_RTFStringStreamStruct
*
)
dwCookie
;
int
count
;
count
=
min
(
cb
,
pStruct
->
length
-
pStruct
->
pos
);
memmove
(
lpBuff
,
pStruct
->
string
+
pStruct
->
pos
,
count
);
pStruct
->
pos
+=
count
;
*
pcb
=
count
;
return
0
;
}
static
void
ME_StreamInRTFString
(
ME_TextEditor
*
editor
,
BOOL
selection
,
char
*
string
)
{
EDITSTREAM
es
;
ME_RTFStringStreamStruct
data
;
data
.
string
=
string
;
data
.
length
=
strlen
(
string
);
data
.
pos
=
0
;
es
.
dwCookie
=
(
DWORD
)
&
data
;
es
.
pfnCallback
=
ME_ReadFromRTFString
;
ME_StreamIn
(
editor
,
SF_RTF
|
(
selection
?
SFF_SELECTION
:
0
),
&
es
);
}
ME_DisplayItem
*
ME_FindItemAtOffset
(
ME_TextEditor
*
editor
,
ME_DIType
nItemType
,
int
nOffset
,
int
*
nItemOffset
)
{
...
...
@@ -1591,15 +1625,23 @@ LRESULT WINAPI RichEditANSIWndProc(HWND hWnd, UINT msg, WPARAM wParam, LPARAM lP
ME_InternalDeleteText
(
editor
,
0
,
ME_GetTextLength
(
editor
));
if
(
lParam
)
{
LPWSTR
wszText
=
ME_ToUnicode
(
hWnd
,
(
void
*
)
lParam
);
TRACE
(
"WM_SETTEXT lParam==%lx
\n
"
,
lParam
);
TRACE
(
"WM_SETTEXT - %s
\n
"
,
debugstr_w
(
wszText
));
/* debugstr_w() */
if
(
lstrlenW
(
wszText
)
>
0
)
if
(
!
IsWindowUnicode
(
hWnd
)
&&
!
strncmp
((
char
*
)
lParam
,
"{
\\
rtf1"
,
6
))
{
/* Undocumented: WM_SETTEXT supports RTF text */
ME_StreamInRTFString
(
editor
,
0
,
(
char
*
)
lParam
);
}
else
{
/* uses default style! */
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
-
1
,
editor
->
pBuffer
->
pDefaultStyle
);
LPWSTR
wszText
=
ME_ToUnicode
(
hWnd
,
(
void
*
)
lParam
);
TRACE
(
"WM_SETTEXT - %s
\n
"
,
debugstr_w
(
wszText
));
/* debugstr_w() */
if
(
lstrlenW
(
wszText
)
>
0
)
{
/* uses default style! */
ME_InsertTextFromCursor
(
editor
,
0
,
wszText
,
-
1
,
editor
->
pBuffer
->
pDefaultStyle
);
}
ME_EndToUnicode
(
hWnd
,
wszText
);
}
ME_EndToUnicode
(
hWnd
,
wszText
);
}
else
TRACE
(
"WM_SETTEXT - NULL
\n
"
);
...
...
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