SK requested popup menu on images to save them
svn: r10637 original commit: e090a76187ba5b0761277aba406754581796629e
This commit is contained in:
parent
50207ac5c7
commit
c5f03ba904
|
@ -909,7 +909,10 @@
|
|||
(parameter-doc
|
||||
keymap:add-to-right-button-menu
|
||||
(parameter/c
|
||||
(-> (is-a?/c popup-menu%) (is-a?/c editor<%>) (is-a?/c event%) void?))
|
||||
(-> (is-a?/c popup-menu%)
|
||||
(is-a?/c editor<%>)
|
||||
(is-a?/c event%)
|
||||
void?))
|
||||
proc
|
||||
@{When the keymap that @scheme[keymap:get-global] returns is installed
|
||||
into an editor, this parameter's value is used for right button
|
||||
|
|
|
@ -38,7 +38,9 @@
|
|||
on-close
|
||||
can-close?
|
||||
close
|
||||
get-filename/untitled-name))
|
||||
get-filename/untitled-name
|
||||
|
||||
get-pos/text))
|
||||
|
||||
(define basic-mixin
|
||||
(mixin (editor<%>) (basic<%>)
|
||||
|
@ -49,6 +51,31 @@
|
|||
(begin (on-close) #t)
|
||||
#f))
|
||||
|
||||
(define/public (get-pos/text event)
|
||||
(let ([event-x (send event get-x)]
|
||||
[event-y (send event get-y)]
|
||||
[on-it? (box #f)])
|
||||
(let loop ([editor this])
|
||||
(let-values ([(x y) (send editor dc-location-to-editor-location event-x event-y)])
|
||||
(cond
|
||||
[(is-a? editor text%)
|
||||
(let ([pos (send editor find-position x y #f on-it?)])
|
||||
(cond
|
||||
[(not (unbox on-it?)) (values #f #f)]
|
||||
[else
|
||||
(let ([snip (send editor find-snip pos 'after-or-none)])
|
||||
(if (and snip
|
||||
(is-a? snip editor-snip%))
|
||||
(loop (send snip get-editor))
|
||||
(values pos editor)))]))]
|
||||
[(is-a? editor pasteboard%)
|
||||
(let ([snip (send editor find-snip x y)])
|
||||
(if (and snip
|
||||
(is-a? snip editor-snip%))
|
||||
(loop (send snip get-editor))
|
||||
(values editor #f)))]
|
||||
[else (values #f #f)])))))
|
||||
|
||||
;; get-filename/untitled-name : -> string
|
||||
;; returns a string representing the visible name for this file,
|
||||
;; or "Untitled <n>" for some n.
|
||||
|
@ -291,8 +318,7 @@
|
|||
(get-top-level-window)])
|
||||
(finder:put-file f d)))
|
||||
|
||||
|
||||
(super-instantiate ())))
|
||||
(super-new)))
|
||||
|
||||
(define standard-style-list (new style-list%))
|
||||
(define (get-standard-style-list) standard-style-list)
|
||||
|
|
|
@ -116,6 +116,21 @@
|
|||
returns a symbolic name (something like "Untitled").
|
||||
|
||||
}
|
||||
|
||||
@defmethod[(get-pos/text [event (is-a?/c mouse-event%)])
|
||||
(values (or/c false/c (is-a?/c editor<%>))
|
||||
(or/c false/c number?))]{
|
||||
|
||||
This method's first result is @scheme[#f] when the mouse
|
||||
event does not correspond to a location in the editor.
|
||||
|
||||
If the first result is an @scheme[text%] object, then the
|
||||
second result will be a position in the editor and
|
||||
otherwise the second result will be @scheme[#f].
|
||||
|
||||
The @scheme[editor<%>] object will always be the nearest
|
||||
enclosing editor containing the mouse click.
|
||||
}
|
||||
}
|
||||
@defmixin[editor:basic-mixin (editor<%>) (editor:basic<%>)]{
|
||||
This provides the basic editor services required by the rest of the
|
||||
|
|
Loading…
Reference in New Issue
Block a user