removed the dependency between the string-constants library and mrlib
svn: r8369 original commit: 2e3c05b14e0ca53bb6e10376252266834750fc8f
This commit is contained in:
parent
bb5c1e5528
commit
2ef8d09762
|
@ -1,11 +1,4 @@
|
||||||
|
#lang scheme/gui
|
||||||
(module name-message mzscheme
|
|
||||||
(require (lib "string-constant.ss" "string-constants")
|
|
||||||
(lib "class.ss")
|
|
||||||
(lib "file.ss")
|
|
||||||
(lib "list.ss")
|
|
||||||
(lib "mred.ss" "mred")
|
|
||||||
(lib "contract.ss"))
|
|
||||||
|
|
||||||
;; min-w, min-h : number -> contract
|
;; min-w, min-h : number -> contract
|
||||||
;; determines if the widths and heights are suitable
|
;; determines if the widths and heights are suitable
|
||||||
|
@ -16,7 +9,7 @@
|
||||||
[get-left-side-padding (-> number?)]
|
[get-left-side-padding (-> number?)]
|
||||||
(pad-xywh (number? number? (>=/c 0) (>=/c 0) . -> . (values number? number? (>=/c 0) (>=/c 0))))
|
(pad-xywh (number? number? (>=/c 0) (>=/c 0) . -> . (values number? number? (>=/c 0) (>=/c 0))))
|
||||||
(draw-button-label
|
(draw-button-label
|
||||||
(->r ([dc (is-a?/c dc<%>)]
|
(->d ([dc (is-a?/c dc<%>)]
|
||||||
[label (union false/c string?)]
|
[label (union false/c string?)]
|
||||||
[x number?]
|
[x number?]
|
||||||
[y number?]
|
[y number?]
|
||||||
|
@ -26,16 +19,21 @@
|
||||||
[grabbed? boolean?]
|
[grabbed? boolean?]
|
||||||
[button-label-font (is-a?/c font%)]
|
[button-label-font (is-a?/c font%)]
|
||||||
[bkg-color (or/c false/c (is-a?/c color%) string?)])
|
[bkg-color (or/c false/c (is-a?/c color%) string?)])
|
||||||
void?))
|
()
|
||||||
|
[result void?]))
|
||||||
|
|
||||||
(calc-button-min-sizes
|
(calc-button-min-sizes
|
||||||
(->* ((is-a?/c dc<%>) string? (is-a?/c font%))
|
(->* ((is-a?/c dc<%>) string? (is-a?/c font%))
|
||||||
(number? number?))))
|
()
|
||||||
|
(values number? number?))))
|
||||||
|
|
||||||
(provide name-message%)
|
(provide name-message%)
|
||||||
|
|
||||||
(define name-message%
|
(define name-message%
|
||||||
(class canvas%
|
(class canvas%
|
||||||
|
(init-field [string-constant-untitled "Untitled"]
|
||||||
|
[string-constant-no-full-name-since-not-saved
|
||||||
|
"The file does not have a full name because it has not yet been saved."])
|
||||||
(inherit popup-menu get-dc get-size get-client-size min-width min-height
|
(inherit popup-menu get-dc get-size get-client-size min-width min-height
|
||||||
stretchable-width stretchable-height
|
stretchable-width stretchable-height
|
||||||
get-top-level-window refresh)
|
get-top-level-window refresh)
|
||||||
|
@ -56,7 +54,7 @@
|
||||||
(define paths #f)
|
(define paths #f)
|
||||||
|
|
||||||
;; label : string
|
;; label : string
|
||||||
(init-field [label (string-constant untitled)]
|
(init-field [label string-constant-untitled]
|
||||||
[font small-control-font])
|
[font small-control-font])
|
||||||
|
|
||||||
(define full-name-window #f)
|
(define full-name-window #f)
|
||||||
|
@ -77,10 +75,9 @@
|
||||||
(map path->string (explode-path (normalize-path path-name)))
|
(map path->string (explode-path (normalize-path path-name)))
|
||||||
#f))
|
#f))
|
||||||
(let ([new-label (cond
|
(let ([new-label (cond
|
||||||
[(and paths (not (null? paths)))
|
[(and paths (not (null? paths))) (last paths)]
|
||||||
(car (last-pair paths))]
|
|
||||||
[path-name path-name]
|
[path-name path-name]
|
||||||
[else (string-constant untitled)])])
|
[else string-constant-untitled])])
|
||||||
(unless (equal? label new-label)
|
(unless (equal? label new-label)
|
||||||
(set! label new-label)
|
(set! label new-label)
|
||||||
(set! to-draw-message #f)
|
(set! to-draw-message #f)
|
||||||
|
@ -99,7 +96,7 @@
|
||||||
(on-choose-directory (apply build-path (reverse paths)))))
|
(on-choose-directory (apply build-path (reverse paths)))))
|
||||||
(loop (cdr paths))]))
|
(loop (cdr paths))]))
|
||||||
(let ([i (make-object menu-item%
|
(let ([i (make-object menu-item%
|
||||||
(string-constant no-full-name-since-not-saved)
|
string-constant-no-full-name-since-not-saved
|
||||||
menu void)])
|
menu void)])
|
||||||
(send i enable #f))))
|
(send i enable #f))))
|
||||||
|
|
||||||
|
@ -331,4 +328,4 @@
|
||||||
(+ dy (+ y off-y)))
|
(+ dy (+ y off-y)))
|
||||||
(loop (+ x-off 1) (+ off-y 1)))))
|
(loop (+ x-off 1) (+ off-y 1)))))
|
||||||
|
|
||||||
(void)))
|
(void))
|
||||||
|
|
Loading…
Reference in New Issue
Block a user