lilypond-0.0.32
[lilypond.git] / src / textspanner.cc
blob8cd1b8ac3f2f9dc2d8d0fb6e1cce4b4f1e691fed
1 #include "molecule.hh"
2 #include "boxes.hh"
3 #include "textspanner.hh"
4 #include "textdef.hh"
5 #include "debug.hh"
6 #include "paperdef.hh"
8 NAME_METHOD(Text_spanner);
10 void
11 Text_spanner::set_support(Directional_spanner*d)
13 support = d;
14 add_depedency(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