]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/separation-item.cc (width): cache extent in extent-X
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 23 Jul 2002 18:38:44 +0000 (18:38 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 23 Jul 2002 18:38:44 +0000 (18:38 +0000)
* lily/spacing-spanner.cc (standard_breakable_column_spacing):
only add extent for non-musical column.

ChangeLog
input/regression/accidental-unbroken-tie-spacing.ly [new file with mode: 0644]
lily/accidental-placement.cc
lily/separating-group-spanner.cc
lily/separation-item.cc
lily/spacing-spanner.cc
scm/grob-property-description.scm

index 089154d8675975b1196ce6a13edb9a3e2595d40e..6e4584f89e744e191eda48cabdc95433acd5bd91 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,10 @@
 2002-07-23  Han-Wen  <hanwen@cs.uu.nl>
 
+       * lily/separation-item.cc (width): cache extent in extent-X
+
+       * lily/spacing-spanner.cc (standard_breakable_column_spacing):
+       only add extent for non-musical column.
+
        * lily/accidental-placement.cc (split_accidentals): new function
        (get_relevant_accidental_extent): new function
 
diff --git a/input/regression/accidental-unbroken-tie-spacing.ly b/input/regression/accidental-unbroken-tie-spacing.ly
new file mode 100644 (file)
index 0000000..7d4e017
--- /dev/null
@@ -0,0 +1,28 @@
+\header {
+texidoc = "Tied accidentaled notes (which cause reminder accidentals) don't wreak havoc in
+the spacing when unbroken."
+}
+
+\version "1.5.68"
+\include "deutsch.ly"
+
+rechts = \notes \relative c' {
+  \clef treble
+  \time 3/4
+  \context Voice {
+    c8 h2  <g8 h des f> ~ |
+    <g8 h des f>
+  }
+}
+
+Rechts = \context Staff \notes {
+  rechts
+}
+
+\score {
+  \rechts
+
+  \paper {
+    linewidth = -3.3 \cm
+  }
+}
index c05932ecee0e40a62f2a112858239666bc353b31..292f9935512f1195fb6458a994338e7f07dc387b 100644 (file)
@@ -111,8 +111,8 @@ Accidental_placement::split_accidentals (Grob * accs,
 }
 
 /*
-  Accidentals are special, because they appear and disappear before
-  and after ties at will.
+  Accidentals are special, because they appear and disappear after
+  ties at will.
 */
 Interval
 Accidental_placement::get_relevant_accidental_extent (Grob *me,
index f4471530bf217091788c94b30925299ff52d3d84..4cd8c8ef3228c79888697f77120512f758b3b761 100644 (file)
@@ -19,9 +19,14 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
 {
 
   /*
-    This is an inner loop, however, in most cases, the interesting L
-    will just be the first entry of NEXT, making it linear in most of
-    the cases.  */
+    This is an inner loop: look for the first normal (unbroken) Left
+    grob.  This looks like an inner loop (ie. quadratic total), but in
+    most cases, the interesting L will just be the first entry of
+    NEXT, making it linear in most of the cases.
+  */
+  if (Separation_item::width (r).empty_b ())
+    return; 
+  
   for(; gh_pair_p (next); next = ly_cdr (next))
     {
       Item *l = dynamic_cast<Item*> (unsmob_grob (ly_car( next)));
@@ -39,8 +44,6 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
              rod.item_l_drul_[RIGHT] = r;
 
              rod.distance_f_ = li[RIGHT] - ri[LEFT];
-       
-             rod.columnize ();
              rod.add_to_cols ();
            }
        }
@@ -56,16 +59,15 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
 
          rod.distance_f_ = li[RIGHT] - ri[LEFT];
        
-         rod.columnize ();
          rod.add_to_cols ();
-
          break;
        }
-      else
-       /*
-         this grob doesn't cause a constraint. We look further until we
-         find one that does.  */
-       ;
+
+      /*
+       this grob doesn't cause a constraint. We look further until we
+       find one that does.
+      */
+
     }
 }
 
index f85866f4c8320d503dcec25bc210fc97af2b9024..f318a62f7e105e95668340177f3a89c4f1adc10c 100644 (file)
@@ -27,11 +27,15 @@ Separation_item::add_conditional_item (Grob* me , Grob *e)
   Pointer_group_interface::add_grob (me, ly_symbol2scm ("conditional-elements"), e);
 }
 
+/*
+  Return the width of ME given that we are considering the object on
+  the LEFT.
+ */
 Interval
 Separation_item::conditional_width (Grob * me, Grob * left)
 {
   Interval w = width (me);
-
+  
   Item *item = dynamic_cast<Item*> (me);
   Paper_column * pc = item->column_l ();
   
index 4c3f635950c4a63e25853712f382363ad6424b3b..3c8f3a4e14928ebd32cbba4b06bdb3905e303e79 100644 (file)
@@ -28,9 +28,6 @@
 #include "break-align-interface.hh"
 #include "spacing-interface.hh"
 
-/*
-  paper-column:
- */
 class Spacing_spanner
 {
 public:
@@ -639,18 +636,25 @@ Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
                                   Real * fixed, Real * space,
                                   Moment shortest)
 {
   *fixed = 0.0;
   Direction d = LEFT;
   Drul_array<Item*> cols(l,r);
   
   do
     {
-      Interval lext = cols[d]->extent (cols [d], X_AXIS);
-
-      *fixed += -d * lext[-d];
+      if (!Paper_column::musical_b (cols[d]))
+       {
+         /*
+           Tied accidentals over barlines cause problems, so lets see
+           what happens if we do this for non musical columns only.
+          */
+         Interval lext = cols[d]->extent (cols [d], X_AXIS);
+         *fixed += -d * lext[-d];
+       }
     }
   while (flip (&d) != LEFT);
-  
+
   if (l->breakable_b (l) && r->breakable_b(r))
     {
       Moment *dt = unsmob_moment (l->get_grob_property ("measure-length"));
@@ -669,8 +673,6 @@ Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
 
       *space = *fixed + get_duration_space (me, dt, shortest.main_part_, &dummy);
     }
-  
-  
 }
 
 
index e2e8c8366768c401c3a483faf513cdb76df85cca..f7983f893682ccbabcf1028f1023b4160092081f 100644 (file)
@@ -306,7 +306,7 @@ taking grob as argument, returning a smobbed Molecule.
 All visible, i.e. non-transparent, grobs have a callback to create a
 Molecule. The callback should be a Scheme function taking one argument
 (the grob) and returning a Molecule.  Most molecule callbacks are
-written in C++, but you can also write them in Scheme. An examlily/lilypond/ple is
+written in C++, but you can also write them in Scheme. An example is
 provided in @code{input/regression/molecule-hacking.ly}.
 ")