X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fflag.cc;h=4b90be8be01a2395624067d2d64d04d9e230048d;hb=8659a99f233f5c4684292728e7ad4206669b35b0;hp=77491befd6df84fb3d922718f7c7d82bfa73a5ce;hpb=28f3294954eff1f263d3b2e3de1c520f4d2fbdfc;p=lilypond.git diff --git a/lily/flag.cc b/lily/flag.cc index 77491befd6..4b90be8be0 100644 --- a/lily/flag.cc +++ b/lily/flag.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1996--2012 Han-Wen Nienhuys + Copyright (C) 1996--2015 Han-Wen Nienhuys Jan Nieuwenhuizen LilyPond is free software: you can redistribute it and/or modify @@ -38,7 +38,6 @@ public: DECLARE_SCHEME_CALLBACK (calc_y_offset, (SCM)); DECLARE_SCHEME_CALLBACK (pure_calc_y_offset, (SCM, SCM, SCM)); DECLARE_SCHEME_CALLBACK (calc_x_offset, (SCM)); - DECLARE_GROB_INTERFACE (); static SCM internal_calc_y_offset (SCM smob, bool pure); }; @@ -47,8 +46,8 @@ MAKE_SCHEME_CALLBACK (Flag, width, 1); SCM Flag::width (SCM smob) { - Grob *me = unsmob_grob (smob); - Stencil *sten = unsmob_stencil (me->get_property ("stencil")); + Grob *me = unsmob (smob); + Stencil *sten = unsmob (me->get_property ("stencil")); if (!sten) return ly_interval2scm (Interval (0.0, 0.0)); @@ -67,7 +66,7 @@ MAKE_SCHEME_CALLBACK (Flag, glyph_name, 1); SCM Flag::glyph_name (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); @@ -105,7 +104,7 @@ Flag::glyph_name (SCM smob) char dir = (d == UP) ? 'u' : 'd'; string font_char = flag_style - + to_string (dir) + staffline_offs + to_string (log); + + ::to_string (dir) + staffline_offs + ::to_string (log); return ly_string2scm ("flags." + font_char); } @@ -113,7 +112,7 @@ MAKE_SCHEME_CALLBACK (Flag, print, 1); SCM Flag::print (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); @@ -143,11 +142,11 @@ Flag::print (SCM smob) string stroke_style = ly_scm2string (stroke_style_scm); if (!stroke_style.empty ()) { - string font_char = flag_style + to_string (dir) + stroke_style; + string font_char = flag_style + ::to_string (dir) + stroke_style; Stencil stroke = fm->find_by_name ("flags." + font_char); if (stroke.is_empty ()) { - font_char = to_string (dir) + stroke_style; + font_char = ::to_string (dir) + stroke_style; stroke = fm->find_by_name ("flags." + font_char); } if (stroke.is_empty ()) @@ -179,25 +178,27 @@ Flag::calc_y_offset (SCM smob) SCM Flag::internal_calc_y_offset (SCM smob, bool pure) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Grob *stem = me->get_parent (X_AXIS); Direction d = get_grob_direction (stem); Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter")); - Real y2 = pure - ? stem->pure_height (stem, 0, INT_MAX)[d] - : stem->extent (stem, Y_AXIS)[d]; + Interval stem_extent = pure + ? stem->pure_y_extent (stem, 0, INT_MAX) + : stem->extent (stem, Y_AXIS); - return scm_from_double (y2 - d * blot / 2); + return scm_from_double (stem_extent.is_empty () + ? 0.0 + : stem_extent[d] - d * blot / 2); } MAKE_SCHEME_CALLBACK (Flag, calc_x_offset, 1); SCM Flag::calc_x_offset (SCM smob) { - Grob *me = unsmob_grob (smob); + Grob *me = unsmob (smob); Grob *stem = me->get_parent (X_AXIS); return scm_from_double (stem->extent (stem, X_AXIS)[RIGHT]); }