| Paste number 35661: | toy embedded drei/gsharp |
| Pasted by: | Krystof |
| 1 year, 11 months ago | |
| #lisp | |
| Paste contents: |
| (in-package :clim-user) (defclass lilyish-drei-gadget-pane (drei:drei-gadget-pane) ()) (defmethod drei:handle-gesture :after ((drei lilyish-drei-gadget-pane) gesture) (let* ((frame (pane-frame drei)) (output (get-frame-pane frame 'output))) (setf (pane-needs-redisplay output) t) (redisplay-frame-pane frame output))) (define-application-frame lilyish (esa:esa-frame-mixin standard-application-frame) ((input-state :initform (gsharp::make-input-state) :reader gsharp::input-state)) #+nil (:menu-bar tabedit-menu-table) (:panes (minibuffer (make-pane 'esa:minibuffer-pane :height 20 :min-height 20 :max-height 20)) (info (make-pane 'esa:info-pane :height 20 :min-height 20 :max-height 20 :display-function 'display-info)) (editor :drei :drei-class 'lilyish-drei-gadget-pane :minibuffer nil ;; it would be nice to fix the width of the editor ;; component. However, it doesn't seem to work... :width 200 :min-width 200 :max-width 200) (output :application :display-function 'display-music ;; we perform all the redisplays of the output pane ;; ourselves. :display-time nil :default-view (make-instance 'gsharp::orchestra-view) ;; scroll-bars? According to the spec, the default for an ;; application pane is T, so I don't know why I need to ;; include this; however, without it, I only get a vertical ;; scroll bar. :scroll-bars t)) (:layouts (default (vertically () (horizontally () editor output) info minibuffer))) (:top-level ((lambda (frame) (setf (esa:windows frame) (list (find-pane-named frame 'output))) (let ((esa:*minibuffer* (get-frame-pane frame 'minibuffer)) (esa:*current-window* (find-pane-named frame 'editor))) ;; this is a bit of a hacky way to get the master pane ;; information into the info-pane. (reinitialize-instance (find-pane-named frame 'info) :master-pane (find-pane-named frame 'editor)) (default-frame-top-level frame)))))) ;;; hack (defmethod view ((pane application-pane)) (stream-default-view pane)) (defun display-music (frame pane) (let* ((drei (get-frame-pane frame 'editor)) (buffer (drei-buffer:buffer drei))) (let* ((gsharp (make-instance 'gsharp::buffer)) (cursor (gsharp::make-initial-cursor gsharp)) (staff (car (gsharp::staves gsharp))) (view (make-instance 'gsharp::orchestra-view :buffer gsharp :cursor cursor))) (setf (stream-default-view pane) view) (let ((new-word t)) (dotimes (i (drei-buffer:size buffer)) (let ((char (drei-buffer:buffer-object buffer i))) (case char ((#\Space #\Newline) (setf new-word t)) ((#\a #\b #\c #\d #\e #\f #\g) (let ((i (mod (- (digit-char-p char 17) 5) 7))) (cond (new-word (gsharp::insert-numbered-note-new-cluster i) (setf new-word nil)) (t (gsharp::insert-numbered-note-current-cluster i))))))))) (gsharp-measure::recompute-measures gsharp) (gsharp::draw-buffer pane gsharp cursor 0 100)))) (defmethod execute-frame-command :after ((frame lilyish) command) (when (eq frame *application-frame*) (let* ((drei (car (esa:windows frame))) (output (find-pane-named frame 'output)) (buffer (drei-buffer:buffer drei))) (drei-syntax:update-syntax buffer (drei-syntax:syntax buffer)) (redisplay-frame-pane frame drei) (setf (pane-needs-redisplay output) t) (redisplay-frame-pane frame output)))) |
This paste has no annotations.