2004-10-10 09:22:25 -04:00
|
|
|
;; ,load /home/demattia/studium/studienarbeit/scsh-nuit/scheme/nuit-engine.scm
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define-syntax when
|
|
|
|
(syntax-rules ()
|
|
|
|
((_ ?test ?do-this ...)
|
|
|
|
(if ?test
|
|
|
|
(begin ?do-this ... (values))
|
|
|
|
(values)))))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;This is the "heart" of NUIT.
|
|
|
|
;;In a central loop the program waits for input (with wgetch).
|
|
|
|
;;In the upper buffer simply the functionalities of scsh-ncurses:
|
|
|
|
;;input-buffer are used.
|
|
|
|
;;The lower window is meant to be used more flexible. Depending on
|
|
|
|
;;the active command the key-inputs are routed to the correct receiver,
|
|
|
|
;;where one can specify how to react.
|
2004-09-14 07:54:00 -04:00
|
|
|
|
|
|
|
;;*************************************************************************
|
2004-10-06 09:00:59 -04:00
|
|
|
;;State
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
(define-record-type app-window :app-window
|
|
|
|
(make-app-window x y width height curses-win)
|
|
|
|
app-window?
|
|
|
|
(x app-window-x)
|
|
|
|
(y app-window-y)
|
|
|
|
(width app-window-width)
|
|
|
|
(height app-window-height)
|
|
|
|
(curses-win app-window-curses-win set-app-window-curses-win!))
|
|
|
|
|
2005-05-18 11:47:28 -04:00
|
|
|
(define-record-discloser :app-window
|
|
|
|
(lambda (rec)
|
|
|
|
`(app-window
|
|
|
|
(x ,(app-window-x rec)) (y ,(app-window-y rec))
|
|
|
|
(w ,(app-window-width rec)) (h ,(app-window-height rec)))))
|
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
(define bar-1 #f)
|
2005-05-22 05:20:44 -04:00
|
|
|
(define active-command-window #f)
|
2005-05-19 09:59:52 -04:00
|
|
|
|
2005-05-17 11:02:01 -04:00
|
|
|
(define command-frame-window #f)
|
2005-05-10 15:37:54 -04:00
|
|
|
(define command-window #f)
|
2005-05-19 09:59:52 -04:00
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
(define result-window #f)
|
2005-05-19 09:59:52 -04:00
|
|
|
(define result-frame-window #f)
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define key-control-x 24)
|
|
|
|
(define key-o 111)
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;state of the upper window (Command-Window)
|
2005-05-11 09:30:51 -04:00
|
|
|
(define command-buffer
|
|
|
|
(make-buffer '("Welcome to the scsh-ncurses-ui!" "")
|
2005-05-17 11:02:01 -04:00
|
|
|
2 2 2 1 1
|
2005-05-11 09:30:51 -04:00
|
|
|
0 0
|
|
|
|
#t 1))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;state of the lower window (Result-Window)
|
|
|
|
;;----------------------------
|
2004-09-14 07:54:00 -04:00
|
|
|
;;Text
|
2004-10-10 09:22:25 -04:00
|
|
|
(define text-result (list "Type 'shortcuts' for help"))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;line of the result-window
|
2004-10-03 05:13:30 -04:00
|
|
|
(define pos-result 0)
|
2004-10-06 09:00:59 -04:00
|
|
|
|
|
|
|
;;column
|
2004-10-03 05:13:30 -04:00
|
|
|
(define pos-result-col 0)
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;y-coordinate of the cursor in the result-buffer
|
2004-10-03 05:13:30 -04:00
|
|
|
(define result-buffer-pos-y 0)
|
2004-10-06 09:00:59 -04:00
|
|
|
|
|
|
|
;;x-coordinate of the cursor in the result-buffer
|
2004-10-03 05:13:30 -04:00
|
|
|
(define result-buffer-pos-x 0)
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;lines of the lower window
|
2004-09-14 07:54:00 -04:00
|
|
|
(define result-lines 0)
|
2004-10-06 09:00:59 -04:00
|
|
|
|
|
|
|
;;columns in the lower window
|
2004-09-14 07:54:00 -04:00
|
|
|
(define result-cols 0)
|
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;lines to be highlighted
|
2004-10-03 05:13:30 -04:00
|
|
|
(define highlighted-lines '())
|
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;lines to be marked
|
2004-10-03 05:13:30 -04:00
|
|
|
(define marked-lines '())
|
2004-10-06 09:00:59 -04:00
|
|
|
|
|
|
|
;;miscelaneous state
|
2004-09-14 07:54:00 -04:00
|
|
|
;;-------------------
|
|
|
|
|
2005-05-11 02:54:03 -04:00
|
|
|
(define *focus-buffer* 'command-buffer)
|
|
|
|
|
|
|
|
(define (focus-on-command-buffer?)
|
|
|
|
(eq? *focus-buffer* 'command-buffer))
|
|
|
|
|
|
|
|
(define (focus-command-buffer!)
|
|
|
|
(set! *focus-buffer* 'command-buffer))
|
|
|
|
|
|
|
|
(define (focus-on-result-buffer?)
|
|
|
|
(eq? *focus-buffer* 'result-buffer))
|
|
|
|
|
|
|
|
(define (focus-result-buffer!)
|
|
|
|
(set! *focus-buffer* 'result-buffer))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2005-05-23 09:03:45 -04:00
|
|
|
;; mode of the command buffer
|
|
|
|
(define *command-buffer-mode* 'scheme)
|
|
|
|
|
|
|
|
(define (command-buffer-in-scheme-mode?)
|
|
|
|
(eq? *command-buffer-mode* 'scheme))
|
|
|
|
|
|
|
|
(define (command-buffer-in-command-mode?)
|
|
|
|
(eq? *command-buffer-mode* 'command))
|
|
|
|
|
|
|
|
(define (enter-scheme-mode!)
|
|
|
|
(set! *command-buffer-mode* 'scheme))
|
|
|
|
|
|
|
|
(define (enter-command-mode!)
|
|
|
|
(set! *command-buffer-mode* 'command))
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
;; History
|
2004-09-20 04:09:54 -04:00
|
|
|
|
|
|
|
(define history-pos 0)
|
2005-05-22 05:20:44 -04:00
|
|
|
(define the-history (make-empty-history))
|
|
|
|
|
|
|
|
(define (history) the-history)
|
|
|
|
|
|
|
|
(define *current-history-item* #f)
|
2004-09-20 04:09:54 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (current-history-item)
|
|
|
|
*current-history-item*)
|
|
|
|
|
|
|
|
(define-record-type history-entry :history-entry
|
2005-05-22 11:05:25 -04:00
|
|
|
(make-history-entry command args result plugin)
|
2004-10-03 05:13:30 -04:00
|
|
|
history-entry?
|
|
|
|
(command history-entry-command)
|
2005-05-22 05:20:44 -04:00
|
|
|
(args history-entry-args)
|
|
|
|
(result history-entry-result set-history-entry-result!)
|
2005-05-22 11:05:25 -04:00
|
|
|
(plugin history-entry-plugin))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (current-history-entry-selector-maker selector)
|
|
|
|
(lambda ()
|
|
|
|
(cond
|
|
|
|
((current-history-item)
|
|
|
|
=> (lambda (entry)
|
|
|
|
(selector (entry-data entry))))
|
|
|
|
(else #f))))
|
2004-09-20 04:09:54 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define active-command
|
|
|
|
(current-history-entry-selector-maker history-entry-command))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define active-command-arguments
|
|
|
|
(current-history-entry-selector-maker history-entry-args))
|
|
|
|
|
|
|
|
(define current-result
|
|
|
|
(current-history-entry-selector-maker history-entry-result))
|
|
|
|
|
|
|
|
(define (update-current-result! new-value)
|
|
|
|
(cond
|
|
|
|
((current-history-item)
|
|
|
|
=> (lambda (entry)
|
2005-05-22 11:05:25 -04:00
|
|
|
(set-history-entry-result! (entry-data entry) new-value)))
|
2005-05-22 05:20:44 -04:00
|
|
|
(else (values))))
|
|
|
|
|
|
|
|
(define (append-to-history! history-entry)
|
|
|
|
(append-history-item! the-history history-entry)
|
|
|
|
(set! *current-history-item*
|
|
|
|
(history-last-entry the-history)))
|
|
|
|
|
|
|
|
;; one step back in the history
|
|
|
|
(define (history-back!)
|
|
|
|
(cond
|
|
|
|
((and (current-history-item)
|
|
|
|
(history-prev-entry (current-history-item)))
|
|
|
|
=> (lambda (prev)
|
|
|
|
(set! *current-history-item* prev)))
|
|
|
|
(else (values))))
|
|
|
|
|
|
|
|
;; one step forward
|
|
|
|
(define (history-forward!)
|
|
|
|
(cond
|
|
|
|
((and *current-history-item*
|
|
|
|
(history-next-entry *current-history-item*))
|
|
|
|
=> (lambda (next)
|
|
|
|
(set! *current-history-item* next)))
|
|
|
|
(else (values))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-10 09:22:25 -04:00
|
|
|
;;active keyboard-interrupt:
|
|
|
|
;;after each input this is set to #f.
|
|
|
|
;;If a keyboard-interrupt occurs this can be checked by looking-up this box
|
|
|
|
(define active-keyboard-interrupt #f)
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-20 11:20:34 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;The "user" (who extends the functionality of NUIT) has to inform NUIT
|
|
|
|
;;about which function is meant to be the receiver, when a certain
|
|
|
|
;;command is active
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2004-09-14 07:54:00 -04:00
|
|
|
;;*************************************************************************
|
2004-10-06 09:00:59 -04:00
|
|
|
;;Actions
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-10 09:22:25 -04:00
|
|
|
;;start the whole thing
|
2005-05-10 15:37:54 -04:00
|
|
|
(define (nuit)
|
2005-05-18 11:25:16 -04:00
|
|
|
(let ((tty-name (init-tty-debug-output!)))
|
|
|
|
(display "Debug messages will be on ")
|
|
|
|
(display tty-name)
|
|
|
|
(newline))
|
2005-05-17 05:22:07 -04:00
|
|
|
(with-inspecting-handler
|
|
|
|
8888
|
|
|
|
(lambda (condition)
|
|
|
|
(with-current-output-port*
|
|
|
|
(error-output-port)
|
|
|
|
(lambda ()
|
|
|
|
(display "starting remote handler for condition")
|
|
|
|
(display condition)
|
|
|
|
(newline)
|
|
|
|
(display "Please connect to port 8888")
|
|
|
|
(newline)
|
|
|
|
#t)))
|
|
|
|
run))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (toggle-buffer-focus)
|
|
|
|
(cond
|
|
|
|
((focus-on-command-buffer?)
|
|
|
|
(focus-result-buffer!)
|
|
|
|
(refresh-result-window))
|
|
|
|
(else
|
|
|
|
(focus-command-buffer!)
|
|
|
|
(move-cursor command-buffer)
|
|
|
|
(refresh-command-window))))
|
|
|
|
|
2005-05-23 09:03:45 -04:00
|
|
|
(define (toggle-command/scheme-mode)
|
|
|
|
(cond
|
|
|
|
((command-buffer-in-command-mode?)
|
|
|
|
(enter-scheme-mode!))
|
|
|
|
((command-buffer-in-scheme-mode?)
|
|
|
|
(enter-command-mode!)))
|
|
|
|
(paint-command-frame-window)
|
|
|
|
(paint-command-window-contents)
|
|
|
|
(move-cursor command-buffer)
|
|
|
|
(refresh-command-window))
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
;; handle input
|
2005-05-10 15:37:54 -04:00
|
|
|
(define (run)
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2005-05-18 11:47:28 -04:00
|
|
|
(init-windows!)
|
2005-05-10 15:37:54 -04:00
|
|
|
'(set-interrupt-handler interrupt/keyboard
|
|
|
|
(lambda a
|
|
|
|
(set! active-keyboard-interrupt a)))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
;;Loop
|
|
|
|
(paint)
|
2005-05-22 05:20:44 -04:00
|
|
|
(let loop ((ch (wait-for-input)) (c-x-pressed? #f))
|
2005-05-10 15:37:54 -04:00
|
|
|
(cond
|
2005-05-22 05:20:44 -04:00
|
|
|
|
|
|
|
;; Ctrl-x -> wait for next input
|
|
|
|
((= ch key-control-x)
|
|
|
|
(loop (wait-for-input) #t))
|
|
|
|
|
2005-05-23 09:03:45 -04:00
|
|
|
;; F7 toggle scheme-mode / command-mode (FIXME: find a better key)
|
|
|
|
((= ch key-f7)
|
|
|
|
(toggle-command/scheme-mode)
|
|
|
|
(loop (wait-for-input) #f))
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
;; C-x o --- toggle buffer focus
|
|
|
|
((and c-x-pressed? (= ch key-o))
|
|
|
|
(toggle-buffer-focus)
|
|
|
|
(loop (wait-for-input) #f))
|
|
|
|
|
|
|
|
((and c-x-pressed? (focus-on-result-buffer?))
|
|
|
|
(let ((key-message
|
|
|
|
(make-key-pressed-message
|
|
|
|
(active-command) (current-result)
|
|
|
|
ch key-control-x)))
|
|
|
|
(update-current-result!
|
|
|
|
(post-message
|
2005-05-22 11:05:25 -04:00
|
|
|
(history-entry-plugin (entry-data (current-history-item)))
|
2005-05-22 05:20:44 -04:00
|
|
|
key-message))
|
|
|
|
(loop (wait-for-input) #f)))
|
|
|
|
|
|
|
|
;; C-x r --- redo
|
|
|
|
((and c-x-pressed? (focus-on-command-buffer?)
|
|
|
|
(= ch 114))
|
|
|
|
(debug-message "Eric should re-implement redo..."))
|
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
((= ch key-f1)
|
2005-05-22 05:20:44 -04:00
|
|
|
(endwin))
|
2005-05-10 15:37:54 -04:00
|
|
|
|
|
|
|
((= ch key-f2)
|
2005-05-22 05:20:44 -04:00
|
|
|
(paint)
|
|
|
|
(loop (wait-for-input) c-x-pressed?))
|
2005-05-19 09:59:52 -04:00
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
;; forward in result history
|
|
|
|
((= ch key-npage)
|
2005-05-22 05:20:44 -04:00
|
|
|
(history-forward!)
|
|
|
|
(when (current-history-item)
|
|
|
|
(paint-active-command-window)
|
|
|
|
(paint-result-window (entry-data (current-history-item))))
|
2005-05-19 09:59:52 -04:00
|
|
|
(refresh-result-window)
|
2005-05-22 05:20:44 -04:00
|
|
|
(loop (wait-for-input) c-x-pressed?))
|
2005-05-10 15:37:54 -04:00
|
|
|
|
|
|
|
;; back in result history
|
|
|
|
((= ch key-ppage)
|
2005-05-22 05:20:44 -04:00
|
|
|
(history-back!)
|
|
|
|
(when (current-history-item)
|
|
|
|
(paint-active-command-window)
|
|
|
|
(paint-result-window (entry-data (current-history-item))))
|
2005-05-19 09:59:52 -04:00
|
|
|
(refresh-result-window)
|
2005-05-22 05:20:44 -04:00
|
|
|
(loop (wait-for-input) c-x-pressed?))
|
|
|
|
|
|
|
|
((= ch 10)
|
|
|
|
(let ((command (last (buffer-text command-buffer))))
|
2005-05-22 11:05:25 -04:00
|
|
|
(if (not (string=? command ""))
|
|
|
|
(call-with-values
|
|
|
|
(lambda ()
|
|
|
|
(execute-command command))
|
|
|
|
(lambda (result plugin)
|
|
|
|
(let ((new-entry
|
|
|
|
(make-history-entry command '()
|
|
|
|
result plugin)))
|
|
|
|
(append-to-history! new-entry)
|
|
|
|
(buffer-text-append-new-line! command-buffer)
|
|
|
|
(paint-result-window new-entry)
|
|
|
|
(paint-active-command-window)
|
|
|
|
(scroll-command-buffer)
|
|
|
|
(paint-command-window-contents)
|
|
|
|
(move-cursor command-buffer)
|
|
|
|
(refresh-result-window)
|
|
|
|
(refresh-command-window)
|
|
|
|
(loop (wait-for-input) c-x-pressed?))))
|
|
|
|
(loop (wait-for-input) #f))))
|
2005-05-22 05:20:44 -04:00
|
|
|
|
|
|
|
(else
|
2005-05-22 11:05:25 -04:00
|
|
|
(cond
|
|
|
|
((focus-on-result-buffer?)
|
|
|
|
(when (current-history-item)
|
|
|
|
(update-current-result!
|
|
|
|
(post-message
|
|
|
|
(history-entry-plugin (entry-data (current-history-item)))
|
|
|
|
(make-key-pressed-message
|
|
|
|
(active-command) (current-result)
|
|
|
|
ch c-x-pressed?)))
|
|
|
|
(paint-result-window (entry-data (current-history-item)))
|
|
|
|
(refresh-result-window))
|
|
|
|
(loop (wait-for-input) #f))
|
|
|
|
(else
|
|
|
|
(input command-buffer ch)
|
|
|
|
(werase (app-window-curses-win command-window))
|
|
|
|
(print-command-buffer (app-window-curses-win command-window)
|
|
|
|
command-buffer)
|
|
|
|
(move-cursor command-buffer)
|
|
|
|
(refresh-command-window)
|
|
|
|
(loop (wait-for-input) c-x-pressed?)))))))
|
2005-05-10 15:37:54 -04:00
|
|
|
|
|
|
|
(define (window-init-curses-win! window)
|
|
|
|
(set-app-window-curses-win!
|
|
|
|
window
|
|
|
|
(newwin (app-window-height window) (app-window-width window)
|
|
|
|
(app-window-y window) (app-window-x window))))
|
|
|
|
|
2005-05-19 09:59:52 -04:00
|
|
|
(define (make-inlying-app-window outer-window)
|
|
|
|
(make-app-window (+ (app-window-x outer-window) 1)
|
|
|
|
(+ (app-window-y outer-window) 1)
|
|
|
|
(- (app-window-width outer-window) 2)
|
|
|
|
(- (app-window-height outer-window) 2)
|
|
|
|
#f))
|
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
(define (init-windows!)
|
2005-05-10 12:06:06 -04:00
|
|
|
(init-screen)
|
2005-05-10 15:37:54 -04:00
|
|
|
(set! bar-1
|
|
|
|
(make-app-window 1 1
|
|
|
|
(- (COLS) 2) 2
|
|
|
|
#f))
|
2005-05-22 05:20:44 -04:00
|
|
|
(set! active-command-window
|
2005-05-10 15:37:54 -04:00
|
|
|
(make-app-window 1 (+ (round (/ (LINES) 3)) 2)
|
|
|
|
(- (COLS) 2) 3
|
|
|
|
#f))
|
2005-05-17 11:02:01 -04:00
|
|
|
(set! command-frame-window
|
2005-05-10 15:37:54 -04:00
|
|
|
(make-app-window 1 2
|
2005-05-22 05:20:44 -04:00
|
|
|
(- (COLS) 2) (- (app-window-y active-command-window) 2)
|
2005-05-10 15:37:54 -04:00
|
|
|
#f))
|
2005-05-19 09:59:52 -04:00
|
|
|
(set! command-window
|
|
|
|
(make-inlying-app-window command-frame-window))
|
|
|
|
(set! result-frame-window
|
2005-05-22 05:20:44 -04:00
|
|
|
(make-app-window 1 (+ (app-window-y active-command-window) 3)
|
2005-05-10 15:37:54 -04:00
|
|
|
(- (COLS) 2)
|
2005-05-17 11:02:01 -04:00
|
|
|
(- (- (LINES) 6) (app-window-height command-frame-window))
|
2005-05-10 15:37:54 -04:00
|
|
|
#f))
|
2005-05-19 09:59:52 -04:00
|
|
|
(set! result-window
|
|
|
|
(make-inlying-app-window result-frame-window))
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(let ((all-windows (list bar-1 active-command-window
|
2005-05-19 09:59:52 -04:00
|
|
|
command-frame-window command-window
|
|
|
|
result-frame-window result-window)))
|
|
|
|
(for-each window-init-curses-win! all-windows)
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(debug-message "init-windows!: bar-1 " bar-1
|
|
|
|
" active-command-window " active-command-window
|
2005-05-19 09:59:52 -04:00
|
|
|
" command-frame-window " command-frame-window
|
|
|
|
" command-window " command-window
|
|
|
|
" result-frame-window " result-frame-window
|
|
|
|
" result-window " result-window)
|
|
|
|
(for-each wclear
|
|
|
|
(map app-window-curses-win all-windows))
|
|
|
|
(clear)))
|
2005-05-10 15:37:54 -04:00
|
|
|
|
|
|
|
(define (paint-bar-1)
|
|
|
|
(mvwaddstr (app-window-curses-win bar-1) 0 1 "SCSH-NUIT")
|
|
|
|
(wrefresh (app-window-curses-win bar-1)))
|
|
|
|
|
2005-05-23 09:03:45 -04:00
|
|
|
(define (paint-command-buffer-mode-indicator)
|
|
|
|
(let ((mode-string
|
|
|
|
(string-append
|
|
|
|
"[ "
|
|
|
|
(if (command-buffer-in-command-mode?)
|
|
|
|
"Command"
|
|
|
|
"Scheme")
|
|
|
|
" ]")))
|
|
|
|
(mvwaddstr
|
|
|
|
(app-window-curses-win command-frame-window)
|
|
|
|
0
|
|
|
|
(- (- (app-window-width command-frame-window)
|
|
|
|
(string-length mode-string))
|
|
|
|
2)
|
|
|
|
mode-string)))
|
|
|
|
|
2005-05-17 11:02:01 -04:00
|
|
|
(define (paint-command-frame-window)
|
|
|
|
(box (app-window-curses-win command-frame-window)
|
|
|
|
(ascii->char 0) (ascii->char 0))
|
2005-05-23 09:03:45 -04:00
|
|
|
(paint-command-buffer-mode-indicator)
|
2005-05-17 11:02:01 -04:00
|
|
|
(wrefresh (app-window-curses-win command-frame-window)))
|
2005-05-10 15:37:54 -04:00
|
|
|
|
|
|
|
(define (paint-command-window-contents)
|
2005-05-17 11:20:41 -04:00
|
|
|
(set-buffer-num-lines! command-buffer
|
2005-05-17 11:02:01 -04:00
|
|
|
(- (app-window-height command-window) 2))
|
2005-05-17 11:20:41 -04:00
|
|
|
(set-buffer-num-cols! command-buffer
|
2005-05-17 11:02:01 -04:00
|
|
|
(- (app-window-width command-window) 3))
|
|
|
|
(werase (app-window-curses-win command-window))
|
2005-05-19 09:59:52 -04:00
|
|
|
(print-command-buffer (app-window-curses-win command-window)
|
|
|
|
command-buffer))
|
2005-05-18 14:55:51 -04:00
|
|
|
|
|
|
|
(define (refresh-command-window)
|
2005-05-10 15:37:54 -04:00
|
|
|
(wrefresh (app-window-curses-win command-window)))
|
|
|
|
|
2005-05-19 09:59:52 -04:00
|
|
|
(define (paint-result-frame-window)
|
|
|
|
(let ((win (app-window-curses-win result-frame-window)))
|
|
|
|
(wclear win)
|
|
|
|
(box win (ascii->char 0) (ascii->char 0))
|
|
|
|
;;; EK: wtf is going on here?
|
|
|
|
(set! result-lines (- (app-window-height result-window) 2))
|
|
|
|
(set! result-cols (- (app-window-width result-window) 3))
|
|
|
|
(wrefresh win)))
|
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (paint-result-window entry)
|
2005-05-10 15:37:54 -04:00
|
|
|
(wclear (app-window-curses-win result-window))
|
2005-05-22 05:20:44 -04:00
|
|
|
(paint-result-buffer
|
|
|
|
(post-message
|
2005-05-22 11:05:25 -04:00
|
|
|
(history-entry-plugin entry)
|
2005-05-22 05:20:44 -04:00
|
|
|
(make-print-message (history-entry-command entry)
|
|
|
|
(history-entry-result entry)
|
|
|
|
(buffer-num-cols command-buffer)))))
|
2005-05-19 09:59:52 -04:00
|
|
|
|
|
|
|
(define (refresh-result-window)
|
2005-05-10 15:37:54 -04:00
|
|
|
(wrefresh (app-window-curses-win result-window)))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2005-05-10 15:37:54 -04:00
|
|
|
(define (paint)
|
2005-05-18 11:47:28 -04:00
|
|
|
(debug-message "paint")
|
2005-05-10 15:37:54 -04:00
|
|
|
(paint-bar-1)
|
2005-05-17 11:02:01 -04:00
|
|
|
(paint-command-frame-window)
|
2005-05-10 15:37:54 -04:00
|
|
|
(paint-command-window-contents)
|
2005-05-22 05:20:44 -04:00
|
|
|
(paint-active-command-window)
|
2005-05-19 09:59:52 -04:00
|
|
|
(paint-result-frame-window)
|
2005-05-22 05:20:44 -04:00
|
|
|
;(paint-result-window)
|
2005-05-18 14:55:51 -04:00
|
|
|
(move-cursor command-buffer)
|
2005-05-19 09:59:52 -04:00
|
|
|
(refresh-command-window)
|
|
|
|
(refresh-result-window))
|
2005-05-10 12:06:06 -04:00
|
|
|
|
|
|
|
(define (wait-for-input)
|
|
|
|
(noecho)
|
2005-05-10 15:37:54 -04:00
|
|
|
(keypad (app-window-curses-win bar-1) #t)
|
2005-05-10 12:06:06 -04:00
|
|
|
(set! active-keyboard-interrupt #f)
|
2005-05-10 15:37:54 -04:00
|
|
|
(let ((ch (wgetch (app-window-curses-win bar-1))))
|
2005-05-10 12:06:06 -04:00
|
|
|
(echo)
|
|
|
|
ch))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (execute-command command)
|
|
|
|
(let ((result (evaluate command)))
|
|
|
|
(cond
|
2005-05-22 11:05:25 -04:00
|
|
|
((determine-plugin-by-type result)
|
|
|
|
=> (lambda (plugin)
|
|
|
|
(values
|
|
|
|
(post-message plugin
|
|
|
|
(make-init-with-result-message
|
|
|
|
result (buffer-num-cols command-buffer)))
|
|
|
|
plugin)))
|
2005-05-22 05:20:44 -04:00
|
|
|
(else
|
|
|
|
(values
|
2005-05-23 08:47:41 -04:00
|
|
|
(post-message standard-view-plugin
|
2005-05-22 05:20:44 -04:00
|
|
|
(make-next-command-message
|
|
|
|
command '() (buffer-num-cols command-buffer)))
|
2005-05-23 08:47:41 -04:00
|
|
|
standard-view-plugin)))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-10 09:22:25 -04:00
|
|
|
;;Extracts the name of the function and its parameters
|
|
|
|
(define extract-com-and-par
|
|
|
|
(lambda (com)
|
|
|
|
(if (<= (string-length com) 0)
|
|
|
|
(cons "" '())
|
|
|
|
(if (equal? #\( (string-ref com 0))
|
|
|
|
(cons com '())
|
|
|
|
(let* ((fst-word (get-next-word com))
|
|
|
|
(command (car fst-word))
|
|
|
|
(rest (cdr fst-word)))
|
|
|
|
(let loop ((param-str rest)
|
|
|
|
(param-list '()))
|
|
|
|
(let* ((word (get-next-word param-str))
|
|
|
|
(param (car word))
|
|
|
|
(more (cdr word)))
|
|
|
|
(if (equal? "" param)
|
|
|
|
(cons command param-list)
|
|
|
|
(loop more (append param-list (list param)))))))))))
|
|
|
|
|
|
|
|
;;gets the next word from a string
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (get-next-word str)
|
|
|
|
(let loop ((old str)
|
|
|
|
(new ""))
|
|
|
|
(if (= 0 (string-length old))
|
|
|
|
(cons new old)
|
|
|
|
(if (char=? #\space (string-ref old 0))
|
|
|
|
(if (= 1 (string-length old))
|
|
|
|
(cons new "")
|
|
|
|
(cons new (substring old 1 (string-length old))))
|
|
|
|
(if (char=? #\( (string-ref old 0))
|
|
|
|
(let* ((nw (get-next-word-braces
|
|
|
|
(substring old 1
|
|
|
|
(string-length old))))
|
|
|
|
(nw-new (car nw))
|
|
|
|
(nw-old (cdr nw)))
|
|
|
|
(loop nw-old (string-append new "(" nw-new)))
|
|
|
|
(loop (substring old 1 (string-length old))
|
|
|
|
(string-append new (string (string-ref old 0)))))))))
|
|
|
|
|
|
|
|
(define (get-next-word-braces str)
|
|
|
|
(let loop ((old str)
|
|
|
|
(new ""))
|
|
|
|
(if (= 0 (string-length old))
|
|
|
|
(cons new old)
|
|
|
|
(if (char=? #\( (string-ref old 0))
|
|
|
|
(let* ((nw (get-next-word-braces
|
|
|
|
(substring old 1
|
|
|
|
(string-length old))))
|
|
|
|
(nw-new (car nw))
|
|
|
|
(nw-old (cdr nw)))
|
|
|
|
(loop nw-old (string-append new "(" nw-new)))
|
|
|
|
(if (char=? #\) (string-ref old 0))
|
|
|
|
(cons (string-append new ")")
|
|
|
|
(substring old 1 (string-length old)))
|
|
|
|
(loop (substring old 1 (string-length old))
|
|
|
|
(string-append new (string (string-ref old 0)))))))))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;scroll buffer after one command was entered
|
2005-05-11 09:30:51 -04:00
|
|
|
(define (scroll-command-buffer)
|
|
|
|
(set-buffer-pos-line! command-buffer
|
|
|
|
(+ (buffer-pos-line command-buffer) 1))
|
|
|
|
(set-buffer-pos-col! command-buffer 2))
|
2004-09-20 04:09:54 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (init-evaluation-environment package)
|
|
|
|
(let ((structure (reify-structure package)))
|
|
|
|
(load-structure structure)
|
|
|
|
(rt-structure->environment structure)))
|
|
|
|
|
|
|
|
(define (read-sexp-from-string string)
|
|
|
|
(let ((string-port (open-input-string string)))
|
|
|
|
(read string-port)))
|
|
|
|
|
|
|
|
(define evaluate
|
2005-05-22 11:05:25 -04:00
|
|
|
(let ((env (init-evaluation-environment 'nuit-eval)))
|
2005-05-22 05:20:44 -04:00
|
|
|
(lambda (exp)
|
|
|
|
(with-fatal-error-handler
|
|
|
|
(lambda (condition more)
|
|
|
|
(cons 'error condition))
|
|
|
|
(eval (read-sexp-from-string exp) env)))))
|
|
|
|
|
2005-05-22 11:05:25 -04:00
|
|
|
(define (post-message plugin message)
|
2005-05-23 08:47:41 -04:00
|
|
|
(cond
|
|
|
|
((view-plugin? plugin)
|
|
|
|
((view-plugin-fun plugin) message))
|
|
|
|
(else
|
|
|
|
(error "don't know how to talk to this plugin type"
|
|
|
|
plugin))))
|
2005-05-22 05:20:44 -04:00
|
|
|
|
2005-05-22 11:05:25 -04:00
|
|
|
(define (determine-plugin-by-type result)
|
2005-05-20 11:20:34 -04:00
|
|
|
(find (lambda (r)
|
2005-05-23 08:47:41 -04:00
|
|
|
((view-plugin-type-predicate r) result))
|
|
|
|
(view-plugin-list)))
|
2005-05-22 05:20:44 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;Management of the upper buffer
|
|
|
|
;;add a char to the buffer
|
2005-05-11 09:30:51 -04:00
|
|
|
(define (add-to-command-buffer ch)
|
|
|
|
(let* ((text (buffer-text command-buffer))
|
|
|
|
(last-pos (- (length text) 1))
|
|
|
|
(old-last-el (list-ref text last-pos))
|
|
|
|
(old-rest (sublist text 0 last-pos))
|
|
|
|
(before-ch (substring old-last-el 0
|
|
|
|
(max 0 (- (buffer-pos-col command-buffer) 2))))
|
|
|
|
(after-ch (substring old-last-el
|
|
|
|
(max 0 (- (buffer-pos-col command-buffer) 2))
|
|
|
|
(string-length old-last-el)))
|
|
|
|
(new-last-el (string-append before-ch
|
|
|
|
(string (ascii->char ch))
|
|
|
|
after-ch)))
|
|
|
|
(set-buffer-text! command-buffer
|
|
|
|
(append old-rest (list new-last-el)))
|
|
|
|
(set-buffer-pos-col! command-buffer
|
|
|
|
(+ (buffer-pos-col command-buffer) 1))))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;add a string to the buffer
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (add-string-to-command-buffer string)
|
|
|
|
(let loop ((str string))
|
|
|
|
(if (string=? str "")
|
|
|
|
(values)
|
|
|
|
(let ((first-ch (string-ref str 0)))
|
|
|
|
(add-to-command-buffer (char->ascii first-ch))
|
|
|
|
(loop (substring str 1 (string-length str)))))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;selection of the visible area of the buffer
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (prepare-lines l height pos)
|
|
|
|
(if (< (length l) height)
|
|
|
|
(let loop ((tmp-list l))
|
|
|
|
(if (= height (length tmp-list))
|
|
|
|
tmp-list
|
|
|
|
(loop (append tmp-list (list "")))))
|
|
|
|
(if (< pos height)
|
|
|
|
(sublist l 0 height)
|
|
|
|
(sublist l (- pos height) height))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-22 05:20:44 -04:00
|
|
|
;;; FIXME: I guess s48 knows a better way to do this (see ,inspect)
|
|
|
|
(define (maybe-shorten-string string width)
|
|
|
|
(if (> (string-length string) width)
|
|
|
|
(string-append (substring string 0 (- width 3))
|
|
|
|
"...")
|
|
|
|
string))
|
|
|
|
|
|
|
|
(define (paint-active-command-window)
|
|
|
|
(let ((win (app-window-curses-win active-command-window))
|
|
|
|
(width (app-window-width active-command-window)))
|
|
|
|
(wclear win)
|
|
|
|
(box win (ascii->char 0) (ascii->char 0))
|
|
|
|
(cond
|
|
|
|
((current-history-item)
|
|
|
|
=> (lambda (entry)
|
|
|
|
(mvwaddstr win 1 2
|
|
|
|
(maybe-shorten-string
|
|
|
|
(history-entry-command (entry-data entry)) width)))))
|
|
|
|
(wrefresh win)))
|
|
|
|
|
|
|
|
(define (paint-result-buffer print-object)
|
2005-05-10 15:37:54 -04:00
|
|
|
(let* ((window (app-window-curses-win result-window))
|
2005-05-22 05:20:44 -04:00
|
|
|
(text (print-object-text print-object))
|
|
|
|
(pos-y (print-object-pos-y print-object))
|
|
|
|
(pos-x (print-object-pos-x print-object))
|
|
|
|
(highlighted-lns (print-object-highlighted-lines print-object))
|
|
|
|
(marked-lns (print-object-marked-lines print-object)))
|
2005-05-10 15:37:54 -04:00
|
|
|
(set! text-result text)
|
|
|
|
(set! pos-result pos-y)
|
|
|
|
(set! pos-result-col pos-x)
|
|
|
|
(set! highlighted-lines highlighted-lns)
|
|
|
|
(set! marked-lines marked-lns)
|
|
|
|
(right-highlighted-lines)
|
|
|
|
(right-marked-lines)
|
|
|
|
(let ((lines (get-right-result-lines)))
|
|
|
|
(let loop ((pos 1))
|
|
|
|
(if (> pos result-lines)
|
2005-05-17 05:22:07 -04:00
|
|
|
(values)
|
2005-05-10 15:37:54 -04:00
|
|
|
(let ((line (list-ref lines (- pos 1))))
|
|
|
|
(begin
|
2005-05-22 05:20:44 -04:00
|
|
|
(if (not (standard-result-obj? (current-result)))
|
2005-05-10 15:37:54 -04:00
|
|
|
(set! line
|
|
|
|
(if (> (string-length line) result-cols)
|
|
|
|
(let ((start-line
|
|
|
|
(substring line 0
|
|
|
|
(- (ceiling (/ result-cols 2))
|
|
|
|
3)))
|
|
|
|
(end-line
|
|
|
|
(substring line
|
|
|
|
(- (string-length line)
|
|
|
|
(ceiling
|
|
|
|
(/ result-cols 2)))
|
|
|
|
(string-length line))))
|
|
|
|
(string-append start-line "..." end-line))
|
|
|
|
line)))
|
|
|
|
(if (and (member pos highlighted-lines)
|
2005-05-11 02:54:03 -04:00
|
|
|
(focus-on-result-buffer?))
|
2005-05-10 15:37:54 -04:00
|
|
|
(begin
|
|
|
|
(wattron window (A-REVERSE))
|
|
|
|
(mvwaddstr window pos 1 line)
|
|
|
|
(wattrset window (A-NORMAL))
|
2005-05-19 09:59:52 -04:00
|
|
|
;(wrefresh window)
|
2005-05-10 15:37:54 -04:00
|
|
|
(loop (+ pos 1)))
|
|
|
|
(if (member pos marked-lines)
|
2004-10-10 09:22:25 -04:00
|
|
|
(begin
|
2005-05-10 15:37:54 -04:00
|
|
|
(wattron window (A-BOLD))
|
|
|
|
(mvwaddstr window pos 1 line)
|
|
|
|
(wattrset window (A-NORMAL))
|
2005-05-19 09:59:52 -04:00
|
|
|
;(wrefresh window)
|
2004-10-10 09:22:25 -04:00
|
|
|
(loop (+ pos 1)))
|
2005-05-10 15:37:54 -04:00
|
|
|
(begin
|
|
|
|
(mvwaddstr window pos 1 line)
|
2005-05-19 09:59:52 -04:00
|
|
|
;(wrefresh window)
|
2005-05-10 15:37:54 -04:00
|
|
|
(loop (+ pos 1))))))))))))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;visible lines
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (get-right-result-lines)
|
|
|
|
(prepare-lines text-result result-lines pos-result))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;marked and highlighted lines
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (right-highlighted-lines)
|
|
|
|
(let loop ((old highlighted-lines)
|
|
|
|
(new '()))
|
|
|
|
(if (null? old)
|
|
|
|
(set! highlighted-lines new)
|
|
|
|
(let ((el (car old)))
|
|
|
|
(if (<= pos-result result-lines)
|
|
|
|
;;auf der ersten Seite
|
|
|
|
(loop (cdr old)
|
|
|
|
(append new (list el)))
|
|
|
|
(let* ((offset (- pos-result result-lines))
|
|
|
|
(new-el (- el offset )))
|
2004-10-03 05:13:30 -04:00
|
|
|
(loop (cdr old)
|
2005-05-17 16:19:53 -04:00
|
|
|
(append new (list new-el)))))))))
|
|
|
|
|
|
|
|
(define (right-marked-lines)
|
|
|
|
(let loop ((old marked-lines)
|
|
|
|
(new '()))
|
|
|
|
(if (null? old)
|
|
|
|
(set! marked-lines new)
|
|
|
|
(let ((el (car old)))
|
|
|
|
(if (<= pos-result result-lines)
|
|
|
|
;;auf der ersten Seite
|
|
|
|
(loop (cdr old)
|
|
|
|
(append new (list el)))
|
|
|
|
(let* ((offset (- pos-result result-lines))
|
|
|
|
(new-el (- el offset )))
|
|
|
|
(loop (cdr old)
|
|
|
|
(append new (list new-el)))))))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
|
|
|
;;Cursor
|
2004-10-06 09:00:59 -04:00
|
|
|
;;move cursor to the corrct position
|
2005-05-11 04:21:02 -04:00
|
|
|
(define (move-cursor buffer)
|
2005-05-17 05:00:33 -04:00
|
|
|
(if (focus-on-command-buffer?)
|
2005-05-20 11:20:34 -04:00
|
|
|
(cursor-right-pos (app-window-curses-win command-window)
|
2005-05-17 05:00:33 -04:00
|
|
|
buffer)
|
|
|
|
(begin
|
|
|
|
(compute-y-x)
|
|
|
|
(wmove (app-window-curses-win result-window)
|
|
|
|
result-buffer-pos-y result-buffer-pos-x)
|
2005-05-17 09:17:51 -04:00
|
|
|
(wrefresh (app-window-curses-win result-window))
|
|
|
|
buffer)))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2004-10-06 09:00:59 -04:00
|
|
|
;;compue pos-x and pos-y
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (compute-y-x)
|
2005-05-20 11:20:34 -04:00
|
|
|
(if (>= pos-result result-lines)
|
|
|
|
(set! result-buffer-pos-y result-lines)
|
|
|
|
(set! result-buffer-pos-y pos-result))
|
|
|
|
(set! result-buffer-pos-x pos-result-col))
|
2004-09-14 07:54:00 -04:00
|
|
|
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (sublist l pos k)
|
|
|
|
(let ((tmp (list-tail l pos)))
|
|
|
|
(reverse (list-tail (reverse tmp)
|
|
|
|
(- (length tmp) k)))))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-10 09:22:25 -04:00
|
|
|
;;When NUIT is closed the state has to be restored, in order to let the
|
|
|
|
;;user start again from scratch
|
2005-05-17 16:19:53 -04:00
|
|
|
(define (restore-state)
|
|
|
|
(set! text-result (list "Start entering commands."))
|
|
|
|
(set! pos-result 0)
|
|
|
|
(set! pos-result-col 0)
|
|
|
|
(set! result-buffer-pos-y 0)
|
|
|
|
(set! result-buffer-pos-x 0)
|
|
|
|
(set! result-lines 0)
|
|
|
|
(set! result-cols 0)
|
|
|
|
(set! highlighted-lines '())
|
|
|
|
(set! marked-lines '())
|
|
|
|
(set! history '())
|
|
|
|
(set! history-pos 0)
|
|
|
|
(set! active-keyboard-interrupt #f))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2005-05-22 11:05:25 -04:00
|
|
|
(define (get-param-as-str param-lst)
|
|
|
|
(let loop ((lst param-lst)
|
|
|
|
(str ""))
|
|
|
|
(if (null? lst)
|
|
|
|
str
|
|
|
|
(loop (cdr lst)
|
|
|
|
(string-append str " " (car lst))))))
|
2004-10-10 09:22:25 -04:00
|
|
|
|
2004-10-03 05:13:30 -04:00
|
|
|
(define-record-type standard-result-obj standard-result-obj
|
|
|
|
(make-standard-result-obj cursor-pos-y
|
|
|
|
cursor-pos-x
|
2004-10-10 09:22:25 -04:00
|
|
|
result-text
|
|
|
|
result)
|
2004-10-03 05:13:30 -04:00
|
|
|
standard-result-obj?
|
|
|
|
(cursor-pos-y standard-result-obj-cur-pos-y)
|
|
|
|
(cursor-pos-x standard-result-obj-cur-pos-x)
|
2004-10-10 09:22:25 -04:00
|
|
|
(result-text standard-result-obj-result-text)
|
|
|
|
(result standard-result-obj-result))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2004-10-10 09:22:25 -04:00
|
|
|
(define init-std-res (make-standard-result-obj 1 1 text-result
|
|
|
|
(car text-result)))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
|
|
|
;;Standard-Receiver:
|
2005-05-22 05:20:44 -04:00
|
|
|
(define (standard-receiver-rec message)
|
2005-05-17 16:19:53 -04:00
|
|
|
(cond
|
|
|
|
((next-command-message? message)
|
2005-05-22 05:20:44 -04:00
|
|
|
(let* ((result (evaluate (message-command-string message)))
|
2005-05-17 16:19:53 -04:00
|
|
|
(result-string (exp->string result))
|
2005-05-22 05:20:44 -04:00
|
|
|
(width (next-command-message-width message))
|
|
|
|
(text (layout-result-standard result-string result width))
|
|
|
|
(std-obj (make-standard-result-obj 1 1 text result)))
|
|
|
|
std-obj))
|
2005-05-17 16:19:53 -04:00
|
|
|
((print-message? message)
|
2005-05-20 11:20:34 -04:00
|
|
|
(let* ((model (message-result-object message))
|
2005-05-17 16:19:53 -04:00
|
|
|
(pos-y (standard-result-obj-cur-pos-y model))
|
|
|
|
(pos-x (standard-result-obj-cur-pos-x model))
|
|
|
|
(width (print-message-width message))
|
|
|
|
(result (standard-result-obj-result model))
|
|
|
|
(text (layout-result-standard (exp->string result)
|
|
|
|
result width)))
|
|
|
|
(make-print-object pos-y pos-x text '() '())))
|
|
|
|
((key-pressed-message? message)
|
2005-05-20 11:20:34 -04:00
|
|
|
(message-result-object message))
|
2005-05-17 16:19:53 -04:00
|
|
|
((restore-message? message)
|
|
|
|
(values))
|
|
|
|
((selection-message? message)
|
|
|
|
"")))
|
2004-10-03 05:13:30 -04:00
|
|
|
|
2005-05-23 08:47:41 -04:00
|
|
|
(define standard-view-plugin
|
|
|
|
(make-view-plugin standard-receiver-rec
|
|
|
|
(lambda (val) #t)))
|
2005-05-17 16:19:53 -04:00
|
|
|
|