[gsharp-cvs] CVS gsharp

rstrandh rstrandh at common-lisp.net
Sun Feb 26 22:18:40 UTC 2006


Update of /project/gsharp/cvsroot/gsharp
In directory clnet:/tmp/cvs-serv11186

Modified Files:
	packages.lisp drawing.lisp charmap.lisp score-pane.lisp 
Log Message:
The code for drawing ties is basically done (score-pane.lisp).  The
code in drawing.lisp that actually decides how to call the tie-drawing
functions is only rudimentary (only upward ties are drawn at the
moment).



--- /project/gsharp/cvsroot/gsharp/packages.lisp	2006/02/15 02:54:27	1.45
+++ /project/gsharp/cvsroot/gsharp/packages.lisp	2006/02/26 22:18:39	1.46
@@ -61,7 +61,87 @@
 	   #:+glyph-flags-down-one+ #:+glyph-flags-down-two+ #:+glyph-flags-down-three+
 	   #:+glyph-flags-down-four+ #:+glyph-flags-down-five+ #:+glyph-flags-up-one+
 	   #:+glyph-flags-up-two+ #:+glyph-flags-up-three+ #:+glyph-flags-up-four+
-	   #:+glyph-flags-up-five+))
+	   #:+glyph-flags-up-five+
+	   #:+glyph-small-tie-one-up+
+	   #:+glyph-small-tie-one-up-light+
+	   #:+glyph-small-tie-two-up+
+	   #:+glyph-small-tie-two-up-light+
+	   #:+glyph-small-tie-three-up+
+	   #:+glyph-small-tie-three-up-light+
+	   #:+glyph-small-tie-four-up+
+	   #:+glyph-small-tie-four-up-light+
+	   #:+glyph-small-tie-five-up+
+	   #:+glyph-small-tie-five-up-light+
+	   #:+glyph-small-tie-six-up+
+	   #:+glyph-small-tie-six-up-light+
+	   #:+glyph-small-tie-seven-up+
+	   #:+glyph-small-tie-seven-up-light+
+	   #:+glyph-small-tie-eight-up+
+	   #:+glyph-small-tie-eight-up-light+
+	   #:+glyph-small-tie-one-down+
+	   #:+glyph-small-tie-one-down-light+
+	   #:+glyph-small-tie-two-down+
+	   #:+glyph-small-tie-two-down-light+
+	   #:+glyph-small-tie-three-down+
+	   #:+glyph-small-tie-three-down-light+
+	   #:+glyph-small-tie-four-down+
+	   #:+glyph-small-tie-four-down-light+
+	   #:+glyph-small-tie-five-down+
+	   #:+glyph-small-tie-five-down-light+
+	   #:+glyph-small-tie-six-down+
+	   #:+glyph-small-tie-six-down-light+
+	   #:+glyph-small-tie-seven-down+
+	   #:+glyph-small-tie-seven-down-light+
+	   #:+glyph-small-tie-eight-down+
+	   #:+glyph-small-tie-eight-down-light+
+	   #:+glyph-large-tie-one-up+
+	   #:+glyph-large-tie-one-up-light+
+	   #:+glyph-large-tie-two-up+
+	   #:+glyph-large-tie-two-up-light+
+	   #:+glyph-large-tie-three-up+
+	   #:+glyph-large-tie-three-up-light+
+	   #:+glyph-large-tie-four-up+
+	   #:+glyph-large-tie-four-up-light+
+	   #:+glyph-large-tie-five-up+
+	   #:+glyph-large-tie-five-up-light+
+	   #:+glyph-large-tie-six-up+
+	   #:+glyph-large-tie-six-up-light+
+	   #:+glyph-large-tie-seven-up+
+	   #:+glyph-large-tie-seven-up-light+
+	   #:+glyph-large-tie-eight-up+
+	   #:+glyph-large-tie-eight-up-light+
+	   #:+glyph-large-tie-nine-up+
+	   #:+glyph-large-tie-nine-up-light+
+	   #:+glyph-large-tie-ten-up+
+	   #:+glyph-large-tie-ten-up-light+
+	   #:+glyph-large-tie-left-up+
+	   #:+glyph-large-tie-left-up-light+
+	   #:+glyph-large-tie-right-up+
+	   #:+glyph-large-tie-right-up-light+
+	   #:+glyph-large-tie-one-down+
+	   #:+glyph-large-tie-one-down-light+
+	   #:+glyph-large-tie-two-down+
+	   #:+glyph-large-tie-two-down-light+
+	   #:+glyph-large-tie-three-down+
+	   #:+glyph-large-tie-three-down-light+
+	   #:+glyph-large-tie-four-down+
+	   #:+glyph-large-tie-four-down-light+
+	   #:+glyph-large-tie-five-down+
+	   #:+glyph-large-tie-five-down-light+
+	   #:+glyph-large-tie-six-down+
+	   #:+glyph-large-tie-six-down-light+
+	   #:+glyph-large-tie-seven-down+
+	   #:+glyph-large-tie-seven-down-light+
+	   #:+glyph-large-tie-eight-down+
+	   #:+glyph-large-tie-eight-down-light+
+	   #:+glyph-large-tie-nine-down+
+	   #:+glyph-large-tie-nine-down-light+
+	   #:+glyph-large-tie-ten-down+
+	   #:+glyph-large-tie-ten-down-light+
+	   #:+glyph-large-tie-left-down+
+	   #:+glyph-large-tie-left-down-light+
+	   #:+glyph-large-tie-right-down+
+	   #:+glyph-large-tie-right-down-light+))
 
 (defpackage :score-pane
   (:use :clim :clim-extensions :clim-lisp :sdl :esa)
@@ -71,7 +151,7 @@
 	   #:draw-ledger-line #:draw-bar-line #:draw-beam #:staff-step
 	   #:draw-notehead #:draw-accidental #:draw-clef #:draw-rest #:draw-dot
 	   #:draw-flags-up #:draw-flags-down
-	   #:draw-tie
+	   #:draw-tie-up #:draw-tie-down
 	   #:with-score-pane #:with-vertical-score-position
 	   #:with-staff-size #:with-notehead-right-offsets
 	   #:with-suspended-note-offset
--- /project/gsharp/cvsroot/gsharp/drawing.lisp	2006/02/14 03:00:52	1.62
+++ /project/gsharp/cvsroot/gsharp/drawing.lisp	2006/02/26 22:18:39	1.63
@@ -340,11 +340,11 @@
 					      (= (pitch n1) (pitch n2))
 					      (eq (staff n1) (staff n2))
 					      (accidentals n1) (accidentals n2))
-				     (let ((x1 (final-absolute-note-xoffset n1))
-					   (x2 (final-absolute-note-xoffset n2))
-					   (y (- (score-pane:staff-step (note-position n1)))))
+				     (let ((x1 (+ (final-absolute-note-xoffset n1) (score-pane:staff-step 1.5)))
+					   (x2 (- (final-absolute-note-xoffset n2) (score-pane:staff-step 1.5)))
+					   (pos (note-position n1)))
 				       (score-pane:with-vertical-score-position (pane (staff-yoffset (staff n1)))
-					 (score-pane:draw-tie pane x1 x2 y)))))))))))
+					 (score-pane:draw-tie-up pane x1 x2 (if (oddp pos) (1+ pos) pos))))))))))))
 
 (defun draw-system (pane measures)
   (loop for measure in measures do
--- /project/gsharp/cvsroot/gsharp/charmap.lisp	2004/02/16 15:46:10	1.1.1.1
+++ /project/gsharp/cvsroot/gsharp/charmap.lisp	2006/02/26 22:18:39	1.2
@@ -87,3 +87,88 @@
 (defconstant +glyph-flags-up-four-light+ 127)
 (defconstant +glyph-flags-up-five+ 128)
 (defconstant +glyph-flags-up-five-light+ 129)
+
+(defconstant +glyph-small-tie-one-up+ 130)
+(defconstant +glyph-small-tie-one-up-light+ 131)
+(defconstant +glyph-small-tie-two-up+ 132)
+(defconstant +glyph-small-tie-two-up-light+ 133)
+(defconstant +glyph-small-tie-three-up+ 134)
+(defconstant +glyph-small-tie-three-up-light+ 135)
+(defconstant +glyph-small-tie-four-up+ 136)
+(defconstant +glyph-small-tie-four-up-light+ 137)
+(defconstant +glyph-small-tie-five-up+ 138)
+(defconstant +glyph-small-tie-five-up-light+ 139)
+(defconstant +glyph-small-tie-six-up+ 140)
+(defconstant +glyph-small-tie-six-up-light+ 141)
+(defconstant +glyph-small-tie-seven-up+ 142)
+(defconstant +glyph-small-tie-seven-up-light+ 143)
+(defconstant +glyph-small-tie-eight-up+ 144)
+(defconstant +glyph-small-tie-eight-up-light+ 145)
+
+(defconstant +glyph-small-tie-one-down+ 146)
+(defconstant +glyph-small-tie-one-down-light+ 147)
+(defconstant +glyph-small-tie-two-down+ 148)
+(defconstant +glyph-small-tie-two-down-light+ 149)
+(defconstant +glyph-small-tie-three-down+ 150)
+(defconstant +glyph-small-tie-three-down-light+ 151)
+(defconstant +glyph-small-tie-four-down+ 152)
+(defconstant +glyph-small-tie-four-down-light+ 153)
+(defconstant +glyph-small-tie-five-down+ 154)
+(defconstant +glyph-small-tie-five-down-light+ 155)
+(defconstant +glyph-small-tie-six-down+ 156)
+(defconstant +glyph-small-tie-six-down-light+ 157)
+(defconstant +glyph-small-tie-seven-down+ 158)
+(defconstant +glyph-small-tie-seven-down-light+ 159)
+(defconstant +glyph-small-tie-eight-down+ 160)
+(defconstant +glyph-small-tie-eight-down-light+ 161)
+
+(defconstant +glyph-large-tie-one-up+ 162)
+(defconstant +glyph-large-tie-one-up-light+ 163)
+(defconstant +glyph-large-tie-two-up+ 164)
+(defconstant +glyph-large-tie-two-up-light+ 165)
+(defconstant +glyph-large-tie-three-up+ 166)
+(defconstant +glyph-large-tie-three-up-light+ 167)
+(defconstant +glyph-large-tie-four-up+ 168)
+(defconstant +glyph-large-tie-four-up-light+ 169)
+(defconstant +glyph-large-tie-five-up+ 170)
+(defconstant +glyph-large-tie-five-up-light+ 171)
+(defconstant +glyph-large-tie-six-up+ 172)
+(defconstant +glyph-large-tie-six-up-light+ 173)
+(defconstant +glyph-large-tie-seven-up+ 174)
+(defconstant +glyph-large-tie-seven-up-light+ 175)
+(defconstant +glyph-large-tie-eight-up+ 176)
+(defconstant +glyph-large-tie-eight-up-light+ 177)
+(defconstant +glyph-large-tie-nine-up+ 178)
+(defconstant +glyph-large-tie-nine-up-light+ 179)
+(defconstant +glyph-large-tie-ten-up+ 180)
+(defconstant +glyph-large-tie-ten-up-light+ 181)
+(defconstant +glyph-large-tie-left-up+ 182)
+(defconstant +glyph-large-tie-left-up-light+ 183)
+(defconstant +glyph-large-tie-right-up+ 184)
+(defconstant +glyph-large-tie-right-up-light+ 185)
+
+(defconstant +glyph-large-tie-one-down+ 186)
+(defconstant +glyph-large-tie-one-down-light+ 187)
+(defconstant +glyph-large-tie-two-down+ 188)
+(defconstant +glyph-large-tie-two-down-light+ 189)
+(defconstant +glyph-large-tie-three-down+ 190)
+(defconstant +glyph-large-tie-three-down-light+ 191)
+(defconstant +glyph-large-tie-four-down+ 192)
+(defconstant +glyph-large-tie-four-down-light+ 193)
+(defconstant +glyph-large-tie-five-down+ 194)
+(defconstant +glyph-large-tie-five-down-light+ 195)
+(defconstant +glyph-large-tie-six-down+ 196)
+(defconstant +glyph-large-tie-six-down-light+ 197)
+(defconstant +glyph-large-tie-seven-down+ 198)
+(defconstant +glyph-large-tie-seven-down-light+ 199)
+(defconstant +glyph-large-tie-eight-down+ 200)
+(defconstant +glyph-large-tie-eight-down-light+ 201)
+(defconstant +glyph-large-tie-nine-down+ 202)
+(defconstant +glyph-large-tie-nine-down-light+ 203)
+(defconstant +glyph-large-tie-ten-down+ 204)
+(defconstant +glyph-large-tie-ten-down-light+ 205)
+(defconstant +glyph-large-tie-left-down+ 206)
+(defconstant +glyph-large-tie-left-down-light+ 207)
+(defconstant +glyph-large-tie-right-down+ 208)
+(defconstant +glyph-large-tie-right-down-light+ 209)
+
--- /project/gsharp/cvsroot/gsharp/score-pane.lisp	2006/02/14 03:00:52	1.20
+++ /project/gsharp/cvsroot/gsharp/score-pane.lisp	2006/02/26 22:18:39	1.21
@@ -168,12 +168,10 @@
 (defun draw-antialiased-glyph (pane glyph-no x staff-step)
   (let* ((extra (if *light-glyph* 1 0))
 	 (matrix (glyph *font* (+ glyph-no extra)))
-	 (pixmap (pane-pixmap pane matrix))
-	 (width (pixmap-width pixmap))
-	 (height (pixmap-height pixmap)))
+	 (pixmap (pane-pixmap pane matrix)))
     (multiple-value-bind (dx dy) (glyph-offsets *font* (+ glyph-no extra))
       (let ((x1 (+ x dx))
-	    (y1 (+ (staff-step staff-step) dy)))
+	    (y1 (- dy (staff-step staff-step))))
 	(draw-pixmap* pane pixmap x1 y1)))))
 
 ;;; Given a pane, an x position (measured in pixels) a y position 
@@ -627,9 +625,65 @@
 	      (draw-horizontal-beam pane xx1 y1 xx2)
 	      (draw-sloped-beam medium xx1 y1 xx2 y2))))))
 
-;;; FIXME obviously
-(defun draw-tie (pane x1 x2 y)
-  (draw-rectangle* pane x1 (1- y) x2 (1+ y) :ink +blue+))  
+(defun draw-tie-up (pane x1 x2 staff-step)
+  (let ((dist (/ (- x2 x1) (staff-step 4/3))))
+    (if (> dist 19)
+	(let ((xx1 (round (+ x1 (staff-step 10))))
+	      (xx2 (round (- x2 (staff-step 10))))
+	      (y1 (- (round (staff-step (+ staff-step 11/3)))))
+	      (thickness (round (staff-step 2/3))))
+	  (draw-antialiased-glyph pane +glyph-large-tie-left-up+ xx1 staff-step)
+	  (draw-antialiased-glyph pane +glyph-large-tie-right-up+ xx2 staff-step)
+	  (draw-rectangle* pane xx1 y1 xx2 (+ y1 thickness)))
+	(let ((glyph-no (cond ((> dist 18) +glyph-large-tie-ten-up+)
+			      ((> dist 17) +glyph-large-tie-nine-up+)
+			      ((> dist 16) +glyph-large-tie-eight-up+)
+			      ((> dist 15) +glyph-large-tie-seven-up+)
+			      ((> dist 14) +glyph-large-tie-six-up+)
+			      ((> dist 13) +glyph-large-tie-five-up+)
+			      ((> dist 12) +glyph-large-tie-four-up+)
+			      ((> dist 11) +glyph-large-tie-three-up+)
+			      ((> dist 10) +glyph-large-tie-two-up+)
+			      ((> dist 9) +glyph-large-tie-one-up+)
+			      ((> dist 8) +glyph-small-tie-eight-up+)
+			      ((> dist 7) +glyph-small-tie-seven-up+)
+			      ((> dist 6) +glyph-small-tie-six-up+)
+			      ((> dist 5) +glyph-small-tie-five-up+)
+			      ((> dist 4) +glyph-small-tie-four-up+)
+			      ((> dist 3) +glyph-small-tie-three-up+)
+			      ((> dist 2) +glyph-small-tie-two-up+)
+			      (t +glyph-small-tie-one-up+))))
+	  (draw-antialiased-glyph pane glyph-no (round (* 0.5 (+ x1 x2))) staff-step)))))
+
+(defun draw-tie-down (pane x1 x2 staff-step)
+  (let ((dist (/ (- x2 x1) (staff-step 4/3))))
+    (if (> dist 19)
+	(let ((xx1 (round (+ x1 (staff-step 10))))
+	      (xx2 (round (- x2 (staff-step 10))))
+	      (y1 (- (round (staff-step (+ staff-step 11/3)))))
+	      (thickness (round (staff-step 2/3))))
+	  (draw-antialiased-glyph pane +glyph-large-tie-left-down+ xx1 staff-step)
+	  (draw-antialiased-glyph pane +glyph-large-tie-right-down+ xx2 staff-step)
+	  (draw-rectangle* pane xx1 y1 xx2 (+ y1 thickness)))
+	(let ((glyph-no (cond ((> dist 18) +glyph-large-tie-ten-down+)
+			      ((> dist 17) +glyph-large-tie-nine-down+)
+			      ((> dist 16) +glyph-large-tie-eight-down+)
+			      ((> dist 15) +glyph-large-tie-seven-down+)
+			      ((> dist 14) +glyph-large-tie-six-down+)
+			      ((> dist 13) +glyph-large-tie-five-down+)
+			      ((> dist 12) +glyph-large-tie-four-down+)
+			      ((> dist 11) +glyph-large-tie-three-down+)
+			      ((> dist 10) +glyph-large-tie-two-down+)
+			      ((> dist 9) +glyph-large-tie-one-down+)
+			      ((> dist 8) +glyph-small-tie-eight-down+)
+			      ((> dist 7) +glyph-small-tie-seven-down+)
+			      ((> dist 6) +glyph-small-tie-six-down+)
+			      ((> dist 5) +glyph-small-tie-five-down+)
+			      ((> dist 4) +glyph-small-tie-four-down+)
+			      ((> dist 3) +glyph-small-tie-three-down+)
+			      ((> dist 2) +glyph-small-tie-two-down+)
+			      (t +glyph-small-tie-one-down+))))
+	  (draw-antialiased-glyph pane glyph-no (round (* 0.5 (+ x1 x2))) staff-step)))))
 
 ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
 ;;;




More information about the Gsharp-cvs mailing list