]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob-scheme.cc
Release: update news.
[lilypond.git] / lily / grob-scheme.cc
index 1709cb7e926c215d59100acb695897fe1d8454ea..e56e02d27a40c2e709d4ba18ad72df086005a48c 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 1998--2011 Jan Nieuwenhuizen <janneke@gnu.org>
+  Copyright (C) 1998--2012 Jan Nieuwenhuizen <janneke@gnu.org>
   Han-Wen Nienhuys <hanwen@xs4all.nl>
 
   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}."