X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Ffigured-bass-continuation.cc;h=fcfddb94e6f4654ff48e3624e99b2da618792208;hb=5b4b0d6e9a197e8f9eb085b7c2ad78b8be3e5cfc;hp=1969cf30d557be06ca99f3af942d8dd7168d0fe2;hpb=95007e0bdb368a9eb77e241e9952cb3a8651633d;p=lilypond.git diff --git a/lily/figured-bass-continuation.cc b/lily/figured-bass-continuation.cc index 1969cf30d5..fcfddb94e6 100644 --- a/lily/figured-bass-continuation.cc +++ b/lily/figured-bass-continuation.cc @@ -3,12 +3,11 @@ source file of the GNU LilyPond music typesetter - (c) 2005 Han-Wen Nienhuys + (c) 2005--2008 Han-Wen Nienhuys */ #include "line-interface.hh" -#include "lily-guile.hh" #include "spanner.hh" #include "output-def.hh" #include "item.hh" @@ -21,25 +20,26 @@ struct Figured_bass_continuation { - static bool has_interface (Grob*); + DECLARE_GROB_INTERFACE (); public: - DECLARE_SCHEME_CALLBACK(print, (SCM)); - DECLARE_SCHEME_CALLBACK(center_on_figures, (SCM, SCM)); + DECLARE_SCHEME_CALLBACK (print, (SCM)); + DECLARE_SCHEME_CALLBACK (center_on_figures, (SCM)); }; -MAKE_SCHEME_CALLBACK (Figured_bass_continuation, center_on_figures, 2); +MAKE_SCHEME_CALLBACK (Figured_bass_continuation, center_on_figures, 1); SCM -Figured_bass_continuation::center_on_figures (SCM grob, SCM axis) +Figured_bass_continuation::center_on_figures (SCM grob) { Spanner *me = dynamic_cast (unsmob_grob (grob)); - (void) axis; - extract_grob_set (me, "figures", figures); + if (figures.empty ()) + return scm_from_double (0.0); Grob *common = common_refpoint_of_array (figures, me, Y_AXIS); Interval ext = Axis_group_interface::relative_group_extent (figures, common, Y_AXIS); - + if (ext.is_empty ()) + return scm_from_double (0.0); return scm_from_double (ext.center () - me->relative_coordinate (common, Y_AXIS)); } @@ -50,7 +50,7 @@ Figured_bass_continuation::print (SCM grob) Spanner *me = dynamic_cast (unsmob_grob (grob)); Real thick = - me->get_layout ()->get_dimension (ly_symbol2scm ("linethickness")) + me->layout ()->get_dimension (ly_symbol2scm ("line-thickness")) * robust_scm2double (me->get_property ("thickness"), 1); Interval spanned; @@ -59,8 +59,13 @@ Figured_bass_continuation::print (SCM grob) X_AXIS); do { + Item *bound = me->get_bound (d); + Direction extdir = + (d == LEFT && to_boolean (bound->get_property ("implicit"))) + ? LEFT : RIGHT; + spanned[d] - = robust_relative_extent (me->get_bound (d), common, X_AXIS)[RIGHT] + = robust_relative_extent (bound, common, X_AXIS)[extdir] - me->relative_coordinate (common, X_AXIS); } while (flip (&d) != LEFT); @@ -75,11 +80,10 @@ Figured_bass_continuation::print (SCM grob) return extender.smobbed_copy (); } -ADD_INTERFACE(Figured_bass_continuation, - "figured-bass-continuation-interface", +ADD_INTERFACE (Figured_bass_continuation, "Simple extender line between bounds.", - /* props */ + /* properties */ "thickness " "padding " "figures "