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
9c446a13
Commit
9c446a13
authored
Jan 22, 2001
by
Dmitry Timoshkov
Committed by
Alexandre Julliard
Jan 22, 2001
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Protect read-only edit control from modification.
parent
2b77ea04
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
29 additions
and
7 deletions
+29
-7
edit.c
controls/edit.c
+29
-7
No files found.
controls/edit.c
View file @
9c446a13
...
...
@@ -308,6 +308,10 @@ static inline void EDIT_WM_Clear(WND *wnd, EDITSTATE *es)
{
static
const
WCHAR
empty_stringW
[]
=
{
0
};
/* Protect read-only edit control from modification */
if
(
es
->
style
&
ES_READONLY
)
return
;
EDIT_EM_ReplaceSel
(
wnd
,
es
,
TRUE
,
empty_stringW
,
TRUE
);
if
(
es
->
flags
&
EF_UPDATE
)
{
...
...
@@ -3400,8 +3404,15 @@ static void EDIT_EM_SetWordBreakProc16(WND *wnd, EDITSTATE *es, EDITWORDBREAKPRO
*/
static
BOOL
EDIT_EM_Undo
(
WND
*
wnd
,
EDITSTATE
*
es
)
{
INT
ulength
=
strlenW
(
es
->
undo_text
);
LPWSTR
utext
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
ulength
+
1
)
*
sizeof
(
WCHAR
));
INT
ulength
;
LPWSTR
utext
;
/* Protect read-only edit control from modification */
if
(
es
->
style
&
ES_READONLY
)
return
FALSE
;
ulength
=
strlenW
(
es
->
undo_text
);
utext
=
HeapAlloc
(
GetProcessHeap
(),
0
,
(
ulength
+
1
)
*
sizeof
(
WCHAR
));
strcpyW
(
utext
,
es
->
undo_text
);
...
...
@@ -3434,7 +3445,14 @@ static BOOL EDIT_EM_Undo(WND *wnd, EDITSTATE *es)
*/
static
void
EDIT_WM_Char
(
WND
*
wnd
,
EDITSTATE
*
es
,
WCHAR
c
)
{
BOOL
control
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
BOOL
control
;
/* Protect read-only edit control from modification */
if
(
es
->
style
&
ES_READONLY
)
return
;
control
=
GetKeyState
(
VK_CONTROL
)
&
0x8000
;
switch
(
c
)
{
case
'\r'
:
/* If the edit doesn't want the return and it's not a multiline edit, do nothing */
...
...
@@ -3567,15 +3585,15 @@ static void EDIT_WM_ContextMenu(WND *wnd, EDITSTATE *es, INT x, INT y)
ORDER_UINT
(
start
,
end
);
/* undo */
EnableMenuItem
(
popup
,
0
,
MF_BYPOSITION
|
(
EDIT_EM_CanUndo
(
es
)
?
MF_ENABLED
:
MF_GRAYED
));
EnableMenuItem
(
popup
,
0
,
MF_BYPOSITION
|
(
EDIT_EM_CanUndo
(
es
)
&&
!
(
es
->
style
&
ES_READONLY
)
?
MF_ENABLED
:
MF_GRAYED
));
/* cut */
EnableMenuItem
(
popup
,
2
,
MF_BYPOSITION
|
((
end
-
start
)
&&
!
(
es
->
style
&
ES_PASSWORD
)
?
MF_ENABLED
:
MF_GRAYED
));
EnableMenuItem
(
popup
,
2
,
MF_BYPOSITION
|
((
end
-
start
)
&&
!
(
es
->
style
&
ES_PASSWORD
)
&&
!
(
es
->
style
&
ES_READONLY
)
?
MF_ENABLED
:
MF_GRAYED
));
/* copy */
EnableMenuItem
(
popup
,
3
,
MF_BYPOSITION
|
((
end
-
start
)
&&
!
(
es
->
style
&
ES_PASSWORD
)
?
MF_ENABLED
:
MF_GRAYED
));
/* paste */
EnableMenuItem
(
popup
,
4
,
MF_BYPOSITION
|
(
IsClipboardFormatAvailable
(
CF_UNICODETEXT
)
?
MF_ENABLED
:
MF_GRAYED
));
EnableMenuItem
(
popup
,
4
,
MF_BYPOSITION
|
(
IsClipboardFormatAvailable
(
CF_UNICODETEXT
)
&&
!
(
es
->
style
&
ES_READONLY
)
?
MF_ENABLED
:
MF_GRAYED
));
/* delete */
EnableMenuItem
(
popup
,
5
,
MF_BYPOSITION
|
((
end
-
start
)
?
MF_ENABLED
:
MF_GRAYED
));
EnableMenuItem
(
popup
,
5
,
MF_BYPOSITION
|
((
end
-
start
)
&&
!
(
es
->
style
&
ES_READONLY
)
?
MF_ENABLED
:
MF_GRAYED
));
/* select all */
EnableMenuItem
(
popup
,
7
,
MF_BYPOSITION
|
(
start
||
(
end
!=
strlenW
(
es
->
text
))
?
MF_ENABLED
:
MF_GRAYED
));
...
...
@@ -4349,6 +4367,10 @@ static void EDIT_WM_Paste(WND *wnd, EDITSTATE *es)
HGLOBAL
hsrc
;
LPWSTR
src
;
/* Protect read-only edit control from modification */
if
(
es
->
style
&
ES_READONLY
)
return
;
OpenClipboard
(
wnd
->
hwndSelf
);
if
((
hsrc
=
GetClipboardData
(
CF_UNICODETEXT
)))
{
src
=
(
LPWSTR
)
GlobalLock
(
hsrc
);
...
...
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