]> git.donarmstrong.com Git - lilypond.git/commitdiff
use Spanner::broken_neighbor() in slur and line spanner.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Nov 2006 13:36:14 +0000 (14:36 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 9 Nov 2006 13:36:14 +0000 (14:36 +0100)
lily/line-spanner.cc
lily/slur-scoring.cc

index 688cf8db2ee7a14e67546d2201ec203de581824c..0b6a9fae7fefbddb76a5e1235410186157c00e5a 100644 (file)
@@ -222,9 +222,7 @@ Line_spanner::print (SCM smob)
        anymore. We have to find the piano-staff object.
       */
 
-      int k = broken_spanner_index (me);
-      Spanner *parent_sp = dynamic_cast<Spanner *> (me->original ());
-      Spanner *next_sp = parent_sp->broken_intos_ [k + 1];
+      Spanner *next_sp = me->broken_neighbor (RIGHT);
       Item *next_bound = next_sp->get_bound (RIGHT);
 
       if (next_bound->break_status_dir ())
index 618786867efff0fc4352addff0882cc1607e1d12..ba8f5c80ccd52ba9d6c0a1a85a64ef2c4bee3058 100644 (file)
@@ -74,12 +74,11 @@ broken_trend_y (Slur_score_state const &state, Direction hdir)
   Real by = 0.0;
   if (Spanner *mother = dynamic_cast<Spanner *> (state.slur_->original ()))
     {
-      vsize k = broken_spanner_index (state.slur_);
-      int j = int (k) + hdir;
-      if (j < 0 || vsize (j) >= mother->broken_intos_.size ())
+      Grob *neighbor = mother->broken_neighbor (hdir);
+      if (!neighbor)
        return by;
 
-      Grob *neighbor = mother->broken_intos_[j];
+      
       Spanner *common_mother
        = dynamic_cast<Spanner *> (state.common_[Y_AXIS]->original ());
       int common_k
@@ -108,13 +107,8 @@ Slur_score_state::set_next_direction ()
   if (extremes_[RIGHT].note_column_)
     return;
 
-  if (Spanner *mother = dynamic_cast<Spanner *> (slur_->original ()))
+  if (Grob *neighbor = slur_->broken_neighbor (RIGHT))
     {
-      vsize j = 1 + broken_spanner_index (slur_);
-      if (j >= mother->broken_intos_.size ())
-       return;
-
-      Grob *neighbor = mother->broken_intos_[j];
       set_grob_direction (neighbor, dir_);
     }
 }