X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fpitch-scheme.cc;h=6ad6f8c89a2ded2209abebc340e379d57702db6b;hb=d31f8b518f7b5f04e7c332e001b1e31c23c39021;hp=12ddddf10a1c9b71e729622fc0be5c64a5feda5d;hpb=a200088f8b69a03e02c466feb7ed45722cd6a2f7;p=lilypond.git diff --git a/lily/pitch-scheme.cc b/lily/pitch-scheme.cc index 12ddddf10a..6ad6f8c89a 100644 --- a/lily/pitch-scheme.cc +++ b/lily/pitch-scheme.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 2005--2007 Han-Wen Nienhuys + (c) 2005--2009 Han-Wen Nienhuys */ #include "pitch.hh" @@ -142,3 +142,21 @@ LY_DEFINE (ly_pitch_diff, "ly:pitch-diff", return pitch_interval (*r, *p).smobbed_copy (); } + +/* FIXME: probably isn't the right place for this function */ +#include "context.hh" +LY_DEFINE (ly_set_middle_C_x, "ly:set-middle-C!", + 1, 0, 0, (SCM context), + "Set the @code{middleCPosition} variable in @var{context}" + " based on the variables @code{middleCClefPosition} and" + " middleCOffset.") +{ + LY_ASSERT_SMOB (Context, context, 1); + + Context *c = unsmob_context (context); + int clef_pos = robust_scm2int (c->get_property ("middleCClefPosition"), 0); + int offset = robust_scm2int (c->get_property ("middleCOffset"), 0); + + c->set_property (ly_symbol2scm ("middleCPosition"), scm_from_int (clef_pos + offset)); + return SCM_UNDEFINED; +}