From: Han-Wen Nienhuys Date: Wed, 29 Nov 2006 14:18:10 +0000 (+0100) Subject: uniformize grob interface naming with C++. X-Git-Tag: release/2.11.1-1~43 X-Git-Url: https://git.donarmstrong.com/lilypond.git?a=commitdiff_plain;h=a9c0c06eca7cf482bd550be17e4a4dbdfc7cc22a;p=lilypond.git uniformize grob interface naming with C++. --- diff --git a/lily/balloon-engraver.cc b/lily/balloon-engraver.cc index 374d6913d8..9db33d90d1 100644 --- a/lily/balloon-engraver.cc +++ b/lily/balloon-engraver.cc @@ -9,7 +9,6 @@ #include "engraver.hh" - #include "stream-event.hh" #include "item.hh" diff --git a/lily/balloon.cc b/lily/balloon.cc index 03477d9ba4..c450189fc0 100644 --- a/lily/balloon.cc +++ b/lily/balloon.cc @@ -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 */ diff --git a/lily/break-align-engraver.cc b/lily/break-align-engraver.cc index 7a61987846..450286b848 100644 --- a/lily/break-align-engraver.cc +++ b/lily/break-align-engraver.cc @@ -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 index f78ea4ef48..0000000000 --- a/lily/break-align-interface.cc +++ /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 -*/ - - -#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 (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 -Break_align_interface::ordered_elements (Grob *grob) -{ - Item *me = dynamic_cast (grob); - extract_grob_set (me, "elements", elts); - - - SCM order = break_align_order (me); - - if (order == SCM_BOOL_F) - return elts; - - vector writable_elts (elts); - /* - Copy in order specified in BREAK-ALIGN-ORDER. - */ - vector 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 (grob); - - vector elems = ordered_elements (me); - vector 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 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 (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 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 index 0000000000..3ccd2aa125 --- /dev/null +++ b/lily/break-alignment-interface.cc @@ -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 +*/ + + +#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 (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 +Break_alignment_interface::ordered_elements (Grob *grob) +{ + Item *me = dynamic_cast (grob); + extract_grob_set (me, "elements", elts); + + + SCM order = break_align_order (me); + + if (order == SCM_BOOL_F) + return elts; + + vector writable_elts (elts); + /* + Copy in order specified in BREAK-ALIGN-ORDER. + */ + vector 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 (grob); + + vector elems = ordered_elements (me); + vector 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 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 (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 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"); diff --git a/lily/grob-interface.cc b/lily/grob-interface.cc index 9d52d4a56a..bd753f80c6 100644 --- a/lily/grob-interface.cc +++ b/lily/grob-interface.cc @@ -12,12 +12,25 @@ #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); diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index 1515e8fea2..9e23d2b820 100644 --- a/lily/hara-kiri-group-spanner.cc +++ b/lily/hara-kiri-group-spanner.cc @@ -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.", diff --git a/lily/include/break-align-interface.hh b/lily/include/break-align-interface.hh index 41972c83a5..5319c75b43 100644 --- a/lily/include/break-align-interface.hh +++ b/lily/include/break-align-interface.hh @@ -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 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 *); diff --git a/lily/include/grob-interface.hh b/lily/include/grob-interface.hh index e28716cb66..29cf625874 100644 --- a/lily/include/grob-interface.hh +++ b/lily/include/grob-interface.hh @@ -18,11 +18,12 @@ } \ 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); diff --git a/lily/include/lyric-hyphen.hh b/lily/include/lyric-hyphen.hh index 00d87adda4..d842a389e9 100644 --- a/lily/include/lyric-hyphen.hh +++ b/lily/include/lyric-hyphen.hh @@ -9,7 +9,7 @@ #include "spanner.hh" -struct Hyphen_spanner +struct Lyric_hyphen { public: DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM)); diff --git a/lily/ledger-line-spanner.cc b/lily/ledger-line-spanner.cc index bf7444dea0..1817b49be9 100644 --- a/lily/ledger-line-spanner.cc +++ b/lily/ledger-line-spanner.cc @@ -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"); diff --git a/lily/lyric-hyphen.cc b/lily/lyric-hyphen.cc index 66bf1b8523..b6636477c5 100644 --- a/lily/lyric-hyphen.cc +++ b/lily/lyric-hyphen.cc @@ -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 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", diff --git a/lily/main.cc b/lily/main.cc index 4e72121d12..0e8a1e580d 100644 --- a/lily/main.cc +++ b/lily/main.cc @@ -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; } diff --git a/lily/percent-repeat-item.cc b/lily/percent-repeat-item.cc index 691ad5dbae..a80015d396 100644 --- a/lily/percent-repeat-item.cc +++ b/lily/percent-repeat-item.cc @@ -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 "); diff --git a/lily/separating-group-spanner.cc b/lily/separating-group-spanner.cc index 14e457b6ef..c905b430e7 100644 --- a/lily/separating-group-spanner.cc +++ b/lily/separating-group-spanner.cc @@ -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}.", diff --git a/lily/spacing-determine-loose-columns.cc b/lily/spacing-determine-loose-columns.cc index 8cd0b9b6a0..51bbf24787 100644 --- a/lily/spacing-determine-loose-columns.cc +++ b/lily/spacing-determine-loose-columns.cc @@ -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--;) diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 5e2dd4d86c..5e99102761 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -204,7 +204,7 @@ (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))))) @@ -216,7 +216,7 @@ ((class . Item) (interfaces . (side-position-interface text-interface - break-alignment-align-interface + break-alignable-interface self-alignment-interface font-interface )))) @@ -344,7 +344,7 @@ . ( (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 #(( @@ -543,7 +543,7 @@ (meta . ((class . Item) (interfaces . (font-interface break-aligned-interface - percent-repeat-interface)))))) + percent-repeat-item-interface)))))) (DoublePercentRepeatCounter . ( @@ -561,7 +561,7 @@ (meta . ((class . Item) (interfaces . (side-position-interface self-alignment-interface - percent-repeat-interface + percent-repeat-item-interface font-interface text-interface)))))) (DynamicLineSpanner @@ -845,7 +845,7 @@ (length-fraction . 0.25) (layer . 0) (meta . ((class . Spanner) - (interfaces . (ledger-line-interface)))))) + (interfaces . (ledger-line-spanner-interface)))))) (LeftEdge . ( @@ -907,8 +907,8 @@ (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 @@ -918,7 +918,7 @@ (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) @@ -1213,7 +1213,7 @@ (meta . ((class . Spanner) (interfaces . (multi-measure-rest-interface font-interface - percent-repeat-interface)))))) + percent-repeat-item-interface)))))) (PercentRepeatCounter . ( (stencil . ,ly:text-interface::print) @@ -1230,7 +1230,7 @@ (meta . ((class . Spanner) (interfaces . (side-position-interface self-alignment-interface - percent-repeat-interface + percent-repeat-item-interface font-interface text-interface)))))) @@ -1256,7 +1256,7 @@ (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))))) @@ -1272,7 +1272,7 @@ (meta . ((class . Item) (interfaces . (text-interface side-position-interface - break-alignment-align-interface + break-alignable-interface font-interface mark-interface self-alignment-interface)))))) @@ -1283,7 +1283,7 @@ (thickness . 0.48) (slope . 1.7) (meta . ((class . Item) - (interfaces . (percent-repeat-interface)))))) + (interfaces . (percent-repeat-item-interface)))))) (RepeatTie . ( @@ -1379,7 +1379,7 @@ (meta . ((class . Spanner) (interfaces . (only-prebreak-interface spacing-interface - separation-spanner-interface)))))) + separating-group-spanner-interface)))))) (Slur . ((details . ,default-slur-details) @@ -1971,7 +1971,7 @@ (skyline-spacing . #t) (meta . ((class . Spanner) (interfaces . (axis-group-interface - hara-kiri-group-interface + hara-kiri-group-spanner-interface vertically-spaceable-interface)))))) diff --git a/scm/safe-lily.scm b/scm/safe-lily.scm index 31161e25cf..370bfea2a8 100644 --- a/scm/safe-lily.scm +++ b/scm/safe-lily.scm @@ -161,8 +161,8 @@ 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