Compare commits

..

No commits in common. "more-ellipses" and "master" have entirely different histories.

9 changed files with 344 additions and 805 deletions

View File

@ -30,10 +30,6 @@ Adds an undoer procedure to the editor's undo stack. If an undo is
redoing) changes to an editor, and when this undoer is the first item
on the undo (or redo) stack.
Editor instances are created with no undo stack, so no undo operations
will be recorded unless @method[editor<%> set-max-undo-history] is
used to change the size of the undo stack.
The system automatically installs undo records to undo built-in editor
operations, such as inserts, deletes, and font changes. Install an
undoer only when it is necessary to maintain state or handle

View File

@ -61,9 +61,9 @@ A brief example illustrates how editors work. To start, an editor
]
At this point, the editor is fully functional: the user can type text
into the editor, but no cut-and-paste or undo operations are
available. We can support all of the standard operations on an editor
via the menu bar:
into the editor, but no cut-and-paste operations are available. We
can support all of the standard operations on an editor via the
menu bar:
@racketblock[
(define mb (new menu-bar% [parent f]))
@ -71,20 +71,16 @@ At this point, the editor is fully functional: the user can type text
(define m-font (new menu% [label "Font"] [parent mb]))
(append-editor-operation-menu-items m-edit #f)
(append-editor-font-menu-items m-font)
(send t #,(:: editor<%> set-max-undo-history) 100)
]
Now, the standard cut-and-paste operations work and so does undo, and
the user can even set font styles. The editor is created with no undo
history stack, @method[editor<%> set-max-undo-history] is used to set
a non-zero stack, so undo operations can be recorded. The user can
also insert an embedded editor by selecting @onscreen{Insert Text}
from the @onscreen{Edit} menu; after selecting the menu item, a box
appears in the editor with the caret inside. Typing with the caret in
the box stretches the box as text is added, and font operations apply
wherever the caret is active. Text on the outside of the box is
rearranged as the box changes sizes. Note that the box itself can be
copied and pasted.
Now, the standard cut and paste operations work, and the user can even
set font styles. The user can also insert an embedded editor by
selecting @onscreen{Insert Text} from the @onscreen{Edit} menu; after
selecting the menu item, a box appears in the editor with the caret
inside. Typing with the caret in the box stretches the box as text is
added, and font operations apply wherever the caret is active. Text
on the outside of the box is rearranged as the box changes
sizes. Note that the box itself can be copied and pasted.
The content of an editor is made up of @defterm{@tech{snips}}. An
embedded editor is a single snip from the embedding editor's

View File

@ -378,8 +378,6 @@
(preferences:set-default 'framework:fixup-open-parens #f boolean?)
(preferences:set-default 'framework:paren-match #t boolean?)
(let ([defaults-ht (make-hasheq)])
(for-each (λ (x) (hash-set! defaults-ht x '...))
'(... ...+ …+ ::...))
(for-each (λ (x) (hash-set! defaults-ht x 'for/fold))
'(for/fold for/fold: for*/fold for*/fold:))
(for-each (λ (x) (hash-set! defaults-ht x 'define))
@ -460,9 +458,8 @@
(preferences:set-default
'framework:tabify
(list defaults-ht #rx"^begin" #rx"^def" #rx"^(for\\*?(/|$)|with-)" #f)
(cons/c (hash/c symbol? (or/c 'for/fold 'define 'begin 'lambda '...) #:flat? #t)
(or/c (list/c (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?))
(list/c (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?)))))
(list/c (hash/c symbol? (or/c 'for/fold 'define 'begin 'lambda) #:flat? #t)
(or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?) (or/c #f regexp?)))
(define old-style-pred? (listof (list/c symbol? symbol?)))
(define new-style-pred?

View File

@ -752,22 +752,13 @@
(and snd-end
(let ([snd-start (get-backward-sexp snd-end)])
(and snd-start
(text-is-ellipsis? (get-text snd-start snd-end))
(equal? (get-text snd-start snd-end)
"...")
(let ([thrd-start (get-forward-sexp snd-end)])
(and (or (not thrd-start)
(not (= (position-paragraph thrd-start)
(position-paragraph snd-start)))))))))))))
(define/private (text-is-ellipsis? text)
(define pref (preferences:get 'framework:tabify))
(define ht (car pref))
(define ...-reg (and (> (length pref) 5) (list-ref pref 5)))
(hash-ref
ht
(with-handlers ((exn:fail:read? (λ (x) #f)))
(read (open-input-string text)))
(λ () (and ...-reg (regexp-match ...-reg text)))))
(define/private (first-sexp-is-keyword? contains)
(let ([fst-end (get-forward-sexp contains)])
(and fst-end
@ -2182,9 +2173,8 @@
(values (pick-out 'begin all-keywords null)
(pick-out 'define all-keywords null)
(pick-out 'lambda all-keywords null)
(pick-out 'for/fold all-keywords null)
(pick-out '... all-keywords null))))
(define-values (begin-keywords define-keywords lambda-keywords for/fold-keywords ellipses-keywords)
(pick-out 'for/fold all-keywords null))))
(define-values (begin-keywords define-keywords lambda-keywords for/fold-keywords)
(get-keywords (car (preferences:get 'framework:tabify))))
(define ((add-button-callback keyword-type keyword-symbol list-box) button command)
(define new-one
@ -2286,13 +2276,8 @@
'for/fold
for/fold-keywords
(λ (x) (update-pref 4 x))))
(define-values (ellipses-list-box ellipses-regexp-text)
(make-column "Ellipses"
'...
ellipses-keywords
(λ (x) (update-pref 5 x))))
(define (update-list-boxes hash-table)
(define-values (begin-keywords define-keywords lambda-keywords for/fold-keywords ellipses-keywords)
(define-values (begin-keywords define-keywords lambda-keywords for/fold-keywords)
(get-keywords hash-table))
(define (reset list-box keywords)
(send list-box clear)
@ -2301,7 +2286,6 @@
(reset define-list-box define-keywords)
(reset lambda-list-box lambda-keywords)
(reset for/fold-list-box for/fold-keywords)
(reset ellipses-list-box ellipses-keywords)
#t)
(define update-gui
(λ (pref)
@ -2309,10 +2293,7 @@
(send begin-regexp-text set-value (or (object-name (list-ref pref 1)) ""))
(send define-regexp-text set-value (or (object-name (list-ref pref 2)) ""))
(send lambda-regexp-text set-value (or (object-name (list-ref pref 3)) ""))
(send for/fold-regexp-text set-value (or (object-name (list-ref pref 4)) ""))
(send ellipses-regexp-text set-value (or (and (> (length pref) 5)
(object-name (list-ref pref 5)))
""))))
(send for/fold-regexp-text set-value (or (object-name (list-ref pref 4)) ""))))
(preferences:add-callback 'framework:tabify (λ (p v) (update-gui v)))
(update-gui (preferences:get 'framework:tabify))
main-panel)

View File

@ -124,7 +124,7 @@
(let ([w (box 0)]
[h (box 0)])
(get-backing-size w h)
(let ([bm (get-backing-bitmap (lambda (w h) (make-backing-bitmap (max 1 w) (max 1 h))) (unbox w) (unbox h))])
(let ([bm (get-backing-bitmap (lambda (w h) (make-backing-bitmap w h)) (unbox w) (unbox h))])
(internal-set-bitmap bm #t))
(let ([cr (super get-cr)])
(set! retained-cr cr)

View File

@ -237,8 +237,6 @@
(define/override (set-child-size child-gtk x y w h)
(gtk_fixed_move panel-gtk child-gtk (->screen x) (->screen y))
;; gtk3: we expect a panel in a frame to be always visible, so
;; this size erquest should work
(gtk_widget_set_size_request child-gtk (->screen w) (->screen h)))
(define/public (on-close) #t)

View File

@ -28,7 +28,6 @@
(define-gtk gtk_event_box_set_visible_window (_fun _GtkWidget _gboolean -> _void))
(define-gtk gtk_fixed_move (_fun _GtkWidget _GtkWidget _int _int -> _void))
(define-gtk gtk_widget_get_visible (_fun _GtkWidget -> _gboolean))
(define-gtk gtk_container_set_border_width (_fun _GtkWidget _int -> _void))
@ -138,15 +137,7 @@
(super-new)
(define/override (set-child-size child-gtk x y w h)
(gtk_fixed_move (get-container-gtk) child-gtk (->screen x) (->screen y))
(define re-hide?
(and gtk3?
(not (gtk_widget_get_visible child-gtk))
(begin
(gtk_widget_show child-gtk)
#t)))
(gtk_widget_set_size_request child-gtk (->screen w) (->screen h))
(when re-hide?
(gtk_widget_hide child-gtk)))))
(gtk_widget_set_size_request child-gtk (->screen w) (->screen h)))))
(define panel%
(class (panel-container-mixin (panel-mixin window%))

View File

@ -614,7 +614,7 @@
(set! client-delta-h (->normal
(- (GtkRequisition-height req)
(GtkRequisition-height creq)))))
(when gtk3? (gtk_widget_hide gtk))))
(when gtk3? (gtk_widget_show gtk))))
(define/public (set-auto-size [dw 0] [dh 0])
(let ([req (make-GtkRequisition 0 0)])

File diff suppressed because it is too large Load Diff