X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fcrescendo.cc;h=d5c16cb442e5e607fbdbe9d2b0ac81e99429b5ee;hb=13e79c0250d34b6bdfbafbc551ef64e8b59b2991;hp=29aa3ab84176b1e0f2105a157b47f627ec8bfb96;hpb=a41a7fb966e8552cc8da7c4eab1b60eb7b8eff3a;p=lilypond.git diff --git a/lily/crescendo.cc b/lily/crescendo.cc index 29aa3ab841..d5c16cb442 100644 --- a/lily/crescendo.cc +++ b/lily/crescendo.cc @@ -1,38 +1,70 @@ /* crescendo.cc -- implement Crescendo - source file of the LilyPond music typesetter + source file of the GNU LilyPond music typesetter (c) 1997 Han-Wen Nienhuys */ +#include "molecule.hh" +#include "dimen.hh" #include "crescendo.hh" #include "lookup.hh" #include "paper-def.hh" +#include "debug.hh" -Crescendo::Crescendo(int s) +Crescendo::Crescendo() { - staff_size_i_ = s; - grow_dir_i_ =0; - dir_i_ = -1 ; + grow_dir_i_ =0; + dir_i_ = -1 ; + left_dyn_b_ = right_dyn_b_ =false; + inside_staff_b_ = false; } -Spanner* -Crescendo::do_break_at(PCol*, PCol*)const +Interval +Crescendo::symbol_height()const { - return new Crescendo(*this); + return get_symbol().dim[Y_AXIS]; } +static Real absdyn_dim = 10 PT; // ugh + +Symbol +Crescendo::get_symbol()const +{ + Real w_dim = width().length (); + if ( left_dyn_b_) + { + w_dim -= absdyn_dim; + } + if ( right_dyn_b_) + { + w_dim -= absdyn_dim; + } + + if (w_dim < 0) + { + warning ("Crescendo too small"); + w_dim = 0; + } + + return Symbol (paper()->lookup_l ()->hairpin (w_dim, grow_dir_i_ < 0)); +} Molecule* -Crescendo::brew_molecule_p() const return m_p ; +Crescendo::brew_molecule_p() const { - m_p = new Molecule; - Real w_f = width().length(); - Symbol s( paper()->lookup_l()->hairpin(w_f, grow_dir_i_ < 0) ); - m_p->add(Atom(s)); - int pos = (dir_i_ >0) ? staff_size_i_ + 4 : - 4 ; - m_p->translate(Offset(0,pos * paper()->internote())); + Molecule* m_p =0; + Real x_off_dim=0.0; + if ( left_dyn_b_) + x_off_dim += absdyn_dim; + + m_p = new Molecule; + Symbol s (get_symbol()); + m_p->add (Atom (s)); + m_p->translate (Offset (x_off_dim, pos_i_ * paper()->internote_f ())); + return m_p; } -IMPLEMENT_STATIC_NAME(Crescendo); + +IMPLEMENT_IS_TYPE_B1(Crescendo,Spanner);