dialog slap_manager {
title "Slap Manager"
size -1 -1 498 306
}
on *:dialog:slap_manager:*:*: {
if ($devent == init) {
dcx Mark $dname slap_manager_cb
xdialog -b $dname +nty
;// Call initilisation alias
slap_manager_init_dcx
}
}
alias -l slap_manager_init_dcx {
;// Initialising control: Slaps List (Text 4)
xdialog -c $dname 4 text 170 10 100 12 center
xdid -t $dname 4 Slaps List
;// Initialising control: (List 3)
xdialog -c $dname 3 list 170 25 150 199 tabstop multi extsel
if !$exists(slaps.txt) {
.write slaps.txt around a bit with a large trout
}
loadbuf -ao $dname 3 slaps.txt
;// Initialising control: (TreeView 1)
xdialog -c $dname 1 treeview 10 25 150 200 haslines showsel tabstop checkbox hasbuttons linesatroot
xdid -l $dname 1 16
var %a = 1, %b = $scon(0)
while %a <= %b {
.scon %a
xdid -a $dname 1 $+(%a,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $network,$chr(9),)
var %c = 1, %d = $chan(0)
while %c <= %d {
xdid -a $dname 1 $+(%a %c,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $chan(%c),$chr(9),)
var %e = 1, %f = $nick($chan(%c),0)
while %e <= %f {
xdid -a $dname 1 $+(%a %c %e,$chr(9),+e 0 0 0 1 0 $rgb(0,0,255) $nick($chan(%c),%e),$chr(9),)
inc %e
}
inc %c
}
inc %a
}
;// Initialising control: Slap (Button 5)
xdialog -c $dname 5 button 330 10 75 20 tabstop
xdid -t $dname 5 Slap
;// Initialising control: (Check 6)
xdialog -c $dname 6 check 330 35 150 18 tabstop 3state
xdid -t $dname 6 Slap All
;// Initialising control: Network/Channel/Nick (Text 2)
xdialog -c $dname 2 text 10 10 150 12 center
xdid -t $dname 2 Network/Channel/Nick
}
alias slap_manager_cb {
if $2 == sclick {
if $3 == 6 {
xdid -t $1 6 Slap $iif(!$xdid($1,6).state,All,$iif($xdid($1,6).state == 1,Checked,Random))
}
}
elseif ($2 == stateclick) {
%bc = $ctime
stateclick $1-
}
elseif !$istok(close changing sizing focus focusout,$2,32) && (mouse* !iswm $2) && (*activate !iswm $2) && (*mov* !iswm $2) {
echo $color(info) -s */ slap_manager_cb: $1-
}
}
alias stateclick {
var %path = $xdid($1,1).mouseitem, %state = $iif($xdid($1,1,%path).state != 2,2,1), %a = 1, %b = $xdid($1,1,%path).num
while %a <= %b {
xdid -k $1 1 %state %path %a
var %c = 1, %d = $xdid($1,1,%path %a).num
while %c <= %d {
xdid -k $1 1 %state %path %a %c
inc %c
}
inc %a
}
echo -a $+(Time:,$duration($calc($ctime - %bc)))
slap_manager_cb $1 stateclick 1 $iif($xdid($1,1,%path).state != 2,2,1
}
;//
menu status,channel {
slap_manager : dialog $iif(!$dialog(slap_manager),-md,-ev) slap_manager slap_manager
}