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
2c6443ae
Commit
2c6443ae
authored
Sep 19, 2011
by
Nikolay Sivov
Committed by
Alexandre Julliard
Sep 19, 2011
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
comctl32/monthcal: Fix MCM_SETCURSEL for multiple calendars case.
parent
b83d9b32
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
27 additions
and
13 deletions
+27
-13
monthcal.c
dlls/comctl32/monthcal.c
+27
-13
No files found.
dlls/comctl32/monthcal.c
View file @
2c6443ae
...
...
@@ -202,6 +202,11 @@ static inline void MONTHCAL_NotifySelect(const MONTHCAL_INFO *infoPtr)
SendMessageW
(
infoPtr
->
hwndNotify
,
WM_NOTIFY
,
nmsc
.
nmhdr
.
idFrom
,
(
LPARAM
)
&
nmsc
);
}
static
inline
int
MONTHCAL_MonthDiff
(
const
SYSTEMTIME
*
left
,
const
SYSTEMTIME
*
right
)
{
return
(
right
->
wYear
-
left
->
wYear
)
*
12
+
right
->
wMonth
-
left
->
wMonth
;
}
/* returns the number of days in any given month, checking for leap days */
/* January is 1, December is 12 */
int
MONTHCAL_MonthLength
(
int
month
,
int
year
)
...
...
@@ -1462,6 +1467,7 @@ static LRESULT
MONTHCAL_SetCurSel
(
MONTHCAL_INFO
*
infoPtr
,
SYSTEMTIME
*
curSel
)
{
SYSTEMTIME
prev
=
infoPtr
->
minSel
;
INT
diff
;
WORD
day
;
TRACE
(
"%p
\n
"
,
curSel
);
...
...
@@ -1474,7 +1480,22 @@ MONTHCAL_SetCurSel(MONTHCAL_INFO *infoPtr, SYSTEMTIME *curSel)
if
(
!
MONTHCAL_IsDateInValidRange
(
infoPtr
,
curSel
,
FALSE
))
return
FALSE
;
infoPtr
->
calendars
[
0
].
month
=
*
curSel
;
/* scroll calendars only if we have to */
diff
=
MONTHCAL_MonthDiff
(
&
infoPtr
->
calendars
[
MONTHCAL_GetCalCount
(
infoPtr
)
-
1
].
month
,
curSel
);
if
(
diff
<=
0
)
{
diff
=
MONTHCAL_MonthDiff
(
&
infoPtr
->
calendars
[
0
].
month
,
curSel
);
if
(
diff
>
0
)
diff
=
0
;
}
if
(
diff
!=
0
)
{
INT
i
;
for
(
i
=
0
;
i
<
MONTHCAL_GetCalCount
(
infoPtr
);
i
++
)
MONTHCAL_GetMonth
(
&
infoPtr
->
calendars
[
i
].
month
,
diff
);
}
infoPtr
->
minSel
=
*
curSel
;
infoPtr
->
maxSel
=
*
curSel
;
...
...
@@ -1542,19 +1563,15 @@ MONTHCAL_GetSelRange(const MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
static
LRESULT
MONTHCAL_SetSelRange
(
MONTHCAL_INFO
*
infoPtr
,
SYSTEMTIME
*
range
)
{
TRACE
(
"%p
\n
"
,
range
)
;
SYSTEMTIME
old_range
[
2
]
;
if
(
!
range
)
return
FALSE
;
TRACE
(
"%p
\n
"
,
range
)
;
if
(
infoPtr
->
dwStyle
&
MCS_MULTISELECT
)
{
SYSTEMTIME
old_range
[
2
];
if
(
!
range
||
!
(
infoPtr
->
dwStyle
&
MCS_MULTISELECT
))
return
FALSE
;
/* adjust timestamps */
if
(
!
MONTHCAL_ValidateTime
(
&
range
[
0
]))
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
range
[
0
]);
if
(
!
MONTHCAL_ValidateTime
(
&
range
[
1
]))
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
range
[
1
]);
if
(
!
MONTHCAL_ValidateTime
(
&
range
[
0
]))
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
range
[
0
]);
if
(
!
MONTHCAL_ValidateTime
(
&
range
[
1
]))
MONTHCAL_CopyTime
(
&
infoPtr
->
todaysDate
,
&
range
[
1
]);
/* maximum range exceeded */
if
(
!
MONTHCAL_IsSelRangeValid
(
infoPtr
,
&
range
[
0
],
&
range
[
1
],
NULL
))
return
FALSE
;
...
...
@@ -1589,9 +1606,6 @@ MONTHCAL_SetSelRange(MONTHCAL_INFO *infoPtr, SYSTEMTIME *range)
TRACE
(
"[min,max]=[%d %d]
\n
"
,
infoPtr
->
minSel
.
wDay
,
infoPtr
->
maxSel
.
wDay
);
return
TRUE
;
}
return
FALSE
;
}
...
...
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