]> git.donarmstrong.com Git - lilypond.git/commitdiff
release: 1.5.45 release/1.5.45
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 21 Mar 2002 00:55:13 +0000 (01:55 +0100)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Thu, 21 Mar 2002 00:55:13 +0000 (01:55 +0100)
45 files changed:
AUTHORS.txt
ChangeLog
Documentation/regression-test.tely
Documentation/topdocs/AUTHORS.texi
VERSION
input/baerenreiter-sarabande.ly
input/regression/accidental-octave.ly
input/regression/accidental-voice.ly [new file with mode: 0644]
input/regression/accidentals.ly
input/regression/system-extents.ly [new file with mode: 0644]
input/test/boxed-molecule.ly
lily/accidental-engraver.cc
lily/beaming-info.cc
lily/grob.cc
lily/include/grob.hh
lily/include/item.hh
lily/include/lily-proto.hh
lily/include/line-of-score.hh
lily/include/paper-column.hh
lily/include/paper-score.hh
lily/include/score-engraver.hh
lily/include/spanner.hh
lily/include/translator-group.hh
lily/item.cc
lily/line-of-score.cc [deleted file]
lily/molecule.cc
lily/paper-column.cc
lily/paper-score.cc
lily/score-engraver.cc
lily/spanner.cc
lily/system.cc [new file with mode: 0644]
lily/translator-group.cc
ly/engraver-init.ly
ly/params-init.ly
ly/property-init.ly
make/out/lilypond.lsm
make/out/lilypond.mandrake.spec
make/out/lilypond.redhat.spec
make/out/lilypond.suse.spec
ps/lilyponddefs.ps
scm/grob-description.scm
scm/molecule.scm
scm/ps.scm
scm/translator-property-description.scm
tex/lilyponddefs.tex

index 13884f19c6cd1cd29182b9bdc2e430bc3942eeab..e3dc690523d91aa97b50b5ec9cca8dcfffef10ab 100644 (file)
@@ -86,5 +86,5 @@ list is alphabetically ordered.
    * August S.Sigov <august@infran.ru>     Russian translation
 
    * Rune Zedeler <rune@zedeler.dk>     Drum notation, beaming and
-     accidental fixes
+     auto-accidental changes. Font updates. Misc fixes.
 
index 9b01d184565b8bdad16d5481eaaf2eb01e388cff..5432c20c492741ab261a1c7bb23885071c7615f7 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,49 @@
+2002-03-21  Han-Wen  <hanwen@cs.uu.nl>
+
+       * VERSION: 1.5.45 released
+
+       * input/regression/system-extents.ly: new regression test. Test
+       System extents. 
+
+       * lily/system.cc: rename LineOfScore into System 
+
+       * lily/molecule.cc (ly_add_molecule): new Scheme ly-add-molecule.
+
+       * lily/grob.cc (ly_get_parent): new Scheme function ly-get-parent.
+       (ly_get_extent): new Scheme function ly-get-extent
+
+       * ps/lilyponddefs.ps: use output-scale for  line-x
+       definition. 
+
+       * scm/ps.scm (font-load-command): 
+       use output-scale
+
+2002-03-20  Rune Zedeler <rune@zedeler.dk>
+       
+       * lily/beaming-info.cc: Stupid typo fixed
+       
+       * lily/accidental-engraver.cc: rewrote accidental-routines to get
+       support for cross-context auto-accidentals.
+       Now the engraver can stay in Staff-context and see other contexts
+       from there.
+       Changed properties: autoAccidentals, autoCautionaries
+
+       * lily/translator-group.cc (set_children_property):
+       Function added recursively setting the same property (deep_copied)
+       for all children of a Translator_group.
+       
+       * ly/property-init.ly: added commands
+       \pianoAccidentals \voiceAccidentals
+       \modernVoiceAccidentals \modernVoiceCautionaries
+
+       * ly/engraver-init.ly: Correct initialization of new accidentals.
+       
+       * scm/translator-property-description.scm: Updated
+       
+       * input/regression/accidental-voice.ly: Added
+       
+       * Documentation/regression-test.tely: Added new test    
+
 2002-03-19  Han-Wen Nienhuys  <hanwen@cs.uu.nl>
 
        * VERSION: 1.5.44 released
index d35558ed0d23c15d7d7d5199bc278e88d09ff975..ee9a1fdb41c6fc663aa101ca2a0a67d99cc5f622 100644 (file)
@@ -53,6 +53,8 @@ Accidentals are currently in a development stage.
 
 @lilypondfile[printfilename]{accidental-octave.ly}
 
+@lilypondfile[printfilename]{accidental-voice.ly}
+
 
 @section Stems
 
@@ -304,6 +306,8 @@ Grace note do weird things with timing. Fragile.
 
 @lilypondfile[printfilename]{font-magnification.ly}
 
+@lilypondfile[printfilename]{system-extents.ly}
+
 @lilypondfile[printfilename,nofragment]{size11.ly}
 
 @lilypondfile[printfilename,nofragment]{size13.ly}
index f7d94f655ccde74fd083cb92630270eebc681caa..e57ae509acb2af6782921d638ba7532ea3a23690 100644 (file)
@@ -86,7 +86,7 @@ list is alphabetically ordered.
 @item @email{august@@infran.ru, August S.Sigov}
     Russian translation
 @item @email{rune@@zedeler.dk, Rune Zedeler}
-    Drum notation, beaming and accidental fixes 
+    Drum notation, beaming and auto-accidental changes. Font updates. Misc fixes.
 @end itemize
 
 @bye
diff --git a/VERSION b/VERSION
index 0d14b138fcb984e00ccac6971f1b557326fa7ef2..22c74e010df09aab47c71729e598e47f986e9b2b 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -1,7 +1,7 @@
 PACKAGE_NAME=LilyPond
 MAJOR_VERSION=1
 MINOR_VERSION=5
-PATCH_LEVEL=44
+PATCH_LEVEL=45
 MY_PATCH_LEVEL=
 
 # use the above to send patches: MY_PATCH_LEVEL is always empty for a
index 1a529b1a9ced380ed7b9456ec7fabfa2f8716380..262ef28ca62fe30cb4b039f4e5d4b56c3c64b435 100644 (file)
@@ -8,24 +8,25 @@
   editor = "August Wenzinger"
   source= "B\\\"arenreiter Urtext"
 
-  texidoc = "The B\\\"arenreiter edition of the Cello Suites is the most
-beautifully typeset piece of music in our collection of music (we both
-own one. It is also lovely on French Horn). This piece follows the
-same beaming as the printed edition. This is done in order to
-benchmarkk the quality of the LilyPond output. As of lilypond 1.5.38,
-the spacing is almost identical. With a line-break forced before
-measure 25, we get back the linebreaking of Baerenreiter.
-
-
-
-This file used to show spacing weaknesses. Now it shows weaknesses in
-slur handling.
-
-Note that the Barenreiter edition contains an engraving mistake. The
-second line begins with measure 6 (but prints 5).
-
-"
-
+  texidoc = "The B\\\"arenreiter edition of the Cello Suites is the
+most beautifully typeset piece of music in our collection of music (we
+both own one. It is also lovely on French Horn). This piece does not
+include articulation, but it does follows the same beaming and
+linebreaking as the printed edition. This is done in order to
+benchmark the quality of the LilyPond output.
+
+As of lilypond 1.5.42, the spacing and beam quanting is almost
+identical.
+
+There are two tweaks in this file: a line-break was forced before
+measure 25, we get back the linebreaking of Baerenreiter.  The stem
+direction is forced in measure 24. The last beam of that measure is up
+in Baerenreiter because of context. We don't detect that yet.
+
+Note that the Barenreiter edition contains a few engraving
+mistakes. The second line begins with measure 6 (but prints 5). The |:
+half way in measure 13 has been forgotten.
+ "
 }
 
 
@@ -51,7 +52,7 @@ sarabandeA =  \context Voice \notes \relative c {
 
   g8 bes16()a c()bes a()g d'8 f, |
   <  e4.-\trill
-     \\ <a,,4 e'> >
+  \\ <c,4 g'> >
   [d8 c bes]
   %%8
   < { f'8 g16()a a4. g16()f  |
@@ -69,9 +70,7 @@ sarabandeA =  \context Voice \notes \relative c {
 
   fis8.-\trill es16 d8 c |
   [bes g']
-  \stemUp
   [a, fis']
-  \stemBoth
   [es' d] |
   %%16
   < bes4.-\trill d, g, > [a8 g f!] |
index 11962c970e9ec3710ecbf449dcbd61b3ca453ff7..f9bdb98024a619c1dc22362cd7699fd9f72690c8 100644 (file)
@@ -1,8 +1,9 @@
-\version "1.5.24.rz2"
+\version "1.5.43.rz1"
 
 \header {
 texidoc="
 This shows how accidentals in different octaves are handled.
+Fixme: Shorten and docu
 "
 }
 
@@ -47,14 +48,14 @@ mel = \notes \transpose c'' {
 mus = \notes {
    \mel
    \property Score.oneMeasureLazy = ##t
-   \property Score.autoAccidentals = #'((measure-same-octave . 0))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-same-octave . 1))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 1))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 0))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 1))
-   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (same-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 1))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (same-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 0))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (any-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 1))
+   < s1^""^""^"$\\backslash$property Score.autoAccidentals = \\#'(Staff (any-octave . 1))" \mel >
    \modernAccidentals
    < s1^""^""^"$\\backslash$modernAccidentals" \mel >
    \modernCautionaries
diff --git a/input/regression/accidental-voice.ly b/input/regression/accidental-voice.ly
new file mode 100644 (file)
index 0000000..18ff739
--- /dev/null
@@ -0,0 +1,60 @@
+\version "1.5.43.rz1"
+
+\header{
+texidoc="
+This shows how modern cross voice auto cautionary accidentals are handled.
+The first two fisses get accidentals because they belong to different voices.
+The first f gets cautionary natural because of previous measure.
+The last f gets cautionary natural because fis was only in the other voice.
+"
+}
+
+#(define  (lo-octave p)
+  (let* ((a (pitch-alteration p))
+         (n (pitch-notename p)))
+    (make-pitch -1 n a)))
+
+#(define (no-octaves music)
+  (let* ((es (ly-get-mus-property music 'elements))
+         (e (ly-get-mus-property music 'element))
+         (p (ly-get-mus-property music 'pitch)))
+
+    (if (pair? es)
+        (ly-set-mus-property
+         music 'elements
+         (map no-octaves es)))
+
+    (if (music? e)
+        (ly-set-mus-property
+         music 'element
+         (no-octaves e)))
+
+    (if (pitch? p)
+        (begin
+          (set! p (lo-octave p))
+          (ly-set-mus-property music 'pitch p)))
+
+
+    music))
+
+voicea = \notes \transpose c'' {
+    \stemUp
+    fis2 a2 f4 fis a2
+}
+voiceb = \notes \transpose c'' {
+    \stemDown
+    c2 fis2  f4 c   f2
+}
+
+\score {
+    <
+       \notes
+       \context NoteNames=namesa \apply #no-octaves \voicea
+       \context Staff < 
+           \modernVoiceCautionaries
+           \context Voice = voicea \voicea
+           \context Voice = voiceb \voiceb
+       >
+       \context NoteNames=namesb \apply #no-octaves \voiceb
+    >
+}
index 71a534d1b43c802df97b53d27336f5ce95d755b5..42b957eac0591a5e5d614666d91e07b874831b1b 100644 (file)
@@ -1,4 +1,4 @@
-\version "1.5.24.rz2"
+\version "1.5.43.rz1"
 
 \header{
 texidoc="
@@ -45,14 +45,14 @@ mel = \notes { \key d \major \time 4/4
   \context Staff \transpose c''' {
    \mel
    \property Score.oneMeasureLazy = ##t
-   \property Score.autoAccidentals = #'((measure-same-octave . 0))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-same-octave . 1))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-same-octave . 1))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 0))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 0))" \mel >
-   \property Score.autoAccidentals = #'((measure-any-octave . 1))
-   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((measure-any-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((same-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (same-octave . 1))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((same-octave . 1))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 0))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((any-octave . 0))" \mel >
+   \property Score.autoAccidentals = #'(Staff (any-octave . 1))
+   < s1^"$\\backslash$property Score.autoAccidentals = \\#'((any-octave . 1))" \mel >
    \modernAccidentals
    < s1^"$\\backslash$modernAccidentals" \mel >
    \modernCautionaries
diff --git a/input/regression/system-extents.ly b/input/regression/system-extents.ly
new file mode 100644 (file)
index 0000000..3d6ec4a
--- /dev/null
@@ -0,0 +1,20 @@
+\header {
+
+    texidoc = "LilyPond correctly determines the size of every
+    system. This includes postscript constructs such as slurs."
+
+    }
+         
+\score { \notes
+\context Voice
+{\slurDown c4 ( g4 ) c''4
+
+}
+
+    \paper { 
+        \translator {
+            \ScoreContext
+            System \override #'molecule-callback = #box-grob-molecule
+            }
+    }
+}
index 0aeb856200cf62b85576bb72aacdff9c7510d3ce..b45f6cfb860cb1ad2b3bb3eaa734b61f9d5d0225 100644 (file)
@@ -11,18 +11,6 @@ texidoc = "overriding the molecule callback can also be used to draw a
  "
 }
 
-#(define (box-molecule xext yext)
-  (ly-make-molecule
-      (list 'filledbox (- (car xext)) (cdr xext)
-                       (- (car yext)) (cdr yext))
-      xext yext)                      
-)
-
-#(define (widen-interval iv amount)
-   (cons (- (car iv) amount)
-         (+ (cdr iv) amount))
-)
-
 #(define (make-molecule-boxer callback)
   (define (molecule-boxer grob)
   (let*
index 14dd955cd3a18914530f1a594bb57a87e3119ae7..5b476a05cb8dd922f4fe61228761046c7a4832e9 100644 (file)
@@ -2,7 +2,7 @@
   accidental-engraver.cc -- implement accidental_engraver
 
   (c)  1997--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  Modified 2001 by Rune Zedeler <rz@daimi.au.dk>
+  Modified 2001-2002 by Rune Zedeler <rz@daimi.au.dk>
 */
 
 #include "musical-request.hh"
@@ -19,6 +19,8 @@
 #include "arpeggio.hh"
 #include "warn.hh"
 
+#include "translator-group.hh"
+
 /**
 
 
@@ -43,7 +45,7 @@ protected:
   virtual void finalize ();
 public:
 
-  // todo -> property
+  // todo -> property   (why? -rz)
   SCM last_keysig_;
 
   /*
@@ -56,6 +58,7 @@ public:
   Link_array<Grob> head_l_arr_;
   Link_array<Item> forced_l_arr_;
   Link_array<Grob> tie_l_arr_;
+  Link_array<Translator_group> origin_l_arr_;
 
 };
 
@@ -70,14 +73,22 @@ void
 Accidental_engraver::initialize ()
 {
   last_keysig_ = get_property ("keySignature");
-  daddy_trans_l_->set_property ("localKeySignature",  last_keysig_);  
+
+  Translator_group * trans_ = daddy_trans_l_;
+  while (trans_) {
+    trans_ -> set_property ("localKeySignature",  ly_deep_copy(last_keysig_));
+    trans_ = trans_->daddy_trans_l_;
+  }
+  daddy_trans_l_->set_children_property("localKeySignature",last_keysig_);
+
 }
 
 /** calculates the number of accidentals on basis of the current local key sig
-  * (passed as argument).
+  * (passed as argument)
   * Returns number of accidentals (0, 1 or 2).
   *   Negative (-1 or -2) if accidental has changed.
   **/
+// FIXME: Use references for SCM-values
 static int
 number_accidentals (SCM sig, Note_req * note_l, SCM curbarnum, SCM lazyness,
                    bool ignore_octave_b)
@@ -114,31 +125,46 @@ number_accidentals (SCM sig, Note_req * note_l, SCM curbarnum, SCM lazyness,
   return a==p ? num : -num;
 }
 
-static int
-number_accidentals (SCM localsig, Note_req * note_l, SCM accidentals_l,
-                   SCM curbarnum) {
+int
+number_accidentals (Note_req * note_l, Translator_group * origin_l,
+                   SCM accidentals_sl, SCM curbarnum_s) {
   int number=0;
   int diff=0;
-  while(gh_pair_p(accidentals_l)) {
-    if(gh_pair_p(ly_car(accidentals_l))) {
-      SCM type = gh_caar(accidentals_l);
-      SCM lazyness = gh_cdar(accidentals_l);
-      bool measure_same_octave_b =
-       gh_eq_p(ly_symbol2scm("measure-same-octave"),type);
-      bool measure_any_octave_b =
-       gh_eq_p(ly_symbol2scm("measure-any-octave"),type);
-      if(measure_same_octave_b || measure_any_octave_b) {
+  if(gh_pair_p(accidentals_sl) && !gh_symbol_p(ly_car(accidentals_sl)))
+    warning(_f("Accidental typesetting list must begin with context-name: %s",
+              ly_scm2string(ly_car(accidentals_sl)).ch_C()));
+  while(gh_pair_p(accidentals_sl) && origin_l) {
+    // If pair then it is a new accidentals typesetting rule to be checked
+    if(gh_pair_p(ly_car(accidentals_sl))) {
+      SCM type = gh_caar(accidentals_sl);
+      SCM lazyness = gh_cdar(accidentals_sl);
+      SCM localsig = origin_l->get_property ("localKeySignature");
+      bool same_octave_b =
+       gh_eq_p(ly_symbol2scm("same-octave"),type);
+      bool any_octave_b =
+       gh_eq_p(ly_symbol2scm("any-octave"),type);
+      if(same_octave_b || any_octave_b) {
        int n = number_accidentals
-         (localsig,note_l,curbarnum,lazyness,measure_any_octave_b);
+         (localsig,note_l,curbarnum_s,lazyness,any_octave_b);
        diff |= n<0;
        number = max(number,abs(n));     
       }
-      else warning(_f("unknown accidental typesetting: %s",
+      else warning(_f("unknown accidental typesetting: %s. Ignored",
                      ly_symbol2string(type).ch_C()));
     }
-    else warning(_f("Accidental typesetting must be pair: %s",
-                     ly_scm2string(ly_car(accidentals_l)).ch_C()));
-    accidentals_l = ly_cdr(accidentals_l);
+    // if symbol then it is a context name. Scan parent contexts to find it.
+    else if (gh_symbol_p(ly_car(accidentals_sl))) {
+      String context = ly_symbol2string(ly_car(accidentals_sl));
+      while (origin_l && !origin_l->is_alias_b(context)) {
+        origin_l = origin_l->daddy_trans_l_;
+      }
+      if (!origin_l)
+       warning(_f("Symbol is not a parent context: %s. Ignored",
+                  context.ch_C()));
+    }
+    else warning(_f("Accidental typesetting must be pair or context-name: %s",
+                     ly_scm2string(ly_car(accidentals_sl)).ch_C()));
+    accidentals_sl = ly_cdr(accidentals_sl);
   }
   return diff ? -number : number;
 }
@@ -148,9 +174,9 @@ Accidental_engraver::create_grobs ()
 {
   if (!key_item_p_ && mel_l_arr_.size ()) 
     {
-      SCM localsig = get_property ("localKeySignature");
-      SCM accidentals_l =  get_property ("autoAccidentals");
-      SCM cautionaries_l =  get_property ("autoCautionaries");
+      //SCM localsig = get_property ("localKeySignature");
+      SCM accidentals_sl =  get_property ("autoAccidentals");
+      SCM cautionaries_sl =  get_property ("autoCautionaries");
       SCM barnum = get_property ("currentBarNumber");
 
       bool extra_natural_b = get_property ("extraNatural")==SCM_BOOL_T;
@@ -158,9 +184,10 @@ Accidental_engraver::create_grobs ()
        {
          Grob * support_l = head_l_arr_[i];
          Note_req * note_l = mel_l_arr_[i];
+         Translator_group * origin_l = origin_l_arr_[i];
 
-         int num = number_accidentals(localsig,note_l,accidentals_l,barnum);
-         int num_caut = number_accidentals(localsig,note_l,cautionaries_l,barnum);
+         int num = number_accidentals(note_l,origin_l,accidentals_sl,barnum);
+         int num_caut = number_accidentals(note_l,origin_l,cautionaries_sl,barnum);
          bool cautionary = to_boolean (note_l->get_mus_property ("cautionary"));
          if (abs(num_caut)>abs(num))
            {
@@ -178,8 +205,8 @@ Accidental_engraver::create_grobs ()
 
          Grob *tie_break_reminder = 0;
          bool tie_changes = false;
-         for (int i=0; i < tie_l_arr_.size (); i++)
-           if (support_l == Tie::head (tie_l_arr_[i], RIGHT))
+         for (int j=0; j < tie_l_arr_.size (); j++)
+           if (support_l == Tie::head (tie_l_arr_[j], RIGHT))
              {
                tie_changes = different;
                /* Enable accidentals for broken tie
@@ -189,7 +216,7 @@ Accidental_engraver::create_grobs ()
                   
                   Maybe check property noTieBreakForceAccidental? */
                if (different)
-                 tie_break_reminder = tie_l_arr_[i];
+                 tie_break_reminder = tie_l_arr_[j];
                break;
              }
 
@@ -231,30 +258,40 @@ Accidental_engraver::create_grobs ()
          int n = pitch->notename_i_;
          int o = pitch->octave_i_;
          int a = pitch->alteration_i_;
-         SCM on = gh_cons (gh_int2scm (o), gh_int2scm (n));
-         if (tie_changes)
-           {
-             /*
-               Remember an alteration that is different both from
-               that of the tied note and of the key signature.
-              */
-             localsig = ly_assoc_front_x
-               (localsig, on, gh_cons(SCM_BOOL_T,barnum));
-           }
-         else
-           {
-             /*
-               not really really correct if there are more than one
-               noteheads with the same notename.
-              */
-             localsig = ly_assoc_front_x
-               (localsig, on, gh_cons(gh_int2scm (a),barnum)); 
-           }
-        }
-  
-      daddy_trans_l_->set_property ("localKeySignature",  localsig);
+         SCM on_s = gh_cons (gh_int2scm (o), gh_int2scm (n));
+
+         /*
+           TODO: Speed this up!
+           Perhaps only check translators mentioned in the auto-accidentals?
+           -rz
+         */
+         Translator_group * trans_ = origin_l_arr_[i];
+         while (trans_) {
+           SCM localsig = trans_->get_property ("localKeySignature");
+           if (tie_changes)
+             {
+               /*
+                 Remember an alteration that is different both from
+                 that of the tied note and of the key signature.
+               */
+               localsig = ly_assoc_front_x
+                 (localsig, on_s, gh_cons(SCM_BOOL_T,barnum));
+             }
+           else
+             {
+               /*
+                 not really really correct if there are more than one
+                 noteheads with the same notename.
+               */
+               localsig = ly_assoc_front_x
+                 (localsig, on_s, gh_cons(gh_int2scm (a),barnum)); 
+             }
+           trans_->set_property ("localKeySignature",  localsig);
+           trans_ = trans_->daddy_trans_l_;
+         }
+       }
     }
-  
+
   
   if (key_item_p_)
     {
@@ -293,7 +330,8 @@ Accidental_engraver::stop_translation_timestep ()
   arpeggios_.clear ();
   tie_l_arr_.clear ();
   head_l_arr_.clear ();
-  forced_l_arr_.clear ();      
+  forced_l_arr_.clear ();
+  origin_l_arr_.clear ();
 }
 
 void
@@ -305,6 +343,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info)
     {
       mel_l_arr_.push (note_l);
       head_l_arr_.push (info.grob_l_);
+      origin_l_arr_.push (info.origin_trans_l_->daddy_trans_l_);
     }
   else if (Tie::has_interface (info.grob_l_))
     {
@@ -327,12 +366,19 @@ Accidental_engraver::process_music ()
   
   SCM sig = get_property ("keySignature");
 
-  /* Detect key sig changes. */
-  if (last_keysig_ != sig) 
-    {
-      daddy_trans_l_->set_property ("localKeySignature",  ly_deep_copy (sig));
-      last_keysig_ = sig;
+  /* Detect key sig changes.
+     Update all parents and children
+     */
+  if (last_keysig_ != sig) {
+    Translator_group * trans_ = daddy_trans_l_;
+    while (trans_) {
+      trans_ -> set_property ("localKeySignature",  ly_deep_copy(sig));
+      trans_ = trans_->daddy_trans_l_;
     }
+    daddy_trans_l_->set_children_property("localKeySignature",sig);
+
+    last_keysig_ = sig;
+  }
 }
 
 
@@ -340,6 +386,7 @@ Accidental_engraver::process_music ()
 
 
 ENTER_DESCRIPTION(Accidental_engraver,
+/* The FIXME below is deprecated and should be removed. -rz */
 /* descr */       "Make accidentals.  Catches note heads, ties and notices key-change
 events.  Due to interaction with ties (which don't come together
 with note heads), this needs to be in a context higher than Tie_engraver. FIXME",
index c9751f049bec5704c130836c317aaa7dafac57a1..35ba768395db13930ea8c0cf68e886fe4377f810 100644 (file)
@@ -38,7 +38,7 @@ Beaming_info_list::best_splitpoint_index (Moment &beat_length,bool subdivide) co
       beat_pos = infos_[i].start_mom_ / beat_length;
       int den = beat_pos.den ();
       if (infos_[i].beams_i_drul_[LEFT] == infos_[i-1].beams_i_drul_[RIGHT] && !subdivide)
-       den *= 4;
+       den *= 2;
       if (den < minden)
        {
          minidx = i;
index c6088ff5f197b9e53d92acb2e539a640a09c14e5..94758b7990073928724da25a630f5e49b1cf6d4f 100644 (file)
@@ -151,7 +151,7 @@ Grob::remove_grob_property (const char* key)
 /*
   Puts the k, v in the immutable_property_alist_, which is convenient for
   storing variables that are needed during the breaking process. (eg.
-  Line_of_score::rank : int)
+  System::rank : int)
  */
 void
 Grob::set_immutable_grob_property (const char*k, SCM v)
@@ -331,7 +331,7 @@ Grob::do_break_processing ()
 
 
 
-Line_of_score *
+System *
 Grob::line_l () const
 {
   return 0;
@@ -379,8 +379,8 @@ Grob::handle_broken_grobs (SCM src, SCM criterion)
        }
       else
        {
-         Line_of_score * line
-           = dynamic_cast<Line_of_score*> (unsmob_grob (criterion));
+         System * line
+           = dynamic_cast<System*> (unsmob_grob (criterion));
          if (sc->line_l () != line)
            {
              sc = sc->find_broken_piece (line);
@@ -452,7 +452,7 @@ Grob::handle_broken_dependencies ()
       for (int i = 0;  i< s->broken_into_l_arr_ .size (); i++)
        {
          Grob * sc = s->broken_into_l_arr_[i];
-         Line_of_score * l = sc->line_l ();
+         System * l = sc->line_l ();
          sc->mutable_property_alist_ =
            handle_broken_grobs (mutable_property_alist_,
                                 l ? l->self_scm () : SCM_UNDEFINED);
@@ -460,7 +460,7 @@ Grob::handle_broken_dependencies ()
     }
 
 
-  Line_of_score *line = line_l ();
+  System *line = line_l ();
 
   if (line && common_refpoint (line, X_AXIS) && common_refpoint (line, Y_AXIS))
     {
@@ -468,7 +468,7 @@ Grob::handle_broken_dependencies ()
        = handle_broken_grobs (mutable_property_alist_,
                               line ? line->self_scm () : SCM_UNDEFINED);
     }
-  else if (dynamic_cast <Line_of_score*> (this))
+  else if (dynamic_cast <System*> (this))
     {
       mutable_property_alist_ = handle_broken_grobs (mutable_property_alist_,
                                            SCM_UNDEFINED);
@@ -479,7 +479,7 @@ Grob::handle_broken_dependencies ()
        This element is `invalid'; it has been removed from all
        dependencies, so let's junk the element itself.
 
-       do not do this for Line_of_score, since that would remove
+       do not do this for System, since that would remove
        references to the originals of score-elts, which get then GC'd
  (a bad thing.)
       */
@@ -514,7 +514,7 @@ Grob::handle_prebroken_dependencies ()
 }
 
 Grob*
-Grob::find_broken_piece (Line_of_score*) const
+Grob::find_broken_piece (System*) const
 {
   return 0;
 }
@@ -886,6 +886,30 @@ ly_get_paper_var (SCM grob, SCM sym)
 
 
 
+SCM
+ly_get_extent (SCM grob, SCM refp, SCM axis)
+{
+  Grob * sc = unsmob_grob (grob);
+  Grob * ref = unsmob_grob (refp);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(ref, refp, SCM_ARG2, __FUNCTION__, "grob");
+  
+  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG3, __FUNCTION__, "axis");
+
+  return ly_interval2scm ( sc->extent (ref, Axis (gh_scm2int (axis))));
+}
+
+SCM
+ly_get_parent (SCM grob, SCM axis)
+{
+  Grob * sc = unsmob_grob (grob);
+  SCM_ASSERT_TYPE(sc, grob, SCM_ARG1, __FUNCTION__, "grob");
+  SCM_ASSERT_TYPE(ly_axis_p(axis), axis, SCM_ARG2, __FUNCTION__, "axis");
+
+  return sc->get_parent (Axis (gh_scm2int (axis)))->self_scm();
+}
+
+
 static void
 init_functions ()
 {
@@ -895,8 +919,10 @@ init_functions ()
                      (Scheme_function_unknown)ly_set_grob_property);
   scm_c_define_gsubr ("ly-get-spanner-bound", 2 , 0, 0,
                      (Scheme_function_unknown) spanner_get_bound);
-  scm_c_define_gsubr ("ly-get-paper-variable", 2 , 0, 0,
-                     (Scheme_function_unknown) ly_get_paper_var);
+  scm_c_define_gsubr ("ly-get-extent", 3, 0, 0,
+                     (Scheme_function_unknown) ly_get_extent);
+  scm_c_define_gsubr ("ly-get-parent", 2, 0, 0,
+                     (Scheme_function_unknown) ly_get_parent);
 }
 
 bool
index 98c0b7ae82bd38ebd739a1d5e70474c0c05e9b39..028f5a14b7aea480942003778bfe0cc3a03a65f7 100644 (file)
@@ -89,7 +89,7 @@ public:
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
     */
   void add_dependency (Grob*);    
-  virtual Line_of_score * line_l () const;
+  virtual System * line_l () const;
   bool linked_b () const;
 
 
@@ -107,7 +107,7 @@ public:
   static SCM handle_broken_grobs(SCM, SCM criterion);
 
   virtual void do_break_processing ();
-  virtual Grob *find_broken_piece (Line_of_score*) const;
+  virtual Grob *find_broken_piece (System*) const;
   virtual void discretionary_processing ();
   virtual SCM do_derived_mark ();
 
index 6c4aa91bbad5ecc1acd2b99093a7d1bf9845f661..77fd2be90008b9364314c26ecd6061e4b5964962 100644 (file)
@@ -36,9 +36,9 @@ public:
   Direction break_status_dir () const;
   
   Item * find_prebroken_piece (Direction) const;
-  Grob * find_broken_piece (Line_of_score*) const;    
+  Grob * find_broken_piece (System*) const;    
 
-  virtual Line_of_score * line_l () const;
+  virtual System * line_l () const;
   virtual Paper_column * column_l () const;
   virtual void handle_prebroken_dependencies ();
 protected:
index b5451eb06fb5765e4e907137793f06083d4fb945..e250a6a7efd3c266ff37b9615cb802067cc02037 100644 (file)
@@ -75,7 +75,7 @@ class Key_performer;
 class Keyword_ent;
 class Keyword_table;
 class Line_group_engraver_group;
-class Line_of_score;
+class System;
 class Local_key_item;
 class Lookup;
 class Lyric_combine_music;
index 61a755e347030eee4c40faf8dd11d999fb677fb0..4ff07730ef9732d625d7858517d8625b5f090a10 100644 (file)
 #include "column-x-positions.hh"
 #include "spanner.hh"
 
-class Line_of_score : public Spanner
+class System : public Spanner
 {
 public:
   int rank_i_;
   void post_processing (bool);
 
-  Line_of_score (SCM);
+  System (SCM);
   /// is #c# contained in #*this#?
   bool contains_b (Paper_column const *c) const;
   int element_count () const;
index 59e2c797df9e5dde246796815aad524ff8872ca0..ed850c4e247ac5d87ffb2ec9ce042328769d84e1 100644 (file)
@@ -22,10 +22,10 @@ public:
   int  rank_i_;
   virtual void do_break_processing ();
   virtual Paper_column *column_l () const;
-  virtual Line_of_score *line_l () const;
+  virtual System *line_l () const;
 
   /// if lines are broken then this column is in #line#
-  Line_of_score *line_l_;
+  System *line_l_;
 
   static int rank_i (Grob*);
 
index 2e238c48076dfd58f62f48a457544d22301889ac..940a4fb62b929c05f8b6c8e051126aca71288679 100644 (file)
@@ -28,7 +28,7 @@ public:
   Paper_def *paper_l_;
 
   Paper_outputter *outputter_l_;  
-  Line_of_score * line_l_;
+  System * line_l_;
   
   Paper_score ();
 
@@ -38,7 +38,7 @@ public:
   int find_col_idx (Paper_column const *) const;
 
   Link_array<Item> broken_col_range (Item const*,Item const*) const;
-  void typeset_line (Line_of_score*);
+  void typeset_line (System*);
     
 protected:
     /* MAIN ROUTINES */
index 7bad0008a6dcf492a8360678ed339583a0428011..0f0218ddc895f2656c1ba4b542f441279eea4f1f 100644 (file)
@@ -19,7 +19,7 @@
 class Score_engraver : 
   public Engraver_group_engraver, public Global_translator 
 {
-  Line_of_score * scoreline_l_;
+  System * scoreline_l_;
   int breaks_i_;
 
   Link_array<Grob> elem_p_arr_;
index e2b4a2a1bbd6453f52cbb8ea5d2e0b27a8b60959..ebf5af6a8629e56940ef7a841532cdd4928c7f41 100644 (file)
@@ -52,14 +52,14 @@ public:
   Real spanner_length () const;
 
   static int compare (Spanner * const &,Spanner * const &);
-  virtual Grob* find_broken_piece (Line_of_score*) const;
+  virtual Grob* find_broken_piece (System*) const;
   virtual SCM do_derived_mark ();
 protected:
   void set_my_columns ();
 
   VIRTUAL_COPY_CONS (Grob);
   virtual void do_break_processing ();
-  virtual Line_of_score*line_l () const;
+  virtual System*line_l () const;
 };
 
 
index 74a3490d3cf4840ac0e780f13da219094d2d5ac1..1b7069e74046a77f2e246460fb34d837c9d1e195 100644 (file)
@@ -20,6 +20,7 @@
 // egcs
 typedef void (Translator::*Method_pointer) (void);
 #define set_property(x,y) internal_set_property(ly_symbol2scm(x),y)
+#define set_children_property(x,y) internal_set_children_property(ly_symbol2scm(x),y)
 
 class Scheme_hash_table;
 
@@ -43,6 +44,7 @@ public:
 
   void unset_property (SCM var_sym);
   void internal_set_property (SCM var_sym, SCM value);  
+  void internal_set_children_property (SCM var_sym, SCM value);  
   Translator_group *where_defined (SCM name_sym) const;
 
   String id_str_;
index b07210f8bc011a5f4dc0e17642686fa293da7832..2d161192f69ce8b3c89ee9fc107fd3229e2f43b6 100644 (file)
@@ -51,7 +51,7 @@ Item::column_l () const
   return parent ? parent->column_l () : 0;
 }
 
-Line_of_score *
+System *
 Item::line_l () const
 {
   Grob *g = get_parent (X_AXIS);
@@ -97,7 +97,7 @@ Item::discretionary_processing ()
 }
 
 Grob*
-Item::find_broken_piece (Line_of_score*l) const
+Item::find_broken_piece (System*l) const
 {
   if (line_l () == l) 
     return (Item*) (this);
diff --git a/lily/line-of-score.cc b/lily/line-of-score.cc
deleted file mode 100644 (file)
index c65b9ac..0000000
+++ /dev/null
@@ -1,530 +0,0 @@
-/*
-  scoreline.cc -- implement Line_of_score
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-#include "input-smob.hh"
-#include "axis-group-interface.hh"
-#include "debug.hh"
-#include "line-of-score.hh"
-#include "main.hh"
-#include "paper-column.hh"
-#include "paper-def.hh"
-#include "paper-outputter.hh"
-#include "paper-score.hh"
-#include "string.hh"
-#include "warn.hh"
-#include "dimensions.hh"
-#include "molecule.hh"
-#include "all-font-metrics.hh"
-
-// todo: use map.
-void
-fixup_refpoints (SCM s)
-{
-  for (; gh_pair_p (s); s = ly_cdr (s))
-    {
-      Grob::fixup_refpoint (ly_car (s));
-    }
-}
-
-
-Line_of_score::Line_of_score (SCM s)
-  : Spanner (s)
-{
-  rank_i_ = 0;
-
-  Axis_group_interface::set_interface (this);
-  Axis_group_interface::set_axes (this, Y_AXIS,X_AXIS);
-}
-
-int
-Line_of_score::element_count () const
-{
-  return scm_ilength (get_grob_property ("all-elements"));
-}
-
-void
-Line_of_score::typeset_grob (Grob * elem_p)
-{
-  elem_p->pscore_l_ = pscore_l_;
-  Pointer_group_interface::add_grob (this, ly_symbol2scm ("all-elements"),elem_p);
-  scm_gc_unprotect_object (elem_p->self_scm ());
-}
-
-void
-Line_of_score::output_lines ()
-{
-  for (SCM s = get_grob_property ("all-elements");
-       gh_pair_p (s); s = ly_cdr (s))
-    {
-      unsmob_grob (ly_car (s))->do_break_processing ();
-    }
-
-  /*
-    fixups must be done in broken line_of_scores, because new elements
-    are put over there.  */
-  int count = 0;
-  for (int i=0; i < broken_into_l_arr_.size (); i++)
-    {
-      Grob *se = broken_into_l_arr_[i];
-      SCM all = se->get_grob_property ("all-elements");
-      for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
-       {
-         fixup_refpoint (ly_car (s));
-       }
-      count += scm_ilength (all);
-    }
-  
-  /*
-    needed for doing items.
-   */
-  fixup_refpoints (get_grob_property ("all-elements"));
-
-  
-  for (SCM s = get_grob_property ("all-elements");
-       gh_pair_p (s); s = ly_cdr (s))
-    {
-      unsmob_grob (ly_car (s))->handle_broken_dependencies ();
-    }
-  handle_broken_dependencies ();
-
-  if (verbose_global_b)
-    progress_indication (_f ("Element count %d.",  count + element_count ()));
-
-  
-  for (int i=0; i < broken_into_l_arr_.size (); i++)
-    {
-      Line_of_score *line_l = dynamic_cast<Line_of_score*> (broken_into_l_arr_[i]);
-
-      if (verbose_global_b)
-       progress_indication ("[");
-      line_l->post_processing (i+1 == broken_into_l_arr_.size ());
-
-      if (verbose_global_b)
-       {
-         progress_indication (to_str (i));
-         progress_indication ("]");
-       }
-
-      if (i < broken_into_l_arr_.size () - 1)
-       {
-         SCM lastcol =  ly_car (line_l->get_grob_property ("columns"));
-         Grob*  e = unsmob_grob (lastcol);
-
-         SCM between = ly_symbol2scm ("between-system-string");
-         SCM inter = e->internal_get_grob_property (between);
-         if (gh_string_p (inter))
-           {
-             pscore_l_->outputter_l_
-               ->output_scheme (scm_list_n (between, 
-                                            inter, SCM_UNDEFINED));          
-           }
-       }
-    }
-}
-
-
-
-
-/*
-  Find the loose columns in POSNS, and drape them around the columns
-  specified in BETWEEN-COLS.  */
-void
-set_loose_columns (Line_of_score* which, Column_x_positions const *posns)
-{
-  for (int i = 0; i < posns->loose_cols_.size (); i++)
-    {
-      int divide_over = 1;
-      Item *loose = dynamic_cast<Item*> (posns->loose_cols_[i]);
-      Paper_column* col = dynamic_cast<Paper_column*> (loose);
-      
-      if (col->line_l_)
-       continue;
-
-      
-      Item * left = 0;
-      Item * right = 0;
-      do
-       {
-         SCM between = loose->get_grob_property ("between-cols");
-         if (!gh_pair_p (between))
-           break;
-
-
-         Item * l=dynamic_cast<Item*> (unsmob_grob (ly_car (between)));
-         Item * r=dynamic_cast<Item*> (unsmob_grob (ly_cdr (between)));
-
-         if (!(l && r))
-           break ;
-         
-         if (!left && l)
-           {
-             left = l->column_l ();
-           }
-
-         divide_over ++;
-
-         loose = right = r->column_l ();
-       }
-      while (1);
-      
-    
-#if 0
-      Real rx = right->relative_coordinate (right->get_parent (X_AXIS), X_AXIS);
-      Real lx = left->relative_coordinate (left->get_parent (X_AXIS), X_AXIS);
-
-      /*
-       divide space equally over loose columns.
-       */
-      int j = 1;
-      loose = col;
-      while (1)
-       {
-         SCM between = loose->get_grob_property ("between-cols");
-         if (!gh_pair_p (between))
-           break;
-
-         Paper_column *thiscol = dynamic_cast<Paper_column*> (loose);
-
-         thiscol->line_l_ = which;
-         thiscol->translate_axis (lx + j*(rx - lx)/divide_over, X_AXIS);
-
-         j ++; 
-         loose = dynamic_cast<Item*> (unsmob_grob (ly_cdr (between)));
-       }
-#else
-      /*
-       We divide the remaining space of the column over the left and
-       right side. At the moment, we  
-       
-      */
-      Grob * common = right->common_refpoint (left, X_AXIS);
-      
-      Real rx =        right->extent(common, X_AXIS)[LEFT];
-      Real lx =  left->extent(common, X_AXIS)[RIGHT];
-      Real total_dx = rx - lx;
-      Interval cval =col->extent (col, X_AXIS);
-
-      /*
-       
-       We put it in the middle. This is not an ideal solution -- the
-       break alignment code inserts a fixed space before the clef
-       (about 1 SS), while the space following the clef is
-       flexible. In tight situations, the clef will almost be on top
-       of the following note. 
-       
-      */
-      Real dx = rx-lx - cval.length ();
-      if (total_dx < 2* cval.length ())
-       {
-         /*
-           todo: this is discontinuous. I'm too tired to
-           invent a sliding mechanism. Duh.
-
-           TODO.
-          */
-         dx *= 0.25;
-       }
-      else
-       dx *= 0.5;
-
-      col->line_l_ = which;
-      col->translate_axis (lx + dx - cval[LEFT], X_AXIS); 
-#endif
-    }
-}
-
-// const?
-void
-Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
-{
-  for (int i=0; i < breaking.size (); i++)
-    {
-      Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone ());
-      line_l->rank_i_ = i;
-      //      line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
-      Link_array<Grob> c (breaking[i].cols_);
-      pscore_l_->typeset_line (line_l);
-      
-      line_l->set_bound (LEFT,c[0]);
-      line_l->set_bound (RIGHT,c.top ());
-      for (int j=0; j < c.size (); j++)
-       {
-         c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
-         dynamic_cast<Paper_column*> (c[j])->line_l_ = line_l;
-       }
-      set_loose_columns (line_l, &breaking[i]);
-      broken_into_l_arr_.push (line_l);
-    }
-}
-
-
-#define GLOBAL_SYMBOL(cname, name)  \
-SCM cname ;                                    \
-void \
-cname ## _init_func ()                         \
-{                                              \
-  cname = ly_symbol2scm (name);                        \
-  scm_permanent_object (cname);                        \
-}                                              \
-ADD_SCM_INIT_FUNC (cname,cname ## _init_func);\
-
-
-GLOBAL_SYMBOL (offset_sym , "translate-molecule");
-GLOBAL_SYMBOL (placebox_sym , "placebox");
-GLOBAL_SYMBOL (combine_sym , "combine-molecule");
-
-
-
-void
-Line_of_score::output_molecule (SCM expr, Offset o)
-{
-
-  while (1)
-    {
-      if (!gh_pair_p (expr))
-       return;
-  
-      SCM head =ly_car (expr);
-      if (unsmob_input (head))
-       {
-         Input * ip = unsmob_input (head);
-      
-
-         pscore_l_->outputter_l_->output_scheme (scm_list_n (ly_symbol2scm ("define-origin"),
-                                                          ly_str02scm (ip->file_str ().ch_C ()),
-                                                          gh_int2scm (ip->line_number ()),
-                                                          gh_int2scm (ip->column_number ()),
-                                                          SCM_UNDEFINED));
-         expr = ly_cadr (expr);
-       }
-      else  if (head ==  ly_symbol2scm ("no-origin"))
-       {
-         pscore_l_->outputter_l_->output_scheme (scm_list_n (head, SCM_UNDEFINED));
-         expr = ly_cadr (expr);
-       }
-      else if (head == ly_symbol2scm ("translate-molecule"))
-       {
-         o += ly_scm2offset (ly_cadr (expr));
-         expr = ly_caddr (expr);
-       }
-      else if (head == ly_symbol2scm ("combine-molecule"))
-       {
-         output_molecule (ly_cadr (expr), o);
-         expr = ly_caddr (expr);
-       }
-      else
-       {
-         pscore_l_->outputter_l_->
-           output_scheme (scm_list_n (placebox_sym,
-                                   gh_double2scm (o[X_AXIS]),
-                                   gh_double2scm (o[Y_AXIS]),
-                                   expr,
-                                   SCM_UNDEFINED));
-
-         return;
-       }
-    }
-}
-
-void
-Line_of_score::output_scheme (SCM s)
-{
-  pscore_l_->outputter_l_->output_scheme (s);
-}
-
-void
-Line_of_score::add_column (Paper_column*p)
-{
-  Grob *me = this;
-  SCM cs = me->get_grob_property ("columns");
-  Grob * prev =  gh_pair_p (cs) ? unsmob_grob (ly_car (cs)) : 0;
-
-  p->rank_i_ = prev ? Paper_column::rank_i (prev) + 1 : 0; 
-
-  me->set_grob_property ("columns",  gh_cons (p->self_scm (), cs));
-
-  Axis_group_interface::add_element (me, p);
-}
-
-
-
-/*
-  TODO: use scm_map iso. for loops.
- */
-void
-Line_of_score::pre_processing ()
-{
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
-    unsmob_grob (ly_car (s))->discretionary_processing ();
-
-  if (verbose_global_b)
-    progress_indication (_f ("Element count %d ",  element_count ()));
-
-  
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
-    unsmob_grob (ly_car (s))->handle_prebroken_dependencies ();
-  
-  fixup_refpoints (get_grob_property ("all-elements"));
-  
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
-    {
-      Grob* sc = unsmob_grob (ly_car (s));
-      sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
-    }
-  
-  progress_indication ("\n" + _ ("Calculating column positions...") + " ");
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
-    {
-      Grob * e = unsmob_grob (ly_car (s));
-      SCM proc = e->get_grob_property ("spacing-procedure");
-      if (gh_procedure_p (proc))
-       gh_call1 (proc, e->self_scm ());
-    }
-}
-
-void
-Line_of_score::post_processing (bool last_line)
-{
-  for (SCM s = get_grob_property ("all-elements");
-       gh_pair_p (s); s = ly_cdr (s))
-    {
-      Grob* sc = unsmob_grob (ly_car (s));
-      sc->calculate_dependencies (POSTCALCED, POSTCALCING,
-                                 ly_symbol2scm ("after-line-breaking-callback"));
-    }
-
-  Interval i (extent (this, Y_AXIS));
-  if (i.empty_b ())
-    programming_error ("Huh?  Empty Line_of_score?");
-  else
-    translate_axis (- i[MAX], Y_AXIS);
-
-  Real height = i.length ();
-  if (height > 50 CM)
-    {
-      programming_error ("Improbable system height");
-      height = 50 CM;
-    }
-
-  /*
-    generate all molecules  to trigger all font loads.
-
-    (ugh. This is not very memory efficient.)  */
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
-    {
-      unsmob_grob (ly_car (s))->get_molecule ();
-    }
-  /*
-    font defs;
-   */
-  SCM font_names = ly_quote_scm (paper_l ()->font_descriptions ());  
-  output_scheme (scm_list_n (ly_symbol2scm ("define-fonts"),
-                            font_names,
-                            SCM_UNDEFINED));
-
-  /*
-    line preamble.
-   */
-  output_scheme (scm_list_n (ly_symbol2scm ("start-line"),
-                         gh_double2scm (height),
-                         SCM_UNDEFINED));
-  
-  /* Output elements in three layers, 0, 1, 2.
-     The default layer is 1. */
-  for (int i = 0; i < 3; i++)
-    for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s);
-        s = ly_cdr (s))
-      {
-       Grob *sc = unsmob_grob (ly_car (s));
-       Molecule *m = sc->get_molecule ();
-       if (!m)
-         continue;
-       
-       SCM s = sc->get_grob_property ("layer");
-       int layer = gh_number_p (s) ? gh_scm2int (s) : 1;
-       if (layer != i)
-         continue;
-       
-       Offset o (sc->relative_coordinate (this, X_AXIS),
-                 sc->relative_coordinate (this, Y_AXIS));
-       
-       SCM e = sc->get_grob_property ("extra-offset");
-       if (gh_pair_p (e))
-         {
-           o[X_AXIS] += gh_scm2double (ly_car (e));
-           o[Y_AXIS] += gh_scm2double (ly_cdr (e));      
-         }
-       
-       output_molecule (m->get_expr (), o);
-      }
-  
-  if (last_line)
-    {
-      output_scheme (scm_list_n (ly_symbol2scm ("stop-last-line"), SCM_UNDEFINED));
-    }
-  else
-    {
-      output_scheme (scm_list_n (ly_symbol2scm ("stop-line"), SCM_UNDEFINED));
-    }
-}
-
-
-Link_array<Item> 
-Line_of_score::broken_col_range (Item const*l, Item const*r) const
-{
-  Link_array<Item> ret;
-
-  l = l->column_l ();
-  r = r->column_l ();
-  SCM s = get_grob_property ("columns");
-
-  while (gh_pair_p (s) && ly_car (s) != r->self_scm ())
-    s = ly_cdr (s);
-    
-  if (gh_pair_p (s))
-    s = ly_cdr (s);
-  
-  while (gh_pair_p (s) && ly_car (s) != l->self_scm ())
-    {
-      Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (ly_car (s)));
-      if (Item::breakable_b (c) && !c->line_l_)
-       ret.push (c);
-
-      s = ly_cdr (s);
-    }
-
-  ret.reverse ();
-  return ret;
-}
-
-/**
-   Return all columns, but filter out any unused columns , since they might
-   disrupt the spacing problem.
- */
-Link_array<Grob>
-Line_of_score::column_l_arr ()const
-{
-  Link_array<Grob> acs
-    = Pointer_group_interface__extract_grobs (this, (Grob*) 0, "columns");
-  bool bfound = false;
-  for (int i= acs.size (); i -- ;)
-    {
-      bool brb = Item::breakable_b (acs[i]);
-      bfound = bfound || brb;
-
-      /*
-       the last column should be breakable. Weed out any columns that
-       seem empty. We need to retain breakable columns, in case
-       someone forced a breakpoint.
-      */
-      if (!bfound || !Paper_column::used_b (acs[i]))
-       acs.del (i);
-    }
-  return acs;
-}
-  
index 634ec726bd7b2c1bdbdbaaac8acfbf0fa8cf0a42..4efdcfaf1de14a39050a557e441cb3c47a40c762 100644 (file)
@@ -184,6 +184,22 @@ Molecule::ly_molecule_combined_at_edge (SCM first, SCM axis, SCM direction,
   return result.smobbed_copy ();
 }
 
+SCM
+ly_add_molecule (SCM first, SCM second)
+{
+  Molecule * m1 = unsmob_molecule (first);
+  Molecule * m2 = unsmob_molecule (second);
+  Molecule result;
+
+
+  if (m1)
+    result = *m1;
+  if (m2)
+    result.add_molecule (*m2);
+
+  return result.smobbed_copy ();
+}
+
 
 SCM
 make_molecule (SCM expr, SCM xext, SCM yext)
@@ -232,7 +248,8 @@ molecule_init ()
 {
   scm_c_define_gsubr ("ly-make-molecule", 3, 0, 0, (Scheme_function_unknown) make_molecule);
   scm_c_define_gsubr ("ly-fontify-atom", 2, 0, 0, (Scheme_function_unknown) ly_fontify_atom);
-  scm_c_define_gsubr ("ly-align-to!", 3, 0, 0, (Scheme_function_unknown) ly_align_to_x);    
+  scm_c_define_gsubr ("ly-align-to!", 3, 0, 0, (Scheme_function_unknown) ly_align_to_x);
+  scm_c_define_gsubr ("ly-add-molecule", 2, 0,0,(Scheme_function_unknown) ly_add_molecule);
   scm_c_define_gsubr ("ly-combine-molecule-at-edge", 5 , 0, 0, (Scheme_function_unknown) Molecule::ly_molecule_combined_at_edge);
   scm_c_define_gsubr ("ly-set-molecule-extent!", 3 , 0, 0, (Scheme_function_unknown) Molecule::ly_set_molecule_extent_x);
   scm_c_define_gsubr ("ly-get-molecule-extent", 2 , 0, 0, (Scheme_function_unknown) Molecule::ly_get_molecule_extent);
index 7296041000ced4c25196c42e339e4ed63d30d300..3f7d17a4000f3c37917a2df4c375956a4ff0e8c8 100644 (file)
@@ -20,7 +20,7 @@
 
 /*
   Paper_columns form the top-most item parent. (The Paper_columns X
-  parent is Line_of_score, which is a spanner.)
+  parent is System, which is a spanner.)
 
   Paper_columns form the units for the spacing engine. They are
   numbered, the first (leftmost) is column 0. Numbering happens before
@@ -45,7 +45,7 @@ Paper_column::rank_i (Grob*me)
   return dynamic_cast<Paper_column*> (me)->rank_i_;
 }
 
-Line_of_score*
+System*
 Paper_column::line_l () const
 {
   return line_l_;
index 7971743be44de4677e8c5e029a4cf1011eabc933..2154b40bf5a01063cc2d2d771999d3536e0c025a 100644 (file)
@@ -31,7 +31,7 @@ Paper_score::Paper_score ()
 }
 
 void
-Paper_score::typeset_line (Line_of_score *l)
+Paper_score::typeset_line (System *l)
 {
   if (!line_l_)
     {
index 690b05af269525621df5ea0c3b48d4acb8f8f6eb..899b1d0208ab774594bd7bc6c921ea725fe4f2fa 100644 (file)
@@ -90,9 +90,9 @@ Score_engraver::initialize ()
   pscore_p_ = new Paper_score;
   pscore_p_->paper_l_ = dynamic_cast<Paper_def*> (output_def_l_);
 
-  SCM props = get_property ("LineOfScore");
+  SCM props = get_property ("System");
 
-  pscore_p_->typeset_line (new Line_of_score (props));
+  pscore_p_->typeset_line (new System (props));
   
   make_columns ();
   scoreline_l_ = pscore_p_->line_l_;
@@ -303,7 +303,7 @@ Score_engraver::acknowledge_grob (Grob_info gi)
 
 
 ENTER_DESCRIPTION(Score_engraver,
-/* descr */       "Top level engraver. Takes care of generating columns and the complete  system (ie. LineOfScore)
+/* descr */       "Top level engraver. Takes care of generating columns and the complete  system (ie. System)
 
 
 This engraver decides whether a column is breakable. The default is
@@ -315,7 +315,7 @@ that there are no beams or notes that prevent a breakpoint.)
 
 
 ",
-/* creats*/       "LineOfScore PaperColumn NonMusicalPaperColumn",
+/* creats*/       "System PaperColumn NonMusicalPaperColumn",
 /* acks  */       "note-spacing-interface staff-spacing-interface",
 /* reads */       "currentMusicalColumn currentCommandColumn",
 /* write */       "");
index bc8cb45a09e95123257890cc9ffe3afee2e261f4..0b6573dd72c51d20dcf507fcc21034c044c2c55e 100644 (file)
@@ -173,9 +173,9 @@ Spanner::set_bound (Direction d, Grob*s)
   spanned_drul_[d] =i;
 
   /**
-     We check for Line_of_score to prevent the column -> line_of_score
+     We check for System to prevent the column -> line_of_score
      -> column -> line_of_score -> etc situation */
-  if (d== LEFT && !dynamic_cast<Line_of_score*> (this))
+  if (d== LEFT && !dynamic_cast<System*> (this))
     {
       set_parent (i, X_AXIS);
     }
@@ -219,7 +219,7 @@ Spanner::spanner_length () const
   return r-l;
 }
 
-Line_of_score *
+System *
 Spanner::line_l () const
 {
   if (!spanned_drul_[LEFT] || !spanned_drul_[RIGHT])
@@ -231,7 +231,7 @@ Spanner::line_l () const
 
 
 Grob*
-Spanner::find_broken_piece (Line_of_score*l) const
+Spanner::find_broken_piece (System*l) const
 {
   int idx = binsearch_link_array (broken_into_l_arr_, (Spanner*)l, Spanner::compare);
   
diff --git a/lily/system.cc b/lily/system.cc
new file mode 100644 (file)
index 0000000..3405d68
--- /dev/null
@@ -0,0 +1,540 @@
+/*
+  system.cc -- implement System
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+#include "input-smob.hh"
+#include "axis-group-interface.hh"
+#include "debug.hh"
+#include "line-of-score.hh"
+#include "main.hh"
+#include "paper-column.hh"
+#include "paper-def.hh"
+#include "paper-outputter.hh"
+#include "paper-score.hh"
+#include "string.hh"
+#include "warn.hh"
+#include "dimensions.hh"
+#include "molecule.hh"
+#include "all-font-metrics.hh"
+
+// todo: use map.
+void
+fixup_refpoints (SCM s)
+{
+  for (; gh_pair_p (s); s = ly_cdr (s))
+    {
+      Grob::fixup_refpoint (ly_car (s));
+    }
+}
+
+
+System::System (SCM s)
+  : Spanner (s)
+{
+  rank_i_ = 0;
+
+  Axis_group_interface::set_interface (this);
+  Axis_group_interface::set_axes (this, Y_AXIS,X_AXIS);
+}
+
+int
+System::element_count () const
+{
+  return scm_ilength (get_grob_property ("all-elements"));
+}
+
+void
+System::typeset_grob (Grob * elem_p)
+{
+  elem_p->pscore_l_ = pscore_l_;
+  Pointer_group_interface::add_grob (this, ly_symbol2scm ("all-elements"),elem_p);
+  scm_gc_unprotect_object (elem_p->self_scm ());
+}
+
+void
+System::output_lines ()
+{
+  for (SCM s = get_grob_property ("all-elements");
+       gh_pair_p (s); s = ly_cdr (s))
+    {
+      unsmob_grob (ly_car (s))->do_break_processing ();
+    }
+
+  /*
+    fixups must be done in broken line_of_scores, because new elements
+    are put over there.  */
+  int count = 0;
+  for (int i=0; i < broken_into_l_arr_.size (); i++)
+    {
+      Grob *se = broken_into_l_arr_[i];
+      SCM all = se->get_grob_property ("all-elements");
+      for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
+       {
+         fixup_refpoint (ly_car (s));
+       }
+      count += scm_ilength (all);
+    }
+  
+  /*
+    needed for doing items.
+   */
+  fixup_refpoints (get_grob_property ("all-elements"));
+
+  
+  for (SCM s = get_grob_property ("all-elements");
+       gh_pair_p (s); s = ly_cdr (s))
+    {
+      unsmob_grob (ly_car (s))->handle_broken_dependencies ();
+    }
+  handle_broken_dependencies ();
+
+  if (verbose_global_b)
+    progress_indication (_f ("Element count %d.",  count + element_count ()));
+
+  
+  for (int i=0; i < broken_into_l_arr_.size (); i++)
+    {
+      System *line_l = dynamic_cast<System*> (broken_into_l_arr_[i]);
+
+      if (verbose_global_b)
+       progress_indication ("[");
+      line_l->post_processing (i+1 == broken_into_l_arr_.size ());
+
+      if (verbose_global_b)
+       {
+         progress_indication (to_str (i));
+         progress_indication ("]");
+       }
+
+      if (i < broken_into_l_arr_.size () - 1)
+       {
+         SCM lastcol =  ly_car (line_l->get_grob_property ("columns"));
+         Grob*  e = unsmob_grob (lastcol);
+
+         SCM between = ly_symbol2scm ("between-system-string");
+         SCM inter = e->internal_get_grob_property (between);
+         if (gh_string_p (inter))
+           {
+             pscore_l_->outputter_l_
+               ->output_scheme (scm_list_n (between, 
+                                            inter, SCM_UNDEFINED));          
+           }
+       }
+    }
+}
+
+
+
+
+/*
+  Find the loose columns in POSNS, and drape them around the columns
+  specified in BETWEEN-COLS.  */
+void
+set_loose_columns (System* which, Column_x_positions const *posns)
+{
+  for (int i = 0; i < posns->loose_cols_.size (); i++)
+    {
+      int divide_over = 1;
+      Item *loose = dynamic_cast<Item*> (posns->loose_cols_[i]);
+      Paper_column* col = dynamic_cast<Paper_column*> (loose);
+      
+      if (col->line_l_)
+       continue;
+
+      
+      Item * left = 0;
+      Item * right = 0;
+      do
+       {
+         SCM between = loose->get_grob_property ("between-cols");
+         if (!gh_pair_p (between))
+           break;
+
+
+         Item * l=dynamic_cast<Item*> (unsmob_grob (ly_car (between)));
+         Item * r=dynamic_cast<Item*> (unsmob_grob (ly_cdr (between)));
+
+         if (!(l && r))
+           break ;
+         
+         if (!left && l)
+           {
+             left = l->column_l ();
+           }
+
+         divide_over ++;
+
+         loose = right = r->column_l ();
+       }
+      while (1);
+      
+    
+#if 0
+      Real rx = right->relative_coordinate (right->get_parent (X_AXIS), X_AXIS);
+      Real lx = left->relative_coordinate (left->get_parent (X_AXIS), X_AXIS);
+
+      /*
+       divide space equally over loose columns.
+       */
+      int j = 1;
+      loose = col;
+      while (1)
+       {
+         SCM between = loose->get_grob_property ("between-cols");
+         if (!gh_pair_p (between))
+           break;
+
+         Paper_column *thiscol = dynamic_cast<Paper_column*> (loose);
+
+         thiscol->line_l_ = which;
+         thiscol->translate_axis (lx + j*(rx - lx)/divide_over, X_AXIS);
+
+         j ++; 
+         loose = dynamic_cast<Item*> (unsmob_grob (ly_cdr (between)));
+       }
+#else
+      /*
+       We divide the remaining space of the column over the left and
+       right side. At the moment, we  
+       
+      */
+      Grob * common = right->common_refpoint (left, X_AXIS);
+      
+      Real rx =        right->extent(common, X_AXIS)[LEFT];
+      Real lx =  left->extent(common, X_AXIS)[RIGHT];
+      Real total_dx = rx - lx;
+      Interval cval =col->extent (col, X_AXIS);
+
+      /*
+       
+       We put it in the middle. This is not an ideal solution -- the
+       break alignment code inserts a fixed space before the clef
+       (about 1 SS), while the space following the clef is
+       flexible. In tight situations, the clef will almost be on top
+       of the following note. 
+       
+      */
+      Real dx = rx-lx - cval.length ();
+      if (total_dx < 2* cval.length ())
+       {
+         /*
+           todo: this is discontinuous. I'm too tired to
+           invent a sliding mechanism. Duh.
+
+           TODO.
+          */
+         dx *= 0.25;
+       }
+      else
+       dx *= 0.5;
+
+      col->line_l_ = which;
+      col->translate_axis (lx + dx - cval[LEFT], X_AXIS); 
+#endif
+    }
+}
+
+// const?
+void
+System::break_into_pieces (Array<Column_x_positions> const &breaking)
+{
+  for (int i=0; i < breaking.size (); i++)
+    {
+      System *line_l = dynamic_cast <System*> (clone ());
+      line_l->rank_i_ = i;
+      //      line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
+      Link_array<Grob> c (breaking[i].cols_);
+      pscore_l_->typeset_line (line_l);
+      
+      line_l->set_bound (LEFT,c[0]);
+      line_l->set_bound (RIGHT,c.top ());
+      for (int j=0; j < c.size (); j++)
+       {
+         c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+         dynamic_cast<Paper_column*> (c[j])->line_l_ = line_l;
+       }
+      set_loose_columns (line_l, &breaking[i]);
+      broken_into_l_arr_.push (line_l);
+    }
+}
+
+
+#define GLOBAL_SYMBOL(cname, name)  \
+SCM cname ;                                    \
+void \
+cname ## _init_func ()                         \
+{                                              \
+  cname = ly_symbol2scm (name);                        \
+  scm_permanent_object (cname);                        \
+}                                              \
+ADD_SCM_INIT_FUNC (cname,cname ## _init_func);\
+
+
+GLOBAL_SYMBOL (offset_sym , "translate-molecule");
+GLOBAL_SYMBOL (placebox_sym , "placebox");
+GLOBAL_SYMBOL (combine_sym , "combine-molecule");
+
+
+
+void
+System::output_molecule (SCM expr, Offset o)
+{
+
+  while (1)
+    {
+      if (!gh_pair_p (expr))
+       return;
+  
+      SCM head =ly_car (expr);
+      if (unsmob_input (head))
+       {
+         Input * ip = unsmob_input (head);
+      
+
+         pscore_l_->outputter_l_->output_scheme (scm_list_n (ly_symbol2scm ("define-origin"),
+                                                          ly_str02scm (ip->file_str ().ch_C ()),
+                                                          gh_int2scm (ip->line_number ()),
+                                                          gh_int2scm (ip->column_number ()),
+                                                          SCM_UNDEFINED));
+         expr = ly_cadr (expr);
+       }
+      else  if (head ==  ly_symbol2scm ("no-origin"))
+       {
+         pscore_l_->outputter_l_->output_scheme (scm_list_n (head, SCM_UNDEFINED));
+         expr = ly_cadr (expr);
+       }
+      else if (head == ly_symbol2scm ("translate-molecule"))
+       {
+         o += ly_scm2offset (ly_cadr (expr));
+         expr = ly_caddr (expr);
+       }
+      else if (head == ly_symbol2scm ("combine-molecule"))
+       {
+         output_molecule (ly_cadr (expr), o);
+         expr = ly_caddr (expr);
+       }
+      else
+       {
+         pscore_l_->outputter_l_->
+           output_scheme (scm_list_n (placebox_sym,
+                                   gh_double2scm (o[X_AXIS]),
+                                   gh_double2scm (o[Y_AXIS]),
+                                   expr,
+                                   SCM_UNDEFINED));
+
+         return;
+       }
+    }
+}
+
+void
+System::output_scheme (SCM s)
+{
+  pscore_l_->outputter_l_->output_scheme (s);
+}
+
+void
+System::add_column (Paper_column*p)
+{
+  Grob *me = this;
+  SCM cs = me->get_grob_property ("columns");
+  Grob * prev =  gh_pair_p (cs) ? unsmob_grob (ly_car (cs)) : 0;
+
+  p->rank_i_ = prev ? Paper_column::rank_i (prev) + 1 : 0; 
+
+  me->set_grob_property ("columns",  gh_cons (p->self_scm (), cs));
+
+  Axis_group_interface::add_element (me, p);
+}
+
+
+
+/*
+  TODO: use scm_map iso. for loops.
+ */
+void
+System::pre_processing ()
+{
+  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    unsmob_grob (ly_car (s))->discretionary_processing ();
+
+  if (verbose_global_b)
+    progress_indication (_f ("Element count %d ",  element_count ()));
+
+  
+  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    unsmob_grob (ly_car (s))->handle_prebroken_dependencies ();
+  
+  fixup_refpoints (get_grob_property ("all-elements"));
+  
+  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    {
+      Grob* sc = unsmob_grob (ly_car (s));
+      sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
+    }
+  
+  progress_indication ("\n" + _ ("Calculating column positions...") + " ");
+  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    {
+      Grob * e = unsmob_grob (ly_car (s));
+      SCM proc = e->get_grob_property ("spacing-procedure");
+      if (gh_procedure_p (proc))
+       gh_call1 (proc, e->self_scm ());
+    }
+}
+
+void
+System::post_processing (bool last_line)
+{
+  for (SCM s = get_grob_property ("all-elements");
+       gh_pair_p (s); s = ly_cdr (s))
+    {
+      Grob* sc = unsmob_grob (ly_car (s));
+      sc->calculate_dependencies (POSTCALCED, POSTCALCING,
+                                 ly_symbol2scm ("after-line-breaking-callback"));
+    }
+
+  Interval i (extent (this, Y_AXIS));
+  if (i.empty_b ())
+    programming_error ("Huh?  Empty System?");
+  else
+    translate_axis (- i[MAX], Y_AXIS);
+
+  Real height = i.length ();
+  if (height > 50 CM)
+    {
+      programming_error ("Improbable system height");
+      height = 50 CM;
+    }
+
+  /*
+    generate all molecules  to trigger all font loads.
+
+    (ugh. This is not very memory efficient.)  */
+  this->get_molecule();
+  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+    {
+      unsmob_grob (ly_car (s))->get_molecule ();
+    }
+  /*
+    font defs;
+   */
+  SCM font_names = ly_quote_scm (paper_l ()->font_descriptions ());  
+  output_scheme (scm_list_n (ly_symbol2scm ("define-fonts"),
+                            font_names,
+                            SCM_UNDEFINED));
+
+  /*
+    line preamble.
+   */
+  output_scheme (scm_list_n (ly_symbol2scm ("start-line"),
+                         gh_double2scm (height),
+                         SCM_UNDEFINED));
+  
+  /* Output elements in three layers, 0, 1, 2.
+     The default layer is 1. */
+
+  {
+    Molecule *m = this->get_molecule();
+    if (m)
+      output_molecule (m->get_expr (), Offset(0,0));
+  }
+  
+  for (int i = 0; i < 3; i++)
+    for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s);
+        s = ly_cdr (s))
+      {
+       Grob *sc = unsmob_grob (ly_car (s));
+       Molecule *m = sc->get_molecule ();
+       if (!m)
+         continue;
+       
+       SCM s = sc->get_grob_property ("layer");
+       int layer = gh_number_p (s) ? gh_scm2int (s) : 1;
+       if (layer != i)
+         continue;
+       
+       Offset o (sc->relative_coordinate (this, X_AXIS),
+                 sc->relative_coordinate (this, Y_AXIS));
+       
+       SCM e = sc->get_grob_property ("extra-offset");
+       if (gh_pair_p (e))
+         {
+           o[X_AXIS] += gh_scm2double (ly_car (e));
+           o[Y_AXIS] += gh_scm2double (ly_cdr (e));      
+         }
+       
+       output_molecule (m->get_expr (), o);
+      }
+
+  
+  
+  if (last_line)
+    {
+      output_scheme (scm_list_n (ly_symbol2scm ("stop-last-line"), SCM_UNDEFINED));
+    }
+  else
+    {
+      output_scheme (scm_list_n (ly_symbol2scm ("stop-line"), SCM_UNDEFINED));
+    }
+}
+
+
+Link_array<Item> 
+System::broken_col_range (Item const*l, Item const*r) const
+{
+  Link_array<Item> ret;
+
+  l = l->column_l ();
+  r = r->column_l ();
+  SCM s = get_grob_property ("columns");
+
+  while (gh_pair_p (s) && ly_car (s) != r->self_scm ())
+    s = ly_cdr (s);
+    
+  if (gh_pair_p (s))
+    s = ly_cdr (s);
+  
+  while (gh_pair_p (s) && ly_car (s) != l->self_scm ())
+    {
+      Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (ly_car (s)));
+      if (Item::breakable_b (c) && !c->line_l_)
+       ret.push (c);
+
+      s = ly_cdr (s);
+    }
+
+  ret.reverse ();
+  return ret;
+}
+
+/**
+   Return all columns, but filter out any unused columns , since they might
+   disrupt the spacing problem.
+ */
+Link_array<Grob>
+System::column_l_arr ()const
+{
+  Link_array<Grob> acs
+    = Pointer_group_interface__extract_grobs (this, (Grob*) 0, "columns");
+  bool bfound = false;
+  for (int i= acs.size (); i -- ;)
+    {
+      bool brb = Item::breakable_b (acs[i]);
+      bfound = bfound || brb;
+
+      /*
+       the last column should be breakable. Weed out any columns that
+       seem empty. We need to retain breakable columns, in case
+       someone forced a breakpoint.
+      */
+      if (!bfound || !Paper_column::used_b (acs[i]))
+       acs.del (i);
+    }
+  return acs;
+}
+  
index 2938b2b7cd7b1cbdb3ca74a2d0c33db471410b8e..aee0c2309c1638d24e35ab2b2e6e6ec8858d5ac0 100644 (file)
@@ -312,6 +312,16 @@ Translator_group::internal_set_property (SCM sym, SCM val)
   properties_dict ()->set (sym, val);
 }
 
+void
+Translator_group::internal_set_children_property (SCM sym, SCM val)
+{
+  internal_set_property (sym, val);
+  for (SCM p = trans_group_list_; gh_pair_p (p); p = ly_cdr(p)) {
+    Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
+    trg->internal_set_children_property(sym,ly_deep_copy(val));
+  }
+}
+
 /*
   TODO: look up to check whether we have inherited var? 
  */
index 2db5d63839bfcb85d5ff8cc2aa2fefbec8c09ee9..ece252544365a7e3dd2f5eab7f740891558f06e4 100644 (file)
@@ -38,6 +38,7 @@ StaffContext=\translator {
        MinimumVerticalExtent = #'(-4 . 4)
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
+       localKeySignature = #'()
 
        % explicitly set instrument, so we don't get 
        % weird effects when doing instrument names for
@@ -56,7 +57,8 @@ StaffContainerContext = \translator {
        MinimumVerticalExtent = ##f
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
-       
+       localKeySignature = #'()
+
        \accepts Staff
        \name StaffContainer
 }
@@ -67,6 +69,7 @@ InnerChoirStaffContext = \translator {
        alignmentReference = #0
        \consists "System_start_delimiter_engraver"
        systemStartDelimiter = #'SystemStartBracket
+       localKeySignature = #'()
 
        \accepts "Staff"
        \accepts "RhythmicStaff"
@@ -92,6 +95,7 @@ RhythmicStaffContext=\translator{
        MinimumVerticalExtent = ##f
        ExtraVerticalExtent = ##f
        VerticalExtent = ##f 
+       localKeySignature = #'()
 
        \consists "Pitch_squash_engraver"
        \consists "Separating_line_group_engraver"      
@@ -118,6 +122,7 @@ VoiceContext = \translator {
        \name Voice
 
        Generic_property_list = #generic-voice-properties
+       localKeySignature = #'()
        \consists "Font_size_engraver"
        
        % must come before all
@@ -162,6 +167,7 @@ VoiceContext = \translator {
 ThreadContext = \translator{
        \type Engraver_group_engraver
        \name Thread
+       localKeySignature = #'()
 
        \consists "Font_size_engraver"  
        \consists "Thread_devnull_engraver"
@@ -175,6 +181,7 @@ ThreadContext = \translator{
 GrandStaffContext=\translator{
        \type "Engraver_group_engraver"
        \name GrandStaff
+       localKeySignature = #'()
        \consists "Span_bar_engraver"
        \consists "Span_arpeggio_engraver"
        \consists "System_start_delimiter_engraver"
@@ -186,6 +193,7 @@ GrandStaffContext=\translator{
 PianoStaffContext = \translator{
        \GrandStaffContext
        \name "PianoStaff"
+       \alias "GrandStaff"
 
        \consists "Vertical_align_engraver"
        \consists "Instrument_name_engraver"
@@ -202,6 +210,7 @@ PianoStaffContext = \translator{
 InnerStaffGroupContext= \translator {
        \type "Engraver_group_engraver"
        \name InnerStaffGroup
+       localKeySignature = #'()
 
        \consists "Span_bar_engraver"
        \consists "Span_arpeggio_engraver"
@@ -323,6 +332,7 @@ HaraKiriStaffContext = \translator {
 ScoreContext = \translator {
        \type Score_engraver
        \name Score
+       localKeySignature = #'()
        
        \consists "Repeat_acknowledge_engraver"
        \consists "Staff_collecting_engraver"
@@ -388,7 +398,7 @@ ScoreContext = \translator {
        
        subdivideBeams = ##f
        extraNatural = ##t
-       autoAccidentals = #'((measure-same-octave . 0))
+       autoAccidentals = #'(Staff (same-octave . 0))
        autoCautionaries = #'()  
 
 
index 5eb9d02646a2259ccd8cdce422433e6a33afaf1c..e4c851f7eb0c6b396c65d3e0b5177221b48dcbcd 100644 (file)
@@ -22,7 +22,8 @@ staffspace = \staffheight / 4.0
 stafflinethickness = \staffspace / 10.0
 outputscale = \staffheight / 4.0
 
-blotdiameter = 0.4 \pt
+% blotdiameter = 0.4 \pt
+blotdiameter = 0.04 \pt
 
 
 \translator { \NoteNamesContext }
index 5601b73a3343c431ec483fe1825268f0aa796f56..c203bd6632e4d4300fdf3f05437ad3643d3e4043 100644 (file)
@@ -133,8 +133,17 @@ hideStaffSwitch = \property Voice.followVoice = ##f
 % accidentals as they were common in the 18th century.
 defaultAccidentals = {
   \property Score.extraNatural = ##t
-  \property Score.autoAccidentals = #'((measure-same-octave . 0))
-  \property Score.autoCautionaries = #'()  
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+  \property Score.autoCautionaries = #'()
+}
+
+% accidentals in voices instead of staves.
+% Notice that accidentals from one voice do NOT get cancelled in other voices
+voiceAccidentals = {
+  \property Score.extraNatural = ##t
+  \property Score.autoAccidentals = #'(Voice (same-octave . 0))
+  \property Score.autoCautionaries = #'()
+  
 }
 
 % accidentals as suggested by Kurt Stone, Music Notation in the 20th century.
@@ -142,22 +151,57 @@ defaultAccidentals = {
 % in other octaves and in the next measure.
 modernAccidentals = {
   \property Score.extraNatural = ##f
-  \property Score.autoAccidentals = #'((measure-same-octave . 0) (measure-any-octave . 0) (measure-any-octave . 1))
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0) (any-octave . 0) (any-octave . 1))
   \property Score.autoCautionaries = #'()  
 }
 
 % the accidentals that Stone adds to the old standard as cautionaries
 modernCautionaries = {
   \property Score.extraNatural = ##f
-  \property Score.autoAccidentals = #'((measure-same-octave . 0))
-  \property Score.autoCautionaries = #'((measure-any-octave . 0) (measure-any-octave . 1))  
+  \property Score.autoAccidentals = #'(Staff (same-octave . 0))
+  \property Score.autoCautionaries = #'(Staff (any-octave . 0) (any-octave . 1))  
+}
+
+% Multivoice accidentals to be read both by musicians playing one voice
+% and musicians playing all voices.
+% Accidentals are typeset for each voice, but they ARE cancelled across voices.
+modernVoiceAccidentals = {
+  \property Staff.extraNatural = ##f
+  \property Staff.autoAccidentals = #'(
+    Voice (same-octave . 0) (any-octave . 0) (any-octave . 1)
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+  )
+  \property Staff.autoCautionaries = #'()  
+}
+
+% same as modernVoiceAccidental eccept that all special accidentals are typeset
+% as cautionaries
+modernVoiceCautionaries = {
+  \property Staff.extraNatural = ##f
+  \property Staff.autoAccidentals = #'(
+    Voice (same-octave . 0) 
+  )
+  \property Staff.autoCautionaries = #'(
+    Voice (any-octave . 0) (any-octave . 1)
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+  )  
+}
+
+% stone's suggestions for accidentals on grand staff.
+% Accidentals are cancelled across the staves in the same grand staff as well
+pianoAccidentals = {
+  \property GrandStaff.autoAccidentals = #'(
+    Staff (same-octave . 0) (any-octave . 0) (any-octave . 1)
+    GrandStaff (any-octave . 1)
+  )
+  \property GrandStaff.autoCautionaries = #'()  
 }
 
 % Do not reset the key at the start of a measure.  Accidentals will be
 % printed only once and are in effect until overridden, possibly many
 % measures later.
 noResetKey = {
-  \property Score.autoAccidentals = #'((measure-same-octave . #t))
+  \property Score.autoAccidentals = #'(Staff (same-octave . #t))
   \property Score.autoCautionaries = #'()
 }
 
@@ -167,7 +211,7 @@ noResetKey = {
 % remembered for the duration of a measure.
 % accidentals not being remembered, causing accidentals always to be typeset relative to the time signature
 forgetAccidentals = {
-  \property Score.autoAccidentals = #'((measure-same-octave . -1))
+  \property Score.autoAccidentals = #'(Staff (same-octave . -1))
   \property Score.autoCautionaries = #'()  
 }
 
index 888be205fb28ca895c5e631a5e955fa709e4d557..ca4e0756a6b3302f652bd6a080fdede62a414f58 100644 (file)
@@ -1,15 +1,15 @@
 Begin3
 Title: LilyPond
-Version: 1.5.44
-Entered-date: 20MRT02
+Version: 1.5.45
+Entered-date: 21MRT02
 Description: @BLURB@
 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.5.44.tar.gz 
+       1000k lilypond-1.5.45.tar.gz 
 Original-site: ftp.cs.uu.nl /pub/GNU/LilyPond/development/
-       1000k lilypond-1.5.44.tar.gz 
+       1000k lilypond-1.5.45.tar.gz 
 Copying-policy: GPL
 End
index e309c21d93adbf66b7297bd503c030378b4160bb..4d319008eb987896276707781a7bc568ba92163b 100644 (file)
@@ -1,5 +1,5 @@
 %define name lilypond
-%define version 1.5.44
+%define version 1.5.45
 %define release 1mdk
 
 Name: %{name}
index aa38813cc5e8ebc72d0c341fb3580c5b54b0f278..4bdc2c5213c43ee9bcd2133e89dbabae0161265f 100644 (file)
@@ -3,11 +3,11 @@
 %define info yes
 
 Name: lilypond
-Version: 1.5.44
+Version: 1.5.45
 Release: 1
 License: GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.44.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.45.tar.gz
 Summary: Create and print music notation 
 URL: http://www.lilypond.org/
 BuildRoot: /tmp/lilypond-install
index afaa58bb439a6db9bad1b3b33c405813e5790efd..7617b7d05cc2f514c10adfa986bd5c0225e5681f 100644 (file)
 
 Distribution: SuSE Linux 7.0 (i386)
 Name: lilypond
-Version: 1.5.44
+Version: 1.5.45
 Release: 2
 Copyright:    GPL
 Group: Applications/Publishing
-Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.44.tar.gz
+Source0: ftp.cs.uu.nl:/pub/GNU/LilyPond/development/lilypond-1.5.45.tar.gz
 # music notation software for.. ?
 Summary: A program for printing sheet music.
 URL: http://www.lilypond.org/
index 453135ab52395b0aa4bb93271908081c940b9daf..ebde4b6a1b1e76fed1866c606bd296a7618494a0 100644 (file)
@@ -214,7 +214,7 @@ paper-size
 % initialise paper dimensions
 staff-height init-paper
 
-/line-x left-margin def
+/line-x left-margin output-scale div def
 /line-y vsize top-margin sub def
 
 make-lilypond-title
index 997cbb755f3cd2724e57a4c4fca3414ba0b10f7d..c55661e8a99ca76140438e188a44abe414ae9874 100644 (file)
        (meta . ,(grob-description lyric-hyphen-interface ))
        ))
 
-    (LineOfScore
-     . (
-       (axes . (0 1))
-       (meta . ,(grob-description  line-of-score-interface axis-group-interface))
-       ))
-
     (LyricExtender
      . (
        (molecule-callback . ,Lyric_extender::brew_molecule)
        (meta . ,(grob-description piano-pedal-interface axis-group-interface side-position-interface))
        ))
 
+    (System
+     . (
+       (axes . (0 1))
+       (meta . ,(grob-description  line-of-score-interface axis-group-interface))
+       ))
+
     (SystemStartBrace
      . (
        (glyph . "brace")
index 85176065aed7c86b6223cd11aa9d62beb4f17e8b..1d3c58d027d7e6eb2d20d8ccb2ad7c1c32a8f4c3 100644 (file)
     (set! mol (ly-combine-molecule-at-edge mol (other-axis  axis) -1 rb padding))
     mol
   ))
+
+
+
+(define (box-molecule xext yext)
+  "Make a filled box."
+  
+  (ly-make-molecule
+      (list 'filledbox (- (car xext)) (cdr xext)
+                       (- (car yext)) (cdr yext))
+      xext yext)                      
+)
+
+(define (widen-interval iv amount)
+   (cons (- (car iv) amount)
+         (+ (cdr iv) amount))
+)
+
+
+(define (box-grob-molecule grob)
+  "Make a box of exactly the extents of the grob."
+  (let* ((xext (ly-get-extent grob grob 0))
+        (yext (ly-get-extent grob grob 1))
+        (mol (ly-make-molecule '() '(10000 . -10000) '(10000 . -10000)))
+        (thick 0.1)
+        )
+    (display "hoi")
+    (set! mol (ly-add-molecule mol (box-molecule xext (cons (car yext) (+ (car yext) thick)))))
+    (set! mol (ly-add-molecule mol (box-molecule xext (cons (- (cdr yext) thick) (cdr yext)))))
+    (set! mol (ly-add-molecule mol (box-molecule (cons (car xext) (+ (car xext) thick)) yext)))
+    (set! mol (ly-add-molecule mol (box-molecule (cons (- (cdr xext) thick) (cdr xext)) yext)))
+    mol
+  ))
index 8ba55fba03efb67666922dac1b03dbf5304b5fa3..b7c1072b8fca2704e77c24c13536c95a76bba9d1 100644 (file)
@@ -93,7 +93,7 @@
    (car name-mag)
    " findfont "
    "20 " (ly-number->string (cdr name-mag)) " mul "
-   "lilypondpaperoutputscale div scalefont setfont } bind def "
+   "output-scale div scalefont setfont } bind def "
    "\n"))
 
 (define (beam width slope thick)
index 8cfeb298ca60a868a8a92f483fc60d64545e7913..9c7474ef2e6fde507a7903fd2cc565b1b3245442 100644 (file)
@@ -85,18 +85,23 @@ The head of the list:
 (translator-property-description 'autoAccidentals list? "List of
 different ways to typeset an accidental. All algorithms in the list
 are tried, and the one returning the most accidentals is used.
-Each algorithm-description is a name-value pair.
+Each entry is either a symbol containg a context name or a name-value
+pair containing an algorithm-description.
+The list must begin with a symbol (context name).
+The symbols denote in which context THE FOLLOWING algorithms (until next symbol) 
+will be interpreted. All notes in the interpretation context will share accidentals.
+The contexts must be stated in order, innermost first.
 The algorithms are:
 @table @samp
-@item measure-same-octave:
+@item same-octave:
 This is the default algorithm. Accidentals are typeset if the note changes
 the accidental of that note in that octave. Accidentals lasts to the end of the measure 
 and then as many measures as specified in the value. I.e. 1 means to the end
-of next measure, -1 means to the end of previous measure (that is: no duration at all), etc.
-@item measure-any-octave:
+of next measure, -1 means to the end of previous measure (that is: no duration at all), etc. #t means forever.
+@item any-octave:
 Accidentals are typeset if the note is different from 
 the previous note on the same pitch in any octave. The value has same meaning as in
-measure-same-octave.
+same-octave.
 @end table
 ")
 
index c47267cead9fb9e7586fc7ab9ef42f6d2bd8ec4c..c948be1bd646bc742c7620de209cbd4fa3e1a89f 100644 (file)
@@ -9,11 +9,11 @@
 \def\ifundefined#1{\expandafter\ifx\csname#1\endcsname\relax}
 
 % The feta characters
-\input feta20.tex
+%\input feta20.tex
 
-\font\fetasixteen=feta16
-\def\fetafont{\fetasixteen}
-\def\fetachar#1{\hbox{\fetasixteen#1}}
+%\font\fetasixteen=feta16
+%\def\fetafont{\fetasixteen}
+%\def\fetachar#1{\hbox{\fetasixteen#1}}
 
 % If we must make titles, do so, before we're Skipped.
 \ifx\mustmakelilypondtitle\undefined\else\makelilypondtitle\fi