[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Cheesy Hacks #1: Better Search Files



MCL Users-

This is the first in possibly a series of cheesy hacks that fit
in a single email message. Use at your own risk.

This hack adds a "Pick Path" button, which brings up the standard directory
dialog box, to the Search Files dialog.

Please let me know of any bugs or improvements you make.
Thanks,
Shannon Spires
svspire@sandia.gov
--------------------------------
;;; better search files.lisp
;;; Adds a "pick path" button to the standard MCL "search files" dialog box,
;;;  so you can use the standard file dialog box to pick a path.
;;; Load this file at startup time after MCL's menus have been built.

;;; 11/11/93 Shannon Spires
;;; 
;;; Use at your own risk.

(defun new-search-file-dialog ()
  (ccl::search-file-dialog)
  (add-subviews
   ccl::*search-file-dialog*
   (MAKE-DIALOG-ITEM
    'BUTTON-DIALOG-ITEM
    #@(312 10)
    #@(76 16)
    "Pick Path"
    #'(LAMBDA (ITEM)
        (let ((pathitem (FIND-NAMED-SIBLING ITEM 'CCL::FILE-ITEM)))
          (SET-DIALOG-ITEM-TEXT
           pathitem
           (concatenate
            'string                  
            (CHOOSE-DIRECTORY-DIALOG 
             ; :directory (dialog-item-text pathitem)
;;   uncomment above line to have path pick start at directory currently 
;;     shown in the box.
;;   This can be useful, but unfortunately it bombs with the default string
;;     that MCL first puts in the box.
             )
                        "*.lisp"))))
;; Use this format to search all subdirectories as well: "**:*.lisp"
    :VIEW-NICK-NAME
    'PICK-PATH
    :DEFAULT-BUTTON
    NIL)
                )
  )

(set-menu-item-action-function 
 (find-menu-item (find-menu "Tools") "Search Files")
 'new-search-file-dialog)

; end of better search files.lisp