fixed on-save-file with wx:....copy
original commit: 02ac59a2e99da8407035aca660938b303444cc3d
This commit is contained in:
parent
a0f0cb32fd
commit
c7923e541a
|
@ -178,6 +178,7 @@
|
||||||
[super-on-local-char on-local-char]
|
[super-on-local-char on-local-char]
|
||||||
|
|
||||||
[super-on-save-file on-save-file]
|
[super-on-save-file on-save-file]
|
||||||
|
[super-after-save-file after-save-file]
|
||||||
|
|
||||||
[super-after-set-position after-set-position]
|
[super-after-set-position after-set-position]
|
||||||
|
|
||||||
|
@ -195,11 +196,11 @@
|
||||||
[super-after-delete after-delete]
|
[super-after-delete after-delete]
|
||||||
[super-after-set-size-constraint after-set-size-constraint])
|
[super-after-set-size-constraint after-set-size-constraint])
|
||||||
(private
|
(private
|
||||||
[styles-fixed-edit-modified? #f])
|
[styles-fixed-edit-modified? #f]
|
||||||
|
[restore-file-format void]) ; the function void, not #<void>
|
||||||
(public
|
(public
|
||||||
[on-save-file
|
[on-save-file
|
||||||
(let ([skip-check #f]
|
(let ([has-non-text-snips
|
||||||
[has-non-text-snips
|
|
||||||
(lambda ()
|
(lambda ()
|
||||||
(let loop ([s (find-snip 0 wx:const-snip-after)])
|
(let loop ([s (find-snip 0 wx:const-snip-after)])
|
||||||
(cond
|
(cond
|
||||||
|
@ -208,29 +209,31 @@
|
||||||
(loop (send s next))]
|
(loop (send s next))]
|
||||||
[else #t])))])
|
[else #t])))])
|
||||||
(lambda (name format)
|
(lambda (name format)
|
||||||
(unless (or skip-check
|
(when (and (or (= format wx:const-media-ff-same)
|
||||||
(= format wx:const-media-ff-std)
|
(= format wx:const-media-ff-copy))
|
||||||
(= format wx:const-media-ff-guess)
|
(not (= (get-file-format)
|
||||||
(and (= format wx:const-media-ff-same)
|
|
||||||
(= (get-file-format)
|
|
||||||
wx:const-media-ff-std)))
|
wx:const-media-ff-std)))
|
||||||
(dynamic-wind
|
|
||||||
(lambda () (set! skip-check #t))
|
|
||||||
(lambda ()
|
|
||||||
(cond
|
(cond
|
||||||
[(= format wx:const-media-ff-copy)
|
[(= format wx:const-media-ff-copy)
|
||||||
(let ([format (get-file-format)])
|
(set! restore-file-format
|
||||||
(set-file-format wx:const-media-ff-std)
|
(let ([f (get-file-format)])
|
||||||
(save-file name format)
|
(lambda ()
|
||||||
(set-file-format format))]
|
(set! restore-file-format void)
|
||||||
|
(set-file-format f))))
|
||||||
|
(set-file-format wx:const-media-ff-std)]
|
||||||
[(and (has-non-text-snips)
|
[(and (has-non-text-snips)
|
||||||
(or (not (mred:preferences:get-preference 'mred:verify-change-format))
|
(or (not (mred:preferences:get-preference 'mred:verify-change-format))
|
||||||
(mred:gui-utils:get-choice "Save this file as plain text?" "No" "Yes")))
|
(mred:gui-utils:get-choice "Save this file as plain text?" "No" "Yes")))
|
||||||
(save-file name wx:const-media-ff-std)]
|
(set-file-format wx:const-media-ff-std)]
|
||||||
[else (void)]))
|
[else (void)]))
|
||||||
(lambda () (set! skip-check #f))))
|
(or (super-on-save-file name format)
|
||||||
(super-on-save-file name format)))]
|
(begin
|
||||||
|
(restore-file-format)
|
||||||
|
#f))))]
|
||||||
|
[after-save-file
|
||||||
|
(lambda (success)
|
||||||
|
(super-after-save-file success)
|
||||||
|
(restore-file-format))]
|
||||||
|
|
||||||
|
|
||||||
[autowrap-bitmap mred:icon:autowrap-bitmap]
|
[autowrap-bitmap mred:icon:autowrap-bitmap]
|
||||||
|
|
Loading…
Reference in New Issue
Block a user