2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2010--2014 Neil Puttock <n.puttock@gmail.com>
6 LilyPond is free software: you can redistribute it and/or modify
7 it under the terms of the GNU General Public License as published by
8 the Free Software Foundation, either version 3 of the License, or
9 (at your option) any later version.
11 LilyPond is distributed in the hope that it will be useful,
12 but WITHOUT ANY WARRANTY; without even the implied warranty of
13 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
14 GNU General Public License for more details.
16 You should have received a copy of the GNU General Public License
17 along with LilyPond. If not, see <http://www.gnu.org/licenses/>.
22 #include "international.hh"
25 #include "simple-music-iterator.hh"
27 class Partial_iterator : public Simple_music_iterator
30 DECLARE_SCHEME_CALLBACK (constructor, ());
32 virtual void process (Moment);
36 Partial_iterator::process (Moment m)
39 = unsmob_duration (get_music ()->get_property ("duration")))
41 // Partial_iterator is an iterator rather than an engraver, so
42 // the active context it is getting called in does not depend on
43 // which context definition the engraver might be defined.
45 // Using where_defined to find the context where measurePosition
46 // should be overwritten does not actually work since the
47 // Timing_translator does not set measurePosition when
50 Context *timing = unsmob_context (scm_call_2 (ly_lily_module_constant ("ly:context-find"),
51 get_outlet ()->self_scm (),
52 ly_symbol2scm ("Timing")));
55 programming_error ("missing Timing in \\partial");
58 Moment mp = robust_scm2moment (timing->get_property ("measurePosition"),
61 if (mp.main_part_ > Rational (0))
62 mp.main_part_ = measure_length (timing);
66 Moment length = Moment (dur->get_length ());
67 timing->set_property ("measurePosition", (mp - length).smobbed_copy ());
71 programming_error ("invalid duration in \\partial");
73 Simple_music_iterator::process (m);
76 IMPLEMENT_CTOR_CALLBACK (Partial_iterator);