From: David Kastrup Date: Tue, 1 Oct 2013 14:42:37 +0000 (+0200) Subject: Issue 3115: Revert "Uses a heuristic to determine if chord tremolos collide with... X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2122a9643a5374edee7a02730b4945d298443afa;p=lilypond.git Issue 3115: Revert "Uses a heuristic to determine if chord tremolos collide with accidentals." 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. --- diff --git a/lily/beam.cc b/lily/beam.cc index 0932bd37d0..fbd158aeca 100644 --- a/lily/beam.cc +++ b/lily/beam.cc @@ -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 " diff --git a/lily/include/beam.hh b/lily/include/beam.hh index c26d8d2137..116ae6aa57 100644 --- a/lily/include/beam.hh +++ b/lily/include/beam.hh @@ -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 get_beam_segments (Grob *); static void set_stem_directions (Grob *, Direction); diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index e39edf840f..c2723f0ba8 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -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 *); diff --git a/lily/note-column.cc b/lily/note-column.cc index b98b4c68f8..42bd9b484c 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -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 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) { diff --git a/lily/paper-column.cc b/lily/paper-column.cc index 78f2786ef8..cdf3d595ca 100644 --- a/lily/paper-column.cc +++ b/lily/paper-column.cc @@ -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. */ diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index e4e0f9dd99..00cbaeb55c 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -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 diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 9b1b4e71ca..5222034ae1 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -408,11 +408,9 @@ ;; 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))