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
77d65c39
Commit
77d65c39
authored
Jan 18, 2018
by
Alexandre Julliard
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comdlg32: Add a helper function to select a combo box item.
Signed-off-by:
Alexandre Julliard
<
julliard@winehq.org
>
parent
8a62752f
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
22 additions
and
38 deletions
+22
-38
fontdlg.c
dlls/comdlg32/fontdlg.c
+22
-38
No files found.
dlls/comdlg32/fontdlg.c
View file @
77d65c39
...
...
@@ -483,6 +483,16 @@ static inline void CFn_ReleaseDC(const CHOOSEFONTW *lpcf, HDC hdc)
ReleaseDC
(
0
,
hdc
);
}
/*************************************************************************
* select_combo_item [internal]
*/
static
void
select_combo_item
(
HWND
dialog
,
int
id
,
int
sel
)
{
HWND
combo
=
GetDlgItem
(
dialog
,
id
);
SendMessageW
(
combo
,
CB_SETCURSEL
,
sel
,
0
);
SendMessageW
(
dialog
,
WM_COMMAND
,
MAKEWPARAM
(
id
,
CBN_SELCHANGE
),
(
LPARAM
)
combo
);
}
/***********************************************************************
* AddFontStyle [internal]
*/
...
...
@@ -543,10 +553,7 @@ static void CFn_FitFontSize( HWND hDlg, int points)
if
(
points
==
(
int
)
SendDlgItemMessageW
(
hDlg
,
cmb3
,
CB_GETITEMDATA
,
i
,
0
))
{
SendDlgItemMessageW
(
hDlg
,
cmb3
,
CB_SETCURSEL
,
i
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb3
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb3
));
select_combo_item
(
hDlg
,
cmb3
,
i
);
return
;
}
}
...
...
@@ -559,21 +566,17 @@ static BOOL CFn_FitFontStyle( HWND hDlg, LONG packedstyle )
{
LONG
id
;
int
i
;
BOOL
ret
=
FALSE
;
/* look for fitting font style in combobox2 */
for
(
i
=
0
;
i
<
TEXT_EXTRAS
;
i
++
)
{
id
=
SendDlgItemMessageW
(
hDlg
,
cmb2
,
CB_GETITEMDATA
,
i
,
0
);
if
(
packedstyle
==
id
)
{
SendDlgItemMessageW
(
hDlg
,
cmb2
,
CB_SETCURSEL
,
i
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb2
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb2
));
ret
=
TRUE
;
break
;
select_combo_item
(
hDlg
,
cmb2
,
i
);
return
TRUE
;
}
}
return
ret
;
return
FALSE
;
}
...
...
@@ -587,16 +590,12 @@ static BOOL CFn_FitCharSet( HWND hDlg, int charset )
cs
=
SendDlgItemMessageW
(
hDlg
,
cmb5
,
CB_GETITEMDATA
,
i
,
0
);
if
(
charset
==
cs
)
{
SendDlgItemMessageW
(
hDlg
,
cmb5
,
CB_SETCURSEL
,
i
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb5
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb2
));
select_combo_item
(
hDlg
,
cmb5
,
i
);
return
TRUE
;
}
}
/* no charset fits: select the first one in the list */
SendDlgItemMessageW
(
hDlg
,
cmb5
,
CB_SETCURSEL
,
0
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb5
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb2
));
select_combo_item
(
hDlg
,
cmb5
,
0
);
return
FALSE
;
}
...
...
@@ -729,9 +728,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
points
=
MulDiv
(
height
,
72
,
GetScreenDPI
());
pstyle
=
MAKELONG
(
lpxx
->
lfWeight
>
FW_MEDIUM
?
FW_BOLD
:
FW_NORMAL
,
lpxx
->
lfItalic
!=
0
);
SendDlgItemMessageW
(
hDlg
,
cmb1
,
CB_SETCURSEL
,
j
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb1
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb1
));
select_combo_item
(
hDlg
,
cmb1
,
j
);
init
=
TRUE
;
/* look for fitting font style in combobox2 */
CFn_FitFontStyle
(
hDlg
,
pstyle
);
...
...
@@ -742,18 +739,10 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
}
if
(
!
init
)
{
SendDlgItemMessageW
(
hDlg
,
cmb1
,
CB_SETCURSEL
,
0
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb1
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb1
));
SendDlgItemMessageW
(
hDlg
,
cmb2
,
CB_SETCURSEL
,
0
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb2
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb1
));
SendDlgItemMessageW
(
hDlg
,
cmb3
,
CB_SETCURSEL
,
0
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb3
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb3
));
SendDlgItemMessageW
(
hDlg
,
cmb5
,
CB_SETCURSEL
,
0
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
MAKEWPARAM
(
cmb5
,
CBN_SELCHANGE
),
(
LPARAM
)
GetDlgItem
(
hDlg
,
cmb5
));
select_combo_item
(
hDlg
,
cmb1
,
0
);
select_combo_item
(
hDlg
,
cmb2
,
0
);
select_combo_item
(
hDlg
,
cmb3
,
0
);
select_combo_item
(
hDlg
,
cmb5
,
0
);
}
/* limit text length user can type in as font size */
SendDlgItemMessageW
(
hDlg
,
cmb3
,
CB_LIMITTEXT
,
5
,
0
);
...
...
@@ -761,12 +750,7 @@ static LRESULT CFn_WMInitDialog(HWND hDlg, LPARAM lParam, LPCHOOSEFONTW lpcf)
if
((
lpcf
->
Flags
&
CF_USESTYLE
)
&&
lpcf
->
lpszStyle
)
{
j
=
SendDlgItemMessageW
(
hDlg
,
cmb2
,
CB_FINDSTRING
,
-
1
,(
LPARAM
)
lpcf
->
lpszStyle
);
if
(
j
!=
CB_ERR
)
{
j
=
SendDlgItemMessageW
(
hDlg
,
cmb2
,
CB_SETCURSEL
,
j
,
0
);
SendMessageW
(
hDlg
,
WM_COMMAND
,
cmb2
,
MAKELONG
(
LOWORD
(
GetDlgItem
(
hDlg
,
cmb2
)),
CBN_SELCHANGE
));
}
if
(
j
!=
CB_ERR
)
select_combo_item
(
hDlg
,
cmb2
,
j
);
}
CFn_ReleaseDC
(
lpcf
,
hdc
);
SetCursor
(
hcursor
);
...
...
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