]> git.donarmstrong.com Git - lilypond.git/commitdiff
Merge branch 'master' of ssh+git://jneem@git.sv.gnu.org/srv/git/lilypond
authorJoe Neeman <joeneeman@gmail.com>
Tue, 12 Dec 2006 15:53:07 +0000 (17:53 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Tue, 12 Dec 2006 15:53:07 +0000 (17:53 +0200)
lily/axis-group-interface.cc
lily/grob.cc
lily/separation-item.cc
lily/skyline.cc
lily/system.cc
lily/tie-formatting-problem.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

index 44293f6d5455c75ed497676dbf809d0238521f79..5eebdf2b89aad35ab2c58ed20bb1733d9271f688 100644 (file)
@@ -314,6 +314,8 @@ Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
 
       Box b (elements[i]->extent (x_common, X_AXIS),
             elements[i]->extent (y_common, Y_AXIS));
+      SCM horizon_padding_scm = elements[i]->get_property ("outside-staff-horizontal-padding");
+      Real horizon_padding = robust_scm2double (horizon_padding_scm, 0.0);
       if (b[X_AXIS].is_empty () || b[Y_AXIS].is_empty ())
        {
          warning (_f ("outside-staff object %s has an empty extent", elements[i]->name ().c_str ()));
@@ -322,7 +324,7 @@ Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
 
       boxes.clear ();
       boxes.push_back (b);
-      Skyline other = Skyline (boxes, 0, X_AXIS, -dir);
+      Skyline other = Skyline (boxes, horizon_padding, X_AXIS, -dir);
       Real padding = robust_scm2double (elements[i]->get_property ("outside-staff-padding"), 0.5);
       Real dist = skylines[dir].distance (other) + padding;
 
index 3ff7b5df468f3cbf59211a43b5a4bb9db596cb23..139a387989393209390a7704246c87402d0b3295 100644 (file)
@@ -623,6 +623,7 @@ ADD_INTERFACE (Grob,
               "meta "
               "minimum-X-extent "
               "minimum-Y-extent "
+              "outside-staff-horizontal-padding "
               "outside-staff-padding "
               "outside-staff-priority "
               "rotation "
index a07668d13b68ca8891d18dc69a71f8a33b73f95e..20de8fbbd57b6816723815e66c71753dbddd78b0 100644 (file)
@@ -128,7 +128,8 @@ Separation_item::calc_skylines (SCM smob)
   vector<Box> bs = boxes (me);
   do
     {
-      Skyline l (bs, 0, Y_AXIS, d);
+      /* todo: the horizon_padding is somewhat arbitrary */
+      Skyline l (bs, 0.1, Y_AXIS, d);
       index_set_cell (lines, d, l.smobbed_copy ());
     }
   while (flip (&d) != LEFT);
@@ -161,7 +162,6 @@ Separation_item::boxes (Grob *me)
        continue;
 
       Interval y (il->pure_height (ycommon, 0, very_large));
-      y.widen (0.1);           // fixme
       Box b (il->extent (pc, X_AXIS), y);
 
       out.push_back (b);
index 6c3caab69ebe05b3c223050277576a85e46cae9f..ab877f28ce605fcb4854984c049885007007c47d 100644 (file)
 /* A skyline is a sequence of non-overlapping buildings: something like
    this:
                    _______
-                  /       \                                ________
-                 /         \                      ________/        \
-        /\                \                    /                  \
-       /  -----             \                 /                    \
-      /                         \              /                      \
-     /                            ------------/                        ----
+                  |       \                                 ________
+                  |        \                       ________/        \
+        /\        |          \                    /                  \
+       /  --------             \                 /                    \
+      /                          \              /                      \
+     /                             ------------/                        ----
    --
    Each building has a starting position, and ending position, a starting
    height and an ending height.
@@ -259,13 +259,13 @@ single_skyline (Building b, Real horizon_padding, list<Building> *const ret)
   if (!isinf (b.iv_[RIGHT]))
     ret->push_front (Building (b.iv_[RIGHT], -infinity_f,
                               -infinity_f, infinity_f));
-  if (horizon_padding > 0)
+  if (horizon_padding > 0 && !isinf (b.iv_.length ()))
     ret->push_front (b.sloped_neighbour (horizon_padding, RIGHT));
   
   if (b.iv_[RIGHT] > b.iv_[LEFT])
     ret->push_front (b);
 
-  if (horizon_padding > 0)
+  if (horizon_padding > 0 && !isinf (b.iv_.length ()))
     ret->push_front (b.sloped_neighbour (horizon_padding, LEFT));
   if (!isinf (b.iv_[LEFT]))
     ret->push_front (Building (-infinity_f, -infinity_f,
@@ -350,7 +350,7 @@ Skyline::Skyline (vector<Box> const &boxes, Real horizon_padding, Axis horizon_a
          iv.widen (EPS);
          Building front = Building (iv[LEFT], height, height, iv[RIGHT]);
          bldgs.push_front (front);
-         if (horizon_padding > 0)
+         if (horizon_padding > 0 && !isinf (front.iv_.length ()))
            {
              bldgs.push_front (front.sloped_neighbour (horizon_padding, LEFT));
              bldgs.push_front (front.sloped_neighbour (horizon_padding, RIGHT));
index 8f375a8db851d67e57b03e57f0294d614ffb98a9..90eb463c44932ac307902bd3e8a7e5e210b7984f 100644 (file)
@@ -532,8 +532,10 @@ System::build_skylines ()
        boxes.push_back (Box (xiv, yiv));
     }
 
-  skylines_[UP] = Skyline (boxes, 0, X_AXIS, UP);
-  skylines_[DOWN] = Skyline (boxes, 0, X_AXIS, DOWN);
+  SCM horizon_padding_scm = get_property ("skyline-horizontal-padding");
+  Real horizon_padding = robust_scm2double (horizon_padding_scm, 0);
+  skylines_[UP] = Skyline (boxes, horizon_padding, X_AXIS, UP);
+  skylines_[DOWN] = Skyline (boxes, horizon_padding, X_AXIS, DOWN);
 }
 
 
@@ -547,4 +549,5 @@ ADD_INTERFACE (System,
               "pure-Y-extent "
               "spaceable-staves "
               "skyline-distance "
+              "skyline-horizontal-padding "
               )
index 3937c5194ea3d1058ca4b8b068dc63e4c15cf200..a55f31373519f6519131a5c5fd76bb8724c55cdd 100644 (file)
@@ -174,8 +174,9 @@ Tie_formatting_problem::set_column_chord_outline (vector<Item*> bounds,
        boxes.push_back (Box (x, y));
     }
   while (flip (&updowndir) != DOWN);
-  
-  chord_outlines_[key] = Skyline (boxes, 0, Y_AXIS, -dir);
+
+  /* todo: the horizon_padding is somewhat arbitrary */
+  chord_outlines_[key] = Skyline (boxes, 0.1, Y_AXIS, -dir);
   if (bounds[0]->break_status_dir ())
     {
       Real x = robust_relative_extent (bounds[0],  x_refpoint_, X_AXIS)[-dir];
index 24f1fe0a2be4ff1e7611a1c976a901cffb3621a4..d0364bf4959f2284b2d0cad5d829ecba4e441443 100644 (file)
@@ -275,6 +275,9 @@ get stems extending to the middle staff line.")
      (non-musical ,boolean? "True if the grob belongs in a NonMusicalPaperColumn.")
      (number-type ,symbol? "Type of numbers to use in label.  Choices
 include @code{roman-lower}, @code{roman-upper}, and @code{arabic}.")
+     (outside-staff-horizontal-padding ,number? "By default, an outside-staff-object can be
+placed so that is it very close to another grob horizontally. If this property is set,
+the outside-staff-object will be raised so that it is not so close to its neighbour.")
      (outside-staff-padding ,number? "The padding to place between this grob and the staff when
 spacing according to outside-staff-priority.")
      (outside-staff-priority ,number? "When set, the grob will be positioned outside the staff
@@ -558,6 +561,7 @@ than a whole rest.")
 
      (spaceable-staves ,ly:grob-array? "Objects to be spaced during page layout.")
      (skyline-distance ,number? "The distance between this staff and the next one, as determined by a skyline algorithm.")
+     (skyline-horizontal-padding ,number? "For determining the vertical distance between 2 staves, it is possible to have a configuration which would result in a tight interleaving of grobs from the top staff and the bottom staff. The larger this parameter is, the farther apart the staves will be placed in such a configuration.")
      (skyline-spacing ,boolean? "When true, this axis-group will vertically space its children
 using a skyline algorithm.")
 
index 4f5f9a6f51af9cce35233ecd7148ea34a36ce8b3..a9dd4edfbc660b50942192802501f3d029ee4004 100644 (file)
        (X-extent . ,ly:axis-group-interface::width)
        (Y-extent . ,ly:axis-group-interface::height)
        (skyline-spacing . #t)
+       (skyline-horizontal-padding . 1.0)
        (meta . ((class . System)
                 (interfaces . (system-interface
                                axis-group-interface))))))