2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2010--2011 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 ("partial-duration")))
41 Context
*ctx
= get_outlet ();
42 Moment now
= ctx
->now_mom ();
43 if (now
.main_part_
> Rational (0))
44 get_music ()->origin ()->
45 warning (_ ("trying to use \\partial after the start of a piece"));
46 Moment length
= Moment (dur
->get_length ());
47 now
= Moment (0, now
.grace_part_
);
48 ctx
->set_property ("measurePosition", (now
- length
).smobbed_copy ());
51 programming_error ("invalid duration in \\partial");
53 Simple_music_iterator::process (m
);
56 IMPLEMENT_CTOR_CALLBACK (Partial_iterator
);