X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fchord-name-engraver.cc;h=44c1333d7a383a333261c813594a87ed03e12b8c;hb=6c00542bf11cd4759b2e39537aeb3d9a533a3519;hp=ac5b14d4cbf1d62711ee508e5a334596271721ab;hpb=e53b6ddc057f5419b4bc6219f0cf6132a487a305;p=lilypond.git diff --git a/lily/chord-name-engraver.cc b/lily/chord-name-engraver.cc index ac5b14d4cb..44c1333d7a 100644 --- a/lily/chord-name-engraver.cc +++ b/lily/chord-name-engraver.cc @@ -8,13 +8,11 @@ #include "engraver.hh" #include "chord-name.hh" -#include "event.hh" #include "output-def.hh" #include "font-interface.hh" #include "output-def.hh" #include "dimensions.hh" #include "item.hh" -#include "pitch.hh" #include "protected-scm.hh" #include "context.hh" #include "warn.hh" @@ -27,19 +25,27 @@ protected: virtual void process_music (); virtual bool try_music (Music *); virtual void finalize (); + virtual void derived_mark () const; private: void add_note (Music *); Item* chord_name_; Link_array notes_; - Protected_scm last_chord_; + SCM last_chord_; }; + + void Chord_name_engraver::finalize () { - last_chord_ = SCM_EOL; +} + +void +Chord_name_engraver::derived_mark() const +{ + scm_gc_mark (last_chord_); } Chord_name_engraver::Chord_name_engraver () @@ -65,7 +71,7 @@ Chord_name_engraver::process_music () SCM pitches = SCM_EOL; Music* inversion_event = 0; - for (int i =0 ; i < notes_.size (); i++) + for (int i = 0 ; i < notes_.size (); i++) { Music *n = notes_[i]; SCM p = n->get_property ("pitch"); @@ -86,13 +92,13 @@ Chord_name_engraver::process_music () if (inversion_event) { SCM oct = inversion_event->get_property ("octavation"); - if (ly_c_number_p (oct)) + if (scm_is_number (oct)) { Pitch *p = unsmob_pitch (inversion_event->get_property ("pitch")); int octavation = scm_to_int (oct); Pitch orig = p->transposed (Pitch (-octavation, 0,0)); - pitches= scm_cons (orig.smobbed_copy (), pitches); + pitches = scm_cons (orig.smobbed_copy (), pitches); } else programming_error ("Inversion does not have original pitch."); @@ -113,7 +119,7 @@ Chord_name_engraver::process_music () chord_name_->set_property ("text", markup); SCM s = get_property ("chordChanges"); - if (to_boolean (s) && ly_c_pair_p (last_chord_) + if (to_boolean (s) && scm_is_pair (last_chord_) && ly_c_equal_p (chord_as_scm, last_chord_)) chord_name_->set_property ("begin-of-line-visible", SCM_BOOL_T); @@ -145,7 +151,7 @@ Chord_name_engraver::stop_translation_timestep () The READs description is not strictly accurate: which properties are read depend on the chord naming function active. */ -ENTER_DESCRIPTION (Chord_name_engraver, +ADD_TRANSLATOR (Chord_name_engraver, /* descr */ "Catch note-events " "and generate the appropriate chordname.", /* creats*/ "ChordName",