]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/lookup.cc
release: 1.5.29
[lilypond.git] / lily / lookup.cc
index f2e89466b6d91c7a813b25465a36ab9052d10453..60cc0c6269c14eff04c7321fa1779ba36afd556e 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 
   Jan Nieuwenhuizen <janneke@gnu.org>
 
@@ -37,7 +37,7 @@ Lookup::beam (Real slope, Real width, Real thick)
         Interval (min_y, max_y));
 
   
-  SCM at = gh_list (ly_symbol2scm ("beam"),
+  SCM at = scm_list_n (ly_symbol2scm ("beam"),
                    gh_double2scm (width),
                    gh_double2scm (slope),
                    gh_double2scm (thick),
@@ -57,7 +57,7 @@ Lookup::dashed_slur (Bezier b, Real thick, Real dash)
       l = gh_cons (ly_offset2scm (b.control_[i]), l);
     }
 
-  SCM at = (gh_list (ly_symbol2scm ("dashed-slur"),
+  SCM at = (scm_list_n (ly_symbol2scm ("dashed-slur"),
                               gh_double2scm (thick), 
                               gh_double2scm (dash),
                               ly_quote_scm (l),
@@ -80,7 +80,7 @@ Lookup::blank (Box b)
 Molecule
 Lookup::filledbox (Box b) 
 {
-  SCM  at  = (gh_list (ly_symbol2scm ("filledbox"),
+  SCM  at  = (scm_list_n (ly_symbol2scm ("filledbox"),
                     gh_double2scm (-b[X_AXIS][LEFT]),
                     gh_double2scm (b[X_AXIS][RIGHT]),                 
                     gh_double2scm (-b[Y_AXIS][DOWN]),
@@ -125,11 +125,14 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick)
 {
   Real alpha = (curve.control_[3] - curve.control_[0]).arg ();
   Bezier back = curve;
-
+  Offset perp = curvethick * complex_exp (Offset (0, alpha + M_PI/2)) * 0.5;
   back.reverse ();
-  back.control_[1] += curvethick * complex_exp (Offset (0, alpha + M_PI/2));
-  back.control_[2] += curvethick * complex_exp (Offset (0, alpha + M_PI/2));  
+  back.control_[1] += perp;
+  back.control_[2] += perp;
 
+  curve.control_[1] -= perp;
+  curve.control_[2] -= perp;
+  
   SCM scontrols[8];
 
   for (int i=4; i--;)
@@ -148,12 +151,16 @@ Lookup::slur (Bezier curve, Real curvethick, Real linethick)
     }
   
   
-  SCM at = (gh_list (ly_symbol2scm ("bezier-sandwich"),
+  SCM at = (scm_list_n (ly_symbol2scm ("bezier-sandwich"),
                     ly_quote_scm (list),
                     gh_double2scm (linethick),
                     SCM_UNDEFINED));
+  Box b(curve.extent (X_AXIS),
+       curve.extent (Y_AXIS));
+
+  b[X_AXIS].unite (back.extent (X_AXIS));
+  b[Y_AXIS].unite (back.extent (Y_AXIS));
 
-  Box b (curve.extent (X_AXIS), curve.extent (Y_AXIS));
   return Molecule (b, at);
 }
 
@@ -161,8 +168,8 @@ Molecule
 Lookup::accordion (SCM s, Real staff_space, Font_metric *fm) 
 {
   Molecule m;
-  String sym = ly_scm2string (gh_car (s));
-  String reg = ly_scm2string (gh_car (gh_cdr (s)));
+  String sym = ly_scm2string (ly_car (s));
+  String reg = ly_scm2string (ly_car (ly_cdr (s)));
 
   if (sym == "Discant")
     {
@@ -355,3 +362,21 @@ Lookup::accordion (SCM s, Real staff_space, Font_metric *fm)
   return m;  
 }
 
+/*
+  TODO: should use slope instead?  Angle gives nasty rad <-> degree
+  conversions.
+*/
+Molecule
+Lookup::repeat_slash (Real w, Real s, Real t)
+{
+  SCM wid = gh_double2scm (w);
+  SCM sl = gh_double2scm (s);
+  SCM thick = gh_double2scm (t);
+  SCM slashnodot = scm_list_n (ly_symbol2scm ("repeat-slash"),
+                           wid, sl, thick, SCM_UNDEFINED);
+
+  Box b (Interval (0, w + sqrt (sqr(t/s) + sqr (t))),
+        Interval (0, w * s));
+
+  return Molecule (b, slashnodot); //  http://slashnodot.org
+}