-
Notifications
You must be signed in to change notification settings - Fork 8
Expand file tree
/
Copy pathVKAP.Player.pas
More file actions
233 lines (206 loc) · 6.02 KB
/
VKAP.Player.pas
File metadata and controls
233 lines (206 loc) · 6.02 KB
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
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
unit VKAP.Player;
interface
uses
Winapi.Windows, Winapi.Messages, System.SysUtils, System.Variants, System.Classes, Vcl.Graphics,
Vcl.Controls, Vcl.Forms, Vcl.Dialogs, Vcl.StdCtrls, HGM.Controls.PanelExt, HGM.Button,
Vcl.Imaging.pngimage, Vcl.ExtCtrls, System.ImageList, Vcl.ImgList, Vcl.Menus,
HGM.Controls.SpinEdit, Vcl.Grids, HGM.Controls.ColorGrid;
type
TFormPlayer = class(TForm)
ImageAlbum: TImage;
LabelTitle: TLabel;
ImagePrev: TImage;
ImageNext: TImage;
ImagePlay: TImage;
ImageList: TImageList;
ImageListL: TImageList;
PopupMenu: TPopupMenu;
MenuItemFontColor: TMenuItem;
MenuItemButtonsColor: TMenuItem;
ColorDialog: TColorDialog;
MenuItemOnTop: TMenuItem;
MenuItemBGColor: TMenuItem;
N1: TMenuItem;
Panel1: TPanel;
MenuItemProps: TMenuItem;
hColorGrid1: ThColorGrid;
CheckBoxFlat1: TCheckBoxFlat;
CheckBoxFlat2: TCheckBoxFlat;
CheckBoxFlat3: TCheckBoxFlat;
ImageList24: TImageList;
SpinEditBGAlpha: TlkSpinEdit;
ButtonFlat1: TButtonFlat;
ButtonFlat2: TButtonFlat;
ButtonFlat3: TButtonFlat;
procedure PanelPlayerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure FormPaint(Sender: TObject);
procedure FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
procedure MenuItemButtonsColorClick(Sender: TObject);
procedure MenuItemFontColorClick(Sender: TObject);
procedure MenuItemOnTopClick(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure MenuItemBGColorClick(Sender: TObject);
procedure MenuItemPropsClick(Sender: TObject);
private
FIsPlay: Boolean;
FPlayImg: Integer;
procedure SetIsPlay(const Value: Boolean);
procedure SetImageColor(Color: TColor);
public
procedure CreateParams(var Params: TCreateParams); override;
property IsPlay: Boolean read FIsPlay write SetIsPlay;
end;
var
FormPlayer: TFormPlayer;
implementation
uses
VKAP.Main, HGM.Common.Utils, HGM.Common.PngUtils;
{$R *.dfm}
procedure TFormPlayer.CreateParams(var Params: TCreateParams);
begin
inherited CreateParams(Params);
Params.Style := (Params.Style or WS_POPUP) and (not WS_CHILD);
//Params.ExStyle := Params.ExStyle or WS_EX_APPWINDOW;
//Params.ExStyle := Params.ExStyle or WS_EX_TRANSPARENT;
Params.WndParent := GetDesktopWindow;
end;
procedure TFormPlayer.SetImageColor(Color: TColor);
var
i: Integer;
begin
for i := 0 to ImageList.Count - 1 do
ColorImages(ImageList, i, Color);
for i := 0 to ImageListL.Count - 1 do
ColorImages(ImageListL, i, ColorLighter(Color, 20));
ColorImages(ImageList, 5, clWhite);
end;
procedure TFormPlayer.FormClose(Sender: TObject; var Action: TCloseAction);
begin
FormMain.Close;
end;
procedure TFormPlayer.FormCreate(Sender: TObject);
begin
ClientHeight := 42;
Color := clBlack;
Left := FormMain.Left;
Top := FormMain.Top;
FPlayImg := 7;
ImagePlay.OnClick := FormMain.ButtonFlatPlayPauseClick;
ImageNext.OnClick := FormMain.ButtonFlatNextClick;
ImagePrev.OnClick := FormMain.ButtonFlatPrevClick;
ImageListL.AddImages(ImageList);
SetImageColor($00B58251);
end;
procedure TFormPlayer.FormMouseMove(Sender: TObject; Shift: TShiftState; X, Y: Integer);
begin
Invalidate;
end;
procedure TFormPlayer.FormPaint(Sender: TObject);
var
IL: TImageList;
begin
with Canvas do
begin
if Color <> clBlack then
begin
Brush.Color := Color;
FillRect(ClientRect);
end;
if PtInRect(ImagePrev.BoundsRect, ScreenToClient(Mouse.CursorPos)) then
IL := ImageListL
else
IL := ImageList;
IL.Draw(Canvas,
ImagePrev.Left + ImagePrev.Width div 2 - 32 div 2,
ImagePrev.Top + ImagePrev.Height div 2 - 32 div 2,
2, True);
if PtInRect(ImagePlay.BoundsRect, ScreenToClient(Mouse.CursorPos)) then
IL := ImageListL
else
IL := ImageList;
IL.Draw(Canvas,
ImagePlay.Left + ImagePlay.Width div 2 - 32 div 2 + 1,
ImagePlay.Top + ImagePlay.Height div 2 - 32 div 2,
FPlayImg, True);
if PtInRect(ImageNext.BoundsRect, ScreenToClient(Mouse.CursorPos)) then
IL := ImageListL
else
IL := ImageList;
IL.Draw(Canvas,
ImageNext.Left + ImageNext.Width div 2 - 32 div 2,
ImageNext.Top + ImageNext.Height div 2 - 32 div 2,
1, True);
StretchDraw(TRect.Create(TPoint.Create(ImageAlbum.Left, ImageAlbum.Top), 26, 26), ImageAlbum.Picture.Graphic);
end;
end;
procedure TFormPlayer.MenuItemBGColorClick(Sender: TObject);
begin
if ColorDialog.Execute(Handle) then
begin
Color := ColorDialog.Color;
GlassFrame.Enabled := Color = clBlack;
Invalidate;
end;
end;
procedure TFormPlayer.MenuItemButtonsColorClick(Sender: TObject);
begin
if ColorDialog.Execute(Handle) then
begin
SetImageColor(ColorDialog.Color);
Invalidate;
end;
end;
procedure TFormPlayer.MenuItemFontColorClick(Sender: TObject);
begin
if ColorDialog.Execute(Handle) then
begin
LabelTitle.Font.Color := ColorDialog.Color;
Invalidate;
end;
end;
procedure TFormPlayer.MenuItemOnTopClick(Sender: TObject);
begin
if FormStyle = fsNormal then
FormStyle := fsStayOnTop
else
FormStyle := fsNormal;
MenuItemOnTop.Checked := FormStyle = fsStayOnTop;
end;
procedure TFormPlayer.MenuItemPropsClick(Sender: TObject);
begin
if ClientHeight <= 42 then
ClientHeight := 200
else
ClientHeight := 42;
end;
procedure TFormPlayer.PanelPlayerMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
if ssDouble in Shift then
begin
if Button = mbLeft then
begin
FormMain.Full;
end;
Exit;
end;
if Button = mbLeft then
begin
ReleaseCapture;
SendMessage(Handle, WM_SYSCOMMAND, 61458, 0);
end;
if Button = mbRight then
begin
PopupMenu.Popup(Mouse.CursorPos.X, Mouse.CursorPos.Y);
end;
end;
procedure TFormPlayer.SetIsPlay(const Value: Boolean);
begin
FIsPlay := Value;
if FIsPlay then
FPlayImg := 6
else
FPlayImg := 7;
Invalidate;
end;
end.