]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-placement.cc
* mf/feta-macros.mf (soft_start_penstroke, soft_end_penstroke): New
[lilypond.git] / lily / accidental-placement.cc
index 2c508ac9f7de1c88d0786f1a0bea4b39f7f35bd5..087f62abd0e997eb59766aa6db65ce4e9a46e861 100644 (file)
@@ -9,13 +9,13 @@
 
 #include <math.h>
 
+
+#include "accidental-placement.hh"
 #include "libc-extension.hh"   // isinf
-#include "item.hh"
 #include "skyline.hh"
 #include "music.hh"
 #include "pitch.hh"
 #include "warn.hh"
-#include "accidental-placement.hh"
 #include "note-column.hh"
 #include "group-interface.hh"
 #include "note-collision.hh"
@@ -52,7 +52,7 @@ Accidental_placement::add_accidental (Grob* me, Grob* a)
       return; 
     }
 
-  Pitch *p= unsmob_pitch (mcause->get_property ("pitch"));
+  Pitch *p = unsmob_pitch (mcause->get_property ("pitch"));
 
   int n = p->get_notename ();
 
@@ -81,8 +81,8 @@ Accidental_placement::split_accidentals (Grob * accs,
                                         Link_array<Grob> *break_reminder,
                                         Link_array<Grob> *real_acc)
 {
-  for (SCM acs =accs->get_property ("accidental-grobs"); scm_is_pair (acs);
-       acs =scm_cdr (acs))
+  for (SCM acs = accs->get_property ("accidental-grobs"); scm_is_pair (acs);
+       acs = scm_cdr (acs))
     for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s))
       {
        Grob *a = unsmob_grob (scm_car (s));
@@ -142,7 +142,7 @@ struct Accidental_placement_entry
   int notename_;
   Accidental_placement_entry ()
   {
-    offset_ =0.0;
+    offset_ = 0.0;
     notename_ = -1;
   }
 };
@@ -188,7 +188,7 @@ stagger_apes (Link_array<Accidental_placement_entry> *apes)
 
   apes->clear ();
 
-  int i =0;
+  int i = 0;
   int parity = 1;
   while (i < asc.size ())
     {
@@ -254,18 +254,20 @@ Accidental_placement::position_accidentals (Grob * me)
     return SCM_UNSPECIFIED;
   
   SCM accs = me->get_property ("accidental-grobs");
-
+  if (!scm_is_pair (accs))
+    return SCM_UNSPECIFIED;
+    
   /*
     TODO: there is a bug in this code. If two accs are on the same
     Y-position, they share an Ape, and will be printed in overstrike.
    */
   Link_array<Accidental_placement_entry> apes;
-  for (SCM s = accs; scm_is_pair (s); s =scm_cdr (s))
+  for (SCM s = accs; scm_is_pair (s); s = scm_cdr (s))
     {
       Accidental_placement_entry *ape = new Accidental_placement_entry;
       ape->notename_ = scm_to_int (scm_caar (s));
       
-      for (SCM t = scm_cdar (s); scm_is_pair (t); t =scm_cdr (t))
+      for (SCM t = scm_cdar (s); scm_is_pair (t); t = scm_cdr (t))
        ape->grobs_.push (unsmob_grob (scm_car (t)));
 
       apes.push (ape);
@@ -278,7 +280,7 @@ Accidental_placement::position_accidentals (Grob * me)
     extents if we're sure that we've found the right common refpoint
    */
   Link_array<Grob> note_cols, heads;
-  for (int i= apes.size (); i--;)
+  for (int i = apes.size (); i--;)
     { 
       Accidental_placement_entry * ape = apes[i];
       for (int j = ape->grobs_.size (); j--;)
@@ -328,7 +330,7 @@ Accidental_placement::position_accidentals (Grob * me)
   common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
 
   
-  for (int i= apes.size (); i--;)
+  for (int i = apes.size (); i--;)
     {
       Accidental_placement_entry * ape = apes[i];
       ape->left_skyline_ = empty_skyline (LEFT);
@@ -388,7 +390,7 @@ Accidental_placement::position_accidentals (Grob * me)
   /*
     Add accs entries right-to-left.
    */
-  for (int i= apes.size (); i-- > 0;)
+  for (int i = apes.size (); i-- > 0;)
     {
       Real offset =
        -skyline_meshing_distance (apes[i]->right_skyline_, left_skyline);