move the standard viewer to a seperate module

This commit is contained in:
eknauel 2005-05-31 11:20:20 +00:00
parent 6e72d5abd4
commit 7b9b6c3e66
3 changed files with 38 additions and 31 deletions

View File

@ -913,34 +913,3 @@
(lp (cdr chars) (string-append token (string (car chars)))
tokens (+ i 1)))))))
(define (make-standard-viewer)
(let ((x 1)
(y 1)
(text "")
(value #f))
(lambda (message)
(cond
((eq? message 'init)
(lambda (self new-value buffer)
(set! value new-value)
(set! text
(layout-result-standard
(exp->string value)
(result-buffer-num-cols buffer)))
self))
((eq? message 'paint)
(lambda (self win buffer have-focus?)
;; #### get rid of this cruft
((make-simple-result-buffer-printer y x text '() '())
win buffer have-focus?)))
((eq? message 'key-press)
(lambda (self . ignore)
self))))))
(define standard-view-plugin
(make-view-plugin make-standard-viewer
(lambda (val) #t)))

View File

@ -120,6 +120,14 @@
plugin)
(files std-command))
(define-structure standard-viewer
(export make-standard-viewer)
(open scheme
objects
layout)
(files std-viewer))
;;; fs-objects
(define-interface fs-object-interface
@ -305,6 +313,7 @@
inspect-exception
rt-modules
tty-debug
fs-object
objects
plugin
@ -319,6 +328,7 @@
dirlist-view-plugin
process-viewer
standard-command-plugin
standard-viewer
nuit-inspector-plugin)
(files nuit-engine))

28
scheme/std-viewer.scm Normal file
View File

@ -0,0 +1,28 @@
(define (make-standard-viewer)
(let ((x 1)
(y 1)
(text "")
(value #f))
(lambda (message)
(cond
((eq? message 'init)
(lambda (self new-value buffer)
(set! value new-value)
(set! text
(layout-result-standard
(exp->string value)
(result-buffer-num-cols buffer)))
self))
((eq? message 'paint)
(lambda (self win buffer have-focus?)
;; #### get rid of this cruft
((make-simple-result-buffer-printer y x text '() '())
win buffer have-focus?)))
((eq? message 'key-press)
(lambda (self . ignore)
self))))))