lilypond-0.0.32
[lilypond.git] / src / textitem.cc
blob110e95e3bfe166488c9d84f0f91044be5375cac7
1 #include "musicalrequest.hh"
2 #include "paperdef.hh"
3 #include "textitem.hh"
4 #include "stem.hh"
5 #include "molecule.hh"
6 #include "lookup.hh"
8 NAME_METHOD(Text_item);
10 Text_item::Text_item(Text_req* treq_l, int staffsize_i)
12 staffsize_i_ = staffsize_i;
13 dir_i_ = treq_l->dir_i_;
14 if (!dir_i_)
15 dir_i_ = -1;
16 tdef_l_ = treq_l->tdef_p_;
19 void
20 Text_item::set_default_pos()
22 pos_i_ = (dir_i_ > 0) ? staffsize_i_ + 2: -4;
25 void
26 Text_item::do_pre_processing()
28 set_default_pos();
32 Molecule*
33 Text_item::brew_molecule_p() const
35 Molecule* mol_p = new Molecule(tdef_l_->create_atom(paper()));
36 mol_p->translate(Offset(0, pos_i_ * paper()->internote()));
38 if(dir_i_<0)
39 mol_p->translate(Offset(0, -mol_p->extent().y.length() ));
41 return mol_p;