OLD | NEW |
1 /* | 1 /* |
2 This file is part of LilyPond, the GNU music typesetter. | 2 This file is part of LilyPond, the GNU music typesetter. |
3 | 3 |
4 Copyright (C) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> | 4 Copyright (C) 1998--2015 Jan Nieuwenhuizen <janneke@gnu.org> |
5 | 5 |
6 LilyPond is free software: you can redistribute it and/or modify | 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 | 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 | 8 the Free Software Foundation, either version 3 of the License, or |
9 (at your option) any later version. | 9 (at your option) any later version. |
10 | 10 |
(...skipping 125 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
136 } | 136 } |
137 | 137 |
138 SCM chord_changes = get_property ("chordChanges"); | 138 SCM chord_changes = get_property ("chordChanges"); |
139 SCM last_chord = get_property ("lastChord"); | 139 SCM last_chord = get_property ("lastChord"); |
140 if (to_boolean (chord_changes) && ly_is_equal (markup, last_chord)) | 140 if (to_boolean (chord_changes) && ly_is_equal (markup, last_chord)) |
141 chord_name->set_property ("begin-of-line-visible", SCM_BOOL_T); | 141 chord_name->set_property ("begin-of-line-visible", SCM_BOOL_T); |
142 | 142 |
143 context ()->set_property ("lastChord", markup); | 143 context ()->set_property ("lastChord", markup); |
144 } | 144 } |
145 | 145 |
146 IMPLEMENT_TRANSLATOR_LISTENER (Chord_name_engraver, note); | |
147 void | 146 void |
148 Chord_name_engraver::listen_note (Stream_event *ev) | 147 Chord_name_engraver::listen_note (Stream_event *ev) |
149 { | 148 { |
150 notes_.push_back (ev); | 149 notes_.push_back (ev); |
151 } | 150 } |
152 | 151 |
153 IMPLEMENT_TRANSLATOR_LISTENER (Chord_name_engraver, rest); | |
154 void | 152 void |
155 Chord_name_engraver::listen_rest (Stream_event *ev) | 153 Chord_name_engraver::listen_rest (Stream_event *ev) |
156 { | 154 { |
157 ASSIGN_EVENT_ONCE (rest_event_, ev); | 155 ASSIGN_EVENT_ONCE (rest_event_, ev); |
158 } | 156 } |
159 | 157 |
160 void | 158 void |
161 Chord_name_engraver::stop_translation_timestep () | 159 Chord_name_engraver::stop_translation_timestep () |
162 { | 160 { |
163 notes_.clear (); | 161 notes_.clear (); |
164 rest_event_ = 0; | 162 rest_event_ = 0; |
165 } | 163 } |
166 | 164 |
167 /* | 165 /* |
168 The READs description is not strictly accurate: | 166 The READs description is not strictly accurate: |
169 which properties are read depend on the chord naming function active. | 167 which properties are read depend on the chord naming function active. |
170 */ | 168 */ |
| 169 void |
| 170 Chord_name_engraver::boot () |
| 171 { |
| 172 ADD_LISTENER (Chord_name_engraver, note); |
| 173 ADD_LISTENER (Chord_name_engraver, rest); |
| 174 } |
| 175 |
171 ADD_TRANSLATOR (Chord_name_engraver, | 176 ADD_TRANSLATOR (Chord_name_engraver, |
172 /* doc */ | 177 /* doc */ |
173 "Catch note and rest events and generate the appropriate chordna
me.", | 178 "Catch note and rest events and generate the appropriate chordna
me.", |
174 | 179 |
175 /* create */ | 180 /* create */ |
176 "ChordName ", | 181 "ChordName ", |
177 | 182 |
178 /* read */ | 183 /* read */ |
179 "chordChanges " | 184 "chordChanges " |
180 "chordNameExceptions " | 185 "chordNameExceptions " |
181 "chordNameFunction " | 186 "chordNameFunction " |
182 "chordNoteNamer " | 187 "chordNoteNamer " |
183 "chordRootNamer " | 188 "chordRootNamer " |
184 "chordNameExceptions " | 189 "chordNameExceptions " |
185 "lastChord " | 190 "lastChord " |
186 "majorSevenSymbol " | 191 "majorSevenSymbol " |
187 "noChordSymbol ", | 192 "noChordSymbol ", |
188 | 193 |
189 /* write */ | 194 /* write */ |
190 "lastChord " | 195 "lastChord " |
191 ); | 196 ); |
OLD | NEW |