]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/crescendo.cc
release: 1.1.1
[lilypond.git] / lily / crescendo.cc
index 1bd91d0f0cde3b4cdf9c856f65041cc9afbb076c..4af8ceadcdf1cc49d3e9e443482d8831aa62b50c 100644 (file)
@@ -3,22 +3,22 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+  (c)  1997--1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "molecule.hh"
-#include "dimen.hh"
 #include "crescendo.hh"
 #include "lookup.hh"
+#include "dimensions.hh"
 #include "paper-def.hh"
 #include "debug.hh"
+#include "score-column.hh"
 
 Crescendo::Crescendo()
 {
   grow_dir_ =0;
-  dir_ = DOWN ;
+  dir_ = DOWN;
   dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false;
-  inside_staff_b_ = false;
 }
 
 Interval
@@ -31,24 +31,33 @@ static Real absdyn_dim = 10 PT;     // ugh
 
 Atom
 Crescendo::get_symbol() const
-{    
+{
   Real w_dim = width().length ();
-  if (dyn_b_drul_[LEFT]) 
+  if (dyn_b_drul_[LEFT])
     {
       w_dim -= absdyn_dim;
     }
-  if (dyn_b_drul_[RIGHT]) 
+  if (dyn_b_drul_[RIGHT])
     {
       w_dim -= absdyn_dim;
     }
-  
-  if (w_dim < 0) 
+
+  if (w_dim < 0)
     {
-      warning ("Crescendo too small");
+      warning (_ ("crescendo") + " " + _("too small"));
       w_dim = 0;
     }
 
-  return Atom (paper()->lookup_l ()->hairpin (w_dim, grow_dir_ < 0));
+  Drul_array<bool> broken;
+  Direction d = LEFT;
+  do {
+    Score_column* s = (Score_column* )spanned_drul_[d] ; // UGH
+    broken[d] = (!s->musical_b());
+  } while (flip(&d) != LEFT);
+  
+
+  bool continued = broken[(Direction)-grow_dir_];
+  return Atom (lookup_l ()->hairpin (w_dim, grow_dir_ < 0, continued));
 }
 
 Molecule*
@@ -58,11 +67,11 @@ Crescendo::brew_molecule_p() const
   Real x_off_dim=0.0;
   if (dyn_b_drul_[LEFT])
     x_off_dim += absdyn_dim;
-  
+
   m_p = new Molecule;
   Atom s (get_symbol());
-  m_p->add (Atom (s));
-  m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ()));
+  m_p->add_atom  (s);
+  m_p->translate (Offset (x_off_dim, coordinate_offset_f_));
   return m_p;
 }