X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fnote-head.cc;h=9561ba341faf46d0a85cca4ce8b09e62332f5e47;hb=670a98f23a2561c6a4a4a19bb72c776189715541;hp=10cb7b1c2518df970620ddd0f609c3b71448ff28;hpb=75be12aa75a535af753d6125bfc03da3ee303b36;p=lilypond.git diff --git a/lily/note-head.cc b/lily/note-head.cc index 10cb7b1c25..9561ba341f 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -3,26 +3,26 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1999 Han-Wen Nienhuys */ #include "misc.hh" #include "dots.hh" #include "note-head.hh" #include "debug.hh" -#include "paper-def.hh" #include "lookup.hh" #include "molecule.hh" #include "musical-request.hh" +void +Note_head::flip_around_stem (Direction d) +{ + translate_axis (do_width ().length () * d, X_AXIS); +} Note_head::Note_head () { - x_dir_ = CENTER; - staff_size_i_= 8; // UGH - steps_i_ = 0; position_i_ = 0; - extremal_i_ = 0; } void @@ -35,54 +35,61 @@ Note_head::do_pre_processing () dots_l_->position_i_ = position_i_; } - - - int Note_head::compare (Note_head *const &a, Note_head * const &b) { return a->position_i_ - b->position_i_; } +/** + Don't account for ledgerlines in the width. + */ Interval Note_head::do_width () const { - Atom a = lookup_l ()->ball (balltype_i_); + Molecule a = lookup_l ()->notehead (balltype_i_, ""); // UGH Interval i = a.dim_[X_AXIS]; - i+= x_dir_ * i.length (); return i; } Molecule* Note_head::do_brew_molecule_p() const { - Molecule*out = 0; - Paper_def *p = paper(); - Real inter_f = p->internote_f (); + Real inter_f = staff_line_leading_f ()/2; + int sz = lines_i ()-1; - // ugh - int streepjes_i = abs (position_i_) < staff_size_i_/2 + int streepjes_i = abs (position_i_) < sz ? 0 - : (abs(position_i_) - staff_size_i_/2) /2; + : (abs(position_i_) - sz) /2; + + + String type; + SCM style =get_elt_property (style_scm_sym); + if (style != SCM_BOOL_F) + { + type = ly_scm2string (SCM_CDR(style)); + } - Atom s = lookup_l()->ball (balltype_i_); - out = new Molecule (Atom (s)); - out->translate_axis (x_dir_ * s.dim_[X_AXIS].length (), X_AXIS); + Molecule* out = new Molecule (lookup_l()->notehead (balltype_i_, type)); if (streepjes_i) { - int dir = sign (position_i_); - Atom streepje = lookup_l ()->streepje (balltype_i_); + Direction dir = sign (position_i_); + Interval hd = out->dim_[X_AXIS]; + Real hw = hd.length ()/4; + + Molecule ledger + = lookup_l ()->ledger_line (Interval (hd[LEFT] - hw, + hd[RIGHT] + hw)); - int parity = (position_i_ % 2) ? 1 : 0; - + int parity = abs(position_i_) % 2; for (int i=0; i < streepjes_i; i++) { - Atom s = streepje; + Molecule s (ledger); s.translate_axis (-dir * inter_f * (i*2 + parity), Y_AXIS); - out->add_atom (s); + out->add_molecule (s); } }