From 1c6dc6b12332e2b982004b56418fa966f826bc5d Mon Sep 17 00:00:00 2001 From: wp_xxyyzz Date: Wed, 6 Jul 2016 21:49:00 +0000 Subject: [PATCH] tvplanit: Fix preview updating issue in print preview desinger. git-svn-id: https://svn.code.sf.net/p/lazarus-ccr/svn@4929 8e941d3f-bd1b-0410-a28a-d453659cc2b4 --- .../tvplanit/examples/demo/demomain.lfm | 17 ++--- .../tvplanit/examples/demo/demomain.lrt | 1 - .../tvplanit/examples/demo/demomain.pas | 5 +- components/tvplanit/languages/demo.de.po | 4 - components/tvplanit/languages/demo.po | 4 - components/tvplanit/languages/vpsr.de.po | 8 +- components/tvplanit/languages/vpsr.nl.po | 4 +- components/tvplanit/languages/vpsr.po | 4 +- components/tvplanit/languages/vpsr.ru.po | 4 +- components/tvplanit/source/vpedfmtlst.lfm | 74 ++++++++++--------- components/tvplanit/source/vpedfmtlst.pas | 59 ++++++++++++--- components/tvplanit/source/vpprtfmtdlg.pas | 15 ++-- components/tvplanit/source/vpprtprv.pas | 43 +++++------ components/tvplanit/source/vpprtprvdlg.lfm | 26 +++---- components/tvplanit/source/vpprtprvdlg.pas | 49 ++++++------ components/tvplanit/source/vpsr.inc | 4 +- 16 files changed, 172 insertions(+), 149 deletions(-) diff --git a/components/tvplanit/examples/demo/demomain.lfm b/components/tvplanit/examples/demo/demomain.lfm index 3a631ae34..982b4ee63 100644 --- a/components/tvplanit/examples/demo/demomain.lfm +++ b/components/tvplanit/examples/demo/demomain.lfm @@ -25,9 +25,9 @@ object MainForm: TMainForm Height = 532 Top = 48 Width = 780 - ActivePage = TabEvents + ActivePage = TabSettings Align = alClient - TabIndex = 0 + TabIndex = 4 TabOrder = 0 object TabEvents: TTabSheet Caption = 'Events' @@ -521,15 +521,6 @@ object MainForm: TMainForm Caption = 'Drawing style:' ParentColor = False end - object ComboBox1: TComboBox - Left = 10 - Height = 23 - Top = 10 - Width = 100 - ItemHeight = 15 - TabOrder = 5 - Text = 'ComboBox1' - end object CbDrawingStyle: TComboBox Left = 439 Height = 23 @@ -544,7 +535,7 @@ object MainForm: TMainForm ) OnChange = CbDrawingStyleChange Style = csDropDownList - TabOrder = 6 + TabOrder = 5 Text = 'flat' end end @@ -707,6 +698,7 @@ object MainForm: TMainForm Caption.Font.Style = [fsItalic] DayOffset = 0 DayOffsetUnits = duDay + ElementName = 'DayView' Height = 100 Left = 0 Shape.Shape = ustRectangle @@ -724,6 +716,7 @@ object MainForm: TMainForm Version = 'v1.04' DayOffset = 0 DayOffsetUnits = duDay + ElementName = 'WeekView' Height = 100 ItemType = itWeekView Left = 0 diff --git a/components/tvplanit/examples/demo/demomain.lrt b/components/tvplanit/examples/demo/demomain.lrt index 86bbd4581..9ec4b00a6 100644 --- a/components/tvplanit/examples/demo/demomain.lrt +++ b/components/tvplanit/examples/demo/demomain.lrt @@ -19,7 +19,6 @@ TMAINFORM.CBALLOWINPLACEEDITING.CAPTION=Allow inplace editing TMAINFORM.LBLADDRESSBUILDER.CAPTION=Address builder TMAINFORM.CBADDRESSBUILDER.TEXT=(default) TMAINFORM.LBLDRAWINGSTYLE.CAPTION=Drawing style: -TMAINFORM.COMBOBOX1.TEXT=ComboBox1 TMAINFORM.CBDRAWINGSTYLE.TEXT=flat TMAINFORM.TITLELBL.CAPTION=TitleLbl TMAINFORM.MENUITEM1.CAPTION=File diff --git a/components/tvplanit/examples/demo/demomain.pas b/components/tvplanit/examples/demo/demomain.pas index 3c922e495..cb4496bd7 100644 --- a/components/tvplanit/examples/demo/demomain.pas +++ b/components/tvplanit/examples/demo/demomain.pas @@ -24,7 +24,6 @@ type CbFirstDayOfWeek: TComboBox; CbAllowInplaceEditing: TCheckBox; CbAddressBuilder: TComboBox; - ComboBox1: TComboBox; CbDrawingStyle: TComboBox; Img: TImage; ImageList1: TImageList; @@ -359,6 +358,7 @@ end; procedure TMainForm.MnuEditPrintFormatsClick(Sender: TObject); begin + VpPrintFormatEditDialog1.DrawingStyle := VpWeekView1.DrawingStyle; VpPrintFormatEditDialog1.Execute; end; @@ -387,7 +387,8 @@ begin VpPrintPreviewDialog1.ControlLink := VpControlLink1; VpPrintPreviewDialog1.Printer := Printer; VpPrintPreviewDialog1.StartDate := t1; - VPPrintPreviewDialog1.EndDate := t2; + VpPrintPreviewDialog1.EndDate := t2; + VpPrintPreviewDialog1.DrawingStyle := VpDayView1.DrawingStyle; if VpPrintPreviewDialog1.Execute then if PrintDialog1.Execute then begin Printer.BeginDoc; diff --git a/components/tvplanit/languages/demo.de.po b/components/tvplanit/languages/demo.de.po index 29f6f205c..509206c60 100644 --- a/components/tvplanit/languages/demo.de.po +++ b/components/tvplanit/languages/demo.de.po @@ -215,10 +215,6 @@ msgstr "" msgid "30 Min" msgstr "30 Min" -#: tmainform.combobox1.text -msgid "ComboBox1" -msgstr "" - #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "Aufbau der Adresse:" diff --git a/components/tvplanit/languages/demo.po b/components/tvplanit/languages/demo.po index be3b118f0..0cb9e750b 100644 --- a/components/tvplanit/languages/demo.po +++ b/components/tvplanit/languages/demo.po @@ -204,10 +204,6 @@ msgstr "" msgid "30 Min" msgstr "" -#: tmainform.combobox1.text -msgid "ComboBox1" -msgstr "" - #: tmainform.lbladdressbuilder.caption msgid "Address builder" msgstr "" diff --git a/components/tvplanit/languages/vpsr.de.po b/components/tvplanit/languages/vpsr.de.po index 5be8533ed..e3ea6a668 100644 --- a/components/tvplanit/languages/vpsr.de.po +++ b/components/tvplanit/languages/vpsr.de.po @@ -584,8 +584,8 @@ msgid "M" msgstr "M" #: vpsr.rsloadfilebtn -msgid "Load file" -msgstr "Datei laden" +msgid "Load file..." +msgstr "Datei laden..." #: vpsr.rslocationlbl msgid "Location:" @@ -936,8 +936,8 @@ msgid "Saturday" msgstr "Samstag" #: vpsr.rssavefilebtn -msgid "Save file" -msgstr "Datei speichern" +msgid "Save file..." +msgstr "Datei speichern..." #: vpsr.rsselectasound msgid "Select A Sound" diff --git a/components/tvplanit/languages/vpsr.nl.po b/components/tvplanit/languages/vpsr.nl.po index 56cf40465..bbc8c63d1 100644 --- a/components/tvplanit/languages/vpsr.nl.po +++ b/components/tvplanit/languages/vpsr.nl.po @@ -585,7 +585,7 @@ msgid "M" msgstr "M" #: vpsr.rsloadfilebtn -msgid "Load file" +msgid "Load file..." msgstr "" #: vpsr.rslocationlbl @@ -937,7 +937,7 @@ msgid "Saturday" msgstr "Zaterdag" #: vpsr.rssavefilebtn -msgid "Save file" +msgid "Save file..." msgstr "" #: vpsr.rsselectasound diff --git a/components/tvplanit/languages/vpsr.po b/components/tvplanit/languages/vpsr.po index f6cc10eed..4ed5431e5 100644 --- a/components/tvplanit/languages/vpsr.po +++ b/components/tvplanit/languages/vpsr.po @@ -574,7 +574,7 @@ msgid "M" msgstr "" #: vpsr.rsloadfilebtn -msgid "Load file" +msgid "Load file..." msgstr "" #: vpsr.rslocationlbl @@ -926,7 +926,7 @@ msgid "Saturday" msgstr "" #: vpsr.rssavefilebtn -msgid "Save file" +msgid "Save file..." msgstr "" #: vpsr.rsselectasound diff --git a/components/tvplanit/languages/vpsr.ru.po b/components/tvplanit/languages/vpsr.ru.po index 6137ccc4f..f4257de1c 100644 --- a/components/tvplanit/languages/vpsr.ru.po +++ b/components/tvplanit/languages/vpsr.ru.po @@ -589,7 +589,7 @@ msgid "M" msgstr "" #: vpsr.rsloadfilebtn -msgid "Load file" +msgid "Load file..." msgstr "" #: vpsr.rslocationlbl @@ -953,7 +953,7 @@ msgid "Saturday" msgstr "Суббота" #: vpsr.rssavefilebtn -msgid "Save file" +msgid "Save file..." msgstr "" #: vpsr.rsselectasound diff --git a/components/tvplanit/source/vpedfmtlst.lfm b/components/tvplanit/source/vpedfmtlst.lfm index 08883f29b..8b0c07291 100644 --- a/components/tvplanit/source/vpedfmtlst.lfm +++ b/components/tvplanit/source/vpedfmtlst.lfm @@ -2,12 +2,12 @@ object frmPrnFormat: TfrmPrnFormat Left = 250 Height = 480 Top = 165 - Width = 640 + Width = 693 HorzScrollBar.Page = 639 VertScrollBar.Page = 479 Caption = 'Print Format Designer' ClientHeight = 480 - ClientWidth = 640 + ClientWidth = 693 OnCloseQuery = FormCloseQuery OnCreate = FormCreate OnShow = FormShow @@ -25,16 +25,16 @@ object frmPrnFormat: TfrmPrnFormat object LblElements: TLabel Left = 8 Height = 15 - Top = 205 + Top = 225 Width = 51 Caption = 'Ele&ments:' FocusControl = lbElements ParentColor = False end object btnMoveElementUp: TSpeedButton - Left = 248 + Left = 305 Height = 22 - Top = 352 + Top = 375 Width = 23 Glyph.Data = { 76010000424D7601000000000000760000002800000020000000100000000100 @@ -54,9 +54,9 @@ object frmPrnFormat: TfrmPrnFormat OnClick = btnMoveElementUpClick end object btnMoveElementDn: TSpeedButton - Left = 248 + Left = 305 Height = 22 - Top = 380 + Top = 403 Width = 23 Glyph.Data = { 76010000424D7601000000000000760000002800000020000000100000000100 @@ -76,17 +76,17 @@ object frmPrnFormat: TfrmPrnFormat OnClick = btnMoveElementDnClick end object LblPrintOrder: TLabel - Left = 232 + Left = 289 Height = 15 - Top = 332 + Top = 355 Width = 58 Caption = 'Print Order' ParentColor = False end object btnNewFormat: TButton - Left = 223 + Left = 280 Height = 25 - Top = 27 + Top = 25 Width = 75 Caption = '&New' Enabled = False @@ -94,21 +94,21 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 1 end object PrintPreviewPanel: TPanel - Left = 312 + Left = 365 Height = 439 Top = 0 Width = 320 Align = alRight BorderSpacing.Right = 8 - Caption = 'PrintPreviewPanel' + BevelOuter = bvNone ClientHeight = 439 ClientWidth = 320 TabOrder = 8 object PrintPreview: TVpPrintPreview - Left = 1 - Height = 437 - Top = 1 - Width = 318 + Left = 0 + Height = 439 + Top = 0 + Width = 320 CurPage = 0 EndDate = 37377.6447728357 StartDate = 37370.6447728357 @@ -121,9 +121,10 @@ object frmPrnFormat: TfrmPrnFormat end object lbFormats: TListBox Left = 8 - Height = 173 + Height = 191 Top = 25 - Width = 201 + Width = 257 + Columns = 1 ItemHeight = 0 OnClick = lbFormatsClick Sorted = True @@ -131,9 +132,9 @@ object frmPrnFormat: TfrmPrnFormat end object lbElements: TListBox Left = 8 - Height = 180 - Top = 225 - Width = 201 + Height = 193 + Top = 246 + Width = 257 ItemHeight = 0 OnClick = lbElementsClick OnDragDrop = lbElementsDragDrop @@ -142,9 +143,9 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 4 end object btnEditFormat: TButton - Left = 223 + Left = 280 Height = 25 - Top = 63 + Top = 61 Width = 75 Caption = '&Edit' Enabled = False @@ -152,9 +153,9 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 2 end object btnDeleteFormat: TButton - Left = 223 + Left = 280 Height = 25 - Top = 99 + Top = 97 Width = 75 Caption = '&Delete' Enabled = False @@ -162,9 +163,9 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 3 end object btnNewElement: TButton - Left = 223 + Left = 280 Height = 25 - Top = 223 + Top = 246 Width = 75 Caption = 'Ne&w' Enabled = False @@ -172,9 +173,9 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 5 end object btnEditElement: TButton - Left = 223 + Left = 280 Height = 25 - Top = 259 + Top = 282 Width = 75 Caption = 'E&dit' Enabled = False @@ -182,23 +183,24 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 6 end object btnDeleteElement: TButton - Left = 223 + Left = 280 Height = 25 - Top = 295 + Top = 318 Width = 75 Caption = 'De&lete' Enabled = False OnClick = btnDeleteElementClick TabOrder = 7 end - object Panel2: TPanel + object ButtonPanel: TPanel Left = 0 Height = 41 Top = 439 - Width = 640 + Width = 693 Align = alBottom + BevelOuter = bvNone ClientHeight = 41 - ClientWidth = 640 + ClientWidth = 693 TabOrder = 9 object btnLoadFile: TButton Left = 88 @@ -228,7 +230,7 @@ object frmPrnFormat: TfrmPrnFormat TabOrder = 0 end object btnOk: TButton - Left = 556 + Left = 609 Height = 25 Top = 8 Width = 75 diff --git a/components/tvplanit/source/vpedfmtlst.pas b/components/tvplanit/source/vpedfmtlst.pas index d11c02fdf..fa74a7499 100644 --- a/components/tvplanit/source/vpedfmtlst.pas +++ b/components/tvplanit/source/vpedfmtlst.pas @@ -68,7 +68,7 @@ type lbFormats: TListBox; OpenDialog1: TOpenDialog; PrintPreviewPanel: TPanel; - Panel2: TPanel; + ButtonPanel: TPanel; PrintPreview: TVpPrintPreview; SaveDialog1: TSaveDialog; btnOk: TButton; @@ -102,7 +102,9 @@ type IsDirty: Boolean; LastX, LastY: Integer; DragItem: Integer; + FDrawingStyle: TVpDrawingStyle; procedure SetCaptions; + procedure SetDrawingStyle(const v: TVpDrawingStyle); protected function DirtyPrompt: Integer; @@ -115,6 +117,7 @@ type procedure EnableElementButtons(Enable: Boolean); procedure EnableFormatButtons(Enable: Boolean); procedure EnableMoveButtons; + procedure RebuildPreview; procedure SetFormatFileName(const v: string); procedure UpdateFormats; procedure UpdateCaption; @@ -124,8 +127,9 @@ type procedure SetControlLink(const Value: TVpControlLink); public - function Execute : Boolean; - property ControlLink : TVpControlLink read FControlLink write SetControlLink; + function Execute: Boolean; + property ControlLink: TVpControlLink read FControlLink write SetControlLink; + property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle; published property FormatFileName : string read FFormatFileName write SetFormatFileName; @@ -578,10 +582,7 @@ begin Prn.CurFormat := Idx; PrintPreview.ControlLink := ControlLink; - PrintPreview.ForceUpdate; - PrintPreview.FirstPage; - // PrintPreview.Invalidate; - + RebuildPreview; for i := 0 to Pred(Prn.PrintFormats.Items[Idx].Elements.Count) do begin E := Prn.PrintFormats.Items[Idx].Elements.Items[i]; @@ -636,7 +637,13 @@ begin LastY := Y; Accept := True; end; -{=====} + +procedure TfrmPrnFormat.RebuildPreview; +begin + PrintPreview.ForceUpdate; + PrintPreview.FirstPage; +end; + procedure TfrmPrnFormat.SetControlLink(const Value: TVpControlLink); begin if FControlLink <> Value then begin @@ -649,7 +656,7 @@ end; procedure TfrmPrnFormat.SetCaptions; var cnv: TControlCanvas; - w: Integer; + i, w: Integer; wPrv: Integer; begin wPrv := PrintPreview.Width; @@ -676,7 +683,7 @@ begin cnv.Font.Assign(btnNewFile.Font); w := Max(w, cnv.TextWidth(RSNewFileBtn)); w := Max(w, cnv.TextWidth(RSLoadFileBtn)); - w := Max(W, cnv.TextWidth(RSSaveFileBtn)); + w := Max(w, cnv.TextWidth(RSSaveFileBtn)); btnNewFile.Width := w + 16; btnLoadFile.Left := btnNewFile.Left + btnNewFile.Width + 8; btnLoadFile.Width := btnNewFile.Width; @@ -713,6 +720,15 @@ begin end; end; +procedure TfrmPrnFormat.SetDrawingStyle(const v: TVpDrawingStyle); +begin + FDrawingStyle := v; + if FDrawingStyle = dsNoBorder then + PrintPreview.BorderStyle := bsNone else + PrintPreview.BorderStyle := bsSingle; + PrintPreview.DrawingStyle := FDrawingStyle; +end; + procedure TfrmPrnFormat.SetFormatFileName(const v: string); begin if v <> FFormatFileName then begin @@ -731,10 +747,32 @@ procedure TfrmPrnFormat.UpdateFormats; var i: Integer; Prn: TVpPrinter; + w: Integer; + cnv: TControlCanvas; begin Prn := ControlLink.Printer; for i := 0 to Pred(Prn.PrintFormats.Count) do lbFormats.Items.AddObject(Prn.PrintFormats.Items[i].FormatName, Prn.PrintFormats.Items[i]); + + // Show a horizontal scrollbar if list items are too wide + w := 0; + cnv := TControlCanvas.Create; + try + cnv.Control := lbFormats; + cnv.Font := lbFormats.Font; + w := 0; + for i:=0 to lbFormats.Items.Count-1 do + w := Max(w, cnv.TextWidth(lbFormats.Items[i])); + lbFormats.ScrollWidth := w + 8; + + w := 0; + for i:=0 to lbElements.Items.Count-1 do + w := Max(w, cnv.TextWidth(lbElements.Items[i])); + lbElements.ScrollWidth := w + 8; + finally + cnv.Free; + end; + EnableMoveButtons; end; {=====} @@ -752,6 +790,7 @@ begin end; Prn.NotifyLinked; EnableMoveButtons; + RebuildPreview; end; {=====} diff --git a/components/tvplanit/source/vpprtfmtdlg.pas b/components/tvplanit/source/vpprtfmtdlg.pas index bc4060aaa..8884652de 100644 --- a/components/tvplanit/source/vpprtfmtdlg.pas +++ b/components/tvplanit/source/vpprtfmtdlg.pas @@ -49,20 +49,19 @@ type TVpPrintFormatEditDialog = class (TVpBaseDialog) private FControlLink: TVpControlLink; + FDrawingStyle: TVpDrawingStyle; FWindowState: TWindowState; protected procedure Notification(AComponent: TComponent; Operation: TOperation); override; procedure SetControlLink(const Value: TVpControlLink); public - constructor Create (AOwner : TComponent); override; - function Execute : Boolean; override; + constructor Create(AOwner: TComponent); override; + function Execute: Boolean; override; published - property ControlLink : TVpControlLink - read FControlLink write SetControlLink; - - property WindowState : TWindowState - read FWindowState write FWindowState default wsNormal; + property ControlLink : TVpControlLink read FControlLink write SetControlLink; + property DrawingStyle: TVpDrawingStyle read FDrawingStyle write FDrawingStyle default ds3d; + property WindowState : TWindowState read FWindowState write FWindowState default wsNormal; property Options; property Placement; @@ -78,6 +77,7 @@ constructor TVpPrintFormatEditDialog.Create(AOwner: TComponent); begin inherited Create(AOwner); FControlLink := SearchControlLink (Owner); + FDrawingStyle := ds3d; FPlacement.Height := 480; FPlacement.Width := 640; @@ -93,6 +93,7 @@ begin DoFormPlacement(PrtFmtDlg); PrtFmtDlg.WindowState := WindowState; PrtFmtDlg.ControlLink := ControlLink; + PrtFmtDlg.DrawingStyle := FDrawingStyle; Result := PrtFmtDlg.Execute; finally PrtFmtDlg.Free; diff --git a/components/tvplanit/source/vpprtprv.pas b/components/tvplanit/source/vpprtprv.pas index 0f5a61aa3..7cc07c974 100644 --- a/components/tvplanit/source/vpprtprv.pas +++ b/components/tvplanit/source/vpprtprv.pas @@ -773,37 +773,28 @@ var end; procedure DrawBorders; + var + R: TRect; begin if FBorderStyle = bsSingle then begin + R := ClientRect; if FDrawingStyle = dsFlat then begin - { draw an outer and inner bevel } - DrawBevelRect( - WorkBmp.Canvas, - Rect(ClientRect.Left, ClientRect.Top, ClientRect.Right - 1, ClientRect.Bottom - 1), - clBtnShadow, - clBtnHighlight - ); - DrawBevelRect( - WorkBmp.Canvas, - Rect(ClientRect.Left + 1, ClientRect.Top + 1, ClientRect.Right - 2, ClientRect.Bottom - 2), - clBtnHighlight, - clBtnShadow - ); + // Draw a simple rectangular border + //InflateRect(R, 1, 1); + DrawBevelRect(WorkBmp.Canvas, R, clBtnShadow, clBtnShadow); + { + DrawBevelRect(WorkBmp.Canvas, R, clBtnShadow, clBtnHighlight); + InflateRect(R, 1,1); + DrawBevelRect(WorkBmp.Canvas, R, clBtnHighlight, clBtnShadow); + } end else if FDrawingStyle = ds3d then begin - { draw a 3d bevel } - DrawBevelRect( - WorkBmp.Canvas, - Rect(ClientRect.Left, ClientRect.Top, ClientRect.Right - 1, ClientRect.Bottom - 1), - clBtnShadow, - clBtnHighlight - ); - DrawBevelRect( - WorkBmp.Canvas, - Rect(ClientRect.Left + 1, ClientRect.Top + 1, ClientRect.Right - 2, ClientRect.Bottom - 2), - cl3DDkShadow, - clBtnFace - ); + // Draw a 3d bevel + dec(R.Right); + dec(R.Bottom); + DrawBevelRect(WorkBmp.Canvas, R, clBtnShadow, clBtnHighlight); + InflateRect(R, -1, -1); + DrawBevelRect(WorkBmp.Canvas, R, cl3DDkShadow, clBtnFace); end; end; end; diff --git a/components/tvplanit/source/vpprtprvdlg.lfm b/components/tvplanit/source/vpprtprvdlg.lfm index 76b17e648..523c474c5 100644 --- a/components/tvplanit/source/vpprtprvdlg.lfm +++ b/components/tvplanit/source/vpprtprvdlg.lfm @@ -1,13 +1,13 @@ object frmPrintPreview: TfrmPrintPreview Left = 325 - Height = 791 + Height = 818 Top = 118 - Width = 539 + Width = 540 HorzScrollBar.Page = 476 VertScrollBar.Page = 517 Caption = 'Print Preview' - ClientHeight = 791 - ClientWidth = 539 + ClientHeight = 818 + ClientWidth = 540 Constraints.MinHeight = 200 Constraints.MinWidth = 395 KeyPreview = True @@ -19,10 +19,10 @@ object frmPrintPreview: TfrmPrintPreview Left = 0 Height = 62 Top = 0 - Width = 539 + Width = 540 Align = alTop ClientHeight = 62 - ClientWidth = 539 + ClientWidth = 540 TabOrder = 0 object cboxZoom: TComboBox Left = 296 @@ -57,7 +57,7 @@ object frmPrintPreview: TfrmPrintPreview Left = 1 Height = 27 Top = 1 - Width = 537 + Width = 538 AutoSize = True ButtonHeight = 25 ButtonWidth = 25 @@ -125,9 +125,9 @@ object frmPrintPreview: TfrmPrintPreview end object VpPrintPreview1: TVpPrintPreview Left = 0 - Height = 729 + Height = 756 Top = 62 - Width = 539 + Width = 540 CurPage = 0 EndDate = 37355.4526088079 StartDate = 37348.4526088079 @@ -137,8 +137,8 @@ object frmPrintPreview: TfrmPrintPreview TabOrder = 1 end object imMain: TImageList - left = 357 - top = 195 + left = 272 + top = 160 Bitmap = { 4C690600000010000000100000005B4848005B4848005B484800564343008679 799CD1CDCDF3D1CDCDEFD0CCCCEFD1CCCCEFD2CDCDEFD3CDCDF38E8181A75747 @@ -338,8 +338,8 @@ object frmPrintPreview: TfrmPrintPreview object actMain: TActionList Images = imMain OnUpdate = actMainUpdate - left = 272 - top = 152 + left = 192 + top = 160 object actPrint: TAction Caption = '&Print' Hint = 'Print' diff --git a/components/tvplanit/source/vpprtprvdlg.pas b/components/tvplanit/source/vpprtprvdlg.pas index 81b54f33e..fa740c888 100644 --- a/components/tvplanit/source/vpprtprvdlg.pas +++ b/components/tvplanit/source/vpprtprvdlg.pas @@ -38,26 +38,11 @@ uses {$ELSE} Windows, Messages, {$ENDIF} - SysUtils, - Classes, - Graphics, - Controls, - Forms, - Dialogs, - StdCtrls, - ExtCtrls, + SysUtils, Classes, Graphics, Controls, Forms, Dialogs, StdCtrls, ExtCtrls, + Buttons, Printers, ImgList, ComCtrls, ToolWin, ActnList, {$IFDEF VERSION6} Variants, {$ENDIF} - VpMisc, - VpBase, - VpException, - VpData, - VpPrtPrv, - VpSR, - VpBaseDS, - VpDlg, - Buttons, - VpPrtFmtCBox, - Printers, ImgList, ComCtrls, ToolWin, ActnList; + VpMisc, VpBase, VpException, VpData, VpPrtPrv, VpSR, VpBaseDS, VpDlg, + VpPrtFmtCBox; type TVpPrintPreviewDialog = class; @@ -102,12 +87,15 @@ type procedure VpPrintFormatComboBox1Change(Sender: TObject); private + FDrawingStyle: TVpDrawingStyle; procedure SetCaptions; + procedure SetDrawingStyle(AValue: TVpDrawingStyle); public Resource: TVpResource; Contact: TVpContact; ReturnCode: TVpEditorReturnCode; + property DrawingStyle: TVpDrawingStyle read FDrawingStyle write SetDrawingStyle; end; TVpPrintPreviewDialog = class (TVpBaseDialog) @@ -115,6 +103,7 @@ type FControlLink: TVpControlLink; FAutoPrint: Boolean; FBottomMargin: Extended; + FDrawingStyle: TVpDrawingStyle; FEndDate: TDateTime; FLeftMargin: Extended; FMarginUnits: TVpItemMeasurement; @@ -148,6 +137,7 @@ type property AutoPrint: Boolean read FAutoPrint write SetAutoPrint default False; property BottomMargin: Extended read FBottomMargin write SetBottomMargin; property ControlLink: TVpControlLink read FControlLink write SetControlLink; + property DrawingStyle: TVpDrawingStyle read FDrawingStyle write FDrawingStyle default ds3D; property EndDate: TDateTime read FEndDate write SetEndDate; property LeftMargin: Extended read FLeftMargin write SetLeftMargin; property MarginUnits: TVpItemMeasurement read FMarginUnits write SetMarginUnits default imInches; @@ -174,6 +164,8 @@ uses Math, VpPrtFmt; +{ TfrmPrintPreview } + procedure TfrmPrintPreview.FormCreate(Sender: TObject); begin ReturnCode := rtAbandon; @@ -197,19 +189,30 @@ begin actCancel.Hint := RSPrintPrvCancelHint; end; +procedure TfrmPrintPreview.SetDrawingStyle(AValue: TVpDrawingStyle); +begin + FDrawingStyle := AValue; + if FDrawingStyle = dsNoBorder then + VpPrintPreview1.BorderStyle := bsNone else + VpPrintPreview1.BorderStyle := bsSingle; + VpPrintPreview1.DrawingStyle := FDrawingStyle; +end; + procedure TfrmPrintPreview.VpPrintFormatComboBox1Change(Sender: TObject); begin VpPrintPreview1.ForceUpdate; VpPrintPreview1.FirstPage; end; - procedure TfrmPrintPreview.OKBtnClick(Sender: TObject); begin ReturnCode := rtCommit; Close; end; + +{ TVpPrintPreviewDialog } + constructor TVpPrintPreviewDialog.Create(AOwner: TComponent); begin inherited Create (AOwner); @@ -222,6 +225,7 @@ begin FAutoPrint := False; FControlLink := SearchControlLink(Owner); FPrinter := Printer; + DrawingStyle := ds3D; end; function TVpPrintPreviewDialog.Execute: Boolean; @@ -229,7 +233,7 @@ var EditForm: TfrmPrintPreview; begin Result := False; - Application.CreateForm(TfrmPrintPreview, EditForm); + EditForm := TfrmPrintPreview.Create(Application); try DoFormPlacement(EditForm); EditForm.WindowState := WindowState; @@ -242,6 +246,7 @@ begin EditForm.VpPrintPreview1.Printer := Printer; EditForm.VpPrintPreview1.ForceUpdate; EditForm.VpPrintPreview1.FirstPage; + EditForm.DrawingStyle := FDrawingStyle; EditForm.ShowModal; if EditForm.ReturnCode = rtCommit then begin Result := True; @@ -255,7 +260,7 @@ begin end; end; finally - EditForm.Release; + EditForm.Free; end; end; diff --git a/components/tvplanit/source/vpsr.inc b/components/tvplanit/source/vpsr.inc index 664381837..965cef8c9 100644 --- a/components/tvplanit/source/vpsr.inc +++ b/components/tvplanit/source/vpsr.inc @@ -413,8 +413,8 @@ resourcestring RSDeleteBtn = 'Delete'; RSPrintOrder = 'Print order'; RSNewFileBtn = 'New file'; - RSLoadFileBtn = 'Load file'; - RSSaveFileBtn = 'Save file'; + RSLoadFileBtn = 'Load file...'; + RSSaveFileBtn = 'Save file...'; { Automatic resource adding/selection} {!!.01} RSAddNewResource = 'No resources have been defined. Would you ' + {!!.01}