2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2004 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
15 #include "rhythmic-head.hh"
16 #include "side-position-interface.hh"
17 #include "staff-symbol-referencer.hh"
22 Create line-spanner grobs for lines that connect note heads.
24 TODO: have the line commit suicide if the notes are connected with
28 class Note_head_line_engraver
: public Engraver
31 TRANSLATOR_DECLARATIONS (Note_head_line_engraver
);
34 virtual void acknowledge_grob (Grob_info
);
35 virtual void process_acknowledged_grobs ();
36 virtual void stop_translation_timestep ();
46 Note_head_line_engraver::Note_head_line_engraver ()
56 Note_head_line_engraver::acknowledge_grob (Grob_info info
)
58 if (Rhythmic_head::has_interface (info
.grob_
))
61 if (to_boolean (get_property ("followVoice")))
63 Context
* tr
= context ();
64 while (tr
&& !tr
->is_alias (ly_symbol2scm ( "Staff")))
65 tr
= tr
->get_parent_context () ;
68 && tr
->is_alias (ly_symbol2scm ("Staff")) && tr
!= last_staff_
)
80 Note_head_line_engraver::process_acknowledged_grobs ()
82 if (!line_
&& follow_
&& last_head_
&& head_
)
84 /* TODO: Don't follow if there's a beam.
86 We can't do beam-stuff here, since beam doesn't exist yet.
87 Should probably store follow_ in line_, and suicide at some
90 line_
= make_spanner ("VoiceFollower", head_
->self_scm ());
92 line_
->set_bound (LEFT
, last_head_
);
93 line_
->set_bound (RIGHT
, head_
);
101 Note_head_line_engraver::stop_translation_timestep ()
112 ENTER_DESCRIPTION (Note_head_line_engraver
,
113 /* descr */ "Engrave a line between two note heads, for example a glissando. If "
114 " followVoice is set, staff switches also generate a line.",
115 /* creats*/ "Glissando VoiceFollower",
116 /* accepts */ "glissando-event",
117 /* acks */ "rhythmic-head-interface",
118 /* reads */ "followVoice",