Index: buffer.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/buffer.lisp,v
retrieving revision 1.35
diff -u -r1.35 buffer.lisp
--- buffer.lisp	28 Feb 2006 23:42:12 -0000	1.35
+++ buffer.lisp	1 Mar 2006 10:09:37 -0000
@@ -43,21 +43,29 @@
 ;;; The bottom line of the staff is number 1. 
 (defgeneric lineno (clef))
 
+;;; for key signature drawing calcluations.  FIXME: in fact the layout
+;;; of key signatures isn't the same across all clefs.
+(defgeneric b-position (clef))
+(defgeneric f-position (clef))
+
+;;; the note number of the bottom line of this clef.
+(defgeneric bottom-line (clef))
+
 (defclass clef (gsharp-object name-mixin)
   ((print-character :allocation :class :initform #\K)
    (lineno :reader lineno :initarg :lineno
 	   :type (or (integer 2 6) null))))
 
 (defun make-clef (name &key lineno)
-  (declare (type (member :treble :bass :c :percussion) name)
+  (declare (type (member :treble :treble8 :bass :c :percussion) name)
 	   (type (or (integer 2 6) null) lineno))
   (when (null lineno)
     (setf lineno
 	  (ecase name
-	      (:treble 2)
-	      (:bass 6)
-	      (:c 4)
-	      (:percussion 3))))
+            ((:treble :treble8) 2)
+            (:bass 6)
+            (:c 4)
+            (:percussion 3))))
   (make-instance 'clef :name name :lineno lineno))
 
 (defmethod print-gsharp-object :after ((c clef) stream)
@@ -71,6 +79,26 @@
   #'read-clef-v3
   *gsharp-readtable-v3*)
 
+(defmethod b-position ((clef clef))
+  (ecase (name clef)
+    (:bass (- (lineno clef) 4))
+    ((:treble :treble8) (+ (lineno clef) 2))
+    (:c (- (lineno clef) 1))))
+
+(defmethod f-position ((clef clef))
+  (ecase (name clef)
+    (:bass (lineno clef))
+    ((:treble :treble8) (+ (lineno clef) 6))
+    (:c (+ (lineno clef) 3))))
+
+(defmethod bottom-line ((clef clef))
+  (- (ecase (name clef)
+       (:treble 32)
+       (:bass 24)
+       (:c 28)
+       (:treble8 25))
+     (lineno clef)))
+
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;
 ;;; Staff
Index: drawing.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/drawing.lisp,v
retrieving revision 1.63
diff -u -r1.63 drawing.lisp
--- drawing.lisp	26 Feb 2006 22:18:39 -0000	1.63
+++ drawing.lisp	1 Mar 2006 10:09:37 -0000
@@ -40,19 +40,13 @@
 	       :x ,(+ x1 10)
 	       :staff-step ,(lineno (clef staff)))
 	     :stream pane)
-    (let ((yoffset (ecase (name (clef staff))
-		     (:bass (- (lineno (clef staff)) 4))
-		     (:treble (+ (lineno (clef staff)) 2))
-		     (:c (- (lineno (clef staff)) 1)))))
+    (let ((yoffset (b-position clef)))
       (loop for pitch in '(6 2 5 1 4 0 3)
 	    for line in '(0 3 -1 2 -2 1 -3)
 	    for x from (+ x1 10 (score-pane:staff-step 8)) by (score-pane:staff-step 2)
 	    while (eq (aref (alterations (keysig staff)) pitch) :flat)
 	    do (score-pane:draw-accidental pane :flat x (+ line yoffset))))
-    (let ((yoffset (ecase (name (clef staff))
-		     (:bass (lineno (clef staff)))
-		     (:treble (+ (lineno (clef staff)) 6))
-		     (:c (+ (lineno (clef staff)) 3)))))
+    (let ((yoffset (f-position clef)))
       (loop for pitch in '(3 0 4 1 5 2 6)
 	    for line in '(0 -3 1 -2 -5 -1 -4)
 	    for x from (+ x1 10 (score-pane:staff-step 8)) by (score-pane:staff-step 2.5)
@@ -635,8 +661,7 @@
 		    (yoffset (- (gsharp-drawing::staff-yoffset staff))))
 	       (if (typep staff 'fiveline-staff)
 		   (let* ((clef (clef staff))
-			  (bottom-line (- (ecase (name clef) (:treble 32) (:bass 24) (:c 28))
-					  (lineno clef)))
+			  (bottom-line (bottom-line clef))
 			  (lnote-offset (score-pane:staff-step (- last-note bottom-line))))
 		     (draw-line* pane
 				 x (+ sy (- (+ (score-pane:staff-step 12) yoffset)))
Index: gui.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/gui.lisp,v
retrieving revision 1.57
diff -u -r1.57 gui.lisp
--- gui.lisp	1 Mar 2006 00:15:42 -0000	1.57
+++ gui.lisp	1 Mar 2006 10:09:37 -0000
@@ -175,9 +175,8 @@
 
 (defmethod note-position ((note note))
   (let ((clef (clef (staff note))))
-    (+ (- (pitch note)
-	  (ecase (name clef) (:treble 32) (:bass 24) (:c 28)))
-       (lineno clef))))
+    (- (pitch note)
+       (bottom-line clef))))
 
 (defmethod display-element ((frame gsharp) pane)
   (when (handler-case (cur-cluster)
@@ -1015,7 +1100,7 @@
 				    (lambda (so-far mode)
 				      (complete-from-possibilities
 				       so-far
-				       '(:treble :bass :c :percussion)
+				       '(:treble :treble8 :bass :c :percussion)
 				       '()
 				       :action mode
 				       :predicate (constantly t)
Index: measure.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/measure.lisp,v
retrieving revision 1.27
diff -u -r1.27 measure.lisp
--- measure.lisp	15 Feb 2006 02:44:48 -0000	1.27
+++ measure.lisp	1 Mar 2006 10:09:37 -0000
@@ -119,9 +119,8 @@
 
 (defmethod note-position ((note note))
   (let ((clef (clef (staff note))))
-    (+ (- (pitch note)
-	  (ecase (name clef) (:treble 32) (:bass 24) (:c 28)))
-       (lineno clef))))
+    (- (pitch note)
+       (bottom-line clef))))
 
 ;;; given a list of notes, return the one that is at the top
 (defun top-note (notes)
Index: packages.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/packages.lisp,v
retrieving revision 1.47
diff -u -r1.47 packages.lisp
--- packages.lisp	1 Mar 2006 00:15:42 -0000	1.47
+++ packages.lisp	1 Mar 2006 10:09:37 -0000
@@ -196,7 +196,8 @@
 	   #:add-staff-to-layer
 	   #:remove-staff-from-layer
 	   #:stem-direction #:undotted-duration #:duration
-	   #:clef #:keysig #:staff-pos #:xoffset #:read-everything
+	   #:clef #:f-position #:b-position #:bottom-line
+           #:keysig #:staff-pos #:xoffset #:read-everything
 	   #:read-buffer-from-stream
 	   #:key-signature #:alterations #:more-sharps #:more-flats
 	   #:line-width #:min-width #:spacing-style #:right-edge #:left-offset
Index: score-pane.lisp
===================================================================
RCS file: /project/gsharp/cvsroot/gsharp/score-pane.lisp,v
retrieving revision 1.21
diff -u -r1.21 score-pane.lisp
--- score-pane.lisp	26 Feb 2006 22:18:39 -0000	1.21
+++ score-pane.lisp	1 Mar 2006 10:09:37 -0000
@@ -249,7 +249,10 @@
 
 (define-pixmap-recording (draw-clef (name))
     (ecase name
-      (:treble +glyph-g-clef+)
+      ;; FIXME: while using the same glyph for :TREBLE and :TREBLE8 is
+      ;; fine from a musical point of view, some differentiation (by
+      ;; putting an italic 8 underneath, for instance) would be good.
+      ((:treble :treble8) +glyph-g-clef+)
       (:bass +glyph-f-clef+)
       (:c +glyph-c-clef+)))
 
