]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/mark-engraver.cc (stop_translation_timestep): set grob
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 15 Aug 2005 11:17:43 +0000 (11:17 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 15 Aug 2005 11:17:43 +0000 (11:17 +0000)
array for staves found.

* lily/metronome-engraver.cc (stop_translation_timestep): set grob
array for stavesFound.

* lily/staff-spacing.cc (next_note_correction): add fixed and
space to calling convention. This fixes spacing of accidentals
after barlines.

* input/regression/spacing-accidental-stretch.ly: add barline -
accidental case.

ChangeLog
input/regression/spacing-accidental-stretch.ly
lily/include/staff-spacing.hh
lily/mark-engraver.cc
lily/metronome-engraver.cc
lily/paper-column.cc
lily/staff-spacing.cc

index 1a499b23c197f1c9fba2ab3aa20578bae34f3b9f..ff6b69a08b829372ec789b84dd400a3f16bc273f 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,18 @@
 2005-08-15  Han-Wen Nienhuys  <hanwen@xs4all.nl>
 
+       * lily/mark-engraver.cc (stop_translation_timestep): set grob
+       array for staves found.
+
+       * lily/metronome-engraver.cc (stop_translation_timestep): set grob
+       array for stavesFound.
+
+       * lily/staff-spacing.cc (next_note_correction): add fixed and
+       space to calling convention. This fixes spacing of accidentals
+       after barlines.
+
+       * input/regression/spacing-accidental-stretch.ly: add barline -
+       accidental case.
+
        * scm/framework-ps.scm (page-header): add version number to
        creator
        (eps-header): idem.
index b46da7173bf825308836d8574dd756998e2dd97f..114327939cff989f7493ad60f2a8659ed55b71c5 100644 (file)
@@ -10,11 +10,12 @@ The accidental does add a little non-stretchable space.
 \score {
       \relative c'' \context GrandStaff {
        #(set-accidental-style 'piano-cautionary)
-       d16 d d d d d cis d 
+       \time 2/4 
+       d16 d d d d d cis d dis dis dis dis 
        
      }
 
      %% not raggedright!!
-     \layout {  linewidth = 14.\cm
+     \layout {  linewidth = 18.\cm
      }
 }
index eb271be1568ebad6183751cbf935890cb6c131a0..367af8ff8f44e899adee8fef0d5b78d05378f802 100644 (file)
@@ -14,8 +14,8 @@
 class Staff_spacing
 {
 public:
-  static Real next_notes_correction (Grob *, Grob *);
-  static Real next_note_correction (Grob *, Grob *, Interval);
+  static void next_notes_correction (Grob *, Grob *, Real *, Real *);
+  static void next_note_correction (Grob *, Grob *, Interval, Real*, Real *);
   static bool has_interface (Grob *);
   static void get_spacing_params (Grob *, Real *, Real *);
 
index a770cf2001c28093ac517e43daa63ef1ed55c541..209b597bfef69eef1b64fd5a72a066ca36b9becd 100644 (file)
@@ -14,6 +14,7 @@
 #include "item.hh"
 #include "warn.hh"
 #include "text-interface.hh"
+#include "grob-array.hh"
 
 /**
    put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
@@ -62,8 +63,8 @@ Mark_engraver::stop_translation_timestep ()
 {
   if (text_)
     {
-      SCM lst = get_property ("stavesFound");
-      text_->set_object ("side-support-elements", lst);
+      text_->set_object ("side-support-elements",
+                        grob_list_to_grob_array (get_property ("stavesFound")));
       text_ = 0;
     }
   mark_ev_ = 0;
index f42c9f1870e71b9a15fb25aa2c033a6ce7c32a72..15375e542bbabb57b47cca64c4e6c0d5a2cdb6e8 100644 (file)
@@ -8,11 +8,11 @@
 
 #include <cctype>
 
+#include "engraver.hh"
+
 #include "note-column.hh"
-#include "bar-line.hh"
-#include "time-signature.hh"
-#include "engraver-group-engraver.hh"
 #include "context.hh"
+#include "grob-array.hh"
 
 /**
    put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
@@ -47,7 +47,8 @@ Metronome_mark_engraver::stop_translation_timestep ()
     {
       Grob *mc = unsmob_grob (get_property ("currentMusicalColumn"));
       text_->set_parent (mc, X_AXIS);
-      text_->set_object ("side-support-elements", get_property ("stavesFound"));
+      text_->set_object ("side-support-elements",
+                        grob_list_to_grob_array (get_property ("stavesFound")));
 
       text_ = 0;
     }
index 1ae46fee1128a9dd865843f5f12d9f70d415855e..f188bfdb489369262216a8b1c39629a8a4f47432 100644 (file)
@@ -27,20 +27,26 @@ Paper_column::clone (int count) const
 }
 
 ADD_INTERFACE (Paper_column, "paper-column-interface",
-              "@code{Paper_column} objects form the top-most X-parents for items. "
+              "@code{Paper_column} objects form the top-most X-parents for items."
               "  The are two types of columns: musical columns, where are attached to, and "
               "  non-musical columns, where bar-lines, clefs etc. are attached to. "
               "  The spacing engine determines the X-positions of these objects."
+              
               "\n\n"
               "They are\n"
               "  numbered, the first (leftmost) is column 0. Numbering happens before\n"
               "  line-breaking, and columns are not renumbered after line breaking.\n"
               "  Since many columns go unused, you should only use the rank field to\n"
               "  get ordering information.  Two adjacent columns may have\n"
-              "  non-adjacent numbers.\n"
-              "\n",
-              "between-cols when bounded-by-me "
-              "page-penalty shortest-playing-duration shortest-starter-duration");
+              "  non-adjacent numbers.\n",
+              
+              
+              "between-cols "
+              "bounded-by-me "
+              "page-penalty "
+              "shortest-playing-duration "
+              "shortest-starter-duration "
+              "when ");
 
 void
 Paper_column::do_break_processing ()
@@ -110,6 +116,7 @@ Paper_column::is_used (Grob *me)
   extract_grob_set (me, "bounded-by-me", bbm);
   if (bbm.size ())
     return true;
+  
   return Item::is_breakable (me);
 }
 
index 58603069848d47a76fa4f45acdfe6fa1e39aa41e..735436e14219fe464e7ddd599b46a602e75dd9f2 100644 (file)
   Insert some more space for the next note, in case it has a stem in
   the wrong direction
 */
-Real
+void
 Staff_spacing::next_note_correction (Grob *me,
                                     Grob *g,
-                                    Interval bar_size)
+                                    Interval bar_size,
+                                    Real *space,
+                                    Real *fix)
 {
+  (void)space;
+  
   if (!g || !Note_column::has_interface (g))
-    return 0.0;
+    return ;
 
   Item *col = dynamic_cast<Item *> (g)->get_column ();
   Real max_corr = max (0., (- g->extent (col, X_AXIS)[LEFT]));
@@ -80,7 +84,8 @@ Staff_spacing::next_note_correction (Grob *me,
            max_corr = max (max_corr, corr);
          }
       }
-  return max_corr;
+
+  *fix += max_corr;
 }
 
 /*
@@ -114,24 +119,49 @@ Staff_spacing::bar_y_positions (Grob *bar_grob)
   pointers to the separation-items, not the note-columns or
   note-spacings.
 */
-Real
-Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob)
+void
+Staff_spacing::next_notes_correction (Grob *me, Grob *last_grob,
+                                     Real *compound_space, Real *compound_fixed
+                                     )
 {
   Interval bar_size = bar_y_positions (last_grob);
-  Real max_corr = 0.0;
 
   extract_grob_set (me, "right-items", right_items);
+
+  *compound_fixed = 0.0;
+  *compound_space = 0.0;
+  int wishes;
+  
   for (int i = right_items.size (); i--;)
     {
       Grob *g = right_items[i];
 
-      max_corr = max (max_corr, next_note_correction (me, g, bar_size));
+      Real space = 0.0;
+      Real fixed = 0.0;
+
+      next_note_correction (me, g, bar_size, &space, &fixed);
+
+      *compound_space += space;
+      *compound_fixed += fixed; 
+      wishes ++;
+      
       extract_grob_set (g, "elements", elts);
       for (int j = elts.size (); j--;)
-       max_corr = max (max_corr, next_note_correction (me, elts[j], bar_size));
+       {
+         Real space = 0.0;
+         Real fixed = 0.0;
+         next_note_correction (me, elts[j], bar_size, &space, &fixed);
+         *compound_fixed += fixed;
+         *compound_space += space;
+         wishes ++;
+       }
     }
 
-  return max_corr;
+  if (wishes)
+    {
+      *compound_space /= wishes;
+      *compound_fixed /= wishes;
+    }
 }
 
 void
@@ -152,7 +182,6 @@ Staff_spacing::get_spacing_params (Grob *me, Real *space, Real *fixed)
     }
 
   //  printf ("doing col %d\n" , Paper_column::get_rank (left_col));
-
   if (!separation_item)
     {
       programming_error ("no sep item");
@@ -224,7 +253,10 @@ Staff_spacing::get_spacing_params (Grob *me, Real *space, Real *fixed)
       *fixed = *space;
     }
 
-  *space += next_notes_correction (me, last_grob);
+  Real correction_fixed, correction_space;
+  next_notes_correction (me, last_grob, &correction_space, &correction_fixed );
+  *space += correction_space;
+  *fixed += correction_fixed;
 }
 
 ADD_INTERFACE (Staff_spacing, "staff-spacing-interface",