]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/bow.cc
patch::: 1.1.52.mb2
[lilypond.git] / lily / bow.cc
index 770fd8a9735feffce6bf5a67087a5e5b1207fbeb..6553412fa10886f579442000945f803dffffdeda 100644 (file)
@@ -3,8 +3,8 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
-      Jan Nieuwenhuizen <jan@digicash.com>
+  (c)  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+      Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "bow.hh"
@@ -15,8 +15,6 @@
 #include "bezier.hh"
 #include "main.hh"
 
-IMPLEMENT_IS_TYPE_B1(Bow,Directional_spanner);
-
 Bow::Bow ()
 {
   dy_f_drul_[LEFT] = dy_f_drul_[RIGHT] = 0.0;
@@ -24,19 +22,23 @@ Bow::Bow ()
 }
 
 Molecule*
-Bow::brew_molecule_p () const
+Bow::do_brew_molecule_p () const
 {
-  Molecule* mol_p = new Molecule;
-  
+  Real thick = paper_l ()->get_var ("slur_thickness");
   Array<Offset> c = get_controls ();
-  Atom a = paper ()->lookup_l ()->slur (c);
   Real dy = c[3].y () - c[0].y ();
+  Molecule a;
+
+  SCM d =  get_elt_property (dashed_scm_sym);
+  if (d == SCM_BOOL_F)
+    a = lookup_l ()->slur (c);
+  else
+    a = lookup_l ()->dashed_slur (c, thick, gh_scm2int (SCM_CDR(d)));
+
   if (check_debug && !monitor->silent_b ("Bow"))
     {
       static int i = 1;
       cout << "******" << i++ << "******" << endl;
-      // gcc 2.7.2: ices
-//      cout << "c0.y: " << c[0].y << endl;
       cout << "c0.y: " << c[0].y () << endl;
       cout << "c3.y: " << c[3].y () << endl;
       cout << "dy: " << dy << endl;
@@ -46,33 +48,41 @@ Bow::brew_molecule_p () const
     }
   a.translate (Offset (dx_f_drul_[LEFT], dy_f_drul_[LEFT]));
 
-  mol_p->add (a);
-
-  return mol_p;
+  return new Molecule (a); 
 }
 
 Offset
 Bow::center () const
 {
   Real dy = dy_f_drul_[RIGHT] - dy_f_drul_[LEFT];
-
-  Real dx = width ().length ();
+  Real dx =  extent(X_AXIS).length ();
 
   return Offset (dx / 2, dy);
 }
 
+
+
+/*
+   Ugh.  Control points are too crude measures.
+ */
 Interval
-Bow::do_width () const    
+Bow::do_height () const
 {
-  Interval i = Spanner::do_width ();
-  Real dx = i.length();
-  return Interval (0, dx);
+  Interval iv;
+  Array<Offset> c (get_controls());
+  for (int i=0; i < c.size (); i++)
+    {
+      Real y = c[i][Y_AXIS] + dy_f_drul_[LEFT];
+      iv.unite (Interval (y,y));
+    }
+  return iv;
 }
 
+
 Array<Offset>
 Bow::get_controls () const
 {
-  Bezier_bow b (paper ());
+  Bezier_bow b (paper_l ());
   b.set (get_encompass_offset_arr (), dir_);
   b.calc ();
   Array<Offset> controls;
@@ -89,18 +99,11 @@ Bow::get_encompass_offset_arr () const
 {
   Offset d (dx_f_drul_[RIGHT] - dx_f_drul_[LEFT],
     dy_f_drul_[RIGHT] - dy_f_drul_[LEFT]);
-  d.x() += width (). length ();
+  d.x() += extent (X_AXIS). length ();
 
-#define RESIZE_ICE
-#ifndef RESIZE_ICE
   Array<Offset> notes;
-  notes.push (Offset 0, 0));
+  notes.push (Offset (0, 0));
   notes.push (d);
-#else
-  Array<Offset> notes (2);
-  notes[0] = Offset (0, 0);
-  notes[1] = Offset (d);
-#endif
 
   return notes;
 }