]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/chord-name-engraver.cc
release: 1.3.38
[lilypond.git] / lily / chord-name-engraver.cc
index fcc6031cbb2224fe5acfa882fcf38674e8fbbca0..32419e420c42693e55b80804f263cb42d6369222 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1998--1999 Jan Nieuwenhuizen <janneke@gnu.org>
+  (c) 1998--2000 Jan Nieuwenhuizen <janneke@gnu.org>
 */
 
 #include "chord-name-engraver.hh"
@@ -16,6 +16,7 @@
 #include "dimensions.hh"
 #include "text-item.hh"
 
+
 ADD_THIS_TRANSLATOR (Chord_name_engraver);
 
 Chord_name_engraver::Chord_name_engraver ()
@@ -60,7 +61,7 @@ Chord_name_engraver::do_try_music (Music* m)
 }
 
 void
-Chord_name_engraver::do_process_requests ()
+Chord_name_engraver::do_process_music ()
 {
   if (chord_name_p_)
     return;
@@ -68,12 +69,29 @@ Chord_name_engraver::do_process_requests ()
     return;
 
   bool find_inversion_b = false;
-  SCM chord_inversion = get_property ("chordInversion", 0);
+  SCM chord_inversion = get_property ("chordInversion");
   if (gh_boolean_p (chord_inversion))
     find_inversion_b = gh_scm2bool (chord_inversion);
 
-  chord_name_p_ = new Chord_name (to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_, find_inversion_b));
-    
+  chord_name_p_ = new Chord_name;
+  Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_,
+                         find_inversion_b);
+
+  /*
+    Hmm, why not represent complete chord as list?
+    ((tonic third fifth) (inversion bass))
+  */
+  SCM plist = SCM_EOL;
+  for (int i= chord.pitch_arr_.size (); i--; )
+    plist = gh_cons (chord.pitch_arr_[i].to_scm (), plist);
+  
+  chord_name_p_->set_elt_property ("pitches", plist);
+  if (chord.inversion_b_)
+    chord_name_p_->set_elt_property ("inversion",
+                                    chord.inversion_pitch_.to_scm ());
+  if (chord.bass_b_)
+    chord_name_p_->set_elt_property ("bass", chord.bass_pitch_.to_scm ());
+
   announce_element (Score_element_info (chord_name_p_, 0));
 }