home *** CD-ROM | disk | FTP | other *** search
- ;;; ------------------------------------------------------------
- ;;; Menus for Scheme (tm)
- ;;; AN EXPERIMENTAL MENU-DRIVEN USER INTERFACE FOR PC SCHEME
- ;;; EDIT MENU
- ;;; $Revision: 1.0 $ $Date: 14 Dec 1987 0:40:08 $
- ;;; ------------------------------------------------------------
- ;;; Copyright (c) 1987 by Morton Goldberg.
- ;;;
- ;;; Permission is granted to make copies of this program text
- ;;; for personal, non-commercial use provided this notice of
- ;;; copyright appears in all copies and derived works. All
- ;;; other rights reserved. In particular, you may not publish
- ;;; or otherwise distribute any copies of this text or any
- ;;; derived works without permission from the copyright holder.
- ;;; ------------------------------------------------------------
- ;;; Implementation Language: Texas Instruments' PC Scheme
- ;;; (Version 3.0)
- ;;; ------------------------------------------------------------
-
- (writeln "Menu-Driven User Interface -- Edit Menu")
- (writeln "Copyright (c) 1987 by Morton Goldberg")
- (let ((rev-number "$Revision: 1.0 $"))
- ;; Write the revision number string without the leading
- ;; and trailing dollar-signs (which are needed by the
- ;; version control system).
- (writeln (substring rev-number
- 1
- (sub1 (string-length rev-number)))))
-
- ;;; ------------------------------------------------------------
- ;;; EDIT MENU
- ;;; ------------------------------------------------------------
- ;;; *.S CHOICE
-
- ;;; Create a menu of the *.S files in the current directory,
- ;;; display it, and call the external editor to edit the file
- ;;; selected by the user.
- (define (edit-from-menu)
- (define (xedit file-spec)
- (dos-call *external-editor-spec* file-spec 16384))
- (define menu
- (files->menu "*.S"
- 20
- xedit
- *vertical-menu-init*))
- (if menu
- (begin
- (h-justify 'CENTER menu)
- (v-justify 'TOP menu)
- (send menu popup)))
- 'USER-ABORT)
-
- ;;; ------------------------------------------------------------
- ;;; Edit ? CHOICE
-
- ;;; Activate the file specification popup query window. Dos-
- ;;; call the external editor with the string typed-in by the
- ;;; user.
- (define (edit-any-file)
- (let ((file-spec
- (get-response-to-query (vector *file-spec-msg* ""))))
- (if file-spec
- (dos-call *external-editor-spec* file-spec 16384)))
- 'USER-ABORT)
-
- ;;; ------------------------------------------------------------
-
- ;;; This is the item list for the edit menu.
- (define *edit-menu-items*
- `(("*.S" #\s ,edit-from-menu)
- ("Edit ?" #\e ,edit-any-file)))
-
- ;;; Create the edit menu, which is a vertical menu.
- (define *edit-menu*
- (let ((menu (make-vertical-menu *vertical-menu-init*
- *edit-menu-items*)))
- (h-justify 'CENTER menu)
- (v-justify 'TOP menu)
- menu))
-
- ;;; Link to the top-level menu.
- (define (edit-menu)
- (send *edit-menu* popup)
- *the-non-printing-object*)
-
- ;;; ------------------------------------------------------------
-