lilypond-1.1.31
[lilypond.git] / src / textspanner.cc
blob8a648232f663acac25beab3e28776433ccd2f311
1 #include "molecule.hh"
2 #include "boxes.hh"
3 #include "textspanner.hh"
4 #include "text-def.hh"
5 #include "debug.hh"
6 #include "paper-def.hh"
10 void
11 Text_spanner::set_support(Directional_spanner*d)
13 support = d;
14 add_dependency(d);
17 Text_spanner::Text_spanner()
19 support = 0;
22 void
23 Text_spanner::do_print() const
25 spec.print();
28 void
29 Text_spanner::do_post_processing()
31 switch(spec.align_i_) {
32 case 0:
33 text_off_ = support->center() +
34 Offset(0,support->dir_i_ * paper()->internote() * 4); // todo
35 break;
36 default:
37 assert(false);
38 break;
42 Molecule*
43 Text_spanner::brew_molecule_p() const
45 Atom tsym (spec.create_atom(paper()));
46 tsym.translate(text_off_);
48 Molecule*output = new Molecule;
49 output->add( tsym );
50 return output;
53 void
54 Text_spanner::do_pre_processing()
56 right = support->right;
57 left = support->left;
58 assert(left && right);
61 Interval
62 Text_spanner::height()const
64 return brew_molecule_p()->extent().y;
67 Spanner*
68 Text_spanner::do_break_at(PCol*c1, PCol*c2)const
70 return new Text_spanner(*this); // todo