]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/separating-group-spanner.cc
Imported sources
[lilypond.git] / lily / separating-group-spanner.cc
index d841599246fb8fd4c67235d09af00e339f100b06..868e49ecdd2cdb29a41c92a6b35ba8d2b36ce1f9 100644 (file)
@@ -3,7 +3,7 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 1998--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 
@@ -15,7 +15,7 @@
 #include "group-interface.hh"
 
 void
-Separating_group_spanner::find_rods (Item * r, SCM next)
+Separating_group_spanner::find_rods (Item * r, SCM next, Real padding)
 {
 
   /*
@@ -24,9 +24,10 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
     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 ())
+  if (Separation_item::width (r).is_empty ())
     return; 
-  
+
+
   for(; gh_pair_p (next); next = ly_cdr (next))
     {
       Item *l = dynamic_cast<Item*> (unsmob_grob (ly_car( next)));
@@ -36,28 +37,28 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
        {
          Interval li (Separation_item::width (lb));
          Interval ri (Separation_item::conditional_width (r, lb));
-         if (!li.empty_b () && !ri.empty_b())
+         if (!li.is_empty () && !ri.is_empty ())
            {
              Rod rod;
 
              rod.item_l_drul_[LEFT] = lb;
              rod.item_l_drul_[RIGHT] = r;
 
-             rod.distance_ = li[RIGHT] - ri[LEFT];
+             rod.distance_ = li[RIGHT] - ri[LEFT] + padding;
              rod.add_to_cols ();
            }
        }
 
       Interval li (Separation_item::width (l));
       Interval ri (Separation_item::conditional_width (r, l));
-      if (!li.empty_b () && !ri.empty_b())
+      if (!li.is_empty () && !ri.is_empty ())
        {
          Rod rod;
 
          rod.item_l_drul_[LEFT] =l;
          rod.item_l_drul_[RIGHT]=r;
 
-         rod.distance_ = li[RIGHT] - ri[LEFT];
+         rod.distance_ = li[RIGHT] - ri[LEFT] + padding;
        
          rod.add_to_cols ();
          break;
@@ -71,20 +72,12 @@ Separating_group_spanner::find_rods (Item * r, SCM next)
     }
 }
 
-MAKE_SCHEME_CALLBACK (Separating_group_spanner,set_spacing_rods_and_seqs,1);
-SCM
-Separating_group_spanner::set_spacing_rods_and_seqs (SCM smob)
-{
-  set_spacing_rods (smob);
-
-  return SCM_UNSPECIFIED;
-}
-
 MAKE_SCHEME_CALLBACK (Separating_group_spanner,set_spacing_rods,1);
 SCM
 Separating_group_spanner::set_spacing_rods (SCM smob)
 {
   Grob*me = unsmob_grob (smob);
+  Real padding = robust_scm2double (me->get_grob_property ("padding"), 0.1);
   
   for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s) && gh_pair_p (ly_cdr (s)); s = ly_cdr (s))
     {
@@ -100,9 +93,9 @@ Separating_group_spanner::set_spacing_rods (SCM smob)
       Item *rb
        = dynamic_cast<Item*> (r->find_prebroken_piece (LEFT));
       
-      find_rods (r, ly_cdr (s));
+      find_rods (r, ly_cdr (s), padding);
       if (rb)
-       find_rods (rb, ly_cdr (s));
+       find_rods (rb, ly_cdr (s), padding);
     }
 
   return SCM_UNSPECIFIED ;