You've already forked lazarus-ccr
TvPlanIt: Fix ical import (issue #39047)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8643 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -294,63 +294,64 @@ begin
|
||||
DrawDayHeader(ADayIndex, holiday, TextRect);
|
||||
|
||||
if (FWeekView.DataStore <> nil) and (FWeekView.DataStore.Resource <> nil) and
|
||||
(FWeekView.DataStore.Resource.Schedule.EventCountByDay(StartDate + ADayIndex) > 0) and
|
||||
// (FWeekView.DataStore.Resource.Schedule.EventCountByDay(StartDate + ADayIndex) > 0) and
|
||||
(HeightOf(DayRect) >= FWeekView.TextMargin * 2 + FDayHeadHeight)
|
||||
then begin
|
||||
// Events exist for this day
|
||||
// EventList is supposesd to collect the events for the day handled in this procedure
|
||||
EventList := TList.Create;
|
||||
try
|
||||
// Populate the event list with events for this day
|
||||
FWeekView.DataStore.Resource.Schedule.EventsByDate(StartDate + ADayIndex, EventList);
|
||||
|
||||
{ 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);
|
||||
|
||||
// Initialize TextRect for this day
|
||||
TextRect := DayRect;
|
||||
TextRect.Top := DayRect.Top + FDayHeadHeight + 1;
|
||||
TextRect.Bottom := TextRect.Top + rowHeight;
|
||||
|
||||
// Handle all-day events
|
||||
tmpRect := TextRect;
|
||||
tmpRect.Bottom := DayRect.Bottom;
|
||||
if DrawAllDayEvents(StartDate + ADayIndex, tmpRect, EAIndex) then
|
||||
if EventList.Count > 0 then
|
||||
begin
|
||||
TextRect.Bottom := TextRect.Bottom + ADEventsRect.Bottom - TextRect.Top;
|
||||
TextRect.Top := ADEventsRect.Bottom;
|
||||
end;
|
||||
{ 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);
|
||||
|
||||
// Discard AllDayEvents, because they are drawn above.
|
||||
for J := pred(EventList.Count) downto 0 do
|
||||
if TVpEvent(EventList[J]).AllDayEvent then
|
||||
EventList.Delete(J);
|
||||
|
||||
// Iterate the events, painting them one by one
|
||||
for J := 0 to pred(EventList.Count) do begin
|
||||
{ if the TextRect extends below the available space then draw a }
|
||||
{ dot dot dot to indicate there are more events than can be drawn }
|
||||
{ in the available space }
|
||||
if TextRect.Bottom - FWeekView.TextMargin > DayRect.Bottom then begin
|
||||
{ Draw ". . ." }
|
||||
DrawDotDotDot(DayRect, DotDotDotColor);
|
||||
break;
|
||||
end;
|
||||
|
||||
// Write the event text
|
||||
DrawEvent(TVpEvent(EventList.List^[J]), TextRect, ADayIndex);
|
||||
|
||||
// Update the EventArray
|
||||
with TVpWeekViewOpener(FWeekView).wvEventArray[EAIndex] do begin
|
||||
Rec := TextRect;
|
||||
Event := TVpEvent(EventList[J]);
|
||||
end;
|
||||
Inc(EAIndex);
|
||||
|
||||
TextRect.Top := TextRect.Bottom;
|
||||
// Initialize TextRect for this day
|
||||
TextRect := DayRect;
|
||||
TextRect.Top := DayRect.Top + FDayHeadHeight + 1;
|
||||
TextRect.Bottom := TextRect.Top + rowHeight;
|
||||
end; { for loop }
|
||||
|
||||
// Handle all-day events
|
||||
tmpRect := TextRect;
|
||||
tmpRect.Bottom := DayRect.Bottom;
|
||||
if DrawAllDayEvents(StartDate + ADayIndex, tmpRect, EAIndex) then
|
||||
begin
|
||||
TextRect.Bottom := TextRect.Bottom + ADEventsRect.Bottom - TextRect.Top;
|
||||
TextRect.Top := ADEventsRect.Bottom;
|
||||
end;
|
||||
|
||||
// Discard AllDayEvents, because they are drawn above.
|
||||
for J := pred(EventList.Count) downto 0 do
|
||||
if TVpEvent(EventList[J]).AllDayEvent then
|
||||
EventList.Delete(J);
|
||||
|
||||
// Iterate the events, painting them one by one
|
||||
for J := 0 to pred(EventList.Count) do begin
|
||||
{ if the TextRect extends below the available space then draw a }
|
||||
{ dot dot dot to indicate there are more events than can be drawn }
|
||||
{ in the available space }
|
||||
if TextRect.Bottom - FWeekView.TextMargin > DayRect.Bottom then begin
|
||||
{ Draw ". . ." }
|
||||
DrawDotDotDot(DayRect, DotDotDotColor);
|
||||
break;
|
||||
end;
|
||||
|
||||
// Write the event text
|
||||
DrawEvent(TVpEvent(EventList.List^[J]), TextRect, ADayIndex);
|
||||
|
||||
// Update the EventArray
|
||||
with TVpWeekViewOpener(FWeekView).wvEventArray[EAIndex] do begin
|
||||
Rec := TextRect;
|
||||
Event := TVpEvent(EventList[J]);
|
||||
end;
|
||||
Inc(EAIndex);
|
||||
|
||||
TextRect.Top := TextRect.Bottom;
|
||||
TextRect.Bottom := TextRect.Top + rowHeight;
|
||||
end; { for loop }
|
||||
end;
|
||||
finally
|
||||
EventList.Free;
|
||||
end;
|
||||
|
Reference in New Issue
Block a user