Update of /project/gsharp/cvsroot/gsharp In directory common-lisp.net:/tmp/cvs-serv11943
Modified Files: gui.lisp Log Message: Invalidated elements of layers using a staff that has its key signature altered.
Date: Sat Nov 26 22:30:43 2005 Author: rstrandh
Index: gsharp/gui.lisp diff -u gsharp/gui.lisp:1.44 gsharp/gui.lisp:1.45 --- gsharp/gui.lisp:1.44 Sun Nov 20 20:17:22 2005 +++ gsharp/gui.lisp Sat Nov 26 22:30:13 2005 @@ -1089,39 +1089,59 @@ (layer (layer (cursor *application-frame*)))) (remove-staff-from-layer staff layer)))
+(defun invalidate-slice-using-staff (slice staff) + (declare (ignore staff)) ; maybe use this later + (loop for bar in (bars slice) + do (loop for element in (elements bar) + do (mark-modified element)))) + (define-gsharp-command com-more-sharps () - (let ((keysig (keysig (car (staves (layer (cursor *application-frame*))))))) - (cond ((eq (aref keysig 3) :flat) (setf (aref keysig 3) :natural)) - ((eq (aref keysig 0) :flat) (setf (aref keysig 0) :natural)) - ((eq (aref keysig 4) :flat) (setf (aref keysig 4) :natural)) - ((eq (aref keysig 1) :flat) (setf (aref keysig 1) :natural)) - ((eq (aref keysig 5) :flat) (setf (aref keysig 5) :natural)) - ((eq (aref keysig 2) :flat) (setf (aref keysig 2) :natural)) - ((eq (aref keysig 6) :flat) (setf (aref keysig 6) :natural)) - ((eq (aref keysig 3) :natural) (setf (aref keysig 3) :sharp)) - ((eq (aref keysig 0) :natural) (setf (aref keysig 0) :sharp)) - ((eq (aref keysig 4) :natural) (setf (aref keysig 4) :sharp)) - ((eq (aref keysig 1) :natural) (setf (aref keysig 1) :sharp)) - ((eq (aref keysig 5) :natural) (setf (aref keysig 5) :sharp)) - ((eq (aref keysig 2) :natural) (setf (aref keysig 2) :sharp)) - ((eq (aref keysig 6) :natural) (setf (aref keysig 6) :sharp))))) + (let ((staff (car (staves (layer (cursor *application-frame*)))))) + (loop for segment in (segments (buffer *application-frame*)) + do (loop for layer in (layers segment) + do (when (member staff (staves layer)) + (invalidate-slice-using-staff (head layer) staff) + (invalidate-slice-using-staff (body layer) staff) + (invalidate-slice-using-staff (tail layer) staff)))) + (let ((keysig (keysig staff))) + (cond ((eq (aref keysig 3) :flat) (setf (aref keysig 3) :natural)) + ((eq (aref keysig 0) :flat) (setf (aref keysig 0) :natural)) + ((eq (aref keysig 4) :flat) (setf (aref keysig 4) :natural)) + ((eq (aref keysig 1) :flat) (setf (aref keysig 1) :natural)) + ((eq (aref keysig 5) :flat) (setf (aref keysig 5) :natural)) + ((eq (aref keysig 2) :flat) (setf (aref keysig 2) :natural)) + ((eq (aref keysig 6) :flat) (setf (aref keysig 6) :natural)) + ((eq (aref keysig 3) :natural) (setf (aref keysig 3) :sharp)) + ((eq (aref keysig 0) :natural) (setf (aref keysig 0) :sharp)) + ((eq (aref keysig 4) :natural) (setf (aref keysig 4) :sharp)) + ((eq (aref keysig 1) :natural) (setf (aref keysig 1) :sharp)) + ((eq (aref keysig 5) :natural) (setf (aref keysig 5) :sharp)) + ((eq (aref keysig 2) :natural) (setf (aref keysig 2) :sharp)) + ((eq (aref keysig 6) :natural) (setf (aref keysig 6) :sharp))))))
(define-gsharp-command com-more-flats () - (let ((keysig (keysig (car (staves (layer (cursor *application-frame*))))))) - (cond ((eq (aref keysig 6) :sharp) (setf (aref keysig 6) :natural)) - ((eq (aref keysig 2) :sharp) (setf (aref keysig 2) :natural)) - ((eq (aref keysig 5) :sharp) (setf (aref keysig 5) :natural)) - ((eq (aref keysig 1) :sharp) (setf (aref keysig 1) :natural)) - ((eq (aref keysig 4) :sharp) (setf (aref keysig 4) :natural)) - ((eq (aref keysig 0) :sharp) (setf (aref keysig 0) :natural)) - ((eq (aref keysig 3) :sharp) (setf (aref keysig 3) :natural)) - ((eq (aref keysig 6) :natural) (setf (aref keysig 6) :flat)) - ((eq (aref keysig 2) :natural) (setf (aref keysig 2) :flat)) - ((eq (aref keysig 5) :natural) (setf (aref keysig 5) :flat)) - ((eq (aref keysig 1) :natural) (setf (aref keysig 1) :flat)) - ((eq (aref keysig 4) :natural) (setf (aref keysig 4) :flat)) - ((eq (aref keysig 0) :natural) (setf (aref keysig 0) :flat)) - ((eq (aref keysig 3) :natural) (setf (aref keysig 3) :flat))))) + (let ((staff (car (staves (layer (cursor *application-frame*)))))) + (loop for segment in (segments (buffer *application-frame*)) + do (loop for layer in (layers segment) + do (when (member staff (staves layer)) + (invalidate-slice-using-staff (head layer) staff) + (invalidate-slice-using-staff (body layer) staff) + (invalidate-slice-using-staff (tail layer) staff)))) + (let ((keysig (keysig staff))) + (cond ((eq (aref keysig 6) :sharp) (setf (aref keysig 6) :natural)) + ((eq (aref keysig 2) :sharp) (setf (aref keysig 2) :natural)) + ((eq (aref keysig 5) :sharp) (setf (aref keysig 5) :natural)) + ((eq (aref keysig 1) :sharp) (setf (aref keysig 1) :natural)) + ((eq (aref keysig 4) :sharp) (setf (aref keysig 4) :natural)) + ((eq (aref keysig 0) :sharp) (setf (aref keysig 0) :natural)) + ((eq (aref keysig 3) :sharp) (setf (aref keysig 3) :natural)) + ((eq (aref keysig 6) :natural) (setf (aref keysig 6) :flat)) + ((eq (aref keysig 2) :natural) (setf (aref keysig 2) :flat)) + ((eq (aref keysig 5) :natural) (setf (aref keysig 5) :flat)) + ((eq (aref keysig 1) :natural) (setf (aref keysig 1) :flat)) + ((eq (aref keysig 4) :natural) (setf (aref keysig 4) :flat)) + ((eq (aref keysig 0) :natural) (setf (aref keysig 0) :flat)) + ((eq (aref keysig 3) :natural) (setf (aref keysig 3) :flat))))))
;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;; ;;;