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:
wp_xxyyzz
2022-10-12 20:24:11 +00:00
parent 3cb293895d
commit 6242422cf8
34 changed files with 3166 additions and 0 deletions

View File

@@ -0,0 +1,19 @@
[General]
Version=v105
[Resources]
1178568021={Description:Test}|{ResourceActive:true}
[Events of resource 1178568021]
1273124118={StartTime:2022/10/01 10:00:00}|{EndTime:2022/10/01 12:30:00}|{ResourceID:1178568021}|{Description:Test event 1}|{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/02 16:00:00}|{ResourceID:1178568021}|{Description:Test event 2}|{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/02 19:00:00}|{ResourceID:1178568021}|{Description:Test event 2a}|{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 13:00:00}|{ResourceID:1178568021}|{Description:Test event 3}|{Category:3}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
1294424480={StartTime:2022/10/04 08:00:00}|{EndTime:2022/10/04 08:30:00}|{ResourceID:1178568021}|{Description:All-day event}|{Category:2}|{AllDayEvent:true}|{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 10:30:00}|{EndTime:2022/10/06 14:00:00}|{ResourceID:1178568021}|{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 6}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
825453432={StartTime:2022/10/07 12:30:00}|{EndTime:2022/10/07 19:00:00}|{ResourceID:1178568021}|{Description:Test 6a}|{Category:2}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
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}

View File

@@ -0,0 +1,90 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="dvPrintDemo"/>
<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="dvPrintDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="dvmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="dvMain"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="dvPrintDemo"/>
</Target>
<SearchPaths>
<IncludeFiles Value="$(ProjOutDir)"/>
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
</SearchPaths>
<Linking>
<Debugging>
<DebugInfoType Value="dsDwarf3"/>
</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>

View File

@@ -0,0 +1,25 @@
program dvPrintDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, dvMain, printer4lazarus
{ you can add units after this };
{$R *.res}
begin
RequireDerivedFormResource:=True;
Application.Scaled:=True;
Application.Initialize;
Application.CreateForm(TForm1, Form1);
Application.Run;
end.

View File

@@ -0,0 +1,225 @@
object Form1: TForm1
Left = 327
Height = 523
Top = 127
Width = 584
Caption = 'Form1'
ClientHeight = 523
ClientWidth = 584
OnCreate = FormCreate
object VpDayView1: TVpDayView
Left = 0
Height = 485
Top = 38
Width = 584
PopupMenu = VpDayView1.default
DataStore = VpIniDatastore1
ControlLink = VpControlLink1
Font.Height = -12
ParentFont = False
Align = alClient
TabOrder = 0
AllDayEventAttributes.Font.Height = -12
TimeSlotColors.Active = clWhite
TimeSlotColors.ActiveRange.RangeBegin = h_00
TimeSlotColors.ActiveRange.RangeEnd = h_00
HeadAttributes.Font.Height = -13
RowHeadAttributes.HourFont.Height = -24
RowHeadAttributes.MinuteFont.Height = -12
end
object Panel1: TPanel
Left = 6
Height = 26
Top = 6
Width = 572
Align = alTop
AutoSize = True
BorderSpacing.Around = 6
BevelOuter = bvNone
ClientHeight = 26
ClientWidth = 572
TabOrder = 1
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
object SpinEdit1: TSpinEdit
AnchorSideLeft.Control = Label1
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 453
Height = 23
Top = 2
Width = 51
Alignment = taRightJustify
BorderSpacing.Left = 4
MaxValue = 7
MinValue = 1
OnChange = SpinEdit1Change
TabOrder = 3
Value = 1
end
object Label1: TLabel
AnchorSideLeft.Control = btnPrint
AnchorSideLeft.Side = asrBottom
AnchorSideTop.Control = Panel1
AnchorSideTop.Side = asrCenter
Left = 424
Height = 15
Top = 6
Width = 25
BorderSpacing.Left = 24
Caption = 'Days'
end
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 = 1
DayIncUnits = duDay
Description = 'DayView with 1 day'
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'DayView'
Height = 100
Left = 0
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = 'One day'
end
item
Version = 'v1.0.7'
DayInc = 2
DayIncUnits = duDay
Description = '2 Day views'
Elements = <
item
Version = 'v1.0.7'
DayOffset = 1
DayOffsetUnits = duDay
ElementName = 'Top DayView'
Height = 48
Left = 2
Rotation = ra270
Shape.Shape = ustRectangle
Top = 2
Width = 96
end
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'Bottom DayView'
Height = 48
Left = 2
Rotation = ra270
Shape.Shape = ustRectangle
Top = 51
Width = 98
end>
FormatName = 'Two days'
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 = 'file error.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

View File

@@ -0,0 +1,95 @@
unit dvMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Spin, PrintersDlgs, VpBaseDS, VpIniDs, VpDayView, VpPrtPrvDlg, VpPrtFmtCBox, VpData;
type
{ TForm1 }
TForm1 = class(TForm)
btnPrintPreview: TButton;
btnPrint: TButton;
Label1: TLabel;
Panel1: TPanel;
PrintDialog1: TPrintDialog;
SpinEdit1: TSpinEdit;
VpControlLink1: TVpControlLink;
VpDayView1: TVpDayView;
VpIniDatastore1: TVpIniDatastore;
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
VpPrintPreviewDialog1: TVpPrintPreviewDialog;
procedure btnPrintPreviewClick(Sender: TObject);
procedure btnPrintClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure SpinEdit1Change(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, 1);
d2 := EncodeDate(2022, 10, 31);
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, 1);
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];
VpDayView1.Date := EncodeDate(2022, 10, 1);
end;
procedure TForm1.SpinEdit1Change(Sender: TObject);
begin
VpDayView1.NumDays := SpinEdit1.Value;
end;
end.