]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.3.59 release/1.3.59
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 12 Jun 2000 14:39:13 +0000 (16:39 +0200)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 12 Jun 2000 14:39:13 +0000 (16:39 +0200)
===========

* Rewrote key sig support.  Now key signature can also be controlled
by setting keySignature and localKeySignature properties, eg.

\property keySignature = #'((2 . -1) ( 4 . -1) (6 . -1))

sets a key signature of `es ges bes' (an unusual key signature).

Keys are internally represented as transpositions of the c-major
scale. Printing the key signature for a scale is done by filtering out
all non-natural accidentals.

* Removed support for \keysignature, and \key something \minor; Newkey
is now obsolete.

1.3.58.j

35 files changed:
CHANGES
VERSION
configure
input/test/keys.ly
input/test/keys2.ly
lily/audio-item.cc
lily/auto-beam-engraver.cc
lily/break-align-item.cc
lily/command-request.cc
lily/include/audio-item.hh
lily/include/command-request.hh
lily/include/group-interface.hh
lily/include/key-def.hh
lily/include/key-engraver.hh
lily/include/key-performer.hh
lily/include/lily-guile.hh
lily/include/local-key-engraver.hh [deleted file]
lily/include/newkey-def.hh [new file with mode: 0644]
lily/include/newkey.hh [deleted file]
lily/include/smobs.hh
lily/key-def.cc [deleted file]
lily/key-engraver.cc
lily/key-item.cc
lily/key-performer.cc
lily/local-key-engraver.cc
lily/midi-item.cc
lily/my-lily-lexer.cc
lily/newkey-def.cc [new file with mode: 0644]
lily/newkey.cc [deleted file]
lily/parser.yy
lily/tuplet-engraver.cc
ly/engraver.ly
make/out/lilypond.lsm
make/out/lilypond.spec
scm/lily.scm

diff --git a/CHANGES b/CHANGES
index 603ec451f95fd75d51911d0cb34e05ddea3b1bcf..1ddcaf682142419246d7e81feb8b4700ba4627fe 100644 (file)
--- a/CHANGES
+++ b/CHANGES
@@ -1,4 +1,21 @@
-1.3.58.jcn2
+1.3.58.hwn1
+===========
+
+* Rewrote key sig support.  Now key signature can also be controlled
+by setting keySignature and localKeySignature properties, eg.
+
+       \property keySignature = #'((2 . -1) ( 4 . -1) (6 . -1))
+
+sets a key signature of `es ges bes' (an unusual key signature).
+
+Keys are internally represented as transpositions of the c-major
+scale. Printing the key signature for a scale is done by filtering out
+all non-natural accidentals.
+
+* Removed support for \keysignature, and \key something \minor; Newkey
+is now obsolete.
+
+1.3.58.jcn3
 ===========
 
 * Fixed pedal items (hw)
@@ -8,8 +25,7 @@
 
 * Replaced one scm_assoc () u-turn slipped through jcn1
 
-1.3.58.jcn1
-===========
+* various GUILE 1.3.5 compile fixes
 
 * Added `Ped' as a compound symbol font and removed silly scheme kerning.
 
diff --git a/VERSION b/VERSION
index 9d24cd1c01da0ebf456edac49bfcd5562b7ac806..484be829b250fb9a030bbd6b492e38b7e07987b3 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,8 +1,8 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=3
-PATCH_LEVEL=58
-MY_PATCH_LEVEL=jcn2
+PATCH_LEVEL=59
+MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
 # released version.
index fa1b218de5cbc9222259babd2c1b59acc26e29c9..d35bdc404550f4d9d297a6da95f4642c1de4834e 100755 (executable)
--- a/configure
+++ b/configure
@@ -83,7 +83,7 @@ ac_help="$ac_help
 ac_help="$ac_help
   with-lang=LANG          use LANG as language to emit messages"
 ac_help="$ac_help
-  enable-tex-tfmdir=DIR   set the tex-directory where cmr10.tfm lives (default: use kpsewhich)"
+  enable-tfm-path=PATH   set path of tex directories where tfm files live, esp.: cmr10.tfm (default: use kpsewhich)"
 
 # Initialize some variables set by options.
 # The variables have the same names as the options, with
@@ -2605,12 +2605,12 @@ echo "configure:2577: checking for working metafont mode" >&5
     
 
 
-    # Check whether --enable-tex-tfmdir or --disable-tex-tfmdir was given.
-if test "${enable_tex_tfmdir+set}" = set; then
-  enableval="$enable_tex_tfmdir"
-  TFMDIR=$enableval
+    # Check whether --enable-tfm-path or --disable-tfm-path was given.
+if test "${enable_tfm_path+set}" = set; then
+  enableval="$enable_tfm_path"
+  tfm_path=$enableval
 else
-  TFMDIR=auto 
+  tfm_path=auto 
 fi
 
 
@@ -2649,35 +2649,42 @@ test -n "$KPSEWHICH" && break
 done
 test -n "$KPSEWHICH" || KPSEWHICH="no"
 
-    echo $ac_n "checking for TeX TFM directory""... $ac_c" 1>&6
-echo "configure:2654: checking for TeX TFM directory" >&5
-    if test "x$TFMDIR" = xauto ; then
-       if test "x$TEX_TFMDIR" = "x" ; then
-           if test "x$KPSEWHICH" != "xno" ; then
-               CMR10=`kpsewhich tfm cmr10.tfm`
-               TEX_TFMDIR=`dirname $CMR10`
-           else
-               
-    echo "configure: warning: Please set TEX_TFMDIR (to where cmr10.tfm lives):
-       TEX_TFMDIR=/usr/local/TeX/lib/tex/fonts ./configure" 1>&2
+    echo $ac_n "checking for tfm path""... $ac_c" 1>&6
+echo "configure:2654: checking for tfm path" >&5
+
+    TFM_FONTS="cmr msam"
+
+    if test "x$tfm_path" = xauto ; then
+       if test "x$KPSEWHICH" != "xno" ; then
+           for i in $TFM_FONTS; do
+               dir=`$KPSEWHICH tfm ${i}10.tfm`
+               TFM_PATH="$TFM_PATH `dirname $dir`"
+           done
+       else
+           
+    echo "configure: warning: Please specify where cmr10.tfm lives:
+    ./configure --enable-tfm-path=/usr/local/TeX/lib/tex/fonts" 1>&2
     warn_b=yes
 
-           fi
        fi
+    else
+         TFM_PATH=$tfm_path
     fi
-    echo "$ac_t""$TEX_TFMDIR" 1>&6
+
+    TFM_PATH=`echo $TFM_PATH | tr ':' ' '`
+    echo "$ac_t""$TFM_PATH" 1>&6
     
 
 
     ## First, let's just see if we can find Guile at all.
     echo $ac_n "checking "for guile-config"""... $ac_c" 1>&6
-echo "configure:2675: checking "for guile-config"" >&5
+echo "configure:2682: checking "for guile-config"" >&5
     for guile_config in guile-config $target-guile-config $build-guile-config; do
        echo "$ac_t"""$guile_config"" 1>&6
        if ! $guile_config --version > /dev/null 2>&1 ; then
            echo "configure: warning: "cannot execute $guile_config"" 1>&2
            echo $ac_n "checking "if we are cross compiling"""... $ac_c" 1>&6
-echo "configure:2681: checking "if we are cross compiling"" >&5
+echo "configure:2688: checking "if we are cross compiling"" >&5
            guile_config=error
        else
            break
@@ -2688,7 +2695,7 @@ echo "configure:2681: checking "if we are cross compiling"" >&5
        exit 1
     fi
     echo $ac_n "checking "Guile version"""... $ac_c" 1>&6
-echo "configure:2692: checking "Guile version"" >&5
+echo "configure:2699: checking "Guile version"" >&5
     need_guile_version="1.3.4"
     guile_version=`expr "\`$guile_config --version 2>&1\`" : ".*\($need_guile_version\).*"`
     echo "$ac_t"""$guile_version"" 1>&6
@@ -2701,10 +2708,8 @@ echo "configure:2692: checking "Guile version"" >&5
     
 ## The GUILE_FLAGS macro.
   echo $ac_n "checking for Guile""... $ac_c" 1>&6
-echo "configure:2705: checking for Guile" >&5
-  if $guile_config link > /dev/null ; then
-      :
-  else
+echo "configure:2712: checking for Guile" >&5
+  if ! $guile_config link > /dev/null ; then
       echo "$ac_t"""cannot execute $guile_config"" 1>&6
       { echo "configure: error: "cannot find guile-config; is Guile installed?"" 1>&2; exit 1; }
       exit 1
@@ -2718,7 +2723,7 @@ echo "configure:2705: checking for Guile" >&5
     # Extract the first word of "guile", so it can be a program name with args.
 set dummy guile; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2722: checking for $ac_word" >&5
+echo "configure:2727: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_GUILE'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2756,7 +2761,7 @@ fi
 
 
 echo $ac_n "checking for 8-bit clean memcmp""... $ac_c" 1>&6
-echo "configure:2760: checking for 8-bit clean memcmp" >&5
+echo "configure:2765: checking for 8-bit clean memcmp" >&5
 if eval "test \"`echo '$''{'ac_cv_func_memcmp_clean'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -2764,7 +2769,7 @@ else
   ac_cv_func_memcmp_clean=no
 else
   cat > conftest.$ac_ext <<EOF
-#line 2768 "configure"
+#line 2773 "configure"
 #include "confdefs.h"
 #ifdef __cplusplus
 extern "C" void exit(int);
@@ -2777,7 +2782,7 @@ main()
 }
 
 EOF
-if { (eval echo configure:2781: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
+if { (eval echo configure:2786: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext} && (./conftest; exit) 2>/dev/null
 then
   ac_cv_func_memcmp_clean=yes
 else
@@ -2795,12 +2800,12 @@ echo "$ac_t""$ac_cv_func_memcmp_clean" 1>&6
 test $ac_cv_func_memcmp_clean = no && LIBOBJS="$LIBOBJS memcmp.${ac_objext}"
 
 echo $ac_n "checking for vprintf""... $ac_c" 1>&6
-echo "configure:2799: checking for vprintf" >&5
+echo "configure:2804: checking for vprintf" >&5
 if eval "test \"`echo '$''{'ac_cv_func_vprintf'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2804 "configure"
+#line 2809 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char vprintf(); below.  */
@@ -2826,7 +2831,7 @@ vprintf();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2830: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2835: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_vprintf=yes"
 else
@@ -2850,12 +2855,12 @@ fi
 
 if test "$ac_cv_func_vprintf" != yes; then
 echo $ac_n "checking for _doprnt""... $ac_c" 1>&6
-echo "configure:2854: checking for _doprnt" >&5
+echo "configure:2859: checking for _doprnt" >&5
 if eval "test \"`echo '$''{'ac_cv_func__doprnt'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2859 "configure"
+#line 2864 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char _doprnt(); below.  */
@@ -2881,7 +2886,7 @@ _doprnt();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2885: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2890: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func__doprnt=yes"
 else
@@ -2908,12 +2913,12 @@ fi
 for ac_func in memmem snprintf vsnprintf gettext isinf
 do
 echo $ac_n "checking for $ac_func""... $ac_c" 1>&6
-echo "configure:2912: checking for $ac_func" >&5
+echo "configure:2917: checking for $ac_func" >&5
 if eval "test \"`echo '$''{'ac_cv_func_$ac_func'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
   cat > conftest.$ac_ext <<EOF
-#line 2917 "configure"
+#line 2922 "configure"
 #include "confdefs.h"
 /* System header to define __stub macros and hopefully few prototypes,
     which can conflict with char $ac_func(); below.  */
@@ -2939,7 +2944,7 @@ $ac_func();
 
 ; return 0; }
 EOF
-if { (eval echo configure:2943: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
+if { (eval echo configure:2948: \"$ac_link\") 1>&5; (eval $ac_link) 2>&5; } && test -s conftest${ac_exeext}; then
   rm -rf conftest*
   eval "ac_cv_func_$ac_func=yes"
 else
@@ -2978,7 +2983,7 @@ do
 # Extract the first word of "$ac_prog", so it can be a program name with args.
 set dummy $ac_prog; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:2982: checking for $ac_word" >&5
+echo "configure:2987: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_prog_MAKEINFO'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3011,7 +3016,7 @@ test -n "$MAKEINFO" || MAKEINFO="error"
 # Extract the first word of "perl", so it can be a program name with args.
 set dummy perl; ac_word=$2
 echo $ac_n "checking for $ac_word""... $ac_c" 1>&6
-echo "configure:3015: checking for $ac_word" >&5
+echo "configure:3020: checking for $ac_word" >&5
 if eval "test \"`echo '$''{'ac_cv_path_PERL'+set}'`\" = set"; then
   echo $ac_n "(cached) $ac_c" 1>&6
 else
@@ -3236,7 +3241,7 @@ s%@MFMODE@%$MFMODE%g
 s%@MFPLAIN_MP@%$MFPLAIN_MP%g
 s%@INIMETAPOST_FLAGS@%$INIMETAPOST_FLAGS%g
 s%@KPSEWHICH@%$KPSEWHICH%g
-s%@TEX_TFMDIR@%$TEX_TFMDIR%g
+s%@TFM_PATH@%$TFM_PATH%g
 s%@GUILE_CFLAGS@%$GUILE_CFLAGS%g
 s%@GUILE_LDFLAGS@%$GUILE_LDFLAGS%g
 s%@GUILE@%$GUILE%g
index 98ddbe08b0087b5e6460e37cd768fa7692a75795..35b11a9a1521c62735d6b7c3248ac1b4b5b53fde 100644 (file)
@@ -4,8 +4,14 @@
   \notes \relative c''
   {
        \property Staff. createKeyOnClefChange = ##t  
-    \key bes; c2 \key c \minor;  c2
+    \key bes; c2
+%    \key c ; %  \minor;
+    \key es ; %  \minor;
+    c2
     \break
-    \key bes \major; c2 \clef alto; c2   \key d; c1
+    \key bes ; % \major;
+    c2 \clef alto; c2   \key d; \clef treble; c2
+       \property Staff. keySignature = #'((2 . -1)  (6 . -1) (4 . -1))
+       e2
   }
 }
index 944cc8fb16cdbbd5201093ef07d21ee7e2df11c1..b9209cfe48c4198919d9968ae3b48fdf69b296c4 100644 (file)
@@ -9,7 +9,7 @@ blah = \notes {
        [cis8 d e f] [e! a b cis'] |
        es e f e a a' a  a' |
  \clef "bass";  }
-  [es16 c' b a] [g f es d] [c d es d] [c Bes As G] |
+  [es16 c' b a] [g f es d] [c d es d] [c bes, as, g,] |
 
 \clef "violin";
        \keysignature  c;
index 5d78ec4bd58794be869199bcbe49e7bc33cf4f13..4e771ca08e23aaadfbd3ac325971a3333e1d345e 100644 (file)
@@ -40,9 +40,9 @@ Audio_note::tie_to (Audio_note* t)
 }
 
                    
-Audio_key::Audio_key (Key_def const& k)
+Audio_key::Audio_key () // Key_def const& k)
 {
-  key_ = k;
+  //fixme.
 }
 
 Audio_dynamic::Audio_dynamic (Real volume)
index 5a8661ae9cb9d2fa1e87c7674e9ee9f7e18e28c5..c906fc6ac1012bb06735b4330036fb5f1d35810a 100644 (file)
@@ -113,19 +113,19 @@ Auto_beam_engraver::consider_end_and_begin (Moment test_mom)
   SCM one (get_property ("beatLength"));
 
   Moment end_mom;
-  if (SMOB_IS_TYPE_B(Moment, one))
-    end_mom = *SMOB_TO_TYPE (Moment, one);
+  if (unsmob_moment (one))
+    end_mom = *unsmob_moment (one);
 
   /*
     second guess: property generic time exception
   */
   SCM begin = get_property (time_str + "beamAutoBegin");
-  if (SMOB_IS_TYPE_B(Moment, begin))
-    begin_mom = * SMOB_TO_TYPE(Moment, begin);
+  if (unsmob_moment (begin))
+    begin_mom = * unsmob_moment (begin);
 
   SCM end = get_property (time_str + "beamAutoEnd");
-  if (SMOB_IS_TYPE_B (Moment, end))
-    end_mom = * SMOB_TO_TYPE(Moment,end);
+  if (unsmob_moment (end))
+    end_mom = * unsmob_moment (end);
 
   /*
     third guess: property time exception, specific for duration type
@@ -133,26 +133,26 @@ Auto_beam_engraver::consider_end_and_begin (Moment test_mom)
   if (type_str.length_i ())
     {
       SCM end_mult = get_property ( time_str + "beamAutoEnd" + type_str);
-      if (SMOB_IS_TYPE_B (Moment, end_mult))
-       end_mom = * SMOB_TO_TYPE (Moment,end_mult);
+      if (unsmob_moment (end_mult))
+       end_mom = * unsmob_moment (end_mult);
 
       SCM begin_mult = get_property (time_str + "beamAutoBegin" + type_str);
-      if (SMOB_IS_TYPE_B (Moment, begin_mult))
-       begin_mom = * SMOB_TO_TYPE (Moment,begin_mult);
+      if (unsmob_moment (begin_mult))
+       begin_mom = * unsmob_moment (begin_mult);
     }
 
   /*
     fourth guess [user override]: property plain generic
   */
   begin = get_property ("beamAutoBegin");
-  if (SMOB_IS_TYPE_B(Moment, begin))
-    begin_mom = * SMOB_TO_TYPE(Moment, begin);
+  if (unsmob_moment (begin))
+    begin_mom = * unsmob_moment (begin);
 
 
   
   end = get_property ("beamAutoEnd");
-  if (SMOB_IS_TYPE_B (Moment, end))
-    end_mom = * SMOB_TO_TYPE (Moment,end);
+  if (unsmob_moment (end))
+    end_mom = * unsmob_moment (end);
 
   /*
     fifth guess [user override]: property plain, specific for duration type
@@ -160,12 +160,12 @@ Auto_beam_engraver::consider_end_and_begin (Moment test_mom)
   if (type_str.length_i ())
     {
       SCM end_mult = get_property (String ("beamAutoEnd") + type_str);
-      if (SMOB_IS_TYPE_B (Moment, end_mult))
-       end_mom = * SMOB_TO_TYPE (Moment,end_mult);
+      if (unsmob_moment (end_mult))
+       end_mom = * unsmob_moment (end_mult);
 
       SCM begin_mult = get_property (String ("beamAutoBegin") + type_str);
-      if (SMOB_IS_TYPE_B (Moment, begin_mult))
-       begin_mom = * SMOB_TO_TYPE (Moment,begin_mult);
+      if (unsmob_moment (begin_mult))
+       begin_mom = * unsmob_moment (begin_mult);
     }
 
   Rational r;
index 58b04d19a77f4cdbcba7b0bde55334c54db93a37..6e5722ca1282658e9bf4bb6c39ae18758fd02c5a 100644 (file)
@@ -91,7 +91,7 @@ Break_align_item::before_line_breaking ()
        }
 
       SCM symbol = gh_car  (extra_space);
-      Real spc = gh_scm2double (SCM_CADR(extra_space));
+      Real spc = gh_scm2double (gh_cadr(extra_space));
       spc *= interline;
 
       dists.push(spc);
index 3f941f3fe17872d438ce1d09f7c398ca7b7e9632..fea2de22a4a8bdd6e6af1c873290b3d19e22fce1 100644 (file)
@@ -111,7 +111,7 @@ Key_change_req::Key_change_req ()
 Key_change_req::Key_change_req (Key_change_req const&s)
   : Request (s)
 {
-  key_ = s.key_ ?  new Key_def (*s.key_) : 0;
+  key_ = s.key_ ?  new Newkey_def (*s.key_) : 0;
 }
 
 Key_change_req::~Key_change_req ()
index ef13d9f0216daa7d719c24326e7380b71b0fc913..b06ab920c997de089f03ce7e4640a707ec258f51 100644 (file)
@@ -7,11 +7,11 @@
 #ifndef AUDIO_ITEM_HH
 #define AUDIO_ITEM_HH
 
- #include <typeinfo>
+#include <typeinfo>
 #include "lily-proto.hh"
 #include "string.hh"
 #include "audio-element.hh"
-#include "key-def.hh"
+
 #include "musical-pitch.hh"
 #include "moment.hh"
 #include "drul-array.hh"
@@ -48,9 +48,8 @@ public:
 class Audio_key : public Audio_item
 {
 public:
-  Audio_key (Key_def const& key);
-
-  Key_def key_;
+  Audio_key (); //Newkey_def const& key);
+  // FIXME
 };
 
 class Audio_instrument : public Audio_item
index f8755a92dbc16cd7a9e9393fc383e0c01b94c5f1..a79e71132510f44142570ca3c2d6991170057003 100644 (file)
@@ -14,7 +14,7 @@
 #include "array.hh"
 #include "duration.hh"
 #include "musical-pitch.hh"
-#include "key-def.hh"
+#include "newkey-def.hh"
 #include "protected-scm.hh"
 
 class Break_req : public Request {
@@ -102,13 +102,16 @@ class Breathing_sign_req : public Request {
     Routines for sharps and flats are separated, 
     so that caller may identify non-conventional keys.
 */
+/*
+  UGH!
+ */
 class Key_change_req  : public Request
 {
 public:
   Key_change_req ();
   ~Key_change_req();
   Key_change_req(Key_change_req const &);
-  Key_def *key_;
+  Newkey_def *key_;
 
 protected:
   VIRTUAL_COPY_CONS(Music);
index e2eafc6de41e7913efad9192da77ebe065f8ad1d..43b2ba66dbbb97e9c6504e880dd830523f2a1cae 100644 (file)
@@ -59,9 +59,7 @@ Pointer_group_interface__extract_elements (Score_element const *elt, T *, const
   for (SCM s = elt->get_elt_pointer (name); gh_pair_p (s); s = gh_cdr (s))
     {
       SCM e = gh_car (s);
-      assert (SMOB_IS_TYPE_B(Score_element,e));
-      Score_element* se = SMOB_TO_TYPE(Score_element, e);
-      arr.push (dynamic_cast<T*> (se));
+      arr.push (dynamic_cast<T*> (unsmob_element (e)));
     }
 
   arr.reverse ();
index 160e7c43cbc2297d5994b60fae3ef63a88e6b32c..65296f81060baccd891380179b283fc7515acef0 100644 (file)
@@ -1,50 +1,2 @@
-/*   
-  key-def.hh -- declare Key_def
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1999--2000 Jan Nieuwenhuizen <janneke@gnu.org>
-  
- */
 
-#ifndef KEY_DEF_HH
-#define KEY_DEF_HH
-
-#include "array.hh"
-#include "musical-pitch.hh"
-
-/**
-  Universal key definition (Should rename class Key to 'Accidentals'?)
-
-  FIXME: merge key.hh and key-def.hh classes.
-
-  FIXME: use Scheme data structs for this.
- */
-class Key_def
-{
-public:
-  Key_def ();
-  
-  Array<Musical_pitch> pitch_arr_;
-  int modality_i_;
-  bool ordinary_key_b_;
-
-  /// squash the octaves to 1
-  void squash_octaves ();
-
-  /// return number accidentals in key; ordinary key only
-  int ordinary_accidentals_i () const;
-
-  /// return number of flats in key
-  int flats_i () const;
-
-  /// return number of sharps in key
-  int sharps_i () const;
-
-  /// modality == 3
-  bool minor_b () const;
-
-  void transpose (Musical_pitch d);
-};
-
-#endif /* KEY_DEF_HH */
+#error
index 408f961d67d9725b7bd1f6b361a235c4e780be86..0b1be334fec3f84bb9841868e7ef4e14808f7154 100644 (file)
@@ -9,44 +9,5 @@
 
 #ifndef KEYGRAV_HH
 #define KEYGRAV_HH
-
-#include "engraver.hh"
-
-#include "musical-pitch.hh"
-#include "protected-scm.hh"
-#include "newkey.hh"
-
-
-/**
-  Make the key signature.
- */
-class Key_engraver : public Engraver {
-  void create_key(bool);
-  void read_req (Key_change_req const * r);
-
-public:
-  Key_engraver();
-  
-  VIRTUAL_COPY_CONS(Translator);
-
-  /*
-    TODO: move these into properties.
-   */
-  Newkey key_;
-  Key_change_req * keyreq_l_;
-  Key_item * item_p_;
-
-  Protected_scm old_accs_;
-  Protected_scm new_accs_;  
-
-  bool key_changed_b() const;
-    
-protected:
-  virtual bool do_try_music (Music *req_l);
-  virtual void do_process_music();
-  virtual void do_pre_move_processing();
-  virtual void do_post_move_processing();
-  virtual void acknowledge_element (Score_element_info);
-};
-
+#error
 #endif // KEYGRAV_HH
index 535cb3e1bdcde6c9996b877233040239f4fc7fab..512bd48a53e4ac7254011267667f82138cb8e290 100644 (file)
@@ -21,7 +21,6 @@ public:
   ~Key_performer();
 
 protected:
-  void do_print() const;
   virtual bool do_try_music (Music* req_l);
   virtual void do_process_music ();
   virtual void do_pre_move_processing ();
index 0aa2b0287a589afdeca5c594aea96f2fc1afb707..ba9751c4b50f903e4e41409733b675ea5a061cb1 100644 (file)
 
 #ifndef SCM_PACK
 #define SCM_PACK(x) ((SCM) x)
-#endif
 
+#endif
+#ifndef SCM_UNPACK
+#define SCM_UNPACK(x) ( x)
+#endif
 
 /*
   conversion functions follow the GUILE naming convention, i.e.
diff --git a/lily/include/local-key-engraver.hh b/lily/include/local-key-engraver.hh
deleted file mode 100644 (file)
index cf4cf30..0000000
+++ /dev/null
@@ -1,11 +0,0 @@
-/*
-  local-key-engraver.hh -- declare Local_key_engraver
-
-  (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef LOCALKEYGRAV_HH
-#define LOCALKEYGRAV_HH
-
-#endif // LOCALKEYGRAV_HH
diff --git a/lily/include/newkey-def.hh b/lily/include/newkey-def.hh
new file mode 100644 (file)
index 0000000..dfa20c6
--- /dev/null
@@ -0,0 +1,36 @@
+/*   
+  newkey-def.hh -- declare Newkey_def
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#ifndef NEWKEY_DEF_HH
+#define NEWKEY_DEF_HH
+
+#include "protected-scm.hh"
+#include "musical-pitch.hh"
+
+class Newkey_def
+{
+
+public:
+  Protected_scm  pitch_alist_;
+
+  Newkey_def();
+  
+  /// return number of flats in key
+  int flats_i () const;
+
+  /// return number of sharps in key
+  int sharps_i () const;
+  int accs_i (int) const;
+  
+  void transpose (Musical_pitch d);
+};
+
+#endif /* NEWKEY_DEF_HH */
+
+
diff --git a/lily/include/newkey.hh b/lily/include/newkey.hh
deleted file mode 100644 (file)
index 32c3ad7..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-/*   
-  newkey.hh -- declare Newkey
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  
- */
-
-#ifndef NEWKEY_HH
-#define NEWKEY_HH
-
-#include "protected-scm.hh" 
-
-class Newkey
-{
-  /*
-    alist mapping 
-    (octave . notename) -> accidental and notename -> accidental
-   */
-  Protected_scm key_alist_;
-public:
-  void set (int name, int acc);
-  void set (int oct, int name, int acc);
-  void clear ();
-  void set_scm (SCM k, SCM v);
-  Newkey();
-  int get (int oct, int name);
-  int get (int name);
-};
-#endif /* NEWKEY_HH */
-
index 96343a9b95d179b3a06bc12792fbb7fd7dd380ac..dff21977b1af843a1261d758c3127e270b6f09ae 100644 (file)
        SCM self_scm_;
 
 
+#ifndef SCM_CELL_TYPE
+#define SCM_CELL_TYPE(X) SCM_CAR(X)
+#endif
+
+#ifndef SCM_CELL_WORD_1
+#define SCM_CELL_WORD_1(X) SCM_CDR(X)
+#endif 
+
 /**
    Check if S is of the specified C++ class.
  */
-#define SMOB_IS_TYPE_B(TYPE, S)  (SCM_NIMP((S)) && SCM_CAR((S)) == TYPE::smob_tag_)
+#define SMOB_IS_TYPE_B(TYPE, S)  (SCM_NIMP(S) && SCM_CELL_TYPE(S) == TYPE::smob_tag_)
 
 /// Cast S.  No checks are done.
-#define SMOB_TO_TYPE(TYPE, S)  ((TYPE*) SCM_CDR((S)))
+#define SMOB_TO_TYPE(TYPE, S)  ((TYPE*) SCM_CELL_WORD_1(S))
 #endif /* SMOBS_HH */
 
diff --git a/lily/key-def.cc b/lily/key-def.cc
deleted file mode 100644 (file)
index 523c214..0000000
+++ /dev/null
@@ -1,184 +0,0 @@
-/*   
-  key-def.cc --  implement Key_def
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 1999--2000 Jan Nieuwenhuizen <janneke@gnu.org>
-  
- */
-
-#include "key-def.hh"
-#include "debug.hh"
-
-Key_def::Key_def ()
-{
-  modality_i_ = 0;
-  ordinary_key_b_ = false;
-}
-int
-Key_def::ordinary_accidentals_i () const
-{
-  if (!ordinary_key_b_) 
-    {
-      programming_error ("Accidentals requested for non-conventional key");
-      return 0;
-    }
-
-  int p;
-  if (pitch_arr_.size () < 1) 
-    {
-      warning (_ ("No key name, assuming `C'"));
-      p = 0;
-    }
-  else
-    {
-      p = pitch_arr_[0].semitone_pitch ();
-      p += modality_i_;
-    }
-  /* Solve the equation 7*accidentals_i mod 12 = p, -6 <= accidentals_i <= 5 */
-  int accidentals_i = (7*p) % 12;
-  accidentals_i = (accidentals_i + 18) % 12 -6;
-  
-  /* Correct from flats to sharps or vice versa */
-  if (accidentals_i * pitch_arr_[0].accidental_i_ < 0)
-    accidentals_i += 12 * sign (pitch_arr_[0].accidental_i_);
-  return accidentals_i;
-}
-
-int
-Key_def::flats_i () const
-{
-  if (ordinary_key_b_) 
-    return 0 >? -ordinary_accidentals_i ();
-  int flats_i = 0;
-  for (int i = 0; i < pitch_arr_.size (); i++)
-    {
-      if (pitch_arr_[i].accidental_i_ < 0)
-       flats_i -= pitch_arr_[i].accidental_i_;
-    }
-  return flats_i;
-}
-
-bool
-Key_def::minor_b () const
-{
-  return modality_i_ == 3;
-}
-
-int
-Key_def::sharps_i () const
-{
-  if (ordinary_key_b_) 
-    return 0 >? ordinary_accidentals_i ();
-  int sharps_i = 0;
-  for (int i = 0; i < pitch_arr_.size (); i++)
-    {
-      if (pitch_arr_[i].accidental_i_ > 0)
-       sharps_i += pitch_arr_[i].accidental_i_;
-    }
-  return sharps_i;
-}
-
-void
-Key_def::transpose (Musical_pitch d) 
-{
-  if (ordinary_key_b_ ) 
-    { 
-      if (pitch_arr_.size () > 0) 
-        pitch_arr_[0].transpose (d);
-      else
-        {
-          warning (_ ("Don't know how handle empty keys")); // TODO 
-        }
-    }
-  else
-    {
-      Array<Musical_pitch> old_pitch_arr_;
-      for (int i = 0; i < pitch_arr_.size (); i++)
-        {
-          old_pitch_arr_.push (pitch_arr_[i]);
-        }
-      // set accidentals for \key d (as in Key_engraver::read_req)
-      // (later called "new accidentals")
-      int p = d.semitone_pitch ();
-      /* Solve the equation 7*accidentals_i mod 12 = p, -6 <= accidentals_i <= 5 */
-      int accidentals_i = (7*p) % 12;
-      accidentals_i = (accidentals_i + 18) % 12 -6;
-
-      /* Correct from flats to sharps or vice versa */
-      if (accidentals_i * d.accidental_i_ < 0)
-      accidentals_i += 12 * sign (d.accidental_i_);
-    
-      pitch_arr_.clear ();
-      if (accidentals_i < 0) 
-        {
-         int accidental = 6 ; // First accidental: bes
-          for ( ; accidentals_i < 0 ; accidentals_i++ ) 
-           {
-             Musical_pitch m;
-             m.accidental_i_ = -1;
-             m.notename_i_ = accidental;
-             pitch_arr_.push (m);
-     
-             accidental = (accidental + 3) % 7 ;
-           }
-       }
-      else 
-       { 
-         int accidental = 3 ; // First accidental: fis
-         for ( ; accidentals_i > 0 ; accidentals_i-- ) 
-           {
-             Musical_pitch m;
-             m.accidental_i_ = 1;
-             m.notename_i_ = accidental;
-             pitch_arr_.push (m);
-   
-             accidental = (accidental + 4) % 7 ;
-           }
-       }
-      // Check if transposed old accidentals and the new ones coincide
-      accidentals_i = pitch_arr_.size ();
-      int acc_found;
-      Musical_pitch mm;
-      for (int i=0; i < old_pitch_arr_.size (); i++)
-        {
-          acc_found = 0;
-          mm = old_pitch_arr_[i];
-         mm.transpose (d);
-          for (int j=0; ( (j < accidentals_i) && (acc_found == 0)); j++)
-            {
-              if (pitch_arr_[j].notename_i_ == mm.notename_i_)
-                {
-                  if (mm.accidental_i_ == 0)
-                    {
-                      // remove new accidental 
-                      pitch_arr_.del (j);
-                      accidentals_i--;
-                      acc_found = 1;
-                   }
-                 else
-                    {
-                      // change new accidental 
-                      pitch_arr_[j].accidental_i_ = mm.accidental_i_;
-                      acc_found = 1;
-                   }
-                }
-            }
-          if (acc_found == 0)
-            {
-              // add transposed old accidental 
-             pitch_arr_.push (mm);
-            }
-        }
-    }
-}
-
-void
-Key_def::squash_octaves ()
-{
-  for (int i=0; i < pitch_arr_.size (); i++)
-    {
-      pitch_arr_[i].octave_i_ = 0;
-    }
-}
index da00f7204069ef2ddb13373df76d2700f3503029..d5091eb70f61d2071dd5fe696121a44e891cb8d5 100644 (file)
@@ -6,31 +6,50 @@
   (c)  1997--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   */
 
-#include "key-engraver.hh"
+
 #include "key-item.hh"
 #include "command-request.hh"
-#include "local-key-engraver.hh"
 #include "musical-request.hh"
 #include "local-key-item.hh"
 #include "bar.hh"
 #include "timing-translator.hh"
 #include "staff-symbol-referencer.hh"
-
-/*
-  this is a large mess. Please clean this to use Basic properties and
-  Scheme data structs.
+#include "translator-group.hh"
+#include "engraver.hh"
+#include "musical-pitch.hh"
+#include "protected-scm.hh"
+#include "clef-item.hh"
+
+/**
+  Make the key signature.
  */
+class Key_engraver : public Engraver {
+  void create_key(bool);
+  void read_req (Key_change_req const * r);
+
+public:
+  Key_engraver();
+  
+  VIRTUAL_COPY_CONS(Translator);
+
+  Key_change_req * keyreq_l_;
+  Key_item * item_p_;
+  Protected_scm old_accs_;
+    
+protected:
+  virtual void do_creation_processing();
+  virtual bool do_try_music (Music *req_l);
+  virtual void do_process_music();
+  virtual void do_pre_move_processing();
+  virtual void do_post_move_processing();
+  virtual void acknowledge_element (Score_element_info);
+};
+
 
 Key_engraver::Key_engraver ()
 {
+  keyreq_l_ = 0;
   item_p_ = 0;
-  do_post_move_processing ();
-}
-
-bool
-Key_engraver::key_changed_b () const
-{
-  return keyreq_l_ ;
 }
 
 void
@@ -44,7 +63,7 @@ Key_engraver::create_key (bool def)
 
       // todo: put this in basic props.
       item_p_->set_elt_property ("old-accidentals", old_accs_);
-      item_p_->set_elt_property ("new-accidentals", new_accs_);
+      item_p_->set_elt_property ("new-accidentals", get_property ("keySignature"));
 
       Staff_symbol_referencer_interface st (item_p_);
       st.set_interface ();
@@ -82,17 +101,16 @@ Key_engraver::do_try_music (Music * req_l)
 void
 Key_engraver::acknowledge_element (Score_element_info info)
 {
-  if (dynamic_cast <Clef_change_req *> (info.req_l_)) 
+  if (dynamic_cast <Clef_item *> (info.elem_l_)) 
     {
       SCM c =  get_property ("createKeyOnClefChange");
       if (to_boolean (c))
        {
          create_key (false);
-      
        }
     }
   else if (dynamic_cast<Bar *> (info.elem_l_)
-          && gh_pair_p (new_accs_))
+          && gh_pair_p (get_property ("keySignature")))
     {
       create_key (true);
     }
@@ -102,7 +120,7 @@ Key_engraver::acknowledge_element (Score_element_info info)
 void
 Key_engraver::do_process_music ()
 {
-  if (keyreq_l_
+  if (keyreq_l_ || old_accs_ != get_property ("keySignature"))
     {
       create_key (false);
     }
@@ -118,94 +136,45 @@ Key_engraver::do_pre_move_processing ()
     }
 }
 
-
-/*
-  TODO.  Use properties; and this is too hairy.
- */
 void
 Key_engraver::read_req (Key_change_req const * r)
 {
   if (!r->key_)
     return;
-  
-  key_.clear ();
-  SCM prop = get_property ("keyOctaviation");
-  bool multi = to_boolean (prop);
-
-  SCM n = SCM_EOL;
-
-  if (r->key_->ordinary_key_b_) 
-    {
-      int no_of_acc = r->key_->ordinary_accidentals_i ();
 
-      // Hmm, can't these be handled/constructed by Key_change_req?
-      if (no_of_acc < 0) 
-       {
-         int accidental = 6 ; // First accidental: bes
-         for ( ; no_of_acc < 0 ; no_of_acc++ ) 
-           {
-             Musical_pitch m;
-             m.accidental_i_ = -1;
-             m.notename_i_ = accidental;
-             if (multi)
-               key_.set (m.octave_i_, m.notename_i_, m.accidental_i_);
-             else
-               key_.set (m.notename_i_, m.accidental_i_);
-
-             SCM pair = gh_cons (gh_int2scm (m.notename_i_),
-                                 gh_int2scm (m.accidental_i_));
-             n = gh_cons (pair, n) ;
-             accidental = (accidental + 3) % 7 ;
-           }
-       }
-      else 
-       { 
-         int accidental = 3 ; // First accidental: fis
-         for ( ; no_of_acc > 0 ; no_of_acc-- ) 
-           {
-             Musical_pitch m;
-             m.accidental_i_ = 1;
-             m.notename_i_ = accidental;
-             if (multi)
-               key_.set (m.octave_i_, m.notename_i_, m.accidental_i_);
-             else
-               key_.set (m.notename_i_, m.accidental_i_);
-
-             SCM pair = gh_cons (gh_int2scm (m.notename_i_),
-                                 gh_int2scm (m.accidental_i_));
-             n = gh_cons (pair, n);
-             
-             accidental = (accidental + 4) % 7 ;
-           }
-       }
-    }
-  else // Special key
+  SCM n = scm_list_copy (r->key_->pitch_alist_);
+  SCM accs = SCM_EOL;
+  for (SCM s = get_property ("keyAccidentalOrder");
+       gh_pair_p (s); s = gh_cdr (s))
     {
-      for (int i = 0; i < r->key_->pitch_arr_.size (); i ++) 
+      if (gh_pair_p (scm_member (gh_car (s), n)))
        {
-         Musical_pitch m_l =r->key_->pitch_arr_[i];
-         if (multi)
-           key_.set (m_l.octave_i_, m_l.notename_i_, m_l.accidental_i_);
-         else
-           key_.set (m_l.notename_i_, m_l.accidental_i_);
-
-         SCM pair = gh_cons (gh_int2scm (m_l.notename_i_),
-                             gh_int2scm (m_l.accidental_i_));
-         n = gh_cons (pair, n);
+         accs = gh_cons (gh_car (s), accs);
+         n = scm_delete_x (gh_car (s), n);
        }
     }
+  for (SCM s = n ; gh_pair_p (s); s = gh_cdr (s))
+    if (gh_scm2int (gh_cdar (s)))
+      accs = gh_cons (gh_car (s), accs);
 
-  old_accs_ = new_accs_;
-  new_accs_ = n;
-  
+  old_accs_ = get_property ("keySignature");
+  daddy_trans_l_->set_property ("keySignature", accs);
 }
 
 void
 Key_engraver::do_post_move_processing ()
 {
   keyreq_l_ = 0;
+  old_accs_ = get_property ("keySignature");
+}
+
+void
+Key_engraver::do_creation_processing ()
+{
+  daddy_trans_l_->set_property ("keySignature", SCM_EOL);
   old_accs_ = SCM_EOL;
 }
 
+
 ADD_THIS_TRANSLATOR (Key_engraver);
 
index af54bc7b5e3286eb19c4a1716cf9db4daef01a88..46ad565f5044ef075a3e8623470e1f0e835f1fde 100644 (file)
@@ -15,9 +15,6 @@
 #include "lookup.hh"
 #include "staff-symbol-referencer.hh"
 
-const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
-const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
-
 Key_item::Key_item (SCM s)
   : Item (s)
 {
@@ -25,6 +22,12 @@ Key_item::Key_item (SCM s)
 }
 
 
+/*
+  FIXME: too much hardcoding here.
+ */
+const int FLAT_TOP_PITCH=2; /* fes,ges,as and bes typeset in lower octave */
+const int SHARP_TOP_PITCH=4; /*  ais and bis typeset in lower octave */
+
 
 /*
   FIXME: key-item should just get a list of (position, acc), and leave
index ea2668b926c91bd2419836b5f32e0a4d71fbdf8d..81fa1c5296eced08330422c4dab90e04665a09d7 100644 (file)
@@ -11,8 +11,6 @@
 #include "audio-item.hh"
 
 
-
-
 ADD_THIS_TRANSLATOR (Key_performer);
 
 Key_performer::Key_performer ()
@@ -25,21 +23,12 @@ Key_performer::~Key_performer ()
 {
 }
 
-void 
-Key_performer::do_print () const
-{
-#ifndef NPRINT
-  if (key_req_l_)
-    key_req_l_->print ();
-#endif
-}
-
 void
 Key_performer::do_process_music ()
 {
   if (key_req_l_ && key_req_l_->key_)
     {
-      audio_p_ = new Audio_key (*key_req_l_->key_);
+      audio_p_ = new Audio_key (); // *key_req_l_->key_);
       Audio_element_info info (audio_p_, key_req_l_);
       announce_element (info);
       key_req_l_ = 0;
index d8350f1c7a3ad5ad9198424958d13d3147a6e788..8e8babad662d2f470d4968cae56c36483a7a8f2b 100644 (file)
@@ -7,9 +7,7 @@
 
 #include "musical-request.hh"
 #include "command-request.hh"
-#include "local-key-engraver.hh"
 #include "local-key-item.hh"
-#include "key-engraver.hh"
 #include "debug.hh"
 #include "key-item.hh"
 #include "tie.hh"
@@ -41,8 +39,8 @@ protected:
   virtual void process_acknowledged ();
   virtual void do_removal_processing ();
 public:
-  
-  Newkey local_key_;
+
+  SCM last_accs_;
   Key_engraver *key_grav_l_;
   Array<Note_req* > mel_l_arr_;
   Array<Item*> support_l_arr_;
@@ -51,7 +49,6 @@ public:
   Local_key_engraver();
   bool self_grace_b_;
   Grace_align_item * grace_align_l_;
-  Timing_translator * time_trans_l_  ;
 };
 
 
@@ -61,44 +58,21 @@ Local_key_engraver::Local_key_engraver()
   key_grav_l_ = 0;
   key_item_p_ =0;
   grace_align_l_ =0;
-  time_trans_l_ = 0;
+  last_accs_ = SCM_EOL;
 }
 
+
 void
 Local_key_engraver::do_creation_processing ()
 {
-  /*
-    UGHGUHGUH.
-
-    Breaks if Key_engraver is removed from under us.
-  */
-  Translator * result =
-    daddy_grav_l()->get_simple_translator ("Key_engraver");
-
-  key_grav_l_ = dynamic_cast<Key_engraver *> (result);
-
-  if (!key_grav_l_)
-    {
-      warning (_ ("out of tune:"));
-      warning (_f ("can't find: `%s'", "Key_engraver"));
-    }
-  else
-    {
-      local_key_ = key_grav_l_->key_;
-    }
-
-  /*
-    TODO
-    (if we are grace) get key info from parent Local_key_engraver
-  */
-
-  Translator * tr = daddy_grav_l()->get_simple_translator ("Timing_engraver"); // ugh
-  time_trans_l_ = dynamic_cast<Timing_translator*> (tr);
+  last_accs_ = get_property ("keySignature");
 }
 
 void
 Local_key_engraver::process_acknowledged ()
 {
+  SCM localsig = get_property ("localKeySignature");
+  
   if (!key_item_p_ && mel_l_arr_.size()) 
     {
       SCM f = get_property ("forgetAccidentals");
@@ -108,18 +82,23 @@ Local_key_engraver::process_acknowledged ()
          Item * support_l = support_l_arr_[i];
          Note_req * note_l = mel_l_arr_[i];
 
+         int n = note_l->pitch_.notename_i_;
+         int o = note_l->pitch_.octave_i_;
+         int a = note_l->pitch_.accidental_i_;
+         
          /* see if there's a tie that "changes" the accidental */
          /* works because if there's a tie, the note to the left
             is of the same pitch as the actual note */
 
-         int prev_acc =local_key_.get (note_l->pitch_.octave_i_,
-                                       note_l->pitch_.notename_i_);
-         bool different = prev_acc != note_l->pitch_.accidental_i_;
+         SCM prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), localsig);
+         if (prev == SCM_BOOL_F)
+           prev = scm_assoc (gh_int2scm (n), localsig);
+         int prev_acc = (prev == SCM_BOOL_F) ? 0 : gh_scm2int (gh_cdr (prev));
+         bool different = prev_acc != a;
          
          bool tie_changes = tied_l_arr_.find_l (support_l) && different;
          if (!forget
-             && (note_l->forceacc_b_
-                 || !different)
+             && (note_l->forceacc_b_ || different)
              && !tie_changes)
            {
              if (!key_item_p_) 
@@ -133,8 +112,9 @@ Local_key_engraver::process_acknowledged ()
                }
 
              
-             bool extra_natural
-               = sign (prev_acc) * (prev_acc - note_l->pitch_.accidental_i_) == 1 ;
+             bool extra_natural =
+               sign (prev_acc) * (prev_acc - a) == 1
+               && abs(prev_acc) == 2;
 
              key_item_p_->add_pitch (note_l->pitch_,
                                      note_l->cautionary_b_,
@@ -144,9 +124,14 @@ Local_key_engraver::process_acknowledged ()
          
          if (!forget)
            {
-             local_key_.set (note_l->pitch_.octave_i_, note_l->pitch_.notename_i_,
-                             note_l->pitch_.accidental_i_);
+             localsig = scm_assoc_set_x (localsig, gh_cons (gh_int2scm (o),
+                                                            gh_int2scm (n)),
+                                         gh_int2scm (a)); 
+
 #if 0
+             /*
+               TESTME!
+              */
              if (!tied_l_arr_.find_l (support_l))
                {
                  local_key_.clear_internal_forceacc (note_l->pitch_);
@@ -170,7 +155,7 @@ Local_key_engraver::process_acknowledged ()
 void
 Local_key_engraver::do_removal_processing ()
 {
-  // TODO: signal accidentals to Local_key_engraver the 
+  // TODO: if grace ? signal accidentals to Local_key_engraver the 
 }
 
 void
@@ -231,14 +216,15 @@ Local_key_engraver::do_process_music()
   SCM smp = get_property ("measurePosition");
   Moment mp =  (unsmob_moment (smp)) ? *unsmob_moment (smp) : Moment (0);
 
+  SCM sig = get_property ("keySignature");
   if (!mp)
     {
-      if (!to_boolean (get_property ("noResetKey")) && key_grav_l_)
-       local_key_= key_grav_l_->key_;
+      if (!to_boolean (get_property ("noResetKey")))
+       daddy_trans_l_->set_property ("localKeySignature",  sig);
     }
-  else if (key_grav_l_ && key_grav_l_->key_changed_b ())
+  else if (last_accs_ != sig) 
     {
-      local_key_ = key_grav_l_->key_;
+      daddy_trans_l_->set_property ("localKeySignature",  sig);
     }
 }
 
index 7afd3d69e2450be871c17da9a43787abd0fa7825..e91572455daa8ba2a1b0754917ca97d4765a455f 100644 (file)
@@ -356,8 +356,9 @@ Midi_key::Midi_key (Audio_key*a)
 String
 Midi_key::str () const
 {
-  int sharps_i = audio_l_->key_.sharps_i ();
-  int flats_i = audio_l_->key_.flats_i ();
+  // fxime.
+  int sharps_i = 0; //audio_l_->key_.sharps_i ();
+  int flats_i = 0; //audio_l_->key_.flats_i ();
 
   // midi cannot handle non-conventional keys
   if (flats_i && sharps_i)
@@ -370,7 +371,9 @@ Midi_key::str () const
 
   String str = "ff5902";
   str += String_convert::i2hex_str (accidentals_i, 2, '0');
-  str += String_convert::i2hex_str ((int)audio_l_->key_.minor_b (), 2, '0');
+
+  // (int)audio_l_->key_.minor_b ()
+  str += String_convert::i2hex_str (0, 2, '0');
   return String_convert::hex2bin_str (str);
 }
 
index ab0bd3f3a82b295e16ec8a753acd2b7bbc05e50d..a547335081321d302fe8c5342824b5df1568e987 100644 (file)
@@ -47,7 +47,6 @@ static Keyword_ent the_key_tab[]={
   {"in", IN_T},
   {"lyrics", LYRICS},
   {"key", KEY},
-  {"keysignature", KEYSIGNATURE},
   {"mark", MARK},
   {"musicalpitch", MUSICAL_PITCH},
   {"time", TIME_T},
@@ -66,7 +65,6 @@ static Keyword_ent the_key_tab[]={
   {"relative", RELATIVE},
   {"remove", REMOVE},
   {"repeat", REPEAT},
-  {"repetitions", REPETITIONS},
   {"addlyrics", ADDLYRICS},
   {"score", SCORE},
   {"script", SCRIPT},
diff --git a/lily/newkey-def.cc b/lily/newkey-def.cc
new file mode 100644 (file)
index 0000000..6d8e583
--- /dev/null
@@ -0,0 +1,51 @@
+/*   
+  newkey-def.cc --  implement Newkey_def
+  
+  source file of the GNU LilyPond music typesetter
+  
+  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  
+ */
+
+#include "newkey-def.hh"
+#include "misc.hh"
+
+
+Newkey_def::Newkey_def()
+{
+  pitch_alist_ = SCM_EOL;
+}
+
+void
+Newkey_def::transpose (Musical_pitch p) 
+{
+  SCM newlist = SCM_EOL;
+  for (SCM s = pitch_alist_; gh_pair_p (s); s = gh_cdr (s))
+    {
+      SCM k = gh_caar (s);
+
+      if (gh_pair_p (k))
+       {
+         Musical_pitch orig (gh_list (gh_car (k), gh_cdr (k), gh_cdr (s), SCM_UNDEFINED));
+
+         orig.transpose (p);
+
+         SCM key = gh_cons (gh_int2scm (orig.octave_i_),
+                            gh_int2scm (orig.notename_i_));
+
+         newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
+                            newlist);
+       }
+      else if (gh_number_p (k))
+       {
+         Musical_pitch orig (gh_list (gh_int2scm (0), k, gh_cdar (s), SCM_UNDEFINED));
+         orig.transpose (p);
+
+         SCM key =gh_int2scm (orig.notename_i_);
+         newlist = gh_cons (gh_cons (key, gh_int2scm (orig.accidental_i_)),
+                            newlist);
+       }
+    }
+
+  pitch_alist_ = newlist;
+}
diff --git a/lily/newkey.cc b/lily/newkey.cc
deleted file mode 100644 (file)
index 31bd1c9..0000000
+++ /dev/null
@@ -1,45 +0,0 @@
-#include "newkey.hh"
-
-Newkey::Newkey ()
-{
-  clear();
-}
-
-void
-Newkey::clear()
-{
-  key_alist_ = SCM_EOL;
-}
-
-void
-Newkey::set (int n, int a)
-{
-  set_scm (gh_int2scm (n), gh_int2scm (a));
-}
-
-void
-Newkey::set (int o, int n, int a)
-{
-  set_scm (gh_cons (gh_int2scm (o),gh_int2scm(n)), gh_int2scm (a));
-}
-
-void
-Newkey::set_scm (SCM k, SCM v)
-{
-  key_alist_
-    = scm_assoc_set_x (key_alist_, k, v);  
-}
-
-int
-Newkey::get (int o, int n)
-{
-  SCM r = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), key_alist_);
-  return r == SCM_BOOL_F ? get (n) : gh_cdr (r);
-}
-
-int
-Newkey::get (int n)
-{
-  SCM r = scm_assoc (gh_int2scm (n), key_alist_);
-  return r == SCM_BOOL_F ? 0: gh_cdr (r);
-}
index e6c4fe3c191a097738f36fad245cb45adf67cc7c..69be37c7e235d9ead38673763949f49d41f67cb5 100644 (file)
@@ -151,7 +151,6 @@ yylex (YYSTYPE *s,  void * v_l)
 %token IN_T
 %token INVALID
 %token KEY
-%token KEYSIGNATURE
 %token LYRICS
 %token MARK
 %token MEASURES
@@ -169,7 +168,6 @@ yylex (YYSTYPE *s,  void * v_l)
 %token RELATIVE
 %token REMOVE
 %token REPEAT
-%token REPETITIONS
 %token ADDLYRICS
 %token SCM_T
 %token SCORE
@@ -223,7 +221,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <i>      tremolo_type
 %type <i>      int unsigned
 %type <i>      script_dir
-%type <i>      optional_modality 
+
 %type <id>     identifier_init  
 %type <duration> steno_duration optional_notemode_duration
 %type <duration> entered_notemode_duration explicit_duration
@@ -233,7 +231,7 @@ yylex (YYSTYPE *s,  void * v_l)
 %type <pitch>   steno_musical_pitch musical_pitch absolute_musical_pitch
 %type <pitch>   steno_tonic_pitch
 
-%type <pitch_arr>      pitch_list chord_additions chord_subtractions chord_notes chord_step
+%type <pitch_arr>      chord_additions chord_subtractions chord_notes chord_step
 %type <music>  chord
 %type <pitch>  chord_note chord_inversion chord_bass
 %type <midi>   midi_block midi_body
@@ -1008,28 +1006,16 @@ verbose_command_req:
                key_p->key_ = 0;
                $$ = key_p;
        }
-/* UGH. optional.  */
-
-       | KEY NOTENAME_PITCH optional_modality  {
-               Key_change_req *key_p= new Key_change_req;
-               Key_def d;
-               d.pitch_arr_.push (*$2);
-               d.ordinary_key_b_ = true;
-               d.modality_i_ = $3;
-
-               key_p->key_ = new Key_def (d);
-               $$ = key_p;
-               delete $2;
-       }
-       | KEYSIGNATURE pitch_list {
+/*
+TODO: Support for minor/major keys; make `major-scale' settable.
+*/
+       | KEY NOTENAME_PITCH    {
                Key_change_req *key_p= new Key_change_req;
-               Key_def d;
-               d.pitch_arr_ = *$2;
-               d.ordinary_key_b_ = false;
-
-               key_p->key_ = new Key_def(d);
-               $$ = key_p;
-               delete $2;
+               key_p->key_ = new Newkey_def;
+               
+               key_p->key_->pitch_alist_ = scm_eval (ly_symbol2scm ("major-scale"));
+               key_p->key_->transpose (* $2);
+               $$ = key_p; 
        }
        ;
 
@@ -1105,15 +1091,6 @@ verbose_request:
        }
        ;
 
-optional_modality:
-       /* empty */     {
-               $$ = 0;
-       }
-       | int   {
-               $$ = $1;
-       }
-       ;
-
 sup_quotes:
        '\'' {
                $$ = 1;
@@ -1555,6 +1532,11 @@ chord_note:
 /*
        UTILITIES
  */
+
+/*
+  FIXME: use scm.
+*/
+/*
 pitch_list:                    {
                $$ = new Array<Musical_pitch>;
        }
@@ -1563,7 +1545,7 @@ pitch_list:                       {
                delete $2;
        }
        ;
-
+*/
 
 int_list:
        /**/                    {
index b5f224b51c0cc0bc0ced3276f9625c5b2f263d2c..355cb64c09bfd8810c8238a4a77e8e9ecef325e0 100644 (file)
@@ -51,8 +51,8 @@ Tuplet_engraver::do_try_music (Music *r)
          stop_moments_.push (m);
 
          SCM s = get_property ("tupletSpannerDuration");
-         if (SMOB_IS_TYPE_B(Moment, s))
-           m = m <? (now_mom () + *SMOB_TO_TYPE(Moment,s));
+         if (unsmob_moment(s))
+           m = m <? (now_mom () + *unsmob_moment (s));
          
          span_stop_moments_.push (m);
        }
@@ -116,8 +116,8 @@ Tuplet_engraver::do_post_move_processing ()
 
   Moment tsd;
   SCM s = get_property ("tupletSpannerDuration");
-  if (SMOB_IS_TYPE_B(Moment, s))
-    tsd = *SMOB_TO_TYPE(Moment,s);
+  if (unsmob_moment (s))
+    tsd = *unsmob_moment (s);
 
   for (int i= started_span_p_arr_.size (); i--; )
     {
index 8adf113a50c272e7f4aa4598ac7888e203988e1f..965321ee6c5d39408cfad673a973f4f4643d8fb2 100644 (file)
@@ -381,9 +381,19 @@ ScoreContext = \translator {
        defaultBarType = #"|"
        systemStartDelimiterGlyph = #'bar-line
 
+       %
+       % what order to print accs.  We could compute this, 
+       % but computing is more work than putting it here.
+       %
+       % Flats come first, then sharps.
+       keyAccidentalOrder = #'(
+         (6 . -1) (2  . -1) (5 . -1 ) (1  . -1) (4  . -1) (0  . -1) (3  . -1)
+        (3  . 1) (0 . 1) (4 . 1) (1 . 1) (5 . 1) (2 . 1) (6 . 1)
+       )
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        % default settings, mainly for breakable items
        % in alphabetical order
+       % TODO: uniform naming.;  
        %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
        basicBarlineProperties = #`(
                (break-align-symbol . Staff_bar)
index dd7536470cef3ba0111ab8894b66a852ce044ee8..313d5db9dc8bc32ba2c35aba88ff9b6468d144bf 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.3.58
-Entered-date: 08JUN00
+Version: 1.3.59
+Entered-date: 12JUN00
 Description: 
 Keywords: music notation typesetting midi fonts engraving
 Author: hanwen@cs.uu.nl (Han-Wen Nienhuys)
        janneke@gnu.org (Jan Nieuwenhuizen)
 Maintained-by: hanwen@stack.nl (Han-Wen Nienhuys)
 Primary-site: sunsite.unc.edu /pub/Linux/apps/sound/convert
-       1000k lilypond-1.3.58.tar.gz 
+       1000k lilypond-1.3.59.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.3.58.tar.gz 
+       1000k lilypond-1.3.59.tar.gz 
 Copying-policy: GPL
 End
index 0972cf68106a784e81436c0361a81ab59265d86e..564575c68c7183420607c78d6ca0d7571cf780fb 100644 (file)
@@ -1,9 +1,9 @@
 Name: lilypond
-Version: 1.3.58
+Version: 1.3.59
 Release: 1
 Copyright: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.58.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.3.59.tar.gz
 Summary: A program for printing sheet music.
 URL: http://www.cs.uu.nl/~hanwen/lilypond
 # Icon: lilypond-icon.gif
index b9d5c1020d9ffffc742a9f250d4a561956305cb5..42b517f5d05ce5a42b44d8888f32d46bef3334b7 100644 (file)
      )
    )
      
+
+(define major-scale
+  '(
+    (0 . 0)
+    (1 . 0)
+    (2 . 0)
+    (3 . 0)
+    (4 . 0)
+    (5 . 0)
+    (6 . 0)
+    )
+  )