You've already forked lazarus-ccr
tvplanit: Initial version with printing capabilities (still lots of bugs...)
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4903 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -28,13 +28,16 @@
|
||||
<FormatVersion Value="1"/>
|
||||
</local>
|
||||
</RunParams>
|
||||
<RequiredPackages Count="2">
|
||||
<RequiredPackages Count="3">
|
||||
<Item1>
|
||||
<PackageName Value="laz_visualplanit"/>
|
||||
<PackageName Value="Printer4Lazarus"/>
|
||||
</Item1>
|
||||
<Item2>
|
||||
<PackageName Value="LCL"/>
|
||||
<PackageName Value="laz_visualplanit"/>
|
||||
</Item2>
|
||||
<Item3>
|
||||
<PackageName Value="LCL"/>
|
||||
</Item3>
|
||||
</RequiredPackages>
|
||||
<Units Count="2">
|
||||
<Unit0>
|
||||
|
@ -7,7 +7,8 @@ uses
|
||||
cthreads,
|
||||
{$ENDIF}{$ENDIF}
|
||||
Interfaces, // this includes the LCL widgetset
|
||||
Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator;
|
||||
Forms, demoMain, laz_visualplanit, LCLTranslator, DefaultTranslator,
|
||||
printer4lazarus;
|
||||
|
||||
{$R *.res}
|
||||
|
||||
|
@ -689,15 +689,52 @@ object MainForm: TMainForm
|
||||
object VpControlLink1: TVpControlLink
|
||||
DataStore = VpBufDSDataStore1
|
||||
LocalizationFile = '../../source/vplocalize.xml'
|
||||
Printer.BottomMargin = 0
|
||||
Printer.DayStart = h_08
|
||||
Printer.DayEnd = h_05
|
||||
Printer.Granularity = gr30Min
|
||||
Printer.LeftMargin = 0
|
||||
Printer.MarginUnits = imAbsolutePixel
|
||||
Printer.PrintFormats = <>
|
||||
Printer.RightMargin = 0
|
||||
Printer.TopMargin = 0
|
||||
Printer.BottomMargin = 5
|
||||
Printer.DayStart = h_07
|
||||
Printer.DayEnd = h_18
|
||||
Printer.Granularity = gr60Min
|
||||
Printer.LeftMargin = 5
|
||||
Printer.MarginUnits = imPercent
|
||||
Printer.PrintFormats = <
|
||||
item
|
||||
Version = 'v1.04'
|
||||
DayInc = 0
|
||||
DayIncUnits = duDay
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.04'
|
||||
Caption.Caption = 'Current week'
|
||||
Caption.Font.Style = [fsItalic]
|
||||
DayOffset = 1
|
||||
DayOffsetUnits = duDay
|
||||
Height = 100
|
||||
Left = 0
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Current week (dayview)'
|
||||
end
|
||||
item
|
||||
Version = 'v1.04'
|
||||
DayInc = 0
|
||||
DayIncUnits = duWeek
|
||||
Elements = <
|
||||
item
|
||||
Version = 'v1.04'
|
||||
DayOffset = 0
|
||||
DayOffsetUnits = duDay
|
||||
Height = 100
|
||||
ItemType = itWeekView
|
||||
Left = 0
|
||||
Shape.Shape = ustRectangle
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Current week (Week view)'
|
||||
end>
|
||||
Printer.RightMargin = 5
|
||||
Printer.TopMargin = 5
|
||||
left = 312
|
||||
top = 200
|
||||
end
|
||||
@ -1910,6 +1947,13 @@ object MainForm: TMainForm
|
||||
top = 221
|
||||
object MenuItem1: TMenuItem
|
||||
Caption = 'File'
|
||||
object MnuPrintPreview: TMenuItem
|
||||
Caption = 'Print preview...'
|
||||
OnClick = MnuPrintPreviewClick
|
||||
end
|
||||
object MenuItem3: TMenuItem
|
||||
Caption = '-'
|
||||
end
|
||||
object MnuQuit: TMenuItem
|
||||
Caption = 'Quit'
|
||||
OnClick = MnuQuitClick
|
||||
@ -1934,4 +1978,28 @@ object MainForm: TMainForm
|
||||
end
|
||||
end
|
||||
end
|
||||
object PrintDialog1: TPrintDialog
|
||||
left = 560
|
||||
top = 128
|
||||
end
|
||||
object VpPrintPreviewDialog1: TVpPrintPreviewDialog
|
||||
Version = 'v1.04'
|
||||
DataStore = VpBufDSDataStore1
|
||||
BottomMargin = 5
|
||||
ControlLink = VpControlLink1
|
||||
EndDate = 42561.5151169907
|
||||
LeftMargin = 5
|
||||
MarginUnits = imPercent
|
||||
RightMargin = 5
|
||||
StartDate = 42554.5151169907
|
||||
TopMargin = 5
|
||||
Options = [doSizeable]
|
||||
Placement.Position = mpCenter
|
||||
Placement.Top = 10
|
||||
Placement.Left = 10
|
||||
Placement.Height = 500
|
||||
Placement.Width = 1000
|
||||
left = 560
|
||||
top = 192
|
||||
end
|
||||
end
|
||||
|
@ -23,6 +23,8 @@ TMAINFORM.COMBOBOX1.TEXT=ComboBox1
|
||||
TMAINFORM.CBDRAWINGSTYLE.TEXT=flat
|
||||
TMAINFORM.TITLELBL.CAPTION=TitleLbl
|
||||
TMAINFORM.MENUITEM1.CAPTION=File
|
||||
TMAINFORM.MNUPRINTPREVIEW.CAPTION=Print preview...
|
||||
TMAINFORM.MENUITEM3.CAPTION=-
|
||||
TMAINFORM.MNUQUIT.CAPTION=Quit
|
||||
TMAINFORM.MNUMAINTENANCE.CAPTION=Maintenance
|
||||
TMAINFORM.MNURESOURCES.CAPTION=Resources
|
||||
|
@ -5,11 +5,10 @@ unit demoMain;
|
||||
interface
|
||||
|
||||
uses
|
||||
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
|
||||
StdCtrls, ComCtrls, LCLTranslator, Menus,
|
||||
VpBaseDS, VpDayView, VpWeekView, VpTaskList, VpAbout,
|
||||
VpContactGrid, VpMonthView, VpResEditDlg, VpContactButtons, VpBufDS, VpNavBar,
|
||||
VpData, Types;
|
||||
Classes, SysUtils, FileUtil, PrintersDlgs, Forms, Controls, Graphics, Dialogs,
|
||||
ExtCtrls, StdCtrls, ComCtrls, LCLTranslator, Menus, VpBaseDS, VpDayView,
|
||||
VpWeekView, VpTaskList, VpAbout, VpContactGrid, VpMonthView, VpResEditDlg,
|
||||
VpContactButtons, VpBufDS, VpNavBar, VpData, VpPrtPrvDlg, Types;
|
||||
|
||||
type
|
||||
|
||||
@ -36,6 +35,9 @@ type
|
||||
LblGranularity: TLabel;
|
||||
LblLanguage: TLabel;
|
||||
LblVisibleDays: TLabel;
|
||||
MenuItem3: TMenuItem;
|
||||
MnuPrintPreview: TMenuItem;
|
||||
PrintDialog1: TPrintDialog;
|
||||
TitleLbl: TLabel;
|
||||
MainMenu1: TMainMenu;
|
||||
MenuItem1: TMenuItem;
|
||||
@ -68,6 +70,7 @@ type
|
||||
VpDayView1: TVpDayView;
|
||||
VpMonthView1: TVpMonthView;
|
||||
VpNavBar1: TVpNavBar;
|
||||
VpPrintPreviewDialog1: TVpPrintPreviewDialog;
|
||||
VpResourceCombo1: TVpResourceCombo;
|
||||
VpResourceEditDialog1: TVpResourceEditDialog;
|
||||
VpTaskList1: TVpTaskList;
|
||||
@ -85,6 +88,7 @@ type
|
||||
procedure CbTimeFormatChange(Sender: TObject);
|
||||
procedure FormCloseQuery(Sender: TObject; var CanClose: boolean);
|
||||
procedure FormCreate(Sender: TObject);
|
||||
procedure MnuPrintPreviewClick(Sender: TObject);
|
||||
procedure MnuQuitClick(Sender: TObject);
|
||||
procedure MnuResourcesClick(Sender: TObject);
|
||||
procedure MnuSettingsClick(Sender: TObject);
|
||||
@ -129,8 +133,9 @@ uses
|
||||
{$IFDEF WINDOWS}
|
||||
Windows,
|
||||
{$ENDIF}
|
||||
LResources, LazFileUtils, LazUTF8, StrUtils, Translations, IniFiles, Math,
|
||||
VpMisc, VpBase;
|
||||
LResources, LazFileUtils, LazUTF8, StrUtils, DateUtils, Translations,
|
||||
IniFiles, Math, Printers,
|
||||
VpMisc, VpBase, VpPrtFmt;
|
||||
|
||||
const
|
||||
LANGUAGE_DIR = '..\..\languages\';
|
||||
@ -348,6 +353,45 @@ begin
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MnuPrintPreviewClick(Sender: TObject);
|
||||
var
|
||||
t1, t2: TDateTime;
|
||||
fmt: TVpPrintFormatItem;
|
||||
fmtidx: Integer;
|
||||
begin
|
||||
fmtidx := VpPrintPreviewDialog1.ControlLink.Printer.CurFormat;
|
||||
fmt := VpPrintPreviewDialog1.ControlLink.Printer.PrintFormats.Items[fmtidx];
|
||||
case fmtidx of
|
||||
0: begin // current week in DayView
|
||||
t1 := StartOfTheWeek(now);
|
||||
t2 := t1 + 7 - VpDayView1.NumDays mod 7; // + 7;
|
||||
fmt.DayInc := VpDayView1.NumDays;
|
||||
VpControlLink1.Printer.Granularity := VpDayView1.Granularity;
|
||||
VpControlLink1.Printer.DayStart := h_08; //VpDayView1.DefaultTopHour;
|
||||
VpControlLink1.Printer.DayEnd := h_17;
|
||||
end;
|
||||
1: begin // current week in WeekView
|
||||
t1 := StartOfTheWeek(now);
|
||||
t2 := t1; // it all fits on one single page
|
||||
end;
|
||||
end;
|
||||
VpPrintPreviewDialog1.ControlLink := VpControlLink1;
|
||||
VpPrintPreviewDialog1.Printer := Printer;
|
||||
VpPrintPreviewDialog1.StartDate := t1;
|
||||
VPPrintPreviewDialog1.EndDate := t2;
|
||||
if VpPrintPreviewDialog1.Execute then
|
||||
if PrintDialog1.Execute then begin
|
||||
Printer.BeginDoc;
|
||||
try
|
||||
t1 := VpPrintPreviewDialog1.StartDate;
|
||||
t2 := VpPrintPreviewDialog1.EndDate;
|
||||
VpPrintPreviewDialog1.ControlLink.Printer.Print(Printer, t1, t2);
|
||||
finally
|
||||
Printer.EndDoc;
|
||||
end;
|
||||
end;
|
||||
end;
|
||||
|
||||
procedure TMainForm.MnuSettingsClick(Sender: TObject);
|
||||
begin
|
||||
ShowSettings;
|
||||
|
@ -256,6 +256,10 @@ msgstr "Datei"
|
||||
msgid "Help"
|
||||
msgstr "Hilfe"
|
||||
|
||||
#: tmainform.menuitem3.caption
|
||||
msgid "-"
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.mnuabout.caption
|
||||
msgid "About Visual PlanIt"
|
||||
msgstr "Über Visual PlanIt"
|
||||
@ -265,6 +269,10 @@ msgctxt "tmainform.mnumaintenance.caption"
|
||||
msgid "Maintenance"
|
||||
msgstr "Wartung"
|
||||
|
||||
#: tmainform.mnuprintpreview.caption
|
||||
msgid "Print preview..."
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.mnuquit.caption
|
||||
msgid "Quit"
|
||||
msgstr "Beenden"
|
||||
|
@ -245,6 +245,10 @@ msgstr ""
|
||||
msgid "Help"
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.menuitem3.caption
|
||||
msgid "-"
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.mnuabout.caption
|
||||
msgid "About Visual PlanIt"
|
||||
msgstr ""
|
||||
@ -254,6 +258,10 @@ msgctxt "TMAINFORM.MNUMAINTENANCE.CAPTION"
|
||||
msgid "Maintenance"
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.mnuprintpreview.caption
|
||||
msgid "Print preview..."
|
||||
msgstr ""
|
||||
|
||||
#: tmainform.mnuquit.caption
|
||||
msgid "Quit"
|
||||
msgstr ""
|
||||
|
@ -202,7 +202,7 @@ constructor TVpPrintPreviewDialog.Create(AOwner: TComponent);
|
||||
begin
|
||||
inherited Create (AOwner);
|
||||
FPlacement.Height := 480;
|
||||
FPlacement.Width := 640;
|
||||
FPlacement.Width := 720;
|
||||
StartDate := Now;
|
||||
EndDate := Now + 7;
|
||||
FZoomFactor := zfFitToControl;
|
||||
|
Reference in New Issue
Block a user