2 ligature-bracket-engraver.cc -- implement Ligature_bracket_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2002--2007 Juergen Reuter <reuter@ipd.uka.de>
9 #include "international.hh"
11 #include "ligature-engraver.hh"
12 #include "note-column.hh"
13 #include "tuplet-bracket.hh"
15 #include "stream-event.hh"
19 #include "translator.icc"
21 class Ligature_bracket_engraver
: public Engraver
24 virtual void process_music ();
25 virtual void stop_translation_timestep ();
26 DECLARE_ACKNOWLEDGER (rest
);
27 DECLARE_ACKNOWLEDGER (note_column
);
28 DECLARE_TRANSLATOR_LISTENER (ligature
);
30 TRANSLATOR_DECLARATIONS (Ligature_bracket_engraver
);
33 Drul_array
<Stream_event
*> events_drul_
;
34 Spanner
*finished_ligature_
;
36 Stream_event
*previous_start_event_
;
39 IMPLEMENT_TRANSLATOR_LISTENER (Ligature_bracket_engraver
, ligature
);
41 Ligature_bracket_engraver::listen_ligature (Stream_event
*ev
)
43 Direction d
= to_dir (ev
->get_property ("span-direction"));
44 ASSIGN_EVENT_ONCE (events_drul_
[d
], ev
);
47 Ligature_bracket_engraver::Ligature_bracket_engraver ()
50 finished_ligature_
= 0;
51 events_drul_
[LEFT
] = events_drul_
[RIGHT
] = 0;
52 previous_start_event_
= 0;
56 Ligature_bracket_engraver::process_music()
58 if (events_drul_
[STOP
])
62 events_drul_
[STOP
]->origin ()->warning (_ ("cannot find start of ligature"));
66 finished_ligature_
= ligature_
;
68 previous_start_event_
= 0;
71 if (events_drul_
[START
])
75 events_drul_
[START
]->origin ()->warning (_ ("already have a ligature"));
79 previous_start_event_
= events_drul_
[START
];
80 ligature_
= make_spanner ("LigatureBracket", events_drul_
[START
]->self_scm ());
85 Ligature_bracket_engraver::acknowledge_note_column (Grob_info info
)
89 Tuplet_bracket::add_column (ligature_
,
91 add_bound_item (ligature_
, info
.item());
96 Ligature_bracket_engraver::acknowledge_rest (Grob_info info
)
98 acknowledge_note_column(info
);
103 Ligature_bracket_engraver::stop_translation_timestep ()
106 events_drul_
[RIGHT
] = 0;
107 finished_ligature_
= 0;
110 ADD_ACKNOWLEDGER (Ligature_bracket_engraver
, rest
);
111 ADD_ACKNOWLEDGER (Ligature_bracket_engraver
, note_column
);
113 ADD_TRANSLATOR (Ligature_bracket_engraver
,
115 "Handle @code{Ligature_events} by engraving @code{Ligature}"