]> git.donarmstrong.com Git - lilypond.git/commitdiff
uniformize grob interface naming with C++.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 29 Nov 2006 14:18:10 +0000 (15:18 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Wed, 29 Nov 2006 14:18:10 +0000 (15:18 +0100)
18 files changed:
lily/balloon-engraver.cc
lily/balloon.cc
lily/break-align-engraver.cc
lily/break-align-interface.cc [deleted file]
lily/break-alignment-interface.cc [new file with mode: 0644]
lily/grob-interface.cc
lily/hara-kiri-group-spanner.cc
lily/include/break-align-interface.hh
lily/include/grob-interface.hh
lily/include/lyric-hyphen.hh
lily/ledger-line-spanner.cc
lily/lyric-hyphen.cc
lily/main.cc
lily/percent-repeat-item.cc
lily/separating-group-spanner.cc
lily/spacing-determine-loose-columns.cc
scm/define-grobs.scm
scm/safe-lily.scm

index 374d6913d85993f8bd8e924c014929b2c8b2c906..9db33d90d167318db4a18df7f708c2a3f9c92bd8 100644 (file)
@@ -9,7 +9,6 @@
 
 #include "engraver.hh"
 
-
 #include "stream-event.hh"
 #include "item.hh"
 
index 03477d9ba4c80536fcb14efbf1959ab2b3f8777b..c450189fc011caf94b84d64e7fe95bf9025af1ee 100644 (file)
@@ -69,7 +69,7 @@ Balloon_interface::print (SCM smob)
   return fr.smobbed_copy ();
 }
 
-ADD_INTERFACE (Balloon_interface, "text-balloon-interface",
+ADD_INTERFACE (Balloon_interface, "balloon-interface",
               "A collection of routines to put text balloons around an object.",
 
               /* properties */
index 7a619878466201179b2920fb124a729d001f8c97..450286b84826056028db2a3f6e5c5f6ef88d4e2e 100644 (file)
@@ -111,7 +111,7 @@ Break_align_engraver::add_to_group (SCM align_name, Item *item)
 
       column_alist_ = scm_assoc_set_x (column_alist_, align_name, group->self_scm ());
 
-      Break_align_interface::add_element (align_, group);
+      Break_alignment_interface::add_element (align_, group);
     }
   Axis_group_interface::add_element (group, item);
 }
@@ -120,6 +120,8 @@ ADD_TRANSLATOR (Break_align_engraver,
                "Align grobs with corresponding @code{break-align-symbols} into "
                "groups, and order the groups according to @code{breakAlignOrder}. "
                "The left edge of the alignment gets a separate group, with a symbol @code{left-edge}. ",
-               /* create */ "BreakAlignment BreakAlignGroup LeftEdge",
+               /* create */ "BreakAlignment "
+               "BreakAlignGroup "
+               "LeftEdge ",
                /* read */ "",
                /* write */ "");
diff --git a/lily/break-align-interface.cc b/lily/break-align-interface.cc
deleted file mode 100644 (file)
index f78ea4e..0000000
+++ /dev/null
@@ -1,360 +0,0 @@
-/*
-  break-align-interface.cc -- implement Break_align_interface
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
-*/
-
-
-#include "break-align-interface.hh"
-
-#include "align-interface.hh"
-#include "axis-group-interface.hh"
-#include "dimensions.hh"
-#include "international.hh"
-#include "output-def.hh"
-#include "paper-column.hh"
-#include "pointer-group-interface.hh"
-#include "self-alignment-interface.hh"
-#include "side-position-interface.hh"
-#include "warn.hh"
-
-
-MAKE_SCHEME_CALLBACK (Break_align_interface, self_align_callback, 1);
-SCM
-Break_align_interface::self_align_callback (SCM smob)
-{
-  Grob *me = unsmob_grob (smob);
-
-  Item *item = dynamic_cast<Item *> (me);
-  Direction bsd = item->break_status_dir ();
-  if (bsd == LEFT)
-    me->set_property ("self-alignment-X", scm_from_int (RIGHT));
-
-  /*
-    Force break alignment itself to be done first, in the case
-  */
-  return Self_alignment_interface::aligned_on_self (me, X_AXIS);
-}
-
-/*
-  This is tricky: we cannot modify 'elements, since callers are
-  iterating the same list. Reordering the list in-place, or resetting
-  'elements will skip elements in the loops of callers.
-
-  So we return the correct order as an array.
-*/
-SCM
-Break_align_interface::break_align_order (Item *me)
-{
-  SCM order_vec = me->get_property ("break-align-orders");
-  if (!scm_is_vector (order_vec)
-      || scm_c_vector_length (order_vec) < 3)
-    return SCM_BOOL_F;
-
-  SCM order = scm_vector_ref (order_vec,
-                             scm_from_int (me->break_status_dir () + 1));
-
-
-  return order;
-}
-
-  
-vector<Grob*>
-Break_align_interface::ordered_elements (Grob *grob)
-{
-  Item *me = dynamic_cast<Item *> (grob);
-  extract_grob_set (me, "elements", elts);
-
-
-  SCM order = break_align_order (me);
-
-  if (order == SCM_BOOL_F)
-    return elts;
-  
-  vector<Grob*> writable_elts (elts);
-   /*
-    Copy in order specified in BREAK-ALIGN-ORDER.
-  */
-  vector<Grob*> new_elts;
-  for (; scm_is_pair (order); order = scm_cdr (order))
-    {
-      SCM sym = scm_car (order);
-
-      for (vsize i = writable_elts.size (); i--;)
-       {
-         Grob *g = writable_elts[i];
-         if (g && sym == g->get_property ("break-align-symbol"))
-           {
-             new_elts.push_back (g);
-             writable_elts.erase (writable_elts.begin () + i);
-           }
-       }
-    }
-
-  return new_elts;
-}
-
-void
-Break_align_interface::add_element (Grob *me, Grob *toadd)
-{
-  Align_interface::add_element (me, toadd);
-}
-
-MAKE_SCHEME_CALLBACK(Break_align_interface, calc_positioning_done, 1)
-SCM
-Break_align_interface::calc_positioning_done (SCM smob)
-{
-  Grob *grob = unsmob_grob (smob);  
-  Item *me = dynamic_cast<Item *> (grob);
-
-  vector<Grob*> elems = ordered_elements (me);
-  vector<Interval> extents;
-
-  int last_nonempty = -1;
-  for (vsize i = 0; i < elems.size (); i++)
-    {
-      Interval y = elems[i]->extent (elems[i], X_AXIS);
-      extents.push_back (y);
-      if (!y.is_empty ())
-       last_nonempty = i;
-    }
-
-  vsize idx = 0;
-  while (idx < extents.size () && extents[idx].is_empty ())
-    idx++;
-
-  vector<Real> offsets;
-  offsets.resize (elems.size ());
-  for (vsize i = 0; i < offsets.size ();i++)
-    offsets[i] = 0.0;
-
-  Real extra_right_space = 0.0;
-  vsize edge_idx = VPOS;
-  while (idx < elems.size ())
-    {
-      vsize next_idx = idx + 1;
-      while (next_idx < elems.size ()
-            && extents[next_idx].is_empty ())
-       next_idx++;
-
-      Grob *l = elems[idx];
-      Grob *r = 0;
-
-      if (next_idx < elems.size ())
-       r = elems[next_idx];
-
-      SCM alist = SCM_EOL;
-
-      /*
-       Find the first grob with a space-alist entry.
-      */
-      extract_grob_set (l, "elements", elts);
-
-      for (vsize i = elts.size (); i--;)
-       {
-         Grob *elt = elts[i];
-
-         if (edge_idx == VPOS
-             && (elt->get_property ("break-align-symbol")
-                 == ly_symbol2scm ("left-edge")))
-           edge_idx = idx;
-
-         SCM l = elt->get_property ("space-alist");
-         if (scm_is_pair (l))
-           {
-             alist = l;
-             break;
-           }
-       }
-
-      SCM rsym = r ? SCM_EOL : ly_symbol2scm ("right-edge");
-
-      /*
-       We used to use #'cause to find out the symbol and the spacing
-       table, but that gets icky when that grob is suicided for some
-       reason.
-      */
-      if (r)
-       {
-         extract_grob_set (r, "elements", elts);
-         for (vsize i = elts.size ();
-              !scm_is_symbol (rsym) && i--;)
-           {
-             Grob *elt = elts[i];
-             rsym = elt->get_property ("break-align-symbol");
-           }
-       }
-
-      if (rsym == ly_symbol2scm ("left-edge"))
-       edge_idx = next_idx;
-
-      SCM entry = SCM_EOL;
-      if (scm_is_symbol (rsym))
-       entry = scm_assq (rsym, alist);
-
-      bool entry_found = scm_is_pair (entry);
-      if (!entry_found)
-       {
-         string sym_string;
-         if (scm_is_symbol (rsym))
-           sym_string = ly_symbol2string (rsym);
-
-         string orig_string;
-         if (unsmob_grob (l->get_property ("cause")))
-           orig_string = unsmob_grob (l->get_property ("cause"))->name ();
-
-         programming_error (_f ("No spacing entry from %s to `%s'",
-                                orig_string.c_str (),
-                                sym_string.c_str ()));
-       }
-
-      Real distance = 1.0;
-      SCM type = ly_symbol2scm ("extra-space");
-
-      if (entry_found)
-       {
-         entry = scm_cdr (entry);
-
-         distance = scm_to_double (scm_cdr (entry));
-         type = scm_car (entry);
-       }
-
-      if (r)
-       {
-         if (type == ly_symbol2scm ("extra-space"))
-           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] = max (extents[idx][RIGHT], distance);
-       }
-      else
-       {
-         extra_right_space = distance;
-         if (idx < offsets.size() - 1)
-           offsets[idx+1] = extents[idx][RIGHT] + distance;
-       }
-
-      idx = next_idx;
-    }
-
-  Real here = 0.0;
-  Interval total_extent;
-
-  Real alignment_off = 0.0;
-  for (vsize i = 0; i < offsets.size (); i++)
-    {
-      here += offsets[i];
-      if (i == edge_idx)
-       alignment_off = -here;
-      total_extent.unite (extents[i] + here);
-    }
-
-  if (total_extent.is_empty ())
-    return SCM_BOOL_T;
-
-  if (me->break_status_dir () == LEFT)
-    alignment_off = -total_extent[RIGHT] - extra_right_space;
-  else if (edge_idx == VPOS)
-    alignment_off = -total_extent[LEFT];
-
-  here = alignment_off;
-  for (vsize i = 0; i < offsets.size (); i++)
-    {
-      here += offsets[i];
-      elems[i]->translate_axis (here, X_AXIS);
-    }
-
-  return SCM_BOOL_T;
-}
-
-ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
-              "Items that are aligned in prefatory matter.\n"
-              "\n"
-              "The spacing of these items is controlled by the @code{space-alist}\n"
-              "property. It contains a list @code{break-align-symbol}s 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 @code{first-note} and @code{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",
-
-              /* properties */ 
-              "break-align-symbol "
-              "space-alist "
-              );
-
-ADD_INTERFACE (Break_align_interface, "break-alignment-interface",
-              "The object that performs break aligment. See @ref{break-aligned-interface}.",
-
-              /* properties */
-              "positioning-done "
-              "break-align-orders");
-
-
-MAKE_SCHEME_CALLBACK(Break_alignment_align_interface, self_align_callback, 1)
-SCM
-Break_alignment_align_interface::self_align_callback (SCM grob)
-{
-  Grob *me = unsmob_grob (grob);
-  Item *alignment = dynamic_cast<Item*> (me->get_parent (X_AXIS));
-  if (!Break_align_interface::has_interface (alignment))
-    return scm_from_int (0);
-
-  SCM my_align = me->get_property ("break-align-symbol");
-  SCM order = Break_align_interface::break_align_order (alignment);
-
-  vector<Grob*> elements = Break_align_interface::ordered_elements (alignment);
-  if (elements.size () == 0)
-    return scm_from_int (0);
-  
-  int last_idx_found = -1;
-  vsize i = 0;
-  for (SCM s = order; scm_is_pair (s); s = scm_cdr (s))  
-    {
-      if (i < elements.size ()
-         && elements[i]->get_property ("break-align-symbol") == scm_car (s))
-       {
-         last_idx_found = i;
-         i ++;
-       }
-
-      if (scm_car (s) == my_align)
-       break ;
-    }  
-
-  Direction which_edge = LEFT;
-  if (vsize (last_idx_found + 1) < elements.size())
-    last_idx_found ++;
-  else
-    which_edge = RIGHT;
-  
-  Grob *common = me->common_refpoint (elements[last_idx_found], X_AXIS);
-
-  return scm_from_double (robust_relative_extent (elements[last_idx_found], common, X_AXIS)[which_edge]
-                         - me->relative_coordinate (common, X_AXIS));
-}
-
-ADD_INTERFACE (Break_alignment_align_interface, "break-alignment-align-interface",
-              "Object that is aligned on a break aligment. ",
-
-              /* properties */
-              "break-align-symbol "
-              )
-
-
diff --git a/lily/break-alignment-interface.cc b/lily/break-alignment-interface.cc
new file mode 100644 (file)
index 0000000..3ccd2aa
--- /dev/null
@@ -0,0 +1,361 @@
+/*
+  break-align-interface.cc -- implement Break_alignment_interface
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
+*/
+
+
+#include "break-align-interface.hh"
+
+#include "align-interface.hh"
+#include "axis-group-interface.hh"
+#include "dimensions.hh"
+#include "international.hh"
+#include "output-def.hh"
+#include "paper-column.hh"
+#include "pointer-group-interface.hh"
+#include "self-alignment-interface.hh"
+#include "side-position-interface.hh"
+#include "warn.hh"
+
+
+MAKE_SCHEME_CALLBACK (Break_alignment_interface, self_align_callback, 1);
+SCM
+Break_alignment_interface::self_align_callback (SCM smob)
+{
+  Grob *me = unsmob_grob (smob);
+
+  Item *item = dynamic_cast<Item *> (me);
+  Direction bsd = item->break_status_dir ();
+  if (bsd == LEFT)
+    me->set_property ("self-alignment-X", scm_from_int (RIGHT));
+
+  /*
+    Force break alignment itself to be done first, in the case
+  */
+  return Self_alignment_interface::aligned_on_self (me, X_AXIS);
+}
+
+/*
+  This is tricky: we cannot modify 'elements, since callers are
+  iterating the same list. Reordering the list in-place, or resetting
+  'elements will skip elements in the loops of callers.
+
+  So we return the correct order as an array.
+*/
+SCM
+Break_alignment_interface::break_align_order (Item *me)
+{
+  SCM order_vec = me->get_property ("break-align-orders");
+  if (!scm_is_vector (order_vec)
+      || scm_c_vector_length (order_vec) < 3)
+    return SCM_BOOL_F;
+
+  SCM order = scm_vector_ref (order_vec,
+                             scm_from_int (me->break_status_dir () + 1));
+
+
+  return order;
+}
+
+  
+vector<Grob*>
+Break_alignment_interface::ordered_elements (Grob *grob)
+{
+  Item *me = dynamic_cast<Item *> (grob);
+  extract_grob_set (me, "elements", elts);
+
+
+  SCM order = break_align_order (me);
+
+  if (order == SCM_BOOL_F)
+    return elts;
+  
+  vector<Grob*> writable_elts (elts);
+   /*
+    Copy in order specified in BREAK-ALIGN-ORDER.
+  */
+  vector<Grob*> new_elts;
+  for (; scm_is_pair (order); order = scm_cdr (order))
+    {
+      SCM sym = scm_car (order);
+
+      for (vsize i = writable_elts.size (); i--;)
+       {
+         Grob *g = writable_elts[i];
+         if (g && sym == g->get_property ("break-align-symbol"))
+           {
+             new_elts.push_back (g);
+             writable_elts.erase (writable_elts.begin () + i);
+           }
+       }
+    }
+
+  return new_elts;
+}
+
+void
+Break_alignment_interface::add_element (Grob *me, Grob *toadd)
+{
+  Align_interface::add_element (me, toadd);
+}
+
+MAKE_SCHEME_CALLBACK(Break_alignment_interface, calc_positioning_done, 1)
+SCM
+Break_alignment_interface::calc_positioning_done (SCM smob)
+{
+  Grob *grob = unsmob_grob (smob);  
+  Item *me = dynamic_cast<Item *> (grob);
+
+  vector<Grob*> elems = ordered_elements (me);
+  vector<Interval> extents;
+
+  int last_nonempty = -1;
+  for (vsize i = 0; i < elems.size (); i++)
+    {
+      Interval y = elems[i]->extent (elems[i], X_AXIS);
+      extents.push_back (y);
+      if (!y.is_empty ())
+       last_nonempty = i;
+    }
+
+  vsize idx = 0;
+  while (idx < extents.size () && extents[idx].is_empty ())
+    idx++;
+
+  vector<Real> offsets;
+  offsets.resize (elems.size ());
+  for (vsize i = 0; i < offsets.size ();i++)
+    offsets[i] = 0.0;
+
+  Real extra_right_space = 0.0;
+  vsize edge_idx = VPOS;
+  while (idx < elems.size ())
+    {
+      vsize next_idx = idx + 1;
+      while (next_idx < elems.size ()
+            && extents[next_idx].is_empty ())
+       next_idx++;
+
+      Grob *l = elems[idx];
+      Grob *r = 0;
+
+      if (next_idx < elems.size ())
+       r = elems[next_idx];
+
+      SCM alist = SCM_EOL;
+
+      /*
+       Find the first grob with a space-alist entry.
+      */
+      extract_grob_set (l, "elements", elts);
+
+      for (vsize i = elts.size (); i--;)
+       {
+         Grob *elt = elts[i];
+
+         if (edge_idx == VPOS
+             && (elt->get_property ("break-align-symbol")
+                 == ly_symbol2scm ("left-edge")))
+           edge_idx = idx;
+
+         SCM l = elt->get_property ("space-alist");
+         if (scm_is_pair (l))
+           {
+             alist = l;
+             break;
+           }
+       }
+
+      SCM rsym = r ? SCM_EOL : ly_symbol2scm ("right-edge");
+
+      /*
+       We used to use #'cause to find out the symbol and the spacing
+       table, but that gets icky when that grob is suicided for some
+       reason.
+      */
+      if (r)
+       {
+         extract_grob_set (r, "elements", elts);
+         for (vsize i = elts.size ();
+              !scm_is_symbol (rsym) && i--;)
+           {
+             Grob *elt = elts[i];
+             rsym = elt->get_property ("break-align-symbol");
+           }
+       }
+
+      if (rsym == ly_symbol2scm ("left-edge"))
+       edge_idx = next_idx;
+
+      SCM entry = SCM_EOL;
+      if (scm_is_symbol (rsym))
+       entry = scm_assq (rsym, alist);
+
+      bool entry_found = scm_is_pair (entry);
+      if (!entry_found)
+       {
+         string sym_string;
+         if (scm_is_symbol (rsym))
+           sym_string = ly_symbol2string (rsym);
+
+         string orig_string;
+         if (unsmob_grob (l->get_property ("cause")))
+           orig_string = unsmob_grob (l->get_property ("cause"))->name ();
+
+         programming_error (_f ("No spacing entry from %s to `%s'",
+                                orig_string.c_str (),
+                                sym_string.c_str ()));
+       }
+
+      Real distance = 1.0;
+      SCM type = ly_symbol2scm ("extra-space");
+
+      if (entry_found)
+       {
+         entry = scm_cdr (entry);
+
+         distance = scm_to_double (scm_cdr (entry));
+         type = scm_car (entry);
+       }
+
+      if (r)
+       {
+         if (type == ly_symbol2scm ("extra-space"))
+           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] = max (extents[idx][RIGHT], distance);
+       }
+      else
+       {
+         extra_right_space = distance;
+         if (idx < offsets.size() - 1)
+           offsets[idx+1] = extents[idx][RIGHT] + distance;
+       }
+
+      idx = next_idx;
+    }
+
+  Real here = 0.0;
+  Interval total_extent;
+
+  Real alignment_off = 0.0;
+  for (vsize i = 0; i < offsets.size (); i++)
+    {
+      here += offsets[i];
+      if (i == edge_idx)
+       alignment_off = -here;
+      total_extent.unite (extents[i] + here);
+    }
+
+  if (total_extent.is_empty ())
+    return SCM_BOOL_T;
+
+  if (me->break_status_dir () == LEFT)
+    alignment_off = -total_extent[RIGHT] - extra_right_space;
+  else if (edge_idx == VPOS)
+    alignment_off = -total_extent[LEFT];
+
+  here = alignment_off;
+  for (vsize i = 0; i < offsets.size (); i++)
+    {
+      here += offsets[i];
+      elems[i]->translate_axis (here, X_AXIS);
+    }
+
+  return SCM_BOOL_T;
+}
+
+
+
+MAKE_SCHEME_CALLBACK(Break_alignable_interface, self_align_callback, 1)
+SCM
+Break_alignable_interface::self_align_callback (SCM grob)
+{
+  Grob *me = unsmob_grob (grob);
+  Item *alignment = dynamic_cast<Item*> (me->get_parent (X_AXIS));
+  if (!Break_alignment_interface::has_interface (alignment))
+    return scm_from_int (0);
+
+  SCM my_align = me->get_property ("break-align-symbol");
+  SCM order = Break_alignment_interface::break_align_order (alignment);
+
+  vector<Grob*> elements = Break_alignment_interface::ordered_elements (alignment);
+  if (elements.size () == 0)
+    return scm_from_int (0);
+  
+  int last_idx_found = -1;
+  vsize i = 0;
+  for (SCM s = order; scm_is_pair (s); s = scm_cdr (s))  
+    {
+      if (i < elements.size ()
+         && elements[i]->get_property ("break-align-symbol") == scm_car (s))
+       {
+         last_idx_found = i;
+         i ++;
+       }
+
+      if (scm_car (s) == my_align)
+       break ;
+    }  
+
+  Direction which_edge = LEFT;
+  if (vsize (last_idx_found + 1) < elements.size())
+    last_idx_found ++;
+  else
+    which_edge = RIGHT;
+  
+  Grob *common = me->common_refpoint (elements[last_idx_found], X_AXIS);
+
+  return scm_from_double (robust_relative_extent (elements[last_idx_found], common, X_AXIS)[which_edge]
+                         - me->relative_coordinate (common, X_AXIS));
+}
+
+ADD_INTERFACE (Break_alignable_interface, "break-alignable-interface",
+              "Object that is aligned on a break aligment. ",
+
+              /* properties */
+              "break-align-symbol "
+              )
+
+
+
+ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
+              "Items that are aligned in prefatory matter.\n"
+              "\n"
+              "The spacing of these items is controlled by the @code{space-alist}\n"
+              "property. It contains a list @code{break-align-symbol}s 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 @code{first-note} and @code{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",
+
+              /* properties */ 
+              "break-align-symbol "
+              "space-alist "
+              );
+
+ADD_INTERFACE (Break_alignment_interface, "break-alignment-interface",
+              "The object that performs break aligment. See @ref{break-aligned-interface}.",
+
+              /* properties */
+              "positioning-done "
+              "break-align-orders");
index 9d52d4a56a435f40b0eaacdfa643d00e27b6a872..bd753f80c6f62fb6202213ed0d36c2b871455347 100644 (file)
 #include "international.hh"
 #include "protected-scm.hh"
 #include "std-string.hh"
+#include "string-convert.hh"
 #include "warn.hh"
+#include "misc.hh"
 
-void add_interface (char const *symbol,
+void add_interface (char const *cxx_name,
+                   char const *symbol,
                    char const *descr,
                    char const *vars)
 {
+  string suffix ("-interface");
+  string lispy_name = camel_case_to_lisp_identifier (cxx_name);
+  vsize end = max (int (0), int (lispy_name.length () - suffix.length ()));
+  if (lispy_name.substr (end) != suffix)
+    lispy_name += suffix;
+
+  if (lispy_name != string (symbol))
+    programming_error (String_convert::form_string ("%s != %s", lispy_name.c_str (),
+                                                   symbol));
+    
   SCM s = ly_symbol2scm (symbol);
   SCM d = scm_makfrom0str (descr);
   SCM l = parse_symbol_list (vars);
index 1515e8fea21ef25f1bd9de571d0a907dd51685cb..9e23d2b820e6238506c00cd194fdcde1da535135 100644 (file)
@@ -153,7 +153,7 @@ Hara_kiri_group_spanner::add_interesting_item (Grob *me, Grob *n)
   Pointer_group_interface::add_unordered_grob (me, ly_symbol2scm ("items-worth-living"), n);
 }
 
-ADD_INTERFACE (Hara_kiri_group_spanner, "hara-kiri-group-interface",
+ADD_INTERFACE (Hara_kiri_group_spanner, "hara-kiri-group-spanner-interface",
               "A group spanner that  keeps track of interesting items.  If it "
               "doesn't contain any after linebreaking, then it "
               "will remove itself and all its children.",
index 41972c83a5ee1e7f5b2c5d7708ab5de614e54b09..5319c75b439998081bf2818cf0f1b4a43d4ce195 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  break-align-interface.hh -- declare Break_align_interface
+  break-align-interface.hh -- declare Break_alignment_interface
 
   source file of the GNU LilyPond music typesetter
 
@@ -11,7 +11,7 @@
 
 #include "item.hh"
 
-class Break_align_interface
+class Break_alignment_interface
 {
 public:
   static vector<Grob*> ordered_elements (Grob *me);
@@ -27,7 +27,7 @@ struct Break_aligned_interface
   static bool has_interface (Grob *);
 };
 
-struct Break_alignment_align_interface
+struct Break_alignable_interface
 {
   DECLARE_SCHEME_CALLBACK (self_align_callback, (SCM element));
   static bool has_interface (Grob *);
index e28716cb6688dd77edcf1fda2ac9cb7cdaa23383..29cf625874f7ccd4c1d0edd4b37b7f64d993e998 100644 (file)
   }                                                            \
   void cl ## _init_ifaces ()                                   \
   {                                                            \
-    add_interface (a, b, c);                                   \
+    add_interface (#cl, a, b, c);                              \
   }                                                            \
   ADD_SCM_INIT_FUNC (cl ## ifaces, cl ## _init_ifaces);
 
-void add_interface (char const *symbol,
+void add_interface (char const *cxx_name,
+                   char const *symbol,
                    char const *descr,
                    char const *vars);
 
index 00d87adda44ef06e81712f884d7e23309246189b..d842a389e9cc4b6be5585c7af15d9d8c28749095 100644 (file)
@@ -9,7 +9,7 @@
 
 #include "spanner.hh"
 
-struct Hyphen_spanner
+struct Lyric_hyphen
 {
 public:
   DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM));
index bf7444dea0ec73b0a08b9841ffbe691c825c2128..1817b49be9832b83293808278b0c32f236e15378 100644 (file)
@@ -352,18 +352,19 @@ Ledger_line_spanner::print (SCM smob)
 }
 
 ADD_INTERFACE (Ledger_line_spanner,
-              "ledger-line-interface",
+              "ledger-line-spanner-interface",
 
               "This spanner draws the ledger lines of a staff.\n"
               "This is a separate grob because it has to process\n"
               "all potential collisions between all note heads.",
 
               /* properties */
+              "gap "   
+              "length-fraction "       
+              "minimum-length-fraction "
               "note-heads "
               "thickness "
-              "minimum-length-fraction "
-              "length-fraction "
-              "gap");
+              );
 
 struct Ledgered_interface
 {
@@ -374,6 +375,6 @@ ADD_INTERFACE (Ledgered_interface,
               "ledgered-interface",
 
               "Objects that need ledger lines, typically "
-              "note heads. See also @ref{ledger-line-interface}.",
+              "note heads. See also @ref{ledger-line-spanner-interface}.",
 
               "no-ledgers");
index 66bf1b8523aeaced79b539125f53e47625585f8f..b6636477c508e7b05f6e19792c1e5cb7deb8b668 100644 (file)
@@ -1,5 +1,5 @@
 /*
-  hyphen-spanner.cc -- implement Hyphen_spanner
+  hyphen-spanner.cc -- implement Lyric_hyphen
 
   source file of the GNU LilyPond music typesetter
 
@@ -19,9 +19,9 @@
   font.
  */
 
-MAKE_SCHEME_CALLBACK (Hyphen_spanner, print, 1);
+MAKE_SCHEME_CALLBACK (Lyric_hyphen, print, 1);
 SCM
-Hyphen_spanner::print (SCM smob)
+Lyric_hyphen::print (SCM smob)
 {
   Spanner *me = unsmob_spanner (smob);
   Drul_array<Item *> bounds (me->get_bound (LEFT),
@@ -102,9 +102,9 @@ Hyphen_spanner::print (SCM smob)
   return total.smobbed_copy ();
 }
 
-MAKE_SCHEME_CALLBACK (Hyphen_spanner, set_spacing_rods, 1);
+MAKE_SCHEME_CALLBACK (Lyric_hyphen, set_spacing_rods, 1);
 SCM
-Hyphen_spanner::set_spacing_rods (SCM smob)
+Lyric_hyphen::set_spacing_rods (SCM smob)
 {
   Grob *me = unsmob_grob (smob);
 
@@ -128,7 +128,7 @@ Hyphen_spanner::set_spacing_rods (SCM smob)
   return SCM_UNSPECIFIED;
 }
 
-ADD_INTERFACE (Hyphen_spanner,
+ADD_INTERFACE (Lyric_hyphen,
 
               "lyric-hyphen-interface",
               
index 4e72121d122c8546a0c94f93ab6094bd31ece499..0e8a1e580dd3aecfaf48ad99a9e14ffd366f0818 100644 (file)
@@ -628,6 +628,7 @@ main (int argc, char **argv)
   setup_paths (argv[0]);
   setup_guile_env ();
 
+#if 0
   /* Debugging aid.  */
   try
     {
@@ -637,7 +638,10 @@ main (int argc, char **argv)
     {
       error (_f ("exception caught: %s", e.what ()));
     };
-
+#else
+  scm_boot_guile (argc, argv, main_with_guile, 0);
+#endif
+       
   /* Only reachable if GUILE exits.  That is an error.  */
   return 1;
 }
index 691ad5dbae328680d65f4e1dc4396d91b8522ba7..a80015d396456354f68e0c6d3cebdc8eddcc488f 100644 (file)
@@ -71,7 +71,9 @@ Percent_repeat_item_interface::beat_slash (SCM grob)
   return m.smobbed_copy ();
 }
 
-ADD_INTERFACE (Percent_repeat_item_interface, "percent-repeat-interface",
+ADD_INTERFACE (Percent_repeat_item_interface, "percent-repeat-item-interface",
               "Repeats that look like percent signs",
-              "slope thickness");
+              
+              "slope "
+              "thickness ");
 
index 14e457b6ef047a3caf2bb245d44210e44aa79b18..c905b430e78a3326be8148ac78adcf5d1fa3e039 100644 (file)
@@ -109,7 +109,7 @@ Separating_group_spanner::add_spacing_unit (Grob *me, Item *i)
   Pointer_group_interface::add_unordered_grob (me, ly_symbol2scm ("elements"), i);
 }
 
-ADD_INTERFACE (Separating_group_spanner, "separation-spanner-interface",
+ADD_INTERFACE (Separating_group_spanner, "separating-group-spanner-interface",
               "A spanner that calculates spacing constraints (\"rods\") "
               "using the @code{separation-item-interface} grobs in @code{elements}.",
 
index 8cd0b9b6a01e48d0a7980d6a5f2818c15ce8b158..51bbf247874bde620727e55c418ccd108fc2b52f 100644 (file)
@@ -105,7 +105,7 @@ is_loose_column (Grob *l, Grob *col, Grob *r, Spacing_options const *options)
   for (vsize i = elts.size (); i--;)
     {
       Grob *g = elts[i];
-      if (g && Break_align_interface::has_interface (g))
+      if (g && Break_alignment_interface::has_interface (g))
        {
          extract_grob_set (g, "elements", gelts);
          for (vsize j = gelts.size (); j--;)
index 5e2dd4d86c14ea0572aadc11d7d5ae6a9e2f28b1..5e9910276107d97093f0766463db8b7a16506fe6 100644 (file)
        (X-offset . ,(ly:make-simple-closure
                      `(,+
                        ,(ly:make-simple-closure
-                         (list ly:break-alignment-align-interface::self-align-callback))
+                         (list ly:break-alignable-interface::self-align-callback))
                        ,(ly:make-simple-closure
                          (list ly:self-alignment-interface::x-aligned-on-self)))))
 
              ((class . Item)
               (interfaces . (side-position-interface
                              text-interface
-                             break-alignment-align-interface
+                             break-alignable-interface
                              self-alignment-interface
                              font-interface
                              ))))
      . (
        (non-musical . #t)
        (stacking-dir . 1)
-       (positioning-done . ,ly:break-align-interface::calc-positioning-done)
+       (positioning-done . ,ly:break-alignment-interface::calc-positioning-done)
        (X-extent . ,ly:axis-group-interface::width)
        (break-align-orders . ;; end of line
                            #((
        (meta . ((class . Item)
                 (interfaces . (font-interface
                                break-aligned-interface
-                               percent-repeat-interface))))))
+                               percent-repeat-item-interface))))))
 
     (DoublePercentRepeatCounter
      . (
        (meta . ((class . Item)
                 (interfaces . (side-position-interface
                                self-alignment-interface
-                               percent-repeat-interface
+                               percent-repeat-item-interface
                                font-interface
                                text-interface))))))
     (DynamicLineSpanner
        (length-fraction . 0.25)
        (layer . 0)
        (meta . ((class . Spanner)
-                (interfaces . (ledger-line-interface))))))
+                (interfaces . (ledger-line-spanner-interface))))))
 
     (LeftEdge
      . (
        (minimum-length . 0.3)
        (minimum-distance . 0.1)
        (padding . 0.07)
-       (springs-and-rods . ,ly:hyphen-spanner::set-spacing-rods)
-       (stencil . ,ly:hyphen-spanner::print)
+       (springs-and-rods . ,ly:lyric-hyphen::set-spacing-rods)
+       (stencil . ,ly:lyric-hyphen::print)
        (Y-extent . (0 . 0))
        (meta . ((class . Spanner)
                 (interfaces . (lyric-interface
 
     (LyricSpace
      . ((minimum-distance . 0.45)
-       (springs-and-rods . ,ly:hyphen-spanner::set-spacing-rods)
+       (springs-and-rods . ,ly:lyric-hyphen::set-spacing-rods)
        (padding . 0.0)
        (Y-extent . #f)
        (X-extent . #f)
        (meta . ((class . Spanner)
                 (interfaces . (multi-measure-rest-interface
                                font-interface
-                               percent-repeat-interface))))))
+                               percent-repeat-item-interface))))))
     (PercentRepeatCounter
      . (
        (stencil . ,ly:text-interface::print)
        (meta . ((class . Spanner)
                 (interfaces . (side-position-interface
                                self-alignment-interface
-                               percent-repeat-interface
+                               percent-repeat-item-interface
                                font-interface
                                text-interface))))))
 
        (X-offset . ,(ly:make-simple-closure
                      `(,+
                        ,(ly:make-simple-closure
-                         (list ly:break-alignment-align-interface::self-align-callback))
+                         (list ly:break-alignable-interface::self-align-callback))
                        ,(ly:make-simple-closure
                          (list ly:self-alignment-interface::x-aligned-on-self)))))
 
        (meta . ((class . Item)
                 (interfaces . (text-interface
                                side-position-interface
-                               break-alignment-align-interface
+                               break-alignable-interface
                                font-interface
                                mark-interface
                                self-alignment-interface))))))
        (thickness . 0.48)
        (slope . 1.7)
        (meta . ((class . Item)
-                (interfaces . (percent-repeat-interface))))))
+                (interfaces . (percent-repeat-item-interface))))))
 
     (RepeatTie
      . (
        (meta . ((class . Spanner)
                 (interfaces . (only-prebreak-interface
                                spacing-interface
-                               separation-spanner-interface))))))
+                               separating-group-spanner-interface))))))
 
     (Slur
      . ((details . ,default-slur-details)
        (skyline-spacing . #t)
        (meta . ((class . Spanner)
                 (interfaces . (axis-group-interface
-                               hara-kiri-group-interface
+                               hara-kiri-group-spanner-interface
                                vertically-spaceable-interface))))))
 
 
index 31161e25cf0ff78491ff0448e8196eac5f42c6d0..370bfea2a8dcb78ef84060c0c59390a0a6d6d562 100644 (file)
    ly:hara-kiri-group-spanner::force-hara-kiri-callback
    ly:hara-kiri-group-spanner::y-extent
    ly:horizontal-bracket::print
-   ly:hyphen-spanner::print
-   ly:hyphen-spanner::set-spacing-rods
+   ly:lyric-hyphen::print
+   ly:lyric-hyphen::set-spacing-rods
    ly:key-signature-interface::print
    ly:line-spanner::print
    ly:lyric-extender::print