aIRC — File Browser

aIRCv0.8.69 / aIRCv0.8.69 / script / progress.mrc

progress.mrc — 1.58 KB — Download this file

;/**********************************************************************
; *
; * aIRC
; * Progress meter
; *
; **********************************************************************/
alias _progress.init {
  .timerCLOSEDIALOG_aIRCprogress off
  var %d = _aIRCprogress
  set -u %~progress.xy 5 $calc($window(-1).h - 80 - 32 * $dbuh)
  if ($dialog(%d)) { dialog -v %d }
  else { dialog -dmo %d %d }
  dialog -t %d $1-
  did -o %d 1004 1 $ticks
  did -a %d 1001 0 1 100
}
alias _progress {
  var %d = _aIRCprogress
  if ($dialog(%d) == $null) || ($1 !isnum) || ($1 < 0) { return }
  var %n = $round($1,0),%time
  if (%n > 100) { %n = 100 }
  did -a %d 1001 %n
  if ($2- != $null) { did -o %d 1002 1 $ifmatch }
  if (%n == 100) {
    did -o %d 1003 1 Completed in $round($calc(($ticks - $did(%d,1004,1)) / 1000),2) $+ s
    .timerCLOSEDIALOG_aIRCprogress -mo 1 750 dialog -x %d
  }
  elseif ($calc((100 - $1) * ($ticks - $did(%d,1004,1)) / ($1 * 1000)) isnum) { did -o %d 1003 1 %n $+ % - Left: $round($ifmatch,2) $+ s }
}
alias _progress2 {
  if ($1 isnum) && ($2 isnum) && ($2 != 0) { _progress $calc(($1 / $2) * 100) $3- }
}
dialog _aIRCprogress {
  size %~progress.xy 160 32
  option dbu
  title ""

  text "",1001,5 5 150 10
  text "",1002,5 18 150 8,center
  text "",1003,5 26 150 10,center
  list 1004,5 26 150 10,hide

  button "Close",2990,260 145 30 12,cancel
}
ON *:DIALOG:_aIRCprogress:init:0:{
  _mdx.init - title tool sysmenu windowedge
  var %9+0 = $chr(9) $+ +l 0,%9r0 = $chr(9) $+ +r 0
  _mdx.SetControlMDX ctl_gen.mdx $dname 1001 ProgressBar smooth
}