2 notehead.cc -- implement Note_head
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
11 #include "note-head.hh"
13 #include "paper-def.hh"
15 #include "molecule.hh"
16 #include "musical-request.hh"
19 Note_head::Note_head ()
27 Note_head::do_pre_processing ()
29 // 8 ball looks the same as 4 ball:
32 if (dots_l_) // move into Rhythmic_head?
33 dots_l_->position_i_ = position_i_;
37 Note_head::compare (Note_head *const &a, Note_head * const &b)
39 return a->position_i_ - b->position_i_;
43 Note_head::do_width () const
45 Molecule a = lookup_l ()->ball (balltype_i_);
46 Interval i = a.dim_[X_AXIS];
47 i+= x_dir_ * i.length ();
52 Note_head::do_brew_molecule_p() const
55 Paper_def *p = paper_l ();
56 Real inter_f = staff_line_leading_f ()/2;
57 int sz = lines_i ()-1;
59 int streepjes_i = abs (position_i_) < sz
61 : (abs(position_i_) - sz) /2;
65 if (note_head_type_str_.length_i ()) {
66 if (note_head_type_str_ == "normal") // UGH
67 note_head_type_str_ = "";
68 head = lookup_l()->special_ball (balltype_i_, note_head_type_str_);
71 head = lookup_l()->ball (balltype_i_);
73 out = new Molecule (Molecule (head));
74 out->translate_axis (x_dir_ * head.dim_[X_AXIS].length (), X_AXIS);
80 Direction dir = sign (position_i_);
81 Interval hd = head.dim_[X_AXIS];
82 Real hw = hd.length ()/4;
85 = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw,
88 int parity = abs(position_i_) % 2;
90 for (int i=0; i < streepjes_i; i++)
93 s.translate_axis (-dir * inter_f * (i*2 + parity),
95 out->add_molecule (s);
99 out->translate_axis (inter_f*position_i_, Y_AXIS);