editor insert-image uses alpha by default

This commit is contained in:
Matthew Flatt 2010-10-21 07:47:30 -07:00
parent df2626ad44
commit 881c182956
4 changed files with 31 additions and 18 deletions

View File

@ -506,7 +506,7 @@
snip))
(def/public (insert-image [(make-or-false path-string?) [filename #f]]
[symbol? [type 'unknown]]
[image-type? [type 'unknown/alpha]]
[any? [relative? #f]]
[any? [inline-img? #t]])
(let ([filename (or filename
@ -518,7 +518,7 @@
(insert snip)))))
(def/public (on-new-image-snip [path-string? filename]
[symbol? type]
[image-type? type]
[any? relative?]
[any? inline-img?])
(make-object image-snip% filename type relative? inline-img?))

View File

@ -54,7 +54,9 @@
caret-status?
selected-text-color)
selected-text-color
image-type?)
(define (symbol-list? l)
(and (list? l) (andmap symbol? l)))
@ -864,6 +866,12 @@
(define black-color (make-object color% 0 0 0))
(define image-type?
(symbol-in unknown unknown/mask unknown/alpha
gif gif/mask gif/alpha
jpeg png png/mask png/alpha
xbm xpm bmp pict))
(defclass* image-snip% internal-snip% (equal<%>)
(inherit-field s-admin
s-flags)
@ -894,10 +902,7 @@
[([bitmap% bm] [(make-or-false bitmap%) [mask #f]])
(set-bitmap bm mask)]
[([(make-or-false path-string?) [name #f]]
[(symbol-in unknown unknown/mask gif gif/mask
jpeg png png/mask
xbm xpm bmp pict)
[kind 'unknown]]
[image-type? [kind 'unknown]]
[bool? [relative-path? #f]]
[bool? [inline? #t]])
(load-file name kind relative-path? inline?)]

View File

@ -959,7 +959,11 @@ The @scheme[show-errors?] argument is no longer used.
@defmethod[(insert-image [filename (or/c path-string? #f) #f]
[type (or/c 'unknown 'gif 'jpeg 'xbm 'xpm 'bmp 'pict) 'unknown]
[type (one-of/c 'unknown 'unknown/mask 'unknown/alpha
'gif 'gif/mask 'gif/alpha
'jpeg 'png 'png/mask 'png/alpha
'xbm 'xpm 'bmp 'pict)
'unknown/alpha]
[relative-path? any/c #f]
[inline? any/c #t])
void?]{
@ -1521,7 +1525,10 @@ Creates a @scheme[editor-snip%] with either a sub-editor from
@defmethod[(on-new-image-snip [filename path?]
[kind (or/c 'unknown 'gif 'jpeg 'xbm 'xpm 'bmp 'pict)]
[kind (one-of/c 'unknown 'unknown/mask 'unknown/alpha
'gif 'gif/mask 'gif/alpha
'jpeg 'png 'png/mask 'png/alpha
'xbm 'xpm 'bmp 'pict)]
[relative-path? any/c]
[inline? any/c])
(is-a?/c image-snip%)]{

View File

@ -9,9 +9,9 @@ An @scheme[image-snip%] is a snip that can display bitmap images
@defconstructor*/make[(([filename (or/c path-string? false/c) #f]
[kind (one-of/c 'unknown 'unknown/mask
'gif 'gif/mask
'jpeg 'png 'png/mask
[kind (one-of/c 'unknown 'unknown/mask 'unknown/alpha
'gif 'gif/mask 'gif/alpha
'jpeg 'png 'png/mask 'png/alpha
'xbm 'xpm 'bmp 'pict) 'unknown]
[relative-path? any/c #f]
[inline? any/c #t])
@ -95,9 +95,10 @@ relative to the owning editor's path}]
}
@defmethod[(get-filetype)
(one-of/c 'unknown 'unknwon/mask
'gif 'gif/mask
'jpeg 'png 'png/mask 'xbm 'xpm 'bmp 'pict)]{
(one-of/c 'unknown 'unknown/mask 'unknown/alpha
'gif 'gif/mask 'gif/alpha
'jpeg 'png 'png/mask 'png/alpha
'xbm 'xpm 'bmp 'pict)]{
Returns the kind used to load the currently loaded, non-inlined file,
or @scheme['unknown] if a file is not loaded or if a file was loaded
@ -106,9 +107,9 @@ Returns the kind used to load the currently loaded, non-inlined file,
}
@defmethod[(load-file [filename (or/c path-string? false/c)]
[kind (one-of/c 'unknown 'unknown/mask
'gif 'gif/mask
'jpeg 'png 'png/mask
[kind (one-of/c 'unknown 'unknown/mask 'unknown/alpha
'gif 'gif/mask 'gif/alpha
'jpeg 'png 'png/mask 'png/alpha
'xbm 'xpm 'bmp 'pict) 'unknown]
[relative-path? any/c #f]
[inline? any/c #t])