From d970b7734aacb16872f6c297e11cba1569aa8ae6 Mon Sep 17 00:00:00 2001 From: Robby Findler Date: Tue, 25 Jun 2002 18:43:27 +0000 Subject: [PATCH] .. original commit: 8073fed7691153883d2d46f1d404c40cbbb47c1c --- collects/framework/gui-utils.ss | 4 +-- collects/framework/private/editor.ss | 2 +- collects/framework/private/frame.ss | 37 ++++++++++++++++++++++++++++ 3 files changed, 40 insertions(+), 3 deletions(-) diff --git a/collects/framework/gui-utils.ss b/collects/framework/gui-utils.ss index 29cf0b5d..867b67fc 100644 --- a/collects/framework/gui-utils.ss +++ b/collects/framework/gui-utils.ss @@ -152,7 +152,7 @@ "Anyway\"}. The result symbol indicates the user's choice. If" "\\var{can-save-now?} is \\rawscm{\\#f}, this function does not" "give the user the ``Save'' option and thus will not return" - "\rawscm{'save}.") + "\\rawscm{'save}.") (gui-utils:get-choice (opt-> @@ -178,7 +178,7 @@ "clicks on \\var{false-choice}, \\rawscm{\\#f} is returned." "" "The argument \\var{default-result} determines how closing the window is" - "treated. If the argument is \rawscm{'disallow-close}, closing the window" + "treated. If the argument is \\rawscm{'disallow-close}, closing the window" "is not allowed. If it is anything else, that value is returned when" "the user closes the window." "" diff --git a/collects/framework/private/editor.ss b/collects/framework/private/editor.ss index d25b9703..0bef1ea2 100644 --- a/collects/framework/private/editor.ss +++ b/collects/framework/private/editor.ss @@ -319,7 +319,7 @@ (lambda (name) (let ([filename (if name (file-name-from-path (normalize-path name)) - "")]) + (gui-utils:next-untitled-name))]) (for-each (lambda (canvas) (let ([tlw (send canvas get-top-level-window)]) (when (and (is-a? tlw frame:editor<%>) diff --git a/collects/framework/private/frame.ss b/collects/framework/private/frame.ss index 144caa64..c6ed581d 100644 --- a/collects/framework/private/frame.ss +++ b/collects/framework/private/frame.ss @@ -878,6 +878,43 @@ (define open-here-mixin (mixin (-editor<%>) (open-here<%>) + + (rename [super-file-menu:new-on-demand file-menu:new-on-demand]) + (define/override (file-menu:new-on-demand item) + (super-file-menu:new-on-demand item) + (send item set-label (if (preferences:get 'framework:open-here?) + (string-constant new-...-menu-item) + (string-constant new-menu-item)))) + + (rename [super-file-menu:new-callback file-menu:new-callback]) + (define/override (file-menu:new-callback item event) + (cond + [(preferences:get 'framework:open-here?) + (let ([clear-current (ask-about-new-here)]) + (cond + [(eq? clear-current 'cancel) (void)] + [clear-current + (let ([editor (get-editor)]) + (send editor begin-edit-sequence) + (send editor set-filename #f) + (send editor erase) + (send editor set-modified #f) + (send editor end-edit-sequence))] + [else (super-file-menu:new-callback item event)]))] + [else (super-file-menu:new-callback item event)])) + + ;; ask-about-new-here : -> (union 'cancel boolean?) + ;; prompts the user about creating a new window + ;; or "reusing" the current one. + (define/private (ask-about-new-here) + (gui-utils:get-choice + (string-constant create-new-window-or-clear-current) + (string-constant clear-current) + (string-constant new-window) + (string-constant drscheme) + 'cancel + this)) + (rename [super-file-menu:open-on-demand file-menu:open-on-demand]) (define/override (file-menu:open-on-demand item) (super-file-menu:open-on-demand item)