;IRcap8 ebfd1eb164796e982f886224eb2d8695

Alias Playlist {
  if $1 == redim { guiwin @PList x x  $window(@plist).w $window(@plist).h | goto L1 }
  var %a = $readini ircap.ini ww plist
  guiwin @PList %a
  %plist.skla = 270 108
  if (!$window(@sba1.plist)) { window -hl @sba1.plist | PLISTBUF lee }
  else { window -hl @sba1.plist }

  :L1
  var %x = 14 | if $window(@plist).h < 180 { %x = 2000 }
  %plist.ls1 = %x 44 $calc($window(@plist).w - 50) $int($calc(($window(@plist).h / 14) - 9)) 1 0 plistplay @sba1.plist 0, $+ $calc($window(@plist).w - 92) $+ ,2500
  guitgrid @plist %plist.ls1 $m(272) $+  $+ $m(273) $+ Path

  var %y = $calc($window(@plist).h - 36)
  %plist.bt = 100 %y 10 mp3menus_+ +|130 %y 10 mp3menus_- -|160 %y 10 mp3menus_bar M|190 %y 10 mp3menus_l L
  inc %y 4
  %plist.tx = 220 %y $calc($window(@plist).w - 240) plist.busca

  drawpic -nt @plist 65280 18 %y skin\ $+ %skin $+ \c-audio.png

  guilista @plist plist.ls1
  guidib @plist
  if $1 != redim PLISTBUF dib
  window -wa @plist
  PLISTtit - - - - %tmp.musica

  if ($1 == busca) plistbusca $2-
}

alias REDIM.@PLIST {
  playlist redim | .timerPLTI 1 1 titula @plist $m(sbaplist) ( $line(@sba1.plist,0) ) > %plista.donde
  if $1 == fin wmueve2 @plist
}

alias LLENApl $iif($right($1-,4) isin .mp3 .ogg .wma .wav .mid,aline @sba1.plist $nopath($1-) $+ $chr(8) $+ 00:00 $+ $chr(8) $+ $1-)

alias PLISTtit {
  drawrect -nrf @plist $gettok(%gui.cc,15,44) 1 16 $calc($window(@plist).h  - 76) $calc($window(@plist).w - 32) 36
  cuagr @plist 14 $calc($window(@plist).h  - 76) $calc($window(@plist).w - 30) 36

  var %t = $iif(q isincs %mp3flag,- $+ $asctime($4,nn:ss),$asctime($4,nn:ss))
  drawtext -cnr @plist $gettok(%gui.cc2,18,44) Arial 16 23 $calc($window(@plist).h  - 70) 100 100 %t
  drawtext -cnr @plist $gettok(%gui.cc2,17,44) Arial 16 22 $calc($window(@plist).h  - 71) 100 100 %t

  var %c = %tmp.musica ( $+ $asctime($calc($2 / 1000),nn:ss) $+ ) | if ($width(%c,arial,11,1) > $calc($window(@plist).w  - 103)) { var %c = $5- }
  drawtext -cnro @plist $gettok(%gui.cc,17,44) Arial 11 80 $calc($window(@plist).h  - 71) $calc($window(@plist).w  - 103) 100 %c
  drawtext -cnro @plist $gettok(%gui.cc,2,44) Arial 11 80 $calc($window(@plist).h  - 72) $calc($window(@plist).w  - 104) 100 %c

  var %lin = $calc($window(@plist).w  - 104)
  cua @plist 80 $calc($window(@plist).h  - 51) %lin 3 $gettok(%gui.cc2,5,44) $gettok(%gui.cc2,6,44) $gettok(%gui.cc2,4,44)
  if ($2 isnum) drawrect -rnfe @plist $rgb(255,0,0) 1 $calc(79 + $3 / ($2 / %lin)) $calc($window(@plist).h  - 53) 5 8

  drawline @plist
}


alias onEDIT.@PLIST if ($1 == plist.busca) && (%plist.busca) plistbusca %plist.busca

alias UCLICK.@plist {
  var %w = $window(@plist).w , %h = $window(@plist).h
  if ($inrect($1,$2,20,$calc(%h - 70),48,16)) { if (q isincs %mp3flag) { %mp3flag = $removecs(%mp3flag,q) } | else { %mp3flag = %mp3flag $+ q } | bartit }

  if $inrect($1,$2,18,$calc(%h - 32),70,14) {
    var %x = 18 , %y = $calc(%h - 32)
    if $inrect($1,$2,%x,%y,14,14) { PLISTplay << }
    inc %x 14 | if $inrect($1,$2,%x,%y,14,14) { zplay stop }
    inc %x 14 | if $inrect($1,$2,%x,%y,14,14) { zplay repe }
    inc %x 14 | if $inrect($1,$2,%x,%y,14,14) { zplay pausa }
    inc %x 14 | if $inrect($1,$2,%x,%y,14,14) { PLISTplay >> }
  }
}
alias SCLICK.@plist {
  var %w = $window(@plist).w , %h = $window(@plist).h
  if ($inrect($1,$2,80,$calc(%h - 53),$calc(%w - 104),7)) && ($insong) {
    var %x = 80 , %an = $calc(%w - 104) , %p = $calc($1 - %x)
    splay seek $int($calc(($insong.length / %an) * %p)) | bartit
  }
  if $inrect($1,$2,18,$calc(%h - 32),70,14) {
    var %i = $int($calc(($1 - 18) / 14))
    wpulsa @plist $calc(18 + (%i * 14)) $calc(%h - 32) 14 14
  }
}

alias plist.cierra {
  ;  if (!$script(sba.plist.mrc)) window -c @sba1.plist
  .unload -rs $shortfn($script)
}
;EOF-dt
