X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fstaff-symbol-referencer-scheme.cc;h=5fbd8c080be9d514b8377c392c26159b2bb42ca5;hb=b872748c6aa8bb721ced458691b38ac2fac5dfc8;hp=35cd814f0c10fba5870530609b2b7bf9eee5e9b7;hpb=4a401ca1c60f428daa242dbdd102fdb3f327ebfb;p=lilypond.git diff --git a/lily/staff-symbol-referencer-scheme.cc b/lily/staff-symbol-referencer-scheme.cc index 35cd814f0c..5fbd8c080b 100644 --- a/lily/staff-symbol-referencer-scheme.cc +++ b/lily/staff-symbol-referencer-scheme.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1999--2011 Han-Wen Nienhuys + Copyright (C) 1999--2015 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 @@ -27,7 +27,7 @@ LY_DEFINE (ly_grob_staff_position, "ly:grob-staff-position", "Return the Y-position of @var{sg} relative to the staff.") { LY_ASSERT_SMOB (Grob, sg, 1); - Grob *g = unsmob_grob (sg); + Grob *g = unsmob (sg); Real pos = Staff_symbol_referencer::get_position (g); if (fabs (rint (pos) - pos) < 1e-6) // ugh. @@ -43,7 +43,7 @@ LY_DEFINE (ly_position_on_line_p, "ly:position-on-line?", { LY_ASSERT_SMOB (Grob, sg, 1); LY_ASSERT_TYPE (scm_is_number, spos, 2); - Grob *g = unsmob_grob (sg); + Grob *g = unsmob (sg); Grob *st = Staff_symbol_referencer::get_staff_symbol (g); int pos = scm_to_int (spos); bool on_line = st ? Staff_symbol::on_line (g, pos) : false; @@ -52,22 +52,36 @@ LY_DEFINE (ly_position_on_line_p, "ly:position-on-line?", LY_DEFINE (ly_staff_symbol_line_thickness, "ly:staff-symbol-line-thickness", 1, 0, 0, (SCM grob), - "Returns the @code{line-thickness} of the staff associated" - " with @var{grob}.") + "Returns the current staff-line thickness in the staff" + " associated with @var{grob}, expressed as a multiple of the" + " current staff-space height.") { LY_ASSERT_SMOB (Grob, grob, 1); - Grob *g = unsmob_grob (grob); + Grob *g = unsmob (grob); Real thickness = Staff_symbol_referencer::line_thickness (g); return scm_from_double (thickness); } LY_DEFINE (ly_staff_symbol_staff_space, "ly:staff-symbol-staff-space", 1, 0, 0, (SCM grob), - "Returns the @code{staff-space} of the staff associated" - " with @var{grob}.") + "Returns the current staff-space height in the staff" + " associated with @var{grob}, expressed as a multiple of the" + " default height of a staff-space in the traditional" + " five-line staff.") { LY_ASSERT_SMOB (Grob, grob, 1); - Grob *g = unsmob_grob (grob); + Grob *g = unsmob (grob); 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); + Real staff_radius = Staff_symbol_referencer::staff_radius (g); + return scm_from_double (staff_radius); +}