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,85 @@
<?xml version="1.0" encoding="UTF-8"?>
<CONFIG>
<ProjectOptions>
<Version Value="12"/>
<PathDelim Value="\"/>
<General>
<SessionStorage Value="InProjectDir"/>
<Title Value="wvPrintDemo"/>
<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="wvPrintDemo.lpr"/>
<IsPartOfProject Value="True"/>
</Unit>
<Unit>
<Filename Value="wvmain.pas"/>
<IsPartOfProject Value="True"/>
<ComponentName Value="Form1"/>
<HasResources Value="True"/>
<ResourceBaseClass Value="Form"/>
<UnitName Value="wvMain"/>
</Unit>
</Units>
</ProjectOptions>
<CompilerOptions>
<Version Value="11"/>
<PathDelim Value="\"/>
<Target>
<Filename Value="wvPrintDemo"/>
</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>

View File

@ -0,0 +1,25 @@
program wvPrintDemo;
{$mode objfpc}{$H+}
uses
{$IFDEF UNIX}
cthreads,
{$ENDIF}
{$IFDEF HASAMIGA}
athreads,
{$ENDIF}
Interfaces, // this includes the LCL widgetset
Forms, wvMain, 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,242 @@
object Form1: TForm1
Left = 327
Height = 523
Top = 127
Width = 584
Caption = 'Form1'
ClientHeight = 523
ClientWidth = 584
OnCreate = FormCreate
LCLVersion = '2.3.0.0'
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 = 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 VpWeekView1: TVpWeekView
Left = 0
Height = 485
Top = 38
Width = 584
PopupMenu = VpWeekView1.default
DataStore = VpIniDatastore1
ControlLink = VpControlLink1
Font.Height = -12
ParentFont = False
AllDayEventAttributes.Font.Height = -12
DayHeadAttributes.DateFormat = 'ddddd'
DayHeadAttributes.Font.Height = -13
EventFont.Height = -12
HeadAttributes.Font.Height = -12
Align = alClient
TabOrder = 1
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 = duWeek
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'WeekView'
Height = 100
ItemType = itWeekView
Left = 0
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = 'WeekView Portrait'
end
item
Version = 'v1.0.7'
DayInc = 1
DayIncUnits = duWeek
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'WeekView'
Height = 100
ItemType = itWeekView
Left = 0
Rotation = ra90
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = 'WeekView Landscape 90°'
end
item
Version = 'v1.0.7'
DayInc = 1
DayIncUnits = duWeek
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'WeekView'
Height = 100
ItemType = itWeekView
Left = 0
Rotation = ra270
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = 'WeekView Landscape 270°'
end
item
Version = 'v1.0.7'
DayInc = 1
DayIncUnits = duWeek
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'Weekview'
Height = 100
ItemType = itWeekView
Left = 0
Rotation = ra180
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = 'WeekView Portrait Upside-down'
end
item
Version = 'v1.0.7'
DayInc = 0
DayIncUnits = duDay
Elements = <
item
Version = 'v1.0.7'
DayOffset = 0
DayOffsetUnits = duDay
ElementName = 'WeekView'
Height = 100
ItemType = itWeekView
Left = 0
Shape.Shape = ustRectangle
Top = 0
Width = 100
end>
FormatName = '_weekview test'
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

View File

@ -0,0 +1,88 @@
unit wvMain;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, Forms, Controls, Graphics, Dialogs, ExtCtrls, StdCtrls,
Spin, PrintersDlgs, VpBaseDS, VpIniDs, VpDayView, VpPrtPrvDlg, VpPrtFmtCBox,
VpData, VpWeekView;
type
{ TForm1 }
TForm1 = class(TForm)
btnPrintPreview: TButton;
btnPrint: TButton;
Panel1: TPanel;
PrintDialog1: TPrintDialog;
VpControlLink1: TVpControlLink;
VpIniDatastore1: TVpIniDatastore;
VpPrintFormatComboBox1: TVpPrintFormatComboBox;
VpPrintPreviewDialog1: TVpPrintPreviewDialog;
VpWeekView1: TVpWeekView;
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];
VpWeekView1.Date := EncodeDate(2022, 10, 1);
end;
end.