]> git.donarmstrong.com Git - lilypond.git/blob - lily/arpeggio-engraver.cc
Update source file headers. Fixes using standard GNU package conventions.
[lilypond.git] / lily / arpeggio-engraver.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2000--2009 Jan Nieuwenhuizen <janneke@gnu.org>
5
6   LilyPond is free software: you can redistribute it and/or modify
7   it under the terms of the GNU General Public License as published by
8   the Free Software Foundation, either version 3 of the License, or
9   (at your option) any later version.
10
11   LilyPond is distributed in the hope that it will be useful,
12   but WITHOUT ANY WARRANTY; without even the implied warranty of
13   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
14   GNU General Public License for more details.
15
16   You should have received a copy of the GNU General Public License
17   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
18 */
19
20 #include "engraver.hh"
21
22 #include "pointer-group-interface.hh"
23 #include "arpeggio.hh"
24 #include "stem.hh"
25 #include "rhythmic-head.hh"
26 #include "side-position-interface.hh"
27 #include "stream-event.hh"
28 #include "note-column.hh"
29 #include "item.hh"
30
31 #include "translator.icc"
32
33 class Arpeggio_engraver : public Engraver
34 {
35 public:
36   TRANSLATOR_DECLARATIONS (Arpeggio_engraver);
37
38   void acknowledge_stem (Grob_info);
39   void acknowledge_rhythmic_head (Grob_info);
40 protected:
41   void process_music ();
42   void stop_translation_timestep ();
43   DECLARE_TRANSLATOR_LISTENER (arpeggio);
44 private:
45   Item *arpeggio_;
46   Stream_event *arpeggio_event_;
47 };
48
49 Arpeggio_engraver::Arpeggio_engraver ()
50 {
51   arpeggio_ = 0;
52   arpeggio_event_ = 0;
53 }
54
55 IMPLEMENT_TRANSLATOR_LISTENER (Arpeggio_engraver, arpeggio);
56 void Arpeggio_engraver::listen_arpeggio (Stream_event *ev)
57 {
58   ASSIGN_EVENT_ONCE (arpeggio_event_, ev);
59 }
60
61 void
62 Arpeggio_engraver::acknowledge_stem (Grob_info info)
63 {
64   if (arpeggio_)
65     {
66       if (!arpeggio_->get_parent (Y_AXIS))
67         arpeggio_->set_parent (info.grob (), Y_AXIS);
68
69       Pointer_group_interface::add_grob (arpeggio_,
70                                          ly_symbol2scm ("stems"),
71                                          info.grob ());
72     }
73 }
74 void
75 Arpeggio_engraver::acknowledge_rhythmic_head (Grob_info info)
76 {
77   if (arpeggio_)
78
79     /*
80       We can't catch local key items (accidentals) from Voice context,
81       see Local_key_engraver
82     */
83     Side_position_interface::add_support (arpeggio_, info.grob ());
84 }
85
86 void
87 Arpeggio_engraver::process_music ()
88 {
89   if (arpeggio_event_)
90     {
91       arpeggio_ = make_item ("Arpeggio", arpeggio_event_->self_scm ());
92     }
93 }
94
95 void
96 Arpeggio_engraver::stop_translation_timestep ()
97 {
98   arpeggio_ = 0;
99   arpeggio_event_ = 0;
100 }
101
102 ADD_ACKNOWLEDGER (Arpeggio_engraver, stem);
103 ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head);
104
105 ADD_TRANSLATOR (Arpeggio_engraver,
106                 /* doc */
107                 "Generate an Arpeggio symbol.",
108
109                 /* create */
110                 "Arpeggio",
111
112                 /* read */
113                 "",
114
115                 /* write */
116                 ""
117                 );