unit playlist; interface uses forms,controls,stdctrls,transparentpanel,classes,ExtCtrls,graphics,bitmapactionbutton,scrolllistbox,windows,main,sysutils; type tplaylistview = class(TTransparentPanel) lbshape : tshape; lbshape2 : tshape; public lb : tscrolllistbox; moveup,movedown,remove,play,purge : timage; constructor Create(AOwner : TComponent);override; procedure Resize; override; private buttimer : ttimer; currentbut : Tobject; procedure butMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure butMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); procedure OnTimer(Sender : TObject); // procedure setcurrenttrack( const BUTTIME = 250; ICONXSPACE = 30; end; implementation uses global,jukeboxform; constructor tplaylistview.Create(AOwner : TComponent); begin inherited create(Aowner); lb := Tscrolllistbox.create(self); lb.parent:=self; lbshape2 := Tshape.create(self); lbshape2.parent:=self; lbshape := Tshape.create(self); buttimer:=ttimer.Create(self); buttimer.Enabled:=false; buttimer.Interval:=BUTTIME; lbshape.parent:=self; lb.highlightcolor:=FONTCOL; lb.highlightindex:=true; moveup:=timage.Create(self); movedown:=timage.Create(self); remove:=timage.Create(self); play:=timage.Create(self); purge:=timage.Create(self); moveup.Parent:=self; movedown.Parent:=self; remove.Parent:=self; play.Parent:=self; purge.Parent:=self; moveup.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEUP_UP'); movedown.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEDOWN_UP'); remove.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_REMOVE_UP'); play.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PLAY_UP'); purge.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PURGE_UP'); end; procedure tplaylistview.resize; begin inherited resize; with lb do begin linespacing:=2; left:=aspy(4); top:=aspy(20); width:=(parent.Width)-(aspx(75)); height:=(parent.Height-top)-aspy(15);; color:=clblack; font.name:=JUKEBOXFONT; font.size:=aspy(8); showlabels:=false; drawmode:=true; font.color:=clgray; resize; end; lbshape2.Pen.color:={viewgit}{/viewgit}2087A1; lbshape2.BoundsRect:=lb.BoundsRect; lbshape2.Left:=lb.Left-aspx(2); lbshape2.Top:=lb.top-aspy(2); lbshape2.Width:=lb.width+aspx(4); lbshape2.height:=lb.height+aspy(4); lbshape2.Pen.width:=aspy(4); lbshape2.brush.style:=bsclear; lbshape.BoundsRect:=lb.BoundsRect; lbshape.Left:=lbshape.Left-aspx(3); lbshape.Top:=lbshape.top-aspy(3); lbshape.Width:=lbshape.width+aspx(6); lbshape.height:=lbshape.height+aspy(6); lbshape.Pen.width:=aspy(2); lbshape.Pen.color:=FONTCOL; lbshape.brush.style:=bsclear; lbshape.BringToFront; moveup.Width:=aspx(30); moveup.height:=aspy(40); movedown.Width:=aspx(30); movedown.height:=aspy(40); remove.Width:=aspx(30); remove.height:=aspy(30); play.height :=aspx(30); play.width:=aspy(30); purge.height :=aspx(30); purge.width:=aspy(30); moveup.Stretch:=true; movedown.Stretch:=true; remove.Stretch:=true; play.Stretch:=true; purge.Stretch:=true; moveup.Left:=lb.Left+lbshape.width+aspx(10); movedown.Left:=moveup.left; remove.Left:=moveup.left; play.Left:=moveup.left; purge.Left:=moveup.left; moveup.top:=lb.top; movedown.Top:=moveup.top+moveup.height+aspy(ICONXSPACE); remove.Top:=movedown.top+movedown.Height+aspy(ICONXSPACE); play.top:=remove.top+remove.height+aspy(ICONXSPACE); purge.top:=height-purge.height; moveup.Transparent:=true; movedown.Transparent:=true; remove.Transparent:=true; play.Transparent:=true; purge.Transparent:=true; play.Picture.Bitmap.TransparentColor:=rgb(255,0,0); purge.Picture.Bitmap.TransparentColor:=rgb(255,0,0); moveup.BringToFront; movedown.BringToFront; remove.BringToFront; play.BringToFront; purge.BringToFront; moveup.OnMouseDown:=butMouseDown; movedown.OnMouseDown:=butMouseDown; remove.OnMouseDown:=butMouseDown; play.OnMouseDown:=butMouseDown; purge.OnMouseDown:=butMouseDown; moveup.OnMouseUp:=butMouseUp; movedown.OnMouseUp:=butMouseUp; remove.OnMouseUp:=butMouseUp; play.OnMouseUp:=butMouseUp; purge.OnMouseUp:=butMouseUp; buttimer.OnTimer:=OnTimer; end; procedure tplaylistview.butMouseDown(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin if (sender=moveup) or (sender=movedown) then begin CurrentBut:=sender; Buttimer.Interval:=BUTTIME; Buttimer.Enabled:=true; end; if sender=moveup then moveup.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEUP_DOWN'); if sender=movedown then movedown.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEDOWN_DOWN'); if sender=remove then remove.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_REMOVE_DOWN'); if sender=play then play.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PLAY_DOWN'); if sender=purge then purge.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PURGE_DOWN'); end; procedure tplaylistview.butMouseUp(Sender: TObject; Button: TMouseButton; Shift: TShiftState; X, Y: Integer); begin ButTimer.Enabled:=false; if sender=moveup then moveup.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEUP_UP'); if sender=movedown then movedown.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_MOVEDOWN_UP'); if sender=remove then remove.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_REMOVE_UP'); if sender=play then play.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PLAY_UP'); if sender=purge then purge.Picture.Bitmap.LoadFromResourceName(hinstance,'PLAYLIST_PURGE_UP'); end; Procedure TPlayListView.OnTimer(Sender: TObject); begin if Buttimer.Interval>10 then Buttimer.Interval:=Buttimer.interval-5; if sender<>nil then TImage(CurrentBut).OnClick(CurrentBut); end; end.