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,
|
cthreads,
|
||||||
{$ENDIF}{$ENDIF}
|
{$ENDIF}{$ENDIF}
|
||||||
Interfaces, // this includes the LCL widgetset
|
Interfaces, // this includes the LCL widgetset
|
||||||
Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator,
|
Forms, demoMain, LCLTranslator, DefaultTranslator,
|
||||||
bufdsdatamodule, printer4lazarus;
|
bufdsdatamodule;
|
||||||
|
|
||||||
{$R *.res}
|
{$R *.res}
|
||||||
|
|
||||||
|
@ -72,6 +72,10 @@ object Form1: TForm1
|
|||||||
DataStore = VpIniDatastore1
|
DataStore = VpIniDatastore1
|
||||||
ControlLink = VpControlLink1
|
ControlLink = VpControlLink1
|
||||||
Align = alClient
|
Align = alClient
|
||||||
|
ColHeaderAttributes.DayFont.Height = -12
|
||||||
|
ColHeaderAttributes.MonthFont.Height = -12
|
||||||
|
ColHeaderAttributes.WeekFont.Height = -12
|
||||||
|
RowHeaderAttributes.EventFont.Height = -12
|
||||||
TimeFormat = tf24Hour
|
TimeFormat = tf24Hour
|
||||||
end
|
end
|
||||||
object VpControlLink1: TVpControlLink
|
object VpControlLink1: TVpControlLink
|
||||||
|
@ -1317,7 +1317,7 @@ end;
|
|||||||
|
|
||||||
function TVpEvent.CopyToSchedule(ASchedule: TVpSchedule): TVpEvent;
|
function TVpEvent.CopyToSchedule(ASchedule: TVpSchedule): TVpEvent;
|
||||||
begin
|
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
|
// ResourceID will be assigned outside
|
||||||
Result.RecordID := FRecordID;
|
Result.RecordID := FRecordID;
|
||||||
Result.DingPath := FDingPath;
|
Result.DingPath := FDingPath;
|
||||||
|
@ -10,6 +10,7 @@ object frmPrnFormat: TfrmPrnFormat
|
|||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnShow = FormShow
|
OnShow = FormShow
|
||||||
Position = poScreenCenter
|
Position = poScreenCenter
|
||||||
|
LCLVersion = '2.3.0.0'
|
||||||
object LblFormats: TLabel
|
object LblFormats: TLabel
|
||||||
AnchorSideLeft.Control = Owner
|
AnchorSideLeft.Control = Owner
|
||||||
AnchorSideTop.Control = Owner
|
AnchorSideTop.Control = Owner
|
||||||
|
@ -616,8 +616,6 @@ var
|
|||||||
E: TVpPrintFormatElementItem;
|
E: TVpPrintFormatElementItem;
|
||||||
Prn: TVpPrinter;
|
Prn: TVpPrinter;
|
||||||
i, Idx: Integer;
|
i, Idx: Integer;
|
||||||
|
|
||||||
t: TDateTime;
|
|
||||||
begin
|
begin
|
||||||
if LbFormats.ItemIndex = -1 then
|
if LbFormats.ItemIndex = -1 then
|
||||||
exit;
|
exit;
|
||||||
|
@ -1116,7 +1116,7 @@ end;
|
|||||||
function TVpGanttView.GetNumDays: Integer;
|
function TVpGanttView.GetNumDays: Integer;
|
||||||
begin
|
begin
|
||||||
Result := 0;
|
Result := 0;
|
||||||
if (FRealStartDate <> NO_DATE) then
|
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
|
||||||
begin
|
begin
|
||||||
Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1;
|
Result := trunc(FRealEndDate) - trunc(FRealStartDate) + 1;
|
||||||
if Result < 0 then
|
if Result < 0 then
|
||||||
@ -1140,7 +1140,7 @@ var
|
|||||||
y1, m1, d1: Word;
|
y1, m1, d1: Word;
|
||||||
y2, m2, d2: Word;
|
y2, m2, d2: Word;
|
||||||
begin
|
begin
|
||||||
if (FRealStartDate <> NO_DATE) then
|
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
|
||||||
begin
|
begin
|
||||||
DecodeDate(FRealStartDate, y1, m1, d1);
|
DecodeDate(FRealStartDate, y1, m1, d1);
|
||||||
DecodeDate(FRealEndDate, y2, m2, d2);
|
DecodeDate(FRealEndDate, y2, m2, d2);
|
||||||
@ -1161,7 +1161,7 @@ var
|
|||||||
dt1, dt2: TDate;
|
dt1, dt2: TDate;
|
||||||
wn1, wn2: Integer;
|
wn1, wn2: Integer;
|
||||||
begin
|
begin
|
||||||
if (FRealStartDate <> NO_DATE) then
|
if ValidDate(FRealStartDate) and ValidDate(FRealEndDate) then
|
||||||
begin
|
begin
|
||||||
d1 := GetVpDayType(FRealStartDate);
|
d1 := GetVpDayType(FRealStartDate);
|
||||||
d2 := GetVpDayType(FRealEndDate);
|
d2 := GetVpDayType(FRealEndDate);
|
||||||
@ -1207,8 +1207,15 @@ end;
|
|||||||
means the very first/last event. }
|
means the very first/last event. }
|
||||||
procedure TVpGanttView.GetRealEventDateRange(out AStartDate, AEndDate: TDate);
|
procedure TVpGanttView.GetRealEventDateRange(out AStartDate, AEndDate: TDate);
|
||||||
begin
|
begin
|
||||||
if FStartDate > 0 then AStartDate := DatePart(FStartDate) else AStartDate := FFirstDate;
|
if ValidDate(FStartDate) then
|
||||||
if FEndDate > 0 then AEndDate := DatePart(FEndDate) else AEndDate := FLastDate;
|
AStartDate := DatePart(FStartDate)
|
||||||
|
else
|
||||||
|
AStartDate := FFirstDate;
|
||||||
|
|
||||||
|
if ValidDate(FEndDate) then
|
||||||
|
AEndDate := DatePart(FEndDate)
|
||||||
|
else
|
||||||
|
AEndDate := FLastDate;
|
||||||
end;
|
end;
|
||||||
|
|
||||||
function TVpGanttView.GetRowAtCoord(Y: Integer): Integer;
|
function TVpGanttView.GetRowAtCoord(Y: Integer): Integer;
|
||||||
@ -1871,8 +1878,6 @@ begin
|
|||||||
end;
|
end;
|
||||||
|
|
||||||
procedure TVpGanttView.SetActiveEvent(AValue: TVpEvent);
|
procedure TVpGanttView.SetActiveEvent(AValue: TVpEvent);
|
||||||
var
|
|
||||||
i:Integer;
|
|
||||||
begin
|
begin
|
||||||
if FActiveEvent <> AValue then
|
if FActiveEvent <> AValue then
|
||||||
begin
|
begin
|
||||||
|
@ -159,6 +159,7 @@ function SameTimeOrEarlier(t1, t2: TTime): Boolean;
|
|||||||
function SameTimeOrLater(t1, t2: TTime): Boolean;
|
function SameTimeOrLater(t1, t2: TTime): Boolean;
|
||||||
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
|
function DateInRange(ADate, StartDate, EndDate: TDateTime; IncludeLimits: Boolean): Boolean;
|
||||||
function TimeInRange(ATime, StartTime, EndTime: 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;
|
function DateDialog(ACaption: String; var ADate: TDate): Boolean;
|
||||||
|
|
||||||
@ -918,6 +919,11 @@ begin
|
|||||||
Result := (DayOfWeek(ADate) in [1, 7]);
|
Result := (DayOfWeek(ADate) in [1, 7]);
|
||||||
end;
|
end;
|
||||||
|
|
||||||
|
function ValidDate(ADate: TDateTime): Boolean;
|
||||||
|
begin
|
||||||
|
Result := (ADate > 0) and (ADate <> NO_DATE);
|
||||||
|
end;
|
||||||
|
|
||||||
// Displays a date dialog
|
// Displays a date dialog
|
||||||
function DateDialog(ACaption: String; var ADate: TDate): Boolean;
|
function DateDialog(ACaption: String; var ADate: TDate): Boolean;
|
||||||
var
|
var
|
||||||
|
Reference in New Issue
Block a user