..
original commit: 6f0ce41175bc48f0db17688c1bcf300e2dccd4b5
This commit is contained in:
parent
c7c0431bb4
commit
619dd4c842
|
@ -13,6 +13,19 @@
|
||||||
|
|
||||||
(provide/contract/docs
|
(provide/contract/docs
|
||||||
|
|
||||||
|
(gui-utils:trim-string
|
||||||
|
(string?
|
||||||
|
(and/f number? positive?)
|
||||||
|
. ->d .
|
||||||
|
(lambda (str size)
|
||||||
|
(and/f string?
|
||||||
|
(lambda (str)
|
||||||
|
((string-length str) . <= . size)))))
|
||||||
|
(str size)
|
||||||
|
"Constructs a string whose size is less"
|
||||||
|
"than \\var{size} by trimming the \\var{str}"
|
||||||
|
"and inserting an ellispses into it.")
|
||||||
|
|
||||||
(gui-utils:cancel-on-right?
|
(gui-utils:cancel-on-right?
|
||||||
(-> boolean?)
|
(-> boolean?)
|
||||||
()
|
()
|
||||||
|
@ -220,6 +233,30 @@
|
||||||
"@flink gui-utils:get-clicked-clickback-delta %"
|
"@flink gui-utils:get-clicked-clickback-delta %"
|
||||||
"."))
|
"."))
|
||||||
|
|
||||||
|
(define (trim-string str size)
|
||||||
|
(let ([str-size (string-length str)])
|
||||||
|
(cond
|
||||||
|
[(<= str-size size)
|
||||||
|
str]
|
||||||
|
[else
|
||||||
|
(let* ([between "..."]
|
||||||
|
[pre-length (- (quotient size 2)
|
||||||
|
(quotient (string-length between) 2))]
|
||||||
|
[post-length (- size
|
||||||
|
pre-length
|
||||||
|
(string-length between))])
|
||||||
|
(cond
|
||||||
|
[(or (<= pre-length 0)
|
||||||
|
(<= post-length 0))
|
||||||
|
(substring str 0 size)]
|
||||||
|
[else
|
||||||
|
(string-append
|
||||||
|
(substring str 0 pre-length)
|
||||||
|
between
|
||||||
|
(substring str
|
||||||
|
(- str-size post-length)
|
||||||
|
str-size))]))])))
|
||||||
|
|
||||||
;; selected-text-color : color
|
;; selected-text-color : color
|
||||||
(define selected-text-color (send the-color-database find-color "black"))
|
(define selected-text-color (send the-color-database find-color "black"))
|
||||||
|
|
||||||
|
@ -438,6 +475,7 @@
|
||||||
[else mb-res]))))
|
[else mb-res]))))
|
||||||
|
|
||||||
;; manual renaming
|
;; manual renaming
|
||||||
|
(define gui-utils:trim-string trim-string)
|
||||||
(define gui-utils:next-untitled-name next-untitled-name)
|
(define gui-utils:next-untitled-name next-untitled-name)
|
||||||
(define gui-utils:show-busy-cursor show-busy-cursor)
|
(define gui-utils:show-busy-cursor show-busy-cursor)
|
||||||
(define gui-utils:delay-action delay-action)
|
(define gui-utils:delay-action delay-action)
|
||||||
|
|
|
@ -226,7 +226,7 @@
|
||||||
(let ([filename (car recent-list-item)])
|
(let ([filename (car recent-list-item)])
|
||||||
(instantiate menu-item% ()
|
(instantiate menu-item% ()
|
||||||
(parent menu)
|
(parent menu)
|
||||||
(label filename)
|
(label (gui-utils:trim-string filename 200))
|
||||||
(callback (lambda (x y) (open-recent-list-item recent-list-item))))))
|
(callback (lambda (x y) (open-recent-list-item recent-list-item))))))
|
||||||
recently-opened-files)))
|
recently-opened-files)))
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue
Block a user