unit settings;
interface
uses
Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
Dialogs, StdCtrls, XiButton, XiTrackBar, ExtCtrls, JvExStdCtrls,
JvWinampLabel, XiPanel;
type
TEQCArray =
array [1..3]
of Byte;
type
TfrmSettings =
class(TForm)
xiBg: TXiPanel;
xiCaptionBar: TXiPanel;
buttonCloseOver: TImage;
buttonCloseOut: TImage;
xiCancel: TXiButton;
xiOk: TXiButton;
sBottom: TShape;
sLeft: TShape;
sRight: TShape;
XiPanel1: TXiPanel;
xiFadeOutOnClose: TXiButton;
xiCrossfade: TXiButton;
lFadeTime: TLabel;
Label2: TLabel;
xiFadeTime: TXiTrackBar;
Label1: TLabel;
XiPanel2: TXiPanel;
Label5: TLabel;
XiButton3: TXiButton;
XiButton4: TXiButton;
XiPanel3: TXiPanel;
Label3: TLabel;
eqTb3: TXiTrackBar;
eqTb2: TXiTrackBar;
eqTb1: TXiTrackBar;
xiSets: TXiPanel;
xiSet0: TXiButton;
xiSetsButton: TXiPanel;
XiButton5: TXiButton;
xiSet1: TXiButton;
xiSet2: TXiButton;
xiSet3: TXiButton;
xiSet4: TXiButton;
xiSet5: TXiButton;
pos3: TLabel;
pos1: TLabel;
pos2: TLabel;
procedure xiFadeTimeChange(Sender: TObject);
procedure xiSetsButtonClick(Sender: TObject);
procedure buttonCloseOutMouseMove(Sender: TObject; Shift: TShiftState;
X, Y: Integer);
procedure buttonCloseOverClick(Sender: TObject);
procedure xiFadeOutOnCloseClick(Sender: TObject);
procedure xiCrossfadeClick(Sender: TObject);
procedure xiCancelClick(Sender: TObject);
procedure xiOkClick(Sender: TObject);
procedure xiSet0Click(Sender: TObject);
procedure eqTb1Change(Sender: TObject);
procedure eqTb2Change(Sender: TObject);
procedure eqTb3Change(Sender: TObject);
procedure xiCaptionBarMouseMove(Sender: TObject; Shift: TShiftState; X,
Y: Integer);
procedure FormShow(Sender: TObject);
procedure xiCaptionBarMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
private
FadeOutOnClose, Crossfade, noAbort : Boolean;
// @ mkinzler (siehe auch bitte @ *)
EQSetNum : Integer;
FadeTime : Extended;
procedure SetEQControl(EQCArray : TEQCArray);
public
function Execute(eFadeOutOnClose, eCrossfade : Boolean; eEQSetNum : Integer; eFadeTime : Extended) : Boolean;
function getFadeOutOnClose : Boolean;
function getCrossfade : Boolean;
function getEQSetNum : Integer;
function getFadeTime : Extended;
end;
var
frmSettings : TfrmSettings;
implementation
{$R *.dfm}
procedure TfrmSettings.xiFadeTimeChange(Sender: TObject);
begin
lFadeTime.Caption := FloatToStr(xiFadeTime.Position / 10);
FadeTime := xiFadeTime.Position * 100;
end;
procedure TfrmSettings.xiSetsButtonClick(Sender: TObject);
begin
if xiSetsButton.BevelOuter = bvRaised
then
xiSetsButton.BevelOuter := bvNone
else
xiSetsButton.BevelOuter := bvRaised;
xiSets.Visible := xiSetsButton.BevelOuter = bvRaised;
end;
procedure TfrmSettings.buttonCloseOutMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
buttonCloseOut.Visible := False;
buttonCloseOver.Visible := True;
end;
procedure TfrmSettings.buttonCloseOverClick(Sender: TObject);
begin
buttonCloseOut.Visible := True;
buttonCloseOver.Visible := False;
Close;
end;
function TfrmSettings.Execute(eFadeOutOnClose, eCrossfade : Boolean; eEQSetNum : Integer; eFadeTime : Extended) : Boolean;
begin
Crossfade :=
not eCrossfade;
FadeOutOnClose :=
not eFadeOutOnClose;
EQSetNum := eEQSetNum;
FadeTime := eFadeTime;
xiFadeOutOnCloseClick(xiFadeOutOnClose);
xiCrossfadeClick(xiCrossfade);
xiFadeTime.Position := Round(eFadeTime / 100);
xiSet0Click(FindComponent('
xiSet' + IntToStr(EQSetNum)));
ShowModal;
Result := noAbort;
end;
procedure TfrmSettings.xiFadeOutOnCloseClick(Sender: TObject);
begin
FadeOutOnClose :=
not FadeOutOnClose;
if FadeOutOnClose
then
xiFadeOutOnClose.Caption := '
Deactivate fade out on close'
else
xiFadeOutOnClose.Caption := '
Activate fade out on close';
end;
procedure TfrmSettings.xiCrossfadeClick(Sender: TObject);
begin
Crossfade :=
not Crossfade;
if Crossfade
then
xiCrossfade.Caption := '
Deactivate automatic crossfade'
else
xiCrossfade.Caption := '
Activate automatic crossfade';
end;
procedure TfrmSettings.xiOkClick(Sender: TObject);
begin
noAbort := true;
end;
procedure TfrmSettings.xiCancelClick(Sender: TObject);
begin
noAbort := false;
end;
procedure TfrmSettings.xiSet0Click(Sender: TObject);
var EQCArray : TEQCArray;
begin
if Sender
is TXiButton
then begin
EQSetNum := StrToInt(Copy((Sender
as TXiButton).
Name, 6, Length((Sender
as TXiButton).
Name)));
case EQSetNum
of
0 :
begin
EQCArray[1] := 15;
EQCArray[2] := 15;
EQCArray[3] := 15;
SetEQControl(EQCArray);
end;
2 :
begin
EQCArray[1] := 16;
EQCArray[2] := 18;
EQCArray[3] := 15;
SetEQControl(EQCArray);
end;
3 :
begin
EQCArray[1] := 16;
EQCArray[2] := 14;
EQCArray[3] := 18;
SetEQControl(EQCArray);
end;
4 :
begin
EQCArray[1] := 16;
EQCArray[2] := 15;
EQCArray[3] := 14;
SetEQControl(EQCArray);
end;
5 :
begin
EQCArray[1] := 16;
EQCArray[2] := 14;
EQCArray[3] := 16;
SetEQControl(EQCArray);
end;
end;
end;
end;
procedure TfrmSettings.SetEQControl(EQCArray : TEQCArray);
begin
eqTb1.Position := EQCArray[1];
eqTb2.Position := EQCArray[2];
eqTb3.Position := EQCArray[3];
end;
function TfrmSettings.getFadeOutOnClose : Boolean;
begin
Result := FadeOutOnClose;
end;
function TfrmSettings.getCrossfade : Boolean;
begin
Result := Crossfade;
end;
function TfrmSettings.getEQSetNum : Integer;
begin
Result := EQSetNum;
end;
function TfrmSettings.getFadeTime : Extended;
begin
Result := FadeTime;
end;
procedure TfrmSettings.eqTb1Change(Sender: TObject);
begin
pos1.Caption := IntToStr(30 - eqTb1.Position);
end;
procedure TfrmSettings.eqTb2Change(Sender: TObject);
begin
pos2.Caption := IntToStr(30 - eqTb2.Position);
end;
procedure TfrmSettings.eqTb3Change(Sender: TObject);
begin
pos3.Caption := IntToStr(30 - eqTb3.Position);
end;
procedure TfrmSettings.xiCaptionBarMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
buttonCloseOut.Visible := True;
buttonCloseOver.Visible := False;
end;
procedure TfrmSettings.FormShow(Sender: TObject);
var hDesk : HWND;
hdcDesktop : HDC;
p : TPoint;
crefPixel : COLORREF;
begin
p.X := 9;
p.Y := 40;
hDesk := GetDesktopWindow;
hdcDesktop := GetWindowDC(hDesk);
crefPixel := GetPixel(hdcDesktop, p.x, p.y);
eqTb1.BackColor := crefPixel;
eqTb2.BackColor := crefPixel;
eqTb3.BackColor := crefPixel;
end;
procedure TfrmSettings.xiCaptionBarMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ReleaseCapture;
Perform(wm_syscommand,$f012, 0);
end;
end.