]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/completion-note-heads-engraver.cc
* The grand 2005-2006 replace.
[lilypond.git] / lily / completion-note-heads-engraver.cc
index 7a0061f9b9878eb795850abbfa47dcd5322aeffb..3ab3a3f6e2865c43695e76c060ec104638b2438a 100644 (file)
@@ -1,10 +1,11 @@
 /*
   completion-note-heads-engraver.cc -- Completion_heads_engraver
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include <cctype>
+using namespace std;
 
 #include "rhythmic-head.hh"
 #include "output-def.hh"
@@ -21,8 +22,6 @@
 #include "duration.hh"
 #include "pitch.hh"
 
-
-
 /*
   TODO: make matching rest engraver.
 */
@@ -99,9 +98,7 @@ Completion_heads_engraver::try_music (Music *m)
       return true;
     }
   else if (m->is_mus_type ("busy-playing-event"))
-    {
-      return note_events_.size () && is_first_;
-    }
+    return note_events_.size () && is_first_;
 
   return false;
 }
@@ -141,9 +138,7 @@ Completion_heads_engraver::find_nearest_duration (Rational length)
          continue;
        }
       else
-       {
-         d = Duration (d.duration_log () + 1, 2);
-       }
+       d = Duration (d.duration_log () + 1, 2);
     }
 
   if (d.duration_log () >= log_limit)
@@ -173,9 +168,7 @@ Completion_heads_engraver::process_music ()
   Duration note_dur;
   Duration *orig = 0;
   if (left_to_do_)
-    {
-      note_dur = find_nearest_duration (left_to_do_);
-    }
+    note_dur = find_nearest_duration (left_to_do_);
   else
     {
       orig = unsmob_duration (note_events_[0]->get_property ("duration"));
@@ -194,9 +187,7 @@ Completion_heads_engraver::process_music ()
     }
 
   if (orig)
-    {
-      left_to_do_ = orig->get_length ();
-    }
+    left_to_do_ = orig->get_length ();
 
   if (orig && note_dur.get_length () != orig->get_length ())
     {
@@ -223,7 +214,7 @@ Completion_heads_engraver::process_music ()
 
       Item *note = make_item ("NoteHead", event->self_scm ());
       note->set_property ("duration-log",
-                         scm_int2num (note_dur.duration_log ()));
+                         scm_from_int (note_dur.duration_log ()));
 
       int dots = note_dur.dot_count ();
       if (dots)
@@ -235,7 +226,7 @@ Completion_heads_engraver::process_music ()
            measly attempt to save an eeny-weenie bit of memory.
          */
          if (dots != scm_to_int (d->get_property ("dot-count")))
-           d->set_property ("dot-count", scm_int2num (dots));
+           d->set_property ("dot-count", scm_from_int (dots));
 
          d->set_parent (note, Y_AXIS);
          dots_.push (d);
@@ -248,7 +239,7 @@ Completion_heads_engraver::process_music ()
       if (scm_is_number (c0))
        pos += scm_to_int (c0);
 
-      note->set_property ("staff-position", scm_int2num (pos));
+      note->set_property ("staff-position", scm_from_int (pos));
       notes_.push (note);
     }
 
@@ -257,8 +248,6 @@ Completion_heads_engraver::process_music ()
       for (int i = 0; i < notes_.size (); i++)
        {
          Grob *p = make_spanner ("Tie", SCM_EOL);
-         Tie::set_interface (p); // cannot remove yet!
-
          Tie::set_head (p, LEFT, prev_notes_[i]);
          Tie::set_head (p, RIGHT, notes_[i]);
 
@@ -273,9 +262,7 @@ Completion_heads_engraver::process_music ()
   */
   if (orig
       && now_mom ().grace_part_)
-    {
-      left_to_do_ = Rational (0, 0);
-    }
+    left_to_do_ = Rational (0, 0);
 }
 
 void
@@ -290,9 +277,7 @@ Completion_heads_engraver::stop_translation_timestep ()
   dots_.clear ();
 
   for (int i = scratch_note_events_.size (); i--;)
-    {
-      scratch_note_events_[i]->unprotect ();
-    }
+    scratch_note_events_[i]->unprotect ();
 
   scratch_note_events_.clear ();
 }
@@ -315,10 +300,10 @@ Completion_heads_engraver::Completion_heads_engraver ()
 #include "translator.icc"
 
 ADD_TRANSLATOR (Completion_heads_engraver,
-               /* descr */ "This engraver replaces "
+               /* doc */ "This engraver replaces "
                "@code{Note_heads_engraver}. It plays some trickery to "
                "break long notes and automatically tie them into the next measure.",
-               /* creats*/ "NoteHead Dots Tie",
-               /* accepts */ "busy-playing-event note-event",
-               /* reads */ "middleCPosition measurePosition measureLength",
+               /* creat*/ "NoteHead Dots Tie",
+               /* accept */ "busy-playing-event note-event",
+               /* read */ "middleCPosition measurePosition measureLength",
                /* write */ "");