/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 2006--2010 Han-Wen Nienhuys <hanwen@lilypond.org>
+ Copyright (C) 2006--2015 Han-Wen Nienhuys <hanwen@lilypond.org>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
class Note_spacing_engraver : public Engraver
{
- typedef map <Context*, Grob*> Last_spacing_map;
+ typedef map <Context *, Grob *> Last_spacing_map;
Last_spacing_map last_spacings_;
Grob *last_spacing_;
-
+
Grob *spacing_;
void add_spacing_item (Grob *);
TRANSLATOR_DECLARATIONS (Note_spacing_engraver);
protected:
- DECLARE_ACKNOWLEDGER (rhythmic_grob);
- DECLARE_ACKNOWLEDGER (note_column);
+ void acknowledge_rhythmic_grob (Grob_info);
+ void acknowledge_note_column (Grob_info);
void stop_translation_timestep ();
virtual void finalize ();
virtual void derived_mark () const;
scm_gc_mark (i->first->self_scm ());
}
-Note_spacing_engraver::Note_spacing_engraver ()
+Note_spacing_engraver::Note_spacing_engraver (Context *c)
+ : Engraver (c)
{
spacing_ = 0;
last_spacing_ = 0;
{
spacing_ = make_item ("NoteSpacing", g->self_scm ());
}
-
+
if (spacing_)
{
Pointer_group_interface::add_grob (spacing_,
- ly_symbol2scm ("left-items"),
- g);
+ ly_symbol2scm ("left-items"),
+ g);
if (last_spacing_)
- Pointer_group_interface::add_grob (last_spacing_,
- ly_symbol2scm ("right-items"),
- g);
+ Pointer_group_interface::add_grob (last_spacing_,
+ ly_symbol2scm ("right-items"),
+ g);
}
}
-
void
Note_spacing_engraver::acknowledge_note_column (Grob_info gi)
{
Grob *last_spacing = last_spacings_[parent];
if (last_spacing
- && !unsmob_grob_array (last_spacing->get_object ("right-items")))
+ && !unsmob<Grob_array> (last_spacing->get_object ("right-items")))
{
- Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
-
+ Grob *col = unsmob<Grob> (get_property ("currentCommandColumn"));
+
Pointer_group_interface::add_grob (last_spacing,
- ly_symbol2scm ("right-items"),
- col);
+ ly_symbol2scm ("right-items"),
+ col);
}
}
if (last_spacing
&& to_boolean (get_property ("hasStaffSpacing")))
{
- Grob *col = unsmob_grob (get_property ("currentCommandColumn"));
+ Grob *col = unsmob<Grob> (get_property ("currentCommandColumn"));
Pointer_group_interface::add_grob (last_spacing,
- ly_symbol2scm ("right-items"),
- col);
+ ly_symbol2scm ("right-items"),
+ col);
}
-
+
if (spacing_)
{
last_spacings_[parent] = spacing_;
}
-ADD_ACKNOWLEDGER (Note_spacing_engraver, note_column);
-ADD_ACKNOWLEDGER (Note_spacing_engraver, rhythmic_grob);
+
+void
+Note_spacing_engraver::boot ()
+{
+ ADD_ACKNOWLEDGER (Note_spacing_engraver, note_column);
+ ADD_ACKNOWLEDGER (Note_spacing_engraver, rhythmic_grob);
+}
ADD_TRANSLATOR (Note_spacing_engraver,
- /* doc */
- "Generate @code{NoteSpacing}, an object linking horizontal"
- " lines for use in spacing.",
+ /* doc */
+ "Generate @code{NoteSpacing}, an object linking horizontal"
+ " lines for use in spacing.",
- /* create */
- "NoteSpacing ",
+ /* create */
+ "NoteSpacing ",
- /* read */
- "",
+ /* read */
+ "",
- /* write */
- ""
- );
+ /* write */
+ ""
+ );