[gsharp-cvs] CVS update: gsharp/drawing.lisp gsharp/measure.lisp gsharp/packages.lisp

Robert Strandh rstrandh at common-lisp.net
Mon Nov 21 22:18:39 UTC 2005


Update of /project/gsharp/cvsroot/gsharp
In directory common-lisp.net:/tmp/cvs-serv28766

Modified Files:
	drawing.lisp measure.lisp packages.lisp 
Log Message:
moved the computation of the final accidental (determine whether
one should be displayed or not according to the key signature) from
drawing.lisp to measure.lisp.

Date: Mon Nov 21 23:18:38 2005
Author: rstrandh

Index: gsharp/drawing.lisp
diff -u gsharp/drawing.lisp:1.32 gsharp/drawing.lisp:1.33
--- gsharp/drawing.lisp:1.32	Mon Nov 21 21:37:45 2005
+++ gsharp/drawing.lisp	Mon Nov 21 23:18:37 2005
@@ -4,8 +4,7 @@
   ((yoffset :initform 0 :accessor staff-yoffset)))
 
 (define-added-mixin dnote () note
-  ((final-accidental :initform nil :accessor final-accidental)
-   ;; The relative x offset of the accidental of the note with respect
+  (;; The relative x offset of the accidental of the note with respect
    ;; to the cluster.  A value of nil indicates that accidental has
    ;; not been placed yet
    (final-relative-accidental-xoffset :initform nil
@@ -431,17 +430,6 @@
   (loop for note in notes do
 	(draw-note pane note notehead dots (final-absolute-note-xoffset note) (note-position note))))
 
-;;; Given a list of notes to be displayed on the same staff line, for
-;;; each note, compute the accidental to be displayed as a function of
-;;; the accidentals of the note and the key signature of the staff.
-(defun compute-final-accidentals (group)
-  (loop for note in group do
-	(setf (final-accidental note)
-	      (if (eq (accidentals note)
-		      (aref (keysig (staff note)) (mod (pitch note) 7)))
-		  nil
-		  (accidentals note)))))
-
 (defun element-has-suspended-notes (element)
   (not (apply #'= (mapcar #'final-relative-note-xoffset (notes element)))))
 
@@ -598,7 +586,6 @@
 	(score-pane:with-vertical-score-position (pane stem-yoffset)
 	  (draw-flags pane element x direction stem-pos)))
       (loop for group in groups do 
-	    (compute-final-accidentals group)
 	    (compute-final-relative-accidental-xoffset group x direction)
 	    (draw-notes pane group (dots element) (notehead element))
 	    (draw-ledger-lines pane x group))


Index: gsharp/measure.lisp
diff -u gsharp/measure.lisp:1.12 gsharp/measure.lisp:1.13
--- gsharp/measure.lisp:1.12	Mon Nov 21 21:37:45 2005
+++ gsharp/measure.lisp	Mon Nov 21 23:18:37 2005
@@ -18,7 +18,8 @@
 ;;; Note
 
 (defrclass rnote note
-  (;; the relative x offset of the note with respect to the cluster
+  ((final-accidental :initform nil :accessor final-accidental)
+   ;; the relative x offset of the note with respect to the cluster
    (final-relative-note-xoffset :accessor final-relative-note-xoffset)))
 
 ;;; given a list of notes, group them so that every note in the group
@@ -172,6 +173,17 @@
 	  when (non-empty-cluster-p element)
 	  do (setf (final-stem-direction element) stem-direction))))
 
+;;; Given a list of notes to be displayed on the same staff line, for
+;;; each note, compute the accidental to be displayed as a function of
+;;; the accidentals of the note and the key signature of the staff.
+(defun compute-final-accidentals (group)
+  (loop for note in group do
+	(setf (final-accidental note)
+	      (if (eq (accidentals note)
+		      (aref (keysig (staff note)) (mod (pitch note) 7)))
+		  nil
+		  (accidentals note)))))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Rest
@@ -383,7 +395,8 @@
 		 (setf note old-note))))))
 
 (defun compute-staff-group-parameters (staff-group stem-direction)
-  (compute-final-relative-note-xoffsets staff-group stem-direction))
+  (compute-final-relative-note-xoffsets staff-group stem-direction)
+  (compute-final-accidentals staff-group))
 
 ;;; compute some important parameters of an element
 (defgeneric compute-element-parameters (element))


Index: gsharp/packages.lisp
diff -u gsharp/packages.lisp:1.32 gsharp/packages.lisp:1.33
--- gsharp/packages.lisp:1.32	Mon Nov 21 21:37:45 2005
+++ gsharp/packages.lisp	Mon Nov 21 23:18:37 2005
@@ -132,7 +132,8 @@
 	   #:note-position #:non-empty-cluster-p
 	   #:top-note #:bot-note #:top-note-pos #:bot-note-pos
 	   #:beam-groups #:final-stem-direction
-	   #:group-notes-by-staff #:final-relative-note-xoffset))
+	   #:group-notes-by-staff #:final-relative-note-xoffset
+	   #:final-accidental))
 
 (defpackage :gsharp-postscript
   (:use :clim :clim-lisp)




More information about the Gsharp-cvs mailing list