]> git.donarmstrong.com Git - lilypond.git/commitdiff
fix various dot-related regressions
authorJoe Neeman <joeneeman@gmail.com>
Wed, 4 Jul 2007 00:17:53 +0000 (10:17 +1000)
committerJoe Neeman <joeneeman@gmail.com>
Wed, 4 Jul 2007 00:17:53 +0000 (10:17 +1000)
lily/dot-column.cc
lily/include/note-column.hh
lily/note-collision.cc
lily/note-column.cc
lily/note-spacing-engraver.cc
lily/rhythmic-column-engraver.cc
lily/separating-line-group-engraver.cc
scm/define-context-properties.scm
scm/define-grobs.scm

index 36c95137970240f526faff57515c68e8f7753f07..1698ef51eb8aa98da084c4804fd27b170f9a497b 100644 (file)
@@ -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<Grob*> 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<Box> boxes;
   set<Grob*> stems;
index 8646f120fed818d568d7aa54b061602b326c09cf..34a30ab5ddaff3b5df7ea79b8970d8d6c0c8471e 100644 (file)
@@ -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);
index 6feb71c8633f0e00f26e4f59c5bc32dbf44f4a20..8ee404cb067e5a0d1468ed69112a09d9b88f516a 100644 (file)
@@ -434,8 +434,7 @@ Note_collision_interface::get_clash_groups (Grob *me)
 */
 SCM
 Note_collision_interface::automatic_shift (Grob *me,
-                                          Drul_array < vector<Grob*>
-                                          > clash_groups)
+                                          Drul_array<vector<Grob*> > clash_groups)
 {
   Drul_array < vector<int> > shifts;
   SCM tups = SCM_EOL;
index 3f57d3e63c888b09fb564849aa3809b4307366b3..b1c6b9f272204417ddf050f2ebd1a2a036068bb4 100644 (file)
@@ -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)
 {
index d253eb81d960d568f2843f1695a0469607e272f7..68593604de12420214b390b78adda3536567e10c 100644 (file)
@@ -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_)
index 5ebd6d5b765f622087bcd92e24d40794b302fd4c..827a6fb94ff2a621c6685d050a070085126f613b 100644 (file)
@@ -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);
index 7fe9ae9115db8d85e4c8ef5237d29d1769798483..31bd53a2d53f39cb53a1ee78183b70fe5bc12db1 100644 (file)
@@ -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"
                );
index 1d0b28cf6ca3a295de73bbf82b08076e0dfc0d78..05127f86d1414474fbe2cddace54435e040a6995 100644 (file)
@@ -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
index 2109c8874463e34cb78d83e14b06a342fea5b3aa..6159e81f94e38d684ee43f299a8c31146e3d046c 100644 (file)
                          (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)