From 9b1d3ef007ba18e54dd46b38b835c6ec59140aa3 Mon Sep 17 00:00:00 2001 From: Han-Wen Nienhuys Date: Sat, 21 Oct 2006 10:45:15 +0000 Subject: [PATCH] * scm/define-grobs.scm (all-grob-descriptions): calc connect-to-neighbor * lily/horizontal-bracket.cc (make_bracket): support connect-to-neighbor. --- ChangeLog | 6 ++++++ lily/horizontal-bracket.cc | 33 +++++++++++++++++++++++++++++++-- lily/include/translator.icc | 4 ++++ lily/tuplet-bracket.cc | 3 +-- scm/define-grobs.scm | 2 ++ 5 files changed, 44 insertions(+), 4 deletions(-) diff --git a/ChangeLog b/ChangeLog index 986174f39f..94a092ed80 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,11 @@ 2006-10-21 Han-Wen Nienhuys + * scm/define-grobs.scm (all-grob-descriptions): calc + connect-to-neighbor + + * lily/horizontal-bracket.cc (make_bracket): support + connect-to-neighbor. + * lily/ttf.cc (make_index_to_charcode_map): remove debugging gobs. * VERSION (PACKAGE_NAME): release 2.9.26 diff --git a/lily/horizontal-bracket.cc b/lily/horizontal-bracket.cc index 80baa95de5..00dd0b653f 100644 --- a/lily/horizontal-bracket.cc +++ b/lily/horizontal-bracket.cc @@ -30,6 +30,7 @@ Horizontal_bracket::make_bracket (Grob *me, Drul_array shorten = robust_scm2interval (me->get_property ("shorten-pair"), Interval (0, 0)); + // Make sure that it points in the correct direction: scale_drul (&edge_height, Real (-dir)); @@ -37,6 +38,22 @@ Horizontal_bracket::make_bracket (Grob *me, Offset start; start[a] = length; + Drul_array connect_to_other = + robust_scm2booldrul (me->get_property ("connect-to-neighbor"), + Drul_array (false, false)); + + Direction d = LEFT; + do + { + if (connect_to_other[d]) + { + edge_height[d] = 0.0; + flare[d] = 0.0; + shorten[d] = 0.0; + } + } + while (flip (&d) != LEFT); + /* ugh, Tuplet_bracket should use Horizontal_bracket, not the other way around. */ @@ -70,15 +87,26 @@ MAKE_SCHEME_CALLBACK (Horizontal_bracket, print, 1); SCM Horizontal_bracket::print (SCM smob) { - Grob *me = unsmob_grob (smob); + Spanner *me = unsmob_spanner (smob); extract_grob_set (me, "columns", gs); + + vector enclosed = gs; if (!gs.size ()) { me->suicide (); return SCM_EOL; } - Stencil b = make_enclosing_bracket (me, me, gs, X_AXIS, get_grob_direction (me)); + Direction d = LEFT; + do + { + Item *b = me->get_bound (d); + if (b->break_status_dir ()) + enclosed.push_back (b); + } + while (flip (&d) != LEFT); + + Stencil b = make_enclosing_bracket (me, me, enclosed, X_AXIS, get_grob_direction (me)); return b.smobbed_copy (); } @@ -92,5 +120,6 @@ ADD_INTERFACE (Horizontal_bracket, "columns " "edge-height " "shorten-pair " + "connect-to-neighbor " ); diff --git a/lily/include/translator.icc b/lily/include/translator.icc index bf9e9be8d5..6eb9e10405 100644 --- a/lily/include/translator.icc +++ b/lily/include/translator.icc @@ -13,6 +13,10 @@ #include "std-vector.hh" #include "translator.hh" +/* + TODO: derive "foo-bar-interface" from Foo_bar classname. + */ + /** A macro to automate administration of translators. */ diff --git a/lily/tuplet-bracket.cc b/lily/tuplet-bracket.cc index 68852c8353..a5f8b6c242 100644 --- a/lily/tuplet-bracket.cc +++ b/lily/tuplet-bracket.cc @@ -420,8 +420,7 @@ Tuplet_bracket::make_bracket (Grob *me, // for line properties. Direction d = LEFT; do straight_corners[d] += -d * shorten[d] / length * dz; - while (flip (&d) != LEFT) - ; + while (flip (&d) != LEFT); if (gap.is_empty ()) gap = Interval (0, 0); diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 6899237dc3..99492119c7 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -718,6 +718,8 @@ (thickness . 1.0) (stencil . ,ly:horizontal-bracket::print) (Y-offset . ,ly:side-position-interface::y-aligned-side) + (connect-to-neighbor . ,ly:tuplet-bracket::calc-connect-to-neighbors) + (padding . 0.2) (staff-padding . 0.2) (direction . ,DOWN) -- 2.39.2