]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/paper-column.cc (set_system): new function.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 4 Aug 2006 00:34:33 +0000 (00:34 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Fri, 4 Aug 2006 00:34:33 +0000 (00:34 +0000)
* lily/spacing-engraver.cc (stop_translation_timestep): store
SpacingSpanner refs in Paper_column.

* lily/spacing-loose-columns.cc (set_loose_columns): rewrite
compute loose clique spacing using GraceSpacing/SpacingSpanner.

ChangeLog
lily/include/paper-column.hh
lily/paper-column.cc
lily/spacing-basic.cc
lily/spacing-engraver.cc
lily/spacing-loose-columns.cc
lily/system.cc
scm/define-grob-properties.scm

index e4bc82eeee10032bb2d697300c2b3823785c1fca..1afba1af89299bc26de2de05190d1942d5a808b5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,13 @@
+2006-08-04  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * lily/paper-column.cc (set_system): new function.
+
+       * lily/spacing-engraver.cc (stop_translation_timestep): store
+       SpacingSpanner refs in Paper_column.
+
+       * lily/spacing-loose-columns.cc (set_loose_columns): rewrite
+       compute loose clique spacing using GraceSpacing/SpacingSpanner.
+
 2006-08-03  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * lily/beam-engraver.cc (listen_beam): add method for
index d21828c374ee5c5105b13ee98c97b99e3282f988..f9686a4968811331cdcf62b9e732a7c1cce528f6 100644 (file)
@@ -29,6 +29,7 @@ public:
   virtual void do_break_processing ();
   virtual Paper_column *get_column () const;
   virtual System *get_system () const;
+  void set_system (System *);
 
   static int compare (Grob * const &a,
                      Grob * const &b);
index 4da6ff3ef9351419387914458f6f7cc879ca0296..4558709c3002c057cb32c7241ead88eda0212e36 100644 (file)
@@ -45,6 +45,12 @@ Paper_column::get_system () const
   return system_;
 }
 
+void
+Paper_column::set_system (System *s)
+{
+  system_ = s;
+}
+
 Paper_column *
 Paper_column::get_column () const
 {
index 4a11d75b48bf90f15af2d4662b3a47ff3927bb8c..fcae3dfcc2d707aee0463aa3814a7004bbb12ab0 100644 (file)
@@ -140,7 +140,6 @@ Spacing_spanner::note_spacing (Grob *me, Grob *lc, Grob *rc,
          Spacing_options grace_opts;
          grace_opts.init_from_grob (grace_spacing);
 
-
          bool bla;
          dist = grace_opts.get_duration_space (delta_t.grace_part_, &bla);
        }
index 9325451d28a081f404babe33a86018a723927adc..e80f98f1aebfc5e7eeaee4875ba777cf5cfef95d 100644 (file)
@@ -211,8 +211,14 @@ Spacing_engraver::stop_translation_timestep ()
 
   musical_column->set_property ("shortest-playing-duration", sh);
   musical_column->set_property ("shortest-starter-duration", st);
+
+  musical_column->set_object ("spacing", spacing_->self_scm ());
+  unsmob_grob (get_property ("currentCommandColumn"))
+    ->set_object ("spacing", spacing_->self_scm ());
 }
 
+
+
 void
 Spacing_engraver::start_translation_timestep ()
 {
index fdcc77f1b2797e34697fe892a541ca4974edbb96..202cfac6686c8458e3af22eabce47ad367c77305 100644 (file)
@@ -25,7 +25,6 @@ set_loose_columns (System *which, Column_x_positions const *posns)
   if (!loose_col_count)
     return;
 
-  Real default_padding = 1.0;
   for (int i = 0; i < loose_col_count; i++)
     {
       int divide_over = 1;
@@ -69,73 +68,59 @@ set_loose_columns (System *which, Column_x_positions const *posns)
       if (!right->get_system ())
        right = right->find_prebroken_piece (LEFT);
 
-      clique.push_back (right);
-
       Grob *common = right->common_refpoint (left, X_AXIS);
-      Item *finished_right_column = clique.back ();
-
-      for (vsize j = clique.size () - 2; j > 0; j--)
-       {
-         int count = 0;
-         Real total_space = 0.0;
-         Real total_fixed = 0.0;
 
-         extract_grob_set (col, "spacing-wishes", wishes);
-         for (vsize i = 0; i < wishes.size (); i++)
-           {
-             Grob *spacing = wishes[i];
-             Real space = 0.0;
-             Real fixed = 0.0;
-
-             if (Staff_spacing::has_interface (spacing))
-               Staff_spacing::get_spacing_params (spacing, &space, &fixed);
-             else if (Note_spacing::has_interface (spacing))
-               {
-                 Spacing_options options;
+      clique.push_back (right);
 
-                 fixed = robust_relative_extent (col, col, X_AXIS)[RIGHT];
+      vector<Real> clique_spacing;
+      clique_spacing.push_back (0.0);
+      for (vsize j = 1; j < clique.size () - 1; j ++)
+       {
+         Grob *clique_col = clique[j];
 
-                 Moment dt = Paper_column::when_mom (right) - Paper_column::when_mom (col);
-                 bool expand = false;
+         Paper_column *loose_col = dynamic_cast<Paper_column *> (clique[j]);
+         Paper_column *last_col = dynamic_cast<Paper_column *> (clique[j-1]);
 
-                 space = options.get_duration_space (dt.main_part_, &expand);
-                 Note_spacing::get_spacing (spacing, right, space, options.increment_,
-                                            &space, &fixed);
-               }
-             else
-               continue;
+         Grob *spacing = unsmob_grob (clique_col->get_object ("spacing"));
+         if (Grob *grace_spacing = unsmob_grob (clique_col->get_object ("grace-spacing")))
+           {
+             spacing = grace_spacing;
+           }
+         
+         Spacing_options options;
+         options.init_from_grob (spacing);
 
-             count++;
+         bool expand_only = false;
+         Real base_note_space = Spacing_spanner::note_spacing (spacing, last_col, loose_col,
+                                                               &options, &expand_only);
 
-             total_space += space;
-             total_fixed += fixed;
-           }
+         clique_spacing.push_back (base_note_space);
+       }
 
-         Real distance_to_next = 0.0;
-         Real right_point = 0.0;
-         if (count)
-           {
-             total_space /= count;
-             total_fixed /= count;
+      Real default_padding = 1.0;
+      clique_spacing.push_back (default_padding);
 
-             distance_to_next = total_space;
-             right_point
-               = finished_right_column->relative_coordinate (common, X_AXIS);
-           }
-         else
-           {
-             Interval my_extent = robust_relative_extent (col, col, X_AXIS);
-             distance_to_next = my_extent[RIGHT] + default_padding;
-             right_point = robust_relative_extent (finished_right_column, common, X_AXIS)[LEFT];
-           }
+      Real right_point = robust_relative_extent (clique.back (), common, X_AXIS)[LEFT];
+      
+         
+      Grob *finished_right_column = clique.back ();
+      
+      for (vsize j = clique.size () - 2; j > 0; j--)
+       {
+         Paper_column *clique_col = dynamic_cast<Paper_column *> (clique[j]);
+         
+         right_point = finished_right_column->relative_coordinate (common, X_AXIS);
 
+         Real distance_to_next = clique_spacing[j+1];
+         
          Real my_offset = right_point - distance_to_next;
 
-         col->system_ = which;
-         col->translate_axis (my_offset - col->relative_coordinate (common, X_AXIS), X_AXIS);
+         clique_col->set_system (which);
+         clique_col->translate_axis (my_offset - clique_col->relative_coordinate (common, X_AXIS), X_AXIS);      
 
-         finished_right_column = col;
+         finished_right_column = clique_col;
        }
     }
 }
 
index a8a0ff5160f7ba0730c8ce20eee15796780cf5a5..2fba41a49e9f6e04b92f6a66cf428ea2338273a6 100644 (file)
@@ -218,6 +218,7 @@ System::break_into_pieces (vector<Column_x_positions> const &breaking)
          c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
          dynamic_cast<Paper_column *> (c[j])->system_ = system;
        }
+      
       set_loose_columns (system, &breaking[i]);
       broken_intos_.push_back (system);
     }
index 9d59719a8a4fe70fab5f51769c259dee27b2ff88..37a4c3574901a73e069eac5ba3ef71a9dda95502 100644 (file)
@@ -526,7 +526,8 @@ paper-columns or note-column objects.")
 in addition to notes and stems.")
      (elements ,ly:grob-array? "list of grobs, type depending on the Grob
 where this is set in.")
-     (grace-spacing ,ly:grob-array? "a run of grace notes.")
+     (grace-spacing ,ly:grob? "a run of grace notes.")
+     (spacing ,ly:grob? "the spacing spanner governing this section.")
      (heads ,ly:grob-array? "List of note heads.")
      (items-worth-living ,ly:grob-array? "A list of interesting items. If
 empty in a particular staff, then that staff is erased.")