You've already forked lazarus-ccr
tvplanit: Fix hang of prev commit. Minor refactoring.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4875 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -1318,20 +1318,16 @@ begin
|
|||||||
EventList.Clear
|
EventList.Clear
|
||||||
|
|
||||||
else begin
|
else begin
|
||||||
{ Add this days events to the Event List. }
|
{ Add this day's events to the Event List. }
|
||||||
for I := 0 to pred(EventCount) do begin
|
for I := 0 to pred(EventCount) do begin
|
||||||
Event := GetEvent(I);
|
Event := GetEvent(I);
|
||||||
|
|
||||||
{ if this is a repeating event and it falls on "Date" then add it to }
|
{ if this is a repeating event and it falls on "Date" then add it to the list. }
|
||||||
{ the list. }
|
if (Event.RepeatCode > rtNone) and RepeatsOn(Event, Date) then
|
||||||
if (Event.RepeatCode > rtNone)
|
|
||||||
and (RepeatsOn(Event, Date))
|
|
||||||
then
|
|
||||||
EventList.Add(Event)
|
EventList.Add(Event)
|
||||||
{ otherwise if this event naturally falls on "Date" then add it to }
|
else
|
||||||
{ the list. }
|
{ otherwise if this event naturally falls on "Date" then add it to the list. }
|
||||||
else if ((trunc(Date) >= trunc(Event.StartTime))
|
if DateInRange(Date, Event.StartTime, Event.EndTime, true) then
|
||||||
and (trunc(Date) <= trunc(Event.EndTime))) then
|
|
||||||
EventList.Add(Event);
|
EventList.Add(Event);
|
||||||
end;
|
end;
|
||||||
end;
|
end;
|
||||||
@ -2323,7 +2319,9 @@ var
|
|||||||
begin
|
begin
|
||||||
event1 := TVpEvent(P1);
|
event1 := TVpEvent(P1);
|
||||||
event2 := TVpEvent(P2);
|
event2 := TVpEvent(P2);
|
||||||
Result := CompareValue(frac(event1.StartTime), frac(event2.EndTime));
|
Result := CompareValue(frac(event1.StartTime), frac(event2.StartTime));
|
||||||
|
if Result = 0 then
|
||||||
|
Result := CompareValue(frac(event1.EndTime), frac(event2.EndTime));
|
||||||
end;
|
end;
|
||||||
|
|
||||||
end.
|
end.
|
||||||
|
@ -1630,7 +1630,7 @@ begin
|
|||||||
|
|
||||||
{ Now sort times in ascending order. This must be done because the event
|
{ Now sort times in ascending order. This must be done because the event
|
||||||
list can contain recurring events which have the wrong date part }
|
list can contain recurring events which have the wrong date part }
|
||||||
// EventList.Sort(CompareEventsByTimeOnly);
|
EventList.Sort(@CompareEventsByTimeOnly);
|
||||||
|
|
||||||
{ Arrange this day's events in the event matrix }
|
{ Arrange this day's events in the event matrix }
|
||||||
level := 0;
|
level := 0;
|
||||||
|
@ -108,7 +108,8 @@ function IncYear(TheDate: TDateTime; NumYears: Integer): TDateTime;
|
|||||||
function GetJulianDate(Date: TDateTime): Word;
|
function GetJulianDate(Date: TDateTime): Word;
|
||||||
function GetWeekOfYear(ADate: TDateTime): byte;
|
function GetWeekOfYear(ADate: TDateTime): byte;
|
||||||
function SameDate(dt1, dt2: TDateTime): Boolean;
|
function SameDate(dt1, dt2: TDateTime): Boolean;
|
||||||
function TimeInRange(Time, StartTime, EndTime: TDateTime; Inclusive: Boolean): Boolean;
|
function DateInRange(ADate, StartDate, EndDate: TDateTime; Inclusive: Boolean): Boolean;
|
||||||
|
function TimeInRange(ATime, StartTime, EndTime: TDateTime; Inclusive: Boolean): Boolean;
|
||||||
|
|
||||||
function HourToLine(const Value: TVpHours; const Granularity: TVpGranularity): Integer;
|
function HourToLine(const Value: TVpHours; const Granularity: TVpGranularity): Integer;
|
||||||
function GetStartLine(StartTime: TDateTime; Granularity: TVpGranularity): Integer;
|
function GetStartLine(StartTime: TDateTime; Granularity: TVpGranularity): Integer;
|
||||||
@ -526,20 +527,29 @@ begin
|
|||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
function TimeInRange(Time, StartTime, EndTime: TDateTime;
|
function DateInRange(ADate, StartDate, EndDate: TDateTime;
|
||||||
|
Inclusive: Boolean): Boolean;
|
||||||
|
begin
|
||||||
|
ADate := trunc(ADate);
|
||||||
|
StartDate := trunc(StartDate);
|
||||||
|
EndDate := trunc(EndDate);
|
||||||
|
Result := (StartDate < ADate) and (ADate < EndDate);
|
||||||
|
if Inclusive and (not Result) then
|
||||||
|
Result := (StartDate = ADate) or (EndDate = ADate);
|
||||||
|
end;
|
||||||
|
|
||||||
|
function TimeInRange(ATime, StartTime, EndTime: TDateTime;
|
||||||
Inclusive: Boolean): Boolean;
|
Inclusive: Boolean): Boolean;
|
||||||
var
|
var
|
||||||
equStart, equEnd: Boolean;
|
equStart, equEnd: Boolean;
|
||||||
begin
|
begin
|
||||||
equStart := abs(Time - StartTime) < CompareTimeEps;
|
equStart := abs(ATime - StartTime) < CompareTimeEps;
|
||||||
equEnd := abs(Time - EndTime) < CompareTimeEps;
|
equEnd := abs(ATime - EndTime) < CompareTimeEps;
|
||||||
|
|
||||||
if Inclusive then
|
if Inclusive then
|
||||||
Result := equStart or equEnd or ((Time > StartTime) and (Time < EndTime))
|
Result := equStart or equEnd or ((ATime > StartTime) and (ATime < EndTime))
|
||||||
// result := (Time >= StartTime) and (Time <= EndTime)
|
|
||||||
else
|
else
|
||||||
Result := (not equStart) and (not equEnd) and (Time > StartTime) and (Time < EndTime);
|
Result := (not equStart) and (not equEnd) and (ATime > StartTime) and (ATime < EndTime);
|
||||||
// result := (Time > StartTime) and (Time < EndTime);
|
|
||||||
end;
|
end;
|
||||||
{=====}
|
{=====}
|
||||||
|
|
||||||
|
@ -300,7 +300,7 @@ begin
|
|||||||
|
|
||||||
{ Now sort times in ascending order. This must be done because the event
|
{ Now sort times in ascending order. This must be done because the event
|
||||||
list can contain recurring events which have the wrong date part }
|
list can contain recurring events which have the wrong date part }
|
||||||
// EventList.Sort(CompareEventsByTimeOnly);
|
EventList.Sort(CompareEventsByTimeOnly);
|
||||||
|
|
||||||
{ initialize TextRect for this day }
|
{ initialize TextRect for this day }
|
||||||
TextRect := DayRect;
|
TextRect := DayRect;
|
||||||
|
Reference in New Issue
Block a user