You've already forked lazarus-ccr
tvplanit: Restore regular printing code in demo project. Automatic width detection of PrintFormatCombobox in PrintPreviewDlg.
git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4925 8e941d3f-bd1b-0410-a28a-d453659cc2b4
This commit is contained in:
@ -713,7 +713,7 @@ object MainForm: TMainForm
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Current week (dayview)'
|
||||
FormatName = 'Events of current week (dayview)'
|
||||
end
|
||||
item
|
||||
Version = 'v1.04'
|
||||
@ -731,7 +731,7 @@ object MainForm: TMainForm
|
||||
Top = 0
|
||||
Width = 100
|
||||
end>
|
||||
FormatName = 'Current week (Week view)'
|
||||
FormatName = 'Events of current week (Week view)'
|
||||
end>
|
||||
Printer.RightMargin = 5
|
||||
Printer.TopMargin = 5
|
||||
@ -775,9 +775,9 @@ object MainForm: TMainForm
|
||||
CategoryColorMap.Category9.Description = 'Category 9'
|
||||
EnableEventTimer = True
|
||||
PlayEventSounds = True
|
||||
Directory = 'data'
|
||||
AutoConnect = True
|
||||
AutoCreate = True
|
||||
Directory = 'data'
|
||||
left = 312
|
||||
top = 128
|
||||
end
|
||||
|
@ -367,21 +367,9 @@ begin
|
||||
t1 := StartOfTheWeek(now);
|
||||
t2 := t1 + 7 - VpDayView1.NumDays mod 7; // + 7;
|
||||
fmt.DayInc := VpDayView1.NumDays;
|
||||
|
||||
t1 := VpDayView1.Date;
|
||||
t2 := t1; // wp: just for debugging of prt to reduce painting calls
|
||||
fmt.dayInc := 0;
|
||||
|
||||
|
||||
|
||||
|
||||
// wp: !!!!!!!!!!!!!!!!!!!!!!!!!!!! bring back in !!!!!!!!!!!!!
|
||||
|
||||
// VpControlLink1.Printer.Granularity := VpDayView1.Granularity;
|
||||
// VpControlLink1.Printer.DayStart := h_08; //VpDayView1.DefaultTopHour;
|
||||
// VpControlLink1.Printer.DayEnd := h_17;
|
||||
|
||||
|
||||
VpControlLink1.Printer.Granularity := gr30Min;
|
||||
VpControlLink1.Printer.DayStart := h_08;
|
||||
VpControlLink1.Printer.DayEnd := h_18;
|
||||
end;
|
||||
1: begin // current week in WeekView
|
||||
t1 := StartOfTheWeek(now);
|
||||
|
@ -1,18 +1,19 @@
|
||||
object frmPrintPreview: TfrmPrintPreview
|
||||
Left = 285
|
||||
Height = 704
|
||||
Top = 142
|
||||
Left = 325
|
||||
Height = 791
|
||||
Top = 118
|
||||
Width = 539
|
||||
HorzScrollBar.Page = 476
|
||||
VertScrollBar.Page = 517
|
||||
Caption = 'Print Preview'
|
||||
ClientHeight = 704
|
||||
ClientHeight = 791
|
||||
ClientWidth = 539
|
||||
Constraints.MinHeight = 200
|
||||
Constraints.MinWidth = 395
|
||||
KeyPreview = True
|
||||
OnCreate = FormCreate
|
||||
OnKeyDown = FormKeyDown
|
||||
OnShow = FormShow
|
||||
LCLVersion = '1.7'
|
||||
object Panel1: TPanel
|
||||
Left = 0
|
||||
@ -24,7 +25,7 @@ object frmPrintPreview: TfrmPrintPreview
|
||||
ClientWidth = 539
|
||||
TabOrder = 0
|
||||
object cboxZoom: TComboBox
|
||||
Left = 216
|
||||
Left = 296
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 145
|
||||
@ -46,7 +47,7 @@ object frmPrintPreview: TfrmPrintPreview
|
||||
Left = 8
|
||||
Height = 23
|
||||
Top = 32
|
||||
Width = 201
|
||||
Width = 280
|
||||
ItemHeight = 15
|
||||
Sorted = True
|
||||
TabOrder = 1
|
||||
@ -124,7 +125,7 @@ object frmPrintPreview: TfrmPrintPreview
|
||||
end
|
||||
object VpPrintPreview1: TVpPrintPreview
|
||||
Left = 0
|
||||
Height = 642
|
||||
Height = 729
|
||||
Top = 62
|
||||
Width = 539
|
||||
CurPage = 0
|
||||
|
@ -87,6 +87,7 @@ type
|
||||
actLastPage: TAction;
|
||||
actCancel: TAction;
|
||||
|
||||
procedure FormShow(Sender: TObject);
|
||||
procedure OKBtnClick (Sender : TObject);
|
||||
procedure cboxZoomChange(Sender: TObject);
|
||||
procedure actPrintExecute(Sender: TObject);
|
||||
@ -169,6 +170,10 @@ implementation
|
||||
{$R *.dfm}
|
||||
{$ENDIF}
|
||||
|
||||
uses
|
||||
Math,
|
||||
VpPrtFmt;
|
||||
|
||||
procedure TfrmPrintPreview.FormCreate(Sender: TObject);
|
||||
begin
|
||||
ReturnCode := rtAbandon;
|
||||
@ -233,7 +238,7 @@ begin
|
||||
EditForm.VpPrintPreview1.StartDate := StartDate;
|
||||
EditForm.VpPrintPreview1.EndDate := EndDate;
|
||||
EditForm.VpPrintPreview1.ZoomFactor := ZoomFactor;
|
||||
EditForm.cboxZoom.ItemIndex := Integer (ZoomFactor);
|
||||
EditForm.cboxZoom.ItemIndex := Integer(ZoomFactor);
|
||||
EditForm.VpPrintPreview1.Printer := Printer;
|
||||
EditForm.VpPrintPreview1.ForceUpdate;
|
||||
EditForm.VpPrintPreview1.FirstPage;
|
||||
@ -399,5 +404,31 @@ begin
|
||||
actCancel.Execute;
|
||||
end;
|
||||
|
||||
procedure TfrmPrintPreview.FormShow(Sender: TObject);
|
||||
var
|
||||
maxlen: Integer;
|
||||
cnv: TControlCanvas;
|
||||
i: Integer;
|
||||
fmts: TVpPrintFormat;
|
||||
begin
|
||||
if VpPrintPreview1.ControlLink = nil then
|
||||
exit;
|
||||
|
||||
cnv := TControlCanvas.Create;
|
||||
try
|
||||
cnv.Control := VpPrintFormatCombobox1;
|
||||
cnv.Font.Assign(VpPrintFormatCombobox1.Font);
|
||||
cnv.Font.Height := GetRealFontHeight(cnv.Font);
|
||||
maxlen := 0;
|
||||
fmts := VpPrintPreview1.ControlLink.Printer.PrintFormats;
|
||||
for i:=0 to fmts.Count-1 do
|
||||
maxlen := Max(maxlen, cnv.TextWidth(fmts.Items[i].FormatName));
|
||||
VpPrintFormatCombobox1.Width := maxlen + 30;
|
||||
cboxZoom.Left := VpPrintFormatCombobox1.Left + VpPrintFormatCombobox1.Width + 8;
|
||||
finally
|
||||
cnv.Free;
|
||||
end;
|
||||
end;
|
||||
|
||||
end.
|
||||
|
||||
|
Reference in New Issue
Block a user