]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add outside-staff-priority defaults for several grobs.
authorJoe Neeman <joeneeman@gmail.com>
Fri, 1 Dec 2006 15:20:10 +0000 (17:20 +0200)
committerJoe Neeman <joeneeman@gmail.com>
Fri, 1 Dec 2006 21:16:09 +0000 (23:16 +0200)
Add outside-staff-padding.
Fix outside-staff positioning for grobs whose parent is System.

input/mutopia/W.A.Mozart/mozart-hrn-3.ly
lily/axis-group-interface.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

index 9f1ae8ab5778fec1b6c2f7c4c176b04378118d87..1e7960dd22fdb007156d7ae140a75599331730de 100644 (file)
@@ -49,7 +49,6 @@ virtuoso that taught in Geneva.
 \include "mozart-hrn3-rondo.ily"
 
 \paper {
-    between-system-padding = 0.0
     between-system-space = 20 \mm
 }
 
index 2ede25493acad7693f5b8dc8c19cd446d7a87b10..2f5ca17d123302cba5561ddfde7735cac913db5b 100644 (file)
@@ -269,6 +269,22 @@ staff_priority_less (Grob * const &g1, Grob * const &g2)
   return rank_1 < rank_2;
 }
 
+static void
+add_boxes (Grob *me, Grob *x_common, Grob *y_common, vector<Box> *const boxes)
+{
+  if (Axis_group_interface::has_interface (me)
+      && Axis_group_interface::has_axis (me, Y_AXIS))
+    {
+      Grob_array *elements = unsmob_grob_array (me->get_object ("elements"));
+      if (elements)
+       for (vsize i = 0; i < elements->size (); i++)
+         add_boxes (elements->grob (i), x_common, y_common, boxes);
+    }
+  else
+    boxes->push_back (Box (me->extent (x_common, X_AXIS),
+                          me->extent (y_common, Y_AXIS)));
+}
+
 void
 Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
 {
@@ -281,9 +297,7 @@ Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
 
   for (i = 0; i < elements.size ()
         && !scm_is_number (elements[i]->get_property ("outside-staff-priority")); i++)
-    boxes.push_back (Box (elements[i]->extent (x_common, X_AXIS),
-                         elements[i]->extent (y_common, Y_AXIS)));
-
+    add_boxes (elements[i], x_common, y_common, &boxes);
 
   Drul_array<Skyline> skylines (Skyline (boxes, X_AXIS, DOWN),
                                Skyline (boxes, X_AXIS, UP));
@@ -298,10 +312,17 @@ 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));
+      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 ()));
+         continue;
+       }
+
       boxes.clear ();
       boxes.push_back (b);
       Skyline other = Skyline (boxes, X_AXIS, -dir);
-      Real dist = skylines[dir].distance (other);
+      Real padding = robust_scm2double (elements[i]->get_property ("outside-staff-padding"), 0.5);
+      Real dist = skylines[dir].distance (other) + padding;
 
       if (dist > 0)
        {
index 5e9c1757026dcb314d6c82b803ad050e2ceb1f92..0081da0636302cbd9f1879ae2d1db7bbf36b054f 100644 (file)
@@ -274,6 +274,8 @@ 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-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
 in such a way as to avoid all collisions. In case of a potential collision, the grob with
 the smaller outside-staff-priority will be closer to the staff.")
index 3506ea0892608855e224282ad9f70e445069b671..8916c634409380e1b905968ded41b2bfdf1ee456 100644 (file)
        (minimum-space . 1.2)
        (direction . ,DOWN)
        (side-axis . ,Y)
+       (outside-staff-priority . 250)
        (Y-extent . ,ly:axis-group-interface::height)
        (X-extent . ,ly:axis-group-interface::width)
        (meta . ((class . Spanner)
        (avoid-slur . around)
        (no-spacing-rods . #t)
        (script-priority . 100)
+       (outside-staff-priority . 300)
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                text-interface
        (dash-fraction . 0.3)
        (edge-height . (0 . 1.2))
        (direction . ,UP)
+       (outside-staff-priority . 400)
        (meta . ((class . Spanner)
                 (interfaces . (ottava-bracket-interface
                                horizontal-bracket-interface
        (break-visibility . ,end-of-line-invisible)
        (break-align-symbol . staff-bar)
        (padding . 0.8)
+       (outside-staff-priority . 1000)
        (meta . ((class . Item)
                 (interfaces . (text-interface
                                side-position-interface
     (SeparationItem
      . (
        (avoid-slur . inside)
-       (skylines . ,ly:separation-item::calc-skylines)
        (X-extent . ,ly:axis-group-interface::width)
        (Y-extent . ,ly:axis-group-interface::height)
        (meta . ((class . Item)
        (stencil . ,ly:text-interface::print)
        (direction . ,ly:script-interface::calc-direction)
 
+       (outside-staff-priority . 450)
        (avoid-slur . around)
        (slur-padding . 0.5)
        (script-priority . 200)
        (dash-period . 3.0)
        (side-axis . ,Y)
        (direction . ,UP)
+       (outside-staff-priority . 350)
        (meta . ((class . Spanner)
                 (interfaces . (text-spanner-interface
                                line-spanner-interface
        (direction . ,UP)
        (Y-offset . ,ly:side-position-interface::y-aligned-side)
        (side-axis . ,Y)
+       (outside-staff-priority . 50)
        (meta . ((class . Spanner)
                 (interfaces . (text-spanner-interface
                                line-spanner-interface
        (edge-height . (2.0 . 2.0)) ;; staff-space;
        (minimum-space . 5)
        (font-size . -4)
+       (outside-staff-priority . 100)
        (meta . ((class . Spanner)
                 (interfaces . (volta-bracket-interface
                                horizontal-bracket-interface