]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/slur-scoring.cc
Run grand replace for 2015.
[lilypond.git] / lily / slur-scoring.cc
index 3d929ca750038217ed528e571bc10161ba80afa8..7271cc7a7cf139a9109bf9fe794e22424f61abbd 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--2015 Han-Wen Nienhuys <hanwen@xs4all.nl>
   Jan Nieuwenhuizen <janneke@gnu.org>
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -42,7 +42,6 @@
 #include "staff-symbol-referencer.hh"
 #include "staff-symbol.hh"
 #include "stem.hh"
-#include "time-signature.hh"
 #include "warn.hh"
 
 /*
@@ -69,7 +68,6 @@ Slur_score_state::Slur_score_state ()
 {
   musical_dy_ = 0.0;
   valid_ = false;
-  stub_ = false;
   edge_has_beams_ = false;
   has_same_beam_ = false;
   is_broken_ = false;
@@ -108,15 +106,15 @@ Slur_score_state::slur_direction () const
 Encompass_info
 Slur_score_state::get_encompass_info (Grob *col) const
 {
-  Grob *stem = unsmob_grob (col->get_object ("stem"));
+  Grob *stem = Grob::unsmob (col->get_object ("stem"));
   Encompass_info ei;
 
   if (!stem)
     {
       programming_error ("no stem for note column");
       ei.x_ = col->relative_coordinate (common_[X_AXIS], X_AXIS);
-      ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS],
-                                         Y_AXIS, stub_, 0, INT_MAX)[dir_];
+      ei.head_ = ei.stem_ = col->extent (common_[Y_AXIS],
+                                         Y_AXIS)[dir_];
       return ei;
     }
   Direction stem_dir = get_grob_direction (stem);
@@ -129,16 +127,16 @@ Slur_score_state::get_encompass_info (Grob *col) const
   Grob *h = Stem::extremal_heads (stem)[Direction (dir_)];
   if (!h)
     {
-      ei.head_ = ei.stem_ = col->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+      ei.head_ = ei.stem_ = col->extent (common_[Y_AXIS], Y_AXIS)[dir_];
       return ei;
     }
 
-  ei.head_ = h->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+  ei.head_ = h->extent (common_[Y_AXIS], Y_AXIS)[dir_];
 
   if ((stem_dir == dir_)
-      && !stem->maybe_pure_extent (stem, Y_AXIS, stub_, 0, INT_MAX).is_empty ())
+      && !stem->extent (stem, Y_AXIS).is_empty ())
     {
-      ei.stem_ = stem->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+      ei.stem_ = stem->extent (common_[Y_AXIS], Y_AXIS)[dir_];
       if (Grob *b = Stem::get_beam (stem))
         ei.stem_ += stem_dir * 0.5 * Beam::get_beam_thickness (b);
 
@@ -176,13 +174,9 @@ Slur_score_state::get_bound_info () const
               for (int a = X_AXIS; a < NO_AXES; a++)
                 {
                   Axis ax = Axis (a);
-                  Interval s = ax == Y_AXIS
-                               ? extremes[d].stem_->maybe_pure_extent (common_[ax], ax, stub_, 0, INT_MAX)
-                               : extremes[d].stem_->extent (common_[ax], ax);
+                  Interval s = extremes[d].stem_->extent (common_[ax], ax);
                   if (extremes[d].flag_)
-                    s.unite (ax == Y_AXIS
-                             ? extremes[d].flag_->maybe_pure_extent (common_[ax], ax, stub_, 0, INT_MAX)
-                             : extremes[d].flag_->extent (common_[ax], ax));
+                    s.unite (extremes[d].flag_->extent (common_[ax], ax));
                   if (s.is_empty ())
                     {
                       /*
@@ -190,9 +184,7 @@ Slur_score_state::get_bound_info () const
                         whole notes.
                       */
                       s = Interval (0, 0)
-                          + (ax == Y_AXIS
-                             ? extremes[d].stem_->maybe_pure_coordinate (common_[ax], ax, stub_, 0, INT_MAX)
-                             : extremes[d].stem_->relative_coordinate (common_[ax], ax));
+                          + extremes[d].stem_->relative_coordinate (common_[ax], ax);
                     }
                   extremes[d].stem_extent_[ax] = s;
                 }
@@ -222,8 +214,6 @@ void
 Slur_score_state::fill (Grob *me)
 {
   slur_ = dynamic_cast<Spanner *> (me);
-  stub_ = slur_->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface"));
-
   columns_
     = internal_extract_grob_array (me, ly_symbol2scm ("note-columns"));
 
@@ -235,8 +225,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);
@@ -295,7 +285,7 @@ Slur_score_state::fill (Grob *me)
           && minmax (dir_, encompass_place, y_place) == encompass_place
           && (!extra_encompass_infos_[i].grob_->internal_has_interface (ly_symbol2scm ("key-signature-interface"))
               && !Clef::has_interface (extra_encompass_infos_[i].grob_)
-              && !Time_signature::has_interface (extra_encompass_infos_[i].grob_)))
+              && !extra_encompass_infos_[i].grob_->internal_has_interface (ly_symbol2scm ("time-signature-interface"))))
         {
           for (LEFT_and_RIGHT (d))
             additional_ys[d] = minmax (dir_,
@@ -325,7 +315,7 @@ Slur_score_state::fill (Grob *me)
       if (!is_broken_
           && extremes_[d].slur_head_)
         musical_dy_ += d
-                       * extremes_[d].slur_head_->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+                       * extremes_[d].slur_head_->relative_coordinate (common_[Y_AXIS], Y_AXIS);
     }
 
   edge_has_beams_
@@ -340,14 +330,7 @@ MAKE_SCHEME_CALLBACK (Slur, calc_control_points, 1)
 SCM
 Slur::calc_control_points (SCM smob)
 {
-  Spanner *me = unsmob_spanner (smob);
-
-  if (!to_boolean (me->get_property ("cross-staff"))
-      && me->internal_has_interface (ly_symbol2scm ("cross-staff-stub-interface")))
-    {
-      me->suicide ();
-      return SCM_EOL;
-    }
+  Spanner *me = Spanner::unsmob (smob);
 
   Slur_score_state state;
   state.fill (me);
@@ -388,9 +371,7 @@ Slur::calc_control_points (SCM smob)
     {
       Offset o = best->curve_.control_[i]
                  - Offset (me->relative_coordinate (state.common_[X_AXIS], X_AXIS),
-                           me->maybe_pure_coordinate (state.common_[Y_AXIS], Y_AXIS,
-                               state.stub_, 0, INT_MAX));
-
+                           me->relative_coordinate (state.common_[Y_AXIS], Y_AXIS));
       controls = scm_cons (ly_offset2scm (o), controls);
     }
 
@@ -477,12 +458,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_->maybe_pure_extent
-                                                   (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[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_;
@@ -531,7 +516,7 @@ Slur_score_state::get_base_attachments () const
                   || has_same_beam_))
             y = extremes_[d].stem_extent_[Y_AXIS][dir_];
           else if (head)
-            y = head->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+            y = head->extent (common_[Y_AXIS], Y_AXIS)[dir_];
           y += dir_ * 0.5 * staff_space_;
 
           y = move_away_from_staffline (y, head);
@@ -563,7 +548,7 @@ Slur_score_state::get_base_attachments () const
 
           if (extremes_[-d].bound_ != col)
             {
-              y = maybe_pure_robust_relative_extent (col, common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX)[dir_];
+              y = robust_relative_extent (col, common_[Y_AXIS], Y_AXIS)[dir_];
               y += dir_ * 0.5 * staff_space_;
 
               if (get_grob_direction (col) == dir_
@@ -609,8 +594,8 @@ Slur_score_state::move_away_from_staffline (Real y,
     return y;
 
   Real pos
-    = (y - staff_symbol->maybe_pure_coordinate (common_[Y_AXIS],
-                                              Y_AXIS, stub_, 0, INT_MAX))
+    = (y - staff_symbol->relative_coordinate (common_[Y_AXIS],
+                                              Y_AXIS))
       * 2.0 / staff_space_;
 
   if (fabs (pos - my_round (pos)) < 0.2
@@ -648,7 +633,7 @@ Slur_score_state::generate_avoid_offsets () const
 
           Offset z = b.curve_point (0.5);
           z += Offset (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
-                       small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX));
+                       small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
 
           z[Y_AXIS] += dir_ * parameters_.free_slur_distance_;
           avoid.push_back (z);
@@ -657,7 +642,7 @@ Slur_score_state::generate_avoid_offsets () const
         {
           Grob *g = extra_encompasses [i];
           Interval xe = g->extent (common_[X_AXIS], X_AXIS);
-          Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+          Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
 
           if (!xe.is_empty ()
               && !ye.is_empty ())
@@ -775,7 +760,7 @@ Slur_score_state::get_extra_encompass_infos () const
           Bezier b = Slur::get_curve (small_slur);
 
           Offset relative (small_slur->relative_coordinate (common_[X_AXIS], X_AXIS),
-                           small_slur->maybe_pure_coordinate (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX));
+                           small_slur->relative_coordinate (common_[Y_AXIS], Y_AXIS));
 
           for (int k = 0; k < 3; k++)
             {
@@ -809,7 +794,7 @@ Slur_score_state::get_extra_encompass_infos () const
         {
           Grob *g = encompasses [i];
           Interval xe = g->extent (common_[X_AXIS], X_AXIS);
-          Interval ye = g->maybe_pure_extent (common_[Y_AXIS], Y_AXIS, stub_, 0, INT_MAX);
+          Interval ye = g->extent (common_[Y_AXIS], Y_AXIS);
           if (Dots::has_interface (g))
             ye.widen (0.2);