SNL - Skinnable Notify List — File Browser

SNL-SkinnableNotifyListv2.0 / SNL-SkinnableNotifyListv2.0 / SNL / snl.mrc

snl.mrc — 47.87 KB — Download this file

;*****************************
;  SNL v2 by |Rolando|
;  © All Rights Reserved
;   www.snlv2.tk
;*****************************

;Aliases

alias snl { if (!$dialog(snl)) { dialog -m $+ $iif($_get(display,desktop) == 1,d) $+ $iif($_get(misc,ontop) == 1,o) snl snl } | else { dialog -v snl } }
alias snl.opt { if (!$dialog(snl.opt)) { dialog -m $+ $iif($_get(display,desktop) == 1,d) snl.opt snl.opt } | else { dialog -v snl.opt } }
alias snl.abt { if (!$dialog(snl.abt)) { dialog -m $+ $iif($_get(display,desktop) == 1,d) snl.abt snl.abt } | else { dialog -v snl.abt } }
alias snl.wiz { if (!$dialog(snl.wiz)) { dialog -m $+ $iif($_get(display,desktop) == 1,d) snl.wiz snl.wiz } | else { dialog -v snl.wiz } }
alias -l anl { var %a = $input(Enter nickname: ,eq,SNL) | if (%a) { var %b = $input(Enter note: ,eq,SNL) } | if (%b) { .notify %a %b } | if (!%b) && (%a) { .notify %a } | .timersnl -m 1 1 snl.upd } 
alias -l remnl { var %a = $input(Enter nickname: ,eq,SNL) | if ($notify(%a)) { .notify -r %a | snl.upd } }
alias -l snd.clr { _unset sounds $1 | snd.list }
alias -l rgb.list { if ($_get(rgb,dialog) == default) { did -c snl.opt 82 | did -b snl.opt 85 } | if ($_get(rgb,list) == default) { did -c snl.opt 83 | did -b snl.opt 86 } | if ($_get(rgb,font) == default) { did -c snl.opt 84 | did -b snl.opt 87 } | if ($_get(rgb,dialog) isnum) { did -u snl.opt 82 | did -e snl.opt 85 } | if ($_get(rgb,list) isnum) { did -u snl.opt 83 | did -e snl.opt 86 } | if ($_get(rgb,font) isnum) { did -u snl.opt 84 | did -e snl.opt 87 } }
alias -l _hide.all { did -h snl.opt 5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39,40,41,42,43,44,45,46,47,48,49,50,51,52,53,54,55,56,57,58,59,60,61,62,63,64,65,66,67,68,69,70,71,72,73,74,75,76,77,78,79,80,81,82,83,84,85,86,87,88,89,90,91,92,93,94,95,96 }
alias -l _show.display { did -v snl.opt 5,6,7,10,11,12,13,14,15,16 | if ($did(7).state == 1) { did -v snl.opt 8,9 } }
alias -l _show.sounds { did -v snl.opt 17,18,19,20,21,22,23,24,25,26,27,28,29,30,31 }
alias -l _show.position { did -v snl.opt 32,33,34,35,36,37,38,39,40,41,42,43,44,45 }
alias -l _show.skins { did -v snl.opt 46,47,48,49,50,51,52,53,54,55,56 }
alias -l _show.custom { did -v snl.opt 57,58,59,60,61,62,63,64,65,66,67,68,69,81,82,83,84,85,86,87 }
alias -l _show.misc { did -v snl.opt 70,71,72,73,74,75,76,77,78,79,80 }
alias -l _show.dock { did -v snl.opt 88,89,90,91,92,93,94,95 }
alias -l _wiz.cancel { var %c = $input(Are you sure you want to cancel ?,yi,SNL) | if (%c) && ($dialog(snl.wiz)) { dialog -c snl.wiz } }
alias -l _wiz.step { return $gettok($gettok($did(6,snl.wiz).text,1,58),2,32) }
alias -l _wiz.step1 { did -ra snl.wiz 6 Step 1: Enter your skin's name | did -h snl.wiz 9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,1 | did -v snl.wiz 7,8,1 }
alias -l _wiz.step2 { did -ra snl.wiz 6 Step 2: Choose your skin's icons | did -ra snl.wiz 10 * Required | did -h snl.wiz 7,8,23,24,25,26,27,28,29,30,31,32,33,34,1 | did -v snl.wiz 9,11,12,13,14,15,16,17,18,19,20,21,22,1 }
alias -l _wiz.step3 { did -ra snl.wiz 6 Step 3: Choose your sound files | did -ra snl.wiz 10 - Optional | did -h snl.wiz 11,12,13,14,15,16,17,18,19,20,21,22,35,36,37,1 | did -v snl.wiz 23,24,25,26,27,28,29,30,31,32,33,34,1 }
alias -l _wiz.step4 { did -ra snl.wiz 6 Step 4: Choose your colors | did -h snl.wiz 23,24,25,26,27,28,29,30,31,32,33,34,38,39,1 | did -v snl.wiz 2,10,35,36,37,1 }
alias -l _wiz.step5 { did -ra snl.wiz 6 Step 5: Finish your skin | did -h snl.wiz 2,10,35,36,37,1 | did -v snl.wiz 38,39,1 | _wiz.create }
alias -l _wiz.ico { var %i = $$file="Select an icon" [ $mircdir $+ *.ico ] | if (%i) && ($gettok(%i,-1,46) == ico) { did -ra snl.wiz $1 %i } }
alias -l _wiz.snd { var %s = $$file="Select a sound file" [ $mircdir $+ *.wav ] | if (%s) { if ($gettok(%s,-1,46) == wav) || ($gettok(%s,-1,46) == mp3) || ($gettok(%s,-1,46) == mid) { set % $+ $1 $+ sound %s | did -ra snl.wiz $2 $nopath(%s) } } }
alias -l _wiz.ply { if ($1 == 25) && (%notifysound) { splay $shortfn(%notifysound) } | if ($1 == 28) && (%unotifysound) { splay %unotifysound } | if ($1 == 31) && (%connectsound) { splay %connectsound } | if ($1 == 34) && (%disconnectsound) { splay %disconnectsound } }
alias -l r.off { if ($_get(misc,offline) == 1) { return Offline } | if ($_get(misc,offline) == 2) { return Not Online } }
alias -l snd.ply { if ($_get(sounds,enabled) == 1) && ($dialog(snl)) { if ($_get(sounds,$1)) splay -p $ifmatch } }
alias -l snl.list { var %s 1 | while ( %s <= $findfile($skndir,*.snl,0) ) { did -a snl.opt 47 $nopath($findfile($skndir,*.snl,%s)) |  inc %s } | unset %p }
alias -l rnl { did -i snl 2 1 cb root $gettok($did(snl,2,1),3,32) | .notify -r $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) | snl.upd }
alias -l gp.list { did -ra snl.opt 62 $longfn($s.icon(main)) | did -ra snl.opt 63 $longfn($s.icon(arrow)) | did -ra snl.opt 64 $longfn($s.icon(online)) | did -ra snl.opt 65 $longfn($s.icon(offline)) }
alias -l pop tokenize 32 $dll($pdll,Popup,$1-) | if ($isid) return $1- | $iif($4- != did not select a menu item,$4-)
alias -l snl.cn { var %n = $input(Enter your new nickname: ,eq,SNL) | if (%n) { .nick %n | sm.upd } }
alias -l snl.aw { var %m = $input(Enter your away message: ,eq,SNL) | away %m }
alias -l dirv { if ($1) { if (!$exists($1)) { .mkdir $1 } } | return $1 }
alias -l snl.refresh { if ($dialog(snl)) && ($dialog(snl.opt)) { dialog -c snl | .timer -m 1 1 snl | .timerd -m 2 1 dialog -v snl.opt } | if ($dialog(snl)) && (!$dialog(snl.opt)) { dialog -c snl | .timer -m 1 1 snl } }
alias -l snldir { $iif($1,return $+($shortfn($scriptdir),$1),return $dirv($shortfn($scriptdir))) }
alias -l skndir { $iif($1,return $snldir($+(skins\,$1)),return $dirv($snldir(skins\))) }
alias -l tmpdir { $iif($1,return $snldir($+(temp\,$1)),return $dirv($snldir(temp\))) }
alias -l dlldir { $iif($1,return $snldir($+(dlls\,$1)),return $dirv($snldir(dlls\))) }
alias -l lstdir { $iif($1,return $snldir($+(lists\,$1)),return $dirv($snldir(lists\))) }
alias -l imgdir { $iif($1,return $snldir($+(images\,$1)),return $dirv($snldir(images\))) }
alias -l mdx.load { mdx SetMircVersion $version | mdx MarkDialog $dname }
alias -l pdll { return $dlldir(Popups.dll) }
alias -l kdll { return $dlldir(kTools.dll) }
alias -l popups { return $dll($pdll,$1,$2-) }
alias -l mdx { dll $+(",$dlldir(mdx.dll),") $1- }
alias -l bdll { return $dlldir(bars.mdx) }
alias -l ddll { return $dlldir(dialog.mdx) }
alias -l vdll { return $dlldir(views.mdx) }
alias -l gdll { return $dlldir(ctl_gen.mdx) }
alias -l s.icon { return $readini $snldir(conf.ini) icons $1 }
alias -l s_set { writeini $snldir($1) $2 $3 $4 }
alias -l s_get { return $readini $snldir($1) $2 $3 $iif($4,$4) }
alias -l _set { writeini $snldir(conf.ini) $1 $2 $3 }
alias -l _unset { remini $snldir(conf.ini) $1 $2 $iif($3,$3) }
alias -l _get { return $readini $snldir(conf.ini) $1 $2 $iif($3,$3) }
alias -l s.gr { return $_get(misc,group) }
alias -l skin { return $_get(main,theme) }
alias -l tab { return $chr(9) }
alias -l stb { 
  if ($dialog(snl)) {
    var %g $_get(display,stbdisplay) 
    if (%g == 1) { did -i snl 3 2 1 Skin: $readini $_get(skins,current) snl Name $iif($_get(skins,custom) == 1,(Modified)) }
    if (%g == 2) { if ($server) { if ($away) { did -i snl 3 2 1 Mode: Away } | if (!$away) { did -i snl 3 2 1 Mode: Online } } | if (!$server) { did -i snl 3 2 1 Mode: Offline } }
    if (%g == 3) { did -i snl 3 2 1 Server: $iif($server, $server, N/A) }
    if (%g == 4) { 
      set %online 0 | set %offline 0 | var %a 1
      while ($notify(%a)) {
        if ($notify(%a).ison) { inc %online }
        if (!$notify(%a).ison) { inc %offline }
        inc %a
      }
    did -i snl 3 2 1 Users: Online( $+ $iif(%online,%online,0) $+ ) / Offline( $+ $iif(%offline,%offline,0) $+ ) }
    unset %online | unset %offline
  }
}

alias -l snl.save {
  set %f $$sfile($lstdir list.ini,Save as:,Save)
  if (%f) { var %o = $replace($nopath(%f),$chr(32),_) | var %p = $nofile(%f) | var %t = $shortfn(%p) $+ %o
    var %n 1
    while ($notify(%n) > $notify(0)) {
      var %r = $calc(%n - 1)
      writeini %t notify n $+ %r $notify(%n) $+ $iif($notify(%n).note,NOTE: $+ $notify(%n).note)
      inc %n
    }
    var %e $input(File saved as $crlf $+ $longfn(%t) $+ . ,io,SNL)
    unset %f
  }
}

alias -l snl.imp {
  var %f = $$sfile($lstdir *.ini,Choose .ini file:,OK), %c = 0
  if (!%f) { return }
  while ($readini(%f,notify,n $+ %c)) {
    .notify $replace($ifmatch,NOTE:,$chr(32))
    inc %c
  }
  snl.upd
}

alias -l snd.set { 
  var %s = $$file="Select sound file" [ $mircdir $+ *.wav ]
  if (%s) { _set sounds $1 $shortfn(%s) }
  if (!%s) { _set sounds $1 0 }
  snd.list
}

alias -l gp.set { 
  var %c = $$file="Select an icon" [ $mircdir $+ *.ico ]
  if (%c) { _set icons $1 $shortfn(%c) | _set skins custom 1 | snl.prv | if ($1 == main) { mdx SetDialog snl.opt icon $imgdir(snl.ico) } | snl.refresh }
  if (!%c) { return }
  gp.list
}

alias -l snl.ld {
  if ($1) {
    _set skins current $1-
    _set icons main $nofile($1-) $+ $readini($1-,icons,main)
    _set icons arrow $nofile($1-) $+ $readini($1-,icons,arrow)
    _set icons online $nofile($1-) $+ $readini($1-,icons,online)
    _set icons offline $nofile($1-) $+ $readini($1-,icons,offline)
    _set skins custom 0
    if ($dialog(snl.opt)) { mdx SetDialog snl.opt icon $imgdir(snl.ico) }
    if ($readini($1-,rgb,dialog)) { 
      if ($chr(44) isin $readini($1-,rgb,dialog)) { var %rgb1 = $readini($1-,rgb,dialog),%rgb2 = [ $rgb( [ %rgb1 ] ) ] | _set rgb dialog %rgb2 }
      if ($chr(44) !isin $readini($1-,rgb,dialog)) { _set rgb dialog $readini($1-,rgb,dialog) }
    }
    if ($readini($1-,rgb,list)) { 
      if ($chr(44) isin $readini($1-,rgb,list)) { var %rgb1 = $readini($1-,rgb,list),%rgb2 = [ $rgb( [ %rgb1 ] ) ] | _set rgb list %rgb2 }
      if ($chr(44) !isin $readini($1-,rgb,list)) { _set rgb list $readini($1-,rgb,list) }
    }
    if ($readini($1-,rgb,font)) { 
      if ($chr(44) isin $readini($1-,rgb,font)) { var %rgb1 = $readini($1-,rgb,font),%rgb2 = [ $rgb( [ %rgb1 ] ) ] | _set rgb font %rgb2 }
      if ($chr(44) !isin $readini($1-,rgb,font)) { _set rgb font $readini($1-,rgb,dialog) }
    }
    if (!$readini($1-,rgb,dialog)) { _set rgb dialog default }
    if (!$readini($1-,rgb,list)) { _set rgb list default }
    if (!$readini($1-,rgb,font)) { _set rgb font default }
    if ($readini($1-,sounds,notify)) { _set sounds notify $nofile($1-) $+ \ $+ $readini($1-,sounds,notify) } | else { _set sounds notify 0 }
    if ($readini($1-,sounds,unotify)) { _set sounds unotify $nofile($1-) $+ \ $+ $readini($1-,sounds,unotify) } | else { _set sounds unotify 0 }
    if ($readini($1-,sounds,connect)) { _set sounds connect $nofile($1-) $+ \ $+ $readini($1-,sounds,connect) } | else { _set sounds connect 0 }
    if ($readini($1-,sounds,disconnect)) { _set sounds disconnect $nofile($1-) $+ \ $+ $readini($1-,sounds,disconnect) } | else { _set sounds disconnect 0 }
    if ($dialog(snl.opt)) { gp.list | snd.list | rgb.list } | if ($dialog(snl)) { snl.refresh }
  }
}

alias -l snl.prv {
  if ($dialog(snl.opt)) && ($1) {
    did -ra snl.opt 50 Name: $readini($1-,snl,name)
    did -ra snl.opt 51 Author: $readini($1-,snl,author)
    var %f $nofile($1-) | var %s $nopath($1-)
    .copy -o %f $+ \ $+ $readini($1-,icons,main) $tmpdir(main.ico)
    .copy -o %f $+ \ $+ $readini($1-,icons,arrow) $tmpdir(arrow.ico)
    .copy -o %f $+ \ $+ $readini($1-,icons,online) $tmpdir(online.ico)
    .copy -o %f $+ \ $+ $readini($1-,icons,offline) $tmpdir(offline.ico)
    mdx SetControlMDX snl.opt 52 toolbar list nodivider wrap flat arrows > $bdll
    did -i snl.opt 52 1 bmpsize 16 16 | mdx SetBorderStyle snl.opt 52 windowedge | did -r snl.opt 52
    did -i snl.opt 52 1 setimage +d icon small 0, $+ $tmpdir(main.ico)
    did -i snl.opt 52 1 setimage +d icon small 0, $+ $tmpdir(arrow.ico)
    did -i snl.opt 52 1 setimage +d icon small 0, $+ $tmpdir(online.ico)
    did -i snl.opt 52 1 setimage +d icon small 0, $+ $tmpdir(offline.ico)
    did -a snl.opt 52 +ad 1 1 | did -a snl.opt 52 +ad 2 2 | did -a snl.opt 52 +ad 3 3 | did -a snl.opt 52 +ad 4 4
    .remove $tmpdir(main.ico) | .remove $tmpdir(arrow.ico) | .remove $tmpdir(online.ico) | .remove $tmpdir(offline.ico)
  }
}



alias -l snd.list { 
  if ($dialog(snl.opt)) {
    if ($_get(sounds,notify)) { did -ra snl.opt 21 $nopath($_get(sounds,notify)) } | else did -ra snl.opt 21 ---
    if ($_get(sounds,unotify)) { did -ra snl.opt 24 $nopath($_get(sounds,unotify)) } | else did -ra snl.opt 24 ---
    if ($_get(sounds,connect)) { did -ra snl.opt 27 $nopath($_get(sounds,connect)) } | else did -ra snl.opt 27 ---
    if ($_get(sounds,disconnect)) { did -ra snl.opt 30 $nopath($_get(sounds,disconnect)) } | else did -ra snl.opt 30 ---
  }
}
alias -l snl.hlp { winhelp $snldir(snl.hlp) $1 }
alias -l snl.pop {
  if ($s.gr == 1) {
    popups New notify 8 8
    if ($scon(1).network) {
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Whois $cr wnl }
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Query $cr qnl }
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + }
    }
    popups AddItem notify end + Add $cr anl
    if ($gettok($did(snl,2,1),4,32) != $null && $gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Remove $cr rnl }
    popups AddItem notify end +
    popups AddItem notify end + Refresh $cr snl.upd
    popups AddItem notify end +
    popups AddItem notify end + Close $cr dialog -c snl
    pop notify $mouse.dx $mouse.dy
  }
  if ($s.gr == 2) {
    popups New notify 8 8
    if ($scon(1).server) {
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Whois $cr wnl }
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Query $cr qnl }
      if ($gettok($did(snl,2,1),3,32) < $did(snl,2).lines) && ($gettok($did(snl,2,1),4,32) != $null) && ($gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + }
    }
    popups AddItem notify end + Add $cr anl
    if ($gettok($did(snl,2,1),4,32) != $null && $gettok($did(snl,2,1),3,32) != $null) { popups AddItem notify end + Remove $cr rnl }
    popups AddItem notify end +
    popups AddItem notify end + Refresh $cr snl.upd
    popups AddItem notify end +
    popups AddItem notify end + Close $cr dialog -c snl
    pop notify $mouse.dx $mouse.dy
  }
}


alias -l sm.pop {
  popups New ps 8 8
  popups AddItem ps end + Change nick $cr snl.cn
  popups AddItem ps end +
  popups AddItem ps end + $iif($server, Disconnect, Connect) $cr $iif($server, disconnect, server 1)
  if ($server) { popups AddItem ps end + $iif($away,Set back,Go away) $cr $iif($away,away, snl.aw) }
  pop ps $calc($dialog(snl).x + 4) $calc($mouse.dy + 12) 
}

alias -l qnl {
  if ($s.gr == 1) {
    did -i snl 2 1 cb root
    var %s = $gettok($did(snl,2,$gettok($did(snl,2,1),3,32)),7,32)
    var %c = 1
    while %c <= $scon(0) {
      if ($scon(%c).network = %s) { did -i snl 2 1 cb root $gettok($did(snl,2,1),3,32) | scid $scon(%c).cid query $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) }
      inc %c
    }
    snl.upd
  }
  if ($s.gr == 2) {
    did -i snl 2 1 cb root
    var %s = $gettok($did(snl,2,$gettok($did(snl,2,1),3,32)),7,32)
    var %c = 1
    while %c <= $scon(0) {
      if ($scon(%c).server = %s) { did -i snl 2 1 cb root $gettok($did(snl,2,1),3,32) | scid $scon(%c).cid query $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) }
      inc %c
    }
    snl.upd
  }
}

alias -l wnl {
  if ($s.gr == 1) { 
    did -i snl 2 1 cb root
    var %s = $gettok($did(snl,2,$gettok($did(snl,2,1),3,32)),7,32)
    var %c = 1
    while %c <= $scon(0) {
      if ($scon(%c).network = %s) { did -i snl 2 1 cb root $gettok($did(snl,2,1),3,32) | scid $scon(%c).cid whois $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) }
      inc %c
    }
    snl.upd
  }
  if ($s.gr == 2) { 
    did -i snl 2 1 cb root
    var %s = $gettok($did(snl,2,$gettok($did(snl,2,1),3,32)),7,32)
    var %c = 1
    while %c <= $scon(0) {
      if ($scon(%c).server = %s) { did -i snl 2 1 cb root $gettok($did(snl,2,1),3,32) | scid $scon(%c).cid whois $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) $gettok($gettok($did(snl,2,$gettok($did(snl,2,1), -1,32)), 7-, 32),1,32) }
      inc %c
    }
    snl.upd
  }
}

alias -l sm.upd { 
  if (!$dialog(snl)) || ($_get(display,button) == 0) || ($did(snl,5).hidden == $true) { return }
  else { 
    did -r snl 5 | mdx SetControlMDX $dname 5 toolbar list nodivider flat arrows > $bdll | did -i snl 5 1 bmpsize 16 16
    if ($server) { did -i snl 5 1 setimage icon small 0, $+ $s.icon(online) | did -a snl 5 +a $+ $iif($_get(display,arrow),v) 1 $me $iif($_get(display,btips), $tab $me - $server) }
    elseif (!$server) { did -i snl 5 1 setimage icon small 0, $+ $s.icon(offline) | did -a snl 5 +a $+ $iif($_get(display,arrow),v) 1 $me $iif($_get(display,btips), $tab $me - not connected) }
  }
}

alias -l snl.size {
  if ($_get(position,mode) == default) {
    var %dx $_get(position,dx) | var %dy $_get(position,dy) | var %dw $_get(position,dw) | var %dh $_get(position,dh) 
    var %sx $_get(position,sx) | var %sy $_get(position,sy) | var %sw $_get(position,sw) | var %sh $_get(position,sh) 
    if ($_get(position,coordinates) == 1) && ($_get(position,size) == 1) { dialog -s snl $iif(%dx,%dx,-1) $iif(%dy,%dy,-1) $iif(%dw,%dw,222) $iif(%dh,%dh,322) }
    if ($_get(position,coordinates) == 1) && ($_get(position,size) == 0) { dialog -s snl $iif(%dx,%dx,-1) $iif(%dy,%dy,-1) 222 322 }
    if ($_get(position,coordinates) == 0) && ($_get(position,size) == 1) { dialog -s snl -1 -1 $iif(%dw,%dw,222) $iif(%dh,%dh,322) }
    if ($_get(position,coordinates) == 0) && ($_get(position,size) == 0) { dialog -s snl -1 -1 222 322 }
  }
  if ($_get(position,mode) == random) { dialog -s snl $rand(0,$window(-1).w) $rand(0,$window(-1).h) 222 322  }
  if ($_get(position,mode) == specified) { dialog -s snl $iif(%sx,%sx,-1) $iif(%sy,%sy,-1) $iif(%sw,%sw,222) $iif(%sh,%sh,322) }
}
alias -l snl.upd {
  if (!$dialog(snl)) { halt }
  if ($s.gr == 1) {
    did -r snl 2
    var %s 1
    while $scon(%s) {
      if ($scon(%s).network) { if ($s.gr == 1) { did -i snl 2 1 cb root | did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $scon(%s).network }
      }
      inc %s
    }
    did -i snl 2 1 cb root | did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $r.off
    var %x = 1
    while $scon(%x) {
      scon %x | var %s = 1
      while $notify(%s) {
        if ($notify(%s).ison) { 
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $didwm(snl,2,* $scon(%x).network $+ *) | did -a snl 2 +e $+ $iif($_get(ghost,online) == 1,c) 2 2 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,)
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $did(snl,2).lines
          if ($didwm(snl,2,* $notify(%s) *)) { did -d snl 2 $ifmatch }
        }
        else { 
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $did(snl,2).lines
          if (!$didwm(snl,2,* $notify(%s) *)) {
            did -i snl 2 1 cb root
            var %l = $did(snl,2).lines | var %c = 2
            while %c <= %l {
              did -i snl 2 1 cb root %c
              if (!$didwm(snl,2,* $notify(%s) *)) { inc %c }
              else { var %c = $calc(%l +1) }
              if (%c = %l) { did -i snl 2 1 cb root %l | did -a snl 2 +e $+ $iif($_get(ghost,offline) == 1,c) 3 3 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,) }
            }          
          }
        }
        inc %s
      }
      inc %x
    }
    while %l > 0 {
      did -i snl 2 1 cb root %l
      if (!$did(snl,2,2)) { did -i snl 2 1 cb root | did -d snl 2 %l }
      dec %l
    }
    did -i snl 2 1 cb root
    if ($did(snl,2).lines = 1) {
      var %s = 1 | did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $r.off | did -i snl 2 1 cb root 2
      while $notify(%s) {
        did -a snl 2 +e $+ $iif($_get(ghost,offline) == 1,c) 3 3 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,)
        inc %s
      }
    }
  }
  if ($s.gr == 2) {
    did -r snl 2
    var %s = 1
    while $scon(%s) {
      if ($scon(%s).server) { did -i snl 2 1 cb root | did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $scon(%s).server }
      inc %s
    }
    did -i snl 2 1 cb root | did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $r.off
    var %x = 1
    while $scon(%x) {
      scon %x
      var %s = 1
      while $notify(%s) {
        if ($notify(%s).ison) { 
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $didwm(snl,2,* $scon(%x).server $+ *) | did -a snl 2 +e $+ $iif($_get(ghost,online) == 1,c) 2 2 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,)
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $did(snl,2).lines 
          if ($didwm(snl,2,* $notify(%s) *)) { did -d snl 2 $ifmatch }
        }
        else { 
          did -i snl 2 1 cb root | did -i snl 2 1 cb root $did(snl,2).lines
          if (!$didwm(snl,2,* $notify(%s) *)) {
            did -i snl 2 1 cb root
            var %l = $did(snl,2).lines
            var %c = 2
            while %c <= %l {
              did -i snl 2 1 cb root %c
              if (!$didwm(snl,2,* $notify(%s) *)) { inc %c }
              else { var %c = $calc(%l +1) }
              if (%c = %l) { did -i snl 2 1 cb root %l | did -a snl 2 +e $+ $iif($_get(ghost,offline) == 1,c) 3 3 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,)  }
            }          
          }
        }
        inc %s
      }
      inc %x
    }
    while %l > 0 {
      did -i snl 2 1 cb root %l
      if (!$did(snl,2,2)) { did -i snl 2 1 cb root | did -d snl 2 %l }
      dec %l
    }
    did -i snl 2 1 cb root
    if ($did(snl,2).lines = 1) {
      var %s = 1
      did -a snl 2 +be $+ $iif($_get(ghost,arrows) == 1,c) 1 1 $r.off
      did -i snl 2 1 cb root 2
      while $notify(%s) {
        did -a snl 2 +e $+ $iif($_get(ghost,offline) == 1,c) 3 3 $notify(%s) $tab $+ Nick: $notify(%s) $iif($notify(%s).note, $crlf $+ Note: $notify(%s).note,)
        inc %s
      }
    }
  }
}

alias -l _wiz.create { 
  var %d = $skndir($gettok($did(8).text, 1, 32)) | var %f = %d $+ \ $+ $lower($gettok($did(8).text, 1, 32)) $+ .snl
  .mkdir %d | writeini %f snl  Name $did(8).text | writeini %f snl  Author Custom Skin
  .copy -o $shortfn($did(12).text) %d $+ \ $+ $gettok($did(12).text, -1 ,92) | writeini %f icons main $gettok($did(12).text, -1 ,92)
  .copy -o $shortfn($did(15).text) %d $+ \ $+ $gettok($did(15).text, -1 ,92) | writeini %f icons arrow $gettok($did(15).text, -1 ,92)
  .copy -o $shortfn($did(18).text) %d $+ \ $+ $gettok($did(18).text, -1 ,92) | writeini %f icons online $gettok($did(18).text, -1 ,92)
  .copy -o $shortfn($did(21).text) %d $+ \ $+ $gettok($did(21).text, -1 ,92) | writeini %f icons offline $gettok($did(21).text, -1 ,92)
  if (%notifysound) { .copy -o $shortfn(%notifysound) %d $+ \ $+ $gettok(%notifysound, -1 ,92) | writeini %f sounds notify $gettok(%notifysound, -1 ,92) }
  if (%unotifysound) { .copy -o $shortfn(%unotifysound) %d $+ \ $+ $gettok(%unotifysound, -1 ,92) | writeini %f sounds unotify $gettok(%unotifysound, -1 ,92) }
  if (%connectsound) { .copy -o $shortfn(%connectsound) %d $+ \ $+ $gettok(%connectsound, -1 ,92) | writeini %f sounds connect $gettok(%connectsound, -1 ,92) }
  if (%disconnectsound) { .copy -o $shortfn(%disconnectsound) %d $+ \ $+ $gettok(%disconnectsound, -1 ,92) | writeini %f sounds disconnect $gettok(%disconnectsound, -1 ,92) }
  if (%rgbdialog) { writeini %f rgb dialog %rgbdialog }
  if (%rgblist) { writeini %f rgb list %rgblist }
  if (%rgbfont) { writeini %f rgb font %rgbfont }
}

;Dialogs


dialog snl {
  title "SNL"
  option dbu
  size -1 -1 100 134
  button "" ,1,0 0 0 0,cancel
  list 2, 0 17 100 110, size extsel
  list 3, 0 127 100 12, size
  button "positioner", 4 , 0 0 0 0
  list 5, 0 0 110 12, size
  menu "&File", 6
  item "&Add contact", 7, 6
  item "&Remove contact", 8, 6
  item break, 9, 6
  item "&Exit", 10, 6
  menu "&View", 11
  item "&Personal status", 12, 11
  item break, 13, 11
  item "&Statusbar", 14, 11
  menu "&Users", 22
  item "&Save List", 23, 22
  item "&Import List", 24, 22
  item break, 25, 22
  menu "&Sort Users by", 26, 22
  item "&Networks", 27, 26
  item "&Servers", 28, 26
  menu "&Tools", 15
  item "&Options", 16,15
  item break, 29, 15
  item "&Create New Skin Wizard", 30,15
  menu "&Help", 17
  item "&Contents", 18, 17
  item "&Search", 19 ,17
  item break, 20, 17
  item "About SNL", 21, 17
}

dialog snl.opt {
  title "SNL Options"
  option dbu
  size -1 -1 200 110
  button "OK" ,1,85 90 25 13,ok
  button "Cancel" ,2,116 90 25 13,cancel
  button "Help" , 3, 147 90 25 13
  list 4, 2 4 55 102, size
  box "Display", 5, 59 3 139 82
  check "Show dialogs on desktop", 6, 64 13 68 7
  check "Show statusbar", 7, 64 23 46 7
  text ", display:", 8, 110 23 22 7, hide
  combo 9, 135 21 38 100, drop hide
  check "Show personal status button:", 10, 64 33 78 7
  check "Dropdown arrow", 11, 72 43 49 7
  check "Show tooltips", 12, 130 43 41 7
  check "Enable Ghost Effect:", 13, 64 57 57 7
  check "Main arrows", 14, 67 68 35 11, push
  check "Online users", 15, 112 68 35 11, push
  check "Offline users", 16, 157 68 35 11, push
  box "Sounds", 17, 59 3 139 82
  check "Enable sounds", 18, 64 13 43 7
  box "Events", 19, 59 23 139 62
  text "Notify:", 20, 67 35 16 7
  button "", 21, 105 33 65 10
  button "!", 22, 170 33 7 10
  text "Unotify:", 23, 67 47 19 7 
  button "", 24, 105 45 65 10
  button "!", 25, 170 45 7 10
  text "Connect:", 26, 67 59 21 7 
  button "", 27, 105 57 65 10
  button "!", 28, 170 57 7 10
  text "Disconnect:", 29, 67 71 27 7 
  button "", 30, 105 69 65 10
  button "!", 31, 170 69 7 10
  box "Position", 32, 59 3 139 82
  radio "Default", 33, 64 11 26 7
  check "Derive coordinates from last usage", 34, 72 20 92 7, disabled
  check "Derive size from last usage", 35, 72 30 73 7, disabled
  radio "Random", 36, 64 40 28 7
  radio "Specify", 37, 64 50 26 7
  text "X:", 38, 74 60 4 7, disabled
  edit "",39 , 80 59 25 10, disabled
  text "Y:", 40, 74 73 4 7, disabled
  edit "",41 , 80 72 25 10, disabled
  text "Width:", 42, 125 60 15 7, disabled
  edit "",43 , 143 59 25 10, disabled
  text "Height:", 44, 125 73 17 7, disabled
  edit "",45 , 143 72 25 10, disabled
  box "Load Skins", 46, 59 3 139 82
  list 47, 64 12 40 55, size autovs
  button "Load", 48, 64 70 30 10
  box "Skin", 49, 110 8 82 74
  text "Name:", 50, 113 17 76 7
  text "Author:", 51, 113 24 76 7
  list 52, 115 34 10 100, size
  text "Main icon", 53, 128 36 25 7
  text "Arrow icon", 54, 128 47 30 7
  text "Online user", 55, 128 58 30 7
  text "Offline user", 56, 128 69 30 7
  box "Customize Skins", 57, 59 3 139 82
  text "Main icon:", 58, 64 13 25 7
  text "Arrow icon:", 59, 64 21 30 7
  text "Online user:", 60, 64 29 30 7
  text "Offline user:", 61, 64 37 30 7
  edit "", 62, 95 13 80 10, read autohs
  edit "", 63, 95 21 80 10, read autohs
  edit "", 64, 95 29 80 10, read autohs
  edit "", 65, 95 37 80 10, read autohs
  button "...", 66, 177 13 16 8
  button "...", 67, 177 21 16 8
  button "...", 68, 177 29 16 8
  button "...", 69, 177 37 16 8
  box "Miscellaneous", 70, 59 3 139 82
  check "Open on startup", 71, 64 13 49 7
  check "Always keep SNL on top", 72, 64 23 66 7
  text "Group users by:" 73, 64 33 39 7
  combo 74, 105 31 38 50, drop
  text "Show offline users as:", 75, 64 45 53 7
  combo 76, 122 43 38 50, drop
  box "SNL in menus", 77, 59 60 139 25
  check "Menubar", 78, 69 72 30 7
  check "Status", 79, 114 72 24 7
  check "Channel", 80, 152 72 28 7
  box "Advanced", 81, 59 47 139 38
  check "Default dialog color", 82 ,64 56 65 7
  check "Default list background color", 83 ,64 65 87 7
  check "Default font color", 84 ,64 74 61 7
  button "Set color", 85, 160 56 25 8
  button "Set color", 86, 160 65 25 8
  button "Set color", 87, 160 74 25 8
  box "Docking Options", 88, 59 3 139 82
  check "Enable docking", 89, 64 13 45 7
  text "Dock side:", 90, 64 26 25 7
  radio "Dock left", 91, 99 26 29 7, groupd
  radio "Dock right", 92, 138 26 32 7
  box "Warning", 93, 59 42 139 43
  icon 94, 64 56 32 32, $imgdir(warning.ico), noborder
  text "Enabling the docking feature will disable many other SNL features such as statusbar and dialog positioning. No other dialog should be docked while docking SNL.", 95, 87 50 103 28
  icon 96, 18 -65 220 220, $imgdir(options.jpg)
}

dialog snl.abt {
  title "About SNL"
  size -1 -1 171 105
  option dbu
  button "OK", 1, 125 85 38 11, ok
  text "Skinnable Notify List", 2, 10 45 50 7
  text "", 3, 10 65 128 7
  text "Coded && Designed by Rolando. All rights reserved.", 4, 10 53 123 7
  icon 5, -86 -53 342 210, $imgdir(about.jpg), noborder
  text "Graphics, icons, and sounds used in this addon belong to their respective owners. For more information and updates visit www.snlv2.tk !", 6, 10 73 113 21
}

dialog snl.wiz {
  title "Create New Skin Wizard"
  size -1 -1 200 150
  option dbu
  text "", 5, 52 -3 200 135
  icon 4, -26 -67 105 265, $imgdir(wizard.jpg), noborder
  box "", 1, 0 -3 200 135
  button "Next", 2, 113 135 36 11, default
  button "Cancel", 3, 155 135 36 11
  text "Step 1: Enter your skin's name", 6, 60 15 100 8, center
  text "Your Skin's Name:", 7, 65 65 50 8
  edit "", 8, 115 64 75 10
  button "Back", 9, 71 135 36 11, hide
  text "* Required", 10, 65 120 50 8
  text "Main Icon:", 11, 65 45 30 8 
  edit "", 12, 100 44 70 10, autohs
  button "Browse", 13, 175 44 22 10
  text "Arrow Icon:", 14, 65 60 30 8 
  edit "", 15, 100 59 70 10, autohs
  button "Browse", 16, 175 59 22 10
  text "Online Icon:", 17, 65 75 30 8 
  edit "", 18, 100 74 70 10, autohs
  button "Browse", 19, 175 74 22 10
  text "Offline Icon:", 20, 65 90 30 8 
  edit "", 21, 100 89 70 10, autohs
  button "Browse", 22, 175 89 22 10
  text "Notify:", 23, 65 45 30 8 
  button "---", 24, 100 44 70 10,center
  button "!", 25, 170 44 7 10
  text "Unotify:", 26, 65 60 30 8 
  button "---", 27, 100 59 70 10, center
  button "!", 28, 170 59 7 10
  text "Connect:", 29, 65 75 30 8 
  button "---", 30, 100 74 70 10, center
  button "!", 31, 170 74 7 10
  text "Disconnect:", 32, 65 90 30 8 
  button "---", 33, 100 89 70 10, center
  button "!", 34, 170 89 7 10
  check "Default dialog color", 35, 65 50 55 8
  check "Default list color", 36, 65 63 50 8
  check "Default font color", 37, 65 76 51 8
  check "Load skin", 38, 65 63 50 8
  button "Finish", 39, 113 135 36 11, hide
}

:Dialog Events

on *:dialog:snl:*:*: {
  if ($devent == init) {
    mdx.load | mdx SetDialog $dname icon $s.icon(main)
    mdx SetControlMDX $dname 2 treeview > $vdll
    mdx SetControlMDX $dname 3 statusbar $iif($_get(rgb,dialog) == default,sizegrip) > $bdll
    mdx SetControlMDX $dname 4 positioner maxbox minbox size > $ddll
    mdx SetControlMDX $dname 5 toolbar list nodivider flat arrows > $bdll
    if ($_get(rgb,dialog) isnum) { mdx SetDialog $dname bgcolor $_get(rgb,dialog) | mdx SetColor $dname 5 background $_get(rgb,dialog) | did -i $dname 3 1 setbkcolor $_get(rgb,dialog) }
    if ($_get(rgb,list) isnum) { did -i $dname 2 1 setcolor bkg $_get(rgb,list) }
    if ($_get(rgb,font) isnum) { mdx SetColor $dname 5 textbg $_get(rgb,font) | did -i $dname 2 1 setcolor text $_get(rgb,font) }
    if ($_get(misc,group) == 1) { did -c snl 27 } | if ($_get(misc,group) == 2) { did -c snl 28 }
    did -i $dname 2 1 iconsize normal small | mdx SetBorderStyle $dname 3,5 windowedge
    did -i $dname 2 1 seticon normal 0, $+ $s.icon(arrow)
    did -i $dname 2 1 seticon normal 0, $+ $s.icon(online)
    did -i $dname 2 1 seticon normal 0, $+ $s.icon(offline)
    did -i $dname 3 1 seticon 0 small 0, $+ $s.icon(main)
    did -i $dname 5 1 bmpsize 16 16
    did -i $dname 5 1 setimage icon small 0, $+ $s.icon(online)
    did -i $dname 5 1 setimage icon small 0, $+ $s.icon(offline)
    sm.upd | snl.upd | stb Signed on $time | snl.size
    if ($_get(display,statusbar) == 0) { did -h snl 3 } | elseif ($_get(display,statusbar) == 1) { did -c snl 14 }
    if ($_get(display,button) == 1) { did -c snl 12 }
    if ($_get(docking,enable) == 1) { did -h snl 3 | dll $kdll DockWindow $dialog(snl).hwnd > $_get(docking,side) } | elseif ($_get(docking,enable) == 0) { .timerkdl -m 1 2 dll $kdll UnDock }
  }
  if ($devent = sclick) {
    if ($did == 2) { var %a = $gettok($did($dname,2,1),1,32) | if (%a = rclick) { snl.pop } }
    if ($did == 4) { mdx MoveControl $dname 2 * * $calc($dialog($dname).w - 9) $calc($dialog($dname).h - 111) | mdx MoveControl $dname 3 * $calc($dialog($dname).h - 76) $calc($dialog($dname).w - 8) * }
  }
  if ($devent = dclick) { if ($did == 5) { sm.pop } }
  if ($devent = menu) {
    if ($did == 7) { anl }
    if ($did == 8) { remnl }
    if ($did == 10) { if ($_get(docking,enable) == 1) { dialog -c snl | .timerkdl -m 1 2 dll $kdll UnDock | dll $kdll UnDock } | else { dialog -c snl } }
    if ($did == 12) { if ($_get(display,button) == 1) { _set display button 0 | did -h snl 5 | did -u snl 12 } | elseif ($_get(display,button) == 0) { _set display button 1 | did -v snl 5 | sm.upd | did -c snl 12 } }
    if ($did == 14) { if ($_get(display,statusbar) == 1) { _set display statusbar 0 | did -h snl 3 | did -u snl 14 } | elseif ($_get(display,statusbar) == 0) { _set display statusbar 1 | did -v snl 3 | did -c snl 14 } }
    if ($did == 16) { snl.opt }
    if ($did == 18) { snl.hlp }
    if ($did == 19) { snl.hlp   }
    if ($did == 21) { snl.abt }
    if ($did == 23) { snl.save }
    if ($did == 24) { snl.imp }
    if ($did == 27) { did -u snl 28 | _set misc group 1 | did -c snl 27 | snl.upd }
    if ($did == 28) { did -u snl 27 | _set misc group 2 | did -c snl 28 | snl.upd }
    if ($did == 30) { snl.wiz }
  }
  if ($devent == close) { _set position dx $dialog($dname).x | _set position dy $dialog($dname).y | _set position dw $calc($dialog($dname).w  - 4) | _set position dh $calc($dialog($dname).h - 25) }
}

on *:dialog:snl.opt:*:*: {
  if ($devent == init) { 
    mdx.load | mdx SetDialog $dname icon $imgdir(snl.ico)
    mdx SetControlMDX $dname 4 treeview haslines hasbuttons showsel linesatroot > $vdll
    mdx SetControlMDX $dname 39,41,43,45 updown arrowkeys alignright right edit numeric nothousands > $gdll
    mdx SetControlMDX $dname 52 toolbar list nodivider wrap flat arrows > $bdll
    mdx SetBorderStyle $dname 1,2,3,14,15,16,21,22,24,25,27,28,30,31,48,66,67,68,69,85,86,87 staticedge
    did -a $dname 4 General | did -i $dname 4 1 cb last | did -a $dname 4 Display | did -a $dname 4 Sounds | did -a $dname 4 Position | did -i $dname 4 1 cb root 
    did -a $dname 4 Skins | did -i $dname 4 1 cb last | did -a $dname 4 Load | did -a $dname 4 Customize | did -i $dname 4 1 cb root | did -a $dname 4 Misc | did -i $dname 4 1 cb root | did -a $dname 4 Docking
    did -a $dname 9 Skin | did -a $dname 9  Mode | did -a $dname 9 Server | did -a $dname 9 Users | did -c $dname 9 $_get(display,stbdisplay)
    did -a $dname 74 Networks | did -a $dname 74 Servers | did -c $dname 74 $s.gr | did -a $dname 76 Offline | did -a $dname 76 Not Online | did -c $dname 76 $_get(misc,offline)
    did -i $dname 39 1 $_get(position,sx) 0 $window(-1).w | did -i $dname 41 1 $_get(position,sy) 0 $window(-1).h  | gp.list
    did -i $dname 43 1 $_get(position,sw) 100 $window(-1).w | did -i $dname 45 1 $_get(position,sh) 100 $window(-1).w | snd.list | _hide.all | did -v $dname 96
    if ($_get(display,desktop) == 1) { did -c snl.opt 6 } | if ($_get(display,statusbar) == 1) { did -c snl.opt 7 } | if ($_get(display,button) == 1) { did -c snl.opt 10 }
    if ($_get(display,arrow) == 1) { did -c snl.opt 11 } | if ($_get(display,btips) == 1) { did -c snl.opt 12 } | if ($_get(ghost,enabled) == 1) { did -c snl.opt 13 }
    if ($_get(ghost,arrows) == 1) { did -c snl.opt 14 } | if ($_get(ghost,online) == 1) { did -c snl.opt 15 } | if ($_get(ghost,offline) == 1) { did -c snl.opt 16 }
    if ($_get(display,button) == 0) { did -b snl.opt 11,12 } | if ($_get(ghost,enabled) == 0) { did -b snl.opt 14,15,16 } | if ($_get(misc,ontop) == 1) { did -c snl.opt 72 }
    if ($_get(position,mode) == default) { did -c snl.opt 33 | did -e snl.opt 34,35 } | if ($_get(position,mode) == random) { did -c snl.opt 36 } | rgb.list
    if ($_get(position,coordinates) == 1) { did -c snl.opt 34 } | if ($_get(position,size) == 1) { did -c snl.opt 35 } | if ($_get(position,mode) == specified) { did -c snl.opt 37 }
    if ($_get(docking,side) == left) { did -c snl.opt 91 } | if ($_get(docking,side) == right) { did -c snl.opt 92 } | if ($_get(docking,enable) == 1) { did -c snl.opt 89 } | if ($_get(docking,enable) == 0) { did -b snl.opt 91,92 }
    if ($group(#mm) == on) { did -c snl.opt 78 } | if ($group(#ms) == on) { did -c snl.opt 79 } | if ($group(#mc) == on) { did -c snl.opt 80 } | if ($_get(misc,startup) == 1) { did -c snl.opt 71 }
    did -i $dname 52 1 bmpsize 16 16 | mdx SetBorderStyle $dname 52,62,63,64,65 windowedge | snl.list | if ($_get(sounds,enabled) == 1) { did -c $dname 18 }
    var %s = $_get(skins,current), %c = $gettok(%s,-1,92) | if ($didwm(47,%c)) var %l = $ifmatch | if (%l) { did -c $dname 47 %l | snl.prv $shortfn($findfile($skndir,*.snl,$did(47).sel)) }
  } 
  if ($devent == sclick) { 
    if ($did == 1) { 
      _set display desktop $did(6).state
      _set display statusbar $did(7).state
      if ($did(7).state == 1) { if ($did(9).sel != $null) { _set display stbdisplay $did(9).sel } | if ($did(9).sel == $null) { _set display stbdisplay 0 } } | if ($did(7).state == 0) { _set display stbdisplay 0 }
      if ($did(74).sel != $null) { _set misc group $did(74).sel } | if ($did(74).sel == $null) { _set misc group 1 }
      if ($did(76).sel != $null) { _set misc offline $did(76).sel } | if ($did(76).sel == $null) { _set misc offline 1 }
      _set display button $did(10).state | _set misc ontop $did(72).state
      if ($did(10).state == 1) { _set display arrow $did(11).state | _set display btips $did(12).state }
      _set ghost enabled $did(13).state | _set sounds enabled $did(18).state | _set misc startup $did(71).state
      if ($did(13).state == 1) { _set ghost arrows $did(14).state | _set ghost online $did(15).state | _set ghost offline $did(16).state }
      if ($did(13).state == 0) { _set ghost arrows 0 | _set ghost online 0 | _set ghost offline 0 }
      _set rgb dialog $iif($did(82).state == 1,default, $_get(rgb,dialog)) | _set rgb list $iif($did(83).state == 1,default, $_get(rgb,list)) | _set rgb font $iif($did(84).state == 1,default, $_get(rgb,font))
      if ($did(33).state == 1) { _set position mode default | _set position coordinates $did(34).state | _set position size $did(35).state }
      if ($did(36).state == 1) { _set position mode random } | if ($did(80).state == 1) { .enable #mc } | if ($did(80).state == 0) { .disable #mc }
      if ($did(78).state == 1) { .enable #mm } | if ($did(78).state == 0) { .disable #mm } | if ($did(79).state == 1) { .enable #ms } | if ($did(79).state == 0) { .disable #ms }
      if ($did(37).state == 1) { _set position mode specified | _set position sx $gettok($did(39).text,1,32) | _set position sy $gettok($did(41).text,1,32) | _set position sw $gettok($did(43).text,1,32) | _set position sh $gettok($did(45).text,1,32) }
      _set docking enable $did(89).state | if ($did(91).state == 1) && ($_get(docking,enable) == 1) { _set docking side left } | if ($did(92).state == 1) && ($_get(docking,enable) == 1) { _set docking side right }
      if ($dialog(snl)) { dialog -c snl | .timer -m 1 1 snl }
    }
    if ($did == 3) { snl.hlp }
    if ($did == 4) { 
      tokenize 32 $did(4,1,1)
      if ($4 == 2) && ($5 == 2) { _hide.all | _show.display }
      if ($4 == 2) && ($5 == 3) { _hide.all | _show.sounds }
      if ($4 == 2) && ($5 == 4) { _hide.all | _show.position | if ($_get(position,mode) == default) || ($_get(position,mode) == random) { did -e snl.opt 38,39,40,41,42,43,44,45 | did -b snl.opt 38,39,40,41,42,43,44,45 } | else { did -e snl.opt 38,39,40,41,42,43,44,45 } }
      if ($4 == 3) && ($5 == 2) { _hide.all | _show.skins }
      if ($4 == 3) && ($5 == 3) { _hide.all | _show.custom }
      if ($4 == 4) { _hide.all | _show.misc }
      if ($4 == 5) { _hide.all | _show.dock }
    }
    if ($did == 7) { if ($did(7).state == 1) { did -v snl.opt 8,9 } | else { did -h snl.opt 8,9 } }
    if ($did == 10) { if ($did(10).state == 1) { did -e snl.opt 11,12 } | else { did -b snl.opt 11,12 } }
    if ($did == 13) { if ($did(13).state == 1) { did -e snl.opt 14,15,16 } | else { did -b snl.opt 14,15,16 } }
    if ($did == 21) { $iif($_get(sounds,notify), snd.clr notify ,snd.set notify) }
    if ($did == 22) { if ($_get(sounds,notify)) { splay -p $ifmatch } }
    if ($did == 24) { $iif($_get(sounds,unotify), snd.clr unotify ,snd.set unotify) }
    if ($did == 25) { if ($_get(sounds,unotify)) { splay -p $ifmatch } }
    if ($did == 27) { $iif($_get(sounds,connect), snd.clr connect ,snd.set connect) }
    if ($did == 28) { if ($_get(sounds,connect)) { splay -p $ifmatch } }
    if ($did == 30) { $iif($_get(sounds,disconnect), snd.clr disconnect ,snd.set disconnect) }
    if ($did == 31) { if ($_get(sounds,disconnect)) { splay -p $ifmatch } }
    if ($did == 48) { if ($did(47).sel >= 1) { var %s $did(47).sel | snl.ld $shortfn($findfile($skndir,*.snl,%s)) } }
    if ($did == 33) { did -e snl.opt 34,35 | did -b snl.opt 38,39,40,41,42,43,44,45 }
    if ($did == 36) { did -b snl.opt 34,35,38,39,40,41,42,43,44,45 }
    if ($did == 37) { did -b snl.opt 34,35 | did -e snl.opt 38,39,40,41,42,43,44,45 }
    if ($did == 47) { if ($did(47).sel >= 1) { var %s $did(47).sel | snl.prv $shortfn($findfile($skndir,*.snl,%s)) } }
    if ($did == 66) { gp.set main }
    if ($did == 67) { gp.set arrow }
    if ($did == 68) { gp.set online }
    if ($did == 69) { gp.set offline }
    if ($did == 82) { if ($did(82).state == 0) { did -e snl.opt 85 } | if ($did(82).state == 1) { did -b snl.opt 85 } }
    if ($did == 83) { if ($did(83).state == 0) { did -e snl.opt 86 } | if ($did(83).state == 1) { did -b snl.opt 86 } }
    if ($did == 84) { if ($did(84).state == 0) { did -e snl.opt 87 } | if ($did(84).state == 1) { did -b snl.opt 87 } }
    if ($did == 85) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,dialog)) | if (%c != $false) _set rgb dialog %c }
    if ($did == 86) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,list)) | if (%c != $false) _set rgb list %c }
    if ($did == 87) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,font)) | if (%c != $false) _set rgb font %c }
    if ($did == 89) { if ($did(89).state == 0) { did -b $dname 91,92 } | if ($did(89).state == 1) { did -e $dname 91,92 } }
  }
} 

on *:dialog:snl.abt:*:*: { if ($devent == init) { mdx.load | mdx SetColor $dname 6,1 background $rgb(242,241,246) | mdx SetColor $dname 6 textbg $rgb(242,241,246) | mdx SetColor $dname 2,4 background $rgb(248,248,250) | mdx SetColor $dname 2,4 textbg $rgb(248,248,250) | mdx SetColor $dname 3 background $rgb(244,244,246) | mdx SetColor $dname 3 textbg $rgb(244,244,246) | mdx SetDialog $dname icon $imgdir(snl.ico) | did -ra $dname 3 Version 2.0 for mIRC® v $+ $version } | if ($devent == sclick) && ($did == 7) { url www.rolandunderground.tk } }

on *:dialog:snl.wiz:*:*: {
  if ($devent == init) { 
    mdx.load | mdx SetDialog $dname icon $imgdir(snl.ico)
    mdx SetColor $dname 6,7,9,10,11,14,17,20,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38 textbg $rgb(255,255,255)
    mdx SetColor $dname 5,6,7,9,10,11,14,17,20,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38 background $rgb(255,255,255)
    mdx SetFont $dname 6 +a 13 600 tahoma
    mdx SetBorderStyle $dname 8,12,15,18,21 clientedge
    _wiz.step1 | did -c snl.wiz 35,36,37,38
  }
  if ($devent = sclick) {
    if ($did == 2) { 
      if ($_wiz.step == 1) { if (!$did(8).text) { var %m = $input(You did not enter a name for your skin ,ow,SNL) | halt  } | if ($exists($skndir($did(8).text,32))) || ($findfile($skndir, $+ $lower($gettok($did(8).text, 1, 32)) $+ .snl,0) == 1) { var %m = $input(There already is a skin with this name ,ow,SNL) } | elseif ($did(8).text) && (!$exists($skndir($did(8).text))) { _wiz.step2 | halt } }
      if ($_wiz.step == 2) { var %a = $did(12).text | var %s = $did(15).text | var %t = $did(18).text | var %f = $did(21).text | if (!%a) || (!$exists(%a)) || (!%s) || (!$exists(%s)) || (!%t) || (!$exists(%t)) || (!%f) || (!$exists(%f)) { var %m = $input(One or more icon(s) does not exist ,ow,SNL) } | elseif (%a) || ($exists(%a)) || (%s) || ($exists(%s)) || (%t) || ($exists(%t)) || (%f) || ($exists(%f)) { _wiz.step3 | halt } }
      if ($_wiz.step == 3) { _wiz.step4 | halt }
      if ($_wiz.step == 4) { _wiz.step5 | halt }
    }
    if ($did == 3) { _wiz.cancel }
    if ($did == 9) { 
      if ($_wiz.step == 2) { _wiz.step1 | halt }
      if ($_wiz.step == 3) { _wiz.step2 | halt }
      if ($_wiz.step == 4) { _wiz.step3 | halt }
      if ($_wiz.step == 5) { _wiz.step4 | halt }
    }
    if ($did == 13) { _wiz.ico 12 }
    if ($did == 16) { _wiz.ico 15 }
    if ($did == 19) { _wiz.ico 18 }
    if ($did == 22) { _wiz.ico 21 }
    if ($did == 24) { _wiz.snd notify 24 }
    if ($did == 25) { _wiz.ply 25 }
    if ($did == 27) { _wiz.snd unotify 27 }
    if ($did == 28) { _wiz.ply 28 }
    if ($did == 30) { _wiz.snd connect 30 }
    if ($did == 31) { _wiz.ply 31 }
    if ($did == 33) { _wiz.snd disconnect 33 }
    if ($did == 34) { _wiz.ply 34 }
    if ($did == 35) { if ($did(35).state == 0) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,dialog)) | if (%c != $false) set %rgbdialog %c } | if (%c == $false) { did -c $dname 35 } | if ($did(35).state == 1) { unset %rgbdialog } }
    if ($did == 36) { if ($did(36).state == 0) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,list)) | if (%c != $false) set %rgblist %c } | if (%c == $false) { did -c $dname 36 } | if ($did(36).state == 1) { unset %rgblist } }
    if ($did == 37) { if ($did(37).state == 0) { var %c $dll($dlldir(color.dll) , Color , $_get(rgb,font)) | if (%c != $false) set %rgbfont %c } | if (%c == $false) { did -c $dname 37 } | if ($did(37).state == 1) { unset %rgbfont } }
    if ($did == 39) { if ($did(38).state == 1) { snl.ld $shortfn($skndir($gettok($did(8).text, 1, 32)) $+ \ $+ $lower($gettok($did(8).text, 1, 32)) $+ .snl) } | dialog -c snl.wiz }
  }
  if ($devent == close) { unset %notifysound | unset %unotifysound | unset %connectsound | unset %disconnectsound | unset %rgbdialog | unset %rgblist | unset %rgbfont }
}

;Menubar Groups

#mm on
menu menubar {
  .-
  .SNL
  .. Open SNL : snl
  .. -
  .. SNL Options : snl.opt
  .. SNL Help : snl.hlp
}
#mm end

#ms off
menu status {
  .-
  .SNL
  .. Open SNL : snl
  .. -
  .. SNL Options : snl.opt
  .. SNL Help : snl.hlp
}
#ms end

#mc off
menu channel {
  .-
  .SNL
  .. Open SNL : snl
  .. -
  .. SNL Options : snl.opt
  .. SNL Help : snl.hlp
}
#mc end

;Events

on *:START: { if ($_get(misc,startup) == 1) { snl } }
on ^*:NICK: { .timer -m 1 1 sm.upd }
on 1:CONNECT: { snl.upd | .timer -m 1 1 sm.upd | snd.ply connect | stb }
on 1:DISCONNECT: { snl.upd | .timer -m 1 1 sm.upd | snd.ply disconnect | stb }
on ^1:NOTIFY: { snl.upd | snd.ply notify | stb }
on ^1:UNOTIFY: { snl.upd | snd.ply unotify | stb }
on *:LOAD: { snl.ld $shortfn($skndir(Default\default.snl)) }