]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-grobs.scm (all-grob-descriptions): set
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 9 Oct 2006 11:47:39 +0000 (11:47 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 9 Oct 2006 11:47:39 +0000 (11:47 +0000)
allow-loose-spacing for PaperColumn and NonMusicalPaperColumn.

* lily/spaceable-grob.cc: add allow-loose-spacing property.

* lily/spacing-determine-loose-columns.cc (is_loose_column):
allow-loose-spacing property.

ChangeLog
lily/spaceable-grob.cc
lily/spacing-determine-loose-columns.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

index 6aa8986c7ad25afd4eebceb5fa054cfb60ba2347..0a1fdbe85119f05ae31744a16d8946014c5d79f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,5 +1,13 @@
 2006-10-09  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
+       * scm/define-grobs.scm (all-grob-descriptions): set
+       allow-loose-spacing for PaperColumn and NonMusicalPaperColumn.
+
+       * lily/spaceable-grob.cc: add allow-loose-spacing property.
+
+       * lily/spacing-determine-loose-columns.cc (is_loose_column):
+       allow-loose-spacing property.
+
        * scm/define-markup-commands.scm (postscript): gsave & grestore
        around embedded PS. Do setlinewidth too. Fixes  #109.
 
index 96313acf4abd4629f8806a6d87f9ee9f9a94e553..0f3dc9849b93b6edc9068ef0d9767e5500164601 100644 (file)
@@ -122,7 +122,10 @@ Spaceable_grob::remove_interface (Grob *me)
 
 ADD_INTERFACE (Spaceable_grob, "spaceable-grob-interface",
               "A layout object that takes part in the spacing problem. ",
+              
+
               /* properties */
+              "allow-loose-spacing "
               "ideal-distances "
               "keep-inside-line "
               "left-neighbors "
index 93f70b5cecd477ebed82c058fa2d5f79c8345d12..8cd0b9b6a01e48d0a7980d6a5f2818c15ce8b158 100644 (file)
   (Otherwise, we might risk core dumps, and other weird stuff.)
 */
 static bool
-is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options)
+is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options)
 {
+  if (!to_boolean (col->get_property ("allow-loose-spacing")))
+    return false;
+  
   if ((options->float_nonmusical_columns_
        ||options->float_grace_columns_)
-      && Paper_column::when_mom (c).grace_part_)
+      && Paper_column::when_mom (col).grace_part_)
     return true;
 
-  if (Paper_column::is_musical (c)
-      || Paper_column::is_breakable (c))
+  if (Paper_column::is_musical (col)
+      || Paper_column::is_breakable (col))
     return false;
 
-  extract_grob_set (c, "right-neighbors", rns);
-  extract_grob_set (c, "left-neighbors", lns);
+  extract_grob_set (col, "right-neighbors", rns);
+  extract_grob_set (col, "left-neighbors", lns);
 
   /*
     If this column doesn't have a proper neighbor, we should really
@@ -98,7 +101,7 @@ is_loose_column (Grob *l, Grob *c, Grob *r, Spacing_options const *options)
 
     in any case, we don't want to move bar lines.
   */
-  extract_grob_set (c, "elements", elts);
+  extract_grob_set (col, "elements", elts);
   for (vsize i = elts.size (); i--;)
     {
       Grob *g = elts[i];
@@ -159,15 +162,13 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector<Grob*> *cols,
          /*
            Set distance constraints for loose columns
          */
-         Drul_array<Grob *> next_door;
-         next_door[LEFT] = cols->at (i - 1);
-         next_door[RIGHT] = cols->at (i + 1);
+         Drul_array<Grob *> next_door (cols->at (i - 1),
+                                       cols->at (i + 1));
          Direction d = LEFT;
          Drul_array<Real> dists (0, 0);
 
          do
            {
-             dists[d] = 0.0;
              Item *lc = dynamic_cast<Item *> ((d == LEFT) ? next_door[LEFT] : c);
              Item *rc = dynamic_cast<Item *> (d == LEFT ? c : next_door[RIGHT]);
 
@@ -179,19 +180,19 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector<Grob*> *cols,
                      || Note_spacing::right_column (sp) != rc)
                    continue;
 
-                 Real space, fixed;
-                 fixed = 0.0;
-                 bool dummy;
-
                  if (Note_spacing::has_interface (sp))
                    {
                      /*
                        The note spacing should be taken from the musical
                        columns.
-
                      */
+                     Real space = 0.0;
+                     Real fixed = 0.0;
+                     bool dummy = false;
+                 
                      Real base = note_spacing (me, lc, rc, options, &dummy);
-                     Note_spacing::get_spacing (sp, rc, base, options->increment_, &space, &fixed);
+                     Note_spacing::get_spacing (sp, rc, base, options->increment_,
+                                                &space, &fixed);
 
                      space -= options->increment_;
 
@@ -199,7 +200,8 @@ Spacing_spanner::prune_loose_columns (Grob *me, vector<Grob*> *cols,
                    }
                  else if (Staff_spacing::has_interface (sp))
                    {
-                     Real space, fixed_space;
+                     Real space = 0;
+                     Real fixed_space = 0;
                      Staff_spacing::get_spacing_params (sp,
                                                         &space, &fixed_space);
 
index 7f46e9890b63b8d6c533f0671486149b5dee2db6..c1c5f43ea27625d81d899ec858b8e1557cef382b 100644 (file)
@@ -33,6 +33,7 @@ relative to its Y-parent")
     
      (align-dir ,ly:dir? "Which side to align? @code{-1}: left side,
 @code{0}: around center of width, @code{1}: right side.")
+     (allow-loose-spacing ,boolean? "If set, column can be detached from main spacing.")
      (arpeggio-direction ,ly:dir? "If set, put an
 arrow on the arpeggio squiggly line.")
   
index a82741dc6937a61eb774541fdaaf4fdc6d2389a5..f35f29d59c57c7e45e552c3d9e281531c0877cc6 100644 (file)
     (PaperColumn
      . (
        (axes . (0))
+       (allow-loose-spacing . #t)
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
        ;; (stencil . ,ly:paper-column::print)
        (X-extent . ,ly:axis-group-interface::width)
 
     (NonMusicalPaperColumn
      . (
+       (allow-loose-spacing . #t)
        (axes . (0))
        (before-line-breaking . ,ly:paper-column::before-line-breaking)
        (X-extent . ,ly:axis-group-interface::width)