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

Robert Strandh rstrandh at common-lisp.net
Mon Dec 5 05:53:31 UTC 2005


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

Modified Files:
	drawing.lisp 
Log Message:
The spacing algorithm now takes into account the left bulge of the
first element of each bar of the measure.  Check the new behavior by
loading Scores/spacetest.gsh and observe how lyrics are spaced. 


Date: Mon Dec  5 06:53:30 2005
Author: rstrandh

Index: gsharp/drawing.lisp
diff -u gsharp/drawing.lisp:1.49 gsharp/drawing.lisp:1.50
--- gsharp/drawing.lisp:1.49	Mon Dec  5 06:33:24 2005
+++ gsharp/drawing.lisp	Mon Dec  5 06:53:30 2005
@@ -288,10 +288,16 @@
 ;;; measure).  These values, together with an elasticity function at
 ;;; the beginning of a measure, are used to compute the total
 ;;; elasticity function of a measure.
-(defun compute-elasticity-functions (measures method)
+(defun compute-elasticity-functions (measures method pane)
   (loop for measure in measures
 	do (setf (prefix-elasticity-function measure)
-		 (make-elementary-elasticity (min-width method) 0.0001))
+		 (let ((prefix-width
+			(max (min-width method)
+			     (if (zerop (flexichain:nb-elements (timelines measure)))
+				 0
+				 (loop for element in (elements (flexichain:element* (timelines measure) 0))
+				       maximize (left-bulge element pane))))))
+		   (make-elementary-elasticity prefix-width 0.0001)))
 	do (loop with result = (prefix-elasticity-function measure)
 		 with timelines = (timelines measure)
 		 for i from 0 below (flexichain:nb-elements timelines)
@@ -401,7 +407,7 @@
 	 (lambda (measures)
 	   (compute-elasticities measures method)
 	   (compute-gaps measures method pane)
-	   (let* ((e-fun (compute-elasticity-functions measures method))
+	   (let* ((e-fun (compute-elasticity-functions measures method pane))
 		  ;; FIXME:  it would be much better to compress the system
 		  ;; proportionally, so that every smallest gap gets shrunk
 		  ;; by the same percentage




More information about the Gsharp-cvs mailing list