]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/break-align-interface.cc
* lily/spacing-engraver.cc (finalize): robustifications.
[lilypond.git] / lily / break-align-interface.cc
index edcc77c730193e9476e4ad4c1b5b3c653d43e07f..07a99d272f10fc6c6bf551cc3d03720fdfb78d99 100644 (file)
@@ -3,13 +3,14 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c)  1997--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 
 #include <math.h>
 #include <libc-extension.hh>   // isinf
 
+#include "self-alignment-interface.hh"
 #include "side-position-interface.hh"
 #include "axis-group-interface.hh"
 #include "warn.hh"
@@ -31,9 +32,9 @@ Break_align_interface::alignment_callback (SCM element_smob, SCM axis)
 
   assert (a == X_AXIS);
   Grob *par = me->get_parent (a);
-  if (par && !to_boolean (par->get_grob_property ("break-alignment-done")))
+  if (par && !to_boolean (par->get_grob_property ("positioning-done")))
     {
-      par->set_grob_property ("break-alignment-done", SCM_BOOL_T);
+      par->set_grob_property ("positioning-done", SCM_BOOL_T);
       Break_align_interface::do_alignment (par);
     }
     
@@ -71,7 +72,6 @@ void
 Break_align_interface::do_alignment (Grob *me)
 {
   Item * item = dynamic_cast<Item*> (me);
-  int rank = Paper_column::get_rank (item->get_column ());
   Link_array<Grob> elems
     = Pointer_group_interface__extract_grobs (me, (Grob*)0,
                                                 "elements");
@@ -82,12 +82,12 @@ Break_align_interface::do_alignment (Grob *me)
     {
       Interval y = elems[i]->extent (elems[i], X_AXIS);
       extents.push (y);
-      if (!y.empty_b())
+      if (!y.is_empty ())
        last_nonempty = i; 
     }
 
   int idx  = 0;
-  while (idx < extents.size  () && extents[idx].empty_b ())
+  while (idx < extents.size  () && extents[idx].is_empty ())
     idx++;
   
   Array<Real> offsets;
@@ -102,8 +102,7 @@ Break_align_interface::do_alignment (Grob *me)
     {
       int next_idx = idx+1;
       while (next_idx < elems.size() &&
-            extents[next_idx].empty_b()
-           )
+            extents[next_idx].is_empty () )
        next_idx++;
       
       Grob *l = elems[idx];
@@ -188,7 +187,9 @@ Break_align_interface::do_alignment (Grob *me)
       if (r)
        {
          if (type == ly_symbol2scm ("extra-space"))
-           offsets[next_idx] = extents[idx][RIGHT] + distance;
+           offsets[next_idx] = extents[idx][RIGHT] + distance
+             - extents[next_idx][LEFT];
+         /* should probably junk minimum-space */
          else if (type == ly_symbol2scm("minimum-space"))
            offsets[next_idx] = extents[idx][RIGHT] >? distance;
        }
@@ -230,28 +231,33 @@ Break_align_interface::do_alignment (Grob *me)
 
 
 ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
-  "Items that are aligned in prefatory matter.
-
-The spacing of these items is controlled by the space-alist
-property. It contains a list break-align-symbols with a specification
-of the associated space. The space definition is either (extra-space
-. @var{number}), which adds space after the symbol, (minimum-space
-. @var{ms}), which pads the space until it it is @var{ms}.
-
-
-Special keys for the alist are 'first-note and 'next-note, signifyign
-the first note on a line, and the next note halfway a line.
-
-Rules for this spacing are much more complicated than this. 
-See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147
-
-
-",
-  "break-align-symbol break-alignment-done space-alist");
+              "Items that are aligned in prefatory matter.\n"
+              "\n"
+              "The spacing of these items is controlled by the space-alist\n"
+              "property. It contains a list break-align-symbols with a specification\n"
+              "of the associated space. The space specification can be "
+              "@table @code\n"
+              "@item (minimum-space . @var{spc}))\n"
+              "  Pad space until the distance is @var{spc}\n"
+              "@item (fixed-space . @var{spc})\n"
+              "  Set a fixed space\n" 
+              "@item (semi-fixed-space . @var{spc})\n"
+              "  Set a space. Half of it is fixed and half is stretchable. \n"
+              "(does not work at start of line. fixme)\n"
+              "@item (extra-space . @var{spc})\n"
+              "  Add @var{spc} amount of space.\n"
+              "@end table\n"
+              "\n"
+              "Special keys for the alist are 'first-note and 'next-note, signifying\n"
+              "the first note on a line, and the next note halfway a line.\n"
+              "\n"
+              "Rules for this spacing are much more complicated than this. \n"
+              "See [Wanske] page 126 -- 134, [Ross] pg 143 -- 147\n",
+              "break-align-symbol space-alist");
 
 ADD_INTERFACE (Break_align_interface, "break-alignment-interface",
   "See @ref{break-aligned-interface}.",
-  "break-alignment-done");
+  "positioning-done");