2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
12 #include "musical-request.hh"
14 #include "rhythmic-head.hh"
15 #include "side-position-interface.hh"
16 #include "staff-symbol-referencer.hh"
17 #include "translator-group.hh"
20 Create line-spanner grobs for glissandi (and possibly other) lines
21 that connect note heads.
24 class Note_head_line_engraver : public Engraver
27 VIRTUAL_COPY_CONS (Translator);
28 Note_head_line_engraver ();
31 virtual void acknowledge_grob (Grob_info);
32 virtual void create_grobs ();
33 virtual void stop_translation_timestep ();
34 virtual bool try_music (Music *);
40 Translator* last_staff_;
45 Note_head_line_engraver::Note_head_line_engraver ()
56 Note_head_line_engraver::try_music (Music* m)
60 if (Glissando_req *r = dynamic_cast<Glissando_req*> (m))
70 Note_head_line_engraver::acknowledge_grob (Grob_info info)
72 if (Rhythmic_head::has_interface (info.elem_l_))
76 if (to_boolean (get_property ("followThread")))
78 Translator* staff = daddy_trans_l_ && daddy_trans_l_->daddy_trans_l_
79 ? daddy_trans_l_->daddy_trans_l_->daddy_trans_l_ : 0;
80 if (staff != last_staff_)
83 last_req_ = (Request*)1; // ugh
91 Note_head_line_engraver::create_grobs ()
93 if (!line_ && last_req_ && last_head_ && head_)
96 line_ = new Spanner (get_property ("NoteHeadLine"));
97 line_->set_bound (LEFT, head_);
98 line_->set_bound (RIGHT, last_head_);
100 line_->set_parent (head_, X_AXIS);
101 line_->set_parent (head_, Y_AXIS);
103 line_->set_parent (last_head_, X_AXIS);
104 line_->set_parent (last_head_, Y_AXIS);
106 if ((int)last_req_ == 1) // ugh
109 announce_grob (line_, last_req_);
117 Note_head_line_engraver::stop_translation_timestep ()
121 typeset_grob (line_);
130 ADD_THIS_TRANSLATOR (Note_head_line_engraver);