2 crescendo.cc -- implement Crescendo
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
10 #include "crescendo.hh"
12 #include "dimensions.hh"
13 #include "paper-def.hh"
15 #include "paper-column.hh"
18 Crescendo::Crescendo ()
20 set_elt_property ("dynamic-drul", gh_cons (SCM_BOOL_F, SCM_BOOL_F));
26 Crescendo::do_brew_molecule_p () const
28 Real absdyn_dim = paper_l ()-> get_var ("crescendo_shorten");
29 Real extra_left = get_broken_left_end_align ();
31 SCM dir = get_elt_property("grow-dir");
32 SCM dyns = get_elt_property ("dynamic-drul");
34 if (!isdir_b (dir) || !gh_pair_p (dyns))
36 Crescendo * me = (Crescendo*)this;
37 me->set_elt_property ("transparent", SCM_BOOL_T);
41 Direction gd = to_dir (dir);
43 bool dynleft= to_boolean (gh_car (dyns));
44 bool dynright = to_boolean (gh_cdr (dyns));
47 extra_left += absdyn_dim;
51 Real width = spanner_length()- get_broken_left_end_align ();
64 warning (_ ("crescendo") + " " + _ ("too small"));
68 Drul_array<bool> broken;
71 Paper_column* s = dynamic_cast<Paper_column*>(spanned_drul_[d]); // UGH
72 broken[d] = (!s->musical_b ());
73 } while (flip (&d) != LEFT);
76 bool continued = broken[Direction (-gd)];
77 Real height = paper_l()->get_var ("crescendo_height");
78 Real thick = paper_l ()->get_var ("crescendo_thickness");
80 const char* hairpin = (gd < 0)? "decrescendo" : "crescendo";
83 m->dim_.x () = Interval (0, width);
84 m->dim_.y () = Interval (-2*height, 2*height);
86 Atom *a = new Atom(gh_list (ly_symbol2scm (hairpin),
87 gh_double2scm (thick),
88 gh_double2scm (width),
89 gh_double2scm (height),
90 gh_double2scm (continued ? height/2 : 0.0),
93 m->add_atom (a->self_scm_);
94 m->translate_axis (extra_left, X_AXIS);