2 grace-spacing-engraver.cc -- implement Grace_spacing_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2006--2009 Han-Wen <hanwen@lilypond.org>
10 #include "engraver.hh"
12 #include "pointer-group-interface.hh"
15 #include "translator.icc"
17 class Grace_spacing_engraver
: public Engraver
19 TRANSLATOR_DECLARATIONS (Grace_spacing_engraver
);
24 Spanner
*grace_spacing_
;
26 void process_music ();
27 void stop_translation_timestep ();
31 Grace_spacing_engraver::Grace_spacing_engraver ()
37 Grace_spacing_engraver::process_music ()
39 Moment now
= now_mom ();
40 if (!last_moment_
.grace_part_
and now
.grace_part_
)
42 grace_spacing_
= make_spanner ("GraceSpacing", SCM_EOL
);
46 if (grace_spacing_
&& (now
.grace_part_
|| last_moment_
.grace_part_
))
48 Grob
*column
= unsmob_grob (get_property ("currentMusicalColumn"));
49 Pointer_group_interface::add_grob (grace_spacing_
,
50 ly_symbol2scm ("columns"),
53 column
->set_object ("grace-spacing", grace_spacing_
->self_scm ());
55 if (!grace_spacing_
->get_bound (LEFT
))
56 grace_spacing_
->set_bound (LEFT
, column
);
58 grace_spacing_
->set_bound (RIGHT
, column
);
63 Grace_spacing_engraver::stop_translation_timestep ()
65 last_moment_
= now_mom ();
67 if (!last_moment_
.grace_part_
)
72 ADD_TRANSLATOR (Grace_spacing_engraver
,
73 "Bookkeeping of shortest starting and playing notes in grace"
80 "currentMusicalColumn ",