home *** CD-ROM | disk | FTP | other *** search
/ Programmer 7500 / MAX_PROGRAMMERS.iso / CLIPPER / MISC / MENUSPCS.ZIP / MENMOU.S < prev    next >
Encoding:
Text File  |  1987-12-14  |  5.4 KB  |  151 lines

  1. ;;; ------------------------------------------------------------
  2. ;;; Menus for Scheme (tm)
  3. ;;; AN EXPERIMENTAL MENU-DRIVEN USER INTERFACE FOR PC SCHEME
  4. ;;; TOP-LEVEL DRIVER FOR SYSTEMS WITH A MOUSE
  5. ;;; $Revision:   1.0  $   $Date:   14 Dec 1987  0:38:46  $
  6. ;;; ------------------------------------------------------------
  7. ;;; Copyright (c) 1987 by Morton Goldberg.  
  8. ;;;
  9. ;;; Permission is granted to make copies of this program text
  10. ;;; for personal, non-commercial use provided this notice of
  11. ;;; copyright appears in all copies and derived works.  All
  12. ;;; other rights reserved.  In particular, you may not publish
  13. ;;; or otherwise distribute any copies of this text or any
  14. ;;; derived works without permission from the copyright holder.
  15. ;;; ------------------------------------------------------------
  16. ;;; Implementation Language: Texas Instruments' PC Scheme
  17. ;;; (Version 3.0)
  18. ;;; ------------------------------------------------------------
  19.  
  20. (writeln "Menu-Driven User Interface -- For Systems With A Mouse")
  21. (writeln "Copyright (c) 1987 by Morton Goldberg")
  22. (let ((rev-number "$Revision:   1.0  $"))
  23.   ;; Write the revision number string without the leading
  24.   ;; and trailing dollar-signs (which are needed by the
  25.   ;; version control system).
  26.   (writeln (substring rev-number
  27.                       1
  28.                       (sub1 (string-length rev-number)))))
  29.  
  30. ;;; -------------------------------------------------------------
  31.  
  32. ;;; Console window colors
  33. (define *console-colors* #x07) ; white text on black background
  34.  
  35. ;;; Popup menu colors
  36. (define *menu-norm* #x70) ; black text on white background
  37. (define *menu-high* #x07) ; white text on black background
  38.  
  39. ;;; Popup text and query colors
  40. (define *popup-norm* #x70) ; black text on white background
  41. (define *popup-high* #x07) ; white text on black background
  42.  
  43. ;;; DOS directory and file paths.  IMPORTANT: When installing
  44. ;;; the menu-driven user interface, replace the following path
  45. ;;; and file specification strings with specifications
  46. ;;; appropriate to your computer's DOS directory structure:
  47.  
  48. ;;; Remove *external-editor-spec* definition if not using
  49. ;;; external editor.
  50. (define *external-editor-spec* "\\BIN\\EP.EXE")
  51.  
  52. (define *make-fsl-spec*
  53.   (string-append pcs-sysdir "\\MAKE_FSL.EXE"))
  54.  
  55. (define *transcript-spec*
  56.   (string-append pcs-sysdir "\\SESSION.PCS"))
  57.  
  58. ;;; -------------------------------------------------------------
  59. ;;; VERTICAL MENU INIT LIST
  60. ;;; ------------------------------------------------------------
  61. ;;; This is the init-list for the vertical menus.
  62. (define *vertical-menu-init*
  63.   `('w-top 1
  64.     'w-left 1
  65.     'n-attr ,*menu-norm*
  66.     'hl-attr ,*menu-high*
  67.     'border? #t))
  68.  
  69. ;;; ------------------------------------------------------------
  70. ;;; POPUP QUERY WINDOW
  71. ;;; ------------------------------------------------------------
  72.  
  73. ;;; One of these strings appears on 1-st line of any query made
  74. ;;; by this application.
  75. (define *file-spec-msg*
  76.   "Enter a file specification -- no wild cards")
  77. (define *wild-spec-msg*
  78.   "Enter a file specification -- wild cards OK")
  79. (define *file-path-msg*
  80.   "Enter a directory path")
  81.  
  82. ;;; This is the init-list for the popup query windows.
  83. (define *query-window-init*
  84.   `('w-top 1
  85.     'w-left 1
  86.     'cursor-row 1
  87.     'cursor-col 0
  88.     'input-width 40
  89.     'n-attr ,*popup-norm*
  90.     'hl-attr ,*popup-high*
  91.     'border? #t))
  92.  
  93. ;;; The following code creates a two-line popup query window.
  94. (define *query-window*
  95.   (let ((query (make-popup-query-window *query-window-init*
  96.                                         '#(" " " "))))
  97.     (h-justify 'CENTER query)
  98.     (v-justify 'CENTER query)
  99.     query))
  100.  
  101. ;;; Prompt the user with `query-text', a vector consisting of
  102. ;;; two strings, and return the response if it is a non-empty
  103. ;;; string; otherwise, return '().
  104. (define (get-response-to-query query-text)
  105.   (send *query-window* set-text query-text)
  106.   (send *query-window* popup)
  107.   (let ((rspns (send *query-window* get-response)))
  108.     (if (and (string? rspns) (> (string-length rspns) 0))
  109.       rspns
  110.       '())))
  111.  
  112. ;;; ------------------------------------------------------------
  113. ;;; IMPLEMENT THE OTHER MOUSE MENU CHOICES
  114. ;;; ------------------------------------------------------------
  115.  
  116. ;;; Clear screen.  More precisely, clear the console window.
  117. (define (clr-console)
  118.   (window-set-attribute! 'console
  119.                          'text-attributes
  120.                          *console-colors*)
  121.   (window-clear 'console)
  122.   *the-non-printing-object*)
  123.  
  124. ;;; Debug on/off toggle.  If debug mode is off, turn it on;
  125. ;;; otherwise, turn it off.
  126. (define debug-toggle
  127.   (lambda ()
  128.     (set! pcs-debug-mode (not pcs-debug-mode))
  129.     (window-clear pcs-status-window)
  130.     (display (string-append "Debug mode now "
  131.                             (if pcs-debug-mode "ON" "OFF"))
  132.              pcs-status-window)
  133.     *the-non-printing-object*))
  134.  
  135. ;;; Transcript on/off toggle.   If transcript recording is off,
  136. ;;; turn it on; otherwise, turn it off.
  137. (define trnscrpt-toggle
  138.   (let ((trnscrpt-on '()))
  139.     (lambda ()
  140.       (set! trnscrpt-on (not trnscrpt-on))
  141.       (if trnscrpt-on
  142.         (transcript-on *transcript-spec*)
  143.         (transcript-off))
  144.       (window-clear pcs-status-window)
  145.       (display (string-append "Transcript now "
  146.                               (if trnscrpt-on "ON" "OFF"))
  147.                pcs-status-window)
  148.       *the-non-printing-object*)))
  149.  
  150. ;;; ------------------------------------------------------------
  151.