Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
W
wine-winehq
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-winehq
Commits
8ddf6c0a
Commit
8ddf6c0a
authored
Jan 12, 2009
by
Andrew Talbot
Committed by
Alexandre Julliard
Jan 13, 2009
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Declare some functions static.
parent
b0f2bebc
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
134 additions
and
146 deletions
+134
-146
caret.c
dlls/riched20/caret.c
+26
-27
editor.c
dlls/riched20/editor.c
+108
-107
editor.h
dlls/riched20/editor.h
+0
-12
No files found.
dlls/riched20/caret.c
View file @
8ddf6c0a
...
...
@@ -782,7 +782,7 @@ ME_MoveCursorWords(ME_TextEditor *editor, ME_Cursor *cursor, int nRelOfs)
}
void
static
void
ME_SelectByType
(
ME_TextEditor
*
editor
,
ME_SelectionType
selectionType
)
{
/* pCursor[0] is the end of the selection
...
...
@@ -1335,6 +1335,31 @@ ME_MoveCursorLines(ME_TextEditor *editor, ME_Cursor *pCursor, int nRelOfs)
assert
(
pCursor
->
pRun
->
type
==
diRun
);
}
static
BOOL
ME_UpdateSelection
(
ME_TextEditor
*
editor
,
const
ME_Cursor
*
pTempCursor
)
{
ME_Cursor
old_anchor
=
editor
->
pCursors
[
1
];
if
(
GetKeyState
(
VK_SHIFT
)
>=
0
)
/* cancelling selection */
{
/* any selection was present ? if so, it's no more, repaint ! */
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
if
(
memcmp
(
pTempCursor
,
&
old_anchor
,
sizeof
(
ME_Cursor
)))
{
return
TRUE
;
}
return
FALSE
;
}
else
{
if
(
!
memcmp
(
pTempCursor
,
&
editor
->
pCursors
[
1
],
sizeof
(
ME_Cursor
)))
/* starting selection */
{
editor
->
pCursors
[
1
]
=
*
pTempCursor
;
return
TRUE
;
}
}
ME_Repaint
(
editor
);
return
TRUE
;
}
static
void
ME_ArrowPageUp
(
ME_TextEditor
*
editor
,
ME_Cursor
*
pCursor
)
{
...
...
@@ -1522,32 +1547,6 @@ static int ME_GetSelCursor(ME_TextEditor *editor, int dir)
return
1
;
}
BOOL
ME_UpdateSelection
(
ME_TextEditor
*
editor
,
const
ME_Cursor
*
pTempCursor
)
{
ME_Cursor
old_anchor
=
editor
->
pCursors
[
1
];
if
(
GetKeyState
(
VK_SHIFT
)
>=
0
)
/* cancelling selection */
{
/* any selection was present ? if so, it's no more, repaint ! */
editor
->
pCursors
[
1
]
=
editor
->
pCursors
[
0
];
if
(
memcmp
(
pTempCursor
,
&
old_anchor
,
sizeof
(
ME_Cursor
)))
{
return
TRUE
;
}
return
FALSE
;
}
else
{
if
(
!
memcmp
(
pTempCursor
,
&
editor
->
pCursors
[
1
],
sizeof
(
ME_Cursor
)))
/* starting selection */
{
editor
->
pCursors
[
1
]
=
*
pTempCursor
;
return
TRUE
;
}
}
ME_Repaint
(
editor
);
return
TRUE
;
}
void
ME_DeleteSelection
(
ME_TextEditor
*
editor
)
{
int
from
,
to
;
...
...
dlls/riched20/editor.c
View file @
8ddf6c0a
...
...
@@ -240,6 +240,7 @@
WINE_DEFAULT_DEBUG_CHANNEL
(
richedit
);
static
BOOL
ME_RegisterEditorClass
(
HINSTANCE
);
static
BOOL
ME_UpdateLinkAttribute
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
);
static
const
WCHAR
RichEdit20W
[]
=
{
'R'
,
'i'
,
'c'
,
'h'
,
'E'
,
'd'
,
'i'
,
't'
,
'2'
,
'0'
,
'W'
,
0
};
static
const
WCHAR
RichEdit50W
[]
=
{
'R'
,
'i'
,
'c'
,
'h'
,
'E'
,
'd'
,
'i'
,
't'
,
'5'
,
'0'
,
'W'
,
0
};
...
...
@@ -2114,6 +2115,42 @@ ME_FilterEvent(ME_TextEditor *editor, UINT msg, WPARAM* wParam, LPARAM* lParam)
return
TRUE
;
}
static
void
ME_UpdateSelectionLinkAttribute
(
ME_TextEditor
*
editor
)
{
ME_DisplayItem
*
startPara
,
*
endPara
;
ME_DisplayItem
*
item
;
int
dummy
;
int
from
,
to
;
ME_GetSelection
(
editor
,
&
from
,
&
to
);
if
(
from
>
to
)
from
^=
to
,
to
^=
from
,
from
^=
to
;
startPara
=
NULL
;
endPara
=
NULL
;
/* Find paragraph previous to the one that contains start cursor */
item
=
ME_FindItemAtOffset
(
editor
,
diRun
,
from
,
&
dummy
);
if
(
item
)
{
startPara
=
ME_FindItemBack
(
item
,
diParagraph
);
item
=
ME_FindItemBack
(
startPara
,
diParagraph
);
if
(
item
)
startPara
=
item
;
}
/* Find paragraph that contains end cursor */
item
=
ME_FindItemAtOffset
(
editor
,
diRun
,
to
,
&
dummy
);
if
(
item
)
{
endPara
=
ME_FindItemFwd
(
item
,
diParagraph
);
}
if
(
startPara
&&
endPara
)
{
ME_UpdateLinkAttribute
(
editor
,
startPara
->
member
.
para
.
nCharOfs
,
endPara
->
member
.
para
.
nCharOfs
);
}
else
if
(
startPara
)
{
ME_UpdateLinkAttribute
(
editor
,
startPara
->
member
.
para
.
nCharOfs
,
-
1
);
}
}
static
BOOL
ME_KeyDown
(
ME_TextEditor
*
editor
,
WORD
nKey
)
{
...
...
@@ -2620,7 +2657,7 @@ static BOOL ME_ShowContextMenu(ME_TextEditor *editor, int x, int y)
return
TRUE
;
}
ME_TextEditor
*
ME_MakeEditor
(
HWND
hWnd
,
BOOL
bEmulateVersion10
)
static
ME_TextEditor
*
ME_MakeEditor
(
HWND
hWnd
,
BOOL
bEmulateVersion10
)
{
ME_TextEditor
*
ed
=
ALLOC_OBJ
(
ME_TextEditor
);
int
i
;
...
...
@@ -2705,7 +2742,7 @@ ME_TextEditor *ME_MakeEditor(HWND hWnd, BOOL bEmulateVersion10)
return
ed
;
}
void
ME_DestroyEditor
(
ME_TextEditor
*
editor
)
static
void
ME_DestroyEditor
(
ME_TextEditor
*
editor
)
{
ME_DisplayItem
*
pFirst
=
editor
->
pBuffer
->
pFirst
;
ME_DisplayItem
*
p
=
pFirst
,
*
pNext
=
NULL
;
...
...
@@ -2904,43 +2941,37 @@ get_msg_name(UINT msg)
return
""
;
}
static
LRESULT
RichEditWndProc_common
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
unicode
)
void
ME_LinkNotify
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
ME_TextEditor
*
editor
;
HRESULT
hresult
;
LRESULT
lresult
;
TRACE
(
"enter hwnd %p msg %04x (%s) %lx %lx, unicode %d
\n
"
,
hWnd
,
msg
,
get_msg_name
(
msg
),
wParam
,
lParam
,
unicode
);
editor
=
(
ME_TextEditor
*
)
GetWindowLongPtrW
(
hWnd
,
0
);
if
(
!
editor
)
{
if
(
msg
==
WM_NCCREATE
)
{
CREATESTRUCTW
*
pcs
=
(
CREATESTRUCTW
*
)
lParam
;
TRACE
(
"WM_NCCREATE: hWnd %p style 0x%08x
\n
"
,
hWnd
,
pcs
->
style
);
editor
=
ME_MakeEditor
(
hWnd
,
FALSE
);
SetWindowLongPtrW
(
hWnd
,
0
,
(
LONG_PTR
)
editor
);
return
TRUE
;
}
else
if
(
msg
!=
WM_NCDESTROY
)
{
ERR
(
"called with invalid hWnd %p - application bug?
\n
"
,
hWnd
);
return
0
;
}
}
int
x
,
y
;
ME_Cursor
tmpCursor
;
BOOL
isExact
;
int
nCharOfs
;
/* The start of the clicked text. Absolute character offset */
lresult
=
ME_HandleMessage
(
editor
,
msg
,
wParam
,
lParam
,
unicode
,
&
hresult
)
;
ME_Run
*
tmpRun
;
if
(
hresult
==
S_FALSE
)
lresult
=
DefWindowProcW
(
hWnd
,
msg
,
wParam
,
lParam
);
ENLINK
info
;
x
=
(
short
)
LOWORD
(
lParam
);
y
=
(
short
)
HIWORD
(
lParam
);
nCharOfs
=
ME_CharFromPos
(
editor
,
x
,
y
,
&
isExact
);
if
(
!
isExact
)
return
;
TRACE
(
"exit hwnd %p msg %04x (%s) %lx %lx, unicode %d -> %lu
\n
"
,
hWnd
,
msg
,
get_msg_name
(
msg
),
wParam
,
lParam
,
unicode
,
lresult
)
;
ME_CursorFromCharOfs
(
editor
,
nCharOfs
,
&
tmpCursor
);
tmpRun
=
&
tmpCursor
.
pRun
->
member
.
run
;
return
lresult
;
if
((
tmpRun
->
style
->
fmt
.
dwMask
&
CFM_LINK
)
&&
(
tmpRun
->
style
->
fmt
.
dwEffects
&
CFE_LINK
))
{
/* The clicked run has CFE_LINK set */
info
.
nmhdr
.
hwndFrom
=
editor
->
hWnd
;
info
.
nmhdr
.
idFrom
=
GetWindowLongW
(
editor
->
hWnd
,
GWLP_ID
);
info
.
nmhdr
.
code
=
EN_LINK
;
info
.
msg
=
msg
;
info
.
wParam
=
wParam
;
info
.
lParam
=
lParam
;
info
.
chrg
.
cpMin
=
ME_CharOfsFromRunOfs
(
editor
,
tmpCursor
.
pRun
,
0
);
info
.
chrg
.
cpMax
=
info
.
chrg
.
cpMin
+
ME_StrVLen
(
tmpRun
->
strText
);
SendMessageW
(
GetParent
(
editor
->
hWnd
),
WM_NOTIFY
,
info
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
info
);
}
}
#define UNSUPPORTED_MSG(e) \
...
...
@@ -2954,7 +2985,7 @@ static LRESULT RichEditWndProc_common(HWND hWnd, UINT msg, WPARAM wParam,
* The LRESULT that is returned is a return value for window procs,
* and the phresult parameter is the COM return code needed by the
* text services interface. */
LRESULT
ME_HandleMessage
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
static
LRESULT
ME_HandleMessage
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
unicode
,
HRESULT
*
phresult
)
{
*
phresult
=
S_OK
;
...
...
@@ -4288,6 +4319,45 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
0L
;
}
static
LRESULT
RichEditWndProc_common
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
unicode
)
{
ME_TextEditor
*
editor
;
HRESULT
hresult
;
LRESULT
lresult
;
TRACE
(
"enter hwnd %p msg %04x (%s) %lx %lx, unicode %d
\n
"
,
hWnd
,
msg
,
get_msg_name
(
msg
),
wParam
,
lParam
,
unicode
);
editor
=
(
ME_TextEditor
*
)
GetWindowLongPtrW
(
hWnd
,
0
);
if
(
!
editor
)
{
if
(
msg
==
WM_NCCREATE
)
{
CREATESTRUCTW
*
pcs
=
(
CREATESTRUCTW
*
)
lParam
;
TRACE
(
"WM_NCCREATE: hWnd %p style 0x%08x
\n
"
,
hWnd
,
pcs
->
style
);
editor
=
ME_MakeEditor
(
hWnd
,
FALSE
);
SetWindowLongPtrW
(
hWnd
,
0
,
(
LONG_PTR
)
editor
);
return
TRUE
;
}
else
if
(
msg
!=
WM_NCDESTROY
)
{
ERR
(
"called with invalid hWnd %p - application bug?
\n
"
,
hWnd
);
return
0
;
}
}
lresult
=
ME_HandleMessage
(
editor
,
msg
,
wParam
,
lParam
,
unicode
,
&
hresult
);
if
(
hresult
==
S_FALSE
)
lresult
=
DefWindowProcW
(
hWnd
,
msg
,
wParam
,
lParam
);
TRACE
(
"exit hwnd %p msg %04x (%s) %lx %lx, unicode %d -> %lu
\n
"
,
hWnd
,
msg
,
get_msg_name
(
msg
),
wParam
,
lParam
,
unicode
,
lresult
);
return
lresult
;
}
static
LRESULT
WINAPI
RichEditWndProcW
(
HWND
hWnd
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
BOOL
unicode
=
TRUE
;
...
...
@@ -4336,39 +4406,6 @@ void ME_SendOldNotify(ME_TextEditor *editor, int nCode)
SendMessageA
(
GetParent
(
hWnd
),
WM_COMMAND
,
MAKEWPARAM
(
GetWindowLongW
(
hWnd
,
GWLP_ID
),
nCode
),
(
LPARAM
)
hWnd
);
}
void
ME_LinkNotify
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
)
{
int
x
,
y
;
ME_Cursor
tmpCursor
;
BOOL
isExact
;
int
nCharOfs
;
/* The start of the clicked text. Absolute character offset */
ME_Run
*
tmpRun
;
ENLINK
info
;
x
=
(
short
)
LOWORD
(
lParam
);
y
=
(
short
)
HIWORD
(
lParam
);
nCharOfs
=
ME_CharFromPos
(
editor
,
x
,
y
,
&
isExact
);
if
(
!
isExact
)
return
;
ME_CursorFromCharOfs
(
editor
,
nCharOfs
,
&
tmpCursor
);
tmpRun
=
&
tmpCursor
.
pRun
->
member
.
run
;
if
((
tmpRun
->
style
->
fmt
.
dwMask
&
CFM_LINK
)
&&
(
tmpRun
->
style
->
fmt
.
dwEffects
&
CFE_LINK
))
{
/* The clicked run has CFE_LINK set */
info
.
nmhdr
.
hwndFrom
=
editor
->
hWnd
;
info
.
nmhdr
.
idFrom
=
GetWindowLongW
(
editor
->
hWnd
,
GWLP_ID
);
info
.
nmhdr
.
code
=
EN_LINK
;
info
.
msg
=
msg
;
info
.
wParam
=
wParam
;
info
.
lParam
=
lParam
;
info
.
chrg
.
cpMin
=
ME_CharOfsFromRunOfs
(
editor
,
tmpCursor
.
pRun
,
0
);
info
.
chrg
.
cpMax
=
info
.
chrg
.
cpMin
+
ME_StrVLen
(
tmpRun
->
strText
);
SendMessageW
(
GetParent
(
editor
->
hWnd
),
WM_NOTIFY
,
info
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
info
);
}
}
int
ME_CountParagraphsBetween
(
ME_TextEditor
*
editor
,
int
from
,
int
to
)
{
ME_DisplayItem
*
item
=
ME_FindItemFwd
(
editor
->
pBuffer
->
pFirst
,
diParagraph
);
...
...
@@ -4613,7 +4650,7 @@ static BOOL isurlspecial(WCHAR c)
*
* sel_max == -1 indicates scan to end of text.
*/
BOOL
ME_FindNextURLCandidate
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
,
static
BOOL
ME_FindNextURLCandidate
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
,
int
*
candidate_min
,
int
*
candidate_max
)
{
ME_DisplayItem
*
item
;
...
...
@@ -4709,7 +4746,7 @@ BOOL ME_FindNextURLCandidate(ME_TextEditor *editor, int sel_min, int sel_max,
/**
* This proc evaluates the selection and returns TRUE if it can be considered an URL
*/
BOOL
ME_IsCandidateAnURL
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
)
static
BOOL
ME_IsCandidateAnURL
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
)
{
struct
prefix_s
{
const
char
*
text
;
...
...
@@ -4761,7 +4798,7 @@ BOOL ME_IsCandidateAnURL(ME_TextEditor *editor, int sel_min, int sel_max)
*
* Returns TRUE if at least one section was modified.
*/
BOOL
ME_UpdateLinkAttribute
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
)
static
BOOL
ME_UpdateLinkAttribute
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
)
{
BOOL
modified
=
FALSE
;
int
cMin
,
cMax
;
...
...
@@ -4834,39 +4871,3 @@ BOOL ME_UpdateLinkAttribute(ME_TextEditor *editor, int sel_min, int sel_max)
}
while
(
sel_min
<
sel_max
);
return
modified
;
}
void
ME_UpdateSelectionLinkAttribute
(
ME_TextEditor
*
editor
)
{
ME_DisplayItem
*
startPara
,
*
endPara
;
ME_DisplayItem
*
item
;
int
dummy
;
int
from
,
to
;
ME_GetSelection
(
editor
,
&
from
,
&
to
);
if
(
from
>
to
)
from
^=
to
,
to
^=
from
,
from
^=
to
;
startPara
=
NULL
;
endPara
=
NULL
;
/* Find paragraph previous to the one that contains start cursor */
item
=
ME_FindItemAtOffset
(
editor
,
diRun
,
from
,
&
dummy
);
if
(
item
)
{
startPara
=
ME_FindItemBack
(
item
,
diParagraph
);
item
=
ME_FindItemBack
(
startPara
,
diParagraph
);
if
(
item
)
startPara
=
item
;
}
/* Find paragraph that contains end cursor */
item
=
ME_FindItemAtOffset
(
editor
,
diRun
,
to
,
&
dummy
);
if
(
item
)
{
endPara
=
ME_FindItemFwd
(
item
,
diParagraph
);
}
if
(
startPara
&&
endPara
)
{
ME_UpdateLinkAttribute
(
editor
,
startPara
->
member
.
para
.
nCharOfs
,
endPara
->
member
.
para
.
nCharOfs
);
}
else
if
(
startPara
)
{
ME_UpdateLinkAttribute
(
editor
,
startPara
->
member
.
para
.
nCharOfs
,
-
1
);
}
}
dlls/riched20/editor.h
View file @
8ddf6c0a
...
...
@@ -177,7 +177,6 @@ void ME_SetDefaultCharFormat(ME_TextEditor *editor, CHARFORMAT2W *mod);
/* caret.c */
int
ME_SetSelection
(
ME_TextEditor
*
editor
,
int
from
,
int
to
);
void
ME_SelectByType
(
ME_TextEditor
*
editor
,
ME_SelectionType
selectionType
);
void
ME_HideCaret
(
ME_TextEditor
*
ed
);
void
ME_ShowCaret
(
ME_TextEditor
*
ed
);
void
ME_MoveCaret
(
ME_TextEditor
*
ed
);
...
...
@@ -204,7 +203,6 @@ BOOL ME_InternalDeleteText(ME_TextEditor *editor, int nOfs, int nChars, BOOL bFo
int
ME_GetTextLength
(
ME_TextEditor
*
editor
);
int
ME_GetTextLengthEx
(
ME_TextEditor
*
editor
,
const
GETTEXTLENGTHEX
*
how
);
ME_Style
*
ME_GetSelectionInsertStyle
(
ME_TextEditor
*
editor
);
BOOL
ME_UpdateSelection
(
ME_TextEditor
*
editor
,
const
ME_Cursor
*
pTempCursor
);
/* context.c */
void
ME_InitContext
(
ME_Context
*
c
,
ME_TextEditor
*
editor
,
HDC
hDC
);
...
...
@@ -269,12 +267,7 @@ void ME_CopyReObject(REOBJECT* dst, const REOBJECT* src);
void
ME_DeleteReObject
(
REOBJECT
*
reo
);
/* editor.c */
ME_TextEditor
*
ME_MakeEditor
(
HWND
hWnd
,
BOOL
bEmulateVersion10
);
void
ME_DestroyEditor
(
ME_TextEditor
*
editor
);
LRESULT
ME_HandleMessage
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
,
BOOL
unicode
,
HRESULT
*
phresult
);
void
ME_SendOldNotify
(
ME_TextEditor
*
editor
,
int
nCode
);
void
ME_LinkNotify
(
ME_TextEditor
*
editor
,
UINT
msg
,
WPARAM
wParam
,
LPARAM
lParam
);
int
ME_GetTextW
(
ME_TextEditor
*
editor
,
WCHAR
*
buffer
,
int
nStart
,
int
nChars
,
BOOL
bCRLF
);
ME_DisplayItem
*
ME_FindItemAtOffset
(
ME_TextEditor
*
editor
,
ME_DIType
nItemType
,
int
nOffset
,
int
*
nItemOffset
);
void
ME_RTFCharAttrHook
(
struct
_RTF_Info
*
info
);
...
...
@@ -284,11 +277,6 @@ void ME_RTFSpecialCharHook(struct _RTF_Info *info);
void
ME_StreamInFill
(
ME_InStream
*
stream
);
extern
int
me_debug
;
extern
void
DoWrap
(
ME_TextEditor
*
editor
);
extern
BOOL
ME_FindNextURLCandidate
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
,
int
*
candidate_min
,
int
*
candidate_max
);
extern
BOOL
ME_IsCandidateAnURL
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
);
BOOL
ME_UpdateLinkAttribute
(
ME_TextEditor
*
editor
,
int
sel_min
,
int
sel_max
);
void
ME_UpdateSelectionLinkAttribute
(
ME_TextEditor
*
editor
);
/* table.c */
BOOL
ME_IsInTable
(
ME_DisplayItem
*
pItem
);
...
...
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