* Make the drracket `default-filters' have a ";"-separated glob for all

patterns instead of one pattern per suffix.  (This was almost never
  used -- only when saving a file that is in text mode.)

* Since this default is the same that the scheme
  mode ("framework/private/scheme.rkt") sets, remove that
  setting.  (Leave it commented in case there's need to have some
  different global default.)  It makes the above default get used when
  saving a scheme-mode file.

* Finally, for some reason the code in "framework/private/finder.rkt"
  was not using these `default-filters' at all for the file open dialog
  in `*get-file'.  (I tracked it back to CVS when the code was written,
  and it was never used.)

  I made it use it now.  This is visible on gtk (and probably on
  windows, not sure what OSX does) in that openning a file would show
  you all files.  After this change, it would show only racket source
  files, but there will be an option to switch the pattern to show all files.

  ** If the previous setup (showing all files) was intentional, it would
     be better to simply change "drracket/private/main.rkt" to add the
     racket source globs before the default.  In that case it might also
     make sense to uncomment the change in scheme.rkt back in, so when
     saving the default is the racket file suffixes (but this sounds
     like a confusing UI).

original commit: 1582f160bc9c778af05ff9216854576b3b1d806b
This commit is contained in:
Eli Barzilay 2011-06-02 10:06:15 -04:00
parent 4a7d60f87e
commit 3235598f6d
2 changed files with 4 additions and 2 deletions

View File

@ -25,7 +25,7 @@
(message-box (string-constant error) msg)
#f)))))
(define default-filters (make-parameter '(("Any" "*.*"))))
(define default-filters (make-parameter '(["Any" "*.*"])))
(define default-extension (make-parameter ""))
;; dialog wrappers
@ -66,7 +66,8 @@
[filter #f]
[filter-msg (string-constant file-wrong-form)]
[parent-win (dialog-parent-parameter)])
(let ([f (get-file prompt parent-win directory #f #f style)])
(let ([f (get-file prompt parent-win directory #f
(default-extension) style (default-filters))])
(and f (or (not filter) (filter-match? filter f filter-msg))
(let ([f (normalize-path f)])
(cond [(directory-exists? f)

View File

@ -1276,6 +1276,7 @@
(define/override (put-file text sup directory default-name)
(parameterize ([finder:default-extension "rkt"]
#; ; no need for the following, since it's the default
[finder:default-filters '(["Racket Sources" "*.rkt;*.scrbl;*.ss;*.scm"]
["Any" "*.*"])])
;; don't call the surrogate's super, since it sets the default extension