From 8efa15a11e4fd490ab796e91f8685198cdabaf08 Mon Sep 17 00:00:00 2001 From: Joe Neeman Date: Wed, 4 Jul 2007 10:17:53 +1000 Subject: [PATCH] fix various dot-related regressions --- lily/dot-column.cc | 38 ++++++++++++++------------ lily/include/note-column.hh | 1 - lily/note-collision.cc | 3 +- lily/note-column.cc | 6 ---- lily/note-spacing-engraver.cc | 11 ++++---- lily/rhythmic-column-engraver.cc | 26 ++---------------- lily/separating-line-group-engraver.cc | 22 +++++++++++++-- scm/define-context-properties.scm | 2 ++ scm/define-grobs.scm | 1 + 9 files changed, 52 insertions(+), 58 deletions(-) diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 36c9513797..1698ef51eb 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -36,6 +36,13 @@ Dot_column::calc_positioning_done (SCM smob) { Grob *me = unsmob_grob (smob); + /* + Trigger note collision resolution first, since that may kill off + dots when merging. + */ + if (Grob *collision = unsmob_grob (me->get_object ("note-collision"))) + (void) collision->get_property ("positioning-done"); + me->set_property ("positioning-done", SCM_BOOL_T); vector dots @@ -45,24 +52,19 @@ Dot_column::calc_positioning_done (SCM smob) Real ss = 0; Grob *commonx = me; - { /* - Trigger note collision resolution first, since that may kill off - dots when merging. - */ - for (vsize i = 0; i < dots.size (); i++) - { - Grob *n = dots[i]->get_parent (Y_AXIS); - commonx = n->common_refpoint (commonx, X_AXIS); - - if (Grob *stem = unsmob_grob (n->get_object("stem"))) - { - commonx = stem->common_refpoint (commonx, X_AXIS); - - if (Stem::first_head (stem) == n) - main_heads.push_back (n); - } - } - } + for (vsize i = 0; i < dots.size (); i++) + { + Grob *n = dots[i]->get_parent (Y_AXIS); + commonx = n->common_refpoint (commonx, X_AXIS); + + if (Grob *stem = unsmob_grob (n->get_object("stem"))) + { + commonx = stem->common_refpoint (commonx, X_AXIS); + + if (Stem::first_head (stem) == n) + main_heads.push_back (n); + } + } vector boxes; set stems; diff --git a/lily/include/note-column.hh b/lily/include/note-column.hh index 8646f120fe..34a30ab5dd 100644 --- a/lily/include/note-column.hh +++ b/lily/include/note-column.hh @@ -30,7 +30,6 @@ public: static Grob *first_head (Grob *me); static Grob *get_rest (Grob *me); static void set_stem (Grob *me, Grob *); - static void set_dotcol (Grob *me, Grob *); static void add_head (Grob *me, Grob *); static bool has_rests (Grob *me); static Grob *dot_column (Grob *me); diff --git a/lily/note-collision.cc b/lily/note-collision.cc index 6feb71c863..8ee404cb06 100644 --- a/lily/note-collision.cc +++ b/lily/note-collision.cc @@ -434,8 +434,7 @@ Note_collision_interface::get_clash_groups (Grob *me) */ SCM Note_collision_interface::automatic_shift (Grob *me, - Drul_array < vector - > clash_groups) + Drul_array > clash_groups) { Drul_array < vector > shifts; SCM tups = SCM_EOL; diff --git a/lily/note-column.cc b/lily/note-column.cc index 3f57d3e63c..b1c6b9f272 100644 --- a/lily/note-column.cc +++ b/lily/note-column.cc @@ -142,12 +142,6 @@ Note_column::translate_rests (Grob *me, int dy) } } -void -Note_column::set_dotcol (Grob *me, Grob *d) -{ - Axis_group_interface::add_element (me, d); -} - Grob * Note_column::first_head (Grob *me) { diff --git a/lily/note-spacing-engraver.cc b/lily/note-spacing-engraver.cc index d253eb81d9..68593604de 100644 --- a/lily/note-spacing-engraver.cc +++ b/lily/note-spacing-engraver.cc @@ -105,13 +105,12 @@ Note_spacing_engraver::stop_translation_timestep () if (last_spacing_ && last_spacing_parent_context_ && last_spacing_parent_context_ == context ()->get_parent_context () - && !unsmob_grob_array (last_spacing_->get_object ("right-items"))) + && to_boolean (get_property ("hasStaffSpacing"))) { - Grob *sep = unsmob_grob (get_property ("currentCommandColumn")); - if (sep) - Pointer_group_interface::add_grob (last_spacing_, - ly_symbol2scm ("right-items"), - sep); + Grob *col = unsmob_grob (get_property ("currentCommandColumn")); + Pointer_group_interface::add_grob (last_spacing_, + ly_symbol2scm ("right-items"), + col); } if (spacing_) diff --git a/lily/rhythmic-column-engraver.cc b/lily/rhythmic-column-engraver.cc index 5ebd6d5b76..827a6fb94f 100644 --- a/lily/rhythmic-column-engraver.cc +++ b/lily/rhythmic-column-engraver.cc @@ -51,7 +51,6 @@ class Rhythmic_column_engraver : public Engraver TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver); protected: - DECLARE_ACKNOWLEDGER (dot_column); DECLARE_ACKNOWLEDGER (stem); DECLARE_ACKNOWLEDGER (rhythmic_head); DECLARE_ACKNOWLEDGER (arpeggio); @@ -64,7 +63,6 @@ Rhythmic_column_engraver::Rhythmic_column_engraver () stem_ = 0; note_column_ = 0; - dotcol_ = 0; arpeggio_ = 0; } @@ -75,27 +73,17 @@ Rhythmic_column_engraver::process_acknowledged () if (rheads_.size ()) { if (!note_column_) - { - note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ()); - } + note_column_ = make_item ("NoteColumn", rheads_[0]->self_scm ()); for (vsize i = 0; i < rheads_.size (); i++) - { - if (!rheads_[i]->get_parent (X_AXIS)) - Note_column::add_head (note_column_, rheads_[i]); + if (!rheads_[i]->get_parent (X_AXIS)) + Note_column::add_head (note_column_, rheads_[i]); - if (Grob *dot = unsmob_grob (rheads_[i]->get_object ("dot"))) - Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), dot); - } rheads_.resize (0); } if (note_column_) { - if (dotcol_ - && !dotcol_->get_parent (X_AXIS)) - Note_column::set_dotcol (note_column_, dotcol_); - if (stem_ && !stem_->get_parent (X_AXIS)) { @@ -123,12 +111,6 @@ Rhythmic_column_engraver::acknowledge_rhythmic_head (Grob_info i) rheads_.push_back (i.grob ()); } -void -Rhythmic_column_engraver::acknowledge_dot_column (Grob_info i) -{ - dotcol_ = i.grob (); -} - void Rhythmic_column_engraver::acknowledge_arpeggio (Grob_info i) { @@ -139,12 +121,10 @@ void Rhythmic_column_engraver::stop_translation_timestep () { note_column_ = 0; - dotcol_ = 0; stem_ = 0; arpeggio_ = 0; } -ADD_ACKNOWLEDGER (Rhythmic_column_engraver, dot_column); ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem); ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head); ADD_ACKNOWLEDGER (Rhythmic_column_engraver, arpeggio); diff --git a/lily/separating-line-group-engraver.cc b/lily/separating-line-group-engraver.cc index 7fe9ae9115..31bd53a2d5 100644 --- a/lily/separating-line-group-engraver.cc +++ b/lily/separating-line-group-engraver.cc @@ -50,6 +50,7 @@ protected: DECLARE_ACKNOWLEDGER (item); void stop_translation_timestep (); + void start_translation_timestep (); public: TRANSLATOR_DECLARATIONS (Separating_line_group_engraver); }; @@ -73,7 +74,14 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i) && !current_spacings_.staff_spacing_ && to_boolean (get_property ("createSpacing"))) { + Grob *col = unsmob_grob (get_property ("currentCommandColumn")); + current_spacings_.staff_spacing_ = make_item ("StaffSpacing", SCM_EOL); + context ()->set_property ("hasStaffSpacing", SCM_BOOL_T); + + Pointer_group_interface::add_grob (current_spacings_.staff_spacing_, + ly_symbol2scm ("left-items"), + col); if (!last_spacings_.note_spacings_.size () && last_spacings_.staff_spacing_) @@ -88,17 +96,27 @@ Separating_line_group_engraver::acknowledge_item (Grob_info i) } ga->clear (); - ga->add (unsmob_grob (get_property ("currentCommandColumn"))); + ga->add (col); } } } +void +Separating_line_group_engraver::start_translation_timestep () +{ + context ()->unset_property (ly_symbol2scm ("hasStaffSpacing")); +} + void Separating_line_group_engraver::stop_translation_timestep () { if (!current_spacings_.is_empty ()) last_spacings_ = current_spacings_; + if (Item *sp = current_spacings_.staff_spacing_) + if (Grob *col = unsmob_grob (get_property ("currentMusicalColumn"))) + Pointer_group_interface::add_grob (sp, ly_symbol2scm ("right-items"), col); + current_spacings_.clear (); } @@ -108,5 +126,5 @@ ADD_TRANSLATOR (Separating_line_group_engraver, /* create */ "StaffSpacing", /* read */ "createSpacing", - /* write */ "" + /* write */ "hasStaffSpacing" ); diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index 1d0b28cf6c..05127f86d1 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -536,6 +536,8 @@ event types that should be duplicated for @code{\\quote} commands.") (instrumentSupport ,grob-list? "list of grobs to attach instrument name to.") (tieMelismaBusy ,boolean? "Signal whether a tie is present.") + (hasStaffSpacing ,boolean? "True if the currentCommandColumn contains items that will +affect spacing") ))) (define-public all-translation-properties diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 2109c88744..6159e81f94 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1334,6 +1334,7 @@ (list ly:self-alignment-interface::x-aligned-on-self))))) (Y-offset . ,ly:side-position-interface::y-aligned-side) + (extra-spacing-width . (+inf.0 . -inf.0)) (self-alignment-X . 0) (direction . ,UP) (non-musical . #t) -- 2.39.2