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
|
||||
|
||||
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
|
||||
Event := GetEvent(I);
|
||||
|
||||
{ if this is a repeating event and it falls on "Date" then add it to }
|
||||
{ the list. }
|
||||
if (Event.RepeatCode > rtNone)
|
||||
and (RepeatsOn(Event, Date))
|
||||
then
|
||||
{ if this is a repeating event and it falls on "Date" then add it to the list. }
|
||||
if (Event.RepeatCode > rtNone) and RepeatsOn(Event, Date) then
|
||||
EventList.Add(Event)
|
||||
{ otherwise if this event naturally falls on "Date" then add it to }
|
||||
{ the list. }
|
||||
else if ((trunc(Date) >= trunc(Event.StartTime))
|
||||
and (trunc(Date) <= trunc(Event.EndTime))) then
|
||||
else
|
||||
{ otherwise if this event naturally falls on "Date" then add it to the list. }
|
||||
if DateInRange(Date, Event.StartTime, Event.EndTime, true) then
|
||||
EventList.Add(Event);
|
||||
end;
|
||||
end;
|
||||
@ -2323,7 +2319,9 @@ var
|
||||
begin
|
||||
event1 := TVpEvent(P1);
|
||||
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.
|
||||
|
@ -1630,7 +1630,7 @@ begin
|
||||
|
||||
{ Now sort times in ascending order. This must be done because the event
|
||||
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 }
|
||||
level := 0;
|
||||
|
@ -108,7 +108,8 @@ function IncYear(TheDate: TDateTime; NumYears: Integer): TDateTime;
|
||||
function GetJulianDate(Date: TDateTime): Word;
|
||||
function GetWeekOfYear(ADate: TDateTime): byte;
|
||||
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 GetStartLine(StartTime: TDateTime; Granularity: TVpGranularity): Integer;
|
||||
@ -526,20 +527,29 @@ begin
|
||||
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;
|
||||
var
|
||||
equStart, equEnd: Boolean;
|
||||
begin
|
||||
equStart := abs(Time - StartTime) < CompareTimeEps;
|
||||
equEnd := abs(Time - EndTime) < CompareTimeEps;
|
||||
equStart := abs(ATime - StartTime) < CompareTimeEps;
|
||||
equEnd := abs(ATime - EndTime) < CompareTimeEps;
|
||||
|
||||
if Inclusive then
|
||||
Result := equStart or equEnd or ((Time > StartTime) and (Time < EndTime))
|
||||
// result := (Time >= StartTime) and (Time <= EndTime)
|
||||
Result := equStart or equEnd or ((ATime > StartTime) and (ATime < EndTime))
|
||||
else
|
||||
Result := (not equStart) and (not equEnd) and (Time > StartTime) and (Time < EndTime);
|
||||
// result := (Time > StartTime) and (Time < EndTime);
|
||||
Result := (not equStart) and (not equEnd) and (ATime > StartTime) and (ATime < EndTime);
|
||||
end;
|
||||
{=====}
|
||||
|
||||
|
@ -300,7 +300,7 @@ begin
|
||||
|
||||
{ Now sort times in ascending order. This must be done because the event
|
||||
list can contain recurring events which have the wrong date part }
|
||||
// EventList.Sort(CompareEventsByTimeOnly);
|
||||
EventList.Sort(CompareEventsByTimeOnly);
|
||||
|
||||
{ initialize TextRect for this day }
|
||||
TextRect := DayRect;
|
||||
|
Reference in New Issue
Block a user