]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.122
authorfred <fred>
Wed, 27 Mar 2002 00:35:23 +0000 (00:35 +0000)
committerfred <fred>
Wed, 27 Mar 2002 00:35:23 +0000 (00:35 +0000)
lily/local-key-engraver.cc

index 9d921602b0584b26089366fd000c7ee8507ee346..2bad4ea824c033d8cdf2ec335e2b182339c98211 100644 (file)
@@ -94,9 +94,10 @@ Local_key_engraver::create_grobs ()
          SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), localsig);
          if (prev == SCM_BOOL_F)
            prev = scm_assoc (gh_int2scm (n), localsig);
-         int prev_acc = (prev == SCM_BOOL_F) ? 0 : gh_scm2int (gh_cdr (prev));
-         bool different = prev_acc != a;
-         
+         SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm(0) : gh_cdr (prev);
+         bool different = !gh_equal_p(prev_acc , gh_int2scm(a));
+         int p = gh_number_p(prev_acc) ? gh_scm2int(prev_acc) : 0;
+
          bool tie_changes = tied_l_arr_.find_l (support_l) && different;
          if ((to_boolean (note_l->get_mus_property ("force-accidental"))
              || different) && !tie_changes)
@@ -114,8 +115,8 @@ Local_key_engraver::create_grobs ()
 
              
              bool extra_natural =
-               sign (prev_acc) * (prev_acc - a) == 1
-               && abs(prev_acc) == 2;
+               sign (p) * (p - a) == 1
+               && abs(p) == 2;
 
              Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")),
                                         to_boolean (note_l->get_mus_property ("cautionary")),
@@ -132,7 +133,18 @@ Local_key_engraver::create_grobs ()
 
           */
          bool forget = to_boolean (get_property ("forgetAccidentals"));
-         if (!forget && !tie_changes)
+         if (tie_changes)
+           {
+             /*
+               Remember an alteration that is different both from
+               that of the tied note and of the key signature.
+              */
+             localsig = scm_assoc_set_x (localsig, gh_cons (gh_int2scm (o),
+                                                            gh_int2scm (n)),
+                                         SCM_BOOL_T); 
+
+           }
+         else if (!forget)
            {
              /*
                not really really correct if there are more than one