]> git.donarmstrong.com Git - lilypond.git/commitdiff
Fix #106 and problems with 'modern accidental style.
authorRune Zedeler <rune@lilypond.org>
Tue, 19 Dec 2006 09:38:28 +0000 (10:38 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Tue, 19 Dec 2006 09:38:28 +0000 (10:38 +0100)
lily/accidental-engraver.cc

index 9d671c11e610a0e34420ca703689247d4ba382ef..5a15fbbd364a5d170524c3bb9cd1a101855f047f 100644 (file)
@@ -66,7 +66,6 @@ protected:
   void acknowledge_finger (Grob_info);
 
   void stop_translation_timestep ();
-  virtual void initialize ();
   void process_acknowledged ();
   virtual void finalize ();
   virtual void derived_mark () const;
@@ -120,21 +119,17 @@ Accidental_engraver::update_local_key_signature ()
 
   Context *trans = context ()->get_parent_context ();
 
-  /* Huh. Don't understand what this is good for. --hwn.  */
+  /* Reset parent contexts so that e.g. piano-accidentals won't remember old
+     cross-staff accidentals after key-sig-changes */
 
   SCM val;
-  while (trans && trans->where_defined (ly_symbol2scm ("localKeySignature"), &val))
+  while (trans && trans->where_defined (ly_symbol2scm ("localKeySignature"), &val)==trans)
     {
       trans->set_property ("localKeySignature", ly_deep_copy (last_keysig_));
       trans = trans->get_parent_context ();
     }
 }
 
-void
-Accidental_engraver::initialize ()
-{
-  update_local_key_signature ();
-}
 
 /** Calculate the number of accidentals on basis of the current local key
     sig (passed as argument)
@@ -194,10 +189,14 @@ number_accidentals_from_sig (bool *different, SCM sig, Pitch *pitch,
       SCM entry = scm_car (s);
       if (scm_is_pair (scm_car (entry))
          && scm_cdar (entry) == scm_from_int (n))
-       from_other_octaves = scm_cdr (entry);
+       {
+         from_other_octaves = scm_cdr (entry);
+         break;
+       }
     }
 
-  if (from_same_octave != SCM_BOOL_F
+  if (!ignore_octave
+      && from_same_octave != SCM_BOOL_F
       && recent_enough (bar_number, from_same_octave, laziness))
     previous_alteration = from_same_octave;
   else if (ignore_octave