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

Cheesy Hacks #1 (update)



Here's an update of Cheesy Hacks #1: Better Search Files.

;;; better search files.lisp
;;; Cheesy Hacks #1 (2/4/94)
;;; 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
;;; 2/9/94   Christopher Vogt modified to not barf when initial string in
;;;          search files dialog was wild.
;;; 
;;; Use at your own risk.

#|
Date: Wed, 9 Feb 1994 10:48:25 -0800
To: svspire@somnet.sandia.gov
Subject: Re: Cheesy Hacks #1: Better Search Files
Organization: Kalantha, Inc.
Thanks for the hack. Below is my modified version that hacks around
the problem with the initial directory string, as well as others like
it.
Christopher J. Vogt vogt@netcom.com
From: El Eh, CA

|#
(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))
               (path (dialog-item-text pathitem)))
          (SET-DIALOG-ITEM-TEXT
           pathitem
           (concatenate
            'string
            (CHOOSE-DIRECTORY-DIALOG
             :directory (if (wild-pathname-p path)
                            ""
                          path))
            "*.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 Cheesy Hacks #1

-Shannon
svspire@sandia.gov