FMX.Bind.Editors, Data.Bind.Components, FMX.StdCtrls, FMX.Effects,
FMX.Filter.Effects, FMX.Ani, FMX.Objects, FMX.Menus, FMX.ListView.Types,
FMX.ListView, System.TypInfo, FMX.Layouts, FMX.ListBox,
- FMX.Controls.Presentation, FMX.Edit, FMX.EditBox, FMX.SpinBox, FMX.Media;
+ FMX.Controls.Presentation, FMX.Edit, FMX.EditBox, FMX.SpinBox, FMX.Media,
+ Math;
type
TForm1 = class(TForm)
SetObjectProp(s, 'target',
ListView1.Items[ListView1.ItemIndex + 1].Bitmap);
FloatAnimation1.Start;
+ if Sender = Button2 then
+ MediaPlayer1.Play;
break;
end;
end;
end;
end
else
+ begin
progress := false;
+ MediaPlayer1.Stop;
+ end;
end;
procedure TForm1.FormCreate(Sender: TObject);
progress := true;
FloatAnimation1.Stop;
end;
+ SpinBox1Change(Sender);
+ if (Form3.CheckBox1.IsChecked = true) and
+ (MediaPlayer1.CurrentTime > MediaPlayer1.Duration) then
+ MediaPlayer1.CurrentTime :=
+ MediaPlayer1.CurrentTime mod MediaPlayer1.Duration;
Image1.Bitmap.Assign(ListView1.Items[ListView1.ItemIndex].Bitmap);
end;
procedure TForm1.SpinBox1Change(Sender: TObject);
begin
+ with FloatAnimation1 do
+ begin
+ if Running = true then
+ begin
+ progress := true;
+ Stop;
+ end;
+ Delay := SpinBox1.Value - Duration;
+ end;
+ if ListView1.Items.Count > 0 then
+ MediaPlayer1.CurrentTime := Floor(SpinBox1.Value * MediaPlayer1.Duration *
+ MediaTimeScale * ListView1.ItemIndex / ListView1.Items.Count);
Label2.Visible := SpinBox1.Value = 2.50;
end;
--- /dev/null
+object Form2: TForm2
+ Left = 0
+ Top = 0
+ BorderIcons = [biSystemMenu]
+ BorderStyle = Single
+ Caption = #12456#12501#12455#12463#12488
+ ClientHeight = 480
+ ClientWidth = 640
+ FormFactor.Width = 320
+ FormFactor.Height = 480
+ FormFactor.Devices = [Desktop]
+ OnShow = FormShow
+ DesignerMasterStyle = 0
+ object Button5: TButton
+ ModalResult = 1
+ Position.X = 224.000000000000000000
+ Position.Y = 416.000000000000000000
+ TabOrder = 0
+ Text = 'OK'
+ end
+ object Button6: TButton
+ Cancel = True
+ ModalResult = 2
+ Position.X = 352.000000000000000000
+ Position.Y = 416.000000000000000000
+ TabOrder = 1
+ Text = 'Cancel'
+ end
+ object Panel1: TPanel
+ Align = Top
+ Size.Width = 640.000000000000000000
+ Size.Height = 393.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 2
+ object Button1: TButton
+ Position.X = 296.000000000000000000
+ Position.Y = 128.000000000000000000
+ Size.Width = 41.000000000000000000
+ Size.Height = 22.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 0
+ Text = '=>'
+ OnClick = Button1Click
+ end
+ object Button2: TButton
+ Position.X = 296.000000000000000000
+ Position.Y = 176.000000000000000000
+ Size.Width = 41.000000000000000000
+ Size.Height = 22.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 1
+ Text = '<='
+ OnClick = Button2Click
+ end
+ object Button3: TButton
+ Position.X = 432.000000000000000000
+ Position.Y = 304.000000000000000000
+ TabOrder = 2
+ Text = #20840#12390#36861#21152
+ OnClick = Button3Click
+ end
+ object Button4: TButton
+ Position.X = 128.000000000000000000
+ Position.Y = 304.000000000000000000
+ TabOrder = 3
+ Text = #20840#12390#21066#38500
+ OnClick = Button4Click
+ end
+ object ListBox1: TListBox
+ Position.X = 72.000000000000000000
+ Position.Y = 80.000000000000000000
+ TabOrder = 4
+ DisableFocusEffect = True
+ DefaultItemStyles.ItemStyle = ''
+ DefaultItemStyles.GroupHeaderStyle = ''
+ DefaultItemStyles.GroupFooterStyle = ''
+ MultiSelectStyle = Default
+ Sorted = True
+ end
+ object ListBox2: TListBox
+ Position.X = 368.000000000000000000
+ Position.Y = 80.000000000000000000
+ TabOrder = 5
+ DisableFocusEffect = True
+ DefaultItemStyles.ItemStyle = ''
+ DefaultItemStyles.GroupHeaderStyle = ''
+ DefaultItemStyles.GroupFooterStyle = ''
+ MultiSelectStyle = Default
+ Sorted = True
+ end
+ end
+end
--- /dev/null
+unit Unit2;
+
+interface
+
+uses
+ System.SysUtils, System.Types, System.UITypes, System.Classes,
+ System.Variants,
+ FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
+ FMX.Layouts, FMX.ListBox;
+
+type
+ TForm2 = class(TForm)
+ ListBox1: TListBox;
+ ListBox2: TListBox;
+ Button1: TButton;
+ Button2: TButton;
+ Button3: TButton;
+ Button4: TButton;
+ Button5: TButton;
+ Button6: TButton;
+ Panel1: TPanel;
+ procedure Button1Click(Sender: TObject);
+ procedure Button2Click(Sender: TObject);
+ procedure Button3Click(Sender: TObject);
+ procedure Button4Click(Sender: TObject);
+ procedure FormShow(Sender: TObject);
+ private
+ { private \90é\8c¾ }
+ public
+ { public \90é\8c¾ }
+ end;
+
+var
+ Form2: TForm2;
+
+implementation
+
+{$R *.fmx}
+
+uses Unit1;
+
+procedure TForm2.Button1Click(Sender: TObject);
+var
+ i: Integer;
+begin
+ for i := ListBox1.Count - 1 downto 0 do
+ if ListBox1.ListItems[i].IsSelected = true then
+ begin
+ ListBox2.Items.Add(ListBox1.Items[i]);
+ ListBox1.Items.Delete(i);
+ end;
+end;
+
+procedure TForm2.Button2Click(Sender: TObject);
+var
+ i: Integer;
+begin
+ for i := ListBox2.Count - 1 downto 0 do
+ if ListBox2.ListItems[i].IsSelected = true then
+ begin
+ ListBox1.Items.Add(ListBox2.Items[i]);
+ ListBox2.Items.Delete(i);
+ end;
+end;
+
+procedure TForm2.Button3Click(Sender: TObject);
+begin
+ ListBox2.Items.AddStrings(ListBox1.Items);
+ ListBox1.Items.Clear;
+end;
+
+procedure TForm2.Button4Click(Sender: TObject);
+begin
+ ListBox1.Items.AddStrings(ListBox2.Items);
+ ListBox2.Items.Clear;
+end;
+
+procedure TForm2.FormShow(Sender: TObject);
+var
+ i: Integer;
+ s: string;
+begin
+ ListBox1.Items.Clear;
+ ListBox2.Items.Assign(Form1.ComboBox1.Items);
+ for i := 0 to Form1.Image1.ChildrenCount - 1 do
+ begin
+ s := Form1.Image1.Children[i].ClassName;
+ if ListBox2.Items.IndexOf(s) = -1 then
+ ListBox1.Items.Add(s);
+ end;
+end;
+
+end.
--- /dev/null
+object Form3: TForm3
+ Left = 0
+ Top = 0
+ BorderIcons = [biSystemMenu]
+ BorderStyle = Single
+ Caption = #38899#22768
+ ClientHeight = 480
+ ClientWidth = 640
+ FormFactor.Width = 320
+ FormFactor.Height = 480
+ FormFactor.Devices = [Desktop]
+ OnCreate = FormCreate
+ OnShow = FormShow
+ OnHide = FormHide
+ DesignerMasterStyle = 0
+ object Button1: TButton
+ ModalResult = 1
+ Position.X = 168.000000000000000000
+ Position.Y = 400.000000000000000000
+ TabOrder = 0
+ Text = 'OK'
+ end
+ object Button2: TButton
+ Cancel = True
+ ModalResult = 2
+ Position.X = 368.000000000000000000
+ Position.Y = 400.000000000000000000
+ TabOrder = 1
+ Text = 'Cancel'
+ end
+ object Panel1: TPanel
+ Align = Top
+ Size.Width = 640.000000000000000000
+ Size.Height = 305.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 6
+ object Button3: TButton
+ Default = True
+ Position.X = 432.000000000000000000
+ Position.Y = 96.000000000000000000
+ TabOrder = 0
+ Text = 'Open'
+ OnClick = Button3Click
+ end
+ object Label1: TLabel
+ Position.X = 520.000000000000000000
+ Position.Y = 152.000000000000000000
+ Text = 'Mute'
+ end
+ object SpeedButton1: TSpeedButton
+ StaysPressed = True
+ IsPressed = True
+ Position.X = 168.000000000000000000
+ Position.Y = 200.000000000000000000
+ Text = 'Test'
+ OnClick = SpeedButton1Click
+ end
+ object Switch1: TSwitch
+ IsChecked = False
+ Position.X = 432.000000000000000000
+ Position.Y = 152.000000000000000000
+ TabOrder = 3
+ end
+ object TrackBar1: TTrackBar
+ Orientation = Horizontal
+ Position.X = 96.000000000000000000
+ Position.Y = 128.000000000000000000
+ Size.Width = 241.000000000000000000
+ Size.Height = 20.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 4
+ OnChange = TrackBar1Change
+ object FloatAnimation1: TFloatAnimation
+ Duration = 0.200000002980232200
+ OnFinish = FloatAnimation1Finish
+ PropertyName = 'Value'
+ StartValue = 0.000000000000000000
+ StopValue = 0.000000000000000000
+ end
+ end
+ object ArcDial1: TArcDial
+ Position.X = 448.000000000000000000
+ Position.Y = 216.000000000000000000
+ TabOrder = 5
+ Value = 1.000000000000000000
+ Frequency = 1.000000000000000000
+ OnChange = ArcDial1Change
+ end
+ object CheckBox1: TCheckBox
+ Position.X = 344.000000000000000000
+ Position.Y = 128.000000000000000000
+ TabOrder = 6
+ Text = 'Loop'
+ end
+ object Label2: TLabel
+ Position.X = 344.000000000000000000
+ Position.Y = 152.000000000000000000
+ Text = 'Label2'
+ end
+ object Button4: TButton
+ Position.X = 104.000000000000000000
+ Position.Y = 200.000000000000000000
+ Size.Width = 41.000000000000000000
+ Size.Height = 22.000000000000000000
+ Size.PlatformDefault = False
+ TabOrder = 7
+ Text = '<<'
+ OnClick = Button4Click
+ end
+ end
+ object OpenDialog1: TOpenDialog
+ Filter = #38899#22768#12501#12449#12452#12523'(*.mp3;*.wmv;*.caf)|*.mp3;*.wmv;*.caf'
+ Options = [ofHideReadOnly, ofFileMustExist, ofEnableSizing]
+ Left = 352
+ Top = 256
+ end
+ object MediaPlayer1: TMediaPlayer
+ Left = 168
+ Top = 272
+ end
+end
--- /dev/null
+unit Unit3;
+
+interface
+
+uses
+ System.SysUtils, System.Types, System.UITypes, System.Classes,
+ System.Variants,
+ FMX.Types, FMX.Controls, FMX.Forms, FMX.Graphics, FMX.Dialogs, FMX.StdCtrls,
+ FMX.Media, Data.Bind.EngExt, Fmx.Bind.DBEngExt, System.Rtti,
+ System.Bindings.Outputs, Fmx.Bind.Editors, Data.Bind.Components, FMX.StdActns,
+ Math, FMX.Ani;
+
+type
+ TForm3 = class(TForm)
+ Button1: TButton;
+ Button2: TButton;
+ Button3: TButton;
+ TrackBar1: TTrackBar;
+ Switch1: TSwitch;
+ SpeedButton1: TSpeedButton;
+ Label1: TLabel;
+ OpenDialog1: TOpenDialog;
+ MediaPlayer1: TMediaPlayer;
+ Panel1: TPanel;
+ ArcDial1: TArcDial;
+ CheckBox1: TCheckBox;
+ Label2: TLabel;
+ Button4: TButton;
+ FloatAnimation1: TFloatAnimation;
+ procedure Button3Click(Sender: TObject);
+ procedure SpeedButton1Click(Sender: TObject);
+ procedure FormShow(Sender: TObject);
+ procedure FormHide(Sender: TObject);
+ procedure ArcDial1Change(Sender: TObject);
+ procedure FormCreate(Sender: TObject);
+ procedure Button4Click(Sender: TObject);
+ procedure TrackBar1Change(Sender: TObject);
+ procedure FloatAnimation1Finish(Sender: TObject);
+ private
+ { private \90é\8c¾ }
+ public
+ FileName: string;
+ Vol: Extended;
+ Current: integer;
+ { public \90é\8c¾ }
+ end;
+
+var
+ Form3: TForm3;
+
+implementation
+
+{$R *.fmx}
+
+procedure TForm3.ArcDial1Change(Sender: TObject);
+begin
+ with ArcDial1 do
+ if Value > ValueRange.Max then
+ Value:=ValueRange.Max
+ else if Value < ValueRange.Min then
+ Value:=ValueRange.Min;
+ MediaPlayer1.Volume:=1-ArcDial1.ValueRange.RelativeValue+Vol;
+end;
+
+procedure TForm3.Button3Click(Sender: TObject);
+begin
+ if OpenDialog1.Execute = true then
+ begin
+ FileName := OpenDialog1.FileName;
+ MediaPlayer1.FileName := OpenDialog1.FileName;
+ TrackBar1.Max:=MediaPlayer1.Duration/MediaTimeScale;
+ FloatAnimation1.StopValue:=TrackBar1.Max;
+ Label2.Text:=TimeToStr(TrackBar1.Max);
+ SpeedButton1Click(Sender);
+ end;
+end;
+
+procedure TForm3.Button4Click(Sender: TObject);
+begin
+ TrackBar1.Value:=0;
+end;
+
+procedure TForm3.FloatAnimation1Finish(Sender: TObject);
+begin
+ if CheckBox1.IsChecked = true then
+ FloatAnimation1.Start;
+end;
+
+procedure TForm3.FormCreate(Sender: TObject);
+begin
+ with ArcDial1.ValueRange do
+ begin
+ Max:=180;
+ Min:=-120;
+ ArcDial1.Value:=Min;
+ Vol:=RelativeValue;
+ end;
+ Label2.Text:=TimeToStr(0);
+end;
+
+procedure TForm3.FormHide(Sender: TObject);
+begin
+ MediaPlayer1.Clear;
+ SpeedButton1.IsPressed:=false;
+end;
+
+procedure TForm3.FormShow(Sender: TObject);
+begin
+ if FileName <> '' then
+ MediaPlayer1.FileName := FileName;
+end;
+
+procedure TForm3.SpeedButton1Click(Sender: TObject);
+begin
+ if SpeedButton1.IsPressed = true then
+ MediaPlayer1.Play
+ else
+ begin
+ MediaPlayer1.Stop;
+ FloatAnimation1.Stop;
+ end;
+end;
+
+procedure TForm3.TrackBar1Change(Sender: TObject);
+begin
+if FloatAnimation1.Running = true then exit;
+ FloatAnimation1.StartValue:=TrackBar1.Value;
+ FloatAnimation1.Duration:=TrackBar1.Max-TrackBar1.Value;
+ FloatAnimation1.Start;
+ Current:=Floor(TrackBar1.Value*MediaTimeScale);
+ MediaPlayer1.CurrentTime:=Current;
+end;
+
+end.