;-=-=-=-=-=-
; DeadLy Script - ACTIONS
;-=-=-=-=-=-
alias ac return @actions
alias actions {
  window -Ckpal10 +fbn $ac -1 -1 370 170 $icons(exe)
  drawrect -fr $ac $gettok(%xrgb,1,44) 1 0 0 550 350
  drawsc $ac 24 5 5 actions
  drawbut $ac 240 100 45 18 add
  drawbut $ac 240 120 45 18 del
  drawbut $ac 100 120 80 20 OK
  drawedit $ac 10 50 220 60 
  titlebar $ac - Commands/Actions - $sc
  dline -l $ac 1-999
  var %ts 1 | while $hget(actions,%ts).item != $null { aline -l $ac / $+ $hget(actions,%ts).item | inc %ts 1 }
}
menu @actions {
  sclick: {
    if ($inrect($mouse.x,$mouse.y,240,100,45,18) = $true) { 
      drawbutx $ac 240 100 45 18 add
      s.key
      var %aa $$?="commands ?" 
      var %ab $$?="excute ?" 
      if %aa = $null && %ab = $null halt
      aline -l $ac / $+ %aa
      hadd -m actions %aa %ab
      drawedit $ac 10 50 220 60
      drawtext -c $ac 0 arial 11 15 55 210 50 $sline($ac,1) <text>
      drawtext -pc $ac 0 arial 11 15 75 210 18 $_a $+ * $me $hget(actions,$remove($sline($ac,1),/)) <text>
    }
    if ($inrect($mouse.x,$mouse.y,240,120,45,18) = $true) { drawbutx $ac 240 120 45 18 del | hdel actions $remove($$sline($ac,1),/) | dline -l $ac $sline($ac,1).ln | s.key }
    if ($inrect($mouse.x,$mouse.y,100,120,80,20) = $true) { window -c $ac | s.exit | unloads actions }
  }
  lbclick: { drawedit $ac 10 50 220 60
    drawtext -c $ac 0 arial 11 15 55 210 50 $sline($ac,1.1) <text>
    drawtext -pc $ac 0 arial 11 15 75 210 18 $_a $+ * $me $hget(actions,$remove($sline($ac,1.1),/)) <text>
  }
  dclick: { s.key
    var %as $$?=" $$sline($ac,1) will replace what commands ?" 
    var %ad $$?="excute ?" 
    var %sl $sline($ac,1).ln
    if %as = $null && %ad = $null halt
    hdel actions $remove($sline($ac,1),/) | dline -l $ac $sline($ac,1).ln
    aline -l $ac / $+ %as
    sline -l $ac %sl
    hadd -m actions %as %ad
    drawedit $ac 10 50 220 60
    drawtext -c $ac 0 arial 11 15 55 210 50 $sline($ac,1) <text>
    drawtext -pc $ac 0 arial 11 15 75 210 18 $_a $+ * $me $hget(actions,$remove($sline($ac,1),/)) <text>
  }
}
on *:CLOSE:@actions: { unloads actions }
on *:EXIT: unloads autoid
;-=-=-=-=-=-
;-=-=-=-=-=-
