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
|
Top = 0
|
||||||
Width = 100
|
Width = 100
|
||||||
end>
|
end>
|
||||||
FormatName = 'Current week (dayview)'
|
FormatName = 'Events of current week (dayview)'
|
||||||
end
|
end
|
||||||
item
|
item
|
||||||
Version = 'v1.04'
|
Version = 'v1.04'
|
||||||
@ -731,7 +731,7 @@ object MainForm: TMainForm
|
|||||||
Top = 0
|
Top = 0
|
||||||
Width = 100
|
Width = 100
|
||||||
end>
|
end>
|
||||||
FormatName = 'Current week (Week view)'
|
FormatName = 'Events of current week (Week view)'
|
||||||
end>
|
end>
|
||||||
Printer.RightMargin = 5
|
Printer.RightMargin = 5
|
||||||
Printer.TopMargin = 5
|
Printer.TopMargin = 5
|
||||||
@ -775,9 +775,9 @@ object MainForm: TMainForm
|
|||||||
CategoryColorMap.Category9.Description = 'Category 9'
|
CategoryColorMap.Category9.Description = 'Category 9'
|
||||||
EnableEventTimer = True
|
EnableEventTimer = True
|
||||||
PlayEventSounds = True
|
PlayEventSounds = True
|
||||||
Directory = 'data'
|
|
||||||
AutoConnect = True
|
AutoConnect = True
|
||||||
AutoCreate = True
|
AutoCreate = True
|
||||||
|
Directory = 'data'
|
||||||
left = 312
|
left = 312
|
||||||
top = 128
|
top = 128
|
||||||
end
|
end
|
||||||
|
@ -367,21 +367,9 @@ begin
|
|||||||
t1 := StartOfTheWeek(now);
|
t1 := StartOfTheWeek(now);
|
||||||
t2 := t1 + 7 - VpDayView1.NumDays mod 7; // + 7;
|
t2 := t1 + 7 - VpDayView1.NumDays mod 7; // + 7;
|
||||||
fmt.DayInc := VpDayView1.NumDays;
|
fmt.DayInc := VpDayView1.NumDays;
|
||||||
|
VpControlLink1.Printer.Granularity := gr30Min;
|
||||||
t1 := VpDayView1.Date;
|
VpControlLink1.Printer.DayStart := h_08;
|
||||||
t2 := t1; // wp: just for debugging of prt to reduce painting calls
|
VpControlLink1.Printer.DayEnd := h_18;
|
||||||
fmt.dayInc := 0;
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// wp: !!!!!!!!!!!!!!!!!!!!!!!!!!!! bring back in !!!!!!!!!!!!!
|
|
||||||
|
|
||||||
// VpControlLink1.Printer.Granularity := VpDayView1.Granularity;
|
|
||||||
// VpControlLink1.Printer.DayStart := h_08; //VpDayView1.DefaultTopHour;
|
|
||||||
// VpControlLink1.Printer.DayEnd := h_17;
|
|
||||||
|
|
||||||
|
|
||||||
end;
|
end;
|
||||||
1: begin // current week in WeekView
|
1: begin // current week in WeekView
|
||||||
t1 := StartOfTheWeek(now);
|
t1 := StartOfTheWeek(now);
|
||||||
|
@ -1,18 +1,19 @@
|
|||||||
object frmPrintPreview: TfrmPrintPreview
|
object frmPrintPreview: TfrmPrintPreview
|
||||||
Left = 285
|
Left = 325
|
||||||
Height = 704
|
Height = 791
|
||||||
Top = 142
|
Top = 118
|
||||||
Width = 539
|
Width = 539
|
||||||
HorzScrollBar.Page = 476
|
HorzScrollBar.Page = 476
|
||||||
VertScrollBar.Page = 517
|
VertScrollBar.Page = 517
|
||||||
Caption = 'Print Preview'
|
Caption = 'Print Preview'
|
||||||
ClientHeight = 704
|
ClientHeight = 791
|
||||||
ClientWidth = 539
|
ClientWidth = 539
|
||||||
Constraints.MinHeight = 200
|
Constraints.MinHeight = 200
|
||||||
Constraints.MinWidth = 395
|
Constraints.MinWidth = 395
|
||||||
KeyPreview = True
|
KeyPreview = True
|
||||||
OnCreate = FormCreate
|
OnCreate = FormCreate
|
||||||
OnKeyDown = FormKeyDown
|
OnKeyDown = FormKeyDown
|
||||||
|
OnShow = FormShow
|
||||||
LCLVersion = '1.7'
|
LCLVersion = '1.7'
|
||||||
object Panel1: TPanel
|
object Panel1: TPanel
|
||||||
Left = 0
|
Left = 0
|
||||||
@ -24,7 +25,7 @@ object frmPrintPreview: TfrmPrintPreview
|
|||||||
ClientWidth = 539
|
ClientWidth = 539
|
||||||
TabOrder = 0
|
TabOrder = 0
|
||||||
object cboxZoom: TComboBox
|
object cboxZoom: TComboBox
|
||||||
Left = 216
|
Left = 296
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 145
|
Width = 145
|
||||||
@ -46,7 +47,7 @@ object frmPrintPreview: TfrmPrintPreview
|
|||||||
Left = 8
|
Left = 8
|
||||||
Height = 23
|
Height = 23
|
||||||
Top = 32
|
Top = 32
|
||||||
Width = 201
|
Width = 280
|
||||||
ItemHeight = 15
|
ItemHeight = 15
|
||||||
Sorted = True
|
Sorted = True
|
||||||
TabOrder = 1
|
TabOrder = 1
|
||||||
@ -124,7 +125,7 @@ object frmPrintPreview: TfrmPrintPreview
|
|||||||
end
|
end
|
||||||
object VpPrintPreview1: TVpPrintPreview
|
object VpPrintPreview1: TVpPrintPreview
|
||||||
Left = 0
|
Left = 0
|
||||||
Height = 642
|
Height = 729
|
||||||
Top = 62
|
Top = 62
|
||||||
Width = 539
|
Width = 539
|
||||||
CurPage = 0
|
CurPage = 0
|
||||||
|
@ -87,6 +87,7 @@ type
|
|||||||
actLastPage: TAction;
|
actLastPage: TAction;
|
||||||
actCancel: TAction;
|
actCancel: TAction;
|
||||||
|
|
||||||
|
procedure FormShow(Sender: TObject);
|
||||||
procedure OKBtnClick (Sender : TObject);
|
procedure OKBtnClick (Sender : TObject);
|
||||||
procedure cboxZoomChange(Sender: TObject);
|
procedure cboxZoomChange(Sender: TObject);
|
||||||
procedure actPrintExecute(Sender: TObject);
|
procedure actPrintExecute(Sender: TObject);
|
||||||
@ -169,6 +170,10 @@ implementation
|
|||||||
{$R *.dfm}
|
{$R *.dfm}
|
||||||
{$ENDIF}
|
{$ENDIF}
|
||||||
|
|
||||||
|
uses
|
||||||
|
Math,
|
||||||
|
VpPrtFmt;
|
||||||
|
|
||||||
procedure TfrmPrintPreview.FormCreate(Sender: TObject);
|
procedure TfrmPrintPreview.FormCreate(Sender: TObject);
|
||||||
begin
|
begin
|
||||||
ReturnCode := rtAbandon;
|
ReturnCode := rtAbandon;
|
||||||
@ -399,5 +404,31 @@ begin
|
|||||||
actCancel.Execute;
|
actCancel.Execute;
|
||||||
end;
|
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.
|
end.
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user