2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2001 Jan Nieuwenhuizen <janneke@gnu.org>
10 #include "group-interface.hh"
12 #include "musical-request.hh"
15 #include "rhythmic-head.hh"
16 #include "side-position-interface.hh"
17 #include "staff-symbol-referencer.hh"
18 #include "translator-group.hh"
21 Create line-spanner grobs for glissandi (and possibly other) lines
22 that connect note heads.
25 TODO: have the line commit suicide if the notes are connected with
29 class Note_head_line_engraver : public Engraver
32 VIRTUAL_COPY_CONS (Translator);
33 Note_head_line_engraver ();
36 virtual void acknowledge_grob (Grob_info);
37 virtual void create_grobs ();
38 virtual void stop_translation_timestep ();
39 virtual bool try_music (Music *);
45 Translator* last_staff_;
51 Note_head_line_engraver::Note_head_line_engraver ()
63 Note_head_line_engraver::try_music (Music* m)
67 if (Glissando_req *r = dynamic_cast<Glissando_req*> (m))
77 Note_head_line_engraver::acknowledge_grob (Grob_info info)
79 if (Rhythmic_head::has_interface (info.elem_l_))
82 if (to_boolean (get_property ("followThread")))
84 Translator_group * tr = daddy_trans_l_;
85 while (tr && tr->type_str_ != "Staff")
86 tr = tr->daddy_trans_l_ ;
88 if (tr && tr->type_str_ == "Staff" && tr != last_staff_)
100 Note_head_line_engraver::create_grobs ()
102 if (!line_ && (follow_ || last_req_) && last_head_ && head_
103 && (last_head_ != head_))
105 /* TODO: Don't follow if there's a beam.
107 We can't do beam-stuff here, since beam doesn't exist yet.
108 Should probably store follow_ in line_, and suicide at some
111 line_ = new Spanner (get_property ("FollowThread"));
113 line_ = new Spanner (get_property ("Glissando"));
115 line_->set_bound (LEFT, last_head_);
116 line_->set_bound (RIGHT, head_);
118 /* Note, mustn't set y-parent of breakable symbol to simple item:
119 one of the two broken parts won't have an y-parent! */
120 /* X parent is set by set_bound */
121 line_->set_parent (Staff_symbol_referencer::staff_symbol_l (last_head_),
124 announce_grob (line_, last_req_);
132 Note_head_line_engraver::stop_translation_timestep ()
136 typeset_grob (line_);
151 ADD_THIS_TRANSLATOR (Note_head_line_engraver);