X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fflag.cc;h=f997d6fe457f44626cddc7bec2579788b4046a69;hb=646848f37e1b5faca1678fb4d1845216f2a41993;hp=ceab63e0e48a055efd03a537636969d7de5221bb;hpb=1d509b27723ea1c359b51c0f2fe623a32867d6f9;p=lilypond.git diff --git a/lily/flag.cc b/lily/flag.cc index ceab63e0e4..f997d6fe45 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--2011 Han-Wen Nienhuys + Copyright (C) 1996--2012 Han-Wen Nienhuys Jan Nieuwenhuizen LilyPond is free software: you can redistribute it and/or modify @@ -35,11 +35,12 @@ public: DECLARE_SCHEME_CALLBACK (print, (SCM)); DECLARE_SCHEME_CALLBACK (width, (SCM)); 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); +}; MAKE_SCHEME_CALLBACK (Flag, width, 1); SCM @@ -138,9 +139,24 @@ Flag::print (SCM smob) return flag.smobbed_copy (); } +MAKE_SCHEME_CALLBACK (Flag, pure_calc_y_offset, 3); +SCM +Flag::pure_calc_y_offset (SCM smob, + SCM /* beg */, + SCM /* end */) +{ + return internal_calc_y_offset (smob, true); +} + MAKE_SCHEME_CALLBACK (Flag, calc_y_offset, 1); SCM Flag::calc_y_offset (SCM smob) +{ + return internal_calc_y_offset (smob, false); +} + +SCM +Flag::internal_calc_y_offset (SCM smob, bool pure) { Grob *me = unsmob_grob (smob); Grob *stem = me->get_parent (X_AXIS); @@ -149,7 +165,9 @@ Flag::calc_y_offset (SCM smob) Real blot = me->layout ()->get_dimension (ly_symbol2scm ("blot-diameter")); - Real y2 = stem->extent (stem, Y_AXIS)[d]; + Real y2 = pure + ? stem->pure_height (stem, 0, INT_MAX)[d] + : stem->extent (stem, Y_AXIS)[d]; return scm_from_double (y2 - d * blot / 2); }