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:
@@ -0,0 +1,85 @@
|
||||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<CONFIG>
|
||||
<ProjectOptions>
|
||||
<Version Value="12"/>
|
||||
<PathDelim Value="\"/>
|
||||
<General>
|
||||
<SessionStorage Value="InProjectDir"/>
|
||||
<Title Value="calPrintDemo"/>
|
||||
<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="calPrintDemo.lpr"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
</Unit>
|
||||
<Unit>
|
||||
<Filename Value="calmain.pas"/>
|
||||
<IsPartOfProject Value="True"/>
|
||||
<ComponentName Value="Form1"/>
|
||||
<HasResources Value="True"/>
|
||||
<ResourceBaseClass Value="Form"/>
|
||||
<UnitName Value="calMain"/>
|
||||
</Unit>
|
||||
</Units>
|
||||
</ProjectOptions>
|
||||
<CompilerOptions>
|
||||
<Version Value="11"/>
|
||||
<PathDelim Value="\"/>
|
||||
<Target>
|
||||
<Filename Value="calPrintDemo"/>
|
||||
</Target>
|
||||
<SearchPaths>
|
||||
<IncludeFiles Value="$(ProjOutDir)"/>
|
||||
<UnitOutputDirectory Value="lib\$(TargetCPU)-$(TargetOS)"/>
|
||||
</SearchPaths>
|
||||
<Linking>
|
||||
<Debugging>
|
||||
<DebugInfoType Value="dsDwarf3"/>
|
||||
</Debugging>
|
||||
</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 calPrintDemo;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
uses
|
||||
{$IFDEF UNIX}
|
||||
cthreads,
|
||||
{$ENDIF}
|
||||
{$IFDEF HASAMIGA}
|
||||
athreads,
|
||||
{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, calMain, printer4lazarus
|
||||
{ you can add units after this };
|
||||
|
||||
{$R *.res}
|
||||
|
||||
begin
|
||||
RequireDerivedFormResource:=True;
|
||||
Application.Scaled:=True;
|
||||
Application.Initialize;
|
||||
Application.CreateForm(TForm1, Form1);
|
||||
Application.Run;
|
||||
end.
|
||||
|
229
components/tvplanit/examples/printing/calendar/calmain.lfm
Normal file
229
components/tvplanit/examples/printing/calendar/calmain.lfm
Normal file
@@ -0,0 +1,229 @@
|
||||
object Form1: TForm1
|
||||
Left = 327
|
||||
Height = 347
|
||||
Top = 127
|
||||
Width = 420
|
||||
Caption = 'Form1'
|
||||
ClientHeight = 347
|
||||
ClientWidth = 420
|
||||
OnCreate = FormCreate
|
||||
object Panel1: TPanel
|
||||
Left = 6
|
||||
Height = 26
|
||||
Top = 6
|
||||
Width = 408
|
||||
Align = alTop
|
||||
AutoSize = True
|
||||
BorderSpacing.Around = 6
|
||||
BevelOuter = bvNone
|
||||
ClientHeight = 26
|
||||
ClientWidth = 408
|
||||
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 VpCalendar1: TVpCalendar
|
||||
Left = 0
|
||||
Height = 309
|
||||
Top = 38
|
||||
Width = 420
|
||||
PopupMenu = VpCalendar1.default
|
||||
DataStore = VpIniDatastore1
|
||||
ControlLink = VpControlLink1
|
||||
Font.Height = -12
|
||||
ParentFont = False
|
||||
Align = alClient
|
||||
Colors.ActiveDay = clBlue
|
||||
Colors.ActiveDayBorder = clBlack
|
||||
Colors.ActiveDayText = clWhite
|
||||
Colors.Background = clDefault
|
||||
Colors.ColorScheme = cscalCustom
|
||||
Colors.DayNames = clMaroon
|
||||
Colors.Days = clBlack
|
||||
Colors.InactiveDays = clMedGray
|
||||
Colors.MonthAndYear = clBlue
|
||||
Colors.Weekend = clRed
|
||||
Colors.EventDays = clBlack
|
||||
TabOrder = 1
|
||||
TabStop = True
|
||||
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 = duMonth
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'Calendar'
|
||||
Height = 100
|
||||
ItemType = itCalendar
|
||||
Left = 0
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Calendar Portrait'
|
||||
end
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayInc = 1
|
||||
DayIncUnits = duMonth
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'Calendar'
|
||||
Height = 100
|
||||
ItemType = itCalendar
|
||||
Left = 0
|
||||
Rotation = ra90
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Calendar Landscape 90°'
|
||||
end
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayInc = 1
|
||||
DayIncUnits = duMonth
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'Calendar'
|
||||
Height = 100
|
||||
ItemType = itCalendar
|
||||
Left = 0
|
||||
Rotation = ra270
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Calendar Landscape 270°'
|
||||
end
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayInc = 1
|
||||
DayIncUnits = duMonth
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.0.7'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
ElementName = 'Calendar'
|
||||
Height = 100
|
||||
ItemType = itCalendar
|
||||
Left = 0
|
||||
Rotation = ra180
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Calendar 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/calendar/calmain.pas
Normal file
88
components/tvplanit/examples/printing/calendar/calmain.pas
Normal file
@@ -0,0 +1,88 @@
|
||||
unit calMain;
|
||||
|
||||
{$mode objfpc}{$H+}
|
||||
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
|
||||
PrintersDlgs, VpBaseDS, VpIniDs, VpPrtPrvDlg, VpPrtFmtCBox,
|
||||
VpData, VpMonthView, VpCalendar;
|
||||
|
||||
type
|
||||
|
||||
{ TForm1 }
|
||||
|
||||
TForm1 = class(TForm)
|
||||
btnPrintPreview: TButton;
|
||||
btnPrint: TButton;
|
||||
Panel1: TPanel;
|
||||
PrintDialog1: TPrintDialog;
|
||||
VpCalendar1: TVpCalendar;
|
||||
VpControlLink1: TVpControlLink;
|
||||
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, 1);
|
||||
d2 := EncodeDate(2022, 12, 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, 12, 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];
|
||||
VpCalendar1.Date := EncodeDate(2022, 10, 1);
|
||||
end;
|
||||
|
||||
end.
|
||||
|
21
components/tvplanit/examples/printing/calendar/data.ini
Normal file
21
components/tvplanit/examples/printing/calendar/data.ini
Normal file
@@ -0,0 +1,21 @@
|
||||
[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}
|
||||
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}
|
||||
638950699={StartTime:2022/10/31 15:00:00}|{EndTime:2022/10/31 18:00:00}|{ResourceID:1178568021}|{Description:Test Oct-31}|{Category:0}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1339092840={StartTime:2022/11/06 10:00:00}|{EndTime:2022/11/06 15:00:00}|{ResourceID:1178568021}|{Description:Test Nov-10}|{Category:1}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
||||
1915067938={StartTime:2022/11/30 12:00:00}|{EndTime:2022/11/30 14:00:00}|{ResourceID:1178568021}|{Description:Test Nov-30}|{Category:3}|{AllDayEvent:false}|{AlarmSet:false}|{AlarmAdvance:15}|{AlarmAdvanceType:atMinutes}|{RepeatCode:rtNone}|{CustomInterval:0}
|
Reference in New Issue
Block a user