+// if we are in grace time already on initialization, it is unlikely
+// that we'll receive a GraceChange event from the grace iterator yet,
+// so we want to start into grace mode anyway. The downside is that
+// this will get us confused when given something like
+//
+// \new Voice { \oneVoice \grace { c''8 8 } g'1 }
+//
+// where \grace executes its actions already before \oneVoice, causing
+// different stem directions.
+
+void
+Grace_engraver::start_translation_timestep ()
+{
+ // Only on startup
+ if (last_moment_ == Rational (-1))
+ consider_change_grace_settings ();
+}
+
+// If the grace iterator has moved off to some other context, we might
+// not get to see the ChangeContext event. In that case, we still
+// want to change into or out of grace mode settings as appropriate
+
+void
+Grace_engraver::process_music ()
+{
+ // We may have lost connection to the iterator in which case we
+ // still need to call consider_change_grace_settings in particular
+ // in order to get out of grace mode again
+ if (last_moment_ != now_mom ())
+ consider_change_grace_settings ();
+}
+