2 notehead.cc -- implement Note_head
4 source file of the GNU LilyPond music typesetter
6 (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
10 #include "note-head.hh"
13 #include "paper-def.hh"
15 #include "molecule.hh"
16 #include "musical-request.hh"
20 Note_head::Note_head(int ss)
32 Note_head::do_pre_processing()
34 // 8 ball looks the same as 4 ball:
35 if (balltype_i_ > 4 && !rest_b_)
40 Note_head::set_rhythmic(Rhythmic_req*r_req_l)
42 balltype_i_ = r_req_l->duration_.type_i_;
43 dots_i_ = r_req_l->duration_.dots_i_;
46 IMPLEMENT_STATIC_NAME(Note_head);
49 Note_head::do_print()const
54 mtor << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
55 << "dots_i_ " << dots_i_;
61 Note_head::compare(Note_head *const &a, Note_head * const &b)
63 return a->position_i_ - b->position_i_;
67 Note_head::brew_molecule_p() const
70 Paper_def *p = paper();
72 Real dy = p->internote_f();
75 s = p->lookup_l()->ball(balltype_i_);
77 s = p->lookup_l()->rest(balltype_i_);
79 out = new Molecule(Atom(s));
81 Symbol d = p->lookup_l()->dots(dots_i_);
84 if (!(position_i_ %2))
85 dm.translate(Offset(0,dy));
88 out->translate(Offset(x_dir_i_ * p->note_width(),0));
89 bool streepjes = (position_i_<-1)||(position_i_ > staff_size_i_+1);
91 if (rest_b_ && balltype_i_ > 2)
95 int dir = sign(position_i_);
96 int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
97 Symbol str = p->lookup_l()->streepjes(s);
101 sm.translate(Offset(0,-dy* dir));
105 out->translate(Offset(0,dy*position_i_));