zIRCk Final Project — File Browser
zIRCkFinalProjectv2.5 / zIRCkFinalProjectv2.5 / System / script6.mrc
script6.mrc — 16.1 KB — Download this file
[SCRIPT]
NAME=Bottom Bar
VERSION=2.5
; ## Bottom bar (switchbar/statusbar)
; ## [AFX] 2005
; ## Return switchbar icon
alias sbico {
if ($1 isnum) {
var %c
if ($1 = 1) { %c = $rconf(Switchbar,Status) }
if ($1 = 2) { %c = $rconf(Switchbar,Channel) }
if ($1 = 3) { %c = $rconf(Switchbar,Query) }
if ($1 = 4) { %c = $rconf(Switchbar,Custom) }
if ($1 = 5) { %c = $rconf(Switchbar,DCCChat) }
if ($1 = 6) { %c = $rconf(Switchbar,DCCSend) }
if ($1 = 7) { %c = $rconf(Switchbar,DCCGet) }
return %c
}
}
; ## Check if data exists on switchbar
alias _sbdata {
if ($dialog(bbar)) {
if (!$did(bbar,3,2)) {
bbar_close !
dodialog bbar
}
}
}
; ## Close bbar
alias bbar_close {
hdock -udock bbar close
$iif(!$1,hdock -showsb,return)
}
; ## Mini toolbar alias
alias sb_minitb {
if ($1) {
conf Display MiniTb $iif($1 = on,on,$iif($1 = off,off))
minitb $1
}
}
; ## Mini zAmp alias
alias sb_miniz {
if ($1) {
conf Display MiniZ $iif($1 = on,on,$iif($1 = off,off))
miniz $1
}
}
; ## Actual mini toolbar movement alias (for on/off)
alias minitb {
if ($dialog(bbar)) {
if ($1 = off) {
$iif($rconf(Display,MiniZ) = off,mdx MoveControl bbar 3 20 4 $iif($os = 98,9999,35000) 28)
if ($rconf(Display,MiniZ) = on) {
did -h bbar 2
did -v bbar 5
mdx MoveControl bbar 3 198 4 $iif($os = 98,9999,35000) 28
}
else {
did -h bbar 2
}
$iif($rconf(Display,Toolbar) = on,dodialog tb)
}
elseif ($1 = on) {
mdx MoveControl bbar 3 203 4 $iif($os = 98,9999,35000) 28
did -h bbar 5
did -v bbar 2
if ($dialog(tb)) { hdock -udock tb close }
}
load.sb
}
}
; ## Actual mini zAmp stuff
alias miniz {
if ($dialog(bbar)) {
if ($1 = on) {
$iif($rconf(Display,MiniTb) = on,did -h bbar 2)
did -v bbar 5
mdx MoveControl bbar 3 198 4 $iif($os = 98,9999,35000) 28
$iif($rconf(Display,Toolbar) = on,dodialog tb)
}
elseif ($1 = off) {
$iif($rconf(Display,MiniTb) = on,did -v bbar 2)
did -h bbar 5
if ($rconf(Display,Toolbar) = on) && ($rconf(Display,MiniTb) = off) {
mdx MoveControl bbar 3 20 4 $iif($os = 98,9999,35000) 28
}
elseif ($rconf(Display,Toolbar) = on) && ($rconf(Display,MiniTb) = on) {
minitb on
hdock -udock tb close
}
}
load.sb
}
}
; ## Find lag (ran by timer)
alias tlag {
set %ticks $ticks
.raw ping $scid($cid).server
}
; ## Arrow popup
alias sb_arrowpop {
var %n = arrow
popup New %n 16 16
popup SetMetrics %n iconpad 10 0 contentpad 0 0 spacing 1 0
popup AddItem %n end $+(+,$iif($rconf(Display,MiniZ) = on,x),$iif($rconf(Display,Toolbar) = off,d)) Mini zAmp $cr sb_miniz $iif($rconf(Display,MiniZ) = on,off,on)
popup AddItem %n end $+(+,$iif($rconf(Display,MiniTb) = on,x),$iif($rconf(Display,Toolbar) = off,d)) Mini toolbar $cr sb_minitb $iif($rconf(Display,MiniTb) = on,off,on)
popup AddItem %n end $+(+,$iif($rconf(Display,Statusbar) = on,x)) Statusbar $cr statusbar $iif($rconf(Display,Statusbar) = on,off,on)
popup AddItem %n end +
popup AddItem %n end $+(+,$iif($rconf(Switchbar,Fill) = on,x)) Fill switchbar $cr sb_fill
pop1 %n $mouse.dx $mouse.dy
}
; ## Fill switchbar
alias sb_fill {
if ($rconf(Switchbar,Fill) = on) {
conf Switchbar Fill off
}
elseif ($rconf(Switchbar,Fill) = off) {
conf Switchbar Fill on
}
load.sb
}
; ## Statusbar
alias statusbar {
conf Display Statusbar $iif($1 = on,on,off)
hdock -docksize bbar $iif($rconf(Display,Statusbar) = on,56,28)
}
; ## mQ's /lagbar alias, modified by me/Edd
alias lagbar {
if ($1 == create) {
window -Bphd +d @lagbar 1 1 168 50
drawfill -r @lagbar $rgb(face) 1 160 5 5 17
window -a @lagbar
drawtext -rn @lagbar $rgb(text) Tahoma 10 2 1 $iif(!$server,Not connected...,Waiting...)
}
elseif ($1 == destroy) {
window -c @lagbar
}
elseif ($1 == set) {
var %_l = $iif($$2 > 5.9, 17, $int($calc($$2 / 0.35 + 1)))
drawrect -rf @lagbar $rgb(face) 1 2 2 72 12
drawcopy @lagbar 13 28 156 17 @lagbar 6 28
drawrect -rf @lagbar $rgb(face) 1 160 28 5 17
drawrect -rf @lagbar $iif(%lag >= 6,$rgb(227,108,138),$iif(%lag >= 3 && %lag <= 5,$rgb(158,186,233),$rgb(94,191,145))) 1 160 $calc(21 - %_l + 1 + 23) 5 %_l
drawcopy @lagbar 6 28 160 17 @lagbar 6 5
drawtext -rn @lagbar $rgb(text) Tahoma 10 2 1 Lag: %lag secs
drawdot @lagbar
}
elseif ($1 == clear) {
drawrect -rf @lagbar $rgb(face) 1 0 0 168 50
}
}
; ## Memory usage
alias proc_cpu {
if ($dialog(bbar)) {
did -i bbar 4 2 1 Memory usage: $dll($shortfn($scriptdirDll\ProcInfo.dll),GetRam,p100use) $+ % $+($chr(40),$dll($shortfn($scriptdirDll\ProcInfo.dll),GetRam,memory),KB,$chr(41)) / Free: $dll($shortfn($scriptdirDll\ProcInfo.dll),GetRam,p100avail) $+ % $+($chr(40),$dll($shortfn($scriptdirDll\ProcInfo.dll),GetRam,memoryavail),KB,$chr(41)) $iif($rconf(Display,MiniZ) = on && $insong,$chr(149) Listening to: $zsong $iif($insong.pause,$+($chr(40),Paused,$chr(41)))) $iif($rconf(Display,MiniTb) = on && $rconf(Display,BandMeter) = on && $rconf(Display,MiniZ) = off,$chr(149) Bandwidth usage: $_band_dn $+ KB Down $+ $chr(44) $_band_up $+ KB Up)
}
}
; ## Loading switchbar data
alias load.sb {
if ($dialog(bbar)) {
did -r bbar 3
var %z = 1,%a = $did(bbar,8).text,%buttons = 0,%divs = 0
while %z <= $scid(0) {
var %l = $scon(%z)
scid %l
did -a bbar 3 +c $+ $iif($active == $window(Status Window) && %l == $activecid && $window($active).state != minimized,x) 1 $iif($scid(%l).network && $scid(%l).server,$scid(%l).network,$iif($scid(%l).server,$scid(%l).server,Status Window)) $chr(9) $+ %l Status Window
var %x = 1
while (%x <= $chan(0)) {
did -a bbar 3 +c $+ $iif($active == $chan(%x) && $window($active).state != minimized && $scon(%z) == $activecid,x) $+ $iif($window($chan(%x)).sbcolor,i) 2 $iif($chr(38) isin $chan(%x),$chr(38) $+ $chan(%x),$chan(%x)) $chr(9) $+ %l $chan(%x)
inc %x
}
var %x = 1
while (%x <= $query(0)) {
did -a bbar 3 +c $+ $iif($active == $query(%x) && $window($active).state != minimized && $query(%x).cid = $activecid,x) $+ $iif($window($query(%x)).sbcolor,i) 3 $query(%x) $chr(9) $+ %l $query(%x)
inc %x
}
var %x = 1
while (%x <= $send(0)) {
if ($scon(%z) == $send(%x).cid) {
did -a bbar 3 +c $+ $iif($active == Send $send(%x) $send(%x).file && $window($active).state != hidden,x) $+ $iif($window($send(%x)).sbcolor,i) 6 $send(%x) $chr(9) $+ %l $send(%x) $+(",$send(%x).file,")
}
inc %x
}
var %x = 1
while (%x <= $get(0)) {
if ($scon(%z) == $get(%x).cid) {
did -a bbar 3 +c $+ $iif($active == Get $get(%x) $get(%x).file && $window($active).state != hidden,x) $+ $iif($window($get(%x)).sbcolor,i) 7 $get(%x) $chr(9) $+ %l $get(%x) $+(",$get(%x).file,")
}
inc %x
}
var %x = 1
while (%x <= $chat(0)) {
if (%z == $chat(%x).cid) {
did -a bbar 3 +c $+ $iif($active == = $+ $chat(%x) && $window($active).state != hidden,x) $+ $iif($window( $+ = $+ $chat(%x)).sbcolor,i) 5 $chat(%x) $chr(9) $+ %l $chat(%x)
}
inc %x
}
if ($window(Channels List)) { did -a bbar 3 +c $+ $iif(Channels List = $active && %l == $activecid && $window($active).state != minimized,x) 4 Channels List $chr(9) $+ %l Channels List }
if ($window(Links List)) { did -a bbar 3 +c $+ $iif(Links List = $active && %l == $activecid && $window($active).state != minimized,x) 4 Links List $chr(9) $+ %l Links List }
if ($window(Notify List)) { did -a bbar 3 +c $+ $iif(Notify List = $active && %l == $activecid && $window($active).state != minimized,x) 4 Notify List $chr(9) $+ %l Notify List }
if ($window(URL List)) { did -a bbar 3 +ca $+ $iif(URL List = $active && %z == $activecid && $window($active).state != minimized,x) 4 URL List $chr(9) $+ %z URL List }
did -a bbar 3 -
inc %z
inc %divs
}
var %x = 1
while (%x <= $window(0)) {
var %s = $calc($len($window(%x)) -1)
if (@ !isin $right($window(%x),%s)) && ($window(%x) != @lagbar) && ($window(%x) != @zplsearch) && ($window(%x) != @DIR) && ($window(%x) != @viewlog) && ($window(%x) != @logs) && ($window(%x) != @logclean) && ($window(%x) != @PL) && ($window(%x) != @Tip zirck) && ($bar.max) && (%m >= %a) {
did -a bbar 3 +c $+ $iif($active == $window(%x) && $window($active).state != hidden,x) 4 $window(%x) $chr(9) $+ %l $window(%x)
}
inc %x
}
if ($rconf(Display,MiniTb) = off) && ($rconf(Display,MiniZ) = off) { var %w = $calc($calc($dialog(bbar).w -40) / ($did(bbar,3).lines -1 - %divs)) }
elseif ($rconf(Display,MiniTb) = on) || ($rconf(Display,MiniZ) = on) { var %w = $calc($calc($dialog(bbar).w -220) / ($did(bbar,3).lines -1 - %divs)) }
if ($rconf(Switchbar,Fill) = off) {
if (%w > 90) { did -i bbar 3 1 bwidth 90 90 }
else {
did -i bbar 3 1 bwidth %w %w
}
}
else {
did -i bbar 3 1 bwidth %w %w
}
}
}
; ## Mini zAmp popup
alias miniz_pop {
var %a = miniz
popup New %a 16 16
popup SetMetrics %a iconpad 10 0 contentpad 0 0 spacing 1 0
popup LoadImg %a icon small $shortfn($scriptdirzAmp\Playlist.ico)
popup LoadImg %a icon small $shortfn($scriptdirzAmp\options.ico)
popup LoadImg %a icon small $shortfn($scriptdirzAmp\zamp.ico)
popup LoadImg %a icon small $shortfn($scriptdirzAmp\modes.ico)
popup AddItem %a end + 4 4 Open file... $cr mp3_play -o
popup AddItem %a end +
popup AddItem %a end + $+ $iif($zread(MP3,Mode) = rep,x) Repeat once $cr zamp_playmode 2
popup AddItem %a end + $+ $iif($zread(MP3,Mode) = cont,x) Repeat all $cr zamp_playmode 1
popup AddItem %a end + $+ $iif($zread(MP3,Mode) = shuffle,x) Shuffle $cr zamp_playmode 3
popup AddItem %a end +
popup AddItem %a end + 3 3 Open player $cr zamp
popup AddItem %a end + 2 2 Configuration $cr zcfg
popup AddItem %a end +
popup AddItem %a end + 1 1 Playlist editor $cr zplcreate
popup AddItem %a end + Playlist: $iif($zread(MP3,Playlist),$remove($nopath($longfn($ifmatch)),.txt),None Selected) $cr plmenu_loadlist
pop1 %a $mouse.dx $mouse.dy
}
; ## Bottom bar dialog/dialog events
dialog bbar {
title "bbar"
size -1 -1 578 38
option dbu
list 2, 10 2 90 14, size hide
list 1, 0 2 10 14, size
list 3, 103 2 34961 14, size
list 4, 0 14 35000 14, size
button "Button", 7, 365 16 37 12, disable
text "1", 8, 1 1 0 0, hide
list 5, 10 2 88 14, hide size
}
on *:dialog:bbar:init:0: {
mdx MarkDialog $dname
mdx SetFont $dname 3,4 -11 400 Tahoma
mdx SetControlMDX $dname 1,2,3,5 Toolbar flat wrap list arrows nodivider > $bars
mdx SetControlMDX $dname 4 Statusbar > $bars
lagbar create
mdx SetControlMDX $dname 7 Window > $dlg
mdx SetBorderStyle $dname 1,2,3,4,5
did -i $dname 1,2,3,5 1 bmpsize 16 16
did -i $dname 1 1 bwidth 1 11
; did -i $dname 1 1 pad 1 1
did -i $dname 1 1 setimage icon small $shortfn($scriptdirIcons\arrowright.ico)
did -a $dname 1 +aW 12 1 $chr(9) $+ Bar options
did -a $dname 1 -
did -i bbar 2 1 setimage icon small 0, $+ $icl
did -i bbar 2 1 setimage icon small 1, $+ $icl
did -i bbar 2 1 setimage icon small 2, $+ $icl
did -i bbar 2 1 setimage icon small 3, $+ $icl
did -i bbar 2 1 setimage icon small 4, $+ $icl
did -i bbar 2 1 setimage icon small 5, $+ $icl
did -i bbar 2 1 setimage icon small 6, $+ $icl
did -a bbar 2 +av 1 $chr(9) $+ Connect
did -a bbar 2 +a 3 $chr(9) $+ Configuration
did -a bbar 2 +a 4 $chr(9) $+ Module Manager
did -a bbar 2 +a 5 $chr(9) $+ zAmp
did -a bbar 2 +a 6 $chr(9) $+ KTE Themes
did -a bbar 2 +ac $+ $iif($rconf(Display,Sidepane) = on,x) 7 $chr(9) $+ Enable/disable sidepane
did -a bbar 2 -
did -i bbar 3 1 setimage icon small $sbico(1)
did -i bbar 3 1 bwidth 90 90
did -i bbar 3 1 setimage icon small $sbico(2)
did -i bbar 3 1 setimage icon small $sbico(3)
did -i bbar 3 1 setimage icon small $sbico(4)
did -i bbar 3 1 setimage icon small $sbico(5)
did -i bbar 3 1 setimage icon small $sbico(6)
did -i bbar 3 1 setimage icon small $sbico(7)
did -i bbar 5 1 setimage icon small 0, $+ $zicl
did -i bbar 5 1 setimage icon small 1, $+ $zicl
did -i bbar 5 1 setimage icon small 2, $+ $zicl
did -i bbar 5 1 setimage icon small 3, $+ $zicl
did -i bbar 5 1 setimage icon small 4, $+ $zicl
did -i bbar 5 1 setimage icon small $shortfn($scriptdirzamp\options.ico)
did -a bbar 5 +a 1 $chr(9) $+ Previous
did -a bbar 5 +a 2 $chr(9) $+ Play
did -a bbar 5 +ac 3 $chr(9) $+ Pause
did -a bbar 5 +a 4 $chr(9) $+ Stop
did -a bbar 5 +a 5 $chr(9) $+ Next
did -a bbar 5 -
did -a bbar 5 +a 6 $chr(9) $+ Playlist
did -a bbar 5 -
did -i bbar 4 1 setparts $calc($window(-2).w -8)
did -i bbar 4 1 seticon small 17, $+ $icl
did -a bbar 7 grab $window(@lagbar).hwnd @lagbar
mdx SetBorderStyle $dname 7 staticedge
load.sb
if ($rconf(Display,MiniZ) = on) && ($rconf(Display,MiniTb) = off) { miniz on }
elseif ($rconf(Display,MiniZ) = off) && ($rconf(Display,MiniTb) = on) { minitb on }
elseif ($rconf(Display,MiniZ) = on) && ($rconf(Display,MiniTb) = on) { miniz on }
else { mdx MoveControl bbar 3 20 4 $iif($os = 98,9999,35000) 28 }
proc_cpu
$iif(!$timer(proc),.timerproc 0 1 proc_cpu)
$iif($rconf(Display,MiniTb) = on,hdock -hidetb)
hdock -hidesb
hdock -dock bbar bottom 56
$iif(!$timer(sbdata),.timersbdada 0 1 _sbdata)
}
on *:dialog:bbar:sclick:1: { sb_arrowpop }
on *:dialog:bbar:sclick:2: {
var %s = $did($dname,2).sel
if %s = 2 {
if ($scid($activecid).status = connecting || $scid($activecid).status = connected ) { scid $activecid disconnect }
else {
scid $activecid server
.timer -m 1 1 load.sb
}
_toolbar.s
scid $activecid .timer -m 1 1 load.sb
did -f $dname 4
scid $activecid window -a "status window"
}
elseif %s = 3 { dodialog config }
elseif %s = 4 { dodialog mods }
elseif %s = 5 { zamp }
elseif %s = 6 { kte.load }
elseif %s = 7 {
if (+xca iswm $gettok($did($dname,2).seltext,1,32)) {
conf Display Sidepane on
sidepane
}
elseif (+ca iswm $gettok($did($dname,2).seltext,1,32)) {
conf Display Sidepane off
sidepane -x
}
}
}
on *:dialog:bbar:dclick:2: {
if ($did($dname,2).sel = 2) { favservs }
}
on *:dialog:bbar:sclick:3:{
var %window2 = $remove($gettok($did($dname,3).seltext,5-,32),$chr(9))
if ($gettok(%window2,1,32) isnum) { %window2 = $+(",$gettok(%window2,2-,32),") }
if ($numtok(%window2,32) > 2) { %window2 = " $+ $gettok(%window2,$iif($gettok(%window2,1,32) isnum,2-,3-),32) $+ " }
var %z = $remove($gettok($did($dname,3).seltext,2,9),$chr(9)),%z = $gettok(%z,1,32)
scid %z
tokenize 32 $did(bbar,3,$did(3).sel)
if ($2 isnum) {
var %m = $gettok($did($dname,3).seltext,1,32)
if (+c isin %m || +cW isin %m && $mouse.key != 4) {
window -n $iif($2 = 1,"Status Window",$iif($2 = 5,"= $+ %window2 $+ ",$iif($2 = 6,"Send $remove(%window2,$chr(34)) $+ ",$iif($2 = 7,"Get $remove(%window2,$chr(34)) $+ ",%window2))))
}
elseif (+xc isin %m || +ixc isin %m || +xcv isin %m && $mouse.key != 4) {
window -a $iif($2 = 1,"Status Window",$iif($2 = 5,"= $+ %window2 $+ ",$iif($2 = 6,"Send $remove(%window2,$chr(34)) $+ ",$iif($2 = 7,"Get $remove(%window2,$chr(34)) $+ ",%window2))))
}
elseif ($mouse.key = 4) {
$iif($2 = 2,part,window -c) $iif($2 = 1,"Status Window",$iif($2 = 5,"= $+ %window2 $+ ",$iif($2 = 6,"Send $remove(%window2,$chr(34)) $+ ",$iif($2 = 7,"Get $remove(%window2,$chr(34)) $+ ",%window2))))
}
}
load.sb
}
on *:dialog:bbar:sclick:5: {
var %s = $did($dname,5).sel
if (%s = 2) { mp3_prev }
if (%s = 3) { mp3_play }
if (%s = 4) { mp3_pause $gettok($did($dname,5).seltext,1,32) }
if (%s = 5) { mp3_stop }
if (%s = 6) { mp3_next }
if (%s = 8) { miniz_pop }
}