]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/tab-note-heads-engraver.cc
Merge branch 'jneeman' of git+ssh://jneem@git.sv.gnu.org/srv/git/lilypond into jneeman
[lilypond.git] / lily / tab-note-heads-engraver.cc
index d30c2265c7da959f81b32e5f1183252eae19d03e..a9e655673420ec210e39b3aa818aea85b0653187 100644 (file)
@@ -1,26 +1,24 @@
 /*
   tab-note-heads-engraver.cc -- part of GNU LilyPond
 
-  based on note-heads-engraver.cc, by Jean-Baptiste Lamy <jiba@tuxfamily.org>,
-
-  (c) 2002--2006
+  (c) 2002--2006 Han-Wen Nienhuys, Jean-Baptiste Lamy <jiba@tuxfamily.org>,
 */
 
 #include <cctype>
 #include <cstdio>
+
+#include "engraver.hh"
+
 using namespace std;
 
-#include "dot-column.hh"
-#include "dots.hh"
 #include "duration.hh"
 #include "item.hh"
 #include "output-def.hh"
 #include "pitch.hh"
 #include "rhythmic-head.hh"
-#include "score-engraver.hh"
-#include "staff-symbol-referencer.hh"
 #include "stream-event.hh"
 #include "warn.hh"
+#include "context.hh"
 
 #include "translator.icc"
 
@@ -31,7 +29,6 @@ class Tab_note_heads_engraver : public Engraver
 {
   vector<Item*> notes_;
 
-  vector<Item*> dots_;
   vector<Stream_event*> note_events_;
   vector<Stream_event*> tabstring_events_;
 public:
@@ -69,8 +66,8 @@ Tab_note_heads_engraver::process_music ()
   vsize j = 0;
   for (vsize i = 0; i < note_events_.size (); i++)
     {
-      SCM stringTunings = get_property ("stringTunings");
-      int number_of_strings = ((int) ly_length (stringTunings));
+      SCM string_tunings = get_property ("stringTunings");
+      int number_of_strings = scm_ilength (string_tunings);
       bool high_string_one = to_boolean (get_property ("highStringOne"));
 
       Stream_event *event = note_events_[i];
@@ -108,22 +105,6 @@ Tab_note_heads_engraver::process_music ()
        }
 
       Duration dur = *unsmob_duration (event->get_property ("duration"));
-      note->set_property ("duration-log",
-                         scm_from_int (dur.duration_log ()));
-
-      if (dur.dot_count ())
-       {
-         Item *d = make_item ("Dots", event->self_scm ());
-         Rhythmic_head::set_dots (note, d);
-
-         if (dur.dot_count ()
-             != scm_to_int (d->get_property ("dot-count")))
-           d->set_property ("dot-count", scm_from_int (dur.dot_count ()));
-
-         d->set_parent (note, Y_AXIS);
-
-         dots_.push_back (d);
-       }
 
       SCM scm_pitch = event->get_property ("pitch");
       SCM proc = get_property ("tablatureFormat");
@@ -133,22 +114,26 @@ Tab_note_heads_engraver::process_music ()
       while (!string_found)
        {
          int fret = unsmob_pitch (scm_pitch)->semitone_pitch ()
-           - scm_to_int (scm_list_ref (stringTunings, scm_from_int (tab_string - 1)));
+           - scm_to_int (scm_list_ref (string_tunings, scm_from_int (tab_string - 1)));
          if (fret < min_fret)
            tab_string += high_string_one ? 1 : -1;
          else
            string_found = true;
        }
 
-      SCM text = scm_call_3 (proc, scm_from_int (tab_string), stringTunings, scm_pitch);
+      SCM text = scm_call_3 (proc, scm_from_int (tab_string),
+                            context ()->self_scm (),
+                            event->self_scm ());
+      note->set_property ("text", text);
+
 
       int pos = 2 * tab_string - number_of_strings - 1; // No tab-note between the string !!!
       if (to_boolean (get_property ("stringOneTopmost")))
        pos = -pos;
 
-      note->set_property ("text", text);
-
       note->set_property ("staff-position", scm_from_int (pos));
+
+      
       notes_.push_back (note);
     }
 }
@@ -157,15 +142,23 @@ void
 Tab_note_heads_engraver::stop_translation_timestep ()
 {
   notes_.clear ();
-  dots_.clear ();
   note_events_.clear ();
   tabstring_events_.clear ();
 }
 
 ADD_TRANSLATOR (Tab_note_heads_engraver,
                /* doc */ "Generate one or more tablature noteheads from event of type NoteEvent.",
-               /* create */ "TabNoteHead Dots",
-               /* accept */ "note-event string-number-event",
-               /* read */ "middleCPosition stringTunings minimumFret tablatureFormat highStringOne stringOneTopmost",
+               /* create */
+               "TabNoteHead "
+               ,
+
+               /* read */
+               "middleCPosition "
+               "stringTunings "
+               "minimumFret "
+               "tablatureFormat "
+               "highStringOne "
+               "stringOneTopmost ",
+
                /* write */ "");