From: Joe Neeman Date: Mon, 1 Oct 2007 08:26:44 +0000 (+1000) Subject: Fix 482. X-Git-Tag: release/2.11.34-1~1 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=2b96d015bca6fe23fb7ee4b68dad1cd41c97ec2e;p=lilypond.git Fix 482. --- diff --git a/lily/bar-line.cc b/lily/bar-line.cc index 369e3d779d..800c138c93 100644 --- a/lily/bar-line.cc +++ b/lily/bar-line.cc @@ -16,17 +16,25 @@ #include "staff-symbol-referencer.hh" #include "line-interface.hh" -/* Get the extent of just the line part of the bar (ie. excluding any - repeat dots) */ -Interval -Bar_line::bar_y_extent (Grob *me, Grob *refpoint) +MAKE_SCHEME_CALLBACK (Bar_line, calc_bar_extent, 1) +SCM +Bar_line::calc_bar_extent (SCM smob) { + Grob *me = unsmob_grob (smob); + SCM size = me->get_property ("bar-size"); + if (!scm_is_number (size)) - return Interval (); + return ly_interval2scm (Interval ()); Real h = scm_to_double (size); - Interval iv (-h/2, h/2); + return ly_interval2scm (Interval (-h/2, h/2)); +} + +Interval +Bar_line::bar_y_extent (Grob *me, Grob *refpoint) +{ + Interval iv = robust_scm2interval (me->get_property ("bar-extent"), Interval ()); iv.translate (me->relative_coordinate (refpoint, Y_AXIS)); return iv; @@ -317,6 +325,7 @@ ADD_INTERFACE (Bar_line, "glyph " "glyph-name " "bar-size " + "bar-extent " ); diff --git a/lily/include/bar-line.hh b/lily/include/bar-line.hh index ce22353c8d..ea9833bc34 100644 --- a/lily/include/bar-line.hh +++ b/lily/include/bar-line.hh @@ -19,6 +19,7 @@ public: static Stencil compound_barline (Grob *, string, Real height, bool rounded); static Stencil simple_barline (Grob *, Real wid, Real height, bool rounded); static Interval bar_y_extent (Grob *, Grob *); + DECLARE_SCHEME_CALLBACK (calc_bar_extent, (SCM)); DECLARE_SCHEME_CALLBACK (calc_bar_size, (SCM)); DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (calc_anchor, (SCM)); diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index 0b38ad9e5c..07d52c4161 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -604,6 +604,9 @@ function is to protect objects from being garbage collected.") (axis-group-parent-X ,ly:grob? "Containing X@tie{}axis group.") (axis-group-parent-Y ,ly:grob? "Containing Y@tie{}axis group.") + (bar-extent ,number-pair? "The Y-extent of the actual barline. +This may differ from 'Y-extent because it does not include the dots in +a repeat barline.") (bars ,ly:grob-array? "A list of bar line pointers.") (beam ,ly:grob? "A pointer to the beam, if applicable.") (bounded-by-me ,ly:grob-array? "A list of spanners that have this diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index ccbf965fcb..4609a7ca58 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -184,6 +184,7 @@ (stencil . ,ly:bar-line::print) (glyph-name . ,bar-line::calc-glyph-name) (bar-size . ,ly:bar-line::calc-bar-size) + (bar-extent . ,ly:bar-line::calc-bar-extent) (allow-span-bar . #t) (space-alist . ( @@ -1529,9 +1530,11 @@ (non-musical . #t) (stencil . ,ly:span-bar::print) (bar-size . ,ly:span-bar::calc-bar-size) + (bar-extent . ,ly:axis-group-interface::height) (X-extent . ,ly:span-bar::width) (glyph-name . ,ly:span-bar::calc-glyph-name) (before-line-breaking . ,ly:span-bar::before-line-breaking) + (allow-span-bar . #t) ;; ugh duplication!