unit mainform;
{$mode objfpc}{$H+}
interface
uses
Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, ExtCtrls,
StdCtrls, easing;
type
{ TMain }
TMain = class(TForm)
AudioPlayerPanel: TPanel;
BluetoothButtonPanel: TPanel;
ConfiguracaoButtonPanel: TPanel;
ContentPanel: TPanel;
FooterPanel: TPanel;
HomeButton: TImage;
ClockLabel: TLabel;
Image1: TImage;
Image10: TImage;
Image11: TImage;
Image12: TImage;
Image2: TImage;
Image3: TImage;
Image4: TImage;
Image5: TImage;
Image6: TImage;
Image7: TImage;
Image8: TImage;
Image9: TImage;
Label2: TLabel;
Label3: TLabel;
Label4: TLabel;
Label5: TLabel;
Label6: TLabel;
Label7: TLabel;
MenuContainerPanel: TScrollBox;
MenuMainPanel: TPanel;
MultimediaButtonPanel: TPanel;
NavegacaoButtonPanel: TPanel;
PaintBox1: TPaintBox;
ProgramasButtonPanel: TPanel;
RepeatPanel: TPanel;
PlayPanel: TPanel;
NextPanel: TPanel;
StopPanel: TPanel;
ShufflePanel: TPanel;
AudioPlayerTopPanel: TPanel;
PreviousPanel: TPanel;
TrackAlbum: TImage;
TrackAlbumLabel: TLabel;
TrackArtist: TImage;
TrackArtistLabel: TLabel;
TrackArtworkLarge: TImage;
TrackArtworkSmall: TImage;
Label1: TLabel;
ProgressHandlePanel: TPanel;
TrackArtistTitleLabel: TLabel;
MainPanel: TPanel;
HeaderPanel: TPanel;
AudioPlayerBottomPanel: TPanel;
HomeButtonPanel: TPanel;
ProgressBgPB: TPaintBox;
TrackBitrate: TLabel;
TrackGenre: TLabel;
TrackTitle: TImage;
TrackTitleLabel: TLabel;
ViaturaButtonPanel: TPanel;
procedure BluetoothButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure BluetoothButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ConfiguracaoButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ConfiguracaoButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure FormCreate(Sender: TObject);
procedure HomeButtonPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure HomeButtonPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure MultimediaButtonPanelClick(Sender: TObject);
procedure MultimediaButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure MultimediaButtonPanelMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
procedure MultimediaButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure NavegacaoButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure NavegacaoButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure NextPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure NextPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PlayPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PlayPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PreviousPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure PreviousPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ProgramasButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ProgramasButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure RepeatPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure RepeatPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ShufflePanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ShufflePanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure StopPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure StopPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure ViaturaButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
procedure ViaturaButtonPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
procedure TweenScrollBy(Sender: TObject; startPoint, endPoint: integer;
Duration: integer; Direction: string; easeType: TChromeTabsEaseType);
private
{ private declarations }
public
{ public declarations }
end;
var
Main: TMain;
CurrentVisibleMenu: TPanel;
MouseDownOnMenu: Boolean;
implementation
{$R *.lfm}
{ TMain }
procedure TMain.HomeButtonPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
HomeButtonPanel.Color := $000D70FF;
Application.Terminate;
end;
procedure TMain.HomeButtonPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
HomeButtonPanel.Color := $007F7F7F;
end;
procedure TMain.BluetoothButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BluetoothButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.BluetoothButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
BluetoothButtonPanel.Color := $00666666;
MouseDownOnMenu := False;
end;
procedure TMain.ConfiguracaoButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ConfiguracaoButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.ConfiguracaoButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ConfiguracaoButtonPanel.Color := $004C4C4C;
MouseDownOnMenu := False;
end;
procedure TMain.FormCreate(Sender: TObject);
begin
CurrentVisibleMenu := MenuMainPanel;
MenuContainerPanel.DoubleBuffered := True;
MultimediaButtonPanel.DoubleBuffered := True;
NavegacaoButtonPanel.DoubleBuffered := True;
BluetoothButtonPanel.DoubleBuffered := True;
ProgramasButtonPanel.DoubleBuffered := True;
ViaturaButtonPanel.DoubleBuffered := True;
ConfiguracaoButtonPanel.DoubleBuffered := True;
end;
procedure TMain.MultimediaButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MultimediaButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.MultimediaButtonPanelMouseMove(Sender: TObject;
Shift: TShiftState; X, Y: Integer);
begin
//TPanel(CurrentVisibleMenu).Left := Mouse.CursorPos.X;
end;
procedure TMain.MultimediaButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
MultimediaButtonPanel.Color := $00666666;
MouseDownOnMenu := False;
end;
procedure TMain.MultimediaButtonPanelClick(Sender: TObject);
begin
ShowMessage('teste');
end;
procedure TMain.NavegacaoButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
NavegacaoButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.NavegacaoButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
NavegacaoButtonPanel.Color := $004C4C4C;
MouseDownOnMenu := False;
end;
procedure TMain.NextPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
NextPanel.Color := $000D70FF;
TweenScrollBy(CurrentVisibleMenu, -760, 0, 100, 'horizontal', tteaseInOutQuad);
end;
procedure TMain.NextPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
NextPanel.Color := $00999999;
end;
procedure TMain.PlayPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PlayPanel.Color := $000D70FF;
end;
procedure TMain.PlayPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PlayPanel.Color := $00B2B2B2;
end;
procedure TMain.PreviousPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PreviousPanel.Color := $000D70FF;
TweenScrollBy(CurrentVisibleMenu, 0, -760, 100, 'horizontal', tteaseInOutQuad);
end;
procedure TMain.PreviousPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
PreviousPanel.Color := $00B2B2B2;
end;
procedure TMain.ProgramasButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ProgramasButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.ProgramasButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ProgramasButtonPanel.Color := $004C4C4C;
MouseDownOnMenu := False;
end;
procedure TMain.RepeatPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
RepeatPanel.Color := $000D70FF;
end;
procedure TMain.RepeatPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
RepeatPanel.Color := $007F7F7F;
end;
procedure TMain.ShufflePanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShufflePanel.Color := $000D70FF;
end;
procedure TMain.ShufflePanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
ShufflePanel.Color := $00999999;
end;
procedure TMain.StopPanelMouseDown(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
StopPanel.Color := $000D70FF;
end;
procedure TMain.StopPanelMouseUp(Sender: TObject; Button: TMouseButton;
Shift: TShiftState; X, Y: Integer);
begin
StopPanel.Color := $00CCCCCC;
end;
procedure TMain.ViaturaButtonPanelMouseDown(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ViaturaButtonPanel.Color := $000D70FF;
MouseDownOnMenu := True;
end;
procedure TMain.ViaturaButtonPanelMouseUp(Sender: TObject;
Button: TMouseButton; Shift: TShiftState; X, Y: Integer);
begin
ViaturaButtonPanel.Color := $00666666;
MouseDownOnMenu := False;
end;
procedure TMain.TweenScrollBy(Sender: TObject; startPoint, endPoint: integer;
Duration: integer; Direction: string; easeType: TChromeTabsEaseType);
var
i, j: integer;
begin
for i := 1 to Duration do
begin
j := Trunc(CalculateEase(startPoint, endPoint, i, Duration, easeType));
if ((startPoint > endPoint) and (j < endPoint)) or
((startPoint < endPoint) and (j > endPoint)) then
j := endPoint;
case Direction of
'vertical': TPanel(CurrentVisibleMenu).Top := j;
'horizontal': TPanel(CurrentVisibleMenu).Left := j;
end;
TPanel(CurrentVisibleMenu).Update;
end;
end;
end.