Change a bunch of "~%" and "~n" in format strings to "\n".

original commit: 7dc4d2e5a63ab416d90e44d7bf75cb5593329909
This commit is contained in:
Eli Barzilay 2010-08-25 17:16:32 -04:00
parent b0135206c3
commit 2c1b48d3c4
11 changed files with 99 additions and 99 deletions

View File

@ -244,7 +244,7 @@ the state transitions / contracts are:
(pref-can-init? p)) (pref-can-init? p))
(let ([default-okay? (checker default-value)]) (let ([default-okay? (checker default-value)])
(unless default-okay? (unless default-okay?
(error 'set-default "~s: checker (~s) returns ~s for ~s, expected #t~n" (error 'set-default "~s: checker (~s) returns ~s for ~s, expected #t\n"
p checker default-okay? default-value))) p checker default-okay? default-value)))
(unless (= (length aliases) (length rewrite-aliases)) (unless (= (length aliases) (length rewrite-aliases))

View File

@ -192,7 +192,7 @@
(,(xyz-z xyz-white))))]) (,(xyz-z xyz-white))))])
(apply values (car (transpose sigmas))))) (apply values (car (transpose sigmas)))))
;; (printf "should be equal to xyz-white: ~n~a~n" ;; (printf "should be equal to xyz-white: \n~a\n"
;; (matrix-multiply pre-matrix `((,sigma-r) (,sigma-g) (,sigma-b)))) ;; (matrix-multiply pre-matrix `((,sigma-r) (,sigma-g) (,sigma-b))))
(define rgb->xyz-matrix (define rgb->xyz-matrix
@ -203,13 +203,13 @@
(define xyz->rgb-matrix (define xyz->rgb-matrix
(matrix-invert rgb->xyz-matrix)) (matrix-invert rgb->xyz-matrix))
;;(printf "should be identity: ~n~a~n" (matrix-multiply rgb->xyz-matrix xyz->rgb-matrix)) ;;(printf "should be identity: \n~a\n" (matrix-multiply rgb->xyz-matrix xyz->rgb-matrix))
(define (rgb->xyz r g b) (define (rgb->xyz r g b)
(apply make-xyz (car (transpose (matrix-multiply rgb->xyz-matrix (transpose `((,r ,g ,b)))))))) (apply make-xyz (car (transpose (matrix-multiply rgb->xyz-matrix (transpose `((,r ,g ,b))))))))
;;(print-struct #t) ;;(print-struct #t)
;; (printf "should be xyz-white: ~n~a~n" (rgb->xyz 255 255 255)) ;; (printf "should be xyz-white: \n~a\n" (rgb->xyz 255 255 255))
(define (xyz->rgb x y z) (define (xyz->rgb x y z)
(car (transpose (matrix-multiply xyz->rgb-matrix (transpose `((,x ,y ,z))))))) (car (transpose (matrix-multiply xyz->rgb-matrix (transpose `((,x ,y ,z)))))))

View File

@ -286,7 +286,7 @@ added get-regions
(enable-suspend #t)))]) (enable-suspend #t)))])
(unless (eq? 'eof type) (unless (eq? 'eof type)
(enable-suspend #f) (enable-suspend #f)
#; (printf "~a at ~a to ~a~n" lexeme (+ in-start-pos (sub1 new-token-start)) #; (printf "~a at ~a to ~a\n" lexeme (+ in-start-pos (sub1 new-token-start))
(+ in-start-pos (sub1 new-token-end))) (+ in-start-pos (sub1 new-token-end)))
(let ((len (- new-token-end new-token-start))) (let ((len (- new-token-end new-token-start)))
(set-lexer-state-current-pos! ls (+ len (lexer-state-current-pos ls))) (set-lexer-state-current-pos! ls (+ len (lexer-state-current-pos ls)))
@ -418,11 +418,11 @@ added get-regions
(define/private (colorer-driver) (define/private (colorer-driver)
(unless (andmap lexer-state-up-to-date? lexer-states) (unless (andmap lexer-state-up-to-date? lexer-states)
#;(printf "revision ~a~n" (get-revision-number)) #;(printf "revision ~a\n" (get-revision-number))
(unless (and tok-cor (= rev (get-revision-number))) (unless (and tok-cor (= rev (get-revision-number)))
(when tok-cor (when tok-cor
(coroutine-kill tok-cor)) (coroutine-kill tok-cor))
#;(printf "new coroutine~n") #;(printf "new coroutine\n")
(set! tok-cor (set! tok-cor
(coroutine (coroutine
(λ (enable-suspend) (λ (enable-suspend)
@ -450,19 +450,19 @@ added get-regions
(format "exception in colorer thread: ~s" exn) (format "exception in colorer thread: ~s" exn)
exn)) exn))
(set! tok-cor #f)))) (set! tok-cor #f))))
#;(printf "begin lexing~n") #;(printf "begin lexing\n")
(when (coroutine-run 10 tok-cor) (when (coroutine-run 10 tok-cor)
(for-each (lambda (ls) (for-each (lambda (ls)
(set-lexer-state-up-to-date?! ls #t)) (set-lexer-state-up-to-date?! ls #t))
lexer-states))) lexer-states)))
#;(printf "end lexing~n") #;(printf "end lexing\n")
#;(printf "begin coloring~n") #;(printf "begin coloring\n")
;; This edit sequence needs to happen even when colors is null ;; This edit sequence needs to happen even when colors is null
;; for the paren highlighter. ;; for the paren highlighter.
(begin-edit-sequence #f #f) (begin-edit-sequence #f #f)
(color) (color)
(end-edit-sequence) (end-edit-sequence)
#;(printf "end coloring~n"))) #;(printf "end coloring\n")))
(define/private (colorer-callback) (define/private (colorer-callback)
(cond (cond
@ -643,7 +643,7 @@ added get-regions
;; possible. ;; possible.
(define/private match-parens (define/private match-parens
(lambda ([just-clear? #f]) (lambda ([just-clear? #f])
;;(printf "(match-parens ~a)~n" just-clear?) ;;(printf "(match-parens ~a)\n" just-clear?)
(when (and (not in-match-parens?) (when (and (not in-match-parens?)
;; Trying to match open parens while the ;; Trying to match open parens while the
;; background thread is going slows it down. ;; background thread is going slows it down.
@ -918,21 +918,21 @@ added get-regions
(let* ((x null) (let* ((x null)
(f (λ (a b c) (set! x (cons (list a b c) x))))) (f (λ (a b c) (set! x (cons (list a b c) x)))))
(send (lexer-state-tokens ls) for-each f) (send (lexer-state-tokens ls) for-each f)
(printf "tokens: ~.s~n" (reverse x)) (printf "tokens: ~.s\n" (reverse x))
(set! x null) (set! x null)
(send (lexer-state-invalid-tokens ls) for-each f) (send (lexer-state-invalid-tokens ls) for-each f)
(printf "invalid-tokens: ~.s~n" (reverse x)) (printf "invalid-tokens: ~.s\n" (reverse x))
(printf "start-pos: ~a current-pos: ~a invalid-tokens-start ~a~n" (printf "start-pos: ~a current-pos: ~a invalid-tokens-start ~a\n"
(lexer-state-start-pos ls) (lexer-state-start-pos ls)
(lexer-state-current-pos ls) (lexer-state-current-pos ls)
(lexer-state-invalid-tokens-start ls)) (lexer-state-invalid-tokens-start ls))
(printf "parens: ~.s~n" (car (send (lexer-state-parens ls) test))))) (printf "parens: ~.s\n" (car (send (lexer-state-parens ls) test)))))
lexer-states)) lexer-states))
;; ------------------------- Callbacks to Override ---------------------- ;; ------------------------- Callbacks to Override ----------------------
(define/override (lock x) (define/override (lock x)
;;(printf "(lock ~a)~n" x) ;;(printf "(lock ~a)\n" x)
(super lock x) (super lock x)
(when (and restart-callback (not x)) (when (and restart-callback (not x))
(set! restart-callback #f) (set! restart-callback #f)
@ -940,25 +940,25 @@ added get-regions
(define/override (on-focus on?) (define/override (on-focus on?)
;;(printf "(on-focus ~a)~n" on?) ;;(printf "(on-focus ~a)\n" on?)
(super on-focus on?) (super on-focus on?)
(match-parens (not on?))) (match-parens (not on?)))
(define/augment (after-edit-sequence) (define/augment (after-edit-sequence)
;;(printf "(after-edit-sequence)~n") ;;(printf "(after-edit-sequence)\n")
(when (has-focus?) (when (has-focus?)
(match-parens)) (match-parens))
(inner (void) after-edit-sequence)) (inner (void) after-edit-sequence))
(define/augment (after-set-position) (define/augment (after-set-position)
;;(printf "(after-set-position)~n") ;;(printf "(after-set-position)\n")
(unless (local-edit-sequence?) (unless (local-edit-sequence?)
(when (has-focus?) (when (has-focus?)
(match-parens))) (match-parens)))
(inner (void) after-set-position)) (inner (void) after-set-position))
(define/augment (after-change-style a b) (define/augment (after-change-style a b)
;;(printf "(after-change-style)~n") ;;(printf "(after-change-style)\n")
(unless (get-styles-fixed) (unless (get-styles-fixed)
(unless (local-edit-sequence?) (unless (local-edit-sequence?)
(when (has-focus?) (when (has-focus?)
@ -966,19 +966,19 @@ added get-regions
(inner (void) after-change-style a b)) (inner (void) after-change-style a b))
(define/augment (on-set-size-constraint) (define/augment (on-set-size-constraint)
;;(printf "(on-set-size-constraint)~n") ;;(printf "(on-set-size-constraint)\n")
(unless (local-edit-sequence?) (unless (local-edit-sequence?)
(when (has-focus?) (when (has-focus?)
(match-parens))) (match-parens)))
(inner (void) on-set-size-constraint)) (inner (void) on-set-size-constraint))
(define/augment (after-insert edit-start-pos change-length) (define/augment (after-insert edit-start-pos change-length)
;;(printf "(after-insert ~a ~a)~n" edit-start-pos change-length) ;;(printf "(after-insert ~a ~a)\n" edit-start-pos change-length)
(do-insert/delete edit-start-pos change-length) (do-insert/delete edit-start-pos change-length)
(inner (void) after-insert edit-start-pos change-length)) (inner (void) after-insert edit-start-pos change-length))
(define/augment (after-delete edit-start-pos change-length) (define/augment (after-delete edit-start-pos change-length)
;;(printf "(after-delete ~a ~a)~n" edit-start-pos change-length) ;;(printf "(after-delete ~a ~a)\n" edit-start-pos change-length)
(do-insert/delete edit-start-pos (- change-length)) (do-insert/delete edit-start-pos (- change-length))
(inner (void) after-delete edit-start-pos change-length)) (inner (void) after-delete edit-start-pos change-length))

View File

@ -242,10 +242,10 @@
(unless (and (procedure? t) (unless (and (procedure? t)
(= 0 (procedure-arity t))) (= 0 (procedure-arity t)))
(error 'editor:basic::run-after-edit-sequence (error 'editor:basic::run-after-edit-sequence
"expected procedure of arity zero, got: ~s~n" t)) "expected procedure of arity zero, got: ~s\n" t))
(unless (or (symbol? sym) (not sym)) (unless (or (symbol? sym) (not sym))
(error 'editor:basic::run-after-edit-sequence (error 'editor:basic::run-after-edit-sequence
"expected second argument to be a symbol or #f, got: ~s~n" "expected second argument to be a symbol or #f, got: ~s\n"
sym)) sym))
(if (refresh-delayed?) (if (refresh-delayed?)
(if in-local-edit-sequence? (if in-local-edit-sequence?

View File

@ -125,7 +125,7 @@
(write-docs)) (write-docs))
(define (write-docs) (define (write-docs)
(printf "writing to ~a~n" docs-menus.ss-filename) (printf "writing to ~a\n" docs-menus.ss-filename)
(call-with-output-file docs-menus.ss-filename (call-with-output-file docs-menus.ss-filename
(λ (port) (λ (port)
(define (pop-out sexp) (define (pop-out sexp)
@ -203,7 +203,7 @@
#:exists 'truncate)) #:exists 'truncate))
(define (write-standard-menus.rkt) (define (write-standard-menus.rkt)
(printf "writing to ~a~n" standard-menus.rkt-filename) (printf "writing to ~a\n" standard-menus.rkt-filename)
(call-with-output-file standard-menus.rkt-filename (call-with-output-file standard-menus.rkt-filename
(λ (port) (λ (port)

View File

@ -44,7 +44,7 @@
[(left top) 0] [(left top) 0]
[(right bottom) (- total-size item-size)] [(right bottom) (- total-size item-size)]
[else (error 'place-children [else (error 'place-children
"alignment spec is unknown ~a~n" spec)])))]) "alignment spec is unknown ~a\n" spec)])))])
(map (λ (l) (map (λ (l)
(let*-values ([(min-width min-height h-stretch? v-stretch?) (let*-values ([(min-width min-height h-stretch? v-stretch?)
(apply values l)] (apply values l)]

View File

@ -528,7 +528,7 @@ the state transitions / contracts are:
(cond (cond
[(string? default) string?] [(string? default) string?]
[(number? default) number?] [(number? default) number?]
[else (error 'internal-error.set-default "unrecognized default: ~a~n" default)])) [else (error 'internal-error.set-default "unrecognized default: ~a\n" default)]))
(preferences:add-callback (preferences:add-callback
name name
(λ (p new-value) (λ (p new-value)

View File

@ -123,12 +123,12 @@
[(or (path? splash-draw-spec) [(or (path? splash-draw-spec)
(string? splash-draw-spec)) (string? splash-draw-spec))
(unless (file-exists? splash-draw-spec) (unless (file-exists? splash-draw-spec)
(fprintf (current-error-port) "WARNING: bitmap path ~s not found~n" splash-draw-spec) (fprintf (current-error-port) "WARNING: bitmap path ~s not found\n" splash-draw-spec)
(no-splash)) (no-splash))
(set! splash-bitmap (make-object bitmap% splash-draw-spec)) (set! splash-bitmap (make-object bitmap% splash-draw-spec))
(unless (send splash-bitmap ok?) (unless (send splash-bitmap ok?)
(fprintf (current-error-port) "WARNING: bad bitmap ~s~n" splash-draw-spec) (fprintf (current-error-port) "WARNING: bad bitmap ~s\n" splash-draw-spec)
(no-splash)) (no-splash))
(send splash-canvas min-width (send splash-bitmap get-width)) (send splash-canvas min-width (send splash-bitmap get-width))

View File

@ -363,7 +363,7 @@
(loop (- n 1))))])))] (loop (- n 1))))])))]
[(number? state) [(number? state)
(unless (send rb is-enabled? state) (unless (send rb is-enabled? state)
(error 'test:set-radio-box! "item ~a is not enabled~n" state)) (error 'test:set-radio-box! "item ~a is not enabled\n" state))
(send rb set-selection state)] (send rb set-selection state)]
[else (error 'test:set-radio-box! [else (error 'test:set-radio-box!
"expected a string or a number as second arg, got: ~e (other arg: ~e)" "expected a string or a number as second arg, got: ~e (other arg: ~e)"

View File

@ -133,7 +133,7 @@
(if (not l) (if (not l)
win win
l)))]) l)))])
(when noisy? (printf "~a~n" s)) (when noisy? (printf "~a\n" s))
(send m set-label (substring s 0 (min 200 (string-length s)))))))) (send m set-label (substring s 0 (min 200 (string-length s))))))))
(define (add-click-intercept frame panel) (define (add-click-intercept frame panel)
@ -146,7 +146,7 @@
(make-object menu-item% (format "Click on ~a" win) (make-object menu-item% (format "Click on ~a" win)
m (lambda (i e) m (lambda (i e)
(unless (eq? (send m get-popup-target) win) (unless (eq? (send m get-popup-target) win)
(printf "Wrong owner!~n")))) (printf "Wrong owner!\n"))))
(send win popup-menu m (send win popup-menu m
(inexact->exact (send e get-x)) (inexact->exact (send e get-x))
(inexact->exact (send e get-y))) (inexact->exact (send e get-y)))
@ -160,7 +160,7 @@
[cc (make-object cursor% 'cross)]) [cc (make-object cursor% 'cross)])
(make-object check-box% "Control Bullseye Cursors" panel (make-object check-box% "Control Bullseye Cursors" panel
(lambda (c e) (lambda (c e)
(printf "~a~n" e) (printf "~a\n" e)
(if (send c get-value) (if (send c get-value)
(set! old (set! old
(map (lambda (b) (map (lambda (b)
@ -200,7 +200,7 @@
(override (override
[on-demand [on-demand
(lambda () (lambda ()
(printf "Menu item ~a demanded~n" name))]) (printf "Menu item ~a demanded\n" name))])
(sequence (sequence
(apply super-init name args)))) (apply super-init name args))))
@ -239,7 +239,7 @@
(memq (send e get-event-type) (memq (send e get-event-type)
'(menu-popdown menu-popdown-none))) '(menu-popdown menu-popdown-none)))
(error "bad event object")) (error "bad event object"))
(printf "popdown ok~n")))] (printf "popdown ok\n")))]
[make-callback [make-callback
(let ([id 0]) (let ([id 0])
(lambda () (lambda ()
@ -297,7 +297,7 @@
(sequence (sequence
(apply super-init args) (apply super-init args)
(unless (ok?) (unless (ok?)
(printf "bitmap failure: ~s~n" args))))) (printf "bitmap failure: ~s\n" args)))))
(define (active-mixin %) (define (active-mixin %)
(class % (class %
@ -312,9 +312,9 @@
[on-subwindow-char (lambda args [on-subwindow-char (lambda args
(or (apply pre-on args) (or (apply pre-on args)
(super on-subwindow-char . args)))] (super on-subwindow-char . args)))]
[on-activate (lambda (on?) (printf "active: ~a~n" on?))] [on-activate (lambda (on?) (printf "active: ~a\n" on?))]
[on-move (lambda (x y) (printf "moved: ~a ~a~n" x y))] [on-move (lambda (x y) (printf "moved: ~a ~a\n" x y))]
[on-size (lambda (x y) (printf "sized: ~a ~a~n" x y))]) [on-size (lambda (x y) (printf "sized: ~a ~a\n" x y))])
(public* [set-info (public* [set-info
(lambda (ep) (lambda (ep)
(set! pre-on (add-pre-note this ep)) (set! pre-on (add-pre-note this ep))
@ -331,10 +331,10 @@
(override (override
[on-superwindow-show [on-superwindow-show
(lambda (on?) (lambda (on?)
(printf "~a ~a~n" name (if on? "show" "hide")))] (printf "~a ~a\n" name (if on? "show" "hide")))]
[on-superwindow-enable [on-superwindow-enable
(lambda (on?) (lambda (on?)
(printf "~a ~a~n" name (if on? "on" "off")))]) (printf "~a ~a\n" name (if on? "on" "off")))])
(sequence (sequence
(apply super-init name args)))) (apply super-init name args))))
@ -952,7 +952,7 @@
(compare expect v (format "label search: ~a" string))))] (compare expect v (format "label search: ~a" string))))]
[tell-ok [tell-ok
(lambda () (lambda ()
(printf "ok~n"))]) (printf "ok\n"))])
(private-field (private-field
[temp-labels? #f] [temp-labels? #f]
[use-menubar? #f] [use-menubar? #f]
@ -1180,7 +1180,7 @@
(unless (memq type types) (unless (memq type types)
(error (format "bad event type: ~a" type)))) (error (format "bad event type: ~a" type))))
(unless silent? (unless silent?
(printf "Callback Ok~n"))) (printf "Callback Ok\n")))
(define (instructions v-panel file) (define (instructions v-panel file)
(define c (make-object editor-canvas% v-panel)) (define c (make-object editor-canvas% v-panel))
@ -1216,7 +1216,7 @@
(lambda (e) (lambda (e)
(check-callback-event b b e commands #t)) (check-callback-event b b e commands #t))
old-list) old-list)
(printf "All Ok~n")))) (printf "All Ok\n"))))
(define e (make-object button% (define e (make-object button%
"Disable Test" p "Disable Test" p
(lambda (c e) (lambda (c e)
@ -1227,7 +1227,7 @@
(thread (lambda () (sleep 0.5) (semaphore-post sema))) (thread (lambda () (sleep 0.5) (semaphore-post sema)))
(yield sema) (yield sema)
(when hit? (when hit?
(printf "un-oh~n")) (printf "un-oh\n"))
(send b enable #t))))) (send b enable #t)))))
(instructions p "button-steps.txt") (instructions p "button-steps.txt")
(send f show #t)) (send f show #t))
@ -1261,7 +1261,7 @@
(lambda (e) (lambda (e)
(check-callback-event cb cb e commands #t)) (check-callback-event cb cb e commands #t))
old-list) old-list)
(printf "All Ok~n")))) (printf "All Ok\n"))))
(instructions p "checkbox-steps.txt") (instructions p "checkbox-steps.txt")
(send f show #t)) (send f show #t))
@ -1333,7 +1333,7 @@
(lambda (rbe) (lambda (rbe)
(check-callback-event (car rbe) (car rbe) (cdr rbe) commands #t)) (check-callback-event (car rbe) (car rbe) (cdr rbe) commands #t))
old-list) old-list)
(printf "All Ok~n"))) (printf "All Ok\n")))
(instructions p "radiobox-steps.txt") (instructions p "radiobox-steps.txt")
(send f show #t)) (send f show #t))
@ -1360,12 +1360,12 @@
(cond (cond
[(eq? (send e get-event-type) 'list-box-dclick) [(eq? (send e get-event-type) 'list-box-dclick)
; double-click ; double-click
(printf "Double-click~n") (printf "Double-click\n")
(unless (send cx get-selection) (unless (send cx get-selection)
(error "no selection for dclick"))] (error "no selection for dclick"))]
[else [else
; misc multi-selection ; misc multi-selection
(printf "Changed: ~a~n" (if list? (printf "Changed: ~a\n" (if list?
(send cx get-selections) (send cx get-selections)
(send cx get-selection)))]) (send cx get-selection)))])
(check-callback-event c cx e commands #f))) (check-callback-event c cx e commands #f)))
@ -1402,7 +1402,7 @@
(make-object button% (make-object button%
"Visible Indices" p "Visible Indices" p
(lambda (b e) (lambda (b e)
(printf "top: ~a~nvisible count: ~a~n" (printf "top: ~a\nvisible count: ~a\n"
(send c get-first-visible-item) (send c get-first-visible-item)
(send c number-of-visible-items)))))) (send c number-of-visible-items))))))
(define cdp (make-object horizontal-panel% p)) (define cdp (make-object horizontal-panel% p))
@ -1555,9 +1555,9 @@
(lambda (e) (lambda (e)
(check-callback-event c c e commands #t)) (check-callback-event c c e commands #t))
old-list) old-list)
(printf "content: ~s~n" actual-content) (printf "content: ~s\n" actual-content)
(when multi? (when multi?
(printf "selections: ~s~n" (send c get-selections)))))) (printf "selections: ~s\n" (send c get-selections))))))
(send c stretchable-width #t) (send c stretchable-width #t)
(instructions p "choice-list-steps.txt") (instructions p "choice-list-steps.txt")
(send f show #t)) (send f show #t))
@ -1570,7 +1570,7 @@
(define s (make-object slider% "Slide Me" -1 11 p (define s (make-object slider% "Slide Me" -1 11 p
(lambda (sl e) (lambda (sl e)
(check-callback-event s sl e commands #f) (check-callback-event s sl e commands #f)
(printf "slid: ~a~n" (send s get-value))) (printf "slid: ~a\n" (send s get-value)))
3)) 3))
(define c (make-object button% "Check" p (define c (make-object button% "Check" p
(lambda (c e) (lambda (c e)
@ -1578,7 +1578,7 @@
(lambda (e) (lambda (e)
(check-callback-event s s e commands #t)) (check-callback-event s s e commands #t))
old-list) old-list)
(printf "All Ok~n")))) (printf "All Ok\n"))))
(define (simulate v) (define (simulate v)
(let ([e (make-object control-event% 'slider)]) (let ([e (make-object control-event% 'slider)])
(send s set-value v) (send s set-value v)
@ -1634,13 +1634,13 @@
(define (handler get-this) (define (handler get-this)
(lambda (c e) (lambda (c e)
(unless (eq? c (get-this)) (unless (eq? c (get-this))
(printf "callback: bad item: ~a~n" c)) (printf "callback: bad item: ~a\n" c))
(let ([t (send e get-event-type)]) (let ([t (send e get-event-type)])
(cond (cond
[(eq? t 'text-field) [(eq? t 'text-field)
(printf "Changed: ~a~n" (send c get-value))] (printf "Changed: ~a\n" (send c get-value))]
[(eq? t 'text-field-enter) [(eq? t 'text-field-enter)
(printf "Return: ~a~n" (send c get-value))])))) (printf "Return: ~a\n" (send c get-value))]))))
(define f (make-frame frame% "Text Test")) (define f (make-frame frame% "Text Test"))
(define p (make-object vertical-panel% f)) (define p (make-object vertical-panel% f))
@ -1701,7 +1701,7 @@
(send f set-status-text s)))] (send f set-status-text s)))]
[on-scroll [on-scroll
(lambda (e) (lambda (e)
(when auto? (printf "Hey - on-scroll called for auto scrollbars~n")) (when auto? (printf "Hey - on-scroll called for auto scrollbars\n"))
(unless incremental? (on-paint)))] (unless incremental? (on-paint)))]
[init-auto-scrollbars (lambda x [init-auto-scrollbars (lambda x
(set! auto? #t) (set! auto? #t)
@ -1877,7 +1877,7 @@
(let ([c (car (send p get-children))]) (let ([c (car (send p get-children))])
(let-values ([(w h) (send c get-size)] (let-values ([(w h) (send c get-size)]
[(cw ch) (send c get-client-size)]) [(cw ch) (send c get-client-size)])
(printf "~a: (~a x ~a) client[~a x ~a] diff<~a x ~a> min{~a x ~a}~n" (printf "~a: (~a x ~a) client[~a x ~a] diff<~a x ~a> min{~a x ~a}\n"
c w h cw ch c w h cw ch
(- w cw) (- h ch) (- w cw) (- h ch)
(send c min-width) (send c min-height))))) (send c min-width) (send c min-height)))))
@ -1962,7 +1962,7 @@
(make-object button% "Rename" p2 (lambda (b e) (make-object button% "Rename" p2 (lambda (b e)
(send p set-item-label (quotient (send p get-number) 2) "Do&nut"))) (send p set-item-label (quotient (send p get-number) 2) "Do&nut")))
(make-object button% "Labels" p2 (lambda (b e) (make-object button% "Labels" p2 (lambda (b e)
(printf "~s~n" (printf "~s\n"
(reverse (reverse
(let loop ([i (send p get-number)]) (let loop ([i (send p get-number)])
(if (zero? i) (if (zero? i)
@ -2000,10 +2000,10 @@
(define (message-boxes parent) (define (message-boxes parent)
(define (check expected got) (define (check expected got)
(unless (eq? expected got) (unless (eq? expected got)
(fprintf (current-error-port) "bad result: - expected ~e, got ~e~n" (fprintf (current-error-port) "bad result: - expected ~e, got ~e\n"
expected got))) expected got)))
(define (big s) (define (big s)
(format "~a~n~a~n~a~n~a~n" s (format "~a\n~a\n~a\n~a\n" s
(make-string 500 #\x) (make-string 500 #\x)
(make-string 500 #\x) (make-string 500 #\x)
(make-string 500 #\x))) (make-string 500 #\x)))

View File

@ -39,7 +39,7 @@
(test (list s) 'yield-wrapped (yield (wrap-evt s (lambda (v) (list v)))))) (test (list s) 'yield-wrapped (yield (wrap-evt s (lambda (v) (list v))))))
(define (enable-tests f) (define (enable-tests f)
(printf "Enable ~a~n" f) (printf "Enable ~a\n" f)
(st #t f is-enabled?) (st #t f is-enabled?)
(stv f enable #f) (stv f enable #f)
(st #f f is-enabled?) (st #f f is-enabled?)
@ -47,7 +47,7 @@
(st #t f is-enabled?)) (st #t f is-enabled?))
(define (drop-file-tests f) (define (drop-file-tests f)
(printf "Drop File ~a~n" f) (printf "Drop File ~a\n" f)
(st #f f accept-drop-files) (st #f f accept-drop-files)
(stv f accept-drop-files #t) (stv f accept-drop-files #t)
(st #t f accept-drop-files) (st #t f accept-drop-files)
@ -55,7 +55,7 @@
(st #f f accept-drop-files)) (st #f f accept-drop-files))
(define (client->screen-tests f) (define (client->screen-tests f)
(printf "Client<->Screen ~a~n" f) (printf "Client<->Screen ~a\n" f)
(let-values ([(x y) (send f client->screen 0 0)]) (let-values ([(x y) (send f client->screen 0 0)])
(stvals '(0 0) f screen->client x y)) (stvals '(0 0) f screen->client x y))
(let-values ([(x y) (send f screen->client 0 0)]) (let-values ([(x y) (send f screen->client 0 0)])
@ -66,7 +66,7 @@
(stv f refresh)) (stv f refresh))
(define (area-tests f sw? sh? no-stretch?) (define (area-tests f sw? sh? no-stretch?)
(printf "Area ~a~n" f) (printf "Area ~a\n" f)
(let ([x (send f min-width)] (let ([x (send f min-width)]
[y (send f min-height)]) [y (send f min-height)])
(st sw? f stretchable-width) (st sw? f stretchable-width)
@ -76,7 +76,7 @@
(let-values ([(w h) (if no-stretch? (let-values ([(w h) (if no-stretch?
(send f get-size) (send f get-size)
(values 0 0))]) (values 0 0))])
(printf "Size ~a x ~a~n" w h) (printf "Size ~a x ~a\n" w h)
(when no-stretch? (when no-stretch?
(stv f min-width w) ; when we turn of stretchability, don't resize (stv f min-width w) ; when we turn of stretchability, don't resize
(stv f min-height h)) (stv f min-height h))
@ -95,7 +95,7 @@
(define (containee-tests f sw? sh? m) (define (containee-tests f sw? sh? m)
(area-tests f sw? sh? #f) (area-tests f sw? sh? #f)
(printf "Containee ~a~n" f) (printf "Containee ~a\n" f)
(st m f horiz-margin) (st m f horiz-margin)
(st m f vert-margin) (st m f vert-margin)
(stv f horiz-margin 3) (stv f horiz-margin 3)
@ -108,14 +108,14 @@
(stv f vert-margin m)) (stv f vert-margin m))
(define (container-tests f win?) (define (container-tests f win?)
(printf "Container ~a~n" f) (printf "Container ~a\n" f)
(let-values ([(x y) (send f get-alignment)]) (let-values ([(x y) (send f get-alignment)])
(stv f set-alignment 'right 'bottom) (stv f set-alignment 'right 'bottom)
(stvals '(right bottom) f get-alignment) (stvals '(right bottom) f get-alignment)
(stv f set-alignment x y))) (stv f set-alignment x y)))
(define (cursor-tests f) (define (cursor-tests f)
(printf "Cursor ~a~n" f) (printf "Cursor ~a\n" f)
(let ([c (send f get-cursor)]) (let ([c (send f get-cursor)])
(stv f set-cursor c) (stv f set-cursor c)
(st c f get-cursor) (st c f get-cursor)
@ -131,7 +131,7 @@
(define (show-tests f) (define (show-tests f)
(unless (is-a? f dialog%) (unless (is-a? f dialog%)
(printf "Show ~a~n" f) (printf "Show ~a\n" f)
(let ([on? (send f is-shown?)]) (let ([on? (send f is-shown?)])
(stv f show #f) (stv f show #f)
(when on? (when on?
@ -193,7 +193,7 @@
(st #f f get-menu-bar))] (st #f f get-menu-bar))]
[space-tests [space-tests
(lambda () (lambda ()
(printf "Spacing~n") (printf "Spacing\n")
(let ([b (send f border)]) (let ([b (send f border)])
(stv f border 25) (stv f border 25)
(st 25 f border) (st 25 f border)
@ -209,14 +209,14 @@
(drop-file-tests f))] (drop-file-tests f))]
[client->screen-tests [client->screen-tests
(lambda () (lambda ()
(printf "Client<->Screen~n") (printf "Client<->Screen\n")
(let-values ([(x y) (send f client->screen 0 0)]) (let-values ([(x y) (send f client->screen 0 0)])
(stvals '(0 0) f screen->client x y)) (stvals '(0 0) f screen->client x y))
(let-values ([(x y) (send f screen->client 0 0)]) (let-values ([(x y) (send f screen->client 0 0)])
(stvals '(0 0) f client->screen x y)))] (stvals '(0 0) f client->screen x y)))]
[container-tests [container-tests
(lambda () (lambda ()
(printf "Container~n") (printf "Container\n")
(area-tests f #t #t #t) (area-tests f #t #t #t)
(let-values ([(x y) (send f container-size null)]) (let-values ([(x y) (send f container-size null)])
(st x f min-width) (st x f min-width)
@ -238,15 +238,15 @@
(container-tests) (container-tests)
(cursor-tests) (cursor-tests)
(printf "Init~n") (printf "Init\n")
(init-tests #f) (init-tests #f)
(stv f show #t) (stv f show #t)
(pause) (pause)
(printf "Show Init~n") (printf "Show Init\n")
(init-tests #t) (init-tests #t)
(stv f show #f) (stv f show #f)
(pause) (pause)
(printf "Hide Init~n") (printf "Hide Init\n")
(init-tests #f) (init-tests #f)
(send f show #t) (send f show #t)
(pause) (pause)
@ -258,7 +258,7 @@
(stv f change-children values) (stv f change-children values)
(printf "Iconize~n") (printf "Iconize\n")
(stv f iconize #t) (stv f iconize #t)
(pause) (pause)
(pause) (pause)
@ -272,7 +272,7 @@
(stv f maximize #f) (stv f maximize #f)
(pause) (pause)
(printf "Move~n") (printf "Move\n")
(stv f move 34 37) (stv f move 34 37)
(pause) (pause)
(FAILS (st 34 f get-x)) (FAILS (st 34 f get-x))
@ -280,7 +280,7 @@
(st 150 f get-width) (st 150 f get-width)
(st 151 f get-height) (st 151 f get-height)
(printf "Resize~n") (printf "Resize\n")
(stv f resize 56 57) (stv f resize 56 57)
(pause) (pause)
(FAILS (st 34 f get-x)) (FAILS (st 34 f get-x))
@ -306,7 +306,7 @@
(cursor-tests) (cursor-tests)
(printf "Menu Bar~n") (printf "Menu Bar\n")
(let ([mb (make-object menu-bar% f)]) (let ([mb (make-object menu-bar% f)])
(st mb f get-menu-bar) (st mb f get-menu-bar)
(st f mb get-frame) (st f mb get-frame)
@ -320,11 +320,11 @@
(st null mb get-items) (st null mb get-items)
(printf "Menu 1~n") (printf "Menu 1\n")
(let* ([m (make-object menu% "&File" mb)] (let* ([m (make-object menu% "&File" mb)]
[i m] [i m]
[delete-enable-test (lambda (i parent empty) [delete-enable-test (lambda (i parent empty)
(printf "Item~n") (printf "Item\n")
(st #f i is-deleted?) (st #f i is-deleted?)
(st #t i is-enabled?) (st #t i is-enabled?)
@ -371,7 +371,7 @@
(st null m get-items) (st null m get-items)
(printf "Menu Items~n") (printf "Menu Items\n")
(let ([i1 (make-object menu-item% "&Plain" m (let ([i1 (make-object menu-item% "&Plain" m
(lambda (i e) (lambda (i e)
(test-control-event e '(menu)) (test-control-event e '(menu))
@ -391,7 +391,7 @@
(lambda (i empty name) (lambda (i empty name)
(delete-enable-test i m empty) (delete-enable-test i m empty)
(printf "Shortcut~n") (printf "Shortcut\n")
(set! hit i) (set! hit i)
(stv i command (make-object control-event% 'menu)) (stv i command (make-object control-event% 'menu))
(test name 'hit-command hit) (test name 'hit-command hit)
@ -437,7 +437,7 @@
'done) 'done)
(printf "Menu 2~n") (printf "Menu 2\n")
(let* ([m2 (make-object menu% "&Edit" mb "Help Edit")] (let* ([m2 (make-object menu% "&Edit" mb "Help Edit")]
[i2 m2]) [i2 m2])
(st (list i i2) mb get-items) (st (list i i2) mb get-items)
@ -468,7 +468,7 @@
(define (test-controls parent frame) (define (test-controls parent frame)
(define side-effect #f) (define side-effect #f)
(printf "Buttons~n") (printf "Buttons\n")
(letrec ([b (make-object button% (letrec ([b (make-object button%
"&Button" "&Button"
parent parent
@ -484,7 +484,7 @@
(containee-window-tests b #f #f parent frame 2)) (containee-window-tests b #f #f parent frame 2))
(printf "Check Box~n") (printf "Check Box\n")
(letrec ([c (make-object check-box% (letrec ([c (make-object check-box%
"&Check Box" "&Check Box"
parent parent
@ -511,7 +511,7 @@
#t)]) #t)])
(st #t c get-value)) (st #t c get-value))
(printf "Radio Box~n") (printf "Radio Box\n")
(letrec ([r (make-object radio-box% (letrec ([r (make-object radio-box%
"&Radio Box" "&Radio Box"
(list "O&ne" "T&wo" "T&hree") (list "O&ne" "T&wo" "T&hree")
@ -586,7 +586,7 @@
'(vertical) '(vertical)
3)) 3))
(printf "Gauge~n") (printf "Gauge\n")
(letrec ([g (make-object gauge% (letrec ([g (make-object gauge%
"&Gauge" "&Gauge"
10 10
@ -618,7 +618,7 @@
(containee-window-tests g #t #f parent frame 2)) (containee-window-tests g #t #f parent frame 2))
(printf "Slider~n") (printf "Slider\n")
(letrec ([s (make-object slider% (letrec ([s (make-object slider%
"&Slider" "&Slider"
-2 8 -2 8
@ -774,7 +774,7 @@
'done-list)]) 'done-list)])
(printf "Choice~n") (printf "Choice\n")
(letrec ([c (make-object choice% (letrec ([c (make-object choice%
"&Choice" "&Choice"
'("A" "B" "C & D") '("A" "B" "C & D")
@ -808,7 +808,7 @@
(let ([mk-list (let ([mk-list
(lambda (style) (lambda (style)
(printf "List Box: ~a~n" style) (printf "List Box: ~a\n" style)
(letrec ([l (make-object list-box% (letrec ([l (make-object list-box%
"&List Box" "&List Box"
'("A" "B" "C & D") '("A" "B" "C & D")
@ -869,7 +869,7 @@
(let ([c (make-object canvas% parent '(hscroll vscroll))]) (let ([c (make-object canvas% parent '(hscroll vscroll))])
(printf "Tab Focus~n") (printf "Tab Focus\n")
(st #f c accept-tab-focus) (st #f c accept-tab-focus)
(stv c accept-tab-focus #t) (stv c accept-tab-focus #t)
(st #t c accept-tab-focus) (st #t c accept-tab-focus)
@ -880,7 +880,7 @@
; (stv c set-scrollbars 100 101 5 6 2 3 10 20 #t) ; (stv c set-scrollbars 100 101 5 6 2 3 10 20 #t)
(let-values ([(w h) (send c get-virtual-size)] (let-values ([(w h) (send c get-virtual-size)]
[(cw ch) (send c get-client-size)]) [(cw ch) (send c get-client-size)])
(printf "Canvas size: Virtual: ~a x ~a Client: ~a x ~a~n" w h cw ch) (printf "Canvas size: Virtual: ~a x ~a Client: ~a x ~a\n" w h cw ch)
(let ([check-scroll (let ([check-scroll
(lambda (xpos ypos) (lambda (xpos ypos)
(let-values ([(x y) (send c get-view-start)]) (let-values ([(x y) (send c get-view-start)])
@ -958,7 +958,7 @@
102)]) 102)])
(let loop ([n 100]) (let loop ([n 100])
(unless (zero? n) (unless (zero? n)
(send e insert (format "line ~a~n" n)) (send e insert (format "line ~a\n" n))
(loop (sub1 n)))) (loop (sub1 n))))
(st #f c allow-scroll-to-last) (st #f c allow-scroll-to-last)