add editor-scroll-to method of editor<%>

svn: r10860

original commit: 6c43d23bc47c8e811ee77831a965592d0f849a25
This commit is contained in:
Matthew Flatt 2008-07-22 13:17:09 +00:00
parent 23aeb8d205
commit f5f6cd7d0c
4 changed files with 43 additions and 5 deletions

View File

@ -36,7 +36,7 @@
"MrEdIt" #f 620 450))
(define c (make-object editor-canvas% f))
(define e (make-object (class editor%
(define/override (set-modified mod?)
(define/override (set-modified mod?)
(send f modified mod?)
(super set-modified mod?))
(super-new))))

View File

@ -252,6 +252,7 @@
release-snip
on-snip-modified
set-modified
scroll-editor-to
set-snip-data
get-snip-data
needs-update
@ -928,6 +929,7 @@
release-snip
on-snip-modified
set-modified
scroll-editor-to
set-snip-data
get-snip-data
needs-update
@ -1141,6 +1143,7 @@
release-snip
on-snip-modified
set-modified
scroll-editor-to
set-snip-data
get-snip-data
needs-update

View File

@ -1988,6 +1988,30 @@ The @scheme[show-errors?] argument is no longer used.
}
@defmethod[(scroll-editor-to [localx real?]
[localy real?]
[width (and/c real? (not/c negative?))]
[height (and/c real? (not/c negative?))]
[refresh? any/c]
[bias (one-of/c 'start 'end 'none)])
boolean?]{
Causes the editor to be scrolled so that a given @techlink{location}
is visible. If the editor is scrolled, @scheme[#t] is returned,
otherwise @scheme[#f] is returned.
This method is normally called indirectly by @method[editor<%>
scroll-to] or @xmethod[text% scroll-to-position] to implement
scrolling.
The default implementation forwards the request to the
@method[editor-admin% scroll-to] method of the current administrator,
if any (see @method[editor<%> get-admin]). If the editor has no
administrator, @scheme[#f] is returned.
}
@defmethod[(scroll-line-location [pos (and/c exact? integer?)])
(and/c real? (not/c negative?))]{
@ -2010,8 +2034,13 @@ For @scheme[text%] objects: @|FCA| @|EVD|
Called (indirectly) by snips within the editor: it causes the editor
to be scrolled so that a given @techlink{location} range within a
given snip is visible. If the editor is scrolled, @scheme[#t] is
returned, otherwise @scheme[#f] is returned.
given snip is visible. If the editor is scrolled immediately,
@scheme[#t] is returned, otherwise @scheme[#f] is returned.
If refreshing is delayed (see @method[editor<%> refresh-delayed?]),
then the scroll request is saved until the delay has ended. The
scroll is performed (immediately or later) by calling
@method[editor<%> scroll-editor-to].
The @scheme[localx], @scheme[localy], @scheme[width], and @scheme[height]
arguments specify the area that needs to be visible in @scheme[snip]'s

View File

@ -1706,12 +1706,18 @@ When the specified range cannot fit in the visible area, @scheme[bias]
displayed. Otherwise, @scheme[bias] must be @scheme['none].
If the editor is scrolled, then the editor is redrawn and the return
value is @scheme[#t]; otherwise, the return value is @scheme[#f].
value is @scheme[#t]; otherwise, the return value is @scheme[#f]. If
refreshing is delayed (see @method[editor<%> refresh-delayed?]), then
the scroll request is saved until the delay has ended. The scroll is
performed (immediately or later) by calling @method[editor<%>
scroll-editor-to].
Scrolling is disallowed when the editor is internally locked for
reflowing (see also @|lockdiscuss|).
The system may scroll the editor without calling this method.
The system may scroll the editor without calling this method. For
example, a canvas displaying an editor might scroll the editor to
handle a scrollbar event.
}