PageRenderTime 251ms CodeModel.GetById 22ms RepoModel.GetById 0ms app.codeStats 1ms

/units/printdialogs/MCKPageSetup.pas

http://github.com/rofl0r/KOL
Pascal | 104 lines | 75 code | 28 blank | 1 comment | 15 complexity | d91cebcedddef1efcddda7a687933f54 MD5 | raw file
  1. unit mckPageSetup;
  2. interface
  3. uses
  4. KOL,KOLPageSetupDialog,Windows, Classes,Graphics,
  5. mirror,mckObjs ;
  6. type
  7. TKOLPageSetupDialog = class(TKOLObj)
  8. private
  9. fOptions : TPageSetupOptions;
  10. fAlwaysReset : Boolean;
  11. protected
  12. function AdditionalUnits: string; override;
  13. procedure SetupFirst( SL: TStringList; const AName, AParent, Prefix: String ); override;
  14. procedure SetOptions(const Value : TPageSetupOptions);
  15. procedure SetAlwaysReset(const Value : Boolean);
  16. public
  17. constructor Create( AOwner: TComponent ); override;
  18. destructor Destroy;override;
  19. published
  20. property Options : TPageSetupOptions read fOptions write SetOptions;
  21. property AlwaysReset : Boolean read fAlwaysReset write SetAlwaysReset;
  22. end;
  23. procedure Register;
  24. implementation
  25. {$R *.dcr}
  26. constructor TKOLPageSetupDialog.Create( AOwner: TComponent );
  27. begin
  28. inherited Create(Aowner);
  29. fAlwaysReset := false;
  30. fOptions := [psdMargins,psdOrientation,psdSamplePage,psdPaperControl,psdPrinterControl];
  31. end;
  32. destructor TKOLPageSetupDialog.Destroy;
  33. begin
  34. inherited Destroy;
  35. end;
  36. procedure TKOLPageSetupDialog.SetAlwaysReset(const Value: Boolean);
  37. begin
  38. fAlwaysReset := Value;
  39. Change;
  40. end;
  41. procedure TKOLPageSetupDialog.SetOptions(const Value : TPageSetupOptions);
  42. begin
  43. fOptions := Value;
  44. Change;
  45. end;
  46. function TKOLPageSetupDialog.AdditionalUnits;
  47. begin
  48. Result := ', KOLPageSetupDialog';
  49. end;
  50. procedure TKOLPageSetupDialog.SetupFirst(SL: TStringList; const AName,
  51. AParent, Prefix: String);
  52. var
  53. s : String;
  54. begin
  55. if (psdMargins in fOptions) then s := s + ',psdMargins';
  56. if (psdOrientation in fOptions) then s := s + ',psdOrientation';
  57. if (psdSamplePage in fOptions) then s := s + ',psdSamplePage';
  58. if (psdPaperControl in fOptions) then s := s + ',psdPaperControl';
  59. if (psdPrinterControl in fOptions) then s := s + ',psdPrinterControl';
  60. if (psdHundredthsOfMillimeters in fOptions) then s := s + ',psdHundredthsOfMillimeters';
  61. if (psdThousandthsOfInches in fOptions) then s := s + ',psdThousandthsOfInches';
  62. if (psdUseMargins in fOptions) then s := s + ',psdUseMargins';
  63. if (psdUseMinMargins in fOptions) then s := s + ',psdUseMinMargins';
  64. if (psdWarning in fOptions) then s := s + ',psdWarning';
  65. if (psdHelp in fOptions) then s := s + ',psdHelp';
  66. if (psdReturnDC in fOptions) then s:= s + ',psdReturnDC';
  67. if s <> '' then
  68. if s[1] = ',' then s[1] := Chr(32);
  69. SL.Add(Prefix + AName + ' := NewPageSetupDialog(' + AParent + ',[' + s + ']);');
  70. if fAlwaysReset then SL.Add(Prefix + AName + '.AlwaysReset := True;');
  71. end;
  72. procedure Register;
  73. begin
  74. RegisterComponents('KOL Dialogs', [TKOLPageSetupDialog]);
  75. end;
  76. end.