File: lr_dopt.pas

package info (click to toggle)
lazarus 2.0.0%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 214,460 kB
  • sloc: pascal: 1,862,622; xml: 265,709; cpp: 56,595; sh: 3,008; java: 609; makefile: 535; perl: 297; sql: 222; ansic: 137
file content (130 lines) | stat: -rw-r--r-- 3,350 bytes parent folder | download | duplicates (10)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130

{*****************************************}
{                                         }
{             FastReport v2.3             }
{            Document options             }
{                                         }
{  Copyright (c) 1998-99 by Tzyganenko A. }
{                                         }
{*****************************************}

unit LR_Dopt;

interface

{$I LR_Vers.inc}

uses
  Classes, SysUtils, LResources,
  Forms, Controls, Graphics, Dialogs,
  Buttons, StdCtrls,
  LR_Const, ButtonPanel, ComCtrls;

type

  { TfrDocOptForm }

  TfrDocOptForm = class(TForm)
    ButtonPanel1: TButtonPanel;
    CB1: TCheckBox;
    CB2: TCheckBox;
    edComments: TMemo;
    edAutor: TEdit;
    edtRepCreateDate: TEdit;
    edtRepLastChangeDate: TEdit;
    edtMaj: TEdit;
    edtMinor: TEdit;
    edtRelease: TEdit;
    edtBuild: TEdit;
    edKeyWords: TEdit;
    edSubject: TEdit;
    edTitle: TEdit;
    GroupBox2: TGroupBox;
    GroupBox3: TGroupBox;
    ImageList1: TImageList;
    labComments: TLabel;
    Label1: TLabel;
    Label2: TLabel;
    Label3: TLabel;
    labPrinter: TLabel;
    labMaj: TLabel;
    labMinor: TLabel;
    labRelease: TLabel;
    labBuild: TLabel;
    labKeyWords: TLabel;
    labSubject: TLabel;
    labAutor: TLabel;
    labTitle: TLabel;
    ListBox1: TListBox;
    PageControl1: TPageControl;
    TabSheet1: TTabSheet;
    TabSheet2: TTabSheet;
    procedure FormActivate(Sender: TObject);
    procedure FormCreate(Sender: TObject);
    procedure ListBox1DrawItem({%H-}Control: TWinControl; Index: Integer;
      ARect: TRect; {%H-}State: TOwnerDrawState);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  frDocOptForm: TfrDocOptForm;

implementation

{$R *.lfm}

uses LR_Prntr, math;

procedure TfrDocOptForm.FormActivate(Sender: TObject);
begin
  OnActivate:=nil;
  ListBox1.Items.Assign(Prn.Printers);
  ListBox1.ItemIndex := Prn.PrinterIndex;
  ListBox1.ItemHeight:=Max(ListBox1.Canvas.TextHeight('Wg')+8, 20);
end;

procedure TfrDocOptForm.FormCreate(Sender: TObject);
begin
  PageControl1.ActivePageIndex:=0;
  Caption := sDocOptFormOpt;
  labPrinter.Caption := sDocOptFormPrinter;
  CB1.Caption := sDocOptFormSelect;
  GroupBox2.Caption := sDocOptFormOther;
  CB2.Caption := sDocOptForm2Pass;
  labTitle.Caption:=sDocOptFormTitle;
  labSubject.Caption:=sDocOptFormSubject;
  labKeywords.Caption:=sDocOptFormKeyWords;
  labComments.Caption:=sDocOptFormComments;
  labAutor.Caption:=sDocAutor;
  //Page control
  TabSheet1.Caption:=sDesOptionsFormOpt;
  TabSheet2.Caption:=sDocOptFormOther;

  //Version group box
  GroupBox3.Caption:=sDocVersion;
  labMaj.Caption:=sDocMajor;
  labMinor.Caption:=sDocMinor;
  labRelease.Caption:=sDocRelease;
  labBuild.Caption:=sDocBuild;

  Label1.Caption:=sReportCreateDate;
  Label2.Caption:=sReportLastModifyDate;

end;

procedure TfrDocOptForm.ListBox1DrawItem(Control: TWinControl; Index: Integer;
  ARect: TRect; State: TOwnerDrawState);
begin
  ListBox1.Canvas.FillRect(ARect);       { clear the rectangle }
  if ListBox1.Items.Count > Index then
  begin
    ImageList1.Draw(ListBox1.Canvas, ARect.Left + 2, ARect.Top + 2, 0, True);
    ListBox1.Canvas.TextOut(ARect.Left + 24, (ARect.Top + ARect.Bottom  - ListBox1.Canvas.TextHeight('Wg')) div 2, ListBox1.Items[Index]);  { display the text }
  end;
end;

end.