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_ > 2 && !rest_b_)
55 else if (balltype_i_ == 0)
61 Note_head::set_rhythmic (Rhythmic_req*r_req_l)
63 balltype_i_ = r_req_l->duration_.durlog_i_;
64 dots_i_ = r_req_l->duration_.dots_i_;
68 IMPLEMENT_IS_TYPE_B1(Note_head,Item);
71 Note_head::do_print()const
76 DOUT << "balltype_i_ "<< balltype_i_ << ", position_i_ = "<< position_i_
77 << "dots_i_ " << dots_i_;
83 Note_head::compare (Note_head *const &a, Note_head * const &b)
85 return a->position_i_ - b->position_i_;
91 if (!(position_i_ %2) && rest_b_ && balltype_i_ == 0)
93 else if (!(position_i_ %2))
101 Note_head::brew_molecule_p() const
103 ((Note_head*)this)->set_dots(); // UGH GUH
105 Paper_def *p = paper();
106 Real inter_f = p->internote_f();
110 bool streepjes_b = (position_i_<-1) || (position_i_ > staff_size_i_+1);
113 s = p->lookup_l()->ball (balltype_i_);
116 s = p->lookup_l()->rest (balltype_i_, streepjes_b);
118 out = new Molecule (Atom (s));
119 out->translate (x_dir_i_ * s.dim.x().length () , X_AXIS);
122 Symbol d = p->lookup_l()->dots (dots_i_);
125 dm.translate (inter_f * dot_delta_y_i_ , Y_AXIS);
137 int dir = sign (position_i_);
138 int s =(position_i_<-1) ? -((-position_i_)/2): (position_i_-staff_size_i_)/2;
140 Symbol str = p->lookup_l()->streepjes (s);
144 sm.translate (-inter_f* dir, Y_AXIS);
148 out->translate (inter_f*position_i_, Y_AXIS);