X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fgrob-scheme.cc;h=e56e02d27a40c2e709d4ba18ad72df086005a48c;hb=f166a6e3a57e6cff6dbaf97b2c47edc114c8ec2f;hp=1709cb7e926c215d59100acb695897fe1d8454ea;hpb=bb8a0a5387af94dd2702877256334b160575a730;p=lilypond.git diff --git a/lily/grob-scheme.cc b/lily/grob-scheme.cc index 1709cb7e92..e56e02d27a 100644 --- a/lily/grob-scheme.cc +++ b/lily/grob-scheme.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1998--2011 Jan Nieuwenhuizen + Copyright (C) 1998--2012 Jan Nieuwenhuizen Han-Wen Nienhuys LilyPond is free software: you can redistribute it and/or modify @@ -78,6 +78,49 @@ LY_DEFINE (ly_grob_set_nested_property_x, "ly:grob-set-nested-property!", return SCM_UNSPECIFIED; } +LY_DEFINE (ly_grob_pure_property, "ly:grob-pure-property", + 4, 1, 0, (SCM grob, SCM sym, SCM beg, SCM end, SCM val), + "Return the pure value for property @var{sym} of @var{grob}." + " If no value is found, return @var{val} or @code{'()}" + " if @var{val} is not specified.") +{ + Grob *sc = unsmob_grob (grob); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_TYPE (ly_is_symbol, sym, 2); + LY_ASSERT_TYPE (scm_is_integer, beg, 3); + LY_ASSERT_TYPE (scm_is_integer, end, 4); + if (val == SCM_UNDEFINED) + val = SCM_EOL; + + SCM retval = sc->internal_get_pure_property (sym, scm_to_int (beg), scm_to_int (end)); + if (retval == SCM_EOL) + retval = val; + + return retval; +} + +LY_DEFINE (ly_grob_pure_height, "ly:grob-pure-height", + 4, 1, 0, (SCM grob, SCM refp, SCM beg, SCM end, SCM val), + "Return the pure height of @var{grob} given refpoint @var{refp}." + " If no value is found, return @var{val} or @code{'()}" + " if @var{val} is not specified.") +{ + Grob *sc = unsmob_grob (grob); + Grob *ref = unsmob_grob (refp); + + LY_ASSERT_SMOB (Grob, grob, 1); + LY_ASSERT_SMOB (Grob, refp, 2); + LY_ASSERT_TYPE (scm_is_integer, beg, 3); + LY_ASSERT_TYPE (scm_is_integer, end, 4); + if (val == SCM_UNDEFINED) + val = SCM_EOL; + + Interval retval = sc->pure_height (ref, scm_to_int (beg), scm_to_int (end)); + + return ly_interval2scm (retval); +} + LY_DEFINE (ly_grob_property, "ly:grob-property", 2, 1, 0, (SCM grob, SCM sym, SCM val), "Return the value for property @var{sym} of @var{grob}."