Peace & Protection 4.00 — File Browser

PeaceProtection4.00v4.0 / PeaceProtection4.00v4.0 / SCRIPT / THEMEDIT.MRC

THEMEDIT.MRC — 21.72 KB — Download this file

; #= P&P -rs
; ########################################
; Peace & Protection
; Theme / scheme editing and related, also some sound scheme
; ########################################

; Options
; /text [file.ext|on|off|mirc|edit|save file.ext|cfg]
; /nickcol [on|off|edit] (always refreshes)
alias text {
  if ($1 == on) { _cfgw texts 1 | .enable #pp-texts | if ($exists($_cfg(text.dat))) .load -a $_cfg(text.dat) | dispa Text scheme is now $:t(On) ( $+ $_texts.name $+ ) }
  elseif ($1 == off) { _cfgw texts 0 | .disable #pp-texts | dispa Text scheme is now $:t(Off) }
  elseif ($1 == cfg) textopt
  elseif ($1 == mirc) {
    .unload -a " $+ $alias(text.dat) $+ "
    .copy -o script\blanktxs.dat $_cfg(text.dat)
    .load -a $_cfg(text.dat)
    _cfgw texts 1
    .enable #pp-texts
    dispa Default mIRC text scheme loaded!
    if ($dialog(textsch)) did -a textsch 4 $_texts.name
    if ($dialog(textopt)) did -a textopt 6 $_texts.name
  }
  elseif ($1 == save) {
    if ($2 == $null) _error No filename given to save text scheme to.You must give a filename to save the current text scheme to.
    if ($exists($2-)) _fileopt 0 $2-
    .copy -o $_cfg(text.dat) " $+ $2-"
    dispa Current text scheme saved as $:q($2-)
  }
  elseif ($1 == edit) textsch
  elseif ($1) {
    if ($exists($1-) == $false) _error Text scheme file doesn't exist!You must select a P&P text scheme file that exists.
    if (*#=*texts* !iswm $read -l1 $1-) _error Error in text scheme file! $+ $1- is not a valid P&P text scheme file.
    .unload -a " $+ $alias(text.dat) $+ "
    .copy -o " $+ $1-" $_cfg(text.dat)
    .load -a $_cfg(text.dat)
    _cfgw texts 1
    .enable #pp-texts
    dispa Text scheme file $:q($1-) loaded! ( $+ $_texts.name $+ )
    if ($dialog(textsch)) did -a textsch 4 $_texts.name
    if ($dialog(textopt)) did -a textopt 6 $_texts.name
  }
  elseif ($_cfgi(texts)) dispa Text scheme is $:t(On) ( $+ $_texts.name $+ ) Use $:b(/text cfg) to configure or $:b(/text edit) to edit scheme.
  else dispa Text scheme is $:t(Off) Use $:b(/text cfg) to configure or $:b(/text edit) to edit scheme.
}
alias _texts.name if ($exists($_cfg(text.dat)) == $false) return no text scheme | var %line = $read -l1 $_cfg(text.dat) | if ($gettok(%line,5-,32) != $null) return $ifmatch | return unnamed text scheme
alias nickcol {
  if ($1 == on) _cfgw nickcol 1
  elseif ($1 == off) _cfgw nickcol 0
  elseif ($1 == edit) { ncedit | return }
  if ($_cfgi(nickcol)) {
    .enable #pp-nicklist
    dispa Nicklist coloring is $:t(On)
  }
  else {
    .disable #pp-nicklist
    dispa Nicklist coloring is $:t(Off)
  }
  var %num = 1
  :upd
  if ($chan(%num)) { col.nicklist $ifmatch | inc %num | goto upd }
}

; Make sure nicklist/textscheme options are correct (startup)
alias _upd.texts {
  if (($_cfgi(texts)) && ($exists($_cfg(text.dat)))) {
    .enable #pp-texts
    if ($alias(text.dat) == $null) .load -a $_cfg(text.dat)
  }
  else {
    .disable #pp-texts
    if ($alias(text.dat)) .unload -a " $+ $ifmatch $+ "
  }
  if ($_cfgi(nickcol)) .enable #pp-nicklist
  else .disable #pp-nicklist
}

;
; Modification of display scheme
;
dialog display {
  title "Display Scheme"
  size -1 -1 346 305
  box "Colors:", 201, 5 8 160 140
  text "Base color:", 202, 20 30 100 20, right
  text "Word highlight color:", 203, 20 52 100 20, right
  text "String highlight color:", 204, 20 74 100 20, right
  text "Warning color:", 205, 20 96 100 20, right
  text "Alert background:", 206, 20 118 100 20, right
  icon 3, 125 29 15 15
  icon 4, 125 51 15 15
  icon 5, 125 73 15 15
  icon 6, 125 95 15 15
  icon 7, 125 117 15 15

  box "Brackets:", 207, 180 8 160 140
  text "&Normal:", 208, 190 30 38 20, right
  edit "", 12, 230 26 50 22, autohs
  edit "", 13, 280 26 50 22, autohs
  text "&Whois:", 209, 190 52 38 20, right
  edit "", 10, 230 48 50 22, autohs
  edit "", 11, 280 48 50 22, autohs
  text "&Quotes:", 210, 190 74 38 20, right
  edit "", 16, 230 70 50 22, autohs
  edit "", 17, 280 70 50 22, autohs
  text "&Public:", 211, 190 96 38 20, right
  edit "", 14, 230 92 50 22, autohs
  edit "", 15, 280 92 50 22, autohs
  text "&Bold:", 212, 190 118 38 20, right
  edit "", 8, 230 114 50 22, autohs
  edit "", 9, 280 114 50 22, autohs

  box "Symbols:", 213, 5 158 160 140
  text "&Line bullet:", 214, 15 180 88 20, right
  edit "", 18, 105 176 50 22, autohs
  text "&CTCP symbol:", 215, 15 202 88 20, right
  edit "", 19, 105 198 50 22, autohs
  text "W&allop symbol:", 216, 15 224 88 20, right
  edit "", 20, 105 220 50 22, autohs
  text "&Server notices:", 217, 15 246 88 20, right
  edit "", 21, 105 242 50 22, autohs
  text "B&ulleted list:", 218, 15 268 88 20, right
  edit "", 22, 105 264 50 22, autohs

  text "&Horizontal line:", 219, 190 180 88 20, right
  edit "", 23, 280 176 50 22, autohs
  text "&Popup marker:", 220, 190 202 88 20, right
  edit "", 24, 280 198 50 22, autohs

  button "OK", 101, 180 265 50 25, OK default
  button "Cancel", 102, 235 265 50 25, cancel
  button "Help", 103, 290 265 50 25, disable
}
on *:DIALOG:display:init:*:{
  window -hl @.display
  loadbuf @.display $_cfg(display.dat)
  var %num = 3
  :loop
  if (%num < 8) {
    %_color. [ $+ [ %num ] ] = $calc($line(@.display,%num))
    did -g $dname %num script\ $+ $calc($line(@.display,%num)) $+ .bmp
  }
  else did -a $dname %num $line(@.display,%num)
  if (%num < 22) { inc %num | goto loop }
  window -c @.display
  did -a $dname 23 %`horizline
  did -a $dname 24 %`popupmark
}
on *:DIALOG:display:sclick:101:{
  _cs-fin
  window -hl @.display
  loadbuf @.display $_cfg(display.dat)
  var %num = 3
  :loop
  if (%num < 8) rline @.display %num $_cprep(%_color. [ $+ [ %num ] ] )
  elseif ($did(%num)) rline @.display %num $did(%num)
  else rline @.display %num $cr
  if (%num < 22) { inc %num | goto loop }
  savebuf @.display $_cfg(display.dat)
  window -c @.display
  unset %_color.*
  _upd.markup
  `set horizline $did(23)
  `set popupmark $did(24)
}
on *:DIALOG:display:sclick:102:_cs-fin | unset %_color.*
on *:DIALOG:display:sclick:*:if ($did < 8) _cs-go 15 15 0
alias display _cs-prep | _dialog -am display display

;
; Text options
;
alias textopt _dialog -am textopt textopt
dialog textopt {
  title "Text Options"
  size -1 -1 346 305

  check "&Use P&&P text display: (enable to use any these options)", 1, 5 10 300 16

  text "Current text scheme:", 5, 117 38 250 20
  text "(scheme name)", 6, 117 54 250 20
  button "&Edit text scheme", 7, 15 40 90 25

  box "&Notices:", 8, 8 75 160 80

  radio "Normal", 9, 28 95 100 16, group
  radio "Notices window", 10, 28 113 100 16
  radio "Status window", 11, 28 131 100 16

  box "&Op Notices:", 12, 178 75 160 80

  radio "Normal", 13, 198 95 100 16, group
  radio "Notices window", 14, 198 113 100 16
  radio "Events window", 15, 198 131 100 16

  box "&Services Notices:", 16, 8 165 160 80

  radio "Normal", 17, 28 185 100 16, group
  radio "Notices window", 18, 28 203 100 16
  radio "Status window", 19, 28 221 100 16

  check "S&how op status alongside", 25, 178 165 300 16
  text "nicknames in channel text", 30, 196 183 300 16
  check "&Copy private messages to", 26, 178 201 300 16
  text "active window as well", 31, 196 219 300 16
  check "&Don't show quits in status", 24, 178 237 300 16

  button "OK", 101, 14 271 80 25, OK default
  button "Cancel", 102, 133 271 80 25, cancel
  button "He&lp", 103, 252 271 80 25, disable
}
on *:DIALOG:textopt:init:*:{
  if ($_cfgi(texts)) did -c $dname 1 | else _bulkdid -b $dname 5 25
  did -a $dname 6 $_texts.name
  did -c $dname $calc(9 + [ %`reg.notice ] )
  did -c $dname $calc(13 + [ %`op.notice ] )
  did -c $dname $calc(17 + [ %`serv.notice ] )
  if (%`hide.status.quit) did -c $dname 24
  if (%`themeop) did -c $dname 25
  if (%`copy.query) did -c $dname 26
}
on *:DIALOG:textopt:sclick:7:_juryrig textsch
on *:DIALOG:textopt:sclick:1:_bulkdid $iif($did(1).state,-e,-b) $dname 5 25
on *:DIALOG:textopt:sclick:101:{
  `set hide.status.quit $did(24).state
  `set themeop $did(25).state
  `set copy.query $did(26).state
  `set reg.notice $iif($did(9).state,0,$iif($did(10).state,1,2))
  `set op.notice $iif($did(13).state,0,$iif($did(14).state,1,2))
  `set serv.notice $iif($did(17).state,0,$iif($did(18).state,1,2))
  if ($did(1).state) { _cfgw texts 1 | .text on } | else { _cfgw texts 0 | .text off }
}

;
; Full theme support, central theme editor (edit/export/import)
;
dialog themes {
  title "P&P Theme Central"
  size -1 -1 345 315
  box "Theme editing:", 101, 5 5 335 134
  button "&Nicklist colors", 1, 15 25 155 22
  button "&Colors and symbols", 2, 15 52 155 22
  button "&Messages", 3, 15 79 155 22
  button "&Text display scheme", 4, 15 106 155 22
  button "&Font settings", 5, 175 25 155 22
  button "&Line separator", 6, 175 52 155 22
  button "&Event sounds", 7, 175 79 155 22
  box "mIRC features:", 102, 5 147 335 123
  text "* To modify mIRC colors, press Alt + K.", 103, 15 167 310 20
  text "* To select toolbar and switchbar bitmaps, right-click on them.", 104, 15 187 310 20
  text "* To select window backgrounds, use the system menu in the upper-left corner of the window. (make sure to also select 'default' to make a background the default, if you want P&&P to store it as part of a theme.)", 105, 15 207 310 55
  button "L&oad theme", 8, 15 282 100 25
  button "&Save theme", 9, 125 282 100 25
  button "Close", 10, 235 282 95 25, cancel
}
on *:DIALOG:themes:sclick:*:if ($did < 10) _juryrig $gettok(ncedit.display.msgs d.textsch.fontfix.line.sounds.theme load.theme save,$did,46)

;
; Sound scheme
;
dialog sounds {
  title "Sounds"
  size -1 -1 300 235
  text "Editing", 101, 5 9 34 20
  combo 1, 40 5 100 130, drop sort
  text "sounds:", 102, 142 9 40 20
  list 2, 5 30 290 110
  edit "", 3, 1 1 1 1, hide autohs
  text "", 4, 10 130 150 15
  text "", 5, 10 145 70 15
  text "", 6, 85 145 210 15
  button "&Select...", 11, 10 165 85 25, default
  button "&Preview", 12, 105 165 85 25
  button "&Clear", 13, 200 165 85 25
  button "&Done", 16, 10 200 85 25, OK
  button "C&opy", 14, 105 200 85 25
  button "P&aste", 15, 200 200 85 25
}
on *:DIALOG:sounds:init:*:{
  window -hl @.sounds
  filter -fw script\scheme.dat @.sounds -*
  var %num = 3 | :loop | if (- * iswm $line(@.sounds,%num)) { did -a $dname 1 $gettok($line(@.sounds,%num),2-,32) | inc %num | goto loop }
  window -c @.sounds
  did -c $dname 1 $_dlgi(sound) 1 | _sndsel
}
on *:DIALOG:sounds:sclick:1:_sndsel
alias -l _sndsel {
  did -r $dname 2,4,5,6 | did -b $dname 12,13,14
  var %file = $_cfg(display.dat),%get = $read -nts"- [ [ $did(1) ] $+ ] " script\scheme.dat,%num = $readn + 1
  did -o $dname 3 1 $readn
  :loop
  %get = $read -ntl [ $+ [ %num ] ] script\scheme.dat
  if (-* !iswm $gettok(%get,1,32)) {
    if ($read -ntl [ $+ [ %num ] ] %file != .) did -a $dname 2 $gettok(%get,2-,32) ( $+ $nopath($ifmatch) $+ )
    else did -a $dname 2 $gettok(%get,2-,32)
    inc %num | goto loop
  }
  _dlgw sound $did(1).sel
}
on *:DIALOG:sounds:sclick:2:{
  did -a $dname 4 $gettok($did(2,$did(2).sel).text,1,40)
  did -a $dname 5 Current sound:
  var %num = $calc($did(2).sel + $did(3))
  if ($read -ntl [ $+ [ %num ] ] $_cfg(display.dat) != .) { did -a $dname 6 $ifmatch | did -e $dname 12,13,14 }
  else { did -a $dname 6 (none) | did -b $dname 12,13,14 }
}
on *:DIALOG:sounds:sclick:14:if (($did(2).sel) && ($did(6) != (none))) clipboard $did(6)
on *:DIALOG:sounds:sclick:13:{
  if ($did(2).sel) {
    var %num = $calc($did(2).sel + $did(3))
    write -l [ $+ [ %num ] ] $_cfg(display.dat) .
    did -a $dname 6 (none)
    did -oc $dname 2 $did(2).sel $did(4)
    did -b $dname 12,13,14
    did -t $dname 13 | did -ft $dname 11
  }
}
on *:DIALOG:sounds:sclick:12:{
  var %file = $did(6)
  if ((%file) && (%file != (none))) {
    if ((\ isin %file) || (: isin %file)) .splay " $+ %file $+ "
    elseif ($findfile($mircdir,%file,1)) .splay " $+ $ifmatch $+ "
  }
}
on *:DIALOG:sounds:sclick:11:if ($did(2).sel) _juryrig _sndselc
on *:DIALOG:sounds:dclick:2:_juryrig _sndselc
on *:DIALOG:sounds:sclick:15:if ($did(2).sel) _sndselc $cb(1)
alias _sndselc {
  if ($1) var %new = $1-
  else {
    if ($_dlgi(sounddir)) var %dir = $ifmatch
    else var %dir = $wavedir
    var %new = $dir="Select sound for $did(sounds,4) $+ " %dir $+ *.wav
  }
  if ($exists(%new)) {
    _dlgw sounddir $nofile(%new)
    var %num = $did(sounds,2).sel + $did(sounds,3)
    write -l [ $+ [ %num ] ] $_cfg(display.dat) $_rel.fn(%new)
    did -a sounds 6 %new
    did -oc sounds 2 $did(sounds,2).sel $did(sounds,4) ( $+ $nopath(%new) $+ )
    did -e sounds 12,13
  }
  dialog -v sounds
}
alias sounds _dialog -am sounds sounds

;
; Messages
;
;;; $read'ing open for optimization
alias msgs {
  if ($window(@Messages)) clear @Messages
  else _window 2 -l $+ $iif($1,d) -t35 @Messages -1 -1 -1 -1 @Messages
  aline @Messages $:w() Double-click to edit a message
  aline @Messages $:w() Select one and right-click for defaults
  aline @Messages $:w() Select one and right-click to use random lines
  aline @Messages  
  var %group,%file = $_cfg(display.dat),%get = $read -s"-- message" script\scheme.dat,%num = $readn + 1 | :loop
  %group = $read -ntl [ $+ [ %num ] ] script\scheme.dat
  if (%group == -) aline @Messages  
  elseif ($gettok(%group,1,32) == -) aline @Messages $:w() $:b($gettok(%group,2-,32))
  elseif ($gettok(%group,1,32) == --) { window -b @Messages | return }
  else {
    %get = $read -ntl [ $+ [ %num ] ] %file
    if (!Random:* iswm %get) aline @Messages   $:s(×) $_p2s($gettok(%group,2,32)) -	 $+ $:b($gettok(%get,2-,58)) (random line)
    else aline @Messages   $:s(×) $_p2s($gettok(%group,2,32)) -	 $+ %get
  }
  inc %num | goto loop
}
menu @Messages {
  dclick:if (× !isin $gettok($line(@Messages,$1),3,32)) return | _msgdo $1
  $_msgprep:_msgdo $sline(@Messages,1).ln
  %.msg2:{
    var %new = $$dir="Select file for random messages" *.txt
    %new = $_rel.fn(%new)
    var %line = $read -s"-- message" script\scheme.dat,%base = $readn - 4
    %line = $sline(@Messages,1).ln
    rline @Messages %line $gettok($line(@Messages,%line),1,9) 	 $+  $+ %new $+  (random line)
    write -l [ $+ [ $calc(%line + %base) ] ] $_cfg(display.dat) !Random: $+ %new
    window -b @Messages
  }
  -
  %.msg8:_msgdef $sline(@Messages,1).ln
  -
  %.msg3:_msgdef $sline(@Messages,1).ln 3
  %.msg4:_msgdef $sline(@Messages,1).ln 4
  %.msg5:_msgdef $sline(@Messages,1).ln 5
  %.msg6:_msgdef $sline(@Messages,1).ln 6
  %.msg7:_msgdef $sline(@Messages,1).ln 7
}
alias -l _msgdo {
  var %old = $gettok($line(@Messages,$1),2-,9)
  if ((* (random line) iswm %old) || (%old ==  )) var %old
  var %ques = $gettok($gettok($line(@Messages,$1),1,45),4-,32) $+ ?,%new = $_entry(0,$_s2p(%old),%ques),%base = $read -s"-- message" script\scheme.dat
  %base = $readn - 4
  rline @Messages $1 $gettok($line(@Messages,$1),1,9) 	 $+ %new
  write -l [ $+ [ $calc($1 + %base) ] ] $_cfg(display.dat) %new
  window -b @Messages
}
alias -l _msgprep {
  unset %.msg?
  if (× !isin $gettok($sline(@Messages,1),3,32)) return
  set -u %.msg2 Random...
  var %base = $read -s"-- message" script\scheme.dat | %base = $readn - 4
  var %data = $read -tnl [ $+ [ $calc($sline(@Messages,1).ln + %base) ] ] script\scheme.dat
  if (%data) { var %num = 3 | :loop | if ($gettok(%data,%num,32)) { if ($chr(124) isin $ifmatch) set -u %.msg [ $+ [ %num ] ] $replace($_p2s($gettok($gettok(%data,%num,32),2,124)),&,&&) | else set -u %.msg [ $+ [ %num ] ] $replace($_p2s($gettok(%data,%num,32)),&,&&) | inc %num | goto loop } }
  if (* iswm $gettok(%data,2,32)) set -u %.msg8 (none or blank)
  return Modify...
}
alias -l _msgdef {
  var %base = $read -s"-- message" script\scheme.dat | %base = $readn - 4
  if ($2) {
    var %new = $read -tnl [ $+ [ $calc($1 + %base) ] ] script\scheme.dat
    %new = $_p2s($gettok($gettok(%new,$2,32),1,124))
  }
  else var %new =  
  write -l [ $+ [ $calc($1 + %base) ] ] $_cfg(display.dat) %new
  if (!Random:* iswm %new) rline @Messages $1 $gettok($line(@Messages,$1),1,9) 	 $+  $+ $gettok(%new,2-,58) $+  (random line) 
  else rline @Messages $1 $gettok($line(@Messages,$1),1,9) 	 $+ %new
  window -b @Messages
}

;
; Text display scheme dialog
;

dialog textsch {
  title "Text Display Scheme"
  size -1 -1 346 200
  box "Text scheme:", 2, 8 10 330 75
  text "Current:", 3, 17 29 40 20
  text "(scheme name)", 4, 58 29 250 20
  button "&Load scheme", 5, 15 50 90 25
  button "&Save scheme", 6, 122 50 90 25
  button "&Default mIRC text", 7, 229 50 100 25
  text "* To edit the text scheme (for advanced users only!) go into mIRC aliases and edit the file text.dat. You can then save your new scheme from here. (you must resave it if you make changes later that you want saved.)",  8, 17 95 300 55
  button "Done", 101, 75 165 90 25, OK default
  button "&Help", 103, 179 165 90 25, disable
}
on *:DIALOG:textsch:init:*:did -a $dname 4 $_texts.name
on *:DIALOG:textsch:sclick:5:_juryrig _txtload
alias _txtload var %file = $dir="Select a text scheme" $mircdirschemes\*.* | dialog -v textsch | if (%file) text %file
on *:DIALOG:textsch:sclick:6:_juryrig _txtsave
alias _txtsave var %file = $dir="Save text scheme" $mircdirschemes\ [ $+ [ $remove($_texts.name,$chr(32)) ] $+ .txs ] | dialog -v textsch | if (%file) text save %file
on *:DIALOG:textsch:sclick:7:text mirc
alias textsch _dialog -am textsch textsch

;
; Some sound schemes
;

on *:KICK:#:_ssplay $iif($knick == $me,youkick,anykick) | if ($knick == $me) { unset %-=*. $+ $chan | flash [kicked from $chan $+ ]] }
on *:OP:#:if ($opnick == $me) _ssplay youop
on *:VOICE:#:if ($vnick == $me) _ssplay youop
on *:SERVEROP:#:if ($opnick == $me) _ssplay youop
on *:DEOP:#:if ($opnick == $me) _ssplay youdeop
on *:DEVOICE:#:if ($vnick == $me) _ssplay youdeop
on *:DISCONNECT:_ssplay $iif(%-quitrequest,youquit,disconnect)
on *:CONNECT:_ssplay connect
on *:FILESENT:*:_ssplay senddone
on *:FILERCVD:*:_ssplay getdone
on *:SENDFAIL:*:_ssplay fileerror
on *:GETFAIL:*:_ssplay fileerror

;
; Events routing
;
alias route set %.chan $1 | _dialog -am evroute evroute
dialog evroute {
  title "Event routing"
  size -1 -1 346 223

  text "Event routing for:", 1, 5 10 100 16
  combo 9, 95 7 230 100, drop edit sort

  text "&Joins:", 2, 8 39 50 20
  text "&Parts:", 3, 8 59 50 20
  text "&Quits:", 4, 8 79 50 20
  text "&Kicks:", 5, 8 99 50 20
  text "&Modes:", 6, 8 119 50 20
  text "&Topics:", 7, 8 139 50 20
  text "&Nicks:", 8, 8 159 50 20

  radio "mIRC setting", 11, 60 38 80 16, group
  radio "Events window", 12, 145 38 100 16
  radio "Don't show", 13, 245 38 100 16

    radio "mIRC setting", 21, 60 58 80 16, group
  radio "Events window", 22, 145 58 100 16
  radio "Don't show", 23, 245 58 100 16

  radio "mIRC setting", 31, 60 78 80 16, group
  radio "Events window", 32, 145 78 100 16
  radio "Don't show", 33, 245 78 100 16

  radio "mIRC setting", 41, 60 98 80 16, group
  radio "Events window", 42, 145 98 100 16
  radio "Don't show", 43, 245 98 100 16

  radio "mIRC setting", 51, 60 118 80 16, group
  radio "Events window", 52, 145 118 100 16
  radio "Don't show", 53, 245 118 100 16

  radio "mIRC setting", 61, 60 138 80 16, group
  radio "Events window", 62, 145 138 100 16
  radio "Don't show", 63, 245 138 100 16

  radio "mIRC setting", 71, 60 158 80 16, group
  radio "Events window", 72, 145 158 100 16
  radio "Don't show", 73, 245 158 100 16

  button "&Close", 101, 14 189 80 25, cancel default
  button "&Reset", 102, 133 189 80 25
  button "&Help", 103, 252 189 80 25, disable
}
on *:DIALOG:evroute:*:9:_evswitchto
alias -l _evconv if ($_ischan($1-)) return . $+ $1 | return
alias -l _evswitchto {
  tokenize 32 $_evconv($did(9,$did(9).sel))
  var %num = 1
  :loop2
  var %value = %`event. [ $+ [ $remove($did($calc(%num + 1)),s,&,:) ] $+ [ $1 ] ]
  if (%value == $null) %value = %`event. [ $+ [ $remove($did($calc(%num + 1)),s,&,:) ] ]
  if (%value == hide) %value = 3 | else %value = $iif(%value,2,1)
  did -u $dname %num $+ 3, $+ %num $+ 2, $+ %num $+ 1
  did -c $dname %num $+ %value
  if (%num < 7) { inc %num | goto loop2 }
}
on *:DIALOG:evroute:init:*:{
  var %num = 1
  :loop1
  if ($chan(%num)) {
    did -a $dname 9 $ifmatch
    inc %num
    goto loop1
  }
  window -nlh @.evroute
  filter -fw $_cfg(cfgvar.dat) @.evroute event.*
  %num = $line(@.evroute,0)
  :loop2
  if (%num) {
    var %chan = $gettok($gettok($line(@.evroute,%num),3-,46),1,32)
    if (%chan) {
      _ddadd $dname 9 $ifmatch
      if (%chan == $active) %.chan = $active
    }
    dec %num
    goto loop2
  }
  window -c @.evroute
  did -ac $dname 9 (all channels)
  if ($_ischan(%.chan)) {
    if ($_finddid($dname,9,%.chan)) did -c $dname 9 $ifmatch
    else did -ac $dname 9 %.chan
  }
  unset %.chan
  _evswitchto
}
on *:DIALOG:evroute:sclick:102:{
  var %where = $_evconv($did(9)),%num = 1
  if (%where == $null) {
    :loop1
    `set event. $+ $remove($did($calc(%num + 1)),s,&,:) $false
    did -u $dname %num $+ 3
    did -u $dname %num $+ 2
    did -c $dname %num $+ 1
    if (%num < 7) { inc %num | goto loop1 }
  }
  else {
    :loop2
    var %name = $remove($did($calc(%num + 1)),s,&,:),%value = %`event. [ $+ [ %name ] ]
    `set event. $+ %name $+ %where
    if (%value == hide) %value = 3 | else %value = $iif(%value,2,1)
    did -u $dname %num $+ 3, $+ %num $+ 2, $+ %num $+ 1
    did -c $dname %num $+ %value
    if (%num < 7) { inc %num | goto loop2 }
  }
}
on *:DIALOG:evroute:sclick:*:{
  if ($did isnum 11-73) {
    var %where = $_evconv($did(9)),%value = $gettok($!false $true hide,$calc($did % 10),32),%name = $remove($did($int($calc($did / 10 + 1))),s,&,:)
    if ((%where != $null) && (%`event. [ $+ [ %name ] ] == %value)) var %value
    `set event. $+ %name $+ %where %value
  }
}