X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-symbol-referencer-scheme.cc;h=1fe886ec0a5a76ee169f2869600419614a58db68;hb=f2bd717cbca1a2f3d00b2dc37eca5be39c6e2c33;hp=74dd8c2e3a97671ce06eb9882ecbef37e5c4a081;hpb=1efdabf3b2349ea7fa3183dca5bba5104c347c36;p=lilypond.git diff --git a/lily/staff-symbol-referencer-scheme.cc b/lily/staff-symbol-referencer-scheme.cc index 74dd8c2e3a..1fe886ec0a 100644 --- a/lily/staff-symbol-referencer-scheme.cc +++ b/lily/staff-symbol-referencer-scheme.cc @@ -1,9 +1,20 @@ /* - staff-symbol-referencer-scheme.cc -- implement Staff_symbol_referencer bindings + This file is part of LilyPond, the GNU music typesetter. - source file of the GNU LilyPond music typesetter + Copyright (C) 1999--2012 Han-Wen Nienhuys - (c) 1999--2009 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + LilyPond is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with LilyPond. If not, see . */ #include "grob.hh" @@ -19,7 +30,7 @@ LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", Grob *g = unsmob_grob (sg); Real pos = Staff_symbol_referencer::get_position (g); - if (fabs (rint (pos) -pos) < 1e-6) // ugh. + if (fabs (rint (pos) - pos) < 1e-6) // ugh. return scm_from_int ((int) my_round (pos)); else return scm_from_double (pos); @@ -28,7 +39,7 @@ LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", LY_DEFINE (ly_position_on_line_p, "ly:position-on-line?", 2, 0, 0, (SCM sg, SCM spos), "Return whether @var{spos} is on a line of the staff associated" - " with the the grob @var{sg} (even on an extender line).") + " with the grob @var{sg} (even on an extender line).") { LY_ASSERT_SMOB (Grob, sg, 1); LY_ASSERT_TYPE (scm_is_number, spos, 2); @@ -60,3 +71,14 @@ LY_DEFINE (ly_staff_symbol_staff_space, "ly:staff-symbol-staff-space", Real staff_space = Staff_symbol_referencer::staff_space (g); return scm_from_double (staff_space); } + +LY_DEFINE (ly_staff_symbol_staff_radius, "ly:staff-symbol-staff-radius", + 1, 0, 0, (SCM grob), + "Returns the radius of the staff associated with" + " @var{grob}.") +{ + LY_ASSERT_SMOB (Grob, grob, 1); + Grob *g = unsmob_grob (grob); + Real staff_radius = Staff_symbol_referencer::staff_radius (g); + return scm_from_double (staff_radius); +}