2 grace-engraver.cc -- implement Grace_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
13 class Grace_engraver : public Engraver
16 virtual void start_translation_timestep ();
17 virtual void derived_mark () const;
19 TRANSLATOR_DECLARATIONS (Grace_engraver);
25 Grace_engraver::Grace_engraver ()
27 grace_settings_ = SCM_EOL;
31 Grace_engraver::derived_mark () const
33 scm_gc_mark (grace_settings_);
34 Engraver::derived_mark ();
38 Grace_engraver::start_translation_timestep ()
40 Moment now = now_mom ();
41 if (last_moment_.grace_part_ && !now.grace_part_)
43 for (SCM s = grace_settings_; scm_is_pair (s); s = scm_cdr (s))
45 SCM context = scm_caar (s);
46 SCM entry = scm_cdar (s);
47 SCM grob = scm_cadr (entry);
48 SCM sym = scm_caddr (entry);
50 execute_pushpop_property (unsmob_context (context),
51 grob, sym, SCM_UNDEFINED);
54 grace_settings_ = SCM_EOL;
56 else if (!last_moment_.grace_part_ && now.grace_part_)
58 SCM settings = get_property ("graceSettings");
60 grace_settings_ = SCM_EOL;
61 for (SCM s = settings; scm_is_pair (s); s = scm_cdr (s))
63 SCM entry = scm_car (s);
64 SCM context_name = scm_car (entry);
65 SCM grob = scm_cadr (entry);
66 SCM sym = scm_caddr (entry);
67 SCM val = scm_cadr (scm_cddr (entry));
69 Context *c = context ();
71 && c->context_name_symbol () != context_name)
73 c = c->get_parent_context ();
78 execute_pushpop_property (c,
81 = scm_cons (scm_cons (c->self_scm (), entry), grace_settings_);
85 programming_error ("can't find context");
86 scm_display (context_name, scm_current_error_port ());
94 ADD_TRANSLATOR (Grace_engraver,
95 /* descr */ "Set font size and other properties for grace notes.",
99 /* reads */ "graceSettings",