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