All pastes #640639 Raw Edit

Miscellany

public text v1 · immutable
#640639 ·published 2007-07-31 15:20 UTC
rendered paste body
menu @AsciiList {
  mouse:{
    var %mx = $mouse.x, %my = $mouse.y, %w = @AsciiList
    :rh
    if ($inrect(%mx,%my,20,20,300,765)) {
      var %c = $calc((%mx -20) /60), %c2 = $iif($calc(%c -$int(%c)) >= .66,1), %c = $int(%c), $&
        %r = $calc((%my -20) /15), %r2 = $iif($calc(%r - $int(%r)) >= .5,1), %r = $int(%r), $&
        %1 = $iif(%c2 && !%r2,1,0), %2 = $iif(%c2 && %r2,1,0)
      tokenize 32 %al_hl
      if ($1-2 != %c %r) || (($1-2 == %c %r) && ((($+($3,$4)) && (!%c2)) || ((!$+($3,$4)) && (%c2)) || (($+($3,$4)) && ($3-4 != %1 %2)))) {
        ;echo -s $3-4 :: %1 %2
        ; /drawbutton [-rpbomdafstN] @ x y w h face-color [bg-color] [hilight-color shadow-color] [outline-color] [marginx marginy] [[w h] [N] filename] [text-color fontname fontsize text]
        drawbutton -rts %w $calc(%c *60+58) $calc(%r *15+21) 20 6 $iif(%1,16765349,15790320) 16777215 10526880 $iif(%1,16777215,0) tahoma 9 n
        drawbutton -rts %w $calc(%c *60+58) $calc(%r *15+27) 20 6 $iif(%2,16765349,15790320) 16777215 10526880 $iif(%2,16777215,0) tahoma 9 c
        if ($gettok(%al_hl,1-2,32) != %c %r) drawrect -rf %w 16777215 1 $calc($gettok($v1,1,32) *60+58) $calc($gettok($v1,2,32) *15+21) 21 13
        %al_hl = %c %r %1 %2
      }
    }
    elseif (%al_hl) {
      drawrect -rf %w 16777215 1 $calc($gettok($v1,1,32) *60+58) $calc($gettok($v1,2,32) *15+21) 21 13
      unset %al_hl
    }
  }
  sclick:{
    var %w = @AsciiList
    tokenize 32 %al_hl
    if ($+($3,$4)) {
      drawbutton -rto %w $calc($1 *60+58) $calc($2 *15+$replacex($v1,10,21,01,27)) 20 6 255 0 16777215 tahoma 9 $replacex($v1,10,n,01,c)
      %al_hl = $1- 1
    }
  }
  uclick:{
    var %mx = $mouse.x, %my = $mouse.y, %w = @AsciiList
    tokenize 32 %al_hl
    var %x = $calc($1 *60+58), %y = $calc($2 *15+$replacex($v1,10,21,01,27)), %n = $calc(($1 +1)*($2 +1))
    if ($5) {
      .clipboard $replacex($3 $+ $4,10,%n,01,$chr(%n))
      if ($inrect(%mx,%my,20,20,300,765)) goto rh
    }
  }
}