CalLite: Fix crash when moving from a month with 31 days to a month with less days by means of the months dropdown. Set version 0.3.8 for next OPM release.

git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8089 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
wp_xxyyzz
2021-09-14 14:29:10 +00:00
parent 4d9a1ca289
commit b0c6c6891c
3 changed files with 17 additions and 18 deletions

View File

@ -1,6 +1,6 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<Package Version="4"> <Package Version="5">
<Name Value="callight_pkg"/> <Name Value="callight_pkg"/>
<Type Value="RunAndDesignTime"/> <Type Value="RunAndDesignTime"/>
<Author Value="Howard Page-Clark, Ariel Rodriguez and Werner Pamler"/> <Author Value="Howard Page-Clark, Ariel Rodriguez and Werner Pamler"/>
@ -11,9 +11,9 @@
<UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/> <UnitOutputDirectory Value="lib/$(TargetCPU)-$(TargetOS)"/>
</SearchPaths> </SearchPaths>
</CompilerOptions> </CompilerOptions>
<Description Value="A lightweight calendar component"/> <Description Value="A light-weight calendar component"/>
<License Value="Modified LGL2 (with linking exception)"/> <License Value="Modified LGL2 (with linking exception, like Lazarus LCL)"/>
<Version Minor="3" Release="6"/> <Version Minor="3" Release="8"/>
<Files Count="1"> <Files Count="1">
<Item1> <Item1>
<Filename Value="source/calendarlite.pas"/> <Filename Value="source/calendarlite.pas"/>
@ -21,6 +21,7 @@
<UnitName Value="CalendarLite"/> <UnitName Value="CalendarLite"/>
</Item1> </Item1>
</Files> </Files>
<CompatibilityMode Value="True"/>
<i18n> <i18n>
<OutDir Value="languages"/> <OutDir Value="languages"/>
<EnableI18NForLFM Value="True"/> <EnableI18NForLFM Value="True"/>

View File

@ -1,11 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<CONFIG> <CONFIG>
<ProjectOptions> <ProjectOptions>
<Version Value="11"/> <Version Value="12"/>
<PathDelim Value="\"/> <PathDelim Value="\"/>
<General> <General>
<Flags>
<CompatibilityMode Value="True"/>
</Flags>
<SessionStorage Value="InProjectDir"/> <SessionStorage Value="InProjectDir"/>
<MainUnit Value="0"/>
<Title Value="CalLiteTest"/> <Title Value="CalLiteTest"/>
<ResourceType Value="res"/> <ResourceType Value="res"/>
<UseXPManifest Value="True"/> <UseXPManifest Value="True"/>

View File

@ -1326,12 +1326,11 @@ begin
end; end;
procedure TCalDrawer.GotoMonth(AMonth: word); procedure TCalDrawer.GotoMonth(AMonth: word);
var
d: TDate;
begin begin
if not TryEncodeDate(FThisYear, AMonth, FThisDay, d) then // Feb 29 in leap year! if (AMonth < 1) or (AMonth > 12) then
d := EncodeDate(FThisYear, AMonth, FThisDay); exit;
FOwner.Date := d; FThisDay := EnsureRange(FThisDay, 1, DaysInAMonth(FThisYear, AMonth));
FOwner.Date := EncodeDate(FThisYear, AMonth, FThisDay);
end; end;
procedure TCalDrawer.GotoToday; procedure TCalDrawer.GotoToday;
@ -1340,12 +1339,11 @@ begin
end; end;
procedure TCalDrawer.GotoYear(AYear: word); procedure TCalDrawer.GotoYear(AYear: word);
var
d: TDate;
begin begin
if not TryEncodeDate(AYear, FThisMonth, FThisDay, d) then // Feb 29 in leap year! if (FThisMonth < 1) or (FThisMonth > 12) then
d := EncodeDate(AYear, FThisMonth, FThisDay); exit;
FOwner.Date := d; FThisDay := EnsureRange(FThisday, 1, DaysInAMonth(AYear, FThisMonth));
FOwner.Date := EncodeDate(AYear, FThisMonth, FThisDay);
end; end;
procedure TCalDrawer.LeftClick(APoint: TPoint; Shift: TShiftState); procedure TCalDrawer.LeftClick(APoint: TPoint; Shift: TShiftState);
@ -1922,8 +1920,6 @@ begin
item.Tag := y; item.Tag := y;
if y = FCalDrawer.FThisYear then if y = FCalDrawer.FThisYear then
item.Checked := true; item.Checked := true;
if (FCalDrawer.FThisDay = 29) and (FCalDrawer.FThisMonth = 2) and not IsLeapYear(y)
then item.Enabled:= False;
Add(item); Add(item);
end; end;
end; end;