File: frmfprdresizeelements.pp

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 (156 lines) | stat: -rw-r--r-- 4,042 bytes parent folder | download | duplicates (6)
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
{
    This file is part of the Free Component Library.
    Copyright (c) 2017 Michael Van Canneyt, member of the Free Pascal development team

    form for resizing report elements.

    See the file COPYING.FPC, included in this distribution,
    for details about the copyright.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.

 **********************************************************************}
unit frmfprdresizeelements;

{$mode objfpc}{$H+}

interface

uses
  Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ButtonPanel,
  StdCtrls, Spin, fpreport, fpreportdesignobjectlist, reportdesignbaseforms;

type

  { TResizeElementsForm }
  TForm = TBaseReportResizeForm;

  TResizeElementsForm = class(TForm)
    BPResize: TButtonPanel;
    FSEHorizontal: TFloatSpinEdit;
    FSEVertical: TFloatSpinEdit;
    GBHorizontal: TGroupBox;
    GBVertical: TGroupBox;
    RBHParentSize: TRadioButton;
    RBHNone: TRadioButton;
    RBHFixed: TRadioButton;
    RBVParentSize: TRadioButton;
    RBVNone: TRadioButton;
    RBVFixed: TRadioButton;
    RBVLargest: TRadioButton;
    RBHSmallest: TRadioButton;
    RBHLargest: TRadioButton;
    RBVSmallest: TRadioButton;
    procedure RBHFixedClick(Sender: TObject);
    procedure RBVNoneClick(Sender: TObject);
  protected
    function GetH: TSizeAdjust; override;
    function GetHS: TFPReportUnits; override;
    function GetV: TSizeAdjust; override;
    function GetVS: TFPReportUnits; override;
    procedure SetH(AValue: TSizeAdjust);override;
    procedure SetHS(AValue: TFPReportUnits);override;
    procedure SetV(AValue: TSizeAdjust);override;
    procedure SetVS(AValue: TFPReportUnits);override;
  public
    Property Horizontal : TSizeAdjust Read GetH Write SetH;
    Property Vertical : TSizeAdjust Read GetV Write SetV;
    Property HorizontalSize : TFPReportUnits Read GetHS Write SetHS;
    Property VerticalSize : TFPReportUnits Read GetVS Write SetVS;
  end;


implementation

{$R *.lfm}

{ TResizeElementsForm }

procedure TResizeElementsForm.RBHFixedClick(Sender: TObject);
begin
  FSEHorizontal.Enabled:=RBHFixed.Checked;
end;

procedure TResizeElementsForm.RBVNoneClick(Sender: TObject);
begin
  FSEVertical.Enabled:=RBVFixed.Checked;
end;

function TResizeElementsForm.GetH: TSizeAdjust;
begin
  if RBHSmallest.Checked then
    Result:=saSmallest
  else if RBHLargest.Checked then
    Result:=saLargest
  else if RBHFixed.Checked then
    Result:=saValue
  else if RBHParentSize.Checked then
    Result:=saParent
  else
    Result:=saNone;
end;

function TResizeElementsForm.GetHS: TFPReportUnits;
begin
  Result:=FSEHorizontal.Value;
end;

function TResizeElementsForm.GetV: TSizeAdjust;
begin
  if RBVSmallest.Checked then
    Result:=saSmallest
  else if RBVLargest.Checked then
    Result:=saLargest
  else if RBVFixed.Checked then
    Result:=saValue
  else if RBVParentSize.Checked then
    Result:=saParent
  else
    Result:=saNone;
end;

function TResizeElementsForm.GetVS: TFPReportUnits;
begin
  Result:=FSEVertical.Value;
end;

procedure TResizeElementsForm.SetH(AValue: TSizeAdjust);
begin
  Case AValue of
    saLargest  : RBHLargest.Checked:=True;
    saSmallest : RBHSmallest.Checked:=True;
    saValue    : RBHFixed.Checked:=True;
    saParent   : RBHParentSize.Checked:=True;
  else
    RBHNone.Checked:=True;
  end;
end;

procedure TResizeElementsForm.SetHS(AValue: TFPReportUnits);
begin
  FSEHorizontal.Value:=Avalue;
end;

procedure TResizeElementsForm.SetV(AValue: TSizeAdjust);
begin
  Case AValue of
    saLargest  : RBVLargest.Checked:=True;
    saSmallest : RBVSmallest.Checked:=True;
    saValue    : RBVFixed.Checked:=True;
    saParent   : RBVParentSize.Checked:=True;
  else
    RBVNone.Checked:=True;
  end;
end;

procedure TResizeElementsForm.SetVS(AValue: TFPReportUnits);
begin
  FSEVertical.Value:=AValue
end;

initialization
  ReportResizeFormClass:=TResizeElementsForm;
end.