Changeset 569 for CoolAudio/Demo/FormPlaylist.pas
- Timestamp:
- Mar 26, 2024, 11:37:40 PM (7 months ago)
- File:
-
- 1 moved
Legend:
- Unmodified
- Added
- Removed
-
CoolAudio/Demo/FormPlaylist.pas
r568 r569 1 unit UFormPlaylist; 2 3 {$mode objfpc}{$H+} 1 unit FormPlaylist; 4 2 5 3 interface … … 7 5 uses 8 6 Classes, SysUtils, FileUtil, Forms, Controls, Graphics, Dialogs, StdCtrls, 9 ComCtrls, Menus, ActnList, UPlaylist;7 ComCtrls, Menus, ActnList, Playlist; 10 8 11 9 type … … 47 45 procedure ListView1DblClick(Sender: TObject); 48 46 procedure ListView1KeyPress(Sender: TObject; var Key: char); 49 private50 { private declarations }51 47 public 52 48 procedure ReloadList; … … 61 57 62 58 uses 63 UAudioSystem, UFormMain;59 AudioSystem, FormMain; 64 60 65 61 resourcestring … … 76 72 procedure TFormPlaylist.AClearAllExecute(Sender: TObject); 77 73 begin 78 FormMain. PlayList.Items.Clear;74 FormMain.FormMain.PlayList.Items.Clear; 79 75 ReloadList; 80 76 end; … … 84 80 I: Integer; 85 81 begin 86 with FormMain. PlayList, Items do begin82 with FormMain.FormMain.PlayList, Items do begin 87 83 for I := Count - 1 downto 0 do 88 84 if ListView1.Items[I].Selected then Delete(I); … … 94 90 procedure TFormPlaylist.AItemPlayExecute(Sender: TObject); 95 91 begin 96 FormMain. PlayList.CurrentIndex := ListView1.Selected.Index;97 FormMain. PlayList.Play;92 FormMain.FormMain.PlayList.CurrentIndex := ListView1.Selected.Index; 93 FormMain.FormMain.PlayList.Play; 98 94 end; 99 95 … … 112 108 NewItem := TPlaylistItem.Create; 113 109 NewItem.FileName := Dir + DirectorySeparator + sr.Name; 114 FormMain. PlayList.Items.Add(NewItem);110 FormMain.FormMain.PlayList.Items.Add(NewItem); 115 111 end; 116 112 until FindNext(sr) <> 0; … … 124 120 begin 125 121 if OpenDialog1.Execute then begin 126 FormMain. PlayList.AddFile(OpenDialog1.FileName);122 FormMain.FormMain.PlayList.AddFile(OpenDialog1.FileName); 127 123 ReloadList; 128 124 end; … … 145 141 procedure TFormPlaylist.ListView1Data(Sender: TObject; Item: TListItem); 146 142 begin 147 if (Item.Index >= 0) and (Item.Index < FormMain. PlayList.Items.Count) then148 with TPlaylistItem(FormMain. PlayList.Items[Item.Index]) do begin143 if (Item.Index >= 0) and (Item.Index < FormMain.FormMain.PlayList.Items.Count) then 144 with TPlaylistItem(FormMain.FormMain.PlayList.Items[Item.Index]) do begin 149 145 Item.Caption := FileName; 150 Item.Data := FormMain. PlayList.Items[Item.Index];146 Item.Data := FormMain.FormMain.PlayList.Items[Item.Index]; 151 147 end; 152 148 end; … … 164 160 procedure TFormPlaylist.ReloadList; 165 161 begin 166 ListView1.Items.Count := FormMain. PlayList.Items.Count;162 ListView1.Items.Count := FormMain.FormMain.PlayList.Items.Count; 167 163 ListView1.Refresh; 168 164 ListView1.Selected := nil; 169 if (FormMain. PlayList.CurrentIndex >= 0) and170 (FormMain. PlayList.CurrentIndex < ListView1.Items.Count) then171 ListView1.Items[FormMain. PlayList.CurrentIndex].Selected := True;165 if (FormMain.FormMain.PlayList.CurrentIndex >= 0) and 166 (FormMain.FormMain.PlayList.CurrentIndex < ListView1.Items.Count) then 167 ListView1.Items[FormMain.FormMain.PlayList.CurrentIndex].Selected := True; 172 168 UpdateInterface; 173 169 end; … … 178 174 AItemPlay.Enabled := Assigned(ListView1.Selected); 179 175 AClearAll.Enabled := ListView1.Items.Count > 0; 180 CheckBoxRandom.Checked := FormMain. PlayList.RandomOrder;181 CheckBoxRepeat.Checked := FormMain. PlayList.RepeatInfinitely;176 CheckBoxRandom.Checked := FormMain.FormMain.PlayList.RandomOrder; 177 CheckBoxRepeat.Checked := FormMain.FormMain.PlayList.RepeatInfinitely; 182 178 end; 183 179
Note:
See TracChangeset
for help on using the changeset viewer.