aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / questions.mrc

questions.mrc — 22.83 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * Questions
; *
; **********************************************************************/
;;
;
; $_parameter(parameters,required?,title,type,def editbox,text)
;
; 1 - parameters in command
; 2 - 1=required|0=not required
; 3 - title
; 4 - type [$_parameter.edit]
; 5 - default editbox
; 6 - text
;
;
alias _parameter {
  if ($_parameter.edit($4,0,$1)) {
    unset %c.dparm.*
    return $_parameter.return($4,$1)
  }
  var %i,%d
  while (1) {
    inc %i
    %d = parameter $+ %i
    if ($dialog(%d) == $null) { break }
  }
  if ($1 != $null) {
    %c.dparm.default = $ifmatch
    %c.dparm.invalid = $numtok($ifmatch,32)
  }
  else { %c.dparm.default = $5 }
  ;  %c.dparm.default = $replace(%c.dparm.default,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32))
  %c.dparm.need = $2
  if ($count($6-,<CRLF>) == 0) { %c.dparm.texto = $crlf $+ $replace($6-,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  else { %c.dparm.texto = $replace($6-,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  %c.dparm.cond = $4
  %c.dparm.title = $3
  if ($dialog(%d,$iif(%c.dparm.pass,parameterPASS,parameter),-4) != $null) { return $_parameter.return($4,$ifmatch) }
  unset %c.dparm.*
  if ($2) { halt }
}
alias _parameterpass {
  %c.dparm.pass = 1
  return $_parameter($1,$2,$3,$4,$5,$6)
}
alias _param { return $_parameter($null,1,$null,$1,$2,$3) }
alias _parampass { return $_parameterpass($null,1,$null,$1,$2,$3) }
alias _param1 { return $_parameter($null,0,$null,$1,$2,$3) }
alias _parampass1 { return $_parameterpass($null,0,$null,$1,$2,$3) }
alias _parameter.return {
  var %1 = $gettok($1,1,32),%2 = $gettok($1,2,32),%3 = $gettok($1,3,32)
  if (%1 == replace) { return $replace($_text($2-),$chr(%2),$chr(%3)) }
  if ($1 == fixchans) { return $_fixchans($_text($2-)) }
  if ($istok(ischan ismychan,$1,32)) && ($_not($_ischan($2-))) { return #$2 }
  return $2-
}
alias _parameter.edit {
  if ($3- == $null) {
    if ($2) { goto 1 }
    goto 0
  }
  elseif ($istok(normal,$1,32)) { goto 1 }
  elseif ($1 isnum) {
    if ($numtok($3-,32) == $1) { goto 1 }
    goto 0
  }
  elseif (alias:* iswm $gettok($1,1,32)) {
    var %alias = $gettok($gettok($1,1,32),2-,58)
    if ($isalias(%alias)) {
      _result2null
      %alias $3-
      if ($result) { goto 1 }
      goto 0
    }
    goto 1
  }
  else {
    var %alias = Þ $+ $gettok($1,1,32)
    if ($isalias(%alias)) {
      %_parm.edit = $1
      _result2null
      %alias $3-
      unset %_parm.edit
      if ($result) { goto 1 }
      goto 0
    }
    goto 1
  }
  :0
  if (param* iswm $dname) || (selec* iswm $dname) || (rparam* iswm $dname) {
    did -b $dname 241
    did -o $dname 249 2 0
    did -r $dname 200
  }
  else { return 0 }
  goto end
  :1
  if (param* iswm $dname) || (selec* iswm $dname) || (rparam* iswm $dname) {
    did -e $dname 241
    did -o $dname 249 2 1
    did -r $dname 200
  }
  else { return 1 }
  :end
  if ($devent != init) && (param* iswm $dname) { did -f $dname 2 }
}
alias Þisnum {
  var %2 = $gettok(%_parm.edit,2,32),%3 = $gettok(%_parm.edit,3,32)
  if ($1- !isnum) { return 0 }
  if (%_parm.edit == isnum) { return 1 }
  if (- isin %2) {
    if ($1- isnum %2) { return 1 }
    return 0
  }
  if ($1- %2 %3) { return 1 }
}
alias Þistok { if ($istok($gettok(%_parm.edit,2-,32),$1-,32)) { return 1 } }
alias Þnumserie { if ($remove($1-,$chr(44),-) isnum) { return 1 } }
alias Þismail { if ($_ismail($1-) != $null) { return 1 } }
alias Þisvalidfilename { if ($_isvalidfilename($1-) != $null) { return 1 } }
alias Þisvalidircnick { if ($_isvalidircnickname($1-)) { return 1 } }
alias Þischat { if ($chat($1-)) { return 1 } }
alias Þismask { if ($_ismask($1-)) { return 1 } }
alias Þismask2 { if ($_ismask2($1-)) { return 1 } }
alias Þisfullmask { if ($_isfullmask($1-)) { return 1 } }
alias Þisuser@host { if ($_ismask(nick! [ $+ [ $1- ] ] )) { return 1 } }
alias Þisuser@hostsc { if ($_isfullmask(nick! [ $+ [ $1- ] ] )) { return 1 } }
alias Þishost { if ($_ishost($1-)) { return 1 } }
alias Þisint { if ($_isint($1-)) { return 1 } }
alias Þisip { if ($_isip($1-)) { return 1 } }
alias Þischan { if ($0 == 1) && ($numtok($1-,44) == 1) { return 1 } }
alias Þismychan { if ($0 == 1) && (#$1 ischan) { return 1 } }
alias Þlen {
  var %2 = $gettok(%_parm.edit,2,32),%3 = $gettok(%_parm.edit,3,32)
  if ($len($1-) %2 %3) { return 1 }
}
alias Þlen1 {
  var %2 = $gettok(%_parm.edit,2,32),%3 = $gettok(%_parm.edit,3,32)
  if ($0 == 1) && ($len($1-) %2 %3) { return 1 }
}
alias Þreplace { return $1- }
alias Þfixchans { return $1- }


alias _parmchans {
  var %c,%1,%2
  if ($_ischan($7)) { %c = $_parameter($7,1,$1,$3,$null,$2) }
  elseif ($active ischan) { %c = # }
  else { %c = $_parameter($null,1,$1,$3,$null,$2) }
  if ($4) { %1 = $_parameter($8,1,$1,$5,$_activequery,$4) }
  if ($6) { %2 = $9 }
  return %c %1 %2
}
dialog parameter {
  size -1 -1 200 58
  option dbu

  text "",1,10 3 180 23
  edit "",2,10 24 180 11,autohs result

  text "",200,10 40 94 15

  button "&OK",241,114 40 33 15,ok disable
  button "&Cancel",242,157 40 33 15,cancel

  edit "",248,1 1 1 1,hide
  edit "",249,1 1 1 1,hide
  edit "",250,1 1 1 1,hide
}
dialog parameterPASS {
  size -1 -1 200 58
  option dbu

  text "",1,10 3 180 23
  edit "",2,10 24 180 11,autohs pass result

  text "",200,10 40 94 15

  button "&OK",241,114 40 33 15,ok disable
  button "&Cancel",242,157 40 33 15,cancel

  edit "",248,1 1 1 1,hide
  edit "",249,1 1 1 1,hide
  edit "",250,1 1 1 1,hide
}
ON *:DIALOG:parameter*:init:0:{
  _mdx.init $_icofile(question.ico)
  _mdx.SetFont $dname 1,2,200,241,242 + 13 400 Tahoma
  ^playthemesound QUESTION
  if (%c.dparm.title) { dialog -t $dname $ifmatch }
  else { dialog -t $dname aIRC $_vers }
  did -a $dname 1 %c.dparm.texto
  did -o $dname 250 1 %c.dparm.cond
  if (%c.dparm.default != $null) { did -o $dname 2 1 $ifmatch }
  did -o $dname 248 1 $iif(%c.dparm.need,0,1)
  if ($_parameter.edit($did(250),$did(248),$did(2))) { }
  if (%c.dparm.invalid) {
    did -o $dname 200 1 Invalid $_singoplur($ifmatch,parameter,parameters) $+ : %c.dparm.default
    ^playthemesound ERROR
  }
  unset %c.dparm.*
  did -c $dname 2 1 1 99999999999999999999
}
ON *:DIALOG:parameter*:edit:*:{ return $_parameter.edit($did(250),$did(248),$did(2)) }
ON *:DIALOG:parameter*:sclick:241:{
  if ($did($dname,248)) && ($did(2) == $null) { }
  elseif ($did($dname,249) == 0) {
    did -o $dname 200 1 Invalid $_singoplur($numtok($did(2),32),parameter,parameters)
    ^playthemesound ERROR
    halt
  }
  ^playthemesound OK
}
;
;;
;
; $_filexists(add?,title,file)
;
; 1 - 1= add? 0=overwrite and cancel only
; 2 - title
; 3 - file
;
alias _filexists {
  var %i,%d

  while (1) {
    inc %i
    %d = filexists $+ %i
    if ($dialog(%d) == $null) { break }
  }
  %c.filexists.cond = $1
  %c.filexists.title = $2
  %c.filexists.text = File exists: $+ $crlf $+ $3-
  %c.filexists.file = $3-
  if ($dialog(%d,filexists,-4) != $null) { return $ifmatch }
  halt
}
dialog filexists {
  size -1 -1 150 38
  option dbu

  text "",1,5 2 140 15,center

  button "&Overwrite",241,13 20 38 15,ok
  button "&Add",242,56 20 38 15
  button "&Cancel",243,99 20 38 15,cancel

  edit "1",248,1 1 1 1,hide result
  edit "",249,1 1 1 1,hide
  edit "",250,1 1 1 1,hide
}
ON *:DIALOG:filexists*:init:0:{
  _mdx.init $_icofile(question.ico)
  _mdx.SetFont $dname 1,241,242,243 + 13 400 Tahoma
  ^playthemesound QUESTION
  if (%c.filexists.title) { dialog -t $dname $ifmatch }
  else { dialog -t $dname aIRC $_vers }
  did -a $dname 1 %c.filexists.text
  did -o $dname 249 1 %c.filexists.file
  did -o $dname 250 1 %c.filexists.cond
  if (%c.filexists.cond) { did -ft $dname 242 }
  else {
    did -bft $dname 242
    did -ft $dname 241
  }
  unset %c.filexists.*
}
ON *:DIALOG:filexists*:sclick:241:{ ^playthemesound OK }
ON *:DIALOG:filexists*:sclick:242:{
  did -o $dname 248 1 0
  dialog -k $dname
}
;
;;
;
; $_onoff(param,required?,title,default,text)
;
; 1 - parameter given
; 2 - required?
; 3 - title
; 4 - 1=default no 0=default yes
; 5 - text
;
alias _onoff {
  if ($1 != $null) {
    if ($1) && ($1 != off) { return on }
    return off
  }
  %c.onfoff.yes = &On
  %c.onfoff.no = O&ff
  if ($_yesno($2,$3,$4,$5)) { return on }
  return off
}
;
;;
;
; $_yesno(required?,title,default,text)
;
; 1 - required?
; 2 - title
; 3 - 1=default no 0=default yes
; 4 - text
;
alias _yesno {
  unset %c.dyesno.*
  %c.dyesno.yes = %c.onfoff.yes
  %c.dyesno.no = %c.onfoff.no
  unset %c.onfoff.*
  if (%c.dyesno.yes == $null) { %c.dyesno.yes = &Yes }
  if (%c.dyesno.no == $null) { %c.dyesno.no = &No }
  var %i,%d
  while (1) {
    inc %i
    %d = yesno $+ %i
    if ($dialog(%d) == $null) { break }
  }
  if ($count($4-,<CRLF>) == 0) { %c.dyesno.text = $crlf $+ $_evaltext($4-) }
  else { %c.dyesno.text = $_evaltext($4-) }
  %c.dyesno.title = $2
  if ($3) { inc %c.dyesno.def }
  if ($dialog(%d,yesno,-4) != $null) { return $ifmatch }
  unset %c.dyesno.*
  if ($1) { halt }
}
dialog yesno {
  size -1 -1 202 42
  option dbu

  text "",1,5 2 190 23,center

  button %c.dyesno.yes,241,46 24 33 15,ok
  button %c.dyesno.no,242,83 24 33 15
  button "&Cancel",243,122 24 33 15,cancel

  edit "1",248,1 1 1 1,hide result
}
ON *:DIALOG:yesno*:init:0:{
  _mdx.init $_icofile(question.ico)
  _mdx.SetFont $dname 1,241,242,243 + 13 400 Tahoma
  if (%c.dyesno.title != $null) { dialog -t $dname $ifmatch }
  else { dialog -t $dname aIRC $_vers }
  if (%c.dyesno.text != $null) { did -o $dname 1 1 $ifmatch }
  if (%c.dyesno.def) { did -f $dname 242 }
  else { did -f $dname 241 }
  unset %c.dyesno.*
}
ON *:DIALOG:yesno*:sclick:241:{ ^playthemesound OK }
ON *:DIALOG:yesno*:sclick:242:{
  did -o $dname 248 1 0
  dialog -k $dname
}
ON *:DIALOG:yesno*:sclick:243:{ ^playthemesound CANCEL }
;
;;
;
; $_select(parameters,required?,title,type,def editbox,token,tokens|@win,text)
;
; 1 - parameters in command
; 2 - 1=required|0=not required
; 3 - title
; 4 - type [$_parameter.edit]
; 5 - default editbox
; 6 - token
; 7 - tokens
; 8 - text
;
;
alias _select {
  var %i,%d
  if ($_parameter.edit($4,0,$1)) {
    unset %c.dselect.*
    return $_parameter.return($4,$1)
  }
  while (1) {
    inc %i
    %d = SELECT $+ %i
    if ($dialog(%d) == $null) { break }
  }
  if ($1 != $null) {
    %c.dselect.default = $ifmatch
    %c.dselect.invalid = $numtok($ifmatch,32)
  }
  else { %c.dselect.default = $5 }
  %c.dselect.need = $2
  if ($count($8,<CRLF>) == 0) { %c.dselect.text = $crlf $+ $replace($8,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  else { %c.dselect.text = $replace($8,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  %c.dselect.title = $3
  %c.dselect.cond = $4
  %c.dselect.token = $6
  %c.dselect.tokens = $7
  if ($dialog(%d,SELECT,-4) != $null) { return $_parameter.return($4,$ifmatch) }
  unset %c.dselect.*
  if ($2) { halt }
}
alias _selectedit {
  %c.dselect.edit = 1
  return $_select($1,$2,$3,$4,$5,$6,$7,$8)
}

dialog SELECT {
  size -1 -1 102 122
  option dbu

  edit "",248,1 1 1 1,hide result
  edit "",249,1 1 1 1,hide result
  edit "",250,1 1 1 1,hide result

  text "",1,2 2 95 23
  edit "",2,1 1 1 1,hide result

  list 100,2 25 95 70,hide sort
  combo 101,2 25 95 70,hide sort

  text "",200,2 95 95 8,center

  button "&OK",241,15 105 33 15,ok
  button "&Cancel",243,53 105 33 15,cancel

  edit "100",247,1 1 1 1,hide
}
ON *:DIALOG:SELECT*:init:0:{
  _mdx.init $_icofile(question.ico)
  _mdx.SetFont $dname 1,100,101,241,243 + 13 400 Tahoma
  did -o $dname 249 1 1
  if (%c.dselect.title != $null) { dialog -t $dname $ifmatch }
  else { dialog -t $dname aIRC $_vers }
  if (%c.dselect.edit) { did -o $dname 247 1 101 }
  did -fv $dname $did(247)
  did -o $dname 250 1 %c.dselect.cond
  if (-* iswm %c.dselect.token) {
    if (w isin %c.dselect.token) && ($window(%c.dselect.tokens)) {
      filter -wo %c.dselect.tokens $dname $did(247) *
      if (c isin %c.dselect.token) { close -@ %c.dselect.tokens }
    }
  }
  elseif (%c.dselect.token isnum) && (%c.dselect.tokens != $null) {
    var %t,%i = 1,%n = $numtok(%c.dselect.tokens,%c.dselect.token)
    while (%i <= %n) {
      %t = $gettok(%c.dselect.tokens,%i,%c.dselect.token)
      if (%t == %c.dselect.default) {
        did -ack $dname $did(247) %t
        did -o $dname 2 1 %t
      }
      else { did -a $dname $did(247) %t }
      inc %i
    }
  }
  if (%c.dselect.text != $null) { did -o $dname 1 1 $ifmatch }
  did -o $dname 248 1 $iif(%c.dselect.need,0,1)
  if ($_parameter.edit($did(250),$did(248),$did(2))) { }
  if (%c.dselect.invalid) {
    did -o $dname 200 1 Invalid $_singoplur($ifmatch,parameter,parameters) $+ : %c.dselect.default
    ^playthemesound ERROR
  }
  unset %c.dselect.*
}
ON *:DIALOG:SELECT*:edit:101:{
  did -o $dname 2 1 $did(101)
  if ($_parameter.edit($did(250),$did(248),$did(2))) { }
}
ON *:DIALOG:SELECT*:sclick:241:{
  if ($did($dname,248)) && ($did(2) == $null) { }
  elseif ($did($dname,249) == 0) {
    did -o $dname 200 1 Invalid $_singoplur($numtok($did(2),32),parameter,parameters)
    ^playthemesound ERROR
    halt
  }
  ^playthemesound OK
}
ON *:DIALOG:SELECT*:sclick:*:{
  if ($did == $did(247)) {
    did -o $dname 2 1 $did($ifmatch,$did($ifmatch).sel)
    if ($_parameter.edit($did(250),$did(248),$did(2))) { }
  }
}
alias _addyparam {
  var %addy = $1,%result,%win = @__addyparam,%i = 0,%file = $"($_tmpfile),%mask,%nick
  if ($_not($_ismask(%addy))) && ($_address(%addy) != $null) { %addy = $ifmatch }
  %addy = $_fixmask(%addy)
  write -c %file
  while (%i <= 19) {
    %mask = $_mask(%addy,%i)
    write -s $+ %mask %file %mask
    inc %i
  }
  %nick = $gettok(%addy,1,33)
  if (? !isin %nick) && (* !isin %nick) {
    %mask = %nick $+ !*@*
    write -s $+ %mask %file %mask
  }
  _openwins %win
  loadbuf %win %file
  %result = $_rparameter($2,$3,$4,$5,$6,%win,$7,$8)
  close -@ %win
  if (%result != $null) { return $ifmatch }
}
;;
;
; $_rparameter(parameters,required?,title,type,def editbox,[@]list,channel,text)
;
; 1 - parameters in command
; 2 - 1=required|0=not required
; 3 - title
; 4 - type [$_parameter.edit]
; 5 - default editbox
; 6 - [@]list
; 7 - channel
; 8 - text
;
alias _rparameter {
  if ($_parameter.edit($4,0,$1)) {
    unset %c.drparm.*
    return $_parameter.return($4,$1)
  }
  var %i,%d
  while (1) {
    inc %i
    %d = rparameter $+ %i
    if ($dialog(%d) == $null) { break }
  }
  if ($1 != $null) {
    %c.drparm.default = $ifmatch
    %c.drparm.invalid = $numtok($ifmatch,32)
  }
  else { %c.drparm.default = $5 }
  ;  %c.drparm.default = $replace(%c.drparm.default,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32))
  %c.drparm.need = $2
  if ($count($8-,<CRLF>) == 0) { %c.drparm.texto = $crlf $+ $replace($8-,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  else { %c.drparm.texto = $replace($8-,<CRLF>,$crlf,<COMMA>,$chr(44),<ESP>,$chr(32)) }
  %c.drparm.cond = $4
  %c.drparm.title = $3
  %c.drparm.list = $6
  %c.drparm.chan = $7
  if ($dialog(%d,rparameter,-4) != $null) { return $_parameter.return($4,$ifmatch) }
  unset %c.drparm.*
  if ($2) { halt }
}
alias _rparam { return $_rparameter($null,1,$null,$1,$2,$3,$4,$5) }
dialog rparameter {
  size -1 -1 200 58
  option dbu

  text "",1,10 3 180 23
  combo 2,10 27 180 100,drop edit result

  text "",200,10 40 75 15

  button "&Clear list",240,87 40 33 15
  button "&OK",241,122 40 33 15,ok disable
  button "&Cancel",242,157 40 33 15,cancel

  edit "",247,1 1 1 1,hide
  edit "",248,1 1 1 1,hide
  edit "",249,1 1 1 1,hide
  edit "",250,1 1 1 1,hide
}
ON *:DIALOG:rparameter*:init:0:{
  _mdx.init $_icofile(question.ico)
  _mdx.SetFont $dname 1,2,240,241,242 + 13 400 Tahoma
  var %file,%winfrom = @__rparameter,%i,%n
  ^playthemesound QUESTION
  if (%c.drparm.title) { dialog -t $dname $ifmatch }
  else { dialog -t $dname aIRC $_vers }
  did -a $dname 1 %c.drparm.texto
  did -o $dname 250 1 %c.drparm.cond
  _openwins %winfrom
  if (@* iswm %c.drparm.list) {
    if ($window(%c.drparm.list)) { filter -ww %c.drparm.list %winfrom * }
  }
  else {
    %file = $_recent.file(%c.drparm.list)
    if ($isfile(%file)) {
      loadbuf %winfrom $"(%file)
      did -o $dname 247 1 %file
    }
  }

  if (%c.drparm.chan == $null) && (%c.drparm.default == $null) { _win2dialog %winfrom $dname 2 * }
  else {
    var %i = 1,%n = $line(%winfrom,0)
    while (%i <= %n) {
      if (%c.drparm.chan != $null) {
        if ($replace($line(%winfrom,%i),<CHAN>,%c.drparm.chan) != %c.drparm.default) { did -a $dname 2 $ifmatch }
      }
      else {
        if ($line(%winfrom,%i) != %c.drparm.default) { did -a $dname 2 $ifmatch }
      }
      inc %i
    }
  }
  close -@ %winfrom

  if (%c.drparm.default != $null) { did -i $dname 2 1 $ifmatch }
  did -o $dname 248 1 $iif(%c.drparm.need,0,1)
  if ($_parameter.edit($did(250),$did(248),$did(2,1))) { }
  if (%c.drparm.invalid) {
    did -o $dname 200 1 Invalid $_singoplur($ifmatch,parameter,parameters) $+ : %c.drparm.default
    ^playthemesound ERROR
  }
  unset %c.drparm.*
  did -c $dname 2 1 1 99999999999999999999
}
ON *:DIALOG:rparameter*:*:2:{
  return $_parameter.edit($did(250),$did(248),$did(2))
}
ON *:DIALOG:rparameter*:sclick:240:{
  var %file = $did($dname,247,1)
  if (%file != $null) && (@* !iswm %file) {
    if ($_isfile(%file)) { _remove $ifmatch }
  }
}
ON *:DIALOG:rparameter*:sclick:241:{
  if ($did($dname,248)) && ($did(2) == $null) { }
  elseif ($did($dname,249) == 0) {
    did -o $dname 200 1 Invalid $_singoplur($numtok($did(2),32),parameter,parameters)
    ^playthemesound ERROR
    halt
  }
  ^playthemesound OK
}
;;
;
; $_pickcol(can be none ?,button caption,title)
;
alias _pickcol {
  var %dir = $mircdir $+ etc\bmps\,%x,%y,%w,%h,%none = 0,%button = none,%title = Pick Colour,%maxx,%maxy
  %pickcol.00 = $findfile(%dir,mircol00_*.bmp,1,1)
  %pickcol.01 = $findfile(%dir,mircol01_*.bmp,1,1)
  %pickcol.02 = $findfile(%dir,mircol02_*.bmp,1,1)
  %pickcol.03 = $findfile(%dir,mircol03_*.bmp,1,1)
  %pickcol.04 = $findfile(%dir,mircol04_*.bmp,1,1)
  %pickcol.05 = $findfile(%dir,mircol05_*.bmp,1,1)
  %pickcol.06 = $findfile(%dir,mircol06_*.bmp,1,1)
  %pickcol.07 = $findfile(%dir,mircol07_*.bmp,1,1)
  %pickcol.08 = $findfile(%dir,mircol08_*.bmp,1,1)
  %pickcol.09 = $findfile(%dir,mircol09_*.bmp,1,1)
  %pickcol.10 = $findfile(%dir,mircol10_*.bmp,1,1)
  %pickcol.11 = $findfile(%dir,mircol11_*.bmp,1,1)
  %pickcol.12 = $findfile(%dir,mircol12_*.bmp,1,1)
  %pickcol.13 = $findfile(%dir,mircol13_*.bmp,1,1)
  %pickcol.14 = $findfile(%dir,mircol14_*.bmp,1,1)
  %pickcol.15 = $findfile(%dir,mircol15_*.bmp,1,1)
  %pickcol.16 = $findfile(%dir,mircol16_*.bmp,1,1)
  %w = 71
  %h = 16
  if ($1) { var %h = 25,%none = 1 }
  %maxx = $round($calc(($window(-1).w - (%w * $dbuw)) - 10),0)
  %maxy = $round($calc(($window(-1).h - (%h * $dbuh)) - 35),0)
  %x = $mouse.dx
  %y = $mouse.dy
  if (%x > %maxx) { %x = %maxx }
  if (%y > %maxy) { %y = %maxy }
  if ($2 != $null) { %button = $ifmatch }
  if ($3 != $null) { %title = $ifmatch }
  %pickcol.button = %button
  %pickcol.title = %title
  %pickcol.xy = %x %y
  %pickcol.wh = %w %h
  %pickcol.none = %none
  return $dialog(_pickcol,_pickcol,-4)
}
dialog _pickcol {
  size %pickcol.xy %pickcol.wh
  option dbu
  title %pickcol.title

  icon 1000,0 0 8 8, %pickcol.00
  icon 1001,9 0 8 8,%pickcol.01
  icon 1002,18 0 8 8, %pickcol.02
  icon 1003,27 0 8 8,%pickcol.03
  icon 1004,36 0 8 8, %pickcol.04
  icon 1005,45 0 8 8,%pickcol.05
  icon 1006,54 0 8 8, %pickcol.06
  icon 1007,63 0 8 8,%pickcol.07

  icon 1008,0 9 8 8, %pickcol.08
  icon 1009,9 9 8 8,%pickcol.09
  icon 1010,18 9 8 8, %pickcol.10
  icon 1011,27 9 8 8,%pickcol.11
  icon 1012,36 9 8 8, %pickcol.12
  icon 1013,45 9 8 8,%pickcol.13
  icon 1014,54 9 8 8, %pickcol.14
  icon 1015,63 9 8 8,%pickcol.15

  button %pickcol.button,1016,0 19 71 8

  button "ok",2990,1000 1000 1 1,ok
  button "cancel",2991,1000 1000 1 1,cancel
  edit "",2992,1000 1000 1 1,autohs hide result
}
ON *:DIALOG:_pickcol:init:0:{
  _mdx.init - title tool sysmenu
  _mdx.SetFont $dname 1016 + 13 400 Tahoma
  did $iif(%pickcol.none,-v,-h) $dname 1016
  did -f $dname 2991
  unset %pickcol.*
}
ON *:DIALOG:_pickcol:sclick:*:{
  if (10?? iswm $did) {
    did -o $dname 2992 1 $right($did,2)
    dialog -k $dname
  }
}
alias _refreshcolorbmps {
  var %i = 0,%z,%rgb,%dir = $mircdir $+ etc\bmps\,%file,%m,%win = @__refreshcolorbmps,%wh = $calc($dbuw * 8) $calc($dbuh * 8)
  while (%i <= 16) {
    %z = %i
    if (%i < 10) { %z = 0 $+ %i }
    %rgb = $_mircol2rgbnum(%z)
    %m = mircol $+ %z $+ _*.bmp
    %file = %dir $+ mircol $+ %z $+ _ $+ %rgb $+ .bmp
    if ($findfile(%dir,%m,0,1) != 1) || ($findfile(%dir,%m,1,1) != %file) {
      _dummy $findfile(%dir,%m,0,1,_remove $1-)
      close -@ %win
      window -hpk +d %win 0 0 %wh
      drawrect -fr %win %rgb 10 0 0 %wh
      drawsave %win " $+ %file $+ "
    }
    inc %i
  }
  close -@ %win
}


;;;;

dialog _quickinfoerrwarndlg {
  size -1 -1 110 42
  option dbu

  icon 1001,5 5 20 20
  text "",1002,26 2 80 23,center

  button "&Close",2990,48 24 33 15,cancel
}
alias -l _quickinfoerrwarndlg.icon {
  var %ico = $1-
  _mdx.init %ico
  did -g $dname 1001 %ico
  _mdx.SetFont $dname 1002,2990 + 13 400 Tahoma

}
;
;;
;
; $_infodlg(title,text)
;
; 1 - title
; 2 - text
;
alias _infodlg {
  var %i,%d = infodlg,%title = $1,%text = $2-
  if ($count(%text,<CRLF>) == 0) { %text = $crlf $+ $_evaltext(%text) }
  else { %text = $_evaltext(%text) }
  _dialog -am %d _quickinfoerrwarndlg
  if (%title != $null) { dialog -t %d $ifmatch }
  else { dialog -t %d aIRC $_vers }
  if (%text != $null) { did -o %d 1002 1 $ifmatch }
}
ON *:DIALOG:infodlg*:init:0:{ _quickinfoerrwarndlg.icon $_icofile(info.ico) }
;
;;
;
; $_errdlg(title,text)
;
; 1 - title
; 2 - text
;
alias _errdlg {
  var %i,%d = errdlg,%title = $1,%text = $2-
  if ($count(%text,<CRLF>) == 0) { %text = $crlf $+ $_evaltext(%text) }
  else { %text = $_evaltext(%text) }
  _dialog -am %d _quickinfoerrwarndlg
  if (%title != $null) { dialog -t %d $ifmatch }
  else { dialog -t %d aIRC $_vers }
  if (%text != $null) { did -o %d 1002 1 $ifmatch }
}
ON *:DIALOG:errdlg*:init:0:{ _quickinfoerrwarndlg.icon $_icofile(stop.ico) }
;
;;
;
; $_warndlg(title,text)
;
; 1 - title
; 2 - text
;
alias _warndlg {
  var %i,%d = warndlg,%title = $1,%text = $2-
  if ($count(%text,<CRLF>) == 0) { %text = $crlf $+ $_evaltext(%text) }
  else { %text = $_evaltext(%text) }
  _dialog -am %d _quickinfoerrwarndlg
  if (%title != $null) { dialog -t %d $ifmatch }
  else { dialog -t %d aIRC $_vers }
  if (%text != $null) { did -o %d 1002 1 $ifmatch }
}
ON *:DIALOG:warndlg*:init:0:{ _quickinfoerrwarndlg.icon $_icofile(warning.ico) }