2 grace-engraver.cc -- implement Grace_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
10 #include "engraver.hh"
14 class Grace_engraver : public Engraver
17 virtual void start_translation_timestep ();
18 virtual void derived_mark ();
20 TRANSLATOR_DECLARATIONS (Grace_engraver);
27 Grace_engraver::Grace_engraver()
29 grace_settings_ = SCM_EOL;
33 Grace_engraver::derived_mark ()
35 scm_gc_mark (grace_settings_);
39 Grace_engraver::start_translation_timestep ()
41 Moment now = now_mom ();
42 if (last_moment_.grace_part_ && !now.grace_part_)
44 for (SCM s = grace_settings_; scm_is_pair (s); s = scm_cdr (s))
46 SCM context = scm_caar (s);
47 SCM entry = scm_cdar (s);
48 SCM grob = scm_cadr (entry);
49 SCM sym = scm_caddr (entry);
51 execute_pushpop_property (unsmob_context (context),
52 grob, sym, SCM_UNDEFINED);
55 grace_settings_ = SCM_EOL;
57 else if (!last_moment_.grace_part_ && now.grace_part_)
59 SCM settings = get_property ("graceSettings");
61 grace_settings_ = SCM_EOL;
62 for (SCM s = settings; scm_is_pair (s); s = scm_cdr (s))
64 SCM entry = scm_car (s);
65 SCM context_name = scm_car (entry);
66 SCM grob = scm_cadr (entry);
67 SCM sym = scm_caddr (entry);
68 SCM val = scm_cadr (scm_cddr (entry));
70 Context *c = context ();
72 && c->context_name_symbol () != context_name)
74 c = c->get_parent_context ();
79 execute_pushpop_property (c,
82 = scm_cons (scm_cons (c->self_scm(), entry), grace_settings_);
86 programming_error ("Cannot find context");
87 scm_display (context_name, scm_current_error_port());
96 ADD_TRANSLATOR (Grace_engraver,
97 /* descr */ "Set font size and other properties for grace notes.",
101 /* reads */ "graceSettings",