diff --git a/components/tvplanit/examples/fulldemo/demo.lpr b/components/tvplanit/examples/fulldemo/demo.lpr index 5de61a7ad..9b3b4303b 100644 --- a/components/tvplanit/examples/fulldemo/demo.lpr +++ b/components/tvplanit/examples/fulldemo/demo.lpr @@ -7,8 +7,8 @@ uses cthreads, {$ENDIF}{$ENDIF} Interfaces, // this includes the LCL widgetset - Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator, - bufdsdatamodule, printer4lazarus; + Forms, demoMain, LCLTranslator, DefaultTranslator, + bufdsdatamodule; {$R *.res} diff --git a/components/tvplanit/examples/printing/ganttview/gvmain.lfm b/components/tvplanit/examples/printing/ganttview/gvmain.lfm index 4965296b7..6fa8063e6 100644 --- a/components/tvplanit/examples/printing/ganttview/gvmain.lfm +++ b/components/tvplanit/examples/printing/ganttview/gvmain.lfm @@ -72,6 +72,10 @@ object Form1: TForm1 DataStore = VpIniDatastore1 ControlLink = VpControlLink1 Align = alClient + ColHeaderAttributes.DayFont.Height = -12 + ColHeaderAttributes.MonthFont.Height = -12 + ColHeaderAttributes.WeekFont.Height = -12 + RowHeaderAttributes.EventFont.Height = -12 TimeFormat = tf24Hour end object VpControlLink1: TVpControlLink diff --git a/components/tvplanit/source/vpdata.pas b/components/tvplanit/source/vpdata.pas index e75e7b0d2..4e7e26804 100644 --- a/components/tvplanit/source/vpdata.pas +++ b/components/tvplanit/source/vpdata.pas @@ -1317,7 +1317,7 @@ end; function TVpEvent.CopyToSchedule(ASchedule: TVpSchedule): TVpEvent; begin - Result := ASchedule.AddEvent(FResourceID, FStartTime, FEndTime); + Result := ASchedule.AddEvent(FResourceID, FStartTime, FEndTime); // wp: why FResourceID here, AddEvent wants FRecordID !!! // ResourceID will be assigned outside Result.RecordID := FRecordID; Result.DingPath := FDingPath; diff --git a/components/tvplanit/source/vpedfmtlst.lfm b/components/tvplanit/source/vpedfmtlst.lfm index 0f2ccadc7..83b2b76b5 100644 --- a/components/tvplanit/source/vpedfmtlst.lfm +++ b/components/tvplanit/source/vpedfmtlst.lfm @@ -10,6 +10,7 @@ object frmPrnFormat: TfrmPrnFormat OnCreate = FormCreate OnShow = FormShow Position = poScreenCenter + LCLVersion = '2.3.0.0' object LblFormats: TLabel AnchorSideLeft.Control = Owner AnchorSideTop.Control = Owner diff --git a/components/tvplanit/source/vpedfmtlst.pas b/components/tvplanit/source/vpedfmtlst.pas index 5e97b560a..e12796011 100644 --- a/components/tvplanit/source/vpedfmtlst.pas +++ b/components/tvplanit/source/vpedfmtlst.pas @@ -616,8 +616,6 @@ var E: TVpPrintFormatElementItem; Prn: TVpPrinter; i, Idx: Integer; - - t: TDateTime; begin if LbFormats.ItemIndex = -1 then exit; diff --git a/components/tvplanit/source/vpganttview.pas b/components/tvplanit/source/vpganttview.pas index 23195afa2..d9e661bca 100644 --- a/components/tvplanit/source/vpganttview.pas +++ b/components/tvplanit/source/vpganttview.pas @@ -1116,7 +1116,7 @@ end; function TVpGanttView.GetNumDays: Integer; begin Result := 0; - if (FRealStartDate <> NO_DATE) then + if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then begin Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1; if Result < 0 then @@ -1140,7 +1140,7 @@ var y1, m1, d1: Word; y2, m2, d2: Word; begin - if (FRealStartDate <> NO_DATE) then + if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then begin DecodeDate(FRealStartDate, y1, m1, d1); DecodeDate(FRealEndDate, y2, m2, d2); @@ -1161,7 +1161,7 @@ var dt1, dt2: TDate; wn1, wn2: Integer; begin - if (FRealStartDate <> NO_DATE) then + if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then begin d1 := GetVpDayType(FRealStartDate); d2 := GetVpDayType(FRealEndDate); @@ -1207,8 +1207,15 @@ end; means the very first/last event. } procedure TVpGanttView.GetRealEventDateRange(out AStartDate, AEndDate: TDate); begin - if FStartDate > 0 then AStartDate := DatePart(FStartDate) else AStartDate := FFirstDate; - if FEndDate > 0 then AEndDate := DatePart(FEndDate) else AEndDate := FLastDate; + if ValidDate(FStartDate) then + AStartDate := DatePart(FStartDate) + else + AStartDate := FFirstDate; + + if ValidDate(FEndDate) then + AEndDate := DatePart(FEndDate) + else + AEndDate := FLastDate; end; function TVpGanttView.GetRowAtCoord(Y: Integer): Integer; @@ -1871,8 +1878,6 @@ begin end; procedure TVpGanttView.SetActiveEvent(AValue: TVpEvent); -var - i:Integer; begin if FActiveEvent <> AValue then begin diff --git a/components/tvplanit/source/vpmisc.pas b/components/tvplanit/source/vpmisc.pas index fcb1adcd3..0405bcbc0 100644 --- a/components/tvplanit/source/vpmisc.pas +++ b/components/tvplanit/source/vpmisc.pas @@ -159,6 +159,7 @@ function SameTimeOrEarlier(t1, t2: TTime): Boolean; function SameTimeOrLater(t1, t2: TTime): Boolean; function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean; function TimeInRange(ATime, StartTime, EndTime: TDateTime; IncludeLimits: Boolean): Boolean; +function ValidDate(ADate: TDateTime): Boolean; function DateDialog(ACaption: String; var ADate: TDate): Boolean; @@ -918,6 +919,11 @@ begin Result := (DayOfWeek(ADate) in [1, 7]); end; +function ValidDate(ADate: TDateTime): Boolean; +begin + Result := (ADate > 0) and (ADate <> NO_DATE); +end; + // Displays a date dialog function DateDialog(ACaption: String; var ADate: TDate): Boolean; var