-
Notifications
You must be signed in to change notification settings - Fork 4
/
ufrmDelphiVersionsFM.pas
138 lines (118 loc) · 3.68 KB
/
ufrmDelphiVersionsFM.pas
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
unit ufrmDelphiVersionsFM;
interface
uses
System.SysUtils, System.Types, System.UITypes, System.Classes, System.Variants,
FMX.Types, FMX.Controls, FMX.Forms, FMX.Dialogs, FMX.Ani, FMX.Layouts, FMX.Gestures,
FMX.Edit, FMX.StdCtrls, FMX.ListBox, FMX.Controls.Presentation;
type
TfrmDelphiVersionsFM = class(TForm)
ToolbarHolder: TLayout;
ToolbarPopup: TPopup;
ToolbarPopupAnimation: TFloatAnimation;
ToolBar1: TToolBar;
ToolbarApplyButton: TButton;
ToolbarCloseButton: TButton;
ToolbarAddButton: TButton;
lblIntro: TLabel;
lbDefines: TListBox;
pnlBottom: TPanel;
lblRef1: TLabel;
lblRef2: TLabel;
Label1: TLabel;
Label2: TLabel;
edtAboutLink: TEdit;
edtClassLink: TEdit;
edtDirectivesLink: TEdit;
edtVersionsLink: TEdit;
StyleBookUbuntu: TStyleBook;
procedure ToolbarCloseButtonClick(Sender: TObject);
procedure FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
procedure FormKeyDown(Sender: TObject; var Key: Word; var KeyChar: Char;
Shift: TShiftState);
procedure FormActivate(Sender: TObject);
procedure edtLinkClick(Sender: TObject);
procedure FormCreate(Sender: TObject);
private
FFirstTime: Boolean;
FGestureOrigin: TPointF;
FGestureInProgress: Boolean;
procedure ShowToolbar(AShow: Boolean);
end;
var
frmDelphiVersionsFM: TfrmDelphiVersionsFM;
implementation
{$R *.fmx}
{$R *.LgXhdpiPh.fmx ANDROID}
{$R *.Macintosh.fmx MACOS}
{$R *.Windows.fmx MSWINDOWS}
uses
uConditionalList, uOpenViewURL;
procedure TfrmDelphiVersionsFM.FormKeyDown(Sender: TObject; var Key: Word;
var KeyChar: Char; Shift: TShiftState);
begin
if Key = vkEscape then
ShowToolbar(not ToolbarPopup.IsOpen);
end;
procedure TfrmDelphiVersionsFM.ToolbarCloseButtonClick(Sender: TObject);
begin
Application.Terminate;
end;
procedure ShowCompilerDefine(const CompDefined: string);
begin
frmDelphiVersionsFM.lbDefines.Items.Add(CompDefined);
end;
procedure TfrmDelphiVersionsFM.edtLinkClick(Sender: TObject);
begin
OpenURL((Sender as TEdit).Text);
end;
procedure TfrmDelphiVersionsFM.FormActivate(Sender: TObject);
begin
if FFirstTime then begin
FFirstTime := False;
GetConditionalDefines(ShowCompilerDefine);
SetupReferenceLinks;
lblIntro.Text := IntroText;
edtAboutLink.Text := IntroLink1;
edtClassLink.Text := IntroLink2;
edtDirectivesLink.Text := DirectivesLink;
edtVersionsLink.Text := VersionsLink;
end;
end;
procedure TfrmDelphiVersionsFM.FormCreate(Sender: TObject);
begin
FFirstTime := True;
end;
procedure TfrmDelphiVersionsFM.FormGesture(Sender: TObject;
const EventInfo: TGestureEventInfo; var Handled: Boolean);
var
DX, DY : Single;
begin
if EventInfo.GestureID = igiPan then
begin
if (TInteractiveGestureFlag.gfBegin in EventInfo.Flags)
and ((Sender = ToolbarPopup)
or (EventInfo.Location.Y > (ClientHeight - 70))) then
begin
FGestureOrigin := EventInfo.Location;
FGestureInProgress := True;
end;
if FGestureInProgress and (TInteractiveGestureFlag.gfEnd in EventInfo.Flags) then
begin
FGestureInProgress := False;
DX := EventInfo.Location.X - FGestureOrigin.X;
DY := EventInfo.Location.Y - FGestureOrigin.Y;
if (Abs(DY) > Abs(DX)) then
ShowToolbar(DY < 0);
end;
end
end;
procedure TfrmDelphiVersionsFM.ShowToolbar(AShow: Boolean);
begin
ToolbarPopup.Width := ClientWidth;
ToolbarPopup.PlacementRectangle.Rect := TRectF.Create(0, ClientHeight-ToolbarPopup.Height, ClientWidth-1, ClientHeight-1);
ToolbarPopupAnimation.StartValue := ToolbarPopup.Height;
ToolbarPopupAnimation.StopValue := 0;
ToolbarPopup.IsOpen := AShow;
end;
end.