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
d62dd465
Commit
d62dd465
authored
Aug 25, 2015
by
Jactry Zeng
Committed by
Alexandre Julliard
Aug 27, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
riched20: Implement EM_SETFONTSIZE.
parent
836f06f6
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
138 additions
and
2 deletions
+138
-2
editor.c
dlls/riched20/editor.c
+43
-2
editor.c
dlls/riched20/tests/editor.c
+95
-0
No files found.
dlls/riched20/editor.c
View file @
d62dd465
...
@@ -96,7 +96,7 @@
...
@@ -96,7 +96,7 @@
+ EM_SETCHARFORMAT (partly done, no ANSI)
+ EM_SETCHARFORMAT (partly done, no ANSI)
- EM_SETEDITSTYLE
- EM_SETEDITSTYLE
+ EM_SETEVENTMASK (few notifications supported)
+ EM_SETEVENTMASK (few notifications supported)
-
EM_SETFONTSIZE
+
EM_SETFONTSIZE
- EM_SETIMECOLOR 1.0asian
- EM_SETIMECOLOR 1.0asian
- EM_SETIMEOPTIONS 1.0asian
- EM_SETIMEOPTIONS 1.0asian
- EM_SETIMESTATUS
- EM_SETIMESTATUS
...
@@ -3265,7 +3265,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -3265,7 +3265,6 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
UNSUPPORTED_MSG
(
EM_SELECTIONTYPE
)
UNSUPPORTED_MSG
(
EM_SELECTIONTYPE
)
UNSUPPORTED_MSG
(
EM_SETBIDIOPTIONS
)
UNSUPPORTED_MSG
(
EM_SETBIDIOPTIONS
)
UNSUPPORTED_MSG
(
EM_SETEDITSTYLE
)
UNSUPPORTED_MSG
(
EM_SETEDITSTYLE
)
UNSUPPORTED_MSG
(
EM_SETFONTSIZE
)
UNSUPPORTED_MSG
(
EM_SETLANGOPTIONS
)
UNSUPPORTED_MSG
(
EM_SETLANGOPTIONS
)
UNSUPPORTED_MSG
(
EM_SETMARGINS
)
UNSUPPORTED_MSG
(
EM_SETMARGINS
)
UNSUPPORTED_MSG
(
EM_SETPALETTE
)
UNSUPPORTED_MSG
(
EM_SETPALETTE
)
...
@@ -3341,6 +3340,48 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
...
@@ -3341,6 +3340,48 @@ LRESULT ME_HandleMessage(ME_TextEditor *editor, UINT msg, WPARAM wParam,
return
settings
;
return
settings
;
}
}
case
EM_SETFONTSIZE
:
{
CHARFORMAT2W
cf
;
LONG
tmp_size
,
size
;
BOOL
is_increase
=
((
LONG
)
wParam
>
0
);
if
(
editor
->
mode
&
TM_PLAINTEXT
)
return
FALSE
;
cf
.
cbSize
=
sizeof
(
cf
);
cf
.
dwMask
=
CFM_SIZE
;
ME_GetSelectionCharFormat
(
editor
,
&
cf
);
tmp_size
=
(
cf
.
yHeight
/
20
)
+
wParam
;
if
(
tmp_size
<=
1
)
size
=
1
;
else
if
(
tmp_size
>
12
&&
tmp_size
<
28
&&
tmp_size
%
2
)
size
=
tmp_size
+
(
is_increase
?
1
:
-
1
);
else
if
(
tmp_size
>
28
&&
tmp_size
<
36
)
size
=
is_increase
?
36
:
28
;
else
if
(
tmp_size
>
36
&&
tmp_size
<
48
)
size
=
is_increase
?
48
:
36
;
else
if
(
tmp_size
>
48
&&
tmp_size
<
72
)
size
=
is_increase
?
72
:
48
;
else
if
(
tmp_size
>
72
&&
tmp_size
<
80
)
size
=
is_increase
?
80
:
72
;
else
if
(
tmp_size
>
80
&&
tmp_size
<
1638
)
size
=
10
*
(
is_increase
?
(
tmp_size
/
10
+
1
)
:
(
tmp_size
/
10
));
else
if
(
tmp_size
>=
1638
)
size
=
1638
;
else
size
=
tmp_size
;
cf
.
yHeight
=
size
*
20
;
/* convert twips to points */
ME_SetSelectionCharFormat
(
editor
,
&
cf
);
ME_CommitUndo
(
editor
);
ME_WrapMarkedParagraphs
(
editor
);
ME_UpdateScrollBar
(
editor
);
ME_Repaint
(
editor
);
return
TRUE
;
}
case
EM_SETOPTIONS
:
case
EM_SETOPTIONS
:
{
{
/* these flags are equivalent to ES_* counterparts, except for
/* these flags are equivalent to ES_* counterparts, except for
...
...
dlls/riched20/tests/editor.c
View file @
d62dd465
...
@@ -7857,6 +7857,100 @@ static void test_EM_SETREADONLY(void)
...
@@ -7857,6 +7857,100 @@ static void test_EM_SETREADONLY(void)
DestroyWindow
(
richedit
);
DestroyWindow
(
richedit
);
}
}
static
inline
LONG
twips2points
(
LONG
value
)
{
return
value
/
20
;
}
#define TEST_EM_SETFONTSIZE(hwnd,size,expected_size,expected_res,expected_undo) \
_test_font_size(__LINE__,hwnd,size,expected_size,expected_res,expected_undo)
static
void
_test_font_size
(
unsigned
line
,
HWND
hwnd
,
LONG
size
,
LONG
expected_size
,
LRESULT
expected_res
,
BOOL
expected_undo
)
{
CHARFORMAT2A
cf
;
LRESULT
res
;
BOOL
isundo
;
cf
.
cbSize
=
sizeof
(
cf
);
cf
.
dwMask
=
CFM_SIZE
;
res
=
SendMessageA
(
hwnd
,
EM_SETFONTSIZE
,
size
,
0
);
SendMessageA
(
hwnd
,
EM_GETCHARFORMAT
,
SCF_SELECTION
,
(
LPARAM
)
&
cf
);
isundo
=
SendMessageA
(
hwnd
,
EM_CANUNDO
,
0
,
0
);
ok_
(
__FILE__
,
line
)(
res
==
expected_res
,
"EM_SETFONTSIZE unexpected return value: %lx.
\n
"
,
res
);
ok_
(
__FILE__
,
line
)(
twips2points
(
cf
.
yHeight
)
==
expected_size
,
"got wrong font size: %d, expected: %d
\n
"
,
twips2points
(
cf
.
yHeight
),
expected_size
);
ok_
(
__FILE__
,
line
)(
isundo
==
expected_undo
,
"get wrong undo mark: %d, expected: %d.
\n
"
,
isundo
,
expected_undo
);
}
static
void
test_EM_SETFONTSIZE
(
void
)
{
HWND
richedit
=
new_richedit
(
NULL
);
CHAR
text
[]
=
"wine"
;
CHARFORMAT2A
tmp_cf
;
LONG
default_size
;
tmp_cf
.
cbSize
=
sizeof
(
tmp_cf
);
tmp_cf
.
dwMask
=
CFM_SIZE
;
tmp_cf
.
yHeight
=
9
*
20
.
0
;
SendMessageA
(
richedit
,
EM_SETCHARFORMAT
,
SCF_DEFAULT
,
(
LPARAM
)
&
tmp_cf
);
SendMessageA
(
richedit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
text
);
SendMessageA
(
richedit
,
EM_SETMODIFY
,
FALSE
,
0
);
/* without selection */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
10
,
TRUE
,
FALSE
);
/* 9 + 1 -> 10 */
SendMessageA
(
richedit
,
EM_GETCHARFORMAT
,
SCF_DEFAULT
,
(
LPARAM
)
&
tmp_cf
);
default_size
=
twips2points
(
tmp_cf
.
yHeight
);
ok
(
default_size
==
9
,
"Default font size should not be changed.
\n
"
);
ok
(
SendMessageA
(
richedit
,
EM_SETMODIFY
,
0
,
0
)
==
FALSE
,
"Modify flag should not be changed.
\n
"
);
SendMessageA
(
richedit
,
EM_SETSEL
,
0
,
2
);
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
9
,
TRUE
,
TRUE
);
/* 9 + 0 -> 9 */
SendMessageA
(
richedit
,
EM_SETMODIFY
,
FALSE
,
0
);
TEST_EM_SETFONTSIZE
(
richedit
,
3
,
12
,
TRUE
,
TRUE
);
/* 9 + 3 -> 12 */
ok
(
SendMessageA
(
richedit
,
EM_SETMODIFY
,
0
,
0
)
==
FALSE
,
"Modify flag should not be changed.
\n
"
);
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
14
,
TRUE
,
TRUE
);
/* 12 + 1 + 1 -> 14 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
1
,
12
,
TRUE
,
TRUE
);
/* 14 - 1 - 1 -> 12 */
TEST_EM_SETFONTSIZE
(
richedit
,
4
,
16
,
TRUE
,
TRUE
);
/* 12 + 4 -> 16 */
TEST_EM_SETFONTSIZE
(
richedit
,
3
,
20
,
TRUE
,
TRUE
);
/* 16 + 3 + 1 -> 20 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
20
,
TRUE
,
TRUE
);
/* 20 + 0 -> 20 */
TEST_EM_SETFONTSIZE
(
richedit
,
8
,
28
,
TRUE
,
TRUE
);
/* 20 + 8 -> 28 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
28
,
TRUE
,
TRUE
);
/* 28 + 0 -> 28 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
36
,
TRUE
,
TRUE
);
/* 28 + 1 -> 36 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
36
,
TRUE
,
TRUE
);
/* 36 + 0 -> 36 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
48
,
TRUE
,
TRUE
);
/* 36 + 1 -> 48 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
48
,
TRUE
,
TRUE
);
/* 48 + 0 -> 48 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
72
,
TRUE
,
TRUE
);
/* 48 + 1 -> 72 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
72
,
TRUE
,
TRUE
);
/* 72 + 0 -> 72 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
80
,
TRUE
,
TRUE
);
/* 72 + 1 -> 80 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
80
,
TRUE
,
TRUE
);
/* 80 + 0 -> 80 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
90
,
TRUE
,
TRUE
);
/* 80 + 1 -> 90 */
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
90
,
TRUE
,
TRUE
);
/* 90 + 0 -> 90 */
TEST_EM_SETFONTSIZE
(
richedit
,
1
,
100
,
TRUE
,
TRUE
);
/* 90 + 1 -> 100 */
TEST_EM_SETFONTSIZE
(
richedit
,
25
,
130
,
TRUE
,
TRUE
);
/* 100 + 25 -> 130 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
1
,
120
,
TRUE
,
TRUE
);
/* 130 - 1 -> 120 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
35
,
80
,
TRUE
,
TRUE
);
/* 120 - 35 -> 80 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
7
,
72
,
TRUE
,
TRUE
);
/* 80 - 7 -> 72 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
42
,
28
,
TRUE
,
TRUE
);
/* 72 - 42 -> 28 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
16
,
12
,
TRUE
,
TRUE
);
/* 28 - 16 -> 12 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
3
,
9
,
TRUE
,
TRUE
);
/* 12 - 3 -> 9 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
8
,
1
,
TRUE
,
TRUE
);
/* 9 - 8 -> 1 */
TEST_EM_SETFONTSIZE
(
richedit
,
-
111
,
1
,
TRUE
,
TRUE
);
/* 1 - 111 -> 1 */
TEST_EM_SETFONTSIZE
(
richedit
,
10086
,
1638
,
TRUE
,
TRUE
);
/* 1 + 10086 -> 1638 */
/* return FALSE when richedit is TM_PLAINTEXT mode */
SendMessageA
(
richedit
,
WM_SETTEXT
,
0
,
(
LPARAM
)
""
);
SendMessageA
(
richedit
,
EM_SETTEXTMODE
,
(
WPARAM
)
TM_PLAINTEXT
,
0
);
TEST_EM_SETFONTSIZE
(
richedit
,
0
,
9
,
FALSE
,
FALSE
);
DestroyWindow
(
richedit
);
}
START_TEST
(
editor
)
START_TEST
(
editor
)
{
{
BOOL
ret
;
BOOL
ret
;
...
@@ -7922,6 +8016,7 @@ START_TEST( editor )
...
@@ -7922,6 +8016,7 @@ START_TEST( editor )
test_WM_CREATE
();
test_WM_CREATE
();
test_reset_default_para_fmt
();
test_reset_default_para_fmt
();
test_EM_SETREADONLY
();
test_EM_SETREADONLY
();
test_EM_SETFONTSIZE
();
/* Set the environment variable WINETEST_RICHED20 to keep windows
/* Set the environment variable WINETEST_RICHED20 to keep windows
* responsive and open for 30 seconds. This is useful for debugging.
* responsive and open for 30 seconds. This is useful for debugging.
...
...
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