From 1fa09b30b4bc32b9377eda2488b3694703b2a21f Mon Sep 17 00:00:00 2001 From: Neil Puttock Date: Fri, 9 Apr 2010 00:15:37 +0100 Subject: [PATCH] Remove last vestiges of SeparationItem. --- lily/staff-symbol-engraver.cc | 20 +++----- lily/tie.cc | 93 ++++++++++++++-------------------- ly/engraver-init.ly | 1 - scm/define-grob-properties.scm | 2 - scm/define-grobs.scm | 10 ---- 5 files changed, 45 insertions(+), 81 deletions(-) diff --git a/lily/staff-symbol-engraver.cc b/lily/staff-symbol-engraver.cc index a103eda0b3..11f14ea1c6 100644 --- a/lily/staff-symbol-engraver.cc +++ b/lily/staff-symbol-engraver.cc @@ -58,8 +58,7 @@ Staff_symbol_engraver::Staff_symbol_engraver () finished_span_ = 0; first_start_ = true; span_ = 0; - span_events_[LEFT] = 0; - span_events_[RIGHT] = 0; + span_events_.set (0, 0); } IMPLEMENT_TRANSLATOR_LISTENER (Staff_symbol_engraver, staff_span); @@ -70,7 +69,7 @@ Staff_symbol_engraver::listen_staff_span (Stream_event *ev) if (d) ASSIGN_EVENT_ONCE (span_events_[d], ev); else - programming_error (_ ("staff-span event has no direction")); + programming_error ("staff-span event has no direction"); } void @@ -108,12 +107,12 @@ Staff_symbol_engraver::stop_spanner () if (!finished_span_->get_bound (RIGHT)) finished_span_->set_bound (RIGHT, unsmob_grob (get_property ("currentCommandColumn"))); - + announce_end_grob (finished_span_, span_events_[STOP] ? span_events_[STOP]->self_scm () : SCM_EOL); - + finished_span_ = 0; } @@ -122,12 +121,9 @@ Staff_symbol_engraver::stop_translation_timestep () { if ((span_events_[START] || first_start_) && span_) - { - first_start_ = false; - } + first_start_ = false; - span_events_[START] = 0; - span_events_[STOP] = 0; + span_events_.set (0, 0); stop_spanner (); } @@ -145,10 +141,6 @@ Staff_symbol_engraver::finalize () void Staff_symbol_engraver::acknowledge_grob (Grob_info s) { - /* - Perhaps should try to take SeparationItem as bound of the staff - symbol? - */ if (span_ || finished_span_) { Spanner *my = span_ ? span_ : finished_span_; diff --git a/lily/tie.cc b/lily/tie.cc index bf9a4769d4..563e2ca938 100644 --- a/lily/tie.cc +++ b/lily/tie.cc @@ -40,7 +40,6 @@ #include "warn.hh" #include "semi-tie-column.hh" - bool Tie::less (Grob *const &s1, Grob *const &s2) { @@ -57,15 +56,15 @@ Grob * Tie::head (Grob *me, Direction d) { if (is_direction (me->get_property ("head-direction"))) - { - Direction hd = to_dir (me->get_property ("head-direction")); - - return (hd == d) - ? unsmob_grob (me->get_object ("note-head")) - : 0; - } - - Item *it = dynamic_cast (me)->get_bound (d); + { + Direction hd = to_dir (me->get_property ("head-direction")); + + return (hd == d) + ? unsmob_grob (me->get_object ("note-head")) + : 0; + } + + Item *it = dynamic_cast (me)->get_bound (d); if (Note_head::has_interface (it)) return it; else @@ -97,10 +96,9 @@ Tie::get_position (Grob *me) while (flip (&d) != LEFT); /* + TODO: this is theoretically possible for ties across more than 2 + systems.. We should look at the first broken copy. - TODO: this is theoretically possible for ties across more than 2 - systems.. We should look at the first broken copy. - */ programming_error ("Tie without heads. Suicide"); me->suicide (); @@ -120,22 +118,22 @@ Tie::get_position (Grob *me) Direction Tie::get_default_dir (Grob *me) { - Drul_array stems; + Drul_array stems; Direction d = LEFT; do { Grob *one_head = head (me, d); - if (!one_head && dynamic_cast (me)) - one_head = Tie::head (dynamic_cast (me)->broken_neighbor (d), d); - + if (!one_head && dynamic_cast (me)) + one_head = Tie::head (dynamic_cast (me)->broken_neighbor (d), d); + Grob *stem = one_head ? Rhythmic_head::get_stem (one_head) : 0; if (stem) stem = Stem::is_invisible (stem) ? 0 : stem; stems[d] = stem; } - while (flip (&d)!= LEFT); - + while (flip (&d) != LEFT); + if (stems[LEFT] && stems[RIGHT]) { if (get_grob_direction (stems[LEFT]) == UP @@ -149,10 +147,9 @@ Tie::get_default_dir (Grob *me) } else if (int p = get_position (me)) return Direction (sign (p)); - - return to_dir (me->get_property("neutral-direction")); -} + return to_dir (me->get_property ("neutral-direction")); +} MAKE_SCHEME_CALLBACK (Tie, calc_direction, 1); SCM @@ -161,7 +158,7 @@ Tie::calc_direction (SCM smob) Grob *me = unsmob_grob (smob); Grob *yparent = me->get_parent (Y_AXIS); if ((Tie_column::has_interface (yparent) - || Semi_tie_column::has_interface (yparent)) + || Semi_tie_column::has_interface (yparent)) && unsmob_grob_array (yparent->get_object ("ties")) // && unsmob_grob_array (yparent->get_object ("ties"))->size () > 1 ) @@ -175,26 +172,24 @@ Tie::calc_direction (SCM smob) return scm_from_int (Tie::get_default_dir (me)); } - SCM Tie::get_default_control_points (Grob *me_grob) { - Spanner *me = dynamic_cast (me_grob); - Grob *common = me; - common = me->get_bound (LEFT)->common_refpoint (common, X_AXIS); - common = me->get_bound (RIGHT)->common_refpoint (common, X_AXIS); - + Spanner *me = dynamic_cast (me_grob); + Grob *common = me; + common = me->get_bound (LEFT)->common_refpoint (common, X_AXIS); + common = me->get_bound (RIGHT)->common_refpoint (common, X_AXIS); + Tie_formatting_problem problem; problem.from_tie (me); - + Tie_specification spec = problem.get_tie_specification (0); if (!me->is_live ()) return SCM_EOL; - Ties_configuration conf = problem.generate_optimal_configuration (); - + return get_control_points (me, problem.common_x_refpoint (), conf[0], problem.details_); } @@ -203,8 +198,7 @@ SCM Tie::get_control_points (Grob *me, Grob *common, Tie_configuration const &conf, - Tie_details const &details - ) + Tie_details const &details) { Bezier b = conf.get_transformed_bezier (details); b.translate (Offset (- me->relative_coordinate (common, X_AXIS), 0)); @@ -227,39 +221,36 @@ Tie::calc_control_points (SCM smob) Grob *yparent = me->get_parent (Y_AXIS); if ((Tie_column::has_interface (yparent) - || Semi_tie_column::has_interface (yparent)) + || Semi_tie_column::has_interface (yparent)) && unsmob_grob_array (yparent->get_object ("ties"))) { extract_grob_set (yparent, "ties", ties); - if (me->original() && ties.size() == 1 + if (me->original () && ties.size () == 1 && !to_dir (me->get_property_data ("direction"))) { assert (ties[0] == me); set_grob_direction (me, Tie::get_default_dir (me)); - - } + } /* trigger positioning. */ (void) yparent->get_property ("positioning-done"); } SCM cp = me->get_property_data ("control-points"); if (!scm_is_pair (cp)) - { - cp = get_default_control_points (me); - } + cp = get_default_control_points (me); return cp; } /* TODO: merge with Slur::print. - */ +*/ MAKE_SCHEME_CALLBACK (Tie, print, 1); SCM Tie::print (SCM smob) { Grob *me = unsmob_grob (smob); - + SCM cp = me->get_property ("control-points"); Real staff_thick = Staff_symbol_referencer::line_thickness (me); @@ -278,9 +269,9 @@ Tie::print (SCM smob) SCM dash_definition = me->get_property ("dash-definition"); a = Lookup::slur (b, - get_grob_direction (me) * base_thick, + get_grob_direction (me) * base_thick, line_thick, - dash_definition); + dash_definition); #if DEBUG_TIE_SCORING SCM annotation = me->get_property ("annotation"); @@ -305,7 +296,7 @@ Tie::print (SCM smob) /* It would be nice if we could put this in a different layer, but alas, this must be done with a Tie override. - */ + */ a.add_stencil (tm); } #endif @@ -315,24 +306,18 @@ Tie::print (SCM smob) ADD_INTERFACE (Tie, "A horizontal curve connecting two noteheads.", - + /* properties */ "annotation " "avoid-slur " // UGH. "control-points " - "dash-definition " + "dash-definition " "details " "direction " "head-direction " "line-thickness " "neutral-direction " "quant-score " - "separation-item " "staff-position " "thickness " ); - - - - - diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index ee723dc0e1..81b6c8861a 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -407,7 +407,6 @@ printing of a single line of lyrics." \override VerticalAxisGroup #'inter-staff-spacing = #'((space . 5.5) (stretchability . 1) (padding . 0.5)) \override VerticalAxisGroup #'inter-loose-line-spacing = #'((space . 0) (stretchability . 0) (padding . 0.2)) \override VerticalAxisGroup #'non-affinity-spacing #'padding = #1.0 - \override SeparationItem #'padding = #0.2 \override InstrumentName #'self-alignment-Y = ##f %% sync with define-grobs.scm ; diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 72f6894703..cfa8726c48 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -963,8 +963,6 @@ relevant for finding the @code{pure-Y-extent}.") (right-items ,ly:grob-array? "DOCME") (right-neighbor ,ly:grob? "See @code{left-neighbor}.") - (separation-item ,ly:grob? "A pointer to a @code{SeparationItem} -object.") (side-support-elements ,ly:grob-array? "The side support, an array of grobs.") (slur ,ly:grob? "A pointer to a @code{Slur} object.") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 8251fec819..176debd523 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1554,16 +1554,6 @@ (meta . ((class . Item) (interfaces . (script-column-interface)))))) - (SeparationItem - . ( - (avoid-slur . inside) - (horizontal-skylines . ,ly:separation-item::calc-skylines) - (stencil . ,ly:separation-item::print) - (X-extent . ,ly:axis-group-interface::width) - (Y-extent . ,ly:axis-group-interface::height) - (meta . ((class . Item) - (interfaces . (separation-item-interface)))))) - (Slur . ( (avoid-slur . inside) -- 2.39.5