Add arrowed sharp signs
[lilypond.git] / lily / glissando-engraver.cc
blobda9c0a1156117ae984ce94494c010c433c5fa220
1 /*
2 note-head-line-engraver.cc -- implement Note_head_line_engraver
4 source file of the GNU LilyPond music typesetter
6 (c) 2000--2008 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
9 #include "engraver.hh"
11 #include "international.hh"
12 #include "rhythmic-head.hh"
13 #include "spanner.hh"
14 #include "stream-event.hh"
15 #include "warn.hh"
16 #include "item.hh"
18 #include "translator.icc"
20 class Glissando_engraver : public Engraver
22 public:
23 TRANSLATOR_DECLARATIONS (Glissando_engraver);
25 protected:
26 DECLARE_TRANSLATOR_LISTENER (glissando);
27 DECLARE_ACKNOWLEDGER (rhythmic_head);
28 virtual void finalize ();
30 void stop_translation_timestep ();
31 void process_music ();
32 private:
33 Spanner *line_;
34 Spanner *last_line_;
35 Stream_event *event_;
38 Glissando_engraver::Glissando_engraver ()
40 last_line_ = line_ = 0;
41 event_ = 0;
44 IMPLEMENT_TRANSLATOR_LISTENER (Glissando_engraver, glissando);
45 void
46 Glissando_engraver::listen_glissando (Stream_event *ev)
48 ASSIGN_EVENT_ONCE (event_, ev);
51 void
52 Glissando_engraver::process_music ()
54 if (event_)
55 line_ = make_spanner ("Glissando", event_->self_scm ());
58 void
59 Glissando_engraver::acknowledge_rhythmic_head (Grob_info info)
61 Grob *g = info.grob ();
62 if (line_)
63 line_->set_bound (LEFT, g);
65 if (last_line_)
67 last_line_->set_bound (RIGHT, g);
68 announce_end_grob (last_line_, g->self_scm ());
72 void
73 Glissando_engraver::stop_translation_timestep ()
75 if (last_line_ && last_line_->get_bound (RIGHT))
77 last_line_ = 0;
79 if (line_)
81 if (last_line_)
82 programming_error ("overwriting glissando");
83 last_line_ = line_;
85 line_ = 0;
86 event_ = 0;
89 void
90 Glissando_engraver::finalize ()
92 if (line_)
94 string msg = _ ("unterminated glissando");
96 if (event_)
97 event_->origin ()->warning (msg);
98 else
99 warning (msg);
101 line_->suicide ();
102 line_ = 0;
106 ADD_ACKNOWLEDGER (Glissando_engraver, rhythmic_head);
107 ADD_TRANSLATOR (Glissando_engraver,
108 /* doc */
109 "Engrave glissandi.",
111 /* create */
112 "Glissando ",
114 /* read */
117 /* write */