X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ftext-spanner.cc;h=0e6226bf1f318ca37406b45d43a6ba7ec5e51ac2;hb=1a66290a98e7de8d6d41485b5b71a9f7e1fe35c7;hp=3f231223d880f94251381968bc445a2b4158455a;hpb=daee8243ff1c66bc714455a2d265ab02f03546ec;p=lilypond.git diff --git a/lily/text-spanner.cc b/lily/text-spanner.cc index 3f231223d8..0e6226bf1f 100644 --- a/lily/text-spanner.cc +++ b/lily/text-spanner.cc @@ -1,71 +1,94 @@ +/* + text-spanner.cc -- implement Text_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + #include "molecule.hh" #include "boxes.hh" #include "text-spanner.hh" #include "text-def.hh" #include "debug.hh" #include "paper-def.hh" - +#include "symbol.hh" void -Text_spanner::set_support(Directional_spanner*d) +Text_spanner::set_support (Directional_spanner*d) { - support = d; - add_dependency(d); + if (support_span_l_) + remove_dependency (support_span_l_); + + support_span_l_ =d; + add_dependency (d); } Text_spanner::Text_spanner() { - support = 0; + spec_p_ = 0; + support_span_l_ = 0; } + +IMPLEMENT_IS_TYPE_B1(Text_spanner,Spanner); + void Text_spanner::do_print() const { - spec.print(); + spec_p_->print(); } void Text_spanner::do_post_processing() { - switch(spec.align_i_) { - case 0: - text_off_ = support->center() + - Offset(0,support->dir_i_ * paper()->internote() * 4); // todo - break; - default: - assert(false); - break; - } + text_off_ = support_span_l_->center() + + Offset (0,support_span_l_->dir_i_ * paper()->internote_f () * 4); // todo } Molecule* Text_spanner::brew_molecule_p() const { - Atom tsym (spec.create_atom(paper())); - tsym.translate(text_off_); + Atom tsym (spec_p_->get_atom (paper(),0)); + tsym.translate (text_off_); Molecule*output = new Molecule; - output->add( tsym ); + output->add (tsym); return output; } void Text_spanner::do_pre_processing() { - right = support->right; - left = support->left; - assert(left && right); + right_col_l_ = support_span_l_->right_col_l_; + left_col_l_ = support_span_l_->left_col_l_; + assert (left_col_l_ && right_col_l_); } Interval Text_spanner::height()const { - return brew_molecule_p()->extent().y; + return brew_molecule_p()->extent ().y (); +} + +void +Text_spanner::do_substitute_dependency (Score_elem* o, Score_elem*n) +{ + if (support_span_l_ == o) + support_span_l_ = (Directional_spanner*) (n?n->spanner():0); +} + + +Text_spanner::~Text_spanner() +{ + delete spec_p_; } -Spanner* -Text_spanner::do_break_at(PCol*c1, PCol*c2)const +Text_spanner::Text_spanner (Text_spanner const&s) + : Spanner (s) { - return new Text_spanner(*this); // todo + support_span_l_ = s.support_span_l_; + spec_p_ = s.spec_p_? s.spec_p_->clone() : 0; + text_off_ = s.text_off_; }