на тему рефераты Информационно-образоательный портал
Рефераты, курсовые, дипломы, научные работы,
на тему рефераты
на тему рефераты
МЕНЮ|
на тему рефераты
поиск
Универсальный проигрыватель WinMedia
p align="left"> aBitmap1.Free;

aBitmap2.Free;

aIcon.Free;

TempPlayList.Free;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.FormShow(Sender: TObject);

begin

PlayListBox.Clear;

TempPlayList.Assign(MainForm.PlayList);

ListName := MainForm.PlayListName;

UpdatePlayListBox;

ListChanged := not ((ListName <> '') and (ListName <> 'noname.m3u'));

SetFileInfo;

SetButtons;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.FormHide(Sender: TObject);

begin

Приложение А (продолжение)

if ModalResult = mrOK then

begin

if ListChanged then

if MessageDlg('Сохранить изменения в плейлисте ?', mtConfirmation, [mbYes,mbNo],0) = mrYes then

begin

if (ListName <> 'noname.m3u') then

SavePlaylist1Click(nil)

else

SavePlaylistAs1Click(nil);

end;

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlayListEditor.SetListName(aValue: TFileName);

begin

FListName := aValue;

Caption := oldCaption;

if FListName <> '' then

Caption := Caption + ' - ' + FListName;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.SetButtons;

begin

AddButton.Enabled := (FileListBox.SelCount > 0);

RemoveButton.Enabled := (PlayListBox.SelCount > 0);

ClearButton.Enabled := (PlayListBox.Items.Count > 0);

RandomizeButton.Enabled := (PlayListBox.Items.Count > 0);

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlayListEditor.UpdatePlayListBox;

var

i: integer;

begin

PlayListBox.Clear;

for i := 0 to TempPlayList.Count-1 do

PlayListBox.Items.Add(ExtractFileName(TempPlayList[i]));

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlayListEditor.SetFileInfo;

var

FileName,S: String;

lpwio: PWaveIOCB;

MpegInfo: TMpegFileInfo;

begin

if (TempPlayList.Count > 0) and (PlayListBox.ItemIndex >= 0) then

begin

FileName := TempPlayList[PlayListBox.ItemIndex];

if IsMpegFile(FileName) then

begin

if GetMpegFileInfo(FileName, MpegInfo) then

begin

S := 'ISO MPEG ';

with MpegInfo do

begin

case Version of

v1 : S := S + '1 - ';

v2LSF: S := S + '2 - ';

end;

case Layer of

1: S := S + 'Layer I; ';

2: S := S + 'Layer II; ';

3: S := S + 'Layer III; ';

end;

S := S + Format('%2.3f kHz; %d KBit/s; ',[SampleRate/1000,BitRate]);

case SampleMode of

smStereo : S := S + 'Stereo;';

smJointStereo : S := S + 'Joint Stereo;';

smDualChannel : S := S + 'Dual Channel;';

smSingleChannel: S := S + 'Mono;';

end;

InfoLabel.Caption := S;

end;

exit;

end;

end

else if wioIsWaveFile(FileName, RIFF_FILE) then

begin

if wioReadFileInfo(lpwio, PChar(FileName),

mmioFOURCC('W', 'A', 'V', 'E'), RIFF_FILE) = 0 then

try

InfoLabel.Caption := 'WAVE - ';

wioGetFormatName(@lpwio.wfx, S);

InfoLabel.Caption := InfoLabel.Caption+' '+S;

wioGetFormat(@lpwio.wfx, S);

InfoLabel.Caption := InfoLabel.Caption+' '+S;

exit;

finally

wioFreeFileInfo(lpwio);

end;

end;

InfoLabel.Caption := 'Незнай че за файл...';

end

else InfoLabel.Caption := '';

end;

{-- TPlayListEditor -----------------------------------------------------}

function TPlaylistEditor.FirstSelection(aList: TCustomListBox): Integer;

begin

for Result := 0 to aList.Items.Count - 1 do

if aList.Selected[Result] then exit;

Result := LB_ERR;

end;

{-- TPlayListEditor -----------------------------------------------------}

function TPlaylistEditor.LastSelection(aList: TCustomListBox): Integer;

begin

for Result := aList.Items.Count - 1 downTo 0 do

if aList.Selected[Result] then exit;

Result := LB_ERR;

end;

{-- TPlayListEditor -----------------------------------------------------}

function TPlaylistEditor.FindIndex(aList: TListBox; aPos: TPoint): integer;

begin

with aList do

begin

Result := ItemAtPos(aPos, False);

if Items.Count > (Height div ItemHeight)-1 then

if Result = TopIndex + (Height div ItemHeight)-1 then

if aPos.Y > Height-(ItemHeight div 2) then

inc(Result);

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ClearSelected(aList: TCustomListBox);

Var

aIndex: integer;

begin

aIndex := FirstSelection(aList);

Приложение А (продолжение)

if aIndex > LB_Err then

begin

while aIndex <= LastSelection(aList) do

begin

if aList.Selected[aIndex] then

begin

aList.Selected[aIndex] := False;

ListChanged := True;

end;

inc(aIndex);

end;

SetFileInfo;

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.AddSelected(aIndex: integer);

Var

i: Integer;

begin

with TempPlayList do

begin

if (aIndex = -1) then aIndex := Count;

for i := 0 to FileListBox.Items.Count - 1 do

begin

if FileListBox.Selected[i] then

begin

Insert(aIndex, FileListBox.Items[i]);

ListChanged := True;

inc(aIndex);

end;

end;

UpdatePlayListBox;

if aIndex >= PlayListBox.Height div PlayListBox.ItemHeight then

PlayListBox.TopIndex := aIndex-((PlayListBox.Height div PlayListBox.ItemHeight)-1);

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ResortSelected(aIndex: integer);

Var

i: Integer;

begin

if (PlayListBox.Items.Count > 1) then

with PlayListBox do

begin

if (aIndex = -1) then aIndex := 0;

i := 0;

while i < Items.Count do

begin

if Selected[i] then

begin

Selected[i] := False;

ListChanged := True;

if aIndex > i then

begin

TempPlayList.Move(i, aIndex-1);

Items.Move(i, aIndex-1);

dec(i);

end

else

begin

Приложение А (продолжение)

TempPlayList.Move(i, aIndex);

Items.Move(i, aIndex);

inc(aIndex);

end;

end;

inc(i);

end;

if (Items.Count > 0) then

begin

TopIndex := 0;

Selected[0] := True;

Selected[0] := False;

end;

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.RemoveSelected;

Var

i: Integer;

begin

with PlayListBox do

begin

ItemIndex := 0;

for i := Items.Count - 1 downTo 0 do

if Selected[i] then

begin

Items.Delete(i);

TempPlayList.Delete(i);

ListChanged := True;

end;

if (Items.Count > 0) then

begin

TopIndex := 0;

Selected[0] := True;

Selected[0] := False;

end;

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ListMouseUp(Sender: TObject;

Button: TMouseButton; Shift: TShiftState; X, Y: Integer);

begin

if Button = mbLeft then

begin

if (Sender = PlayListBox) then SetFileInfo;

SetButtons;

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ListKeyUp(Sender: TObject; var Key: Word;

Shift: TShiftState);

begin

if (Sender = PlayListBox) then SetFileInfo;

SetButtons;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ListDrawItem(Control: TWinControl;

Index: Integer; Rect: TRect; State: TOwnerDrawState);

Var

Offset: Integer;

begin

with (Control as TListBox), (Control as TListBox).Canvas do

begin

FillRect(Rect);

Offset := 1;

if (odSelected in State) then

BrushCopy(Bounds(Rect.Left + Offset, Rect.Top,

aBitmap2.Width, aBitmap2.Height),

aBitmap2,

Bounds(0, 0, aBitmap2.Width, aBitmap2.Height),

clBlack)

else

BrushCopy(Bounds(Rect.Left + Offset, Rect.Top,

aBitmap1.Width, aBitmap1.Height),

aBitmap1,

Bounds(0, 0, aBitmap1.Width, aBitmap1.Height),

clWhite);

Offset := Offset + aBitmap1.Width + 5;

TextOut(Rect.Left + Offset, Rect.Top, Items[Index]);

end;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.AddButtonClick(Sender: TObject);

begin

AddSelected(-1);

SetButtons;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.RemoveButtonClick(Sender: TObject);

begin

RemoveSelected;

SetButtons;

end;

{-- TPlayListEditor -----------------------------------------------------}

procedure TPlaylistEditor.ClearButtonClick(Sender: TObject);

begin

TempPlayList.Clear;

PlayListBox.Clear;

ListChanged := True;

SetFileInfo;

Страницы: 1, 2, 3, 4, 5, 6, 7, 8



© 2003-2013
Рефераты бесплатно, курсовые, рефераты биология, большая бибилиотека рефератов, дипломы, научные работы, рефераты право, рефераты, рефераты скачать, рефераты литература, курсовые работы, реферат, доклады, рефераты медицина, рефераты на тему, сочинения, реферат бесплатно, рефераты авиация, рефераты психология, рефераты математика, рефераты кулинария, рефераты логистика, рефераты анатомия, рефераты маркетинг, рефераты релиния, рефераты социология, рефераты менеджемент.