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
035d0a15
Commit
035d0a15
authored
Jun 17, 2015
by
Nikolay Sivov
Committed by
Alexandre Julliard
Jun 18, 2015
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/monthcal: Fix title to use properly localized year/month format.
parent
060cffc1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
63 additions
and
13 deletions
+63
-13
monthcal.c
dlls/comctl32/monthcal.c
+63
-13
No files found.
dlls/comctl32/monthcal.c
View file @
035d0a15
...
...
@@ -866,10 +866,16 @@ static void MONTHCAL_PaintButton(MONTHCAL_INFO *infoPtr, HDC hdc, enum nav_direc
/* paint a title with buttons and month/year string */
static
void
MONTHCAL_PaintTitle
(
MONTHCAL_INFO
*
infoPtr
,
HDC
hdc
,
const
PAINTSTRUCT
*
ps
,
INT
calIdx
)
{
static
const
WCHAR
fmt_monthW
[]
=
{
'%'
,
's'
,
' '
,
'%'
,
'l'
,
'd'
,
0
};
static
const
WCHAR
mmmmW
[]
=
{
'M'
,
'M'
,
'M'
,
'M'
,
0
};
static
const
WCHAR
mmmW
[]
=
{
'M'
,
'M'
,
'M'
,
0
};
static
const
WCHAR
mmW
[]
=
{
'M'
,
'M'
,
0
};
static
const
WCHAR
fmtyearW
[]
=
{
'%'
,
'l'
,
'd'
,
0
};
static
const
WCHAR
fmtmmW
[]
=
{
'%'
,
'0'
,
'2'
,
'd'
,
0
};
static
const
WCHAR
fmtmW
[]
=
{
'%'
,
'd'
,
0
};
RECT
*
title
=
&
infoPtr
->
calendars
[
calIdx
].
title
;
const
SYSTEMTIME
*
st
=
&
infoPtr
->
calendars
[
calIdx
].
month
;
WCHAR
buf_month
[
80
],
buf_fmt
[
80
];
WCHAR
monthW
[
80
],
strW
[
80
],
fmtW
[
80
],
yearW
[
6
]
/* valid year range is 1601-30827 */
;
int
yearoffset
,
monthoffset
,
shiftX
;
SIZE
sz
;
/* fill header box */
...
...
@@ -880,21 +886,65 @@ static void MONTHCAL_PaintTitle(MONTHCAL_INFO *infoPtr, HDC hdc, const PAINTSTRU
SetTextColor
(
hdc
,
infoPtr
->
colors
[
MCSC_TITLETEXT
]);
SelectObject
(
hdc
,
infoPtr
->
hBoldFont
);
GetLocaleInfoW
(
LOCALE_USER_DEFAULT
,
LOCALE_SMONTHNAME1
+
st
->
wMonth
-
1
,
buf_month
,
countof
(
buf_month
));
/* draw formatted date string */
GetDateFormatW
(
LOCALE_USER_DEFAULT
,
DATE_YEARMONTH
,
st
,
NULL
,
strW
,
countof
(
strW
));
DrawTextW
(
hdc
,
strW
,
strlenW
(
strW
),
title
,
DT_CENTER
|
DT_VCENTER
|
DT_SINGLELINE
);
GetLocaleInfoW
(
LOCALE_USER_DEFAULT
,
LOCALE_SYEARMONTH
,
fmtW
,
countof
(
fmtW
));
wsprintfW
(
yearW
,
fmtyearW
,
st
->
wYear
);
/* month is trickier as it's possible to have different format pictures, we'll
test for M, MM, MMM, and MMMM */
if
(
strstrW
(
fmtW
,
mmmmW
))
GetLocaleInfoW
(
LOCALE_USER_DEFAULT
,
LOCALE_SMONTHNAME1
+
st
->
wMonth
-
1
,
monthW
,
countof
(
monthW
));
else
if
(
strstrW
(
fmtW
,
mmmW
))
GetLocaleInfoW
(
LOCALE_USER_DEFAULT
,
LOCALE_SABBREVMONTHNAME1
+
st
->
wMonth
-
1
,
monthW
,
countof
(
monthW
));
else
if
(
strstrW
(
fmtW
,
mmW
))
wsprintfW
(
monthW
,
fmtmmW
,
st
->
wMonth
);
else
wsprintfW
(
monthW
,
fmtmW
,
st
->
wMonth
);
wsprintfW
(
buf_fmt
,
fmt_monthW
,
buf_month
,
st
->
wYear
);
DrawTextW
(
hdc
,
buf_fmt
,
strlenW
(
buf_fmt
),
title
,
DT_CENTER
|
DT_VCENTER
|
DT_SINGLELINE
);
/* update hit boxes */
yearoffset
=
0
;
while
(
strW
[
yearoffset
])
{
if
(
!
strncmpW
(
&
strW
[
yearoffset
],
yearW
,
strlenW
(
yearW
)))
break
;
yearoffset
++
;
}
/* update title rectangles with current month - used while testing hits */
GetTextExtentPoint32W
(
hdc
,
buf_fmt
,
strlenW
(
buf_fmt
),
&
sz
);
infoPtr
->
calendars
[
calIdx
].
titlemonth
.
left
=
title
->
right
/
2
+
title
->
left
/
2
-
sz
.
cx
/
2
;
infoPtr
->
calendars
[
calIdx
].
titleyear
.
right
=
title
->
right
/
2
+
title
->
left
/
2
+
sz
.
cx
/
2
;
monthoffset
=
0
;
while
(
strW
[
monthoffset
])
{
if
(
!
strncmpW
(
&
strW
[
monthoffset
],
monthW
,
strlenW
(
monthW
)))
break
;
monthoffset
++
;
}
/* for left limits use offsets */
sz
.
cx
=
0
;
if
(
yearoffset
)
GetTextExtentPoint32W
(
hdc
,
strW
,
yearoffset
,
&
sz
);
infoPtr
->
calendars
[
calIdx
].
titleyear
.
left
=
sz
.
cx
;
sz
.
cx
=
0
;
if
(
monthoffset
)
GetTextExtentPoint32W
(
hdc
,
strW
,
monthoffset
,
&
sz
);
infoPtr
->
calendars
[
calIdx
].
titlemonth
.
left
=
sz
.
cx
;
GetTextExtentPoint32W
(
hdc
,
buf_month
,
strlenW
(
buf_month
),
&
sz
);
/* for right limits use actual string parts lengths */
GetTextExtentPoint32W
(
hdc
,
&
strW
[
yearoffset
],
strlenW
(
yearW
),
&
sz
);
infoPtr
->
calendars
[
calIdx
].
titleyear
.
right
=
infoPtr
->
calendars
[
calIdx
].
titleyear
.
left
+
sz
.
cx
;
GetTextExtentPoint32W
(
hdc
,
monthW
,
strlenW
(
monthW
),
&
sz
);
infoPtr
->
calendars
[
calIdx
].
titlemonth
.
right
=
infoPtr
->
calendars
[
calIdx
].
titlemonth
.
left
+
sz
.
cx
;
infoPtr
->
calendars
[
calIdx
].
titleyear
.
left
=
infoPtr
->
calendars
[
calIdx
].
titlemonth
.
right
;
/* Finally translate rectangles to match center aligned string,
hit rectangles are relative to title rectangle before translation. */
GetTextExtentPoint32W
(
hdc
,
strW
,
strlenW
(
strW
),
&
sz
);
shiftX
=
(
title
->
right
-
title
->
left
-
sz
.
cx
)
/
2
+
title
->
left
;
OffsetRect
(
&
infoPtr
->
calendars
[
calIdx
].
titleyear
,
shiftX
,
0
);
OffsetRect
(
&
infoPtr
->
calendars
[
calIdx
].
titlemonth
,
shiftX
,
0
);
}
static
void
MONTHCAL_PaintWeeknumbers
(
const
MONTHCAL_INFO
*
infoPtr
,
HDC
hdc
,
const
PAINTSTRUCT
*
ps
,
INT
calIdx
)
...
...
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