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 Rhythmic_head::do_pre_processing ();
32 // 8 ball looks the same as 4 ball:
35 if (dots_l_) // move into Rhythmic_head?
36 dots_l_->position_i_ = int (position_f ());
42 Note_head::compare (Note_head *const &a, Note_head * const &b)
44 return sign(a->position_f () - b->position_f ());
48 Don't account for ledgerlines in the width.
51 Note_head::do_width () const
53 Molecule a = lookup_l ()->notehead (balltype_i_, ""); // UGH
54 Interval i = a.dim_[X_AXIS];
59 Note_head::do_brew_molecule_p() const
61 Real inter_f = staff_line_leading_f ()/2;
62 int sz = lines_i ()-1;
64 int streepjes_i = abs (position_f ()) < sz
66 : (abs(position_f ()) - sz) /2;
70 SCM style =get_elt_property ("style");
71 if (style != SCM_UNDEFINED)
73 type = ly_scm2string (style);
76 Molecule* out = new Molecule (lookup_l()->notehead (balltype_i_, type));
82 Direction dir = (Direction)sign (position_f ());
83 Interval hd = out->dim_[X_AXIS];
84 Real hw = hd.length ()/4;
87 = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw,
90 int parity = abs(int (position_f ())) % 2;
92 for (int i=0; i < streepjes_i; i++)
95 s.translate_axis (-dir * inter_f * (i*2 + parity),
97 out->add_molecule (s);