lilypond-0.1.12
[lilypond.git] / src / textitem.cc
blobed943f52a27a9492fd7cf60a458ee9f36628ef3f
1 /*
2 textitem.cc -- implement Text_item
4 source file of the LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
10 #include "musicalrequest.hh"
11 #include "paper-def.hh"
12 #include "textitem.hh"
13 #include "stem.hh"
14 #include "molecule.hh"
15 #include "lookup.hh"
19 Text_item::Text_item(Text_req* treq_l, int staffsize_i)
21 staffsize_i_ = staffsize_i;
22 dir_i_ = treq_l->dir_i_;
23 if (!dir_i_)
24 dir_i_ = -1;
25 tdef_l_ = treq_l->tdef_p_;
28 void
29 Text_item::set_default_index()
31 pos_i_ = (dir_i_ > 0) ? staffsize_i_ + 2: -4;
34 void
35 Text_item::do_pre_processing()
37 set_default_index();
41 Molecule*
42 Text_item::brew_molecule_p() const
44 Molecule* mol_p = new Molecule(tdef_l_->create_atom(paper()));
45 mol_p->translate(Offset(0, pos_i_ * paper()->internote()));
47 if(dir_i_<0)
48 mol_p->translate(Offset(0, -mol_p->extent().y.length() ));
50 return mol_p;