]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/stem.cc
Fretboards: markup strings in dot positions
[lilypond.git] / lily / stem.cc
index 5e828fa84292902d948542e3fa7cabd243b2a5bc..0c2625b9e4c454b9bd108001801b6d3e3b63098d 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   TODO: This is way too hairy
@@ -110,10 +110,10 @@ Stem::head_positions (Grob *me)
 Real
 Stem::chord_start_y (Grob *me)
 {
-  Interval hp = head_positions (me);
-  if (!hp.is_empty ())
-    return hp[get_grob_direction (me)] * Staff_symbol_referencer::staff_space (me)
-           * 0.5;
+  if (head_count (me))
+    return Staff_symbol_referencer::get_position (last_head (me))
+      * Staff_symbol_referencer::staff_space (me) * 0.5;
+
   return 0;
 }
 
@@ -533,7 +533,8 @@ Stem::calc_positioning_done (SCM smob)
   bool is_harmonic_centered = false;
   for (vsize i = 0; i < heads.size (); i++)
     is_harmonic_centered = is_harmonic_centered
-                           || heads[i]->get_property ("style") == ly_symbol2scm ("harmonic");
+                           || scm_is_eq (heads[i]->get_property ("style"),
+                                         ly_symbol2scm ("harmonic"));
   is_harmonic_centered = is_harmonic_centered && is_invisible (me);
 
   Real w = hed->extent (hed, X_AXIS)[dir];
@@ -658,9 +659,9 @@ Stem::calc_default_direction (SCM smob)
 
   Direction dir = CENTER;
   int staff_center = 0;
-  Interval hp = head_positions (me);
-  if (!hp.is_empty ())
+  if (head_count (me))
     {
+      Interval hp = head_positions (me);
       int udistance = (int) (UP * hp[UP] - staff_center);
       int ddistance = (int) (DOWN * hp[DOWN] - staff_center);
 
@@ -951,7 +952,7 @@ Spanner *
 Stem::get_beam (Grob *me)
 {
   SCM b = me->get_object ("beam");
-  return dynamic_cast<Spanner *> (Grob::unsmob (b));
+  return Spanner::unsmob (b);
 }
 
 Stem_info