]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-placement.cc
(AncientRemoveEmptyStaffContext): switch on
[lilypond.git] / lily / accidental-placement.cc
index cf67149f76623e51b6c76d3201cf904b6ffea45d..3f63cb1c5baaf628b61b5ed35bb7fcb8f6b0cb5d 100644 (file)
@@ -6,16 +6,15 @@
   (c) 2002--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include <math.h>
+
 
 #include "accidental-placement.hh"
-#include "libc-extension.hh"   // isinf
 #include "skyline.hh"
 #include "music.hh"
 #include "pitch.hh"
 #include "warn.hh"
 #include "note-column.hh"
-#include "group-interface.hh"
+#include "pointer-group-interface.hh"
 #include "note-collision.hh"
 #include "accidental-interface.hh"
 
@@ -32,7 +31,7 @@ Accidental_placement::alignment_callback (SCM s, SCM)
       position_accidentals (par);
     }
 
-  return scm_int2num (0);
+  return scm_from_int (0);
 }
 
 void
@@ -45,7 +44,7 @@ Accidental_placement::add_accidental (Grob *me, Grob *a)
   Music *mcause = unsmob_music (cause);
   if (!mcause)
     {
-      programming_error ("Note head has no music cause!");
+      programming_error ("note head has no music cause");
       return;
     }
 
@@ -53,13 +52,11 @@ Accidental_placement::add_accidental (Grob *me, Grob *a)
 
   int n = p->get_notename ();
 
-  SCM accs = me->get_property ("accidental-grobs");
-  SCM key = scm_int2num (n);
+  SCM accs = me->get_object ("accidental-grobs");
+  SCM key = scm_from_int (n);
   SCM entry = scm_assq (key, accs);
   if (entry == SCM_BOOL_F)
-    {
-      entry = SCM_EOL;
-    }
+    entry = SCM_EOL;
   else
     entry = scm_cdr (entry);
 
@@ -67,7 +64,7 @@ Accidental_placement::add_accidental (Grob *me, Grob *a)
 
   accs = scm_assq_set_x (accs, key, entry);
 
-  me->set_property ("accidental-grobs", accs);
+  me->set_object ("accidental-grobs", accs);
 }
 
 /*
@@ -78,13 +75,13 @@ 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);
+  for (SCM acs = accs->get_object ("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));
 
-       if (unsmob_grob (a->get_property ("tie")))
+       if (unsmob_grob (a->get_object ("tie")))
          break_reminder->push (a);
        else
          real_acc->push (a);
@@ -113,9 +110,7 @@ Accidental_placement::get_relevant_accidental_extent (Grob *me,
 
   Interval extent;
   for (int i = 0; i < which->size (); i++)
-    {
-      extent.unite (which->elem (i)->extent (item_col, X_AXIS));
-    }
+    extent.unite (which->elem (i)->extent (item_col, X_AXIS));
 
   if (!extent.is_empty ())
     {
@@ -237,7 +232,7 @@ Accidental_placement::position_accidentals (Grob *me)
   if (!me->is_live ())
     return SCM_UNSPECIFIED;
 
-  SCM accs = me->get_property ("accidental-grobs");
+  SCM accs = me->get_object ("accidental-grobs");
   if (!scm_is_pair (accs))
     return SCM_UNSPECIFIED;
 
@@ -295,17 +290,15 @@ Accidental_placement::position_accidentals (Grob *me)
       Grob *c = note_cols[i]->get_parent (X_AXIS);
       if (Note_collision_interface::has_interface (c))
        {
-         Link_array<Grob> gs
-           = extract_grob_array (c, ly_symbol2scm ("elements"));
+         extract_grob_set (c, "elements", gs);
 
          note_cols.concat (gs);
        }
     }
 
   for (int i = note_cols.size (); i--;)
-    {
-      heads.concat (extract_grob_array (note_cols[i], ly_symbol2scm ("note-heads")));
-    }
+    heads.concat (extract_grob_array (note_cols[i], "note-heads"));
+
   heads.default_sort ();
   heads.uniq ();
   common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
@@ -337,9 +330,7 @@ Accidental_placement::position_accidentals (Grob *me)
       Interval y;
 
       for (int j = apes[i]->extents_.size (); j--;)
-       {
-         y.unite (apes[i]->extents_[j][Y_AXIS]);
-       }
+       y.unite (apes[i]->extents_[j][Y_AXIS]);
       apes[i]->vertical_extent_ = y;
       total.unite (y);
     }
@@ -358,7 +349,7 @@ Accidental_placement::position_accidentals (Grob *me)
       insert_extent_into_skyline (&head_skyline, b, Y_AXIS, LEFT);
     }
 
-  head_ape-> left_skyline_ = head_skyline;
+  head_ape->left_skyline_ = head_skyline;
   head_ape->offset_ = 0.0;
 
   Real padding = robust_scm2double (me->get_property ("padding"), 0.2);
@@ -390,9 +381,7 @@ Accidental_placement::position_accidentals (Grob *me)
     {
       Accidental_placement_entry *ape = apes[i];
       for (int j = ape->grobs_.size (); j--;)
-       {
-         ape->grobs_[j]->translate_axis (ape->offset_, X_AXIS);
-       }
+       ape->grobs_[j]->translate_axis (ape->offset_, X_AXIS);
     }
 
   Interval left_extent, right_extent;