]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/chord-name-engraver.cc
release: 1.3.3
[lilypond.git] / lily / chord-name-engraver.cc
index 21f0a99f1ad7f4fa239b76293bc60574e0ba0233..ef0744d627219e1092001232021a8c859d383043 100644 (file)
@@ -20,7 +20,6 @@ ADD_THIS_TRANSLATOR (Chord_name_engraver);
 
 Chord_name_engraver::Chord_name_engraver ()
 {
-  chord_p_ = 0;
   tonic_req_ = 0;
   inversion_req_ = 0;
   bass_req_ = 0;
@@ -62,7 +61,7 @@ Chord_name_engraver::do_try_music (Music* m)
 void
 Chord_name_engraver::do_process_requests ()
 {
-  if (chord_p_)
+  if (text_p_arr_.size ())
     return;
   if (!pitch_arr_.size ())
     return;
@@ -72,20 +71,36 @@ Chord_name_engraver::do_process_requests ()
   if (gh_boolean_p (chord_inversion))
     find_inversion_b = gh_scm2bool (chord_inversion);
 
-  chord_p_ = new Chord (to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_, find_inversion_b));
+  Chord chord = to_chord (pitch_arr_, tonic_req_, inversion_req_, bass_req_, 
+    find_inversion_b);
     
-  announce_element (Score_element_info (chord_p_, 0));
+  Text_item* item_p =  new Text_item;
+
+  /*
+   TODO:
+     - switch on property, add american (?) chordNameStyle:
+       Chord::american_str (...)
+
+  SCM chordNameStyle = get_property ("chordNameStyle", 0);
+  if (chordNameStyle == "Banter")
+    item_p->text_str_ = chord.banter_str (inversion);
+   */
+
+  item_p->text_str_ = chord.banter_str ();
+  
+  text_p_arr_.push (item_p);
+  announce_element (Score_element_info (item_p, 0));
 }
 
 void
 Chord_name_engraver::do_pre_move_processing ()
 {
-  if (chord_p_)
+  for (int i=0; i < text_p_arr_.size (); i++)
     {
-      typeset_element (chord_p_);
+      typeset_element (text_p_arr_[i]);
     }
+  text_p_arr_.clear ();
   pitch_arr_.clear ();
-  chord_p_ = 0;
   tonic_req_ = 0;
   inversion_req_ = 0;
   bass_req_ = 0;