CVSROOT:        /cvsroot/lilypond
Module name:    lilypond
Branch:         
Changes by:     Han-Wen Nienhuys <[EMAIL PROTECTED]>    05/08/15 11:17:43

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

Log message:
        * 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.

CVSWeb URLs:
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/ChangeLog.diff?tr1=1.4002&tr2=1.4003&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/input/regression/spacing-accidental-stretch.ly.diff?tr1=1.24&tr2=1.25&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/mark-engraver.cc.diff?tr1=1.110&tr2=1.111&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/metronome-engraver.cc.diff?tr1=1.27&tr2=1.28&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/paper-column.cc.diff?tr1=1.81&tr2=1.82&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/staff-spacing.cc.diff?tr1=1.49&tr2=1.50&r1=text&r2=text
http://savannah.gnu.org/cgi-bin/viewcvs/lilypond/lilypond/lily/include/staff-spacing.hh.diff?tr1=1.9&tr2=1.10&r1=text&r2=text

Patches:
Index: lilypond/ChangeLog
diff -u lilypond/ChangeLog:1.4002 lilypond/ChangeLog:1.4003
--- lilypond/ChangeLog:1.4002   Mon Aug 15 00:10:29 2005
+++ lilypond/ChangeLog  Mon Aug 15 11:17:43 2005
@@ -1,5 +1,18 @@
 2005-08-15  Han-Wen Nienhuys  <[EMAIL PROTECTED]>
 
+       * 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: lilypond/input/regression/spacing-accidental-stretch.ly
diff -u lilypond/input/regression/spacing-accidental-stretch.ly:1.24 
lilypond/input/regression/spacing-accidental-stretch.ly:1.25
--- lilypond/input/regression/spacing-accidental-stretch.ly:1.24        Sun Jun 
26 22:39:14 2005
+++ lilypond/input/regression/spacing-accidental-stretch.ly     Mon Aug 15 
11:17:43 2005
@@ -10,11 +10,12 @@
 \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: lilypond/lily/include/staff-spacing.hh
diff -u lilypond/lily/include/staff-spacing.hh:1.9 
lilypond/lily/include/staff-spacing.hh:1.10
--- lilypond/lily/include/staff-spacing.hh:1.9  Thu Mar 10 14:36:12 2005
+++ lilypond/lily/include/staff-spacing.hh      Mon Aug 15 11:17:43 2005
@@ -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: lilypond/lily/mark-engraver.cc
diff -u lilypond/lily/mark-engraver.cc:1.110 
lilypond/lily/mark-engraver.cc:1.111
--- lilypond/lily/mark-engraver.cc:1.110        Fri Aug 12 00:04:45 2005
+++ lilypond/lily/mark-engraver.cc      Mon Aug 15 11:17:43 2005
@@ -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 @@
 {
   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: lilypond/lily/metronome-engraver.cc
diff -u lilypond/lily/metronome-engraver.cc:1.27 
lilypond/lily/metronome-engraver.cc:1.28
--- lilypond/lily/metronome-engraver.cc:1.27    Thu Aug 11 12:52:29 2005
+++ lilypond/lily/metronome-engraver.cc Mon Aug 15 11:17:43 2005
@@ -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 @@
     {
       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: lilypond/lily/paper-column.cc
diff -u lilypond/lily/paper-column.cc:1.81 lilypond/lily/paper-column.cc:1.82
--- lilypond/lily/paper-column.cc:1.81  Sat Aug 13 21:35:22 2005
+++ lilypond/lily/paper-column.cc       Mon Aug 15 11:17:43 2005
@@ -27,20 +27,26 @@
 }
 
 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 @@
   extract_grob_set (me, "bounded-by-me", bbm);
   if (bbm.size ())
     return true;
+  
   return Item::is_breakable (me);
 }
 
Index: lilypond/lily/staff-spacing.cc
diff -u lilypond/lily/staff-spacing.cc:1.49 lilypond/lily/staff-spacing.cc:1.50
--- lilypond/lily/staff-spacing.cc:1.49 Sat Aug 13 21:35:22 2005
+++ lilypond/lily/staff-spacing.cc      Mon Aug 15 11:17:43 2005
@@ -24,13 +24,17 @@
   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 @@
            max_corr = max (max_corr, corr);
          }
       }
-  return max_corr;
+
+  *fix += max_corr;
 }
 
 /*
@@ -114,24 +119,49 @@
   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 @@
     }
 
   //  printf ("doing col %d\n" , Paper_column::get_rank (left_col));
-
   if (!separation_item)
     {
       programming_error ("no sep item");
@@ -224,7 +253,10 @@
       *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",


_______________________________________________
Lilypond-cvs mailing list
Lilypond-cvs@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-cvs

Reply via email to