]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/accidental-engraver.cc
* input/regression/key-signature-cancellation.ly (Module): new file.
[lilypond.git] / lily / accidental-engraver.cc
index 31e0998c9e00e1cb7611c6c9f9260caa7be46e93..d74ac87635e00aa501e3fc56f68994655a703e66 100644 (file)
@@ -10,7 +10,6 @@
 #include "accidental-placement.hh"
 #include "arpeggio.hh"
 #include "context.hh"
-#include "engraver-group-engraver.hh"
 #include "engraver.hh"
 #include "event.hh"
 #include "item.hh"
@@ -29,6 +28,7 @@ public:
   Music *melodic_;
   Grob *accidental_;
   Context *origin_;
+  Engraver *origin_trans_;
   Grob *head_;
   bool tied_;
 
@@ -151,12 +151,12 @@ number_accidentals_from_sig (bool *different, SCM sig, Pitch *pitch,
       if (ly_c_pair_p (prev_local))
        {
          if (ly_c_pair_p (ly_cdr (prev_local))
-             && ly_c_number_p (laziness))
+             && scm_is_number (laziness))
            {
-             int barnum = ly_scm2int (ly_cddr (prev_local));
+             int barnum = scm_to_int (ly_cddr (prev_local));
 
              prev_local = scm_cons (ly_car (prev_local), ly_cadr (prev_local));
-             if (curbarnum <= barnum + ly_scm2int (laziness))
+             if (curbarnum <= barnum + scm_to_int (laziness))
                prev_alt = prev_local;
            }
        }
@@ -168,10 +168,10 @@ number_accidentals_from_sig (bool *different, SCM sig, Pitch *pitch,
   prev_alt =  (prev_alt == SCM_BOOL_F) ? scm_int2num (0) : ly_cdr (prev_alt); 
     
   /* UGH. prev_acc can be #t in case of ties. What is this for?  */
-  int p = ly_c_number_p (prev_alt) ? ly_scm2int (prev_alt) : 0;
+  int p = scm_is_number (prev_alt) ? scm_to_int (prev_alt) : 0;
 
   int num;
-  if (a == p && ly_c_number_p (prev_alt))
+  if (a == p && scm_is_number (prev_alt))
     num = 0;
   else if ( (abs (a)<abs (p) || p*a<0) && a != 0 )
     num = 2;
@@ -190,7 +190,7 @@ number_accidentals (bool *different,
   int number = 0;
 
   *different = false;
-  if (ly_c_pair_p (accidentals) && !ly_c_symbol_p (ly_car (accidentals)))
+  if (ly_c_pair_p (accidentals) && !scm_is_symbol (ly_car (accidentals)))
     warning (_f ("Accidental typesetting list must begin with context-name: %s", 
                 ly_scm2string (ly_car (accidentals)).to_str0 ()));
   
@@ -206,9 +206,9 @@ number_accidentals (bool *different,
          SCM localsig = origin->get_property ("localKeySignature");
          
          bool same_octave_b = 
-           ly_c_eq_p (ly_symbol2scm ("same-octave"), type);
+           scm_is_eq (ly_symbol2scm ("same-octave"), type);
          bool any_octave_b = 
-           ly_c_eq_p (ly_symbol2scm ("any-octave"), type);
+           scm_is_eq (ly_symbol2scm ("any-octave"), type);
 
          if (same_octave_b || any_octave_b)
            {
@@ -227,7 +227,7 @@ number_accidentals (bool *different,
       /*
        if symbol then it is a context name. Scan parent contexts to find it.
       */
-      else if (ly_c_symbol_p (rule))
+      else if (scm_is_symbol (rule))
        {
          Context *dad = origin;
          while (dad && !dad->is_alias (rule))
@@ -317,7 +317,7 @@ Accidental_engraver::process_acknowledged_grobs ()
                Accidental from the respective Voice.
               */
              Grob *a
-               = make_item_from_properties (origin->implementation (),
+               = make_item_from_properties (accidentals_[i].origin_trans_,
                                             ly_symbol2scm ("Accidental"),
                                             note->self_scm ());
              a->set_parent (support, Y_AXIS);
@@ -455,6 +455,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info)
          
          Accidental_entry entry ;
          entry.head_ = info.grob_;
+         entry.origin_trans_ = dynamic_cast<Engraver*> (info.origin_trans_);
          entry.origin_ = info.origin_trans_->context ();
          entry.melodic_ = note;