:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
:::::               XcLusive Script                       :::::
:::::               Mp3 Player                            :::::
:::::               HaLiL@AhKalbim.Net                    :::::
:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
alias mp3player if (!$fgi($wm)) mCmp3 | else fgi -a $wm
alias  mD if $1 == -u { dll -u $_md | return } | var %r $dll($_md,$1,$iif($2,$2-,$s)) | if $isid { return %r }
alias  _mD return $shortfn($mircdirmp3\ $+ mp3play.dll)
alias  c {
  var %h mCmp3.vars
  if $1 == -f && $hget(%h) { hfree %h | return }
  if $1 == -r && $hget(%h) { hsave -o %h $cfg | hfree %h | return }
  if $1 == -l { if !$hget(%h) { hmake %h  } | if $isfile($cfg) { hload %h $cfg | return } }
  if $isid { return $hget(%h,$1) }
  else { hadd -m %h $1 $2- }
}
alias  p {
  var %h mCmp3.pl
  if $1 == -r && $hget(%h) { hfree %h | return }
  if $1 == -d { hdel -w %h $2- | return }
  if $1 == -m && !$hget(%h) { hmake %h | return }
  if $1 == -l { if !$hget(%h) { hmake %h } | hload %h $2- | return }
  if $1 == -s { hsave -o %h $2- | return }
  if $isid { return $hget(%h,$1) } | else { hadd -m %h $1 $2- }
}
alias  cdpl if $isid { return $c(pl.cd) } | c pl.cd $1
alias  ch return $str($chr(159),$1)
alias  cfg return $+(",$scriptdir,mcmp3.cfg,")
alias  dr drawrect $1-
alias  dt drawtext $1-
alias  gt var %r $calc($2 + $1) | %r = $iif(%r > 255,255,$iif(%r < 0,0,%r)) | return %r
alias  g var %r $1 | tokenize 46 $c(sh) | return $rgb($gt($1,%r),$gt($2,%r),$gt($3,%r))
alias  help run $+(",$scriptdir,MCMP3.HLP,")
alias  ismp3 return $iif($right($1-,3) == MP3,$true,$false)
alias  insnd.fname { return $c(insnd.fname) }
alias  insnd.pos { 
  if $cdpl { return $calc($md(MediaGet,position) - $md(MediaGet,position track $c(t))) }
  else { return $md(MediaGet,position) }
}
alias  insnd.length if $cdpl { return $md(MediaGet,length track $c(t)) } | else { return $md(MediaGet,length) }
alias  insnd {
  var %s $md(MediaGet,mode)
  If (%s == playing) || (%s == paused) { return $true }
  return $false
}
alias l return $line($iif($2,$2,$wl),$1,0)
alias mcEW { window -e +l @mcmp3.echo $w(-2).w 0 150 $w(-2).h }
alias mcicon return $+(",$mircdirmp3\MCLOGO.ICO,")
alias mcVer return 3.5
alias mE { aline @mcmp3.echo $1- }
alias mecho { echo $colour(info) -ai2t $1- }
alias mplay {
  if $1 == -s { md MediaCDStop | if (!$cdpl || $2) { md MediaClose } }
  elseif $1 == -p {
    if !$cdpl {
      var %r $md(MediaPlay,$2)
      if $gettok(%r,1,32) == OK { return OK }
      else { 
        var %e $gettok(%r,2,32)
        if (%e == MMSYSTEM277) || (%e == MMSYSTEM263) { %r = !Hata! Media Player kullanımda yada Windows Media Player 6.4 yada üstü sürümü yüklemeniz gerekiyor }
        return %r
      }
    }
    else {
      var %r $md(MediaCDPlay,$2)
      if %r == OK { return OK }
      else {
        var %e $gettok(%r,2,32)
        return %e
      }
    }
  }
  elseif $1 == -k { if $cdpl { md MediaCDSeek $calc($int($md(MediaGet,position track $c(t))) + $2) } | else { md MediaSeek $2 } }
  elseif $1 == -r {
    if $cdpl { md MediaCDSeek $c(pau.cdpos) }
    else { md MediaResume }
  }
  elseif $1 == -a {
    c pau.cdpos 0 
    if $cdpl { c pau.cdpos $md(MediaGet,position) }
    md MediaPause
  }
}
alias -l RGBfile return $+(",$scriptdir,CPRESET.CFG,")
alias -l RGBnew return $+(",$scriptdir,NEWPRESETS.CFG,")
alias -l s return $chr(160)
alias -l sd return $iif($isdir($c(ldir)),$c(ldir),$scriptdir)
alias -l sl return [ $ [ $+ [ sline($wl,$1) [ $+ [ $iif($prop,. $+ $prop)) ] ] ] ] ]
alias -l t $+(.timer,$iif(*MCL* !iswm $1,$chr(32)),$1-) 
alias -l to t MCL $+ $1 $+ * off
alias -l w if ($isid) return [ $ [ $+ [ window($1-) [ $+ [ $iif($prop,. $+ $prop) ] ] ] ] ] | else window $1-
alias fgi if ($isid) return [ $ [ $+ [ window($1-) [ $+ [ $iif($prop,. $+ $prop) ] ] ] ] ] | else window $1-
alias -l wD return @mcmp3.dummy
alias -l wID3 return @mcmp3.ID3
alias -l wl return @mcmp3.List
alias -l wlm return @mcmp3.ListMain
alias wm return @XcLusive
alias -l wp return @mcmp3.popup
alias -l wt if $isid { return @mcLISTTEMP } | else { if $1 == -c { w -c @mcLISTTEMP } | else { w -sh +st @mcLISTTEMP } }
alias -l wr var %r $dll($_wr,$1,$2-) | if (E_* iswm %r) { mecho *** Winrgn ile hata: %r : $1 $2- }
alias -l _wr return $shortfn($mircdirmp3\ $+ winrgn.dll)
alias -l x cdpl $false | mplay -s x | if $1 != exit { to | dll -u $_wr | md -u | w -c $wp | w -c $wl | w -c $wlm | w -c $wID3 | w -c $wm } | m -r | c -r | p -r | .disable #mc3mp3end
alias -l tags.val {
  var %v $2-,%f $longfn($1),%v2 $replace(%v,<uzunluk>,0,<albüm>,$chr(32),<trk>,0,<artist>,$chr(32),<başlık>,$chr(32),<kbps>,0)
  if !$ismp3($1) { %v = %v2 }
  if *<dosya.mp3>* iswm %v { %v = $replace(%v,<dosya.mp3>,$nopath(%f)) }
  if *<dosya>* iswm %v { %v = $replace(%v,<dosya>,$left($nopath(%f),-4)) }
  if *<sürücü>* iswm %v { %v = $replace(%v,<sürücü>,$left(%f,2)) }
  if *<dizin>* iswm %v { %v = $replace(%v,<dizin>,$right($nofile(%f),-3)) } 
  if *<boyut>* iswm %v { %v = $replace(%v,<boyut>,$round($calc($lof(%f)/1000000),2) $+ mb) }
  if *<uzunluk>* iswm %v { %v = $replace(%v,<uzunluk>,$remove($duration($calc($sound(%f).length / 1000)),ecs,ec,ins,in,rs,r,$chr(32))) }
  if *<albüm>* iswm %v { %v = $replace(%v,<albüm>,$sound(%f).album) }
  if *<trk>* iswm %v { %v = $replace(%v,<trk>,$sound(%f).track) }
  if *<artist>* iswm %v { %v = $replace(%v,<artist>,$sound(%f).artist) }
  if *<başlık>* iswm %v { %v = $replace(%v,<başlık>,$sound(%f).title) }
  if *<kbps>* iswm %v { %v = $replace(%v,<kbps>,$sound(%f).bitrate) }
  return %v
}
alias -l mcl.cm {
  m.create 165 6 "Arial" 10 _Liste,_Ayarlar
  m.aItem 1 Şarkı listesi yükle... | m.setcmd 1 1 pl L
  m.aItem 1 Şarkı listesini sırala.. | m.setcmd 1 2 pl Sort
  m.aItem 1 Şarkı listesini kaydet... | m.setcmd 1 3 pl S
  m.aItem 1 -EKLE
  m.aItem 1 Dosya... | m.setcmd 1 5 pl A F
  m.aItem 1 Klasör... | m.setcmd 1 6 pl A D
  m.aItem 1 Klasör ve alt klasörler... | m.setcmd 1 7 pl A Dr
  m.aItem 1 -KALDIR
  m.aItem 1 Seçilen dosyaları  | m.setcmd 1 9 pl Rs
  m.aItem 1 Bütün dosyaları | m.setcmd 1 10 pl Ra
  m.aItem 1 -BUL
  m.aItem 1 Listede şarkı bul... | m.setcmd 1 12 find.mp3
  m.aItem 1 -
  m.aItem 1 Müzik CD'si oynat... | m.setcmd 1 14 pc Pcd
  m.aItem 1 -
  m.aItem 1 Kapat | m.setcmd 1 16 x
  m.aItem 2 -Oynatma şekli
  m.aItem 2 Devamlı | m.setcmd 2 2 m.chk c
  m.aItem 2 Rastgele | m.setcmd 2 3 m.chk r
  m.aItem 2 Elle | m.setcmd 2 4 m.chk m
  m.aItem 2 Tekrar et (devamlı) | m.setcmd 2 5 m.chk p
  m.aItem 2 -Şarkıyı oynat
  m.aItem 2 Çift tıklama | m.setcmd 2 7 m.chk dclick
  m.aItem 2 Tek tıklama | m.setcmd 2 8 m.chk sclick
  m.aItem 2 -
  m.aItem 2 Kanala göster... | m.setcmd 2 10 spam.edit
  m.aItem 2 Şarkı listesi görünümü... | m.setcmd 2 11 pl.dView
  m.aItem 2 Görünüm... | m.setcmd 2 12 rgb.w
  m.aItem 2 -
  m.aItem 2 ID3v1 Düzenleyici... | m.setcmd 2 14 id3.draw FROMMENU
}
alias -l loadset {
  if $1 == -start { cdpl $false | mplay -s start | c t 1 | c ts 0 | c pau $false | c plHide $iif($c(plhide),$false,$true) | c id3c.file $s | c scr.f $false }
  elseif $isfile($cfg) {
    c -l
    if ($c(MCMP3VERSION) != $mcVer) {
      var %d $input(You have updated to a new version of XcLusive MP3 $crlf Your mcmp3 config file will now be updated also. $crlf Unfortunately you will lose all settings this does not include Color Presets.,68,mcMp3 Info)
      if $isfile($RGBFile) { .copy -a $RGBnew $RGBfile }
      else { .copy $RGBnew $RGBfile }
      c -f | .remove $cfg
      goto init
    }
  }
  else { :init
    if !$isfile($RGBfile) { .copy $RGBnew $RGBfile }
    c MCMP3VERSION $mcVer
    c Sh 0.-80.-100
    c w.x 0 | c w.y 0 | c w.w 366 | c w.h 112
    c pl.x $c(w.x) | c pl.y $calc($c(w.y) + $c(w.h)) | c pl.w 385 | c pl.h 250 | c pl.stick $false
    c id3.x $calc($c(w.x) + $c(w.w) + 20) | c id3.y 0 | c id3.w 300 | c id3.h 230 | c id3.stick $false
    c btns cP,cS,cPa,cPr,cN,cU,cD,cH,cC,cM,cVu,cVd,cAddDir,cAddRec,cAddFile,cRemAll,cRemSel,cReSize,cLoad,cSave,cCArtist,cCAlbum,cCTitle,cCYear,cCGenre,cCComments,cID3Update,cID3Done,cID3Help
    c plHide $false
    c bk 30 | c bkpop 110
    c pView <dosya>
    c plColor $false
    c V $int($calc($vol(song) / 8000)))
    c s.y 85 | c s.s 10 | c s.w 150 | c s.e $calc($c(s.s) + $c(s.w)) | c s.sz 15 | c s.h 22
    c clickMode dClick | c pMode c | c TimeMode inc
    c pl.font "Arial" | c pl.fontsize 12 | c pl.fontbold $false
    c spam.template mp3) <dosya> )<uzunluk>)<kbps>kbPS)<boyut>
    c spam.target 2 | c spam.chan $a
  }
}
alias mCmp3 {
  .enable #mc3mp3end | loadset | loadset -start | d.switch
  w -Bdhpk +d $wm $c(w.x) $c(w.y) $c(w.w) $c(w.h) $mcicon | titlebar $wm mp3
  var %ww $w($wm).w,%wh $w($wm).h
  w -Bdhp +dL $wlm $c(pl.x) $c(pl.y) $c(pl.w) $c(pl.h)
  wr wrSelectWindow $w($wm).hwnd
  wr wrSetMode rmRect | wr wrSetRegion 0 0 %ww %wh
  wr wrDeleteRegion 0 0 %ww %wh
  wr wrSetMode rmRoundRect
  wr wrAddRegion 0 0 $calc(%ww + 1) %wh 30 30
  wr wrSetMode rmRect
  wr wrAddRegion 0 0 30 30
  w -Bdhl +dnL $wl $calc($w($wlm).dx + 3) $calc($w($wlm).dy + 20) $calc($c(pl.w) - 6) $calc($c(pl.h) - 50) $wl
  pc H init
  font $iif($c(pl.fontbold),-b) $wl $c(pl.fontsize) $c(pl.font)
  dr -fr $wm $g($c(bk)) 1 0 0 $w($wm).dw $w($wm).dh
  p -m | pl.draw
  mcl.cm | m.chk $iif($c(pmode),$ifmatch,c) | m.chk $iif($c(clickmode),$ifmatch,dClick)
  mcl.draw | pc | if $isfile($c(pl)) { t -mo 1 500 pl L $c(pl) | rs tI }
}
alias mp3 {
  .enable #mc3mp3end | loadset | loadset -start | d.switch
  w -Bdhpk +d $wm $c(w.x) $c(w.y) $c(w.w) $c(w.h) $mcicon | titlebar $wm mp3
  var %ww $w($wm).w,%wh $w($wm).h
  w -Bdhp +dL $wlm $c(pl.x) $c(pl.y) $c(pl.w) $c(pl.h)
  wr wrSelectWindow $w($wm).hwnd
  wr wrSetMode rmRect | wr wrSetRegion 0 0 %ww %wh
  wr wrDeleteRegion 0 0 %ww %wh
  wr wrSetMode rmRoundRect
  wr wrAddRegion 0 0 $calc(%ww + 1) %wh 30 30
  wr wrSetMode rmRect
  wr wrAddRegion 0 0 30 30
  w -Bdhl +dnL $wl $calc($w($wlm).dx + 3) $calc($w($wlm).dy + 20) $calc($c(pl.w) - 6) $calc($c(pl.h) - 50) $wl
  pc H init
  font $iif($c(pl.fontbold),-b) $wl $c(pl.fontsize) $c(pl.font)
  dr -fr $wm $g($c(bk)) 1 0 0 $w($wm).dw $w($wm).dh
  p -m | pl.draw
  mcl.cm | m.chk $iif($c(pmode),$ifmatch,c) | m.chk $iif($c(clickmode),$ifmatch,dClick)
  mcl.draw | pc | if $isfile($c(pl)) { t -mo 1 500 pl L $c(pl) | rs tI }
}

alias -l mcl.draw {
  var %ww $w($wm).w,%wh $w($wm).h,%i,%s,%x
  d.switch $wm | d.b 0 0 %ww $calc(%wh - 1) 28 28 $c(bk) | d.f 3 2 255 18 $c(bk) | d.b 0 0 $calc(%ww - 47) 25
  d.l -v 0 20 10 | d.l -h $calc(%ww - 50) 0 30 | d.l -h $calc(%ww - 50) 22 47 | drawfill -rs $wm $g(95) $g($c(bk)) $calc(%ww - 10) 10
  d.btn $calc(%ww - 26) 4 18 18 cC | d.btn $calc(%ww - 45) 4 18 18 cM
  %i = 1 | %x = 5 | %s = XcLusive $+ $s $+ Mp3
  while %i <= $len(%s) {
    dt -nro $wm $g($calc(%i * 20)) "Arial" 12 %x 5 $mid(%s,%i,1)
    %x = %x + $width($mid(%s,%i,1),Arial,12,1,0) | inc %i
  }
  d.b 4 51 358 33 25 25 80 tCtl "Arial" 12 -5 $s
  drawline -r $wm $g(0) 1 240 64 240 70 244 70 252 78 252 56 244 64 240 64
  drawfill -rs $wm $g(175) $g(80) 245 68
  %i = 1 | while %i <= 8 { d.btn $calc(7 + (%i * 26) - 26) 55 25 25 $gettok($c(btns),%i,44) | inc %i }
  d.b 4 26 62 23 5 5 35 tT "System" 10 1 00:00 | d.b 68 26 294 23 15 15 1 tG "FixedSys" 6 1 $s
  d.b 182 86 178 20 20 20 55 tD "Arial" 11 1 $s
  d.b 255 56 100 22 15 15 80 tV "FixedSys" 6 1 $s
  d.btn 259 60 14 14 cVd | d.btn 337 60 14 14 cVu | rs tV | if $insnd { rs tD $c(tD.lline) }
  d.b $calc($c(s.s) - 4) $c(s.y) $calc($c(s.w) + 25) $c(s.h) 20 20 25 tE "FixedSys" 10 0 $s
  c tmode $s | var %i 1
  while %i <= $m(menu.subs) { dt -r $wm $g(255) $m(menu.font) $m(menu.fontsize) $m($+(menu.,%i,.x)) $m($+(menu.,%i,.y)) $m($+(menu.,%i,.name)) | inc %i }
}
alias -l mws.d {
  if $1 != 0 { dr -nrf $wlm $g($c(bk)) 1 2 2 $calc($2 - 4) $calc($3 - 4) }
  dr -nr $wlm $g($1) 2 0 0 $2 $3 | pl.d.rs
  dt -nr $wlm $g(200) "Arial" 10 $calc($2 - 180) $calc($3 - 20) Boyutu ayarlamak için tutup çekin ->
  c pl.mws.ow $2 | c pl.mws.oh $3
}
alias -l mws {
  if !$ctimer {
    wr wrSelectWindow $w($wlm).hwnd | wr wrResetWindow $w($wlm).hwnd | t -ho 1 10 md HW $w($wl).hwnd
    mws.d 255 $c(pl.w) $c(pl.h) | dr $wlm
  }
  elseif ($mouse.dx != $1 || $mouse.dy != $2) {
    if $calc($mouse.dy - $c(pl.y) + 15) < 150 { c pl.h 150 } | else { c pl.h $calc($mouse.dy - $c(pl.y) + 15) }
    if $calc($mouse.dx - $c(pl.x) + 15) < 398 { c pl.w 398  } | else { c pl.w $calc($mouse.dx - $c(pl.x) + 15) }
    w $wlm $c(pl.x) $c(pl.y) $c(pl.w) $c(pl.h) | mws.d 0 $c(pl.mws.ow) $c(pl.mws.oh) | mws.d 255 $c(pl.w) $c(pl.h) | dr $wlm
  }
  if $mouse.key & 1 { t -mo 1 0 mws $mouse.dx $mouse.dy } 
  else { pl.draw }
}
alias -l mw {
  if $1 == $wm { 
    c w.x $calc($mouse.dx - $2)
    c w.y $calc($mouse.dy - $3)
    w $wm $c(w.x) $c(w.y)
  }
  elseif $1 == $wlm {
    c pl.x $calc($mouse.dx - $2)
    c pl.y $calc($mouse.dy - $3)
    w $wlm $c(pl.x) $c(pl.y) | w $wl $calc($w($wlm).dx + 3) $calc($w($wlm).dy + 20)
  }
  elseif $1 == $wID3 {
    c id3.x $calc($mouse.dx - $2)
    c id3.y $calc($mouse.dy - $3)
    w $wID3 $c(id3.x) $c(id3.y)
  }
  if ($mouse.key & 1) { t MCL.move -o 1 0 mw $1- }
}
alias -l ms {
  if (!$insnd) return
  var %y $mouse.y
  if $mouse.key & 1 {
    if $1 == SCROLL {
      var %x $mouse.x, %y $mouse.y
      if !$ctimer { c scr.f $true }
      if $c(scr.f) {
        if $inrect(%x,%y,$c(tG.x),$c(tG.y),$c(tG.w),$c(tG.h)) &&  (2 // $calc(%x - $c(tG.x))) && ($c(scr.ox) != %x) { scroll.c -m $iif($c(scr.ox) > %x,$calc($c(scr.i) + 1),$calc($c(scr.i) - 1)) $c(scr) }
        c scr.ox %x | t MCL.msn -o 1 0 ms SCROLL
      }
    }
    else { 
      c s.f $true
      var %t $calc($mouse.x - $c(s.s) - 7), %a $calc($c(s.s) + %t)
      if %t != $c(s.o) && %a >= $c(s.s) && %a <= $c(s.e) && %y > $calc($c(s.y) + 3) && %y < $calc($c(s.y) + $c(s.h)) { ts2 %t | dr $wm }
      t MCL.ms -o 1 0 ms
    }
  }
  else { if $1 != SCROLL && $insnd { mplay -k $round($calc($c(s.sec) * $c(s.o) * 1000),-1) } }
}
alias -l mv {
  if $c(ts) > 0 {
    var %l $2,%o 
    %o = $l(%l)
    if %l $3 $4 {
      dline $wl %l | iline $wl $1 %o
      %o = $p($1)
      p $1 $p($2) | p $2 %o
    }
  }
}
alias -l id3.close t MCLb* off | w -c $wID3 | c id3c.file $s | w -a $wm
alias -l id3.draw {
  if $w($wID3) && $1 == FROMMENU { return }
  if !$w($wID3) { w -Bdhp +dL $wID3 $c(id3.x) $c(id3.y) $c(id3.w) $c(id3.h) }
  if $1 != -rgn {
    wr wrSelectWindow $w($wID3).hwnd | wr wrResetWindow $w($wID3).hwnd
    wr wrSetMode rmRoundRect
    wr wrSetRegion 0 0 $calc($c(id3.w) + 1) $c(id3.h) 30 30
    wr wrSetMode rmRect
    wr wrAddRegion 0 0 $c(id3.w) 140
  }
  d.switch $wID3
  d.b 0 0 $c(id3.w) $calc($c(id3.h) - 1) 28 28 $calc($c(bk) + 55)
  d.b 0 0 $c(id3.w) 20 0 0 65 tID3t "Arial" 11 1 $s | rs tID3t Mp3 etiket düzenleyici (ID3V1)
  d.l -v 0 15 10 | d.l -v $calc($c(id3.w) - 3) 15 10
  var %w $calc($c(id3.w) - 70)
  d.b 5 25 %w 20 15 15 15 tArtist "Arial" 11 1 $s
  d.b 5 50 %w 20 15 15 15 tAlbum "Arial" 11 1 $s
  d.b 5 75 %w 20 15 15 15 tTitle "Arial" 11 1 $s
  d.b 5 100 100 20 15 15 15 tYear "Arial" 11 1 $s
  d.b 5 125 175 20 15 15 15 tGenre "Arial" 11 1 $s
  d.b 5 150 %w 20 15 15 15 tComments "Arial" 11 1 $s
  d.b 5 175 $calc($c(id3.w) - 10) 20 15 15 15 tID3File "Arial" 11 1 $s
  d.b 35 200 200 20 15 15 15 tID3Status "Arial" 11 1 $s
  var %i 21,%i2 25 | while %i <= 26 { d.btn $calc($c(id3.w) - 60) %i2 55 20 $gettok($c(btns),%i,44) Round 100 15 15 | inc %i | inc %i2 25 }
  d.btn $calc($c(id3.w) - 60) 200 55 20 cID3Update Round 100 15 15
  d.btn $calc($c(id3.w) - 18) 3 14 14 cID3Done | d.btn $calc($c(id3.w) - 34) 3 14 14 cID3Help
  id3.refresh $null
}
alias -l id3.refresh {
  if !$w($wID3) { return }
  rs tArtist Artist: $iif($sound($1).artist,$ifmatch)
  rs tAlbum Albüm: $iif($sound($1).Album,$ifmatch)
  rs tTitle Başlık: $iif($sound($1).title,$ifmatch)
  rs tYear Yıl: $iif($sound($1).year,$ifmatch)
  rs tGenre Tür: $iif($sound($1).genre,$ifmatch)
  rs tComments Bilgi: $iif($sound($1).comment,$ifmatch)
  rs tID3file $iif($isfile($1),$nopath($longfn($1)),$s)
  if !$ismp3($1) { rs tID3Status Durum: Geçersiz dosya türü $right($1,3) | c id3c.file $s | return }
  c id3c.file $1
  rs tID3Status Durum:
}
alias -l id3.change {
  if !$isfile($c(id3c.file)) { return }
  c id3c.field $1 | c id3c.text $3- | c id3c.cancel $false
  var %r $iif($1 == genre,$dialog(id3cgenre.d,id3cgenre.t,$wID3),$dialog(id3c.d,id3c.t,$wID3))
  if !$c(id3c.cancel) {
    %r = $c(id3c.result)
    if $1 == year { %r = $left(%r,4) }
    rs $+(t,$1) $+($1,:,$s,%r)
  }
}
alias -l id3.update {
  rs tID3Status Durum: ID3 tag değiştirilmeye çalışılıyor
  if !$ismp3($1) { rs tID3Status Durum: Geçersiz dosya türü | return }
  if !$isfile($1) { rs tID3Status Durum: Dosya mevcut değil | return }
  if $insnd && $shortfn($insnd.fname) == $1 { rs tID3Status Durum: mp3 oynatılırken değiştirilemedi | return }
  md SetID3Tag init
  md SetID3Tag artist $iif($right($c(tArtist.o),-8),$ifmatch,$s)
  md SetID3Tag Album $iif($right($c(tAlbum.o),-7),$ifmatch,$s)
  md SetID3Tag title $iif($right($c(tTitle.o),-7),$ifmatch,$s)
  md SetID3Tag year $iif($right($c(tYear.o),-6),$ifmatch,$s)
  md SetID3Tag genre $iif($replace($right($c(tGenre.o),-7),$chr(32),_),$ifmatch,$s)
  md SetID3Tag comments $iif($right($c(tComments.o),-10),$ifmatch,$s)
  var %d $md(SetID3Tag,update $1)
  if %d == UPDATE_OK {
    rs tID3Status Durum: ID3 tag değişimi tamamlandı!
    var %l $hfind(mcMp3.pl,$1,1).data
    var %pv $pl.view($1) | rline $wl %l $iif(%pv,%pv,$s)    
  }
  else { rs tID3Status Durum: ID3 tag değiştirilirken hata oluştu }  
}
dialog -l id3c.t {
  title Değiştir
  size -1 -1 132 37
  icon $mcicon
  option dbu
  edit "", 1, 2 11 127 10, limit 30
  button "Değiştir", 2, 47 23 37 12
  button "Button", 3, 45 40 37 12, cancel
  text "Bu id3 bölümünü ne ile değiştirmek istiyorsanız yazın:", 4, 2 2 133 8
}
on *:dialog:id3c.d:init:0: { did -ra $dname 1 $c(id3c.text) }
on *:dialog:id3c.d:sclick:2: { c id3c.result $did(1) | dialog -x $dname }
on *:dialog:id3c.d:sclick:3: { c id3c.cancel $true }
dialog id3CGenre.t {
  title "Tür Değiştir"
  size -1 -1 88 100
  icon $mcicon
  option dbu
  list 1, 1 10 86 75, size, vsbar, sort
  text "Tür seçin:", 2, 1 1 55 8
  button "Değiştir", 3, 26 87 37 12
  button "Button", 4, 16 134 37 12, cancel
}
on *:dialog:id3cgenre.d:init:0: { md FillGenreBox /did -a $dname 1 | did -c $dname 1 1 }
on *:dialog:id3cgenre.d:sclick:3: { c id3c.result $did(1,$did(1).sel).text | dialog -x $dname }
on *:dialog:id3cgenre.d:sclick:4: { c id3c.cancel $true }
alias -l mi if $w($wID3) { md HW $w($wID3).hwnd } | md HW $w($wl).hwnd | md HW $w($wlm).hwnd | w -n $wm
alias -l pc.pau {
  if $ctimer {
    d.switch $c(tT.win)
    c tmode n | d.t tT $c(tT.bk) $c(tT.o)
    if 2 // $c(pau.i) { d.t tT 255 $c(tT.o) }
    else { d.t tT $c(tT.bk) $c(tT.o) }
    dt $wm | c pau.i $calc($c(pau.i) + 1)
  }
  else { c pau.i 1 | t MCL.pause -ho 0 500 pc.pau }
}
alias -l pc.stop { to . | mplay -s $1 | rs tT $iif($c(TimeMode) == dec,-) $+ 00:00 | rs tI | rs tG $s | rs tD $s | c pau $false }
alias -l pc.details {
  var %f $1-
  if $ismp3(%f) { c tD.lline $sound(%f).bitrate $+ kbPS }
  else { c tD.lline $str($s,2) $+ $iif($cdpl,CD Audio,$upper($right(%f,3)) File) }
  c tD.lline $c(tD.lline) ( $+ $round($calc($lof(%f)/1000000),2) $+ mb $+ ) $remove($duration($calc($insnd.length / 1000)),ecs,ec,ins,in,rs,r,$chr(32))
}
alias -l pc.vol {
  var %s
  if $cdpl { %s = -v }
  elseif !$insnd { %s = -w }
  elseif ($right($insnd.fname,3) == MID) { %s = -m }
  else { %s = -w }
  vol %s $calc($c(v) * 8000)
}  
alias -l pc {
  if $1 == P { 
    var %l $fline($wl,$replace($c(lf),$s,$chr(32)),1),%mp
    if %l { cline $color(listbox text) $wl %l }
    pc.stop | %l = $iif($2,$2,$c(t)),%f | %f = $p(%l) | c scr.f $false
    if $cdpl { %mp = $mplay(-p,%l) }
    else { %mp = $mplay(-p,$shortfn(%f)) }
    if %mp != OK { .scroll %mp | return }
    c insnd.fname %f
    id3.refresh %f
    c t %l | c pau $false | c lf $replace($l(%l),$chr(32),$s)
    cline $color(highlight) $wl $c(t)
    time | $+($iif($cdpl,.),scroll) %f | $iif(!$cdpl,spam.send $shortfn(%f)) | rs tI | pc.details %f | rs tD $c(tD.lline)
  }
  elseif $1 == Pcd {
    pl RA | c playlist
    var %r $md(MediaCDOpen)    
    if %r == OK {
      %r = $md(MediaGet,type track 1)
      if %r == audio {
        var %j $md(MediaGet,number of tracks),%i 1 | cdpl $true
        while %i <= %j { pl.aline (CD) Track %i | inc %i }
      }
      else { .scroll !Hata! Müzik CDsi yok. }
    }
    else { .scroll !Error! CD çalar meşgul yada yok. }
    rs tI
  }
  elseif $1 == N { var %t $iif($c(pmode) == r,$rand(1,$c(ts))) | %t = $iif($c(pmode) == c || $c(pmode) == m,$calc($c(t) + 1),%t) | %t = $iif($c(pmode) == p,$c(t),%t) | t -o 1 0 pc P $iif(%t > $c(ts),1,%t) }
  elseif $1 == Pr { var %t $calc($c(t) - 1) | t -o 1 0 pc P $iif(%t < 1,$c(ts),%t) }
  elseif $1 == S { pc.stop }
  elseif $1 == Pa && ($iif(!$cdpl,$insnd,$true)) { if ($md(MediaGet,Mode) == stopped) && (!$c(pau)) { return } | c pau $iif($c(pau),$false,$true) | t MCL.Time $iif($c(pau),-p,-r) | t MCL.Scroll $iif($c(pau),-p,-r) | mplay $iif($c(pau),-a,-r) | if $c(pau) { pc.pau } | else { t MCL.pause off } }
  elseif $1 == C x | if $1 == M { t -mo 1 300 mi }
  elseif $1 == Vu { var %V2 $calc($c(V) + 1) | c V $iif(%v2 > 8,$c(V),%v2) } | if $1 == Vd { var %V2 $calc($c(V) - 1) | c V $iif(%v2 < 0,$c(V),%v2) }
  elseif $1 == H { c plHide $iif($c(plHide),$false,$true) | pl.hide $c(plHide) }
  elseif $1 == RemAll { pl RA }
  elseif $1 == Load { pl L }
  elseif $1 == ID3Help { help }
  elseif $1 == ID3Done { t -ho 1 250 id3.close }
  if $1 == U && $2 { if !$cdpl { mv $2 $calc($2 - 1) > 0 } | else { ia.d } }
  elseif $1 == D && $2 { if !$cdpl { mv $2 $calc($2 + 1) <= $c(ts) } | else { ia.d } }
  elseif $1 == Addfile { if !$cdpl { pl A F } | else { ia.d } }
  elseif $1 == AddDir { if !$cdpl { pl A D } | else { ia.d } }
  elseif $1 == AddRec { if !$cdpl { pl A DR } | else { ia.d } }
  elseif $1 == RemSel { if !$cdpl { pl RS } | else { ia.d } } 
  elseif $1 == Save { if !$cdpl { pl S } | else { ia.d } }
  elseif ($1 == ID3Update) && !$cdpl { id3.update $c(id3c.file) }
  elseif (C* iswm $1) && !$cdpl { id3.change $right($1,-1) 30 $right($c($+(t,$right($1,-1),.o)),$calc(($len($1) + 1) * -1)) }
  if $w($wm) { if $1 != H && $2 != init { rs tV } | pc.vol }
}
alias -l pl.d.rs {
  dt -nr $wlm $g(200) "WingDings" 16 $calc($c(pl.w) - 23) $calc($c(pl.h) - 28) $chr(235)
  dt -r $wlm $g(200) "WingDings" 16 $calc($c(pl.w) - 20) $calc($c(pl.h) - 24) $chr(238)
}
alias -l pl.draw {
  if $1 != -rgn {
    wr wrSelectWindow $w($wlm).hwnd | wr wrResetWindow $w($wlm).hwnd
    wr wrSetMode rmRoundRect
    wr wrSetRegion 0 0 $calc($c(pl.w) + 1) $c(pl.h) 30 30
    wr wrSetMode rmRect
    wr wrAddRegion 0 0 $c(pl.w) 140
    wr wrDeleteRegion 3 20 $calc($c(pl.w) - 3) $calc($c(pl.h) - 35)
  }
  w $iif(!$c(plHide),-a) $wl $calc($c(pl.x) + 3) $calc($c(pl.y) + 20) $calc($c(pl.w) - 6) $calc($c(pl.h) - 55)
  d.switch $wlm
  d.b 0 0 $c(pl.w) $calc($c(pl.h) - 1) 28 28 50
  d.b 0 0 $c(pl.w) 20 0 0 85 tI "Arial" 11 1 $s
  d.l -v 0 15 10 | d.l -v $calc($c(pl.w) - 3) 15 10
  d.l -h 3 $calc($c(pl.h) - 35) $calc($c(pl.w) - 6)
  d.b 280 $calc($c(pl.h) - 31) 88 26 25 25 100 tPLtool3 "Arial" 12 0 $s
  d.b 157 $calc($c(pl.h) - 31) 124 26 25 25 80 tPLtool2 "Arial" 10 -2 $s | rs tPLtool2 $str($s,4) $+ Sil (
  d.b 3 $calc($c(pl.h) - 31) 175 26 25 25 80 tPLtool "Arial" 10 -2 $s | rs tPLtool Ekle  (
  d.l -h 45 $calc($c(pl.h) - 31) 300 | d.l -h 45 $calc($c(pl.h) - 8) 300
  d.btn 37 $calc($c(pl.h) - 28) 45 20 cAddFile Round 100 15 15
  d.btn 80 $calc($c(pl.h) - 28) 45 20 cAddDir Round 100 15 15
  d.btn 124 $calc($c(pl.h) - 28) 50 20 cAddRec Round 100 15 15
  d.btn 194 $calc($c(pl.h) - 28) 48 20 cRemSel Round 100 15 15
  d.btn 238 $calc($c(pl.h) - 28) 40 20 cRemAll Round 100 15 15
  d.btn 285 $calc($c(pl.h) - 28) 40 20 cLoad Round 100 15 15
  d.btn 322 $calc($c(pl.h) - 28) 41 20 cSave Round 100 15 15
  pl.d.rs | rs tI
}
alias -l pl.color {
  var %l listbox t
  if $c(plColor) && !$1 {
    c plColor.oText.i $color(listbox text) | c plColor.oBK.i $color(listbox)
    c plColor.oText.r $color($c(plColor.oText.i)) | c plColor.oBK.r $color($c(plColor.oBK.i))
    color 99 $g(255)
    color listbox t 20 | color 21 $g(120) | color listbox 21
  }
  else { color $c(plColor.oText.i) $c(plColor.oText.r) | color $c(plColor.oBK.i) $c(plColor.oBK.r) }
}
alias -l pl.hide {
  if $1 { md HW $w($wl).hwnd | md HW $w($wlm).hwnd }
  elseif !$1 { w -a $wlm | w -a $wl }
}
alias -l pl.sort {
  var %i 1,%m | wt
  if $c(ts) > 0 {
    var %iPbar 1
    rs tI Liste sıralanıyor...
    pbar -init $calc($c(pl.w) - 110) $calc($c(tI.y)) $calc($c(ts) * 3)
    while %i <= $c(ts) {
      if 6 // %iPbar { pbar -calc %iPbar | if $pbar { pbar -inc } }
      aline $wt $l(%i) $chr(184) $+ %i
      inc %i | inc %iPbar
    }
    %i = 1 | var %o,%f | hmake _ptmp 200
    while %i <= $c(ts) {
      if 6 // %iPbar { pbar -calc %iPBar | if $pbar { pbar -inc } }
      %f = $gettok($l(%i,$wt),1,184) | %o = $gettok($l(%i,$wt),2,184)
      hadd _ptmp %i $p(%o)
      inc %i | inc %iPbar
    }
    var %f " $+ $scriptdirsort.tmp $+ " | hsave _ptmp %f  | p -r | p -l %f | .remove %f | hfree _ptmp
    wt -c | %i = 1 | clear $wl | rs tI Liste tekrar oluşturuluyor...
    while %i <= $c(ts) {
      if 6 // %iPbar { pbar -calc %iPbar | if $pbar { pbar -inc } }
      %m = $p(%i)
      p %i %m | aline $wl $pl.view(%m)
      inc %i | inc %iPbar
    }
    pbar -erase
    rs tI
  }
}
alias -l pl.cView {
  var %v $iif($1-,$1-,$c(pView)),%i 1
  c pView %v | clear $wl
  rs tI Liste tekrar oluşturuluyor: %v
  pbar -init $calc($c(pl.w) - 110) $calc($c(tI.y)) $c(ts)
  while %i <= $c(ts) {
    if  4 // %i { pbar -calc %i | if $pbar { pbar -inc } }
    aline $wl $pl.view($p(%i))
    inc %i
  }
  pbar -erase | rs tI
}
alias -l pl.tags return <dosya.mp3>,<dosya>,<sürücü>,<dizin>,<boyut>,<uzunluk>,<albüm>,<trk>,<artist>,<başlık>,<kbps>
alias -l pl.dView w -a $wm | dialog -adm pview.d pview.t
alias -l pl.view return $iif($cdpl,$1-,$tags.val($1-,$c(pView)))
alias -l pl.aline var %pv $pl.view($1-) | aline $wl $iif(%pv,%pv,$s) | c ts $calc($c(ts) + 1) | p $c(ts) $iif(!$cdpl,$shortfn($1-),$1-)
alias -l pl.per if 8 // $1 { var %tmp $calc($2 + 1) | if %tmp == 5 { %tmp = 1 } | rs tI $3- $+ $str(.,%tmp) | return %tmp } | else { return $2 }
alias -l pl {
  if $1 == Ra { if $c(ts) > 0 { clear $wl | p -r | p -m | to | cdpl $false } }
  if $1 == L || $1 == S { w -a $wm }
  var %fs
  if $1 == L {
    var %f $iif($2,$2,$sfile($sd $+ *.mpl,mp3 listesini seçiniz *.mpl,Yükle))
    if $isfile(%f) {
      pc.stop c | rs tI Yükleniyor: $nopath(%f)
      clear $wl | p -r | p -l $shortfn(%f) | c ts 0 | cdpl $false
      var %l $hget(mCmp3.pl,0).item,%i 1,%m
      pbar -init $calc($c(pl.w) - 110) $calc($c(tI.y)) %l
      while %i <= %l {
        if 4 // %i { pbar -calc %i | if $pbar { pbar -inc } }
        %m = $p(%i)
        pl.aline %m
        inc %i
      }
      pbar -erase | c pl %f | c t 1
      c ldir $nofile(%f) | c pl %f
    }
    w -b $wl
  }
  if $cdpl { ia.d | return }
  if $1 == Rs {
    if $sl(0) {
      rs tI Şeçili dosyalar kaldırılıyor...
      var %i $sl(1).ln,%lastline $sl($sl(0)).ln,%j %i,%sel $sl(0),%lastdel 0,%trks $c(ts),%per 0
      while $sl(0) {
        hdel mCmp3.pl $sl($sl(0)).ln
        dline $wl $sl($sl(0)).ln
        c ts $calc($c(ts) - 1)
      }
      %per = 0
      if $c(ts) {
        while %i <= %lastline && %i <= %trks {
          %j = %i | %per = $pl.per(%i,%per,Liste yenileniyor)
          while !$p(%j) && %j <= %trks { inc %j }
          if $p(%j) { p %i $p(%j) | hdel mCmp3.pl %j | %lastdel = %j }
          inc %i
        }
        if %lastdel {
          %per = 0
          %i = $calc(%lastdel + 1)
          while %i <= %trks {
            %per = $pl.per(%i,%per,Liste yenileniyor)
            if $p(%i) { p $calc(%i - %sel) $p(%i) } | hdel mcMp3.pl %i | inc %i
          }
        }
      }
      if $c(ts) <= 0 { cdpl $false | p -r | p -m }
    }
  }
  if $1 == S { var %f $iif($2,$2,$sfile($sd $+ *.mpl,mp3 listesini seçiniz *.mpl,Kaydet)) | if %f { c ldir $nofile(%f) | rs tI Liste kaydediliyor... | %f = $replace($iif(*.mpl !iswm $right(%f,4),$+(%f,.mpl),%f),$chr(32),_) | p -s %f | c pl %f } }
  if $1 == A {
    w -a $wm
    if $2 == F { var %f $sfile($sd $+ *.mp3;*.wav;*.wma;*.mid,Dosya seçiniz,Ekle) | if ($isfile(%f)) { c ldir $nofile(%f) | pl.aline %f } }
    else {
      var %f,%d $sdir($sd, $iif($2 == Dr,Alt klasörlerle birlikte eklenecek dosyayı seçiniz,Eklenecek klasörü seçiniz))
      if $isdir(%d) {
        rs tI Klasör ekleniyor... Lütfen bekleyiniz.
        var %ext *.mp3-*.wma-*.wav-*.mid,%i 1,%t
        while $gettok(%ext,%i,45) {
          %t = $ifmatch
          %f = $iif($2 == Dr,$findfile(%d,%t,0,pl.aline $1-),$findfile(%d,%t,0,1,pl.aline $1-))
          inc %i
        }
        c ldir %d
      }
    }
    w -b $wl
  }
  if $1 == Sort { pl.sort }
  c ts $l(0) | $iif($c(ts) < 1,pc.stop c)
  if ($c(ts) <= 0) || ($c(t) > $c(ts)) { c t $c(ts) } | if $c(ts) <= 0 { c pl $s } | rs tI
}
alias -l ts dr -renf $wm $g($1) $2 $calc($c(s.s) + $c(s.o) + $3) $calc($c(s.y) + 4 + $4) $calc(15 - $5) $calc(15 - $5)
alias -l ts2 ts $c(tE.bk) 1 0 0 0 | c s.o $1 | ts 255 1 0 0 0 | ts 120 1 2 2 4 | d.switch $wm | d.btn $calc($c(s.s) + $c(s.o) + 2) $calc($c(s.y) + 6) 11 11
alias -l time.f {
  var %m,%s,%e $iif(*hr* iswm $1-,60,0)
  if (*min* iswm $1-) %m = $calc(%e + $remove($wildtok($1-,*min*,1,32),mins,min)) 
  else { %m = $calc(%e + 0) }
  if (%m < 10) %m = 0 $+ %m
  if (*sec* iswm $1-) %s = $remove($wildtok($1-,*sec*,1,32),secs,sec)
  else { %s = 0 }
  if (%s < 10) %s = 0 $+ %s
  return $+($iif($c(TimeMode) == dec,-),%m,:,%s)
}
alias -l time.gd { 
  if $c(TimeMode) == inc return $duration($calc($insnd.pos / 1000))
  else return $duration($calc(($c(TempLen) - $insnd.pos) / 1000)))
}
alias -l time {
  if $ctimer == MCL.Time {
    var %t,%d $time.gd,%str $time.f(%d)
    %t = $int($calc(($insnd.pos / 1000) / $c(s.sec)))
    if %t != $c(s.o) && (!$c(s.f)) ts2 %t
    if (!$cdpl) && ($md(MediaGet,mode) == stopped) { pc S | if $c(pmode) != m { pc N } }
    elseif $cdpl { 
      var %p $calc($md(MediaGet,position) - $md(MediaGet,position track $c(t)))
      if (%p >= $calc($insnd.length - 1000)) { pc S | if $c(pmode) != m { pc N } }
    }
  }
  else { ts2 0 | c s.f $false | c s.sec $calc(($insnd.length / 1000) / $c(s.w)) | c TempLen $insnd.length | t MCL.Time -co 0 1 time }
  rs tT $iif(%str,%str,$iif($c(TimeMode) == dec,$time.f($duration($calc($c(templen) / 1000))),00:00))
}
alias -l scroll.c {
  if $1 == -m { var %t $3-,%j $2 }
  else { var %t $2-,%j $1 }
  var %l $len(%t)
  if $1 != -m { inc %j } | if (%j > %l) { %j = 1 } | elseif (%j < 1) { %j = %l } | %i = %j
  %t = $right(%t,$calc(%l - %i)) $+ $left(%t,$calc(%i))
  c scr.i %i | rs tG %t
}
alias -l scroll { 
  var %i 1
  if $ctimer == MCL.Scroll && !$c(scr.f) { scroll.c $c(scr.i) $c(scr) }
  elseif !$c(scr.f) {
    var %t $+($iif($show,$+($s,$c(t),.),$s),$s,$replace($iif($show,$left($nopath($longfn($1-)),-4),$1-),$chr(32),$s),$s,$chr(40),XcLusive Script Mp3 Player,$chr(41),$str($s,4))
    if $len(%t) < 34 { %t = %t $+ $str($s,$calc(34 - $len(%t))) }
    c scr %t | c scr.f $false | t MCL.Scroll -mo 0 500 scroll | c scr.i %i | rs tG %t
  }
}
alias -l pbar {
  d.switch $wlm
  if $1 == -init {
    var %x $2,%y $3
    d.b %x %y 107 11 0 0 1 tProgress "Arial 10 0 $s
    %x = %x + 3 | c pbar.x %x | c pbar.y $calc(%y + 3) | c pbar.o 0 | c pbar.i $calc($4 / 100)
  }
  elseif $1 == -calc { c pbar.now $int($calc($2 / $c(pbar.i))) }
  elseif $1 == -inc {
    var %s $c(pbar.o),%e $c(pbar.now)
    while %s <= %e { drawline -nr $c(drw) $g($calc(100 + %s)) 1 $calc($c(pbar.x) + %s) $c(pbar.y) $calc($c(pbar.x) + %s) $calc($c(pbar.y) + 5) | inc %s }
    drawline $c(drw)
    c pbar.o $c(pbar.now)
  }
  elseif $isid { if $c(pbar.now) != $c(pbar.o) { return $true } | else { return $false } }
  elseif $1 == -erase { d.b 0 0 $c(pl.w) 20 0 0 85 tI "Arial" 11 1 $s }
  d.switch $wm
}
alias -l rs {
  c tmode n | d.switch $c($+($1,.win))
  if $1 != tV { d.t $1 $c($1 $+ .bk) $c($1 $+ .o) }
  if $1 == tV {
    var %i 1,%tw 7,%x %tw
    dr -frn $wm $g($c($1 $+ .bk)) 1 $calc($c(tV.x) + %x + 5) $calc($c(tV.y)) $calc(%tw * 8) 14
    while %i <= $c(V) {
      dr -frn $wm $g($calc(%i * 35)) 1 $calc($c(tV.x) + %x + 5) $calc($c(tV.y)) %tw 14
      dr -rn $wm $g(0) 1 $calc($c(tV.x) + %x + 5) $calc($c(tV.y)) %tw 14
      inc %i | inc %x %tw
    }
    %t = $+($s,$ch($c(V)))
    dr $wm
  }
  elseif $1 == tI {
    var %t $replace($iif($cdpl,Audio CD,$nopath($c(pl))),_,$chr(32)) (Parça#( $+ $sl(1).ln $+ / $+ $c(ts) $+ ) $&
      $iif($insnd,<Çalınıyor<Parça# $c(t)) $iif($c(pmode) == c,<Devamlı) $&
      $iif($c(pmode) == r,<Rastgele) $iif($c(pmode) == p,<Tekrar et (devamlı)) $iif($c(pmode) == m,<Elle)
  }
  c $1 $+ .o $iif($2,$2-,%t)
  c tmode $s
  if $1 != tV { d.t $1 255 $c($1 $+ .o) }
}
alias -l d.switch if $isid { return $c(drw) } | else { if !$1 { c drw $wm } | else { c drw $1 } }
alias -l d.b var %i 0,%r 110 150 110 $7 | while %i < $iif($7,4,3) { dr $+(-rn,$iif($5,d),$iif($7,f)) $c(drw) $g($gettok(%r,$calc(%i + 1),32)) 1 $calc($1 + %i) $calc($2 + %i) $calc($3 - %i * 2) $calc($4 - %i * 2) $5 $6 | inc %i } | if ($8) && ($7) { c $8 $+ .x $calc($1 + 10) | c $8 $+ .y $calc($2 + 4) | c $8 $+ .w $calc($3 - 20) | c $8 $+ .h $4 | c $8 $+ .bk $7 | c $8 $+ .fn $9 | c $8 $+ .fs $10 | c $8 $+ .fo $11 | c $8 $+ .def $12- | c $8 $+ .o $12- | c $8 $+ .win $c(drw) } | dr $c(drw)
alias -l d.t dt -rc $+ $c(tmode) $c(drw) $g($2) $c($1 $+ .fn) $c($1 $+ .fs) $c($1 $+ .x) $calc($c($1 $+ .y) - $c($1 $+ .fo)) $c($1 $+ .w) 15 $3- | if $c(tmode) != n dt $c(drw) | c $1 + .o $3-
alias -l d.l var %x $2,%y $3,%wh $4,%r 110 150 110,%i 0 | while %i < 3 { drawline -nr $c(drw) $g($gettok(%r,$calc(%i + 1),32)) 1 %x %y $iif($1 == -h,$calc(%x + %wh),%x) $iif($1 == -v,$calc(%y + %wh),%y) | if $1 == -h { inc %y } | else { inc %x } | inc %i } | drawline $c(drw)
alias -l d.f {
  var %r 255,%dec $calc((%r / $3)),%i 0
  while %i <= $3 {
    drawline -rn $wm $g(%r) 1 $calc($1) $calc($2 + $4) $calc($1 + %i) $calc($2)
    dec %r %dec
    inc %i
    if %r == $c(bk) { break }
  }
  drawline $wm
}
alias -l d.btntext c $+($1,.fx) $2 | c $+($1,.fy) $3 | c $+($1,.text) $4 | c $+($1,.font) $6- | c $+($1,.fontsize) $5
alias -l d.btxt dt -ro $c($+($1,.win)) $g($2) $c($+($1,.font)) $c($+($1,.fontsize)) $c($+($1,.fx)) $c($+($1,.fy)) $c($+($1,.text))
alias -l d.tctr { if $1 == -x { var %x $calc($c($+($2,.sx)) / 2),%w $calc($width($3,$5-,$4) / 2),%r $calc($c($+($2,.x)) + (%x - %w) + 2) | return %r } }
alias -l d.samex d.btntext $1 $calc($d.tctr(-x,$1,$s $+ $3,10,"Arial") + 3) $calc($2 - 6) $3 10 "Arial"
alias -l d.btn {
  c $+($5,.x) $1 | c $+($5,.y) $2 | c $+($5,.sx) $3 | c $+($5,.sy) $4 | c $+($5,.win) $c(drw)
  c $+($5,.style) $6 | c $+($5,.stylep1) $8 | c $+($5,.stylep2) $9 | var %s
  %s = $iif($3 < $4,$3,$4)
  var %sx $3,%sy $4,%r 30,%i $calc((255 - %r) / %s * 3),%x $1,%y $2,%t 12 "Courier New",%t2 20 "WingDings"
  if $6 == Elliptical || !$6 || $6 == Round { c $+($5,.1stc) %r | while (%sx >= $calc($c($5 $+ .sx) / 2) && %sy >= $calc($c($5 $+ .sy) / 2))  { dr $iif($6 == Round,-dfrn,-efrn) $c(drw) $g(%r) 1 %x %y %sx %sy $iif($6 == Round,$8 $9) | dec %sx 2 | dec %sy 2 | inc %r %i | inc %x | inc %y } }
  elseif $6 == Flat { c $+($5.lstc) $7 | dr -dnfr $c(drw) $g($calc($7 + 50)) 1 %x %y %sx %sy $8 $9 | dr -dnr $c(drw) $g($7) 3 %x %y %sx %sy $8 $9 }
  dr $c(drw) | %x = $int($calc($1 + ($3 / 2))) | %y = $int($calc($2 + ($4 / 2)))
  if $+(*,$5,*) iswm $c(btns) {
    if $5 == cP d.btntext $5 $calc(%x - 6) $calc(%y - 8) $+($chr(124),>) %t
    elseif $5 == cS d.btntext $5 $calc(%x - 7) $calc(%y - 9) ¨ $replace(%t2,20,17)
    elseif $5 == cPa d.btntext $5 $calc(%x - 6) $calc(%y - 8) $str($chr(124),2) %t
    elseif $5 == cPr d.btntext $5 $calc(%x - 11) $calc(%y - 11) Ç %t2
    elseif $5 == cN d.btntext $5 $calc(%x - 9) $calc(%y - 9) Ê %t2
    elseif $5 == cU d.btntext $5 $calc(%x - 8) $calc(%y - 10) ñ %t2
    elseif $5 == cD d.btntext $5 $calc(%x - 7) $calc(%y - 10) ò %t2
    elseif $5 == cH d.btntext $5 $calc(%x - 7) $calc(%y - 10) 3 %t2
    elseif $5 == cC d.btntext $5 $calc(%x - 3) $calc(%y - 8) X %t
    elseif $5 == cM d.btntext $5 $calc(%x - 4) $calc(%y - 12) _ %t
    elseif $5 == cVd d.btntext $5 $calc(%x - 6) $calc(%y - 5) ß $replace(%t2,20,10)
    elseif $5 == cVu d.btntext $5 $calc(%x - 5) $calc(%y - 5) à $replace(%t2,20,10)
    elseif $5 == cAddDir d.btntext $5 $calc(%x - 15) $calc(%y - 6) Klasör 10 "Arial"
    elseif $5 == cAddRec d.btntext $5 $calc(%x - 17) $calc(%y - 6) Klasör+ 10 "Arial"
    elseif $5 == cAddFile d.btntext $5 $calc(%x - 15) $calc(%y - 6) Dosya 10 "Arial"
    elseif $5 == cRemSel d.btntext $5 $calc(%x - 20) $calc(%y - 6) Seçilen 10 "Arial"
    elseif $5 == cRemAll d.btntext $5 $calc(%x - 12) $calc(%y - 6) Hepsi 10 "Arial"
    elseif $5 == cLoad d.btntext $5 $calc(%x - 15) $calc(%y - 6) Yükle 10 "Arial"
    elseif $5 == cSave d.btntext $5 $calc(%x - 15) $calc(%y - 6) Kaydet 10 "Arial"
    elseif $5 == cID3update d.samex $5 %y Yenile
    elseif $5 == cID3done d.btntext $5 $calc(%x - 3) $calc(%y - 7) X $replace(%t,12,10)
    elseif $5 == cID3help d.btntext $5 $calc(%x - 3) $calc(%y - 7) ? $replace(%t,12,10)
    elseif (cC* iswm $5) d.samex $5 %y Değiştir
    if $c($5 $+ .font) { d.btxt $5 0 }
  }  
}
alias -l b { 
  dr $c($5 $+ .p) $c($5 $+ .win) $g($c(rgb)) 1 $1 $2 $3 $4 $c(btn.p1) $c(btn.p2) | d.btxt $5 $c(rgb)
  if ($calc($c(reps) / 2) == $c(i)) { c f $true }
  if ($c(f)) c rgb $calc($c(rgb) - $c(inc))
  else c rgb $calc($c(rgb) + $c(inc))
  c i $calc($c(i) + 1)
  if $c(i) > $c(reps) { c bn | dr $c($5 $+ .p) $c($5 $+ .win) $g($c($5 $+ .1stc)) 1 $1 $2 $3 $4 $c(btn.p1) $c(btn.p2) | d.btxt $5 0 }
}
alias -l btn var %o $c(bn) | if $timer(MCLb $+ %o) { t MCLb $+ %o off | dr $c(%o $+ .p) $c($+(%o,.win)) $g($c(%o $+ .1stc)) 1 $c(%o $+ .x) $c(%o $+ .y) $c(%o $+ .sx) $c(%o $+ .sy) $c(%o $+ .stylep1) $c(%o $+ .stylep2) | d.btxt %o 0 } | c i 1 | c reps 30 | c f $false | c rgb $c($1 $+ .1stc) | c inc $calc((255 - $c($1 $+ .1stc)) / ($c(reps) / 2)) | c bn $1 | t MCLb $+ $1 -ho $c(reps) 5 b $c($1 $+ .x) $c($1 $+ .y) $c($1 $+ .sx) $c($1 $+ .sy) $1
alias -l btn.chk {
  m.deSel
  var %n $numtok($c(btns),44),%i 1,%b,%win $1
  while %i <= %n {
    %b = $gettok($c(btns),%i,44)
    if $inrect($2,$3,$c(%b $+ .x),$c(%b $+ .y),$c(%b $+ .sx),$c(%b $+ .sy)) && ($c(%b $+ .win) == %win) {
      c %b $+ .p $iif($c(%b $+ .style) == round,-dr,-er)
      c btn.p1 $iif($c(%b $+ .stylep1),$ifmatch) | c btn.p2 $iif($c(%b $+ .stylep2),$ifmatch)
      btn %b | pc $right(%b,-1) $sl(1).ln | break
    }
    inc %i
  }
}
alias -l key.handle {
  var %i 2,%f $+(",$scriptdir,MCMP3KEYS.CFG,"),%l $lines(%f),%t,%val $1,%chr $2
  while %i <= %l {
    %t = $read(%f,%i) | tokenize 32 %t
    if ($eval($+(%,$1),2) == $2) { if (($mouse.key & $3) || ($3 == no)) { $4- | break } }
    inc %i
  }
}
on *:close:$($wm): x
on *:exit: x exit
alias -l id3a if $w($wID3) { md ShowWin $w($wID3).hwnd }
alias -l plH if $c(plhide) { c plHide $false }
on *:active:*: {
  var %ok $false
  if $active == $wm { if !$c(plHide) { md ShowWin $w($wl).hwnd | md ShowWin $w($wlm).hwnd } | id3a | %ok = $true }
  elseif $active == $wl { if !$c(plHide) { md ShowWin $w($wlm).hwnd } | else { md HW $w($wl).hwnd } | id3a | %ok = $true }
  elseif $active == $wlm { if !$c(plHide) { md ShowWin $w($wl).hwnd } | else { md HW $w($wlm).hwnd } | id3a | %ok = $true }
  elseif $active == $wID3 { if !$c(plHide) { md ShowWin $w($wl).hwnd | md ShowWin $w($wlm).hwnd } | %ok = $true }
  if %ok { md ShowWin $w($wm).hwnd }
}
#mc3mp3end off
on *:keydown:*:* { if ($wm == $active) || ($wlm == $active) || ($wl == $active) { key.handle $keychar $keyval } }
#mc3mp3end end
alias -l ia.d { w -a $wm | if !$dialog(ia.d) { dialog -ma ia.d ia.t } }
dialog -l ia.t {
  title "Geçersiz hareket"
  size -1 -1 123 38
  option dbu
  icon $mcicon, 0
  text ".Bu hareket müzik CD'sinde yapılamaz.", 1, 1 2 121 19
  button "Tamam", 2, 43 22 37 12, flat ok
}
alias -l spam.edit w -a $wm | dialog -adm spam.d spam.t
alias -l spam.get { var %i 1,%l $did(1).lines,%temp | while %i <= %l { %temp = $+(%temp,$did(1,%i)) | inc %i } | return %temp }
alias -l spam.send {
  if $c(spam.target) == 2 { /dll systray.dll Balloon 50 1 > [Xc]: Mp3 Player > $tags.val($1,$c(spam.template)) }
  ;$tags.val($1,$c(spam.template))
  elseif $c(spam.target) == 1 {
    var %i 1
    while $gettok($c(spam.chan),%i,44) { if ($me ison $ifmatch) { msg $gettok($c(spam.chan),%i,44) $tags.val($1,$c(spam.template)) } | inc %i }
  }
}
dialog -l spam.t {
  title "Mesaj Düzenleyici"
  size -1 -1 125 146
  option dbu
  icon $mcicon, 0
  edit "", 1, 4 10 115 12, autohs center
  list 2, 4 33 59 56, size
  text "Etiketler:", 3, 4 25 51 8
  button "Etiket Ekle", 4, 70 34 45 12
  button "Varsayılan", 5, 70 48 45 12
  button "Tamam", 6, 70 76 45 12, ok
  button "Önizleme", 8, 70 62 45 12
  box "Mesajı göster:", 9, 2 97 121 46
  radio "", 10, 4 106 7 10, group
  radio "", 11, 4 118 9 10
  radio "", 12, 4 130 8 10
  edit "", 13, 51 105 68 10, autohs
  box "Mesaj düzeni:", 14, 1 1 122 95
  text "Kanallar:", 7, 13 107 35 8
  text "Aktif Pencereye Yaz", 15, 13 119 82 8
  text "Gösterme", 16, 13 130 82 8
}

on *:dialog:spam.d:*:*: {
  if $devent == init { 
    idset 16 | didtok $dname 2 44 $pl.tags | did -ra $dname 1 $c(spam.template) | did -ra $dname 13 $c(spam.chan) | did -c $dname $calc(10 + $c(spam.target) - 1)
  }
  if *click* iswm $devent {
    if $did == 5 { did -ra $dname 1 Calan Parça: <dosya> <uzunluk> <kbps>kbps <boyut> }
    if $did == 6 { c spam.template $spam.get | c spam.chan $did(13) }
    if $did == 8 {
      if $c(ts) < 1 || !$sl(1) { dialog -v spam.d | t -mo 1 0 var %s $input(Önizlemeyi görmek için şarkı listesinde en az bir şarkının seçili olması gerekir.,$calc(4 + 256),Hata) | return }
      mecho Önizleme: $tags.val($p($sl(1).ln),$spam.get)
    }
    if $did == 2 || $did == 4 { if $devent == sclick && $did == 2 { return } | did -a $dname 1 $did(2,$did(2).sel) }
    if $did >= 10 && $did <= 12 { c spam.target $calc($did - 9) }
  }
}
dialog -l pview.t {
  title "Şarkı listesi düzeni"
  size -1 -1 120 108
  option dbu
  icon $mcicon, 0
  edit "", 1, 4 9 110 12, autohs
  list 2, 4 32 60 49, sort size
  button "Etiket ekle", 4, 67 41 45 12
  button "Varsayılan", 5, 67 57 45 12
  button "Tamam", 6, 17 90 35 12, flat ok
  box "Düzen:", 8, 1 1 116 85
  button "Help", 10, 145 137 36 12
  button "İptal", 3, 56 90 35 12, flat cancel
  text "Etiketler:", 7, 5 23 25 8
}

on *:dialog:pview.d:*:*: {
  if $devent == init { idset 10 | didtok $dname 2 44 $pl.tags | did -ra $dname 1 $c(pview) }
  if $devent == sclick {
    if $did == 6 { if $c(pview) != $did(1) { c pview $did(1) | pl.cview } }
    if $did == 5 { did -ra $dname 1 <dosya> }
    if $did == 10 { help }
  }
  if *click* iswm $devent && ($did == 2 || $did == 4) { if $did == 2 && $devent == sclick { return } | did -a $dname 1 $did(2,$did(2).sel) }
}
alias -l find.mp3 w -a $wm | dialog -adm find.d find.t
dialog -l find.t {
  title "Listede Ara"
  size -1 -1 173 31
  option dbu
  icon $mcicon, 0
  text "Aranan:", 1, 1 6 31 8
  edit "", 2, 31 5 88 10, autohs
  text "* ve ? özeliklerini kullanabilirsiniz", 3, 1 18 120 8
  button "Bul", 4, 123 4 45 11
  button "Sonraki", 5, 123 18 45 11
  button "", 6, 0 50 5 5, cancel
}

on *:dialog:find.d:init:0: { 
  idset 6
  if $c(find.last) { did -ra $dname 2 $c(find.last) } 
}
on *:dialog:find.d:sclick:*: {
  var %fl
  if $did == 4 { %fl = $fline($wl,$did(2),1,0) | c find.l 0 }
  if $did == 5 { c find.l $iif($c(find.l) > 0,$calc($c(find.l) + 1),2) | %fl = $fline($wl,$did(2),$c(find.l),0) }
  if %fl { sline $wl %fl } | c find.last $did(2)
}
alias -l rgb.w { w -a $wm | dialog -adm rgb.d rgb.t }
alias -l rgb.setd {
  tokenize 46 $1- | did -u $dname 11,12,13
  did -ra rgb.d 5 $1 | did -c rgb.d 8 $abs($did(5)) | if $1 < 0 did -c rgb.d 11
  did -ra rgb.d 6 $2 | did -c rgb.d 9 $abs($did(6)) | if $2 < 0 did -c rgb.d 12
  did -ra rgb.d 7 $3 | did -c rgb.d 10 $abs($did(7)) | if $3 < 0 did -c rgb.d 13
}
alias -l pre {
  var %h mCmp3.presets
  if $1 == -r && $hget(%h) { hsave -o %h $RGBfile | hfree %h | return }
  if $1 == -d && $hget(%h) { hdel %h $2 | return }
  if $1 == -l { if !$hget(%h) { hmake %h } | if $isfile($RGBfile) { hload %h $RGBfile | return } }
  if $isid { if $1 { return $hget(%h,$1) } | else { return $hget(%h) } }
  else { hadd -m %h $1 $2- }
}
dialog -l rgb.t {
  title "Renk Ayarları"
  size -1 -1 140 139
  option dbu
  icon $mcicon, 0
  box "RGB Değerleri:", 1, 1 1 136 41
  edit "", 5, 52 9 17 10, read
  edit "", 6, 52 19 17 10, read
  edit "", 7, 52 29 17 10, read
  scroll "", 8, 70 11 57 6, range 255 horizontal
  scroll "", 9, 70 21 57 6, range 255 horizontal
  scroll "", 10, 70 31 57 6, range 255 horizontal
  check "", 11, 5 10 9 9
  check "", 12, 5 20 9 9
  check "", 13, 5 30 10 9
  box "Hazır RGB değerleri:", 14, 1 45 136 71
  text "Hazır Değerler:", 15, 5 54 53 8
  button "Ekle", 16, 90 66 40 15
  button "Sil", 17, 90 88 40 15
  combo 18, 5 62 73 52, sort size vsbar
  button "Tamam", 19, 2 120 40 15, flat ok
  button "İptal", 20, 49 120 40 15, flat cancel
  button "Uygula", 21, 96 120 40 15, flat
  button "Help", 22, 114 155 25 12
  text "Kırmızı:", 2, 16 11 31 8
  text "Yeşil:", 3, 16 21 31 8
  text "Mavi:", 4, 16 31 31 8
}

on *:dialog:rgb.d:sclick:* {
  if $did == 16 {
    var %n $replace($did(18,0),$chr(32),_)
    if %n { if !$pre(%n) { did -a $dname 18 %n } | pre %n $+($did(5),.,$did(6),.,$did(7)) }
  }
  if $did == 17 {
    var %l $did(18).sel,%n | %n = $did(18,%l)
    if %n { pre -d %n | did -d $dname 18 %l }
  }
  if $did == 18 { rgb.setd $pre($did(18)) }
  if $did == 19 || $did == 21 {
    var %r $+($did(5),.,$did(6),.,$did(7))
    if %r != $c(sh) && $numtok(%r,$asc(.)) == 3 { c sh %r | mcl.draw | pl.draw -rgn | $iif($w($wID3),id3.draw -rgn) }
  }
  if $did == 20 && $c(shtemp) != $c(sh) { c sh $c(shtemp) | mcl.draw | pl.draw -rgn | $iif($w($wID3),id3.draw -rgn) }
  if $did == 22 { help }
  if $did >= 11 && $did <= 13 { var %c $calc($did - 6),%v $calc($did - 3) | did -ra $dname %c $iif($did($did).state && $did(%v).sel != 0,$calc($did(%v).sel * -1),$did(%v).sel) }
  if $did == 19 || $did == 20 { pre -r }
}
on *:dialog:rgb.d:init:* {
  idset 22
  pre -l
  var %i 1,%j $hget(mCmp3.presets,0).item | while %i <= %j { did -a $dname 18 $hget(mCmp3.presets,%i).item | inc %i }
  c shtemp $c(sh) | rgb.setd $c(sh)
}
on *:dialog:rgb.d:scroll:* { var %c $calc($did - 3),%v $calc($did + 3) | did -ra $dname %c $iif($did(%v).state && $did($did).sel != 0,$calc($did($did).sel * -1),$did($did).sel) }
alias -l m {
  if $1 == -r { hfree mCmp3.menu | return }
  elseif ($isid) {
    if ($1) return $hget(mCmp3.menu,$1)
    else { return $hget(mCmp3.menu) }
  }
  else { hadd -m mCmp3.menu $1 $2- }
}
alias -l m.get {
  var %i 1,%m,%x,%y,%w,%h $m(menu.h)
  if $3 != sub {
    while %i <= $m(menu.subs) {
      %x = $m($+(menu.,%i,.x)) | %y = $m($+(menu.,%i,.y)) | %w = $m($+(menu.,%i,.w))
      if $inrect($1,$2,%x,%y,%w,%h) { return %i } | inc %i
    }
  }
  else {
    %i = 1 | %m = $m(menu.sel) | %w = $calc($w($wp).w - ($m(menu.bw) * 2))
    while %i <= $m($+(menu.,%m,.subs)) {
      %x = $m($+(menu.,%m,.,%i,.x)) | %y = $m($+(menu.,%m,.,%i,.y))
      if $inrect($1,$2,%x,%y,%w,%h) { return %i } | inc %i
    }
  }
  return 0
}
alias -l m.sel {
  if $1 < 1 { return }
  var %x,%y,%w,%h
  %x = $m($+(menu.,$1,.x)) | %y = $m($+(menu.,$1,.y)) | %w = $m($+(menu.,$1,.w)) | %h = $m($+(menu.,$1,.h)) - 1
  c tmode $s
  dr -fr $wm $g($iif($2 == deSel,$c(bk),175)) 1 %x %y %w %h | dt -rc $wm $g($iif($2 == deSel,255,0)) $m(menu.font) $m(menu.fontsize) %x %y %w %h $m($+(menu.,$1,.name))
  if $2 != deSel { m menu.sel $1 }
}
alias -l m.deSel { if ($m(menu.sel) > 0) { m.sel $m(menu.sel) deSel | m.popup -close $1 } }
alias -l chk_ m $+(menu.,$1,.,$2.chk) $3
alias -l m.chk {
  if $1 == c { chk_ 2 2 $true | chk_ 2 3 $false | chk_ 2 4 $false | chk_ 2 5 $false | c pmode $1 }
  if $1 == r { chk_ 2 3 $true | chk_ 2 2 $false | chk_ 2 4 $false | chk_ 2 5 $false | c pmode $1 }
  if $1 == m { chk_ 2 4 $true | chk_ 2 2 $false | chk_ 2 3 $false | chk_ 2 5 $false | c pmode $1 }
  if $1 == p { chk_ 2 5 $true | chk_ 2 2 $false | chk_ 2 3 $false | chk_ 2 4 $false | c pmode $1 }
  if $1 == dclick { chk_ 2 7 $true | chk_ 2 8 $false | c clickmode $1 }
  if $1 == sclick { chk_ 2 8 $true | chk_ 2 7 $false | c clickmode $1 }
  if $1 == plUseColor { c plColor $iif($c(plColor),$false,$true) | chk_ 2 14 $c(plColor) | pl.color }
  if $2 != -notext { rs tI }
}
alias -l m.dl { drawline -r $wp $g($calc($c(bkpop) - 30)) 1 $1 $2 $3 $4 | drawline -r $wp $g($calc($c(bkpop) + 30)) 1 $1 $calc($2 + 1) $3 $calc($4 + 1) }
alias -l m.db { ; $1 x $2 y $3 w $4 h
  drawline -r $wp $g($calc($c(bkpop) - 30)) 1 $1 $calc($2 + $4) $1 $2 $calc($1 + $3) $2
  drawline -r $wp $g($calc($c(bkpop) + 30)) 1 $1 $calc($2 + $4) $calc($1 + $3) $calc($2 + $4) $calc($1 + $3) $2
}
alias -l m.p.c w -u $wp | md HW $w($wp).hwnd | w -a $wm | w -c $wp 
alias -l m.popup {
  if *-close* iswm $1 { t -ho 1 50 m.p.c | m $+(menu.,$m(menu.sel),.sel) 0 | m menu.sel 0 | return }
  var %x,%y,%w,%h,%i 1,%n,%sw $w(-1).w,%sh $w(-1).h
  %x = $m($+(menu.,$1,.x)) | %y = $m($+(menu.,$1,.y)) | %w = $calc($m($+(menu.,$1,.long)) + 6) | %h = $calc($m($+(menu.,$1,.suby)) + ($m(menu.h) / 2))
  if $calc($w($wm).dx + %x + %w) > %sw { %x = $calc(%x + %w) }
  if $calc($w($wm).dy + $m(menu.h) + %h + (%h / 2)) >= %sh { %y = $calc(%y - %h - $m(menu.h)) }
  w -Bdfhop +dL $wp $calc($w($wm).dx + %x) $calc($w($wm).dy + %y + $m(menu.h)) %w %h $wp
  dr -rf $wp $g(0) 1 0 0 %w %h
  wr wrSelectWindow $w($wp).hwnd | wr wrSetMode rmRoundRect | wr wrSetRegion 0 0 $w($wp).w $w($wp).h 10 10
  dr -fr $wp $g(30) 1 0 0 %w %h | dr -dfr $wp $g(70) 1 1 1 $calc(%w - 3) $calc(%h - 3) 10 10 | dr -dfr $wp $g($c(bkpop)) 1 2 2 $calc(%w - 5) $calc(%h - 5) 10 10
  c tmode n
  while %i <= $m($+(menu.,$1,.subs)) {
    %n = $m($+(menu.,$1,.,%i,.name))
    if *-* iswm %n {
      %n = $right(%n,-1)
      %x = $calc(($w($wp).w / 2) - ($m($+(menu.,$1,.,%i,.w)) / 2)) | %y = $m($+(menu.,$1,.,%i,.y))
      if %n { m.db %x $calc(%y + 1) $m($+(menu.,$1,.,%i,.w)) $calc($m(menu.h) - 3) }
      %y = $calc($m($+(menu.,$1,.,%i,.y)) + ($m(menu.h) / 2))
      if %n {
        m.dl $calc($m(menu.bw) + 2) %y $calc(%x - 1) %y | m.dl $calc(%x + $m($+(menu.,$1,.,%i,.w)) + 1) %y $calc($w($wp).w - ($m(menu.bw) * 2)) %y
        dt -r $wp $g(0) $m(menu.font) $m(menu.fontsize) $calc(%x + 5) $calc(1 + %y - ($m(menu.h) / 2)) %n
      }
      else { m.dl $calc($m(menu.bw) + 2) %y $calc($w($wp).w - ($m(menu.bw) * 2)) %y }
    }
    else {
      if $m($+(menu.,$1,.,%i,.chk)) { dt -r $wp $g(0) "WingDings" 15 $calc($m(menu.bw) + 1) $calc($m($+(menu.,$1,.,%i,.y)) - 1) $chr(252) }
      dt -r $wp $g(0) $m(menu.font) $m(menu.fontsize) $m($+(menu.,$1,.,%i,.x)) $m($+(menu.,$1,.,%i,.y)) %n
    }
    inc %i
  }
  c tmode $s | t -ho 1 50 w -a $wp
}
alias -l m.addmain {
  var %s $calc($m(menu.subs) + 1)
  m menu.subs %s
  m $+(menu.,%s,.sel) 0
  m $+(menu.,%s,.name) $+($s,$gettok($1-,1,44))
  m $+(menu.,%s,.len) $len($m($+(menu.,%s,.name)))
  m $+(menu.,%s,.substr) $gettok($1-,$+(2,-,$numtok($1-,44)),44)
  m $+(menu.,%s,.subs) 0
  m $+(menu.,%s,.w) $calc($width($m($+(menu.,%s,.name)),$m(menu.font),$calc($m(menu.fontsize) * -1)) + 5)
  m $+(menu.,%s,.long) 0
  m $+(menu.,%s,.h) $m(menu.h)
  m $+(menu.,%s,.x) $calc($m(menu.x) + $m(menu.w) + 5)
  m $+(menu.,%s,.y) $m(menu.y)
  m $+(menu.,%s,.suby) $calc($m(menu.bw) * 2)
  m menu.w $calc($m(menu.w) + $m($+(menu.,%s,.w)))
}
alias -l m.aItem {
  var %s $calc($m($+(menu.,$1,.subs)) + 1)
  m $+(menu.,$1,.subs) %s
  if *-* iswm $2- { m $+(menu.,$1,.,%s,.name) $2- | m $+(menu.,$1,.,%s,.w) $width($right($m($+(menu.,$1,.,%s,.name)),-1),$m(menu.font),$calc($m(menu.fontsize) * -1)) }
  else { m $+(menu.,$1,.,%s,.name) $+($s,$s,$s,$s,$2-,$s,$s) | m $+(menu.,$1,.,%s,.w) $width($m($+(menu.,$1,.,%s,.name)),$m(menu.font),$calc($m(menu.fontsize) * -1)) }
  m $+(menu.,$1,.,%s,.chk) $false
  if $m($+(menu.,$1,.long)) < $m($+(menu.,$1,.,%s,.w)) { m $+(menu.,$1,.long) $m($+(menu.,$1,.,%s,.w)) }
  m $+(menu.,$1,.,%s,.x) $m(menu.bw)
  m $+(menu.,$1,.,%s,.y) $m($+(menu.,$1,.suby))
  m $+(menu.,$1,.suby) $calc($m($+(menu.,$1,.suby)) + $m(menu.h))
}
alias -l m.setcmd { m $+(menu.,$1,.,$2,.cmd) $replace($3-,$chr(32),$s) }
alias -l m.docmd { t -mo 1 75 $replace($m($+(menu.,$1,.,$2,.cmd)),$s,$chr(32)) }
alias -l m.create {
  if $m { m -r }
  var %mstr $replace($+(.,$4-),$chr(32),$s),%i 2,%d
  m menu.subs 0 | m menu.x $1 | m menu.y $2 | m menu.w 0
  m menu.font $replace($3,_,$chr(32)) | m menu.fontsize $4 | m menu.over $false | m menu.sel 0 | m menu.bw 3
  m menu.h $height(AbCd,$m(menu.font),$calc($m(menu.fontsize) * -1))
  %d = $gettok(%mstr,%i,95)
  while %d { m.addmain %d | inc %i | %d = $gettok(%mstr,%i,95) }
}
menu @XcLusive {
  uclick: {
    if $inrect($mouse.x,$mouse.y,4,26,62,23) { c TimeMode $iif($c(TimeMode) == inc,dec,inc) | rs tT $iif($insnd,$time.f($time.gd),$iif($c(TimeMode) == dec,-) $+ 00:00) }
    elseif $inrect($mouse.x,$mouse.y,$c(s.s),$calc($c(s.y) + 3),$c(s.w),$c(s.sz)) { if !$c(s.f) && $insnd { mplay -k $round($calc($c(s.sec) * ($mouse.x - $c(s.s)) * 1000),-1) } | c s.f $false }
    c scr.f $false
  }
  sclick: {
    var %x $mouse.x,%y $mouse.y,%dx $mouse.dx,%dy $mouse.dy,%s $calc($c(s.s) + $c(s.o))
    if $inrect(%x,%y,1,1,165,24) { t -ho 1 25 m.desel | mw $wm $calc(%dx - $w($wm).x) $calc(%dy - $w($wm).y) }
    elseif ($inrect(%x,%y,$m(menu.x),$m(menu.y),$m(menu.w),$m(menu.h))) {
      var %sel | %sel = $m.get(%x,%y)
      if %sel && $m(menu.sel) != %sel { m.deSel | m.sel %sel | t -ho 1 100 m.popup %sel }
      elseif %sel == $m(menu.sel) { t -mo 1 100 w -a $wp }
    }
    elseif $inrect(%x,%y,%s,$calc($c(s.y) + 3),$c(s.sz),$calc(3 + $c(s.sz))) { m.desel | if $insnd { ms } }
    elseif $inrect(%x,%y,$c(tG.x),$c(tG.y),$c(tG.w),$c(tG.h)) { m.desel | if $insnd { ms SCROLL } }
    else { m.desel | btn.chk $wm $mouse.x $mouse.y }
  }
}
menu @mcmp3.ListMain {
  sclick: { 
    if $inrect($mouse.x,$mouse.y,0,0,$c(pl.w),20) { m.desel | mw $wlm $mouse.x $mouse.y }
    elseif $inrect($mouse.x,$mouse.y,$calc($c(pl.w) - 20),$calc($c(pl.h) - 28),20,20) { m.desel | mws $mouse.dx $mouse.dy }
    else { m.desel | btn.chk $wlm $mouse.x $mouse.y }
  }
}
menu @mcmp3.List {
  lbclick: m.deSel | rs tI | if $c(clickmode) == sclick { pc P $1 } | else { id3.refresh $p($1) }
  dclick: if $c(clickmode) == dclick { pc P $1 }
  Listeyi Sırala...: pl Sort
  -
  Müzik CD'si Çal: pc Pcd
  -
  Liste Fontu...: font | c pl.font $w($wl).font | c pl.fontsize $w($wl).fontsize | c pl.fontbold $w($wl).fontbold 
}
menu @mcmp3.ID3 {
  sclick: {
    if $inrect($mouse.x,$mouse.y,0,0,$calc($c(id3.w) - 40),20) { m.desel | mw $wID3 $mouse.x $mouse.y }
    else { m.desel | btn.chk $wID3 $mouse.x $mouse.y }
  }
}
menu @mcmp3.Popup {
  leave: m.desel
  mouse: {
    var %i $m.get($mouse.x,$mouse.y,sub),%m $m(menu.sel),%w $calc($w($wp).w - ($m(menu.bw) * 2)),%x,%os
    if %i && %i != $m($+(menu.,%m,.sel)) {
      %os = $m($+(menu.,%m,.sel)) | %x = $m(menu.bw)
      if %os > 0 && *-* !iswm $m($+(menu.,%m,.,%os,.name)) { 
        drawrect -fr $wp $g($c(bkpop)) 1 %x $m($+(menu.,%m,.,%os,.y)) %w $m(menu.h)
        dt -r $wp $g(0) $m(menu.font) $m(menu.fontsize) $m($+(menu.,%m,.,%os,.x)) $m($+(menu.,%m,.,%os,.y)) $m($+(menu.,%m,.,%os,.name))
        if $m($+(menu.,%m,.,%os,.chk)) { dt -r $wp $g(0) "WingDings" 15 $calc($m(menu.bw) + 1) $calc($m($+(menu.,%m,.,%os,.y)) - 1) $chr(252) }
      }
      if *-* !iswm $m($+(menu.,%m,.,%i,.name)) {
        drawrect -fr $wp $g($calc($c(bkpop) + 55)) 1 %x $m($+(menu.,%m,.,%i,.y)) %w $m(menu.h)
        dt -r $wp $g(0) $m(menu.font) $m(menu.fontsize) $m($+(menu.,%m,.,%i,.x)) $m($+(menu.,%m,.,%i,.y)) $m($+(menu.,%m,.,%i,.name))
        if $m($+(menu.,%m,.,%i,.chk)) { dt -r $wp $g(0) "WingDings" 15 $calc($m(menu.bw) + 1) $calc($m($+(menu.,%m,.,%i,.y)) - 1) $chr(252) }
      }
      if $m($+(menu.,%m,.,%os,.chk)) { dt -r $wp $g(0) "WingDings" 15 $calc($m(menu.bw) + 1) $calc($m($+(menu.,%m,.,%os,.y)) - 1) $chr(252) }
      m $+(menu.,%m,.sel) %i
    }
  }
  uclick: var %i $m.get($mouse.x,$mouse.y,sub),%m $m(menu.sel) | if %i { m.desel | m.docmd %m %i }
}
