]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.5.43.rz1: 1.5.43.rz1
authorRune Zedeler <rune@lilypond.org>
Wed, 20 Mar 2002 01:50:11 +0000 (02:50 +0100)
committerRune Zedeler <rune@lilypond.org>
Wed, 20 Mar 2002 01:50:11 +0000 (02:50 +0100)
2002-03-20  Rune Zedeler <rune@zedeler.dk>

* lily/beaming-info.cc: Stupid typo fixed

* lily/accidental-engraver.cc: rewrote accidental-routines to get
support for cross-context auto-accidentals.
Now the engraver can stay in Staff-context and see other contexts
from there.
Changed properties: autoAccidentals, autoCautionaries

* lily/translator-group.cc (set_children_property):
Function added recursively setting the same property (deep_copied)
for all children of a Translator_group.

* ly/property-init.ly: added commands
\pianoAccidentals \voiceAccidentals
\modernVoiceAccidentals \modernVoiceCautionaries

* ly/engraver-init.ly: Correct initialization of new accidentals.

* scm/translator-property-description.scm: Updated

* input/regression/accidental-voice.ly: Added

* Documentation/regression-test.tely: Added new test

---
Generated by (address unknown),
>From = lilypond-1.5.43, To = lilypond-1.5.43.rz1

usage

    cd lilypond-source-dir; patch -E -p1 < lilypond-1.5.43.rz1.diff

Patches do not contain automatically generated files
or (urg) empty directories,
i.e., you should rerun autoconf, configure

14 files changed:
ChangeLog
Documentation/regression-test.tely
Documentation/topdocs/AUTHORS.texi
VERSION
input/regression/accidental-octave.ly
input/regression/accidental-voice.ly [new file with mode: 0644]
input/regression/accidentals.ly
lily/accidental-engraver.cc
lily/beaming-info.cc
lily/include/translator-group.hh
lily/translator-group.cc
ly/engraver-init.ly
ly/property-init.ly
scm/translator-property-description.scm

index 6e1811d6cc669bba81eae967bee6123f000c2b14..af429a62ad2ae615aab3720ba7579eb19bc683c5 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,4 +1,35 @@
-2002-03-20  Jan Nieuwenhuizen  <janneke@gnu.org>
+--- ../lilypond-1.5.43/ChangeLog       Tue Mar 19 01:50:26 2002
+++ b/ChangeLog Wed Mar 20 02:24:52 2002
+@@ -1,3 +1,29 @@
+2002-03-20  Rune Zedeler <rune@zedeler.dk>
+       
+       * lily/beaming-info.cc: Stupid typo fixed
+       
+       * lily/accidental-engraver.cc: rewrote accidental-routines to get
+       support for cross-context auto-accidentals.
+       Now the engraver can stay in Staff-context and see other contexts
+       from there.
+       Changed properties: autoAccidentals, autoCautionaries
+
+       * lily/translator-group.cc (set_children_property):
+       Function added recursively setting the same property (deep_copied)
+       for all children of a Translator_group.
+       
+       * ly/property-init.ly: added commands
+       \pianoAccidentals \voiceAccidentals
+       \modernVoiceAccidentals \modernVoiceCautionaries
+
+       * ly/engraver-init.ly: Correct initialization of new accidentals.
+       
+       * scm/translator-property-description.scm: Updated
+       
+       * input/regression/accidental-voice.ly: Added
+       
+       * Documentation/regression-test.tely: Added new test    
+       
+ 2002-03-19  Han-Wen  <hanwen@cs.uu.nl>
+       * VERSION: 1.5.43 released2002-03-20  Jan Nieuwenhuizen  <janneke@gnu.org>
 
        * mf/GNUmakefile (lilypond.map): Don't prepend TeX to font name
        (this fixes pdf output).  Drop awk dependency.
index d35558ed0d23c15d7d7d5199bc278e88d09ff975..aeeeb260cc39c3f2d062aae3654f310af7173747 100644 (file)
@@ -53,6 +53,8 @@ Accidentals are currently in a development stage.
 
 @lilypondfile[printfilename]{accidental-octave.ly}
 
+@lilypondfile[printfilename]{accidental-voice.ly}
+
 
 @section Stems
 
index f7d94f655ccde74fd083cb92630270eebc681caa..e57ae509acb2af6782921d638ba7532ea3a23690 100644 (file)
@@ -86,7 +86,7 @@ list is alphabetically ordered.
 @item @email{august@@infran.ru, August S.Sigov}
     Russian translation
 @item @email{rune@@zedeler.dk, Rune Zedeler}
-    Drum notation, beaming and accidental fixes 
+    Drum notation, beaming and auto-accidental changes. Font updates. Misc fixes.
 @end itemize
 
 @bye
diff --git a/VERSION b/VERSION
index 42ad48e313649860abb284a0b2b8e4f374fa0ce2..3f1105dc8bd6bb317aedc7e9afa02675e2fbaddb 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=43
-MY_PATCH_LEVEL=jcn2
+MY_PATCH_LEVEL=rz1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index 11962c970e9ec3710ecbf449dcbd61b3ca453ff7..f9bdb98024a619c1dc22362cd7699fd9f72690c8 100644 (file)
@@ -1,8 +1,9 @@
-\version "1.5.24.rz2"
+\version "1.5.43.rz1"
 
 \header {
 texidoc="
 This shows how accidentals in different octaves are handled.
+Fixme: Shorten and docu
 "
 }
 
@@ -47,14 +48,14 @@ mel = \notes \transpose c'' {
 mus = \notes {
    \mel
    \property Score.oneMeasureLazy = ##t
-   \property Score.autoAccidentals = #'((measure-same-octave . 0))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-same-octave . 1))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 1))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 0))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 1))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (same-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 1))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (same-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 0))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (any-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 1))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (any-octave . 1))" \mel >
    \modernAccidentals
    < s1^""^""^"$\\backslash$modernAccidentals" \mel >
    \modernCautionaries
diff --git a/input/regression/accidental-voice.ly b/input/regression/accidental-voice.ly
new file mode 100644 (file)
index 0000000..18ff739
--- /dev/null
@@ -0,0 +1,60 @@
+\version "1.5.43.rz1"
+
+\header{
+texidoc="
+This shows how modern cross voice auto cautionary accidentals are handled.
+The first two fisses get accidentals because they belong to different voices.
+The first f gets cautionary natural because of previous measure.
+The last f gets cautionary natural because fis was only in the other voice.
+"
+}
+
+#(define  (lo-octave p)
+  (let* ((a (pitch-alteration p))
+         (n (pitch-notename p)))
+    (make-pitch -1 n a)))
+
+#(define (no-octaves music)
+  (let* ((es (ly-get-mus-property music 'elements))
+         (e (ly-get-mus-property music 'element))
+         (p (ly-get-mus-property music 'pitch)))
+
+    (if (pair? es)
+        (ly-set-mus-property
+         music 'elements
+         (map no-octaves es)))
+
+    (if (music? e)
+        (ly-set-mus-property
+         music 'element
+         (no-octaves e)))
+
+    (if (pitch? p)
+        (begin
+          (set! p (lo-octave p))
+          (ly-set-mus-property music 'pitch p)))
+
+
+    music))
+
+voicea = \notes \transpose c'' {
+    \stemUp
+    fis2 a2 f4 fis a2
+}
+voiceb = \notes \transpose c'' {
+    \stemDown
+    c2 fis2  f4 c   f2
+}
+
+\score {
+    <
+       \notes
+       \context NoteNames=namesa \apply #no-octaves \voicea
+       \context Staff < 
+           \modernVoiceCautionaries
+           \context Voice = voicea \voicea
+           \context Voice = voiceb \voiceb
+       >
+       \context NoteNames=namesb \apply #no-octaves \voiceb
+    >
+}
index 71a534d1b43c802df97b53d27336f5ce95d755b5..42b957eac0591a5e5d614666d91e07b874831b1b 100644 (file)
@@ -1,4 +1,4 @@
-\version "1.5.24.rz2"
+\version "1.5.43.rz1"
 
 \header{
 texidoc="
@@ -45,14 +45,14 @@ mel = \notes { \key d \major \time 4/4
   \context Staff \transpose c''' {
    \mel
    \property Score.oneMeasureLazy = ##t
-   \property Score.autoAccidentals = #'((measure-same-octave . 0))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-same-octave . 1))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 1))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 0))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 1))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((same-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 1))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((same-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 0))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((any-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 1))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((any-octave . 1))" \mel >
    \modernAccidentals
    < s1^"$\\backslash$modernAccidentals" \mel >
    \modernCautionaries
index 14dd955cd3a18914530f1a594bb57a87e3119ae7..5b476a05cb8dd922f4fe61228761046c7a4832e9 100644 (file)
@@ -2,7 +2,7 @@
   accidental-engraver.cc -- implement accidental_engraver
 
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  Modified 2001 by Rune Zedeler <rz@daimi.au.dk>
+  Modified 2001-2002 by Rune Zedeler <rz@daimi.au.dk>
 */
 
 #include "musical-request.hh"
@@ -19,6 +19,8 @@
 #include "arpeggio.hh"
 #include "warn.hh"
 
+#include "translator-group.hh"
+
 /**
 
 
@@ -43,7 +45,7 @@ protected:
   virtual void finalize ();
 public:
 
-  // todo -> property
+  // todo -> property   (why? -rz)
   SCM last_keysig_;
 
   /*
@@ -56,6 +58,7 @@ public:
   Link_array<Grob> head_l_arr_;
   Link_array<Item> forced_l_arr_;
   Link_array<Grob> tie_l_arr_;
+  Link_array<Translator_group> origin_l_arr_;
 
 };
 
@@ -70,14 +73,22 @@ void
 Accidental_engraver::initialize ()
 {
   last_keysig_ = get_property ("keySignature");
-  daddy_trans_l_->set_property ("localKeySignature",  last_keysig_);  
+
+  Translator_group * trans_ = daddy_trans_l_;
+  while (trans_) {
+    trans_ -> set_property ("localKeySignature",  ly_deep_copy(last_keysig_));
+    trans_ = trans_->daddy_trans_l_;
+  }
+  daddy_trans_l_->set_children_property("localKeySignature",last_keysig_);
+
 }
 
 /** calculates the number of accidentals on basis of the current local key sig
-  * (passed as argument).
+  * (passed as argument)
   * Returns number of accidentals (0, 1 or 2).
   *   Negative (-1 or -2) if accidental has changed.
   **/
+// FIXME: Use references for SCM-values
 static int
 number_accidentals (SCM sig, Note_req * note_l, SCM curbarnum, SCM lazyness,
                    bool ignore_octave_b)
@@ -114,31 +125,46 @@ number_accidentals (SCM sig, Note_req * note_l, SCM curbarnum, SCM lazyness,
   return a==p ? num : -num;
 }
 
-static int
-number_accidentals (SCM localsig, Note_req * note_l, SCM accidentals_l,
-                   SCM curbarnum) {
+int
+number_accidentals (Note_req * note_l, Translator_group * origin_l,
+                   SCM accidentals_sl, SCM curbarnum_s) {
   int number=0;
   int diff=0;
-  while(gh_pair_p(accidentals_l)) {
-    if(gh_pair_p(ly_car(accidentals_l))) {
-      SCM type = gh_caar(accidentals_l);
-      SCM lazyness = gh_cdar(accidentals_l);
-      bool measure_same_octave_b =
-       gh_eq_p(ly_symbol2scm("measure-same-octave"),type);
-      bool measure_any_octave_b =
-       gh_eq_p(ly_symbol2scm("measure-any-octave"),type);
-      if(measure_same_octave_b || measure_any_octave_b) {
+  if(gh_pair_p(accidentals_sl) && !gh_symbol_p(ly_car(accidentals_sl)))
+    warning(_f("Accidental typesetting list must begin with context-name: %s",
+              ly_scm2string(ly_car(accidentals_sl)).ch_C()));
+  while(gh_pair_p(accidentals_sl) && origin_l) {
+    // If pair then it is a new accidentals typesetting rule to be checked
+    if(gh_pair_p(ly_car(accidentals_sl))) {
+      SCM type = gh_caar(accidentals_sl);
+      SCM lazyness = gh_cdar(accidentals_sl);
+      SCM localsig = origin_l->get_property ("localKeySignature");
+      bool same_octave_b =
+       gh_eq_p(ly_symbol2scm("same-octave"),type);
+      bool any_octave_b =
+       gh_eq_p(ly_symbol2scm("any-octave"),type);
+      if(same_octave_b || any_octave_b) {
        int n = number_accidentals
-         (localsig,note_l,curbarnum,lazyness,measure_any_octave_b);
+         (localsig,note_l,curbarnum_s,lazyness,any_octave_b);
        diff |= n<0;
        number = max(number,abs(n));     
       }
-      else warning(_f("unknown accidental typesetting: %s",
+      else warning(_f("unknown accidental typesetting: %s. Ignored",
                      ly_symbol2string(type).ch_C()));
     }
-    else warning(_f("Accidental typesetting must be pair: %s",
-                     ly_scm2string(ly_car(accidentals_l)).ch_C()));
-    accidentals_l = ly_cdr(accidentals_l);
+    // if symbol then it is a context name. Scan parent contexts to find it.
+    else if (gh_symbol_p(ly_car(accidentals_sl))) {
+      String context = ly_symbol2string(ly_car(accidentals_sl));
+      while (origin_l && !origin_l->is_alias_b(context)) {
+        origin_l = origin_l->daddy_trans_l_;
+      }
+      if (!origin_l)
+       warning(_f("Symbol is not a parent context: %s. Ignored",
+                  context.ch_C()));
+    }
+    else warning(_f("Accidental typesetting must be pair or context-name: %s",
+                     ly_scm2string(ly_car(accidentals_sl)).ch_C()));
+    accidentals_sl = ly_cdr(accidentals_sl);
   }
   return diff ? -number : number;
 }
@@ -148,9 +174,9 @@ Accidental_engraver::create_grobs ()
 {
   if (!key_item_p_ && mel_l_arr_.size ()) 
     {
-      SCM localsig = get_property ("localKeySignature");
-      SCM accidentals_l =  get_property ("autoAccidentals");
-      SCM cautionaries_l =  get_property ("autoCautionaries");
+      //SCM localsig = get_property ("localKeySignature");
+      SCM accidentals_sl =  get_property ("autoAccidentals");
+      SCM cautionaries_sl =  get_property ("autoCautionaries");
       SCM barnum = get_property ("currentBarNumber");
 
       bool extra_natural_b = get_property ("extraNatural")==SCM_BOOL_T;
@@ -158,9 +184,10 @@ Accidental_engraver::create_grobs ()
        {
          Grob * support_l = head_l_arr_[i];
          Note_req * note_l = mel_l_arr_[i];
+         Translator_group * origin_l = origin_l_arr_[i];
 
-         int num = number_accidentals(localsig,note_l,accidentals_l,barnum);
-         int num_caut = number_accidentals(localsig,note_l,cautionaries_l,barnum);
+         int num = number_accidentals(note_l,origin_l,accidentals_sl,barnum);
+         int num_caut = number_accidentals(note_l,origin_l,cautionaries_sl,barnum);
          bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
          if (abs(num_caut)>abs(num))
            {
@@ -178,8 +205,8 @@ Accidental_engraver::create_grobs ()
 
          Grob *tie_break_reminder = 0;
          bool tie_changes = false;
-         for (int i=0; i < tie_l_arr_.size (); i++)
-           if (support_l == Tie::head (tie_l_arr_[i], RIGHT))
+         for (int j=0; j < tie_l_arr_.size (); j++)
+           if (support_l == Tie::head (tie_l_arr_[j], RIGHT))
              {
                tie_changes = different;
                /* Enable accidentals for broken tie
@@ -189,7 +216,7 @@ Accidental_engraver::create_grobs ()
                   
                   Maybe check property noTieBreakForceAccidental? */
                if (different)
-                 tie_break_reminder = tie_l_arr_[i];
+                 tie_break_reminder = tie_l_arr_[j];
                break;
              }
 
@@ -231,30 +258,40 @@ Accidental_engraver::create_grobs ()
          int n = pitch->notename_i_;
          int o = pitch->octave_i_;
          int a = pitch->alteration_i_;
-         SCM on = gh_cons (gh_int2scm (o), gh_int2scm (n));
-         if (tie_changes)
-           {
-             /*
-               Remember an alteration that is different both from
-               that of the tied note and of the key signature.
-              */
-             localsig = ly_assoc_front_x
-               (localsig, on, gh_cons(SCM_BOOL_T,barnum));
-           }
-         else
-           {
-             /*
-               not really really correct if there are more than one
-               noteheads with the same notename.
-              */
-             localsig = ly_assoc_front_x
-               (localsig, on, gh_cons(gh_int2scm (a),barnum)); 
-           }
-        }
-  
-      daddy_trans_l_->set_property ("localKeySignature",  localsig);
+         SCM on_s = gh_cons (gh_int2scm (o), gh_int2scm (n));
+
+         /*
+           TODO: Speed this up!
+           Perhaps only check translators mentioned in the auto-accidentals?
+           -rz
+         */
+         Translator_group * trans_ = origin_l_arr_[i];
+         while (trans_) {
+           SCM localsig = trans_->get_property ("localKeySignature");
+           if (tie_changes)
+             {
+               /*
+                 Remember an alteration that is different both from
+                 that of the tied note and of the key signature.
+               */
+               localsig = ly_assoc_front_x
+                 (localsig, on_s, gh_cons(SCM_BOOL_T,barnum));
+             }
+           else
+             {
+               /*
+                 not really really correct if there are more than one
+                 noteheads with the same notename.
+               */
+               localsig = ly_assoc_front_x
+                 (localsig, on_s, gh_cons(gh_int2scm (a),barnum)); 
+             }
+           trans_->set_property ("localKeySignature",  localsig);
+           trans_ = trans_->daddy_trans_l_;
+         }
+       }
     }
-  
+
   
   if (key_item_p_)
     {
@@ -293,7 +330,8 @@ Accidental_engraver::stop_translation_timestep ()
   arpeggios_.clear ();
   tie_l_arr_.clear ();
   head_l_arr_.clear ();
-  forced_l_arr_.clear ();      
+  forced_l_arr_.clear ();
+  origin_l_arr_.clear ();
 }
 
 void
@@ -305,6 +343,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info)
     {
       mel_l_arr_.push (note_l);
       head_l_arr_.push (info.grob_l_);
+      origin_l_arr_.push (info.origin_trans_l_->daddy_trans_l_);
     }
   else if (Tie::has_interface (info.grob_l_))
     {
@@ -327,12 +366,19 @@ Accidental_engraver::process_music ()
   
   SCM sig = get_property ("keySignature");
 
-  /* Detect key sig changes. */
-  if (last_keysig_ != sig) 
-    {
-      daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
-      last_keysig_ = sig;
+  /* Detect key sig changes.
+     Update all parents and children
+     */
+  if (last_keysig_ != sig) {
+    Translator_group * trans_ = daddy_trans_l_;
+    while (trans_) {
+      trans_ -> set_property ("localKeySignature",  ly_deep_copy(sig));
+      trans_ = trans_->daddy_trans_l_;
     }
+    daddy_trans_l_->set_children_property("localKeySignature",sig);
+
+    last_keysig_ = sig;
+  }
 }
 
 
@@ -340,6 +386,7 @@ Accidental_engraver::process_music ()
 
 
 ENTER_DESCRIPTION(Accidental_engraver,
+/* The FIXME below is deprecated and should be removed. -rz */
 /* descr */       "Make accidentals.  Catches note heads, ties and notices key-change
 events.  Due to interaction with ties (which don't come together
 with note heads), this needs to be in a context higher than Tie_engraver. FIXME",
index c9751f049bec5704c130836c317aaa7dafac57a1..35ba768395db13930ea8c0cf68e886fe4377f810 100644 (file)
@@ -38,7 +38,7 @@ Beaming_info_list::best_splitpoint_index (Moment &beat_length,bool subdivide) co
       beat_pos = infos_[i].start_mom_ / beat_length;
       int den = beat_pos.den ();
       if (infos_[i].beams_i_drul_[LEFT] == infos_[i-1].beams_i_drul_[RIGHT] && !subdivide)
-       den *= 4;
+       den *= 2;
       if (den < minden)
        {
          minidx = i;
index 74a3490d3cf4840ac0e780f13da219094d2d5ac1..1b7069e74046a77f2e246460fb34d837c9d1e195 100644 (file)
@@ -20,6 +20,7 @@
 // egcs
 typedef void (Translator::*Method_pointer) (void);
 #define set_property(x,y) internal_set_property(ly_symbol2scm(x),y)
+#define set_children_property(x,y) internal_set_children_property(ly_symbol2scm(x),y)
 
 class Scheme_hash_table;
 
@@ -43,6 +44,7 @@ public:
 
   void unset_property (SCM var_sym);
   void internal_set_property (SCM var_sym, SCM value);  
+  void internal_set_children_property (SCM var_sym, SCM value);  
   Translator_group *where_defined (SCM name_sym) const;
 
   String id_str_;
index 2938b2b7cd7b1cbdb3ca74a2d0c33db471410b8e..aee0c2309c1638d24e35ab2b2e6e6ec8858d5ac0 100644 (file)
@@ -312,6 +312,16 @@ Translator_group::internal_set_property (SCM sym, SCM val)
   properties_dict ()->set (sym, val);
 }
 
+void
+Translator_group::internal_set_children_property (SCM sym, SCM val)
+{
+  internal_set_property (sym, val);
+  for (SCM p = trans_group_list_; gh_pair_p (p); p = ly_cdr(p)) {
+    Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
+    trg->internal_set_children_property(sym,ly_deep_copy(val));
+  }
+}
+
 /*
   TODO: look up to check whether we have inherited var? 
  */
index 2db5d63839bfcb85d5ff8cc2aa2fefbec8c09ee9..ece252544365a7e3dd2f5eab7f740891558f06e4 100644 (file)
@@ -38,6 +38,7 @@ StaffContext=\translator {
        MinimumVerticalExtent = #'(-4 . 4)
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
+       localKeySignature = #'()
 
        % explicitly set instrument, so we don't get 
        % weird effects when doing instrument names for
@@ -56,7 +57,8 @@ StaffContainerContext = \translator {
        MinimumVerticalExtent = ##f
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
-       
+       localKeySignature = #'()
+
        \accepts Staff
        \name StaffContainer
 }
@@ -67,6 +69,7 @@ InnerChoirStaffContext = \translator {
        alignmentReference = #0
        \consists "System_start_delimiter_engraver"
        systemStartDelimiter = #'SystemStartBracket
+       localKeySignature = #'()
 
        \accepts "Staff"
        \accepts "RhythmicStaff"
@@ -92,6 +95,7 @@ RhythmicStaffContext=\translator{
        MinimumVerticalExtent = ##f
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
+       localKeySignature = #'()
 
        \consists "Pitch_squash_engraver"
        \consists "Separating_line_group_engraver"      
@@ -118,6 +122,7 @@ VoiceContext = \translator {
        \name Voice
 
        Generic_property_list = #generic-voice-properties
+       localKeySignature = #'()
        \consists "Font_size_engraver"
        
        % must come before all
@@ -162,6 +167,7 @@ VoiceContext = \translator {
 ThreadContext = \translator{
        \type Engraver_group_engraver
        \name Thread
+       localKeySignature = #'()
 
        \consists "Font_size_engraver"  
        \consists "Thread_devnull_engraver"
@@ -175,6 +181,7 @@ ThreadContext = \translator{
 GrandStaffContext=\translator{
        \type "Engraver_group_engraver"
        \name GrandStaff
+       localKeySignature = #'()
        \consists "Span_bar_engraver"
        \consists "Span_arpeggio_engraver"
        \consists "System_start_delimiter_engraver"
@@ -186,6 +193,7 @@ GrandStaffContext=\translator{
 PianoStaffContext = \translator{
        \GrandStaffContext
        \name "PianoStaff"
+       \alias "GrandStaff"
 
        \consists "Vertical_align_engraver"
        \consists "Instrument_name_engraver"
@@ -202,6 +210,7 @@ PianoStaffContext = \translator{
 InnerStaffGroupContext= \translator {
        \type "Engraver_group_engraver"
        \name InnerStaffGroup
+       localKeySignature = #'()
 
        \consists "Span_bar_engraver"
        \consists "Span_arpeggio_engraver"
@@ -323,6 +332,7 @@ HaraKiriStaffContext = \translator {
 ScoreContext = \translator {
        \type Score_engraver
        \name Score
+       localKeySignature = #'()
        
        \consists "Repeat_acknowledge_engraver"
        \consists "Staff_collecting_engraver"
@@ -388,7 +398,7 @@ ScoreContext = \translator {
        
        subdivideBeams = ##f
        extraNatural = ##t
-       autoAccidentals = #'((measure-same-octave . 0))
+       autoAccidentals = #'(Staff (same-octave . 0))
        autoCautionaries = #'()  
 
 
index 5601b73a3343c431ec483fe1825268f0aa796f56..c203bd6632e4d4300fdf3f05437ad3643d3e4043 100644 (file)
@@ -133,8 +133,17 @@ hideStaffSwitch = \property Voice.followVoice = ##f
 % accidentals as they were common in the 18th century.
 defaultAccidentals = {
   \property Score.extraNatural = ##t
-  \property Score.autoAccidentals = #'((measure-same-octave . 0))
-  \property Score.autoCautionaries = #'()  
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+  \property Score.autoCautionaries = #'()
+}
+
+% accidentals in voices instead of staves.
+% Notice that accidentals from one voice do NOT get cancelled in other voices
+voiceAccidentals = {
+  \property Score.extraNatural = ##t
+  \property Score.autoAccidentals = #'(Voice (same-octave . 0))
+  \property Score.autoCautionaries = #'()
+  
 }
 
 % accidentals as suggested by Kurt Stone, Music Notation in the 20th century.
@@ -142,22 +151,57 @@ defaultAccidentals = {
 % in other octaves and in the next measure.
 modernAccidentals = {
   \property Score.extraNatural = ##f
-  \property Score.autoAccidentals = #'((measure-same-octave . 0) (measure-any-octave . 0) (measure-any-octave . 1))
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0) (any-octave . 0) (any-octave . 1))
   \property Score.autoCautionaries = #'()  
 }
 
 % the accidentals that Stone adds to the old standard as cautionaries
 modernCautionaries = {
   \property Score.extraNatural = ##f
-  \property Score.autoAccidentals = #'((measure-same-octave . 0))
-  \property Score.autoCautionaries = #'((measure-any-octave . 0) (measure-any-octave . 1))  
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+  \property Score.autoCautionaries = #'(Staff (any-octave . 0) (any-octave . 1))  
+}
+
+% Multivoice accidentals to be read both by musicians playing one voice
+% and musicians playing all voices.
+% Accidentals are typeset for each voice, but they ARE cancelled across voices.
+modernVoiceAccidentals = {
+  \property Staff.extraNatural = ##f
+  \property Staff.autoAccidentals = #'(
+    Voice (same-octave . 0) (any-octave . 0) (any-octave . 1)
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+  )
+  \property Staff.autoCautionaries = #'()  
+}
+
+% same as modernVoiceAccidental eccept that all special accidentals are typeset
+% as cautionaries
+modernVoiceCautionaries = {
+  \property Staff.extraNatural = ##f
+  \property Staff.autoAccidentals = #'(
+    Voice (same-octave . 0) 
+  )
+  \property Staff.autoCautionaries = #'(
+    Voice (any-octave . 0) (any-octave . 1)
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+  )  
+}
+
+% stone's suggestions for accidentals on grand staff.
+% Accidentals are cancelled across the staves in the same grand staff as well
+pianoAccidentals = {
+  \property GrandStaff.autoAccidentals = #'(
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+    GrandStaff (any-octave . 1)
+  )
+  \property GrandStaff.autoCautionaries = #'()  
 }
 
 % Do not reset the key at the start of a measure.  Accidentals will be
 % printed only once and are in effect until overridden, possibly many
 % measures later.
 noResetKey = {
-  \property Score.autoAccidentals = #'((measure-same-octave . #t))
+  \property Score.autoAccidentals = #'(Staff (same-octave . #t))
   \property Score.autoCautionaries = #'()
 }
 
@@ -167,7 +211,7 @@ noResetKey = {
 % remembered for the duration of a measure.
 % accidentals not being remembered, causing accidentals always to be typeset relative to the time signature
 forgetAccidentals = {
-  \property Score.autoAccidentals = #'((measure-same-octave . -1))
+  \property Score.autoAccidentals = #'(Staff (same-octave . -1))
   \property Score.autoCautionaries = #'()  
 }
 
index 8cfeb298ca60a868a8a92f483fc60d64545e7913..9c7474ef2e6fde507a7903fd2cc565b1b3245442 100644 (file)
@@ -85,18 +85,23 @@ The head of the list:
 (translator-property-description 'autoAccidentals list? "List of
 different ways to typeset an accidental. All algorithms in the list
 are tried, and the one returning the most accidentals is used.
-Each algorithm-description is a name-value pair.
+Each entry is either a symbol containg a context name or a name-value
+pair containing an algorithm-description.
+The list must begin with a symbol (context name).
+The symbols denote in which context THE FOLLOWING algorithms (until next symbol) 
+will be interpreted. All notes in the interpretation context will share accidentals.
+The contexts must be stated in order, innermost first.
 The algorithms are:
 @table @samp
-@item measure-same-octave:
+@item same-octave:
 This is the default algorithm. Accidentals are typeset if the note changes
 the accidental of that note in that octave. Accidentals lasts to the end of the measure 
 and then as many measures as specified in the value. I.e. 1 means to the end
-of next measure, -1 means to the end of previous measure (that is: no duration at all), etc.
-@item measure-any-octave:
+of next measure, -1 means to the end of previous measure (that is: no duration at all), etc. #t means forever.
+@item any-octave:
 Accidentals are typeset if the note is different from 
 the previous note on the same pitch in any octave. The value has same meaning as in
-measure-same-octave.
+same-octave.
 @end table
 ")