SyncLyricsAdjust.pas
2.55 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
unit SyncLyricsAdjust;
interface
{$DEFINE MULTI_LANGUAGE}
uses
Windows, Messages, SysUtils, Classes, Graphics, Controls, Forms, Dialogs,
StdCtrls, Buttons, ComCtrls, slider{$IFDEF MULTI_LANGUAGE}, gnugettext{$ENDIF};
type
TLyricsAdjustForm = class(TForm)
lblTransparency: TLabel;
lblOpaque: TLabel;
lblSmall: TLabel;
Label3: TLabel;
lblScale: TLabel;
Label5: TLabel;
Label6: TLabel;
Label1: TLabel;
TrackBar1: TSlider;
TrackBar2: TSlider;
btnClose: TButton;
Edit1: TEdit;
Edit2: TEdit;
procedure btnCloseClick(Sender: TObject);
procedure FormActivate(Sender: TObject);
procedure TrackBar2Change(Sender: TObject);
procedure FormCreate(Sender: TObject);
procedure FormClose(Sender: TObject; var Action: TCloseAction);
procedure TrackBar1StopTracking(Sender: TObject);
procedure TrackBar1Change(Sender: TObject);
private
{ Private declarations }
public
{ Public declarations }
LyricsHandle : HWND;
Transparency : integer;
ScaleFactor : double;
end;
var
LyricsAdjustForm: TLyricsAdjustForm;
implementation
uses ShowMIDILyrics;
{$R *.DFM}
procedure TLyricsAdjustForm.btnCloseClick(Sender: TObject);
begin
Close;
end;
procedure TLyricsAdjustForm.FormActivate(Sender: TObject);
begin
TrackBar1.Value := Transparency;
TrackBar2.Value := round(ScaleFactor * 100);
Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%';
Edit2.Text := FormatFloat('0.00', TrackBar2.Value / 100);
TrackBar1.OnChange := TrackBar1Change;
TrackBar2.OnChange := TrackBar2Change;
end;
procedure TLyricsAdjustForm.TrackBar1Change(Sender: TObject);
begin
Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%';
end;
procedure TLyricsAdjustForm.TrackBar1StopTracking(Sender: TObject);
begin
Edit1.Text := intToStr(round(TrackBar1.Value / 2.55)) + '%';
PostMessage(LyricsHandle, WM_SyncLyricsConfig, SyncLyrics_BackTransparency, 255 - TrackBar1.Value);
end;
procedure TLyricsAdjustForm.TrackBar2Change(Sender: TObject);
begin
Edit2.Text := FormatFloat('0.00', TrackBar2.Value / 100);
PostMessage(LyricsHandle, WM_SyncLyricsConfig, SyncLyrics_ScaleAdj, TrackBar2.Value);
end;
procedure TLyricsAdjustForm.FormCreate(Sender: TObject);
begin
{$IFDEF MULTI_LANGUAGE}
TranslateComponent(Self);
{$ENDIF}
end;
procedure TLyricsAdjustForm.FormClose(Sender: TObject;
var Action: TCloseAction);
begin
// 프로그램이 Activation시 TrackBar1.Value 또는 TrackBar2.Value를 변경하면서 발생하는 이벤트 방지
TrackBar1.OnChange := nil;
TrackBar2.OnChange := nil;
end;
end.