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"
21 Separate notehead into
28 and Stem takes Rhythmic_heads
32 Note_head::Note_head(int ss)
45 Note_head::do_pre_processing()
47 // 8 ball looks the same as 4 ball:
48 if (balltype_i_ > 4 && !rest_b_)
54 else if (balltype_i_ == 2)
60 Note_head::set_rhythmic(Rhythmic_req*r_req_l)
62 balltype_i_ = r_req_l->duration_.type_i_;
63 dots_i_ = r_req_l->duration_.dots_i_;
67 IMPLEMENT_IS_TYPE_B1(Note_head,Item);
70 Note_head::do_print()const
75 mtor << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
76 << "dots_i_ " << dots_i_;
82 Note_head::compare(Note_head *const &a, Note_head * const &b)
84 return a->position_i_ - b->position_i_;
90 if (!(position_i_ %2) && rest_b_ && balltype_i_ == 1)
92 else if (!(position_i_ %2))
100 Note_head::brew_molecule_p() const
102 ((Note_head*)this)->set_dots(); // UGH GUH
104 Paper_def *p = paper();
105 Real inter_f = p->internote_f();
109 bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
112 s = p->lookup_l()->ball(balltype_i_);
114 s = p->lookup_l()->rest(balltype_i_, streepjes_b);
116 out = new Molecule(Atom(s));
117 out->translate( x_dir_i_ * s.dim.x().length() , X_AXIS);
119 Symbol d = p->lookup_l()->dots(dots_i_ );
122 dm.translate( inter_f * dot_delta_y_i_ , Y_AXIS);
132 int dir = sign(position_i_);
133 int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
135 Symbol str = p->lookup_l()->streepjes(s);
139 sm.translate(-inter_f* dir, Y_AXIS);
143 out->translate(inter_f*position_i_, Y_AXIS);