]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-scoring.cc
CG: Update of Patchy instructions
[lilypond.git] / lily / slur-scoring.cc
index d8b713265c7e79e60300bf25c8870ff5616b8a9f..61a4423159a4d56792c7c8a8338fe280b6b9f32e 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  Copyright (C) 1996--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -226,8 +226,8 @@ Slur_score_state::fill (Grob *me)
 
   Slur::replace_breakable_encompass_objects (me);
   staff_space_ = Staff_symbol_referencer::staff_space (me);
-  Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
-  thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * lt;
+  line_thickness_ = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+  thickness_ = robust_scm2double (me->get_property ("thickness"), 1.0) * line_thickness_;
 
   dir_ = slur_direction ();
   parameters_.fill (me);
@@ -459,11 +459,16 @@ Slur_score_state::get_y_attachment_range () const
     {
       if (extremes_[d].note_column_)
         {
-          end_ys[d] = dir_
-                      * max (max (dir_ * (base_attachments_[d][Y_AXIS]
-                                          + parameters_.region_size_ * dir_),
-                                  dir_ * (dir_ + extremes_[d].note_column_->extent (common_[Y_AXIS], Y_AXIS)[dir_])),
-                             dir_ * base_attachments_[-d][Y_AXIS]);
+          Interval nc_extent = extremes_[d].note_column_
+                               ->extent (common_[Y_AXIS], Y_AXIS);
+          if (nc_extent.is_empty ())
+            slur_->warning ("slur trying to encompass an empty note column.");
+          else
+            end_ys[d] = dir_
+                        * max (max (dir_ * (base_attachments_[d][Y_AXIS]
+                                            + parameters_.region_size_ * dir_),
+                                    dir_ * (dir_ + nc_extent[dir_])),
+                               dir_ * base_attachments_[-d][Y_AXIS]);
         }
       else
         end_ys[d] = base_attachments_[d][Y_AXIS] + parameters_.region_size_ * dir_;
@@ -595,8 +600,7 @@ Slur_score_state::move_away_from_staffline (Real y,
       * 2.0 / staff_space_;
 
   if (fabs (pos - my_round (pos)) < 0.2
-      && Staff_symbol_referencer::on_line (on_staff, (int) rint (pos))
-      && Staff_symbol_referencer::line_count (on_staff) - 1 >= rint (pos))
+      && Staff_symbol_referencer::on_staff_line (on_staff, (int) rint (pos)))
     y += 1.5 * staff_space_ * dir_ / 10;
 
   return y;