]> git.donarmstrong.com Git - lilypond.git/commitdiff
patch::: 1.5.24.rz2: Accidentals Patch 1.5.24
authorRune Zedeler <rune@lilypond.org>
Wed, 5 Dec 2001 00:38:45 +0000 (01:38 +0100)
committerRune Zedeler <rune@lilypond.org>
Wed, 5 Dec 2001 00:38:45 +0000 (01:38 +0100)
14 files changed:
ChangeLog
Documentation/regression-test.tely
VERSION
input/regression/accidental-octave.ly [new file with mode: 0644]
input/regression/accidental-single-double.ly
input/regression/accidentals.ly [new file with mode: 0644]
input/test/accidentals.ly
lily/accidental-engraver.cc
lily/include/lily-guile.hh
lily/lily-guile.cc
ly/engraver-init.ly
ly/property-init.ly
scm/music-functions.scm
scm/translator-property-description.scm

index 162b8efefd38456b4cde2d24162d15b64797fdc4..efacdd12d73f9effa147bbe1ea915c70c7c0e7f1 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,29 @@
+2001-12-03 Rune Zedeler <rune@zedeler.dk>
+
+       * lily/lily-guile.cc: Added ly_assoc_front_x() and ly_assoc_cdr()
+       (FIXME: not accessible from guile)
+       
+       * lily/accidental-engraver.cc: rewrote accidental-routines to get
+       better support for Kurt Stone's suggestions.
+       Removed properties: noResetKey, autoReminders.
+       Added properties:   oneMeasureLazy, extraNatural, autoAccidentals,
+                           autoCautionaries.
+       
+       * ly/property-init.ly: added commands
+       \defaultAccidentals \modernAccidentals \modernCautionaries
+       \noResetKey
+
+       * ly/engraver-init.ly: Correct initialization of new accidentals.
+
+       * scm/translator-property-description.scm: The new properties
+       added.
+
+       * input/: Some examples added, some changed.
+       
+       * Documentation/regression-test.tely: Added quick test of new
+       accidentals.
+       
+       
 2001-12-01  Han-Wen  <hanwen@cs.uu.nl>
 
        * lily/note-head.cc (head_extent): added to compute width without
 2001-12-01  Han-Wen  <hanwen@cs.uu.nl>
 
        * lily/note-head.cc (head_extent): added to compute width without
index 3876f3b648e66b36b661ee2e1ab95f9ca2c5978d..0f7791c577248d13f890472a80787b1554d99c2f 100644 (file)
@@ -35,14 +35,23 @@ documenting bugfixes.
 
 @lilypondfile[printfilename]{dots.ly}
 
 
 @lilypondfile[printfilename]{dots.ly}
 
-@lilypondfile[printfilename]{accidental.ly}
-
 @lilypondfile[printfilename]{multi-measure-rest.ly}
 
 @lilypondfile[printfilename]{mm-rests2.ly}
 
 @lilypondfile[printfilename]{multi-measure-rest.ly}
 
 @lilypondfile[printfilename]{mm-rests2.ly}
 
+
+@section Accidentals
+
+Accidentals are currently in a development stage.
+
+@lilypondfile[printfilename]{accidental.ly}
+
 @lilypondfile[printfilename]{accidental-single-double.ly}
 
 @lilypondfile[printfilename]{accidental-single-double.ly}
 
+@lilypondfile[printfilename]{accidentals.ly}
+
+@lilypondfile[printfilename]{accidental-octave.ly}
+
 
 @section Stems
 
 
 @section Stems
 
diff --git a/VERSION b/VERSION
index 376d694c28904d47a5b4dee79bc74963c56cc9c1..02b981f6dda501ff0cb55213cd84aa2faee784ac 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=24
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=24
-MY_PATCH_LEVEL=jcn1
+MY_PATCH_LEVEL=rz2
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff --git a/input/regression/accidental-octave.ly b/input/regression/accidental-octave.ly
new file mode 100644 (file)
index 0000000..54ba4fb
--- /dev/null
@@ -0,0 +1,74 @@
+\version "1.5.24.rz2"
+
+\header {
+texidoc="
+This shows how accidentals in different octaves are handled.
+"
+}
+
+#(define  (central-octave p)
+  (let* ((a (pitch-alteration p))
+         (n (pitch-notename p)))
+    (make-pitch 0 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 (central-octave p))
+          (ly-set-mus-property music 'pitch p)))
+
+
+    music))
+
+
+\include "paper16.ly"
+
+mel = \notes \transpose c'' {
+  \time 4/4 \key d \major
+  gis4 g' g gis' | gis2 g' | g1 | gis | g | gis | g' |
+  fis4 f' f fis' | fis2 f' | f1 | fis | f | fis | f' |
+  \bar "|." \break
+}
+
+mus = \notes {
+  \mel
+   \property Score.oneMeasureLazy = ##t
+   \property Score.autoAccidentals = #'(same-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(same-octave)" \mel >
+   \property Score.autoAccidentals = #'(lazy-same-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(lazy-same-octave)" \mel >
+   \property Score.autoAccidentals = #'(any-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(any-octave)" \mel >
+   \property Score.autoAccidentals = #'(lazy-any-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(lazy-any-octave)" \mel >
+  \modernAccidentals
+  < s1^"$\\backslash$modernAccidentals" \mel >
+  \modernCautionaries
+  < s1^"$\\backslash$modernCautionaries" \mel >
+  \noResetKey
+  < s1^"$\\backslash$noResetKey" \mel >
+}
+
+
+\score {
+  < \context Staff \mus
+    \context NoteNames \apply #no-octaves \mus
+  >
+  \paper {
+    indent=0.0
+  }
+}
index f7676f85caba78e35df1b767a8cb96aaf580252a..cffcbac459c4b937ba82a6cfed8208e3c0f700fe 100644 (file)
@@ -13,12 +13,12 @@ thenotes =  \notes \relative cis' { \time 4/4
 gisis'4 gis gisis ges |
 geses ges geses gis |
 gisis g geses g |
 gisis'4 gis gisis ges |
 geses ges geses gis |
 gisis g geses g |
-gis g ges g |
+gis ges gis g |
 \key a \major
 gisis4 gis gisis ges |
 geses ges geses gis |
 gisis g geses g |
 \key a \major
 gisis4 gis gisis ges |
 geses ges geses gis |
 gisis g geses g |
-gis g ges g |
+gis ges gis g |
 }
 
 \score { < \context Staff \thenotes
 }
 
 \score { < \context Staff \thenotes
diff --git a/input/regression/accidentals.ly b/input/regression/accidentals.ly
new file mode 100644 (file)
index 0000000..dbd2f02
--- /dev/null
@@ -0,0 +1,36 @@
+\version "1.5.24.rz2"
+
+\header{
+texidoc="
+This shows how accidentals are handled.
+"
+}
+
+mel = \notes { \key d \major \time 4/4
+ d4  dis dis8 dis, d4 | d dis disis8 d, dis4 | d des disis8 dis, d4 | dis deses d dis ~ | dis dis ~ dis8 d, dis4 ~ | \break
+ dis dis cis c | c cis cisis cis | c ces cisis c | cis ceses c cis ~ | cis cis ~ cis cis \bar "|."  | \break
+}
+
+\score { \notes \context Staff \transpose c''' {
+   \mel
+   \property Score.oneMeasureLazy = ##t
+   \property Score.autoAccidentals = #'(same-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(same-octave)" \mel >
+   \property Score.autoAccidentals = #'(lazy-same-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(lazy-same-octave)" \mel >
+   \property Score.autoAccidentals = #'(any-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(any-octave)" \mel >
+   \property Score.autoAccidentals = #'(lazy-any-octave)
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'(lazy-any-octave)" \mel >
+   \stoneAccidentals
+   < s1^"$\\backslash stoneAccidentals" \mel >
+   \stoneCautionaries
+   < s1^"$\\backslash stoneCautionaries" \mel >
+   \noResetKey
+   < s1^"$\\backslash noResetKey" \mel >
+  }
+  \paper {
+    indent = 0.0
+  }
+}
+
index 294ca11db3d970db2457ba26ed5555fdec334e03..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,23 +0,0 @@
-% \version "1.5.15.rz1"
-
-mel = \notes {
- d4  dis dis d | d dis disis dis | d des disis d | dis deses d dis ~ | dis dis ~ dis dis ~ | \break
- dis dis cis c | c cis cisis cis | c ces cisis c | cis ceses c cis ~ | cis cis ~ cis cis \bar "|."  | \break
-}
-
-\score { \notes \context Staff \transpose c''' {
-   \key d \major
-   \mel
-   \property Score.autoReminders = #'cautionary
-   < s1^"$\\backslash$property Score.autoReminders = \\#'cautionary" \mel >
-   \property Score.autoReminders = #'accidental
-   < s1^"$\\backslash$property Score.autoReminders = \\#'accidental" \mel >
-   \property Score.autoReminders = ##f
-   \property Score.forgetAccidentals = ##t
-   < s1^"$\\backslash$property Score.forgetAccidentals = \\#\\#t" \mel >
-   \property Score.forgetAccidentals = ##f
-   \property Score.noResetKey = ##t
-   < s1^"$\\backslash$property Score.noResetKey = \\#\\#t" \mel >
-  }
-}
-
index 65b83a1b611ca39563e546f1102286229a61d83e..baf3941591380799093e228cde74b905738c3b4d 100644 (file)
@@ -59,6 +59,7 @@ public:
 
 };
 
 
 };
 
+
 Accidental_engraver::Accidental_engraver ()
 {
   key_item_p_ =0;
 Accidental_engraver::Accidental_engraver ()
 {
   key_item_p_ =0;
@@ -79,19 +80,22 @@ Accidental_engraver::initialize ()
   *   Negative (-1 or -2) if accidental has changed.
   **/
 static int
   *   Negative (-1 or -2) if accidental has changed.
   **/
 static int
-number_accidentals (SCM sig, Note_req * note_l)
+number_accidentals (SCM sig, Note_req * note_l, bool ignore_octave_b)
 {
   Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
   int n = pitch->notename_i_;
 {
   Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
   int n = pitch->notename_i_;
-  int o = pitch->octave_i () ;
+  int o = pitch->octave_i_;
   int a = pitch->alteration_i_;
   
   int a = pitch->alteration_i_;
   
-  SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
+  SCM prev;
+  if (ignore_octave_b)
+    prev = ly_assoc_cdr (gh_int2scm (n), sig);
+  else
+    prev = gh_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
   if (prev == SCM_BOOL_F)
   if (prev == SCM_BOOL_F)
-    prev = scm_assoc (gh_int2scm (n), sig);
+    prev = gh_assoc (gh_int2scm (n), sig);
   SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
 
   SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
 
-  bool different = !gh_equal_p (prev_acc , gh_int2scm (a));
   int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
 
   int num;
   int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
 
   int num;
@@ -102,6 +106,33 @@ number_accidentals (SCM sig, Note_req * note_l)
   return a==p ? num : -num;
 }
 
   return a==p ? num : -num;
 }
 
+static int
+number_accidentals (SCM localsig, SCM lazysig, Note_req * note_l, SCM accidentals_l) {
+  int number=0;
+  int diff=0;
+  if(gh_memq(ly_symbol2scm("same-octave"),accidentals_l)!=SCM_BOOL_F) {
+    int n = number_accidentals(localsig,note_l,false);
+    diff |= n<0;
+    number = max(number,abs(n));
+  }
+  if(gh_memq(ly_symbol2scm("lazy-same-octave"),accidentals_l)!=SCM_BOOL_F) {
+    int n = number_accidentals(lazysig,note_l,false);
+    diff |= n<0;
+    number = max(number,abs(n));
+  }
+  if(gh_memq(ly_symbol2scm("any-octave"),accidentals_l)!=SCM_BOOL_F) {
+    int n = number_accidentals(localsig,note_l,true);
+    diff |= n<0;
+    number = max(number,abs(n));
+  }
+  if(gh_memq(ly_symbol2scm("lazy-any-octave"),accidentals_l)!=SCM_BOOL_F) {
+    int n = number_accidentals(lazysig,note_l,true);
+    diff |= n<0;
+    number = max(number,abs(n));
+  }
+  return diff ? -number : number;
+}
+
 void
 Accidental_engraver::create_grobs ()
 {
 void
 Accidental_engraver::create_grobs ()
 {
@@ -109,31 +140,25 @@ Accidental_engraver::create_grobs ()
     {
       SCM localsig = get_property ("localKeySignature");
       SCM lazysig = get_property ("lazyKeySignature");
     {
       SCM localsig = get_property ("localKeySignature");
       SCM lazysig = get_property ("lazyKeySignature");
+      SCM accidentals_l =  get_property ("autoAccidentals");
+      SCM cautionaries_l =  get_property ("autoCautionaries");
+
+      bool extra_natural_b = get_property ("extraNatural")==SCM_BOOL_T;
 
       for (int i=0; i  < mel_l_arr_.size (); i++) 
        {
          Grob * support_l = support_l_arr_[i];
          Note_req * note_l = mel_l_arr_[i];
 
 
       for (int i=0; i  < mel_l_arr_.size (); i++) 
        {
          Grob * support_l = support_l_arr_[i];
          Note_req * note_l = mel_l_arr_[i];
 
-         int local_num = number_accidentals(localsig,note_l);
-         bool local_diff = local_num<0; local_num = abs(local_num);
-         int lazy_num = number_accidentals(lazysig,note_l);
-         bool lazy_diff = lazy_num<0; lazy_num = abs(lazy_num);
-
-         int num = local_num;;
-         bool different= local_diff;
+         int num = number_accidentals(localsig,lazysig,note_l,accidentals_l);
+         int num_caut = number_accidentals(localsig,lazysig,note_l,cautionaries_l);
          bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
          bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
-         if (to_boolean (get_property ("noResetKey"))) {
-           num = lazy_num;
-           different = lazy_diff;
-         }
-         else if (gh_equal_p (get_property ("autoReminders"),ly_symbol2scm("cautionary"))
-                  || gh_equal_p (get_property ("autoReminders"),ly_symbol2scm("accidental"))) {
-           num = max(local_num,lazy_num);
-           if (gh_equal_p (get_property ("autoReminders"),ly_symbol2scm("cautionary"))
-               && lazy_num>local_num)
-             cautionary = true;
+         if (abs(num_caut)>abs(num)) {
+           num=num_caut;
+           cautionary=true;
          }
          }
+         bool different=num<0;
+         num=abs(num);
 
          /* see if there's a tie that "changes" the accidental */
          /* works because if there's a tie, the note to the left
 
          /* see if there's a tie that "changes" the accidental */
          /* works because if there's a tie, the note to the left
@@ -176,7 +201,7 @@ Accidental_engraver::create_grobs ()
              
              Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")),
                                         cautionary,
              
              Local_key_item::add_pitch (key_item_p_, *unsmob_pitch (note_l->get_mus_property ("pitch")),
                                         cautionary,
-                                        num==2,
+                                        num==2 && extra_natural_b,
                                         tie_break_reminder);
              Side_position_interface::add_support (key_item_p_,support_l);
            }
                                         tie_break_reminder);
              Side_position_interface::add_support (key_item_p_,support_l);
            }
@@ -188,7 +213,8 @@ Accidental_engraver::create_grobs ()
 
            Checking whether it is tied also works mostly, but will it
            always do the correct thing?
 
            Checking whether it is tied also works mostly, but will it
            always do the correct thing?
-           (???? -Rune )
+           FIXME: 2nd accidental after broken-tie accidental should be junked.
+                  Remove broken-tie-support?
           */
          
          Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
           */
          
          Pitch *pitch = unsmob_pitch (note_l->get_mus_property ("pitch"));
@@ -203,8 +229,8 @@ Accidental_engraver::create_grobs ()
                Remember an alteration that is different both from
                that of the tied note and of the key signature.
               */
                Remember an alteration that is different both from
                that of the tied note and of the key signature.
               */
-             localsig = scm_assoc_set_x (localsig, on, SCM_BOOL_T); 
-             lazysig = scm_assoc_set_x  (lazysig,  on, SCM_BOOL_T); 
+             localsig = ly_assoc_front_x (localsig, on, SCM_BOOL_T);
+             lazysig = ly_assoc_front_x  (lazysig,  on, SCM_BOOL_T);
            }
          else if (!forget)
            {
            }
          else if (!forget)
            {
@@ -212,8 +238,8 @@ Accidental_engraver::create_grobs ()
                not really really correct if there are more than one
                noteheads with the same notename.
               */
                not really really correct if there are more than one
                noteheads with the same notename.
               */
-             localsig = scm_assoc_set_x (localsig, on, gh_int2scm (a)); 
-             lazysig = scm_assoc_set_x  (lazysig,  on, gh_int2scm (a)); 
+             localsig = ly_assoc_front_x (localsig, on, gh_int2scm (a)); 
+             lazysig = ly_assoc_front_x  (lazysig,  on, gh_int2scm (a)); 
            }
         }
   
            }
         }
   
@@ -221,7 +247,7 @@ Accidental_engraver::create_grobs ()
       daddy_trans_l_->set_property ("lazyKeySignature",   lazysig);
     }
   
       daddy_trans_l_->set_property ("lazyKeySignature",   lazysig);
     }
   
-
+  
   if (key_item_p_)
     {
       /*
   if (key_item_p_)
     {
       /*
@@ -307,7 +333,11 @@ Accidental_engraver::process_music ()
     }
   else if (!mp.to_bool () )
     {
     }
   else if (!mp.to_bool () )
     {
-       daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
+      /* Use the old local sig as new lazy sig. This way the lazy sig will be one measure late */
+      if (get_property("oneMeasureLazy")==SCM_BOOL_T)
+       daddy_trans_l_->set_property ("lazyKeySignature",
+         daddy_trans_l_->get_property ("localKeySignature"));
+      daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
     }
 }
 
     }
 }
 
@@ -321,5 +351,5 @@ 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",
 /* creats*/       "Accidentals",
 /* acks  */       "rhythmic-head-interface tie-interface arpeggio-interface",
 with note heads), this needs to be in a context higher than Tie_engraver. FIXME",
 /* creats*/       "Accidentals",
 /* acks  */       "rhythmic-head-interface tie-interface arpeggio-interface",
-/* reads */       "localKeySignature forgetAccidentals noResetKey autoReminders",
+/* reads */       "localKeySignature lazyKeySignature forgetAccidentals oneMeasureLazy extraNatural autoAccidentals autoCautionaries",
 /* write */       "");
 /* write */       "");
index 55aafc98c7d8cdea7102233ab888d2544626ce58..26c2a8a3001732a7ff94c2521813288dbbc52e11 100644 (file)
@@ -133,9 +133,11 @@ String ly_symbol2string (SCM);
 SCM ly_offset2scm (Offset);
 Offset ly_scm2offset (SCM);
 SCM ly_assoc_chain (SCM key, SCM achain);
 SCM ly_offset2scm (Offset);
 Offset ly_scm2offset (SCM);
 SCM ly_assoc_chain (SCM key, SCM achain);
+SCM ly_assoc_cdr (SCM key, SCM alist);
 Interval ly_scm2interval (SCM);
 SCM ly_interval2scm (Interval);
 
 Interval ly_scm2interval (SCM);
 SCM ly_interval2scm (Interval);
 
+
 SCM ly_parse_scm (char const* s, int* n);
 SCM ly_quote_scm (SCM s);
 SCM ly_type (SCM);
 SCM ly_parse_scm (char const* s, int* n);
 SCM ly_quote_scm (SCM s);
 SCM ly_type (SCM);
@@ -153,6 +155,11 @@ inline SCM ly_cddr (SCM x) { return SCM_CDDR (x); }
 inline SCM ly_caddr (SCM x) { return SCM_CADDR (x); }
 inline SCM ly_cdadr (SCM x) { return SCM_CDADR (x); }
 inline SCM ly_caadr (SCM x) { return SCM_CAADR (x); }
 inline SCM ly_caddr (SCM x) { return SCM_CADDR (x); }
 inline SCM ly_cdadr (SCM x) { return SCM_CDADR (x); }
 inline SCM ly_caadr (SCM x) { return SCM_CAADR (x); }
+/* inserts at front, removing dublicates */
+inline SCM ly_assoc_front_x(SCM alist, SCM key, SCM val)
+{
+  return scm_acons(key, val, scm_assoc_remove_x (alist, key));
+}
 inline bool ly_pair_p (SCM x) { return SCM_NFALSEP (scm_pair_p (x)); }
 inline bool ly_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
 inline bool ly_number_p (SCM x) { return SCM_NUMBERP (x); }
 inline bool ly_pair_p (SCM x) { return SCM_NFALSEP (scm_pair_p (x)); }
 inline bool ly_symbol_p (SCM x) { return SCM_SYMBOLP (x); }
 inline bool ly_number_p (SCM x) { return SCM_NUMBERP (x); }
index a42715549180c18e07902fbcd6b479572fe0a00a..2cf476fbbf587ff8c7ffccd1ac4de85917e95b71 100644 (file)
@@ -22,6 +22,7 @@
 #include "direction.hh"
 #include "offset.hh"
 #include "interval.hh"
 #include "direction.hh"
 #include "offset.hh"
 #include "interval.hh"
+#include "pitch.hh"
 
 SCM
 ly_last (SCM list)
 
 SCM
 ly_last (SCM list)
@@ -519,6 +520,23 @@ ly_assoc_chain (SCM key, SCM achain)
     return SCM_BOOL_F;
 }
 
     return SCM_BOOL_F;
 }
 
+/* looks the key up in the cdrs of the alist-keys
+   - ignoring the car and ignoring non-pair keys.
+   Returns first match found. */
+SCM
+ly_assoc_cdr (SCM key, SCM alist)
+{
+  if (gh_pair_p (alist)) {
+    SCM trykey = ly_caar(alist);
+    if(gh_pair_p(trykey) && to_boolean(scm_equal_p(key,ly_cdr(trykey))))
+      return ly_car(alist);
+    else
+      return ly_assoc_cdr (key, ly_cdr (alist));
+  }
+  else
+    return SCM_BOOL_F;
+}
+
 /*
   LIST has the form "sym1 sym2 sym3" 
  */
 /*
   LIST has the form "sym1 sym2 sym3" 
  */
index 104d8ab6eace08e186aa9b72fce1e12152f95678..8ed003ee386bab90b64eeccab8832955b3f4105c 100644 (file)
@@ -382,6 +382,10 @@ ScoreContext = \translator {
        tupletNumberFormatFunction = #denominator-tuplet-formatter
        
        subdivideBeams = ##f
        tupletNumberFormatFunction = #denominator-tuplet-formatter
        
        subdivideBeams = ##f
+       extraNatural = ##t
+       autoAccidentals = #'(same-octave)
+       autoCautionaries = #'()  
+
 
        keyAccidentalOrder = #'(
          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
 
        keyAccidentalOrder = #'(
          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
index 1d26dc2a03b0107a4d5cbd102b6613c9e9a974f3..8fff8e7d9239613e08dd352f6b55890f86b4d9fb 100644 (file)
@@ -160,6 +160,38 @@ fatText = \property Voice.textNonEmpty = ##t
 showStaffSwitch = \property PianoStaff.followVoice = ##t
 hideStaffSwitch = \property PianoStaff.followVoice = ##f
 
 showStaffSwitch = \property PianoStaff.followVoice = ##t
 hideStaffSwitch = \property PianoStaff.followVoice = ##f
 
+% FIXME: Move this docu (to where?)
+
+% accidentals as they were common in the 18th century.
+defaultAccidentals = {
+  \property Score.extraNatural = ##t
+  \property Score.autoAccidentals = #'(same-octave)
+  \property Score.autoCautionaries = #'()  
+}
+
+% accidentals as suggested by Kurt Stone, Music Notation in the 20th century.
+modernAccidentals = {
+  \property Score.extraNatural = ##f
+  \property Score.oneMeasureLazy = ##t
+  \property Score.autoAccidentals = #'(same-octave any-octave lazy-any-octave)
+  \property Score.autoCautionaries = #'()  
+}
+
+% the accidentals that Stone adds to the old standard as cautionaries
+modernCautionaries = {
+  \property Score.extraNatural = ##f
+  \property Score.oneMeasureLazy = ##t
+  \property Score.autoAccidentals = #'(same-octave)
+  \property Score.autoCautionaries = #'(any-octave lazy-any-octave)  
+}
+
+% accidentals not being reset at the bar-lines
+noResetKey = {
+  \property Score.oneMeasureLazy = ##f
+  \property Score.autoAccidentals = #'(lazy-same-octave)
+  \property Score.autoCautionaries = #'()
+}
+
 
 % To remove a Volta bracet or some other graphical object,
 % set it to turnOff. Example: \property Staff.VoltaBracket = \turnOff
 
 % To remove a Volta bracet or some other graphical object,
 % set it to turnOff. Example: \property Staff.VoltaBracket = \turnOff
index 98127c076f23fb94654ba1c020141a108ee1b462..6d2257b7e6c837362b14d0a171d3da7c00e6ceee 100644 (file)
@@ -14,8 +14,6 @@ This function replaces all repeats  with unfold repeats. It was
 written by Rune Zedeler. "
   (let* ((es (ly-get-mus-property music 'elements))
          (e (ly-get-mus-property music 'element))
 written by Rune Zedeler. "
   (let* ((es (ly-get-mus-property music 'elements))
          (e (ly-get-mus-property music 'element))
-         (body (ly-get-mus-property music 'body))
-         (alts (ly-get-mus-property music 'alternatives))
          (n  (ly-music-name music)))
 
     (if (equal? n "Repeated_music")
          (n  (ly-music-name music)))
 
     (if (equal? n "Repeated_music")
@@ -30,16 +28,6 @@ written by Rune Zedeler. "
          music 'elements
          (map unfold-repeats es)))
 
          music 'elements
          (map unfold-repeats es)))
 
-    (if (music? alts)
-        (ly-set-mus-property
-         music 'alternatives
-         (unfold-repeats alts)))
-
-    (if (music? body)
-        (ly-set-mus-property
-         music 'body
-         (unfold-repeats body)))
-
     (if (music? e)
         (ly-set-mus-property
          music 'element
     (if (music? e)
         (ly-set-mus-property
          music 'element
index 97abc27d8d842975ef3b731bae4e07629e887a3d..452154b0941a03d1a8d132672b75db593ba8d381 100644 (file)
@@ -78,21 +78,40 @@ The head of the list:
 
 @end example")
 
 
 @end example")
 
+(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.
+The algorithms are:
+@table @samp
+@item same-octave: This is the default algorithm. Accidentals are
+typeset if the note changes the accidental of that note in that octave.
+@item any-octave: Accidentals are typeset if the note is different from 
+the previous note on the same pitch in any octave.
+@item lazy-same-octave: Shows accidentals as if the key signature does
+not get reset at every barline. This means that an alteration lasts until it is
+changed - perhaps many measures later. See oneMeasureLazy, though.
+@item lazy-any-octave: Yeah, you probably guessed that one.
+@end table
+")
+
+(translator-property-description 'autoCautionaries list? "List similar to
+autoAccidentals, but it controls cautionary accidentals rather than
+normal ones. Both lists are tried, and the one giving the most accidentals
+wins. In case of draw, a normal accidental is typeset.
+")
+
 (translator-property-description 'automaticPhrasing boolean? " If set,
 the @ref{Lyric_phrasing_engraver} will match note heads of context
 called Voice X to syllables from LyricsVoice called
 X-<something>. This feature is turned on by default. See the example
 file @file{lyrics-multi-stanza.ly}.
 (translator-property-description 'automaticPhrasing boolean? " If set,
 the @ref{Lyric_phrasing_engraver} will match note heads of context
 called Voice X to syllables from LyricsVoice called
 X-<something>. This feature is turned on by default. See the example
 file @file{lyrics-multi-stanza.ly}.
-
 ")
 ")
+
 (translator-property-description 'automaticMelismata boolean? " If
 set, \addlyrics will assume that beams, slurs and ties signal
 melismata, and align lyrics accordingly.
 ")
 
 (translator-property-description 'automaticMelismata boolean? " If
 set, \addlyrics will assume that beams, slurs and ties signal
 melismata, and align lyrics accordingly.
 ")
 
-(translator-property-description 'autoReminders symbol? "If set to @samp{accidental} or @samp{cautionary},
-a (reminder) accidental automatically is inserted whenever an accidental is reverted - even after a bar.")
-
 (translator-property-description 'barAlways boolean? " If set to true a bar line is drawn after each note.
 ")
 (translator-property-description 'barCheckNoSynchronize boolean? "If set, don't reset measurePosition when finding a bbarcheck. This
 (translator-property-description 'barAlways boolean? " If set to true a bar line is drawn after each note.
 ")
 (translator-property-description 'barCheckNoSynchronize boolean? "If set, don't reset measurePosition when finding a bbarcheck. This
@@ -178,7 +197,10 @@ procedure? "visibility-lambda function for explicit Key changes;
 \override of #'visibility-lambda will set the visibility for normal
 (ie. at the start of the line) key signatures.")
 
 \override of #'visibility-lambda will set the visibility for normal
 (ie. at the start of the line) key signatures.")
 
-
+(translator-property-description 'extraNatural boolean? "Whether to typeset an
+extra natural sign before accidentals changing from a non-natural to 
+another non-natural.
+")
 (translator-property-description 'followVoice boolean?
                                 "if set, note heads are tracked  across staff switches by a thin line")
 (translator-property-description 'fontSize integer?
 (translator-property-description 'followVoice boolean?
                                 "if set, note heads are tracked  across staff switches by a thin line")
 (translator-property-description 'fontSize integer?
@@ -216,8 +238,11 @@ The format is (NAME . ALTER), where NAME is from 0 .. 6 and ALTER from  -1, 1.
 (translator-property-description 'lastKeySignature list? "Last key
 signature before a key signature change.")
 
 (translator-property-description 'lastKeySignature list? "Last key
 signature before a key signature change.")
 
+(translator-property-description 'lazyKeySignature list? "a lazy version of
+localKeySignature, only being reset according to oneMeasureLazy."
+) 
 (translator-property-description 'localKeySignature list? "the key
 (translator-property-description 'localKeySignature list? "the key
-signature at this point in the measure.  The format is the same as for keySignature. "
+signature at this point in the measure.  The format is the same as for keySignature. Is reset at every bar line."
 ) 
 
 (translator-property-description 'measureLength moment? "Length of one
 ) 
 
 (translator-property-description 'measureLength moment? "Length of one
@@ -236,15 +261,13 @@ MIDI instrument to use ")
 (translator-property-description 'noAutoBeaming boolean? "If set to true then beams are not generated automatically.
 ")
 (translator-property-description 'noDirection boolean? "Don't set directions by a2-engraver when part-combining.")
 (translator-property-description 'noAutoBeaming boolean? "If set to true then beams are not generated automatically.
 ")
 (translator-property-description 'noDirection boolean? "Don't set directions by a2-engraver when part-combining.")
-(translator-property-description 'noResetKey boolean? "Do not
-reset local key to the value of keySignature at the start of a measure,
-as determined by measurePosition.
-
-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.
-")
 (translator-property-description 'oneBeat moment? "  How long does one beat in the current time signature last?")
 (translator-property-description 'oneBeat moment? "  How long does one beat in the current time signature last?")
+(translator-property-description 'oneMeasureLazy boolean? "If false, the lazy
+time-signature is never reset, causing lazy accidentals (see
+autoAccidentals) to last until the next key change. If true, the lazy
+key signature only last one measure longer than the normal one - accidentals
+being reset at the end of the measure after the one in which they occur.
+")
 (translator-property-description 'pedalSustainStrings list? "List of   string to print for sustain-pedal. Format is
  (UP UPDOWN DOWN), where each of the three is the string to print when
 this is done with the pedal.")
 (translator-property-description 'pedalSustainStrings list? "List of   string to print for sustain-pedal. Format is
  (UP UPDOWN DOWN), where each of the three is the string to print when
 this is done with the pedal.")