lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

accidentals 1.5.25.rz1


From: Rune Zedeler
Subject: accidentals 1.5.25.rz1
Date: Sun, 09 Dec 2001 08:24:06 +0100

I still haven't build the docu and hence haven't added documentation -
but I will do.
Haven't done any editorial accidentals yet. (Mark?)
Perhaps we should add a third accidental type, "editorial", because so
many people have requested them that it seems like a bad idea not to
distinguish editorials and cautionaries. Perhaps we could do some sort
of a list of how to typeset each of the three types of accidentals?

I did a rethink about Han-Wen's idea and changed my mind - so I
implemented it nevertheless.
Really fewer properties here than in the last patch. :-)

As I will not have much time the next week I would like you to put this
patch in unless you find something very wrong.
Of course I will do a few changes if you tell me to  - but I cannot do
any big changes in the near future.

Good night.

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

usage 

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

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

diff -purN ../lilypond-1.5.25/ChangeLog ./ChangeLog
--- ../lilypond-1.5.25/ChangeLog        Wed Dec  5 19:08:18 2001
+++ ./ChangeLog Sun Dec  9 06:53:21 2001
@@ -1,3 +1,30 @@
+2001-12-09  Rune Zedeler  <address@hidden>
+       * 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, forgetAccidentals, autoReminders,
+                           lazyKeySignature.
+       Changed property:   localKeySignature.
+       Added properties:   extraNatural, autoAccidentals,
+                           autoCautionaries.
+       (BUGFIX: broken-tie-support destroyed in 1.5.16)
+       
+       * ly/property-init.ly: added commands
+       \defaultAccidentals \modernAccidentals \modernCautionaries
+       \noResetKey \forgetAccidentals
+
+       * 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-05  Han-Wen Nienhuys  <address@hidden>
 
        * bibtools/bib2html.py: Add simple bib2html convertor, and .bst
diff -purN ../lilypond-1.5.25/Documentation/regression-test.tely 
./Documentation/regression-test.tely
--- ../lilypond-1.5.25/Documentation/regression-test.tely       Sat Dec  1 
15:34:56 2001
+++ ./Documentation/regression-test.tely        Sun Dec  9 03:01:55 2001
@@ -35,13 +35,22 @@ documenting bugfixes.
 
 @lilypondfile[printfilename]{dots.ly}
 
address@hidden
-
 @lilypondfile[printfilename]{multi-measure-rest.ly}
 
 @lilypondfile[printfilename]{mm-rests2.ly}
 
+
address@hidden Accidentals
+
+Accidentals are currently in a development stage.
+
address@hidden
+
 @lilypondfile[printfilename]{accidental-single-double.ly}
+
address@hidden
+
address@hidden
 
 
 @section Stems
diff -purN ../lilypond-1.5.25/VERSION ./VERSION
--- ../lilypond-1.5.25/VERSION  Wed Dec  5 19:14:57 2001
+++ ./VERSION   Sun Dec  9 04:05:12 2001
@@ -2,7 +2,7 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
 PATCH_LEVEL=25
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=rz1
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
diff -purN ../lilypond-1.5.25/input/regression/accidental-octave.ly 
./input/regression/accidental-octave.ly
--- ../lilypond-1.5.25/input/regression/accidental-octave.ly    Thu Jan  1 
01:00:00 1970
+++ ./input/regression/accidental-octave.ly     Sun Dec  9 06:27:56 2001
@@ -0,0 +1,76 @@
+\version "1.5.24.rz2"
+
+\header {
+texidoc="
+This shows how accidentals in different octaves are handled.
+"
+}
+
+#(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))
+
+
+\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 = #'((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 >
+   \modernAccidentals
+   < s1^""^""^"$\\backslash$modernAccidentals" \mel >
+   \modernCautionaries
+   < s1^""^""^"$\\backslash$modernCautionaries" \mel >
+   \noResetKey
+   < s1^""^""^"$\\backslash$noResetKey" \mel >
+   \forgetAccidentals
+   < s1^""^""^"$\\backslash$forgetAccidentals" \mel >
+}
+
+
+\score {
+  < \context Staff \mus
+    \context NoteNames \apply #no-octaves \mus
+  >
+  \paper {
+    indent=0.0
+  }
+}
diff -purN ../lilypond-1.5.25/input/regression/accidental-single-double.ly 
./input/regression/accidental-single-double.ly
--- ../lilypond-1.5.25/input/regression/accidental-single-double.ly     Thu Apr 
 5 00:02:37 2001
+++ ./input/regression/accidental-single-double.ly      Sun Dec  9 03:01:58 2001
@@ -13,12 +13,12 @@ thenotes =  \notes \relative cis' { \tim
 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 |
-gis g ges g |
+gis ges gis g |
 }
 
 \score { < \context Staff \thenotes
diff -purN ../lilypond-1.5.25/input/regression/accidentals.ly 
./input/regression/accidentals.ly
--- ../lilypond-1.5.25/input/regression/accidentals.ly  Thu Jan  1 01:00:00 1970
+++ ./input/regression/accidentals.ly   Sun Dec  9 06:04:02 2001
@@ -0,0 +1,71 @@
+\version "1.5.24.rz2"
+
+\header{
+texidoc="
+This shows how accidentals are handled.
+"
+}
+
+#(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))
+
+
+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 = #'((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 >
+   \modernAccidentals
+   < s1^"$\\backslash$modernAccidentals" \mel >
+   \modernCautionaries
+   < s1^"$\\backslash$modernCautionaries" \mel >
+   \noResetKey
+   < s1^"$\\backslash$noResetKey" \mel >
+   \forgetAccidentals
+   < s1^"$\\backslash$forgetAccidentals" \mel >
+  }
+  \context NoteNames \repeat unfold 9 \apply #no-octaves \mel
+ >
+ \paper {
+  indent = 0.0
+ }
+}
+
diff -purN ../lilypond-1.5.25/input/test/accidentals.ly 
./input/test/accidentals.ly
--- ../lilypond-1.5.25/input/test/accidentals.ly        Tue Oct  9 00:04:07 2001
+++ ./input/test/accidentals.ly Thu Jan  1 01:00:00 1970
@@ -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 >
-  }
-}
-
diff -purN ../lilypond-1.5.25/lily/accidental-engraver.cc 
./lily/accidental-engraver.cc
--- ../lilypond-1.5.25/lily/accidental-engraver.cc      Sat Dec  1 15:34:56 2001
+++ ./lily/accidental-engraver.cc       Sun Dec  9 08:03:56 2001
@@ -18,6 +18,7 @@
 #include "side-position-interface.hh"
 #include "engraver.hh"
 #include "arpeggio.hh"
+#include "warn.hh"
 
 /**
 
@@ -59,6 +60,7 @@ public:
 
 };
 
+
 Accidental_engraver::Accidental_engraver ()
 {
   key_item_p_ =0;
@@ -70,7 +72,6 @@ Accidental_engraver::initialize ()
 {
   last_keysig_ = get_property ("keySignature");
   daddy_trans_l_->set_property ("localKeySignature",  last_keysig_);  
-  daddy_trans_l_->set_property ("lazyKeySignature",   last_keysig_);  
 }
 
 /** calculates the number of accidentals on basis of the current local key sig
@@ -79,61 +80,96 @@ Accidental_engraver::initialize ()
   *   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, SCM curbarnum, SCM lazyness,
+                   bool ignore_octave_b)
 {
   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_;
-  
-  SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
-  if (prev == SCM_BOOL_F)
-    prev = scm_assoc (gh_int2scm (n), sig);
+  int curbarnum_i = gh_scm2int(curbarnum);
+  int accbarnum_i = 0;
+  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);
+  /* should really be true unless prev==SCM_BOOL_F */
+  if(gh_pair_p(prev) && gh_pair_p(ly_cdr(prev))) {
+    accbarnum_i = gh_scm2int(ly_cddr(prev));
+    prev = gh_cons(ly_car(prev),ly_cadr(prev));
+  }
+  /* If an accidental was not found or the accidental was too old */
+  if (prev == SCM_BOOL_F ||
+      (gh_number_p(lazyness) && curbarnum_i>accbarnum_i+gh_scm2int(lazyness)))
+    prev = gh_assoc (gh_int2scm (n), sig);
   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;
-  if (a==p && !to_boolean (note_l->get_mus_property ("force-accidental"))) 
num=0;
+  if (a==p && !to_boolean (note_l->get_mus_property ("force-accidental")) && 
gh_number_p(prev_acc)) num=0;
   else if ( (abs(a)<abs(p) || p*a<0) && a!=0 ) num=2;
   else num=1;
   
   return a==p ? num : -num;
 }
 
+static int
+number_accidentals (SCM localsig, Note_req * note_l, SCM accidentals_l,
+                   SCM curbarnum) {
+  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) {
+       int n = number_accidentals
+         (localsig,note_l,curbarnum,lazyness,measure_any_octave_b);
+       diff |= n<0;
+       number = max(number,abs(n));     
+      }
+      else warning(_f("unknown accidental typesetting: %s",
+                     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);
+  }
+  return diff ? -number : number;
+}
+
 void
 Accidental_engraver::create_grobs ()
 {
   if (!key_item_p_ && mel_l_arr_.size ()) 
     {
       SCM localsig = get_property ("localKeySignature");
-      SCM lazysig = get_property ("lazyKeySignature");
+      SCM accidentals_l =  get_property ("autoAccidentals");
+      SCM cautionaries_l =  get_property ("autoCautionaries");
+      SCM barnum = get_property ("currentBarNumber");
+
+      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];
 
-         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,note_l,accidentals_l,barnum);
+         int num_caut = 
number_accidentals(localsig,note_l,cautionaries_l,barnum);
          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
@@ -176,7 +212,7 @@ Accidental_engraver::create_grobs ()
              
              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);
            }
@@ -188,40 +224,37 @@ Accidental_engraver::create_grobs ()
 
            Checking whether it is tied also works mostly, but will it
            always do the correct thing?
-           (???? -Rune )
           */
          
          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_;
          SCM on = gh_cons (gh_int2scm (o), gh_int2scm (n));
-         bool forget = to_boolean (get_property ("forgetAccidentals"));
          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, on, SCM_BOOL_T); 
-             lazysig = scm_assoc_set_x  (lazysig,  on, SCM_BOOL_T); 
+             localsig = ly_assoc_front_x
+               (localsig, on, gh_cons(SCM_BOOL_T,barnum));
            }
-         else if (!forget)
+         else
            {
              /*
                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_cons(gh_int2scm (a),barnum)); 
            }
         }
   
       daddy_trans_l_->set_property ("localKeySignature",  localsig);
-      daddy_trans_l_->set_property ("lazyKeySignature",   lazysig);
     }
   
-
+  
   if (key_item_p_)
     {
       /*
@@ -296,19 +329,12 @@ Accidental_engraver::process_music ()
 
   SCM sig = get_property ("keySignature");
 
-  /*
-    Detect key sig changes. If we haven't found any, check if at start
-    of measure, and set localKeySignature anyhow.  */
+  /* Detect key sig changes. */
   if (last_keysig_ != sig) 
     {
       daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
-      daddy_trans_l_->set_property ("lazyKeySignature",  ly_deep_copy (sig));
       last_keysig_ = sig;
     }
-  else if (!mp.to_bool () )
-    {
-       daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
-    }
 }
 
 
@@ -321,5 +347,5 @@ events.  Due to interaction with ties (w
 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",
-/* write */       "");
+/* reads */       "localKeySignature extraNatural autoAccidentals 
autoCautionaries",
+/* write */       "localKeySignature");
diff -purN ../lilypond-1.5.25/lily/include/lily-guile.hh 
./lily/include/lily-guile.hh
--- ../lilypond-1.5.25/lily/include/lily-guile.hh       Sat Dec  1 13:11:57 2001
+++ ./lily/include/lily-guile.hh        Sun Dec  9 03:02:02 2001
@@ -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_assoc_cdr (SCM key, SCM alist);
 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);
@@ -153,6 +155,11 @@ inline SCM ly_cddr (SCM x) { return SCM_
 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); }
diff -purN ../lilypond-1.5.25/lily/lily-guile.cc ./lily/lily-guile.cc
--- ../lilypond-1.5.25/lily/lily-guile.cc       Sat Dec  1 13:11:57 2001
+++ ./lily/lily-guile.cc        Sun Dec  9 03:02:02 2001
@@ -22,6 +22,7 @@
 #include "direction.hh"
 #include "offset.hh"
 #include "interval.hh"
+#include "pitch.hh"
 
 SCM
 ly_last (SCM list)
@@ -515,6 +516,23 @@ ly_assoc_chain (SCM key, SCM achain)
       else
        return ly_assoc_chain (key, ly_cdr (achain));
     }
+  else
+    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;
 }
diff -purN ../lilypond-1.5.25/ly/engraver-init.ly ./ly/engraver-init.ly
--- ../lilypond-1.5.25/ly/engraver-init.ly      Wed Dec  5 18:54:36 2001
+++ ./ly/engraver-init.ly       Sun Dec  9 05:29:42 2001
@@ -382,6 +382,10 @@ ScoreContext = \translator {
        tupletNumberFormatFunction = #denominator-tuplet-formatter
        
        subdivideBeams = ##f
+       extraNatural = ##t
+       autoAccidentals = #'((measure-same-octave . 0))
+       autoCautionaries = #'()  
+
 
        keyAccidentalOrder = #'(
          (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
diff -purN ../lilypond-1.5.25/ly/property-init.ly ./ly/property-init.ly
--- ../lilypond-1.5.25/ly/property-init.ly      Wed Dec  5 18:54:37 2001
+++ ./ly/property-init.ly       Sun Dec  9 08:07:28 2001
@@ -160,8 +160,51 @@ fatText = \property Voice.textNonEmpty =
 showStaffSwitch = \property PianoStaff.followVoice = ##t
 hideStaffSwitch = \property PianoStaff.followVoice = ##f
 
+% FIXME: Move this docu (to where?)
 
-% To remove a Volta bracet or some other graphical object,
+% accidentals as they were common in the 18th century.
+defaultAccidentals = {
+  \property Score.extraNatural = ##t
+  \property Score.autoAccidentals = #'((measure-same-octave . 0))
+  \property Score.autoCautionaries = #'()  
+}
+
+% accidentals as suggested by Kurt Stone, Music Notation in the 20th century.
+% This includes all the default accidentals, but accidentals also needs 
cancelling
+% 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.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))  
+}
+
+% 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.autoCautionaries = #'()
+}
+
+% do not set localKeySignature when a note alterated differently from
+% localKeySignature is found.
+% Causes accidentals to be printed at every note instead of
+% 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.autoCautionaries = #'()  
+}
+
+
+% To remove a Volta bracket or some other graphical object,
 % set it to turnOff. Example: \property Staff.VoltaBracket = \turnOff
 
 turnOff = #'()
diff -purN ../lilypond-1.5.25/scm/music-functions.scm ./scm/music-functions.scm
--- ../lilypond-1.5.25/scm/music-functions.scm  Wed Dec  5 18:54:40 2001
+++ ./scm/music-functions.scm   Sun Dec  9 03:02:07 2001
@@ -14,8 +14,6 @@ This function replaces all repeats  with
 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")
@@ -29,16 +27,6 @@ written by Rune Zedeler. "
         (ly-set-mus-property
          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
diff -purN ../lilypond-1.5.25/scm/translator-property-description.scm 
./scm/translator-property-description.scm
--- ../lilypond-1.5.25/scm/translator-property-description.scm  Wed Dec  5 
18:54:40 2001
+++ ./scm/translator-property-description.scm   Sun Dec  9 07:10:28 2001
@@ -78,21 +78,42 @@ The head of the list:
 
 @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.
+Each algorithm-description is a name-value pair.
+The algorithms are:
address@hidden @samp
address@hidden measure-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.
address@hidden measure-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.
address@hidden 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 '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
@@ -178,7 +199,10 @@ procedure? "visibility-lambda function f
 \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?
@@ -186,13 +210,6 @@ procedure? "visibility-lambda function f
 in a context. This is done using the @code{Font_size_engraver}.")
 
 (translator-property-description 'forceClef boolean? "Show clef symbol, even 
if it hasn't changed. Only active for the first clef after the property is set, 
not for the full staff.")
-(translator-property-description 'forgetAccidentals boolean? "do
-not set localKeySignature when a note alterated differently from
-localKeySignature is found.
-
-Causes accidentals to be printed at every note instead of
-remembered for the duration of a measure.
-")
 (translator-property-description 'graceAccidentalSpace number? "amount space 
to alot for an accidental")
 (translator-property-description 'graceAlignPosition dir? "put the grace note 
before or after the main note?")
 (translator-property-description 'instr markup? "see @code{instrument}")
@@ -211,13 +228,13 @@ remembered for the duration of a measure
 Alist that defines in what order  alterations should be printed.
 The format is (NAME . ALTER), where NAME is from 0 .. 6 and ALTER from  -1, 1.
 ")
-(translator-property-description 'keySignature list? "The current key 
signature. This is an alist containing (NAME . ALTER) or ((OCTAVE . NAME) . 
ALTER) pairs, where NAME is from 0.. 6 and ALTER from -2,-1,0,1,2 ")
+(translator-property-description 'keySignature list? "The current key 
signature. This is an alist containing (NAME . ALTER) or ((OCTAVE . NAME) . 
ALTER) or ((OCTAVE . NAME) . (ALTER . BARNUMBER)) pairs, where NAME is from 0.. 
6 and ALTER from -2,-1,0,1,2. The optional barnumber contains the number of the 
measure of the accidental. FIXME: describe broken tie entries.")
 
 (translator-property-description 'lastKeySignature list? "Last key
 signature before a key signature change.")
 
 (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
@@ -236,14 +253,6 @@ 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 '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 '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

reply via email to

[Prev in Thread] Current Thread [Next in Thread]