/components/printers/design/printers4lazidetest/main.pas

http://github.com/graemeg/lazarus · Pascal · 71 lines · 31 code · 17 blank · 23 comment · 0 complexity · ce68b4456367e068b45cf805e7fb3f58 MD5 · raw file

  1. { Copyright (C) 2006 Darius Blaszijk
  2. This source is free software; you can redistribute it and/or modify it under
  3. the terms of the GNU General Public License as published by the Free
  4. Software Foundation; either version 2 of the License, or (at your option)
  5. any later version.
  6. This code is distributed in the hope that it will be useful, but WITHOUT ANY
  7. WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS
  8. FOR A PARTICULAR PURPOSE. See the GNU General Public License for more
  9. details.
  10. A copy of the GNU General Public License is available on the World Wide Web
  11. at <http://www.gnu.org/copyleft/gpl.html>. You can also obtain it by writing
  12. to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston,
  13. MA 02111-1307, USA.
  14. }
  15. unit main;
  16. {$mode objfpc}{$H+}
  17. interface
  18. uses
  19. Classes, SysUtils, LResources, Forms, Controls, Graphics, Dialogs, SynEdit,
  20. Buttons, ExtCtrls;
  21. type
  22. { TForm1 }
  23. TForm1 = class(TForm)
  24. Button1: TButton;
  25. SynEdit1: TSynEdit;
  26. procedure Button1Click(Sender: TObject);
  27. procedure FormCreate(Sender: TObject);
  28. private
  29. { private declarations }
  30. public
  31. { public declarations }
  32. end;
  33. var
  34. Form1: TForm1;
  35. implementation
  36. {$R main.lfm}
  37. uses SourcePrinter;
  38. { TForm1 }
  39. procedure TForm1.FormCreate(Sender: TObject);
  40. begin
  41. SynEdit1.Lines.LoadFromFile(UTF8ToSys('main.pas'));
  42. end;
  43. procedure TForm1.Button1Click(Sender: TObject);
  44. var
  45. sp: TSourcePrinter;
  46. begin
  47. sp := TSourcePrinter.Create;
  48. sp.Execute(SynEdit1.Lines);
  49. sp.Free;
  50. end;
  51. end.