-
Notifications
You must be signed in to change notification settings - Fork 1
/
floatformu.pas
108 lines (89 loc) · 2.21 KB
/
floatformu.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
unit FloatFormU;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls,
lclintf, LCLType, ExtCtrls, uEImage, INIFilesUTF8, BGRABitmap;
type
{ TFloatForm }
TFloatForm = class(TForm)
CoreImagePanel: TuEImage;
L_Title: TLabel;
L_CoreName: TLabel;
L_Description: TLabel;
Panel1: TPanel;
TimerShow: TTimer;
procedure FormDestroy(Sender: TObject);
procedure TimerShowTimer(Sender: TObject);
protected
procedure CreateParams(var Params: TCreateParams); override;
private
{ private declarations }
INI:TIniFile;
public
{ public declarations }
procedure ShowCoreInfo(s:string);
procedure Start(F:TForm);
procedure Hide;
end;
var
FloatForm: TFloatForm;
implementation
{$R *.lfm}
uses ConfigFormU, DebugU;
{ TFloatForm }
procedure TFloatForm.ShowCoreInfo(s: string);
begin
if s=L_CoreName.caption then exit;
L_CoreName.caption:=s;
TimerShow.Interval:=500;
TimerShow.Enabled:=true;
end;
procedure TFloatForm.Start(F:TForm);
begin
Info('TFloatForm.Start','Parent = '+F.Name);
PopupParent:=nil;
Hide;
PopupParent:=F;
FormStyle:=fsSystemStayOnTop;
end;
procedure TFloatForm.Hide;
begin
TimerShow.Enabled:=false;
inherited hide;
end;
procedure TFloatForm.TimerShowTimer(Sender: TObject);
begin
Info('TFloatForm','ShowCore= '+L_CoreName.caption);
TimerShow.Enabled:=false;
CoreImagePanel.Image.Clear;
try
CoreImagePanel.LoadFromFile(LibraryDir+L_CoreName.caption+PathDelim+'image.png');
L_Title.Caption:='';
L_Description.Caption:='';
try
Ini:=TINIFile.Create(LibraryDir+L_CoreName.caption+PathDelim+L_CoreName.caption+'.ini');
L_Title.Caption:=Ini.ReadString('MAIN','Title','');
L_Description.Caption:=Ini.ReadString('MAIN','Description','');
finally
Ini.free;
end;
ShowWindow(Self.Handle, SW_SHOWNOACTIVATE);
Visible := True;
except
ON E:Exception do
begin
Visible := False;
end;
end;
end;
procedure TFloatForm.FormDestroy(Sender: TObject);
begin
Info('TFloatForm','FormDestroy');
end;
procedure TFloatForm.CreateParams(var Params: TCreateParams); // override;
begin
inherited;
params.wndParent := 0;
end;
end.