You've already forked lazarus-ccr
tvplanit: Add simple printing test projects
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@8545 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
20
components/tvplanit/examples/printing/ganttview/data.ini
Normal file
20
components/tvplanit/examples/printing/ganttview/data.ini
Normal file
@@ -0,0 +1,20 @@
|
||||
[General]
|
||||
Version=v105
|
||||
|
||||
[Resources]
|
||||
1178568021={Description:Test}|{ResourceActive:true}
|
||||
|
||||
[Events of resource 1178568021]
|
||||
1273124118={StartTime:2022/10/01 10:00:00}|{EndTime:2022/10/03 16:00:00}|{ResourceID:1178568021}|{Description:Test Oct-01-03}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1535857465={StartTime:2022/10/02 13:00:00}|{EndTime:2022/10/05 16:00:00}|{ResourceID:1178568021}|{Description:Test Oct 02-05}|{Category:1}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1842424188={StartTime:2022/10/02 18:00:00}|{EndTime:2022/10/04 19:00:00}|{ResourceID:1178568021}|{Description:Test Oct 02-04}|{Category:2}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1813046879={StartTime:2022/10/03 10:00:00}|{EndTime:2022/10/03 20:00:00}|{ResourceID:1178568021}|{Description:Test Oct 03}|{Category:3}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1819459250={StartTime:2022/10/05 09:30:00}|{EndTime:2022/10/05 13:45:00}|{ResourceID:1178568021}|{Description:Test 4a}|{Category:4}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1170127712={StartTime:2022/10/05 10:30:00}|{EndTime:2022/10/05 19:00:00}|{ResourceID:1178568021}|{Description:Test 4}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
909791748={StartTime:2022/10/06 08:30:00}|{EndTime:2022/10/06 09:00:00}|{ResourceID:1178568021}|{Description:All-day}|{Category:3}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1339092840={StartTime:2022/10/06 09:30:00}|{EndTime:2022/10/08 18:00:00}|{ResourceID:1178568021}|{Description:Test 5}|{Category:1}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1387047049={StartTime:2022/10/07 09:00:00}|{EndTime:2022/10/07 13:00:00}|{ResourceID:1178568021}|{Description:Test Recurring daily}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtCustom}|{RepeatRangeEnd:2022/10/30}|{CustomInterval:4}
|
||||
939711377={StartTime:2022/10/08 10:00:00}|{EndTime:2022/10/08 10:30:00}|{ResourceID:1178568021}|{Description:Test}|{Category:3}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1294424480={StartTime:2022/10/15 08:00:00}|{EndTime:2022/10/15 08:30:00}|{ResourceID:1178568021}|{Description:All-day event Oct 15}|{Category:2}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
638950699={StartTime:2022/10/26}|{EndTime:2022/11/03}|{ResourceID:1178568021}|{Description:Test All-day events Oct26-Nov3}|{Category:0}|{AllDayEvent:true}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
825453432={StartTime:2022/11/07 08:00:00}|{EndTime:2022/11/07 19:00:00}|{ResourceID:1178568021}|{Description:Test Nov-07}|{Category:2}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
@@ -0,0 +1,91 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="gvPrintDemo"/>
|
||||
<Scaled Value="True"/>
|
||||
<ResourceType Value="res"/>
|
||||
<UseXPManifest Value="True"/>
|
||||
<XPManifest>
|
||||
<DpiAware Value="True"/>
|
||||
</XPManifest>
|
||||
<Icon Value="0"/>
|
||||
</General>
|
||||
<BuildModes>
|
||||
<Item Name="Default" Default="True"/>
|
||||
</BuildModes>
|
||||
<PublishOptions>
|
||||
<Version Value="2"/>
|
||||
<UseFileFilters Value="True"/>
|
||||
</PublishOptions>
|
||||
<RunParams>
|
||||
<FormatVersion Value="2"/>
|
||||
</RunParams>
|
||||
<RequiredPackages>
|
||||
<Item>
|
||||
<PackageName Value="Printer4Lazarus"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="laz_visualplanit_design"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="laz_visualplanit"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item>
|
||||
</RequiredPackages>
|
||||
<Units>
|
||||
<Unit>
|
||||
<Filename Value="gvPrintDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="gvmain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="gvMain"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="gvPrintDemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
<UseHeaptrc Value="True"/>
|
||||
</Debugging>
|
||||
<Options>
|
||||
<Win32>
|
||||
<GraphicApplication Value="True"/>
|
||||
</Win32>
|
||||
</Options>
|
||||
</Linking>
|
||||
</CompilerOptions>
|
||||
<Debugging>
|
||||
<Exceptions>
|
||||
<Item>
|
||||
<Name Value="EAbort"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="ECodetoolError"/>
|
||||
</Item>
|
||||
<Item>
|
||||
<Name Value="EFOpenError"/>
|
||||
</Item>
|
||||
</Exceptions>
|
||||
</Debugging>
|
||||
</CONFIG>
|
@@ -0,0 +1,25 @@
|
||||
program gvPrintDemo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, gvMain, printer4lazarus
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
175
components/tvplanit/examples/printing/ganttview/gvmain.lfm
Normal file
175
components/tvplanit/examples/printing/ganttview/gvmain.lfm
Normal file
@@ -0,0 +1,175 @@
|
||||
object Form1: TForm1
|
||||
Left = 327
|
||||
Height = 459
|
||||
Top = 127
|
||||
Width = 936
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 459
|
||||
ClientWidth = 936
|
||||
OnCreate = FormCreate
|
||||
object Panel1: TPanel
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 6
|
||||
Width = 924
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 26
|
||||
ClientWidth = 924
|
||||
TabOrder = 0
|
||||
object VpPrintFormatComboBox1: TVpPrintFormatComboBox
|
||||
AnchorSideLeft.Control = Panel1
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 0
|
||||
Height = 23
|
||||
Top = 2
|
||||
Width = 248
|
||||
ControlLink = VpControlLink1
|
||||
ItemHeight = 15
|
||||
Sorted = True
|
||||
TabOrder = 0
|
||||
end
|
||||
object btnPrintPreview: TButton
|
||||
AnchorSideLeft.Control = VpPrintFormatComboBox1
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 256
|
||||
Height = 25
|
||||
Top = 1
|
||||
Width = 76
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Preview...'
|
||||
OnClick = btnPrintPreviewClick
|
||||
TabOrder = 1
|
||||
end
|
||||
object btnPrint: TButton
|
||||
AnchorSideLeft.Control = btnPrintPreview
|
||||
AnchorSideLeft.Side = asrBottom
|
||||
AnchorSideTop.Control = Panel1
|
||||
AnchorSideTop.Side = asrCenter
|
||||
Left = 340
|
||||
Height = 25
|
||||
Top = 1
|
||||
Width = 60
|
||||
AutoSize = True
|
||||
BorderSpacing.Left = 8
|
||||
Caption = 'Print...'
|
||||
OnClick = btnPrintClick
|
||||
TabOrder = 2
|
||||
end
|
||||
end
|
||||
object VpGanttView1: TVpGanttView
|
||||
Left = 0
|
||||
Height = 421
|
||||
Top = 38
|
||||
Width = 936
|
||||
PopupMenu = VpGanttView1.default
|
||||
DataStore = VpIniDatastore1
|
||||
ControlLink = VpControlLink1
|
||||
Align = alClient
|
||||
TimeFormat = tf24Hour
|
||||
end
|
||||
object VpControlLink1: TVpControlLink
|
||||
DataStore = VpIniDatastore1
|
||||
Printer.BottomMargin = 1
|
||||
Printer.DayStart = h_08
|
||||
Printer.DayEnd = h_18
|
||||
Printer.Granularity = gr30Min
|
||||
Printer.LeftMargin = 1
|
||||
Printer.MarginUnits = imCentimeters
|
||||
Printer.PrintFormats = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayInc = 0
|
||||
DayIncUnits = duDay
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'GanttView'
|
||||
Height = 100
|
||||
ItemType = itGanttView
|
||||
Left = 0
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'GanttView Portrait'
|
||||
end
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayInc = 0
|
||||
DayIncUnits = duDay
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'GanttView'
|
||||
Height = 100
|
||||
ItemType = itGanttView
|
||||
Left = 0
|
||||
Rotation = ra180
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'GanttView Portrait Upside-down'
|
||||
end>
|
||||
Printer.RightMargin = 1
|
||||
Printer.TopMargin = 1
|
||||
Left = 187
|
||||
Top = 207
|
||||
end
|
||||
object VpIniDatastore1: TVpIniDatastore
|
||||
CategoryColorMap.Category0.BackgroundColor = clSkyBlue
|
||||
CategoryColorMap.Category0.Description = 'Category 0'
|
||||
CategoryColorMap.Category1.BackgroundColor = clMoneyGreen
|
||||
CategoryColorMap.Category1.Color = clGreen
|
||||
CategoryColorMap.Category1.Description = 'Category 1'
|
||||
CategoryColorMap.Category2.BackgroundColor = 12171775
|
||||
CategoryColorMap.Category2.Color = clRed
|
||||
CategoryColorMap.Category2.Description = 'Category 2'
|
||||
CategoryColorMap.Category3.BackgroundColor = clYellow
|
||||
CategoryColorMap.Category3.Color = clOlive
|
||||
CategoryColorMap.Category3.Description = 'Category 3'
|
||||
CategoryColorMap.Category4.Description = 'Category 4'
|
||||
CategoryColorMap.Category5.Description = 'Category 5'
|
||||
CategoryColorMap.Category6.Description = 'Category 6'
|
||||
CategoryColorMap.Category7.Description = 'Category 7'
|
||||
CategoryColorMap.Category8.Description = 'Category 8'
|
||||
CategoryColorMap.Category9.Description = 'Category 9'
|
||||
HiddenCategories.BackgroundColor = clSilver
|
||||
HiddenCategories.Color = clGray
|
||||
AutoConnect = True
|
||||
FileName = 'data.ini'
|
||||
Left = 184
|
||||
Top = 272
|
||||
end
|
||||
object PrintDialog1: TPrintDialog
|
||||
Left = 304
|
||||
Top = 99
|
||||
end
|
||||
object VpPrintPreviewDialog1: TVpPrintPreviewDialog
|
||||
Version = 'v1.0.7'
|
||||
DataStore = VpIniDatastore1
|
||||
ControlLink = VpControlLink1
|
||||
EndDate = 44844.8788724421
|
||||
MarginUnits = imAbsolutePixel
|
||||
StartDate = 44837.8788724421
|
||||
Options = []
|
||||
Placement.Position = mpCenter
|
||||
Placement.Top = 10
|
||||
Placement.Left = 10
|
||||
Placement.Height = 480
|
||||
Placement.Width = 720
|
||||
Left = 184
|
||||
Top = 96
|
||||
end
|
||||
end
|
88
components/tvplanit/examples/printing/ganttview/gvmain.pas
Normal file
88
components/tvplanit/examples/printing/ganttview/gvmain.pas
Normal file
@@ -0,0 +1,88 @@
|
||||
unit gvMain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
Spin, PrintersDlgs, VpBaseDS, VpIniDs, VpDayView, VpPrtPrvDlg, VpPrtFmtCBox,
|
||||
VpData, VpWeekView, VpGanttView;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
btnPrintPreview: TButton;
|
||||
btnPrint: TButton;
|
||||
Panel1: TPanel;
|
||||
PrintDialog1: TPrintDialog;
|
||||
VpControlLink1: TVpControlLink;
|
||||
VpGanttView1: TVpGanttView;
|
||||
VpIniDatastore1: TVpIniDatastore;
|
||||
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
|
||||
VpPrintPreviewDialog1: TVpPrintPreviewDialog;
|
||||
procedure btnPrintPreviewClick(Sender: TObject);
|
||||
procedure btnPrintClick(Sender: TObject);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
private
|
||||
|
||||
public
|
||||
|
||||
end;
|
||||
|
||||
var
|
||||
Form1: TForm1;
|
||||
|
||||
implementation
|
||||
|
||||
{$R *.lfm}
|
||||
|
||||
uses
|
||||
Printers;
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
procedure TForm1.btnPrintPreviewClick(Sender: TObject);
|
||||
var
|
||||
d1, d2: TDateTime;
|
||||
begin
|
||||
d1 := EncodeDate(2022, 10, 3);
|
||||
d2 := EncodeDate(2022, 10, 30);
|
||||
VpPrintPreviewDialog1.StartDate := d1;
|
||||
VpPrintPreviewDialog1.EndDate := d2;
|
||||
if VpPrintPreviewDialog1.Execute then
|
||||
if PrintDialog1.Execute then begin
|
||||
Printer.BeginDoc;
|
||||
try
|
||||
VpPrintPreviewDialog1.ControlLink.Printer.Print(Printer, d1, d2);
|
||||
finally
|
||||
Printer.EndDoc;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.btnPrintClick(Sender: TObject);
|
||||
var
|
||||
d1, d2: TDateTime;
|
||||
begin
|
||||
d1 := EncodeDate(2022, 10, 3);
|
||||
d2 := EncodeDate(2022, 10, 31);
|
||||
Printer.BeginDoc;
|
||||
try
|
||||
VpControlLink1.Printer.Print(Printer, d1, d2);
|
||||
finally
|
||||
Printer.EndDoc;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TForm1.FormCreate(Sender: TObject);
|
||||
begin
|
||||
if VpIniDatastore1.Resources.Count > 0 then
|
||||
VpIniDatastore1.Resource := VpIniDatastore1.Resources.Items[0];
|
||||
//VpGanttView1.ActualDate := EncodeDate(2022, 10, 1);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
Reference in New Issue
Block a user