home *** CD-ROM | disk | FTP | other *** search
/ Shareware Overload / ShartewareOverload.cdr / wp / bmacs.zip / BOX.M < prev    next >
Text File  |  1989-01-01  |  5KB  |  120 lines

  1. ;************
  2. ;**
  3. ;**     box.m
  4. ;**     =====
  5. ;**
  6. ;**     Create a temporary keyboard assignment to the NumLock keys
  7. ;**     for drawing boxes.  See notes, below.
  8. ;**
  9. ;** Revision history:
  10. ;**     7-22-86, 10:08 pm -- Created.  Still in testing.  ATC.
  11. ;**     7-23-86, 04:19 pm -- Completed, debugged, documented.  ATC.
  12. ;**
  13. ;** NOTES:
  14. ;**     This macro applies the (use_local_keyboard) primitive to create a
  15. ;**     set of key assignments overlaying the current keymap.
  16. ;**
  17. ;**     When using (keyboard_push) and (keyboard_pop), remember that the
  18. ;**     current keymap IS the top of the keymap stack!
  19. ;**
  20. ;**     Both push and pop work 2 ways, but not very orthogonally:
  21. ;**
  22. ;**     (keyboard_push)     pushes active keymap down, creating a new current
  23. ;**                         map at top of stack, which has NO KEYS assigned.
  24. ;**
  25. ;**     (keyboard_push #)   pushes active keymap down, installing keymap #
  26. ;**                         at top of stack, which has been previously stored
  27. ;**                         with a (keyboard_pop 1).  <#> was the return 
  28. ;**                         value of (inq_keyboard) long ago before that map
  29. ;**                         was popped into storage.
  30. ;**
  31. ;**     (keyboard_pop)      pops the active keymap into oblivion, pulling up
  32. ;**                         whatever map was previously pushed.  If no map
  33. ;**                         had been pushed, you have a non-existent keymap,
  34. ;**                         and must now reboot the computer, or use the
  35. ;**                         (keyboard_push #) operation to set up a map.
  36. ;**     
  37. ;**     (keyboard_pop 1)    pops the active keymap into storage somewhere,
  38. ;**                         pulling up whatever map was previously pushed.
  39. ;**                         If no map had been pushed, reboot, or immediately
  40. ;**                         do a (keyboard_push #) to install some previously
  41. ;**                         saved map.
  42. ;**         
  43. ;**     In addition, a special function is provided for creating temporary
  44. ;**     key assignments that "overlay" the rest of the current keymap.
  45. ;**
  46. ;**     (use_local_keyboard #)  establishes a previously saved map as an
  47. ;**                         overlay on the current map.  The stack is not
  48. ;**                         involved.  Any keymap may be set up with this,
  49. ;**                         and unassigned keys will appear as HOLES, through
  50. ;**                         which the current map will show.  This local
  51. ;**                         map is local to the current buffer, and will have
  52. ;**                         no effect on the current map in any other buffer.
  53. ;**
  54. ;**     (use_local_keyboard 0)  disables any current local overlay keymap,
  55. ;**                         restoring function to all the current map's
  56. ;**                         assignments. Local maps in effect in other buffers
  57. ;**                         are not disabled: only the current buffer's over-
  58. ;**                         lay map.
  59. ;**
  60. ;****************************************************************************
  61.  
  62. (macro box (
  63.     (if (first_time)
  64.         (
  65.             (int    box_map)    ; id of overlay map created below.
  66.             (global box_map)    ; make int accessible from "unbox".
  67.  
  68.             (keyboard_push) ; Push a new, empty map onto stack.  This pushes
  69.                             ; down old map, leaving empty map on top of stack,
  70.                             ; and therefore active (but as yet useless).
  71.  
  72.             (assign_to_key "#18231" "top_left")     ; Assign only the 
  73.             (assign_to_key "#18488" "top_but")      ;   DIFFERENCES, leaving 
  74.             (assign_to_key "#18745" "top_right")    ;   the rest of the map 
  75.             (assign_to_key "#19252" "left_but")     ;   unassigned...
  76.             (assign_to_key "#19509" "cross")        ;
  77.             (assign_to_key "#19766" "right_but")    ;
  78.             (assign_to_key "#20273" "bottom_left")  ;
  79.             (assign_to_key "#20530" "bottom_but")   ;
  80.             (assign_to_key "#20787" "bottom_right") ;
  81.             (assign_to_key "#18989" "horizontal")   ;
  82.             (assign_to_key "#20011" "vertical")     ;
  83.  
  84.             (= box_map (inq_keyboard))  ; Get id of new assignments.
  85.             (keyboard_pop 1)            ; Pop new map into storage for later,
  86.                                         ; pulling old map back into activity.
  87.         )
  88.     )
  89.     (use_local_keyboard box_map)    ; Install stored box_map as an "overlay".
  90.     (message "BOX MODE: Use NumLock keys, \"unbox\" cancels.")  ; Confuse user.
  91. ))
  92.  
  93.  
  94.  
  95.  
  96. ;************
  97. ;**     unbox
  98. ;**     =====
  99.  
  100. (macro unbox (
  101.     (use_local_keyboard 0)      ; Disable local box_map.
  102.     (message "BOX MODE OFF: No overlay in effect.")
  103. ))
  104.  
  105.  
  106.  
  107. (macro top_left     (insert "┌" ))      ; 218
  108. (macro top_but      (insert "┬" ))      ; 194
  109. (macro top_right    (insert "┐" ))      ; 191
  110. (macro left_but     (insert "├" ))      ; 195
  111. (macro cross        (insert "┼" ))      ; 197
  112. (macro right_but    (insert "┤" ))      ; 180
  113. (macro bottom_left  (insert "└" ))      ; 192
  114. (macro bottom_but   (insert "┴" ))      ; 193
  115. (macro bottom_right (insert "┘" ))      ; 217
  116. (macro horizontal   (insert "─" ))      ; 196
  117. (macro vertical     (insert "│" ))      ; 179
  118.  
  119. ;** end of box.m
  120.