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"
14 #include "molecule.hh"
15 #include "musical-request.hh"
19 Note_head::flip_around_stem (Direction d)
21 translate_axis (do_width ().length () * d, X_AXIS);
24 Note_head::Note_head ()
29 Note_head::do_pre_processing ()
31 // 8 ball looks the same as 4 ball:
34 if (dots_l_) // move into Rhythmic_head?
35 dots_l_->position_i_ = position_i_;
41 Note_head::compare (Note_head *const &a, Note_head * const &b)
43 return a->position_i_ - b->position_i_;
47 Don't account for ledgerlines in the width.
50 Note_head::do_width () const
52 Molecule a = lookup_l ()->notehead (balltype_i_, ""); // UGH
53 Interval i = a.dim_[X_AXIS];
58 Note_head::do_brew_molecule_p() const
60 Real inter_f = staff_line_leading_f ()/2;
61 int sz = lines_i ()-1;
63 int streepjes_i = abs (position_i_) < sz
65 : (abs(position_i_) - sz) /2;
69 SCM style =get_elt_property (style_scm_sym);
70 if (style != SCM_BOOL_F)
72 type = ly_scm2string (SCM_CDR(style));
75 Molecule* out = new Molecule (lookup_l()->notehead (balltype_i_, type));
81 Direction dir = sign (position_i_);
82 Interval hd = out->dim_[X_AXIS];
83 Real hw = hd.length ()/4;
86 = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw,
89 int parity = abs(position_i_) % 2;
91 for (int i=0; i < streepjes_i; i++)
94 s.translate_axis (-dir * inter_f * (i*2 + parity),
96 out->add_molecule (s);
101 out->translate_axis (inter_f*position_i_, Y_AXIS);