2 crescendo.cc -- implement Crescendo
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "crescendo.hh"
12 #include "dimensions.hh"
13 #include "paper-def.hh"
15 #include "score-column.hh"
17 Crescendo::Crescendo ()
20 dyn_b_drul_[LEFT] = dyn_b_drul_[RIGHT] =false;
24 Crescendo::get_symbol () const
26 Real w_dim = extent (X_AXIS).length () - get_broken_left_end_align ();
27 Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
28 if (dyn_b_drul_[LEFT])
32 if (dyn_b_drul_[RIGHT])
39 warning (_ ("crescendo") + " " + _ ("too small"));
43 Drul_array<bool> broken;
46 Score_column* s = dynamic_cast<Score_column*>(spanned_drul_[d]); // UGH
47 broken[d] = (!s->musical_b ());
48 } while (flip (&d) != LEFT);
51 bool continued = broken[Direction (-grow_dir_)];
52 Real height = paper_l()->get_var ("crescendo_height");
53 Real thick = paper_l ()->get_var ("crescendo_thickness");
55 return Molecule (lookup_l ()->hairpin (w_dim, height, thick, grow_dir_ < 0, continued));
59 Crescendo::do_brew_molecule_p () const
62 Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
63 Real x_off_dim = get_broken_left_end_align ();
65 if (dyn_b_drul_[LEFT])
66 x_off_dim += absdyn_dim;
69 Molecule s (get_symbol ());
70 m_p->add_molecule (s);
71 m_p->translate_axis (x_off_dim, X_AXIS);