]> git.donarmstrong.com Git - lilypond.git/commitdiff
Issue 3115: Revert "Uses a heuristic to determine if chord tremolos collide with...
authorDavid Kastrup <dak@gnu.org>
Tue, 1 Oct 2013 14:42:37 +0000 (16:42 +0200)
committerDavid Kastrup <dak@gnu.org>
Mon, 7 Oct 2013 10:18:00 +0000 (12:18 +0200)
This reverts commit d8dfa746ead381a80901106b9c9b079dc9b5d004.

Conflicts:
scm/define-grobs.scm

But reconstitute input/regression/chord-tremolo-accidental.ly.  Not
done in a separate commit in order to preserve blame.

lily/beam.cc
lily/include/beam.hh
lily/include/note-column.hh
lily/note-column.cc
lily/paper-column.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

index 0932bd37d01f7a2a69069f07afa4bb19c0f7d215..fbd158aeca8a33a442f2ece1f15f3990764bd7e2 100644 (file)
@@ -49,7 +49,6 @@
 #include "lookup.hh"
 #include "main.hh"
 #include "misc.hh"
-#include "note-column.hh"
 #include "note-head.hh"
 #include "output-def.hh"
 #include "pointer-group-interface.hh"
@@ -142,92 +141,6 @@ Beam::get_beam_count (Grob *me)
   return m;
 }
 
-//------ for whole note chord tremolos
-
-bool
-Beam::whole_note_close_chord_tremolo (Grob *me)
-{
-  if (!scm_is_integer (me->get_property ("gap-count")))
-    return false;
-
-  extract_grob_set (me, "stems", stems);
-  for (vsize i = 0; i < stems.size (); i++)
-    if (Stem::duration_log (stems[i]))
-      return false;
-
-  Grob *staff = Staff_symbol_referencer::get_staff_symbol (me);
-  if (staff)
-    {
-      Grob *outside_stems[2] = {Stem::extremal_heads (stems[0])[DOWN],
-                                Stem::extremal_heads (stems.back ())[DOWN]};
-
-      Interval lines = Staff_symbol::line_span (staff);
-      for (int i = 0; i < 2; i++)
-        {
-          Real my_pos = Staff_symbol_referencer::get_position (outside_stems[i]);
-          if (my_pos > lines[UP] + 1)
-            return false;
-          else if (my_pos < lines[DOWN] - 1)
-            return false;
-        }
-    }
-
-  return (Staff_symbol_referencer::get_position (Stem::extremal_heads (stems.back ())[DOWN])
-          - Staff_symbol_referencer::get_position (Stem::extremal_heads (stems[0])[DOWN]))
-         < 2;
-}
-
-MAKE_SCHEME_CALLBACK (Beam, calc_beam_gap, 1);
-SCM
-Beam::calc_beam_gap (SCM smob)
-{
-  Spanner *me = unsmob_spanner (smob);
-  SCM default_value = scm_cons (scm_from_double (0.8), scm_from_double (0.8));
-  if (!whole_note_close_chord_tremolo (me))
-    return default_value;
-
-  Interval left = Note_column::accidental_width
-                    (me->get_bound (RIGHT)->get_parent (X_AXIS));
-
-  if (left.length () > 0.4)
-    return scm_cons (scm_from_double (0.8), scm_from_double (1.3 + left.length ()));
-  else
-    return default_value;
-}
-
-MAKE_SCHEME_CALLBACK (Beam, calc_springs_and_rods, 1);
-SCM
-Beam::calc_springs_and_rods (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-
-  if (!whole_note_close_chord_tremolo (me))
-    return SCM_BOOL_F;
-
-  return scm_call_1 (Spanner::set_spacing_rods_proc, smob);
-}
-
-MAKE_SCHEME_CALLBACK (Beam, calc_minimum_length, 1);
-SCM
-Beam::calc_minimum_length (SCM smob)
-{
-  Spanner *me = unsmob_spanner (smob);
-  SCM default_value = scm_from_double (0.0);
-
-  if (!whole_note_close_chord_tremolo (me))
-    return SCM_BOOL_F;
-
-  Interval left = Note_column::accidental_width
-                    (me->get_bound (RIGHT)->get_parent (X_AXIS));
-
-  if (left.length () > 0.4)
-    return scm_from_double (left.length () + 4.0);
-  else
-    return default_value;
-}
-
-//------ and everything else
-
 MAKE_SCHEME_CALLBACK (Beam, calc_normal_stems, 1);
 SCM
 Beam::calc_normal_stems (SCM smob)
@@ -452,7 +365,7 @@ Beam::calc_beam_segments (SCM smob)
     commonx = me->get_bound (d)->common_refpoint (commonx, X_AXIS);
 
   int gap_count = robust_scm2int (me->get_property ("gap-count"), 0);
-  Interval gap_lengths = robust_scm2interval (me->get_property ("beam-gap"), Interval (0.0, 0.0));
+  Real gap_length = robust_scm2double (me->get_property ("gap"), 0.0);
 
   Position_stem_segments_map stem_segments;
   Real lt = me->layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
@@ -608,7 +521,7 @@ Beam::calc_beam_segments (SCM smob)
                   current.horizontal_[event_dir] += event_dir * seg.width_ / 2;
                   if (seg.gapped_)
                     {
-                      current.horizontal_[event_dir] -= event_dir * gap_lengths[event_dir];
+                      current.horizontal_[event_dir] -= event_dir * gap_length;
 
                       if (Stem::is_invisible (seg.stem_))
                         {
@@ -621,7 +534,7 @@ Beam::calc_beam_segments (SCM smob)
                           for (vsize k = 0; k < heads.size (); k++)
                             current.horizontal_[event_dir]
                               = event_dir * min (event_dir * current.horizontal_[event_dir],
-                                                 - gap_lengths[event_dir] / 2
+                                                 - gap_length / 2
                                                  + event_dir
                                                  * heads[k]->extent (commonx,
                                                                      X_AXIS)[-event_dir]);
@@ -1578,7 +1491,6 @@ ADD_INTERFACE (Beam,
                "auto-knee-gap "
                "beamed-stem-shorten "
                "beaming "
-               "beam-gap "
                "beam-segments "
                "beam-thickness "
                "break-overshoot "
@@ -1590,6 +1502,7 @@ ADD_INTERFACE (Beam,
                "damping "
                "details "
                "direction "
+               "gap "
                "gap-count "
                "grow-direction "
                "inspect-quants "
index c26d8d213785f770a29cff6a7072fe54d1a500fb..116ae6aa5730a72ad616594c69bc89bb34991672 100644 (file)
@@ -72,9 +72,6 @@ public:
   DECLARE_SCHEME_CALLBACK (rest_collision_callback, (SCM element, SCM prev_off));
   DECLARE_SCHEME_CALLBACK (pure_rest_collision_callback, (SCM element, SCM, SCM, SCM prev_off));
   DECLARE_SCHEME_CALLBACK (print, (SCM));
-  DECLARE_SCHEME_CALLBACK (calc_beam_gap, (SCM));
-  DECLARE_SCHEME_CALLBACK (calc_springs_and_rods, (SCM));
-  DECLARE_SCHEME_CALLBACK (calc_minimum_length, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_beaming, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_stem_shorten, (SCM));
   DECLARE_SCHEME_CALLBACK (calc_direction, (SCM));
@@ -92,7 +89,6 @@ public:
 private:
   friend class Beam_scoring_problem;
 
-  static bool whole_note_close_chord_tremolo (Grob *me);
   static Direction get_default_dir (Grob *);
   static vector<Beam_segment> get_beam_segments (Grob *);
   static void set_stem_directions (Grob *, Direction);
index e39edf840f070086be168fade1a6d96d91795af2..c2723f0ba8d570759a5da8c9cf40717c3937499d 100644 (file)
@@ -42,7 +42,6 @@ public:
   static bool has_rests (Grob *me);
   static Grob *dot_column (Grob *me);
   static Interval cross_staff_extent (Grob *me, Grob *refp);
-  static Interval accidental_width (Grob *me);
   DECLARE_GROB_INTERFACE ();
 
   static Item *get_stem (Grob *);
index b98b4c68f8079ce1178da7c2cc2883afc978eacf..42bd9b484c005270e9b290b8fef74df1cd355bd9 100644 (file)
@@ -40,31 +40,6 @@ using namespace std;
   annoying layer between (rest)collision & (note-head + stem)
 */
 
-Interval
-Note_column::accidental_width (Grob *me)
-{
-  extract_grob_set (me, "note-heads", nhs);
-  vector<Grob *> accs;
-  for (vsize i = 0; i < nhs.size (); i++)
-    if (Grob *acc = unsmob_grob (nhs[i]->get_object ("accidental-grob")))
-      accs.push_back (acc);
-
-  Grob *common = common_refpoint_of_array (accs, me, X_AXIS);
-  common = common_refpoint_of_array (nhs, common, X_AXIS);
-
-  Interval nhs_ex = Axis_group_interface::relative_group_extent (nhs, common, X_AXIS);
-  Interval accs_ex = Axis_group_interface::relative_group_extent (accs, common, X_AXIS);
-
-  if (nhs_ex.is_empty ())
-    return accs_ex;
-
-  // want an empty interval here
-  if (accs_ex.is_empty ())
-    return Interval ();
-
-  return Interval (accs_ex[LEFT], nhs_ex[LEFT]);
-}
-
 bool
 Note_column::has_rests (Grob *me)
 {
index 78f2786ef89b34f41cefcb63cc8d8e4c352a9bbf..cdf3d595ca554ec9ee0c1afcf5deaf9fa7aa493f 100644 (file)
@@ -27,7 +27,6 @@
 #include "lookup.hh"
 #include "lookup.hh"
 #include "moment.hh"
-#include "note-head.hh"
 #include "output-def.hh"
 #include "paper-score.hh"
 #include "pointer-group-interface.hh"
@@ -219,7 +218,6 @@ Paper_column::break_align_width (Grob *me, SCM align_sym)
   return align->extent (p, X_AXIS);
 }
 
-
 /*
   Print a vertical line and  the rank number, to aid debugging.
 */
index e4e0f9dd999d9ad867850f474a9a6b22158e388e..00cbaeb55c67c33cce65e628a8a07050c10f02d9 100644 (file)
@@ -108,7 +108,6 @@ default length of the beamlet to the right.  The actual length of a
 beamlet is determined by taking either the default length or the
 length specified by @code{beamlet-max-length-proportion}, whichever is
 smaller.")
-     (beam-gap ,number-pair? "Size of a gap in a @code{Beam}.")
      (beamlet-max-length-proportion ,pair? "The maximum length of a
 beamlet, as a proportion of the distance between two adjacent stems.")
      (before-line-breaking ,boolean? "Dummy property, used to trigger
index 9b1b4e71cac46f1325092a7c3837800e97a7fb44..5222034ae1c3febf0a40e221910d94e7affc1b7a 100644 (file)
         ;; only for debugging.
         (font-family . roman)
 
-        (beam-gap . ,ly:beam::calc-beam-gap)
-        (minimum-length . ,ly:beam::calc-minimum-length)
+        (gap . 0.8)
         (neutral-direction . ,DOWN)
         (positions . ,beam::place-broken-parts-individually)
-        (springs-and-rods . ,ly:beam::calc-springs-and-rods)
         (X-positions . ,ly:beam::calc-x-positions)
         (transparent . ,(grob::inherit-parent-property
                          X 'transparent))