You've already forked lazarus-ccr
tvplanit: Fix crash in print format component editor when the print format contains a GanttView.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8562 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -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}
|
||||
|
||||
|
@ -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
|
||||
|
@ -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;
|
||||
|
@ -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
|
||||
|
@ -616,8 +616,6 @@ var
|
||||
E: TVpPrintFormatElementItem;
|
||||
Prn: TVpPrinter;
|
||||
i, Idx: Integer;
|
||||
|
||||
t: TDateTime;
|
||||
begin
|
||||
if LbFormats.ItemIndex = -1 then
|
||||
exit;
|
||||
|
@ -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
|
||||
|
@ -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
|
||||
|
Reference in New Issue
Block a user