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;
27 Crescendo::get_symbol () const
29 Real w_dim
= extent (X_AXIS
).length () - get_broken_left_end_align ();
30 Real absdyn_dim
= paper_l ()-> get_var ("crescendo_shorten");
31 if (dyn_b_drul_
[LEFT
])
35 if (dyn_b_drul_
[RIGHT
])
42 warning (_ ("crescendo") + " " + _ ("too small"));
46 Drul_array
<bool> broken
;
49 Score_column
* s
= dynamic_cast<Score_column
*>(spanned_drul_
[d
]); // UGH
50 broken
[d
] = (!s
->musical_b ());
51 } while (flip (&d
) != LEFT
);
54 bool continued
= broken
[Direction (-grow_dir_
)];
55 Real height
= paper_l()->get_var ("crescendo_height");
56 Real thick
= paper_l ()->get_var ("crescendo_thickness");
58 return Molecule (lookup_l ()->hairpin (w_dim
, height
, thick
, grow_dir_
< 0, continued
));
62 Crescendo::do_brew_molecule_p () const
65 Real absdyn_dim
= paper_l ()-> get_var ("crescendo_shorten");
66 Real x_off_dim
= get_broken_left_end_align ();
68 if (dyn_b_drul_
[LEFT
])
69 x_off_dim
+= absdyn_dim
;
72 Molecule
s (get_symbol ());
73 m_p
->add_molecule (s
);
74 m_p
->translate_axis (x_off_dim
, X_AXIS
);