]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/include/grob-info.hh: origin_contexts() now does not
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 16 Feb 2004 02:29:01 +0000 (02:29 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 16 Feb 2004 02:29:01 +0000 (02:29 +0000)
include the originating engraver

* lily/translator-group.cc (translator_each): clean up contents,
remove superfluous stubs. Engraver_group_engraver and
Performer_group_performer are the only classes using multiple
inheritance.

* lily/include/score-context.hh (class Score_context): interface
between Score_{engraver,performer} and Global_context.

* lily/include/global-context.hh (Context): change from
global-translator. This is the entry point for contexts; it is not
tweakable using \translator{}. Score is no longer the top context,
but sits underneath Global.

* lily/include/context.hh (class Context): brain surgery: split
out Context functionality from Translator_group. Context is now a
separate type from Translator.

181 files changed:
ChangeLog
Documentation/user/cheatsheet.itely
Documentation/user/lilypond-book.itely
Documentation/user/refman.itely
VERSION
input/regression/lyric-hyphen.ly
input/regression/mmrest-collision.ly [deleted file]
input/regression/tuplet-rest.ly
input/screech-boink.ly
lily/accidental-engraver.cc
lily/accidental-placement.cc
lily/align-interface.cc
lily/ambitus.cc
lily/apply-context-iterator.cc
lily/audio-element-info.cc
lily/auto-beam-engraver.cc
lily/auto-change-iterator.cc
lily/axis-group-engraver.cc
lily/axis-group-interface.cc
lily/bar-check-iterator.cc
lily/bar-engraver.cc
lily/bar-number-engraver.cc
lily/beam-engraver.cc
lily/beam-performer.cc
lily/beam.cc
lily/break-align-interface.cc
lily/change-iterator.cc
lily/chord-name-engraver.cc
lily/chord-name.cc
lily/chord-tremolo-iterator.cc
lily/clef-engraver.cc
lily/cluster.cc
lily/completion-note-heads-engraver.cc
lily/context-def.cc
lily/context-specced-music-iterator.cc
lily/context.cc
lily/custos.cc
lily/dot-column.cc
lily/dots.cc
lily/drum-note-engraver.cc
lily/drum-note-performer.cc
lily/dynamic-engraver.cc
lily/engraver-group-engraver.cc
lily/engraver.cc
lily/event-chord-iterator.cc
lily/figured-bass-engraver.cc
lily/folded-repeat-iterator.cc
lily/font-size-engraver.cc
lily/forbid-break-engraver.cc
lily/global-context.cc [new file with mode: 0644]
lily/global-translator.cc
lily/grace-iterator.cc
lily/grob-info.cc
lily/grob-pq-engraver.cc
lily/grob-scheme.cc
lily/grob.cc
lily/hairpin.cc
lily/hara-kiri-group-spanner.cc
lily/include/audio-element-info.hh
lily/include/chord-tremolo-iterator.hh
lily/include/context-def.hh
lily/include/context.hh
lily/include/engraver-group-engraver.hh
lily/include/engraver.hh
lily/include/event-chord-iterator.hh
lily/include/folded-repeat-iterator.hh
lily/include/global-context.hh [new file with mode: 0644]
lily/include/global-translator.hh [deleted file]
lily/include/grob-info.hh
lily/include/grob.hh
lily/include/interpretation-context-handle.hh
lily/include/lily-proto.hh
lily/include/ly-smobs.icc
lily/include/music-iterator.hh
lily/include/music-output-def.hh
lily/include/music-wrapper-iterator.hh
lily/include/percent-repeat-iterator.hh
lily/include/performer-group-performer.hh
lily/include/performer.hh
lily/include/score-context.hh [new file with mode: 0644]
lily/include/score-engraver.hh
lily/include/score-performer.hh
lily/include/script.hh
lily/include/sequential-iterator.hh
lily/include/simultaneous-music-iterator.hh
lily/include/translation-property.hh
lily/include/translator-group.hh
lily/include/translator.hh
lily/instrument-name-engraver.cc
lily/interpretation-context-handle.cc
lily/key-engraver.cc
lily/ligature-engraver.cc
lily/line-interface.cc
lily/line-spanner.cc
lily/lookup.cc
lily/lyric-combine-music-iterator.cc
lily/lyric-phrasing-engraver.cc
lily/mark-engraver.cc
lily/measure-grouping-engraver.cc
lily/measure-grouping-spanner.cc
lily/melisma-engraver.cc
lily/metronome-engraver.cc
lily/moment.cc
lily/music-iterator.cc
lily/music-output-def.cc
lily/music-wrapper-iterator.cc
lily/music.cc
lily/new-accidental-engraver.cc [deleted file]
lily/new-fingering-engraver.cc
lily/new-lyric-combine-music-iterator.cc
lily/new-part-combine-iterator.cc
lily/note-head-line-engraver.cc
lily/note-performer.cc
lily/note-spacing.cc
lily/output-property-engraver.cc
lily/paper-column.cc
lily/paper-score.cc
lily/parser.yy
lily/percent-repeat-engraver.cc
lily/percent-repeat-iterator.cc
lily/performer-group-performer.cc
lily/performer.cc
lily/phrasing-slur-engraver.cc
lily/piano-pedal-bracket.cc
lily/piano-pedal-engraver.cc
lily/pitch.cc
lily/property-iterator.cc
lily/recording-group-engraver.cc
lily/repeat-acknowledge-engraver.cc
lily/rest.cc
lily/score-context.cc [new file with mode: 0644]
lily/score-engraver.cc
lily/score-performer.cc
lily/score.cc
lily/script-column.cc
lily/script-engraver.cc
lily/self-aligment-interface.cc
lily/separating-line-group-engraver.cc
lily/sequential-iterator.cc
lily/sequential-music-iterator.cc
lily/side-position-interface.cc
lily/simultaneous-music-iterator.cc
lily/slash-repeat-engraver.cc
lily/slur-engraver.cc
lily/slur-performer.cc
lily/spaceable-grob.cc
lily/span-arpeggio-engraver.cc
lily/span-bar-engraver.cc
lily/staff-collecting-engraver.cc
lily/staff-performer.cc
lily/staff-symbol-referencer.cc
lily/staff-symbol.cc
lily/stem-engraver.cc
lily/stem-tremolo.cc
lily/stem.cc
lily/stencil-scheme.cc
lily/system-start-delimiter-engraver.cc
lily/system-start-delimiter.cc
lily/system.cc
lily/text-item.cc
lily/tie-engraver.cc
lily/tie-performer.cc
lily/time-scaled-music-iterator.cc
lily/timing-engraver.cc
lily/timing-translator.cc
lily/translator-group.cc
lily/translator-property.cc
lily/translator-scheme.cc
lily/translator.cc
lily/unfolded-repeat-iterator.cc
lily/vertical-align-engraver.cc
lily/volta-engraver.cc
ly/engraver-init.ly
ly/performer-init.ly
scm/define-grob-interfaces.scm
scm/define-grob-properties.scm
scm/define-grobs.scm
scm/define-music-properties.scm
scm/lily.scm
scm/music-functions.scm
scripts/convert-ly.py

index 36a35e0ebae46aefb0a929b8c0b3e6c44e2e403d..07b3b2e3aab15335869c5f86312c5908ce17690e 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,39 @@
+2004-02-16  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/include/grob-info.hh: origin_contexts() now does not
+       include the originating engraver
+
+       * lily/translator-group.cc (translator_each): clean up contents,
+       remove superfluous stubs. Engraver_group_engraver and
+       Performer_group_performer are the only classes using multiple
+       inheritance.
+
+       * lily/include/score-context.hh (class Score_context): interface
+       between Score_{engraver,performer} and Global_context.
+
+       * lily/include/global-context.hh (Context): change from
+       global-translator. This is the entry point for contexts; it is not
+       tweakable using \translator{}. Score is no longer the top context,
+       but sits underneath Global.
+
+       * lily/include/context.hh (class Context): brain surgery: split
+       out Context functionality from Translator_group. Context is now a
+       separate type from Translator.
+
+2004-02-15  Han-Wen Nienhuys   <hanwen@xs4all.nl>
+
+       * lily/include/translator.hh (class Translator): make
+       get_score_context() and get_global_translator (), and use the one
+       which is appropriate.
+
+       * lily/context.cc: partially put functionality of Translator_group
+       into Context.
+
+       * lily/include/context.hh (Translator): new class: put between
+       Translator and Translator_group. 
+
+       * lily/new-accidental-engraver.cc: remove file.
+
 2004-02-16  Heikki Junes  <hjunes@cc.hut.fi>
 
        * input/regression/{many}.ly: improve descriptions: use complete 
 
 2004-02-15  Han-Wen Nienhuys   <hanwen@xs4all.nl>
 
+       * lily/music.cc (LY_DEFINE): rename to ly:music-list?
+
+       * scripts/convert-ly.py (conv): add ly:music-list  change.
+
        * lily/grob.cc: edit doc string.
 
        * scm/define-grob-properties.scm (all-user-grob-properties):
        * input/test/maximum-rest-count.ly: remove file.
 
        * scripts/convert-ly.py (FatalConversionError.subst_in_trans):
-       conversion rule for \translator{}. Apply everywhere.  
+       conversion rule for \translator { }. Apply everywhere.  
 
        * lily/parser.yy (music_property_def): set property for \once in
        the PropertyMusic itself, not the ContextSpec.
index b07f0a521375916f498cdc62d2e739a014544e31..b39f168d157302b411b6ccdb75f493d34203737e 100644 (file)
@@ -221,13 +221,19 @@ a\> a a\!
 \context Voice {  \grace b16 c4 }
 @end lilypond
 
-@item @code{\lyrics @{ @dots{} @}}
+@item @code{\lyrics @{ twinkle @}}
 @tab entering lyrics
 @tab
 
-@item @code{\context Lyrics}
+
+@item @code{\new Lyrics}
 @tab printing lyrics
 @tab
+twinkle
+@c cheating .. 
+@c@li lypond[fragment]
+@c  \lyrics \new Lyrics { twinkle }
+@c @end lilypond
 
 @item @code{twin -- kle}
 @tab lyric hyphen 
index e0ad3a271e8ade88734490bd4d58e6ead53ca0d3..f553978e8aaf4264f0817b82c5efbd5e79dd49b6 100644 (file)
@@ -254,8 +254,8 @@ following options:
 
 @table @code
 @item verbatim
-CONTENTS is copied into the source enclosed in a verbatim block,
-followed by any text given with the @code{intertext} option, then
+@var{contents} is copied into the source, enclosed in a verbatim block;
+followed by any text given with the @code{intertext} option; then
 the actual music is displayed.  This option does not work with
 the short version of the music blocks:
 
@@ -287,12 +287,12 @@ prevents printing time signature.
 @item fragment
 @item nofragment
 overrides @command{lilypond-book} auto detection of what type of code is
-in the LilyPond block, voice contents or complete code.
+in the LilyPond block, voice contents, or complete code.
 
 @item indent=@var{size}\\@var{unit}
 sets indentation of the first music system to @var{size},
 where @var{unit} = cm, mm, in, or pt.  This option affects LilyPond,
-not the text layout.  For single-line fragments the default is to
+not the text layout.  For single-line fragments, the default is to
 use no indentation.
 
 For example
@@ -324,7 +324,7 @@ documents are composed from small @file{.ly} files in this way:
 
 @item relative, relative=@var{N}
 uses relative octave mode.  By default, notes are specified relative
-central C.  The optional integer argument specifies the octave of the
+to central C.  The optional integer argument specifies the octave of the
 starting note, where the default @code{1} is central C.
 @end table
 
@@ -342,7 +342,7 @@ cd out && lilypond-book ../yourfile.tex
 
 @noindent
 or to use the @option{--output} command line option, and change to
-that director before running La@TeX{} or @file{makeinfo}:
+that directory before running La@TeX{} or @file{makeinfo}:
 
 @example
 lilypond-book --output=out yourfile.lytex
@@ -382,7 +382,7 @@ Place generated files in @var{dir}.
 
 @item @option{-P @var{process}}, @option{--process=@var{COMMAND}}
 Process lilypond snippets using @var{command}.  The default command is
-@var{lilypon-bin}.
+@var{lilypond-bin}.
 
 @item @option{--verbose}
 Be verbose.
index 7332b0b4891a9abe7f1920feb7a0a73d0057cdb6..165fc001ccf60db048f1dd64d5eefbd1916e6144 100644 (file)
@@ -3524,11 +3524,14 @@ The complete example is shown here:
   << \notes \relative c'' \context Voice = duet { \time 3/4
      g2 e4 a2 f4 g2.  }
   \lyrics << \lyricsto "duet" \new Lyrics {
-    \set stanza = "1"
+    \set stanza = "B."
+    \set vocName = "Bert"
     Hi, my name is bert. }
   \lyricsto "duet" \new Lyrics {
-    \set stanza = "2" 
-    Ooooo, ch\'e -- ri, je t'aime. }
+    \set stanza = "E." 
+    \set vocName = "Ernie"
+    Ooooo, ch\'e -- ri, je t'aime.
+    }
   >> >>
 }
 @end lilypond
@@ -3540,19 +3543,19 @@ The complete example is shown here:
 Stanza numbers can be added by setting @code{stanza}, e.g.
 
 @example
-    \set stanza = "Bert"
+    \set stanza = "B."
     @dots{}
-    \set stanza = "Ernie
+    \set stanza = "E.
 @end example
 
 Notice how dots are surrounded with spaces in @code{\lyrics} mode, to
 prevent @code{stanza} being interpreted as a single
 string.
 
-Names of the singers should be added using @code{Lyrics
-. vocalName} and @code{Lyrics . vocNam}, analogous to instrument
-annotations for staves.
+This example also demonstrates how names of the singers can be added
+using @code{vocalName} analogous to instrument annotations for staves.
+A short version may be entered as @code{vocNam}.
+
 To make empty spaces in lyrics, use @code{\skip}.
 
 
diff --git a/VERSION b/VERSION
index ed63965fdeca9b3ae7109453a925989621627491..ef10a17901ac0f96f56ac7dce093a24aa8b8e877 100644 (file)
--- a/VERSION
+++ b/VERSION
@@ -2,5 +2,5 @@ PACKAGE_NAME=LilyPond
 MAJOR_VERSION=2
 MINOR_VERSION=1
 PATCH_LEVEL=23
-MY_PATCH_LEVEL=
+MY_PATCH_LEVEL=hwn2
 
index 3e4f5afeb92a743ae74d043c52e2a9c1f4a6332a..4dc26dabd75067aa7a5dae81bfe29fd9cdb709ca 100644 (file)
@@ -1,5 +1,7 @@
 \version "2.1.22"
-\header {texidoc="In lyrics, hyphens may be used."}
+\header {
+    texidoc = "In lyrics, hyphens may be used."
+}
 \score{
        <<
        \context Staff \notes { c' (c') (c') c' }
diff --git a/input/regression/mmrest-collision.ly b/input/regression/mmrest-collision.ly
deleted file mode 100644 (file)
index 26e92ba..0000000
+++ /dev/null
@@ -1,29 +0,0 @@
-\version "2.1.23"
-\header { texidoc = "Collision between multimeasure rests in different voices
-may be avoided. " }
-\score {
-  \context Staff \notes <<
-    \new Voice {
-      \override MultiMeasureRest  #'staff-position = #3
-      R1
-    }
-    \new Voice {
-      \override MultiMeasureRest  #'staff-position = #-3
-      R1
-    }
-  >>
-  \paper {
-    \translator {
-      \StaffContext
-      \remove Multi_measure_rest_engraver
-      \remove Bar_engraver
-    }
-    \translator {
-      \VoiceContext
-      \consists Multi_measure_rest_engraver
-      \consists Bar_engraver
-    }
-       raggedright = ##t
-  }
-}
-
index f35bf4a14a7b2e25d65603db47bf622f5d062aba..a3cdf4850b2b5c16f43083916a453018d2ab3f0f 100644 (file)
@@ -1,6 +1,10 @@
 
 \version "2.1.22"
-\header {texidoc = "Tuplets may contain rests. "}
+\header {
+
+    texidoc = "Tuplets may contain rests. "
+
+}
 
 \score {
   \context Voice \notes \relative c'' {
index f574fa45862b4f4e616044b91d2be2eeeb0f16bb..17e5f897b30173606209db8693e1cff7fdd19374 100644 (file)
        }
     >>
 
-    \paper { linewidth = -1.0
+    \paper {
+       raggedright = ##t 
 
-            \translator {
-                \StaffContext
-                \consists Horizontal_bracket_engraver }
-
-        }
+       \translator {
+           \StaffContext
+           \consists Horizontal_bracket_engraver
+       }
+       
+    }
     \midi { \tempo 8 = 60 }
 }
index e20730bb997eb535a7de815b9a12fd320b220481..ae3fe262a8f747c363842060f378c455e4aa212b 100644 (file)
@@ -7,6 +7,7 @@
 
 #include "event.hh"
 
+
 #include "item.hh"
 #include "tie.hh"
 #include "rhythmic-head.hh"
@@ -16,7 +17,7 @@
 #include "engraver.hh"
 #include "arpeggio.hh"
 #include "warn.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "protected-scm.hh"
 
 /**
@@ -30,7 +31,7 @@ struct Accidental_entry {
   bool done_;
   Music * melodic_;
   Grob * accidental_;
-  Translator_group *origin_;
+  Context *origin_;
   Grob*  head_;
   Accidental_entry();
 };
@@ -75,13 +76,14 @@ public:
 
 
 static void
-set_property_on_children (Translator_group * trans, const char * sym, SCM val)
+set_property_on_children (Context * trans, const char * sym, SCM val)
 {
   trans->set_property (sym, val);
-  for (SCM p = trans->trans_group_list_; gh_pair_p (p); p = ly_cdr(p)) {
-    Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
-    set_property_on_children(trg,sym,ly_deep_copy(val));
-  }
+  for (SCM p = trans->context_list_; gh_pair_p (p); p = ly_cdr(p))
+    {
+      Context *trg =  unsmob_context (ly_car (p));
+      set_property_on_children(trg, sym, ly_deep_copy(val));
+    }
 }
 
 Accidental_engraver::Accidental_engraver ()
@@ -95,13 +97,14 @@ Accidental_engraver::initialize ()
 {
   last_keysig_ = get_property ("keySignature");
 
-  Translator_group * trans_ = daddy_trans_;
+  Context * trans_ = daddy_context_;
   while (trans_)
     {
-      trans_ -> set_property ("localKeySignature",  ly_deep_copy (last_keysig_));
-      trans_ = trans_->daddy_trans_;
+      trans_ -> set_property ("localKeySignature",
+                             ly_deep_copy (last_keysig_));
+      trans_ = trans_->daddy_context_;
     }
-  set_property_on_children (daddy_trans_,"localKeySignature", last_keysig_);
+  set_property_on_children (daddy_context_,"localKeySignature", last_keysig_);
 }
 
 /*
@@ -157,7 +160,7 @@ number_accidentals_from_sig (SCM sig, Music *, Pitch *pitch, SCM curbarnum, SCM
 }
 
 static int
-number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, 
+number_accidentals (Music * note, Pitch *pitch, Context * origin, 
                    SCM accidentals, SCM curbarnum)
 {
   int number = 0;
@@ -200,9 +203,9 @@ number_accidentals (Music * note, Pitch *pitch, Translator_group * origin,
       */
       else if (gh_symbol_p (rule))
        {
-         Translator_group * dad = origin;
+         Context * dad = origin;
          while (dad && !dad->is_alias (rule))
-           dad = dad->daddy_trans_;
+           dad = dad->daddy_context_;
       
          if (dad)
            origin = dad;
@@ -234,7 +237,7 @@ Accidental_engraver::process_acknowledged_grobs ()
          accidentals_[i].done_  = true;
          Grob * support = accidentals_[i].head_;
          Music * note = accidentals_[i].melodic_;
-         Translator_group * origin = accidentals_[i].origin_;
+         Context * origin = accidentals_[i].origin_;
 
          Pitch * pitch = unsmob_pitch (note->get_mus_property ("pitch"));
          if (!pitch)
@@ -384,7 +387,7 @@ Accidental_engraver::process_acknowledged_grobs ()
                    (localsig, on_s, gh_cons (scm_int2num (a), barnum)); 
                }
              origin->set_property ("localKeySignature",  localsig);
-             origin = origin->daddy_trans_;
+             origin = origin->daddy_context_;
            }
        }
     }
@@ -434,7 +437,7 @@ Accidental_engraver::acknowledge_grob (Grob_info info)
     {
       Accidental_entry entry ;
       entry.head_ = info.grob_;
-      entry.origin_ = info.origin_trans_->daddy_trans_;
+      entry.origin_ = info.origin_trans_->daddy_context_;
       entry.melodic_ = note;
 
       accidentals_.push (entry);
@@ -463,13 +466,13 @@ Accidental_engraver::process_music ()
   */
   if (last_keysig_ != sig)
     {
-      Translator_group * trans_ = daddy_trans_;
+      Context * trans_ = daddy_context_;
       while (trans_)
        {
          trans_ -> set_property ("localKeySignature",  ly_deep_copy (sig));
-         trans_ = trans_->daddy_trans_;
+         trans_ = trans_->daddy_context_;
        }
-      set_property_on_children(daddy_trans_,"localKeySignature", sig);
+      set_property_on_children(daddy_context_,"localKeySignature", sig);
 
       last_keysig_ = sig;
     }
index e9d0817695be7272802c00f005def4c1fa910262..c0f3b6ae6797d8b71a57b6c445818b04b8e632bc 100644 (file)
@@ -444,5 +444,5 @@ Accidental_placement::position_accidentals (Grob * me)
 
 ADD_INTERFACE(Accidental_placement,
              "accidental-placement-interface",
-             "Take care of complex accidental collisions.",
+             "Resolve accidental collisions.",
              "left-padding padding right-padding accidental-grobs positioning-done")
index 4bddc8327f3f3d9134652a24601f97eeeb374eea..47d90b7b2494d711f58ad5f610061dcfaef45c01 100644 (file)
@@ -266,8 +266,11 @@ find_fixed_alignment_parent  (Grob *g)
 
 
 ADD_INTERFACE (Align_interface, "align-interface",
-  " Order grobs top to bottom/left to right/right to left etc.",
-  "forced-distance stacking-dir align-dir threshold positioning-done center-element elements axes");
+              "Order grobs from top to bottom, left to right, right to left or bottom"
+              "to top."
+              ,
+              "forced-distance stacking-dir align-dir threshold positioning-done "
+              "center-element elements axes");
 
 
 struct Foobar
index 75e3dff62d2d82769922b0a9a6b559c554effa41..eaf006feb04b65b5f782f269cdb13aef7cf7c42b 100644 (file)
@@ -254,5 +254,5 @@ Ambitus::print (SCM smob)
 }
 
 ADD_INTERFACE (Ambitus, "ambitus-interface",
-  "An ambitus represents the pitch range of a voice.",
+  "An object that represents the pitch range of a voice.",
   "c0-position pitch-min pitch-max accidentals note-head-style join-heads");
index e08887c6f9c6f502671a2a812a6b1adcd3656304..d8541f98c0e4f3027cba4a5189ca7e6a973f8bf1 100644 (file)
@@ -1,5 +1,5 @@
 #include "simple-music-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "music.hh"
 
 /**
index 9a079a1425a27213708654b4fc4b81c4fa691848..a2bf63233a237bbd4ae8cf8098daacef7b0ba423 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "audio-element-info.hh"
 #include "translator-group.hh"
+#include "context.hh"
 
 Audio_element_info::Audio_element_info (Audio_element*s, Music *r)
 {
@@ -25,15 +26,15 @@ Audio_element_info::Audio_element_info ()
 }
 
 
-Link_array<Translator>
-Audio_element_info::origin_transes (Translator* end) const
+Link_array<Context>
+Audio_element_info::origin_contexts (Translator* end) const
 {
-  Translator * t = origin_trans_;
-  Link_array<Translator> r;
+  Context * t = origin_trans_->daddy_context_;
+  Link_array<Context> r;
   do {
     r.push (t);
-    t = t->daddy_trans_;
-  } while (t && t != end->daddy_trans_);
+    t = t->daddy_context_;
+  } while (t && t != end->daddy_context_);
   
   return r;
 }
index 5696550ffb2863fb794825b28b44ecc6b79c6f38..ffdfe43140abe8aa81fd5ffb5b891bae6954fd10 100644 (file)
@@ -19,6 +19,7 @@
 #include "item.hh"
 #include "spanner.hh"
 #include "duration.hh"
+#include "context.hh"
 
 /*
   TODO: figure what to do in grace?
@@ -278,7 +279,7 @@ Auto_beam_engraver::begin_beam ()
   
   stems_ = new Link_array<Item>;
   grouping_ = new Beaming_info_list;
-  beam_settings_ = updated_grob_properties (daddy_trans_, ly_symbol2scm ("Beam"));
+  beam_settings_ = updated_grob_properties (daddy_context_, ly_symbol2scm ("Beam"));
   
   beam_start_moment_ = now_mom ();
   beam_start_location_ = *unsmob_moment (get_property ("measurePosition"));
index 30c7b69bbfe218d7ceda087597d8d29314af5049..81dcdaa1c4d2336299c85f1f493c30f69ab61907 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "music.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "event.hh"
 #include "music-wrapper-iterator.hh"
 #include "direction.hh"
@@ -36,8 +36,8 @@ void
 Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
                                 String to_id)
 {
-  Translator_group * current = it->get_outlet ();
-  Translator_group * last = 0;
+  Context * current = it->get_outlet ();
+  Context * last = 0;
 
   /*
     Cut & Paste from Change_iterator (ugh).
@@ -52,7 +52,7 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
   while (current && !current->is_alias (to_type_sym))
     {
       last = current;
-      current = current->daddy_trans_;
+      current = current->daddy_context_;
     }
 
   if (current && current->id_string_ == to_id)
@@ -64,10 +64,10 @@ Auto_change_iterator::change_to (Music_iterator *it, SCM to_type_sym,
   if (current) 
     if (last)
       {
-       Translator_group * dest = 
-         it->get_outlet ()->find_create_translator (to_type_sym, to_id, SCM_EOL);
-       current->remove_translator (last);
-       dest->add_used_group_translator (last);
+       Context * dest = 
+         it->get_outlet ()->find_create_context (to_type_sym, to_id, SCM_EOL);
+       current->remove_context (last);
+       dest->add_context (last);
       }
     else
       {
@@ -86,7 +86,6 @@ void
 Auto_change_iterator::process (Moment m)
 {
   Music_wrapper_iterator::process (m);
-
   
   Moment now = get_outlet ()->now_mom ();
   Moment *splitm = 0;
index 401653e69f14a3bacaf2c5b72e820b998164bd3e..7c509ca9bb32af93a6cffcd9e7ea33b7371117c9 100644 (file)
@@ -12,6 +12,7 @@
 #include "engraver.hh"
 #include "engraver-group-engraver.hh"
 #include "warn.hh"
+#include "context.hh"
 
 /**
    Put stuff in a Spanner with an Axis_group_interface.
@@ -68,7 +69,7 @@ Axis_group_engraver::finalize ()
   if (!staffline_)
     return ;
   
-  String type = get_daddy_grav ()->context_name ();
+  String type = daddy_context_->context_name ();
   SCM dims = get_property ("verticalExtent");
   
   if (is_number_pair (dims))
index 3758ee9abb8e8d6b24d86966e503b09ea645fa9b..f5bc52ced39a97776a28c63d2e5aa26c534e3684 100644 (file)
@@ -33,8 +33,8 @@ Axis_group_interface::axis_b (Grob*me,Axis a)
 
     
    */
-  return me->has_extent_callback_b (group_extent_callback_proc, a) ||
- (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent_proc, a));
+  return me->has_extent_callback (group_extent_callback_proc, a) ||
+ (me->has_extent_callback (Hara_kiri_group_spanner::y_extent_proc, a));
 }
 
 Interval
@@ -93,9 +93,9 @@ Axis_group_interface::set_axes (Grob*me,Axis a1, Axis a2)
   /*
     why so convoluted ? (fixme/documentme?) 
    */
-  if (me->has_extent_callback_b (Grob::stencil_extent_proc, a1))
+  if (me->has_extent_callback (Grob::stencil_extent_proc, a1))
     me->set_extent (Axis_group_interface::group_extent_callback_proc,a1);
-  if (me->has_extent_callback_b (Grob::stencil_extent_proc, a2))
+  if (me->has_extent_callback (Grob::stencil_extent_proc, a2))
     me->set_extent (Axis_group_interface::group_extent_callback_proc,a2);
 }
 
@@ -121,5 +121,5 @@ Axis_group_interface::get_children (Grob*me)
 
 
 ADD_INTERFACE (Axis_group_interface, "axis-group-interface",
-  "a group of coupled grobs",
+  "An object that groups other layout objects.",
   "axes");
index dc3e27feac909cc6f156f68ee32aea5a3172c3c0..343bcd229b49c297940082522b935178afbab9fe 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "simple-music-iterator.hh"
 #include "event.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 /*
   Check bar checks. We do this outside the engravers so that you can
@@ -36,7 +36,7 @@ Bar_check_iterator::process (Moment m)
   Simple_music_iterator::process(m);
   if (!m.to_bool ())
     {
-      Translator_group *tr = get_outlet ();
+      Context *tr = get_outlet ();
 
       SCM mp = tr->get_property ("measurePosition");
       SCM sync= tr->get_property ("barCheckSynchronize");
index f3b94b25329305ae2334db40a495c8ca7b748cb6..2d519a7f65a11013d8319cdbe48bbbdc304a4fa1 100644 (file)
@@ -101,7 +101,7 @@ Bar_engraver::stop_translation_timestep ()
 {
   if (!bar_)
     {
-      top_engraver ()->forbid_breaks ();       // guh. Use properties!
+      get_score_engraver ()->forbid_breaks (); // guh. Use properties!
     }
   else
     typeset_bar ();
index bfdba32328327c9171dd76579719c90e573b2c3f..67c7fc909dd47c620f8a438c06d30fc625681e1c 100644 (file)
@@ -14,7 +14,7 @@
 #include "item.hh"
 #include "moment.hh"
 #include "engraver.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 /*
   
index 868ddcbfc9824d8693696711474404990fc3d719..bd25a47df4f2ac6c6c439322e9d4b54c55448aa2 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1998--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
-#include "engraver-group-engraver.hh"
+
 #include "engraver.hh"
 #include "event.hh"
 #include "beam.hh"
@@ -18,6 +18,7 @@
 #include "drul-array.hh"
 #include "item.hh"
 #include "spanner.hh"
+#include "context.hh"
 
 class Beam_engraver : public Engraver
 {
@@ -46,7 +47,7 @@ protected:
   void set_melisma (bool);
 
   Moment last_stem_added_at_;
-    virtual void stop_translation_timestep ();
+  virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
   virtual void finalize ();
 
@@ -58,7 +59,7 @@ protected:
   virtual bool valid_end_point ();
   
 public:
-  TRANSLATOR_DECLARATIONS(  Beam_engraver );
+  TRANSLATOR_DECLARATIONS(Beam_engraver);
 };
 
 
@@ -120,7 +121,7 @@ Beam_engraver::set_melisma (bool ml)
 {
   SCM b = get_property ("autoBeaming");
   if (!to_boolean (b))
-    daddy_trans_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
+    daddy_context_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
 void
@@ -128,7 +129,7 @@ Beam_engraver::process_music ()
 {
   if (beam_ && !to_boolean (get_property ("allowBeamBreak")))
     {
-      top_engraver ()->forbid_breaks ();
+      get_score_engraver ()->forbid_breaks ();
     }
 
   if (start_ev_)
index 4010502032be1f32711b07ae8a2c2c43641498ea..427946738d4bc076dd8da9463fee88e812660504 100644 (file)
@@ -10,7 +10,7 @@
 #include "event.hh"
 #include "audio-item.hh"
 #include "audio-column.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 
 class Beam_performer : public Performer {
@@ -49,7 +49,7 @@ Beam_performer::set_melisma (bool ml)
 {
   SCM b = get_property ("autoBeaming");
   if (!to_boolean (b))
-    daddy_trans_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
+    daddy_context_->set_property ("beamMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
 void
index 0d34e2ff7226b6bc84e6dbd3b2873b0df21af499..4d8564075d7fad2ab4e273f29df13d4680961467 100644 (file)
@@ -1566,22 +1566,14 @@ Beam::get_direction_beam_count (Grob *me, Direction d )
 
 
 ADD_INTERFACE (Beam, "beam-interface",
-  "A beam. \n\n"
-" "
-"#'thickness= weight of beams, in staffspace "
-" "
-" "
-"We take the least squares line through the ideal-length stems, and "
-"then damp that using "
-" \n"
-"      damped = tanh (slope) \n"
-" \n"
-"this gives an unquantized left and right position for the beam end. "
-"Then we take all combinations of quantings near these left and right "
-"positions, and give them a score (according to how close they are to "
-"the ideal slope, how close the result is to the ideal stems, etc.). We "
-"take the best scoring combination. "
-,
-  "knee positioning-done position-callbacks concaveness-gap concaveness-threshold dir-function quant-score auto-knee-gap gap gap-count chord-tremolo beamed-stem-shorten shorten least-squares-dy damping flag-width-function neutral-direction positions space-function thickness");
+              "A beam. \n\n"
+              "The @code{thickness} property is the weight of beams, and is measured "
+              "in  staffspace"
+              ,
+              "knee positioning-done position-callbacks concaveness-gap "
+              "concaveness-threshold dir-function quant-score auto-knee-gap gap "
+              "gap-count chord-tremolo beamed-stem-shorten shorten least-squares-dy "
+              "damping flag-width-function neutral-direction positions space-function "
+              "thickness");
 
 
index de8ba98a118c4f7554baa96e2d4d1e1707af33eb..91cf8a87455664e3a229fa8d93b5df166678e64b 100644 (file)
@@ -233,8 +233,8 @@ Break_align_interface::do_alignment (Grob *me)
 ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
               "Items that are aligned in prefatory matter.\n"
               "\n"
-              "The spacing of these items is controlled by the space-alist\n"
-              "property. It contains a list break-align-symbols with a specification\n"
+              "The spacing of these items is controlled by the @code{space-alist}\n"
+              "property. It contains a list @code{break-align-symbol}s with a specification\n"
               "of the associated space. The space specification can be "
               "@table @code\n"
               "@item (minimum-space . @var{spc}))\n"
@@ -248,7 +248,7 @@ ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
               "  Add @var{spc} amount of space.\n"
               "@end table\n"
               "\n"
-              "Special keys for the alist are 'first-note and 'next-note, signifying\n"
+              "Special keys for the alist are @code{first-note} and @code{next-note}, signifying\n"
               "the first note on a line, and the next note halfway a line.\n"
               "\n"
               "Rules for this spacing are much more complicated than this. \n"
@@ -256,8 +256,8 @@ ADD_INTERFACE (Break_aligned_interface, "break-aligned-interface",
               "break-align-symbol space-alist");
 
 ADD_INTERFACE (Break_align_interface, "break-alignment-interface",
-  "See @ref{break-aligned-interface}.",
-  "positioning-done");
+              "The object that performs break aligment. See @ref{break-aligned-interface}.",
+              "positioning-done");
 
 
 
index 82ce6d6673287ee8461a85d232436017eef31f8b..0060d4a0adff28402e50ddacdfba135b1bddebba 100644 (file)
@@ -7,10 +7,10 @@
 */
 
 #include "change-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "music.hh"
 #include "warn.hh"
-
+#include "input.hh"
 
 
 void
@@ -38,8 +38,8 @@ Change_iterator::error (String reason)
 void
 Change_iterator::process (Moment m)
 {
-  Translator_group * current = get_outlet ();
-  Translator_group * last = 0;
+  Context * current = get_outlet ();
+  Context * last = 0;
 
   SCM to_type = get_music ()->get_mus_property ("change-to-type");
   String to_id =  ly_scm2string (get_music ()->get_mus_property ("change-to-id"));
@@ -52,7 +52,7 @@ Change_iterator::process (Moment m)
   while (current && !current->is_alias (to_type))
     {
       last = current;
-      current = current->daddy_trans_;
+      current = current->daddy_context_;
     }
 
   if (current && current->id_string_ == to_id)
@@ -64,10 +64,10 @@ Change_iterator::process (Moment m)
   if (current) 
     if (last)
       {
-       Translator_group * dest = 
-         get_outlet ()->find_create_translator (to_type, to_id, SCM_EOL);
-       current->remove_translator (last);
-       dest->add_used_group_translator (last);
+       Context * dest = 
+         get_outlet ()->find_create_context (to_type, to_id, SCM_EOL);
+       current->remove_context (last);
+       dest->add_context (last);
       }
     else
       {
index 0b8fd2d88d8904ed4161b5e1aa1a349cf448290f..9d886084069ba54ba1c5a19aaf7a93202fb04845 100644 (file)
@@ -16,7 +16,7 @@
 #include "item.hh"
 #include "pitch.hh"
 #include "protected-scm.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "warn.hh"
 
 class Chord_name_engraver : public Engraver 
@@ -102,7 +102,7 @@ Chord_name_engraver::process_music ()
 
   SCM name_proc = get_property ("chordNameFunction");
   SCM markup = scm_call_4 (name_proc, pitches, bass, inversion,
-                          daddy_trans_->self_scm());
+                          daddy_context_->self_scm ());
 
   /*
     Ugh. 
index 1077e3ec6f2467436d595d1830691a884ee9ca75..84909fadf40eca04fead565b909063ff922208aa 100644 (file)
@@ -35,6 +35,6 @@ Chord_name::after_line_breaking (SCM smob)
 
 
 ADD_INTERFACE (Chord_name, "chord-name-interface",
-  "generate a chord name",
+  "A chord name.",
   "begin-of-line-visible");
 
index 6887ce67c4c4d4660310d10f504e29a87d24495e..050d5043ce40a964ef777982b454358dcf9e4347 100644 (file)
@@ -46,7 +46,7 @@ Chord_tremolo_iterator::derived_mark () const
 }
 
 void
-Chord_tremolo_iterator::derived_substitute (Translator_group*f, Translator_group*t) 
+Chord_tremolo_iterator::derived_substitute (Context *f, Context *t) 
 {
   if (child_iter_)
     child_iter_->substitute_outlet (f,t);
index 76c814444f48f23c19e0689ff0d43bef56f18525..a9c93ba42ceba13002595894daa8f0e0ec3c51ca 100644 (file)
@@ -10,7 +10,7 @@
 
 #include <ctype.h>
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "bar-line.hh"
 #include "staff-symbol-referencer.hh"
 #include "engraver.hh"
@@ -61,8 +61,8 @@ Clef_engraver::set_glyph ()
 
   SCM basic = ly_symbol2scm ("Clef");
   
-  execute_pushpop_property (daddy_trans_, basic, glyph_sym, SCM_UNDEFINED);
-  execute_pushpop_property (daddy_trans_, basic, glyph_sym, glyph);
+  execute_pushpop_property (daddy_context_, basic, glyph_sym, SCM_UNDEFINED);
+  execute_pushpop_property (daddy_context_, basic, glyph_sym, glyph);
 }
 
 /** 
@@ -149,7 +149,7 @@ Clef_engraver::inspect_clef_properties ()
 
   if (to_boolean (force_clef))
     {
-      Translator_group * w = daddy_trans_->where_defined (ly_symbol2scm ("forceClef"));
+      Context * w = daddy_context_->where_defined (ly_symbol2scm ("forceClef"));
       w->set_property ("forceClef", SCM_EOL);
     }
 }
index fedaaf4d79d0192ed6ffd5802bcb4ddee31c3e0a..d1794a908a3def988adb07d38fea6f6bbaf9b44d 100644 (file)
@@ -218,16 +218,12 @@ Cluster::print (SCM smob)
 }
 
 ADD_INTERFACE (Cluster,"cluster-interface",
-  "A graphically drawn musical cluster. " 
-"\n\n"
-"@code{padding} adds to the vertical extent of the shape (top and "
-"bottom) and is expressed in units of staffspace.  Since the pitch "
-"range of a single pitch is infinitely small, if padding is set to "
-"@code{0.0}, this possibly results in an invisible shape, if you,for "
-"example, say @code{c-\\startCluster d e-\\endCluster}.  The default "
-"value for @code{padding} therefore is @code{0.25}, such that a single "
-"pitch roughly shows the same height as a note head. "
-"\n\n"
-"@code{style} controls the shape of cluster segments.  Valid values include 'leftsided-stairs', 'rightsided-stairs', 'centered-stairs', and 'ramp'.\n"
+              "A graphically drawn musical cluster. " 
+              "\n\n"
+              "@code{padding} adds to the vertical extent of the shape (top and "
+              "bottom). \n\n"
+              "The property @code{style} controls the shape of cluster segments.  Valid values "
+              "include @code{leftsided-stairs}, @code{rightsided-stairs}, @code{centered-stairs}, "
+              "and @code{ramp}.\n"
 ,
   "style padding columns");
index 93f3a60604dbd4970a46b9156f8d5974ed6aef89..bbe14d260d9f5f5c61cae30cd7d467f1eb807091 100644 (file)
@@ -17,6 +17,7 @@
 #include "warn.hh"
 #include "spanner.hh"
 #include "tie.hh"
+#include "global-context.hh"
 
 /*
 
@@ -181,7 +182,8 @@ Completion_heads_engraver::process_music ()
 
       Moment next = now;
       next.main_part_ += note_dur.get_length ();
-      top_engraver ()->add_moment_to_process (next);
+      
+      get_global_context ()->add_moment_to_process (next);
       do_nothing_until_ = next.main_part_;
     }
 
index f48e78d3aa3a9d0c979bcb1e0888bbeb9ca9f720..6fcee6e2de67ae7019745d4d664c0a2cec84c1e3 100644 (file)
@@ -13,6 +13,7 @@
 #include "warn.hh"
 #include "music-output-def.hh"
 #include "ly-smobs.icc"
+#include "score-context.hh"
 
 int
 Context_def::print_smob (SCM smob, SCM port, scm_print_state*)
@@ -163,7 +164,7 @@ Context_def::get_accepted (SCM user_mod) const
 
           
 Link_array<Context_def>
-Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef) const
+Context_def::path_to_acceptable_context (SCM type_sym, Music_output_def* odef) const
 {
   assert (gh_symbol_p (type_sym));
   
@@ -172,7 +173,7 @@ Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef
   Link_array<Context_def> accepteds;
   for (SCM s = accepted; gh_pair_p (s); s = ly_cdr (s))
     {
-      Context_def *t = unsmob_context_def (odef->find_translator (ly_car (s)));
+      Context_def *t = unsmob_context_def (odef->find_context_def (ly_car (s)));
       if (!t)
        continue;
       accepteds.push (t);
@@ -197,7 +198,7 @@ Context_def::path_to_acceptable_translator (SCM type_sym, Music_output_def* odef
       Context_def * g = accepteds[i];
 
       Link_array<Context_def> result
-       = g->path_to_acceptable_translator (type_sym, odef);
+       = g->path_to_acceptable_context (type_sym, odef);
       if (result.size () && result.size () < best_depth)
        {
          result.insert (g,0);
@@ -218,8 +219,6 @@ IMPLEMENT_SMOBS (Context_def);
 IMPLEMENT_DEFAULT_EQUAL_P (Context_def);
 
 
-
-
 SCM
 Context_def::get_translator_names (SCM user_mod) const
 {
@@ -252,18 +251,32 @@ Context_def::get_translator_names (SCM user_mod) const
 }
 
 
-Translator_group *
+Context *
 Context_def::instantiate (SCM ops)
 {
-  Translator * g = get_translator (translator_group_type_);
-  g = g->clone (); 
+  Context * tg =  0;
 
-  Translator_group *tg = dynamic_cast<Translator_group*> (g);
+  if (context_name_ == ly_symbol2scm ("Score"))
+    tg = new Score_context ();
+  else
+    tg = new Context ();
+
+  
   tg->definition_ = self_scm ();
 
   SCM trans_names = get_translator_names (ops); 
-  tg->simple_trans_list_ = names_to_translators (trans_names, tg);
+
+  Translator * g = get_translator (translator_group_type_);
+  g = g->clone ();
+  
+  g->simple_trans_list_ = names_to_translators (trans_names, tg);
+  tg->implementation_ = g->self_scm ();
+  g->daddy_context_ = tg;
+  
+  scm_gc_unprotect_object (g->self_scm ());
+  
   tg->accepts_list_ = get_accepted  (ops);
+  
   return tg;
 }
 
@@ -285,7 +298,7 @@ Context_def::make_scm ()
 }
 
 void
-Context_def::apply_default_property_operations (Translator_group *tg)
+Context_def::apply_default_property_operations (Context *tg)
 {
   apply_property_operations (tg , property_ops_);
 }
index fd4cd1eaf93025e722401efa487c4130bf16d4ca..050d704abf7400cb12a9eea857206c749173bf14 100644 (file)
@@ -9,7 +9,7 @@
 */
 
 #include "music-wrapper-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 class Context_specced_music_iterator : public Music_wrapper_iterator
 {
@@ -29,8 +29,8 @@ Context_specced_music_iterator::construct_children ()
     c_id = ly_scm2string (ci);
   SCM ops = get_music ()->get_mus_property ("property-operations");
   
-  Translator_group* a
-    = get_outlet ()->find_create_translator (ct, c_id, ops);
+  Context * a
+    = get_outlet ()->find_create_context (ct, c_id, ops);
 
   if (a)
     set_translator (a);
index bbf12d4b18f41020a0a7ee7da097a1976f712a2d..df3766b82a13ec0b3078cc91022dd583d46b0bad 100644 (file)
+/*   
+  context.cc --  implement Context
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
 #include "translator-group.hh"
 #include "context-def.hh"
+#include "context.hh"
 #include "warn.hh"
 #include "music-output-def.hh"
 #include "scm-hash.hh"
 #include "main.hh"
+#include "ly-smobs.icc"
+#include "score-context.hh"
 
 bool
-Translator_group::is_removable () const
+Context::is_removable () const
+{
+  return context_list_ == SCM_EOL && ! iterator_count_ &&
+         !dynamic_cast<Score_context const*> (this)
+    ;
+}
+
+
+void
+Context::check_removal ()
+{
+  for (SCM p = context_list_; gh_pair_p (p); p = gh_cdr (p))
+    {
+      Context *trg =  unsmob_context (ly_car (p));
+
+      trg->check_removal ();
+      if (trg->is_removable ())
+       {
+         recurse_down_translators (trg, &Translator::finalize, false);
+         remove_context (trg);
+       }
+    }
+}
+
+Context::Context (Context const&)
+{
+  assert (false);
+}
+
+Scheme_hash_table*
+Context::properties_dict () const
 {
-  return trans_group_list_ == SCM_EOL && ! iterator_count_;
+  return Scheme_hash_table::unsmob (properties_scm_);
 }
 
-Translator_group *
-Translator_group::find_existing_translator (SCM n, String id)
+void
+Context::add_context (Context*t)
+{
+  SCM ts = t->self_scm ();
+  context_list_ = gh_append2 (context_list_,
+                             gh_cons (ts, SCM_EOL));
+  
+  t->daddy_context_ = this;
+  if (!t->init_)
+    {
+      t->init_ = true;
+      
+      scm_gc_unprotect_object (ts);
+      Context_def * td = unsmob_context_def (t->definition_);
+
+      /*
+       this can not move before add_context(), because \override
+       operations require that we are in the hierarchy.
+      */
+      td->apply_default_property_operations (t);
+
+      recurse_down_translators (t, &Translator::initialize, true);
+    }
+}
+
+Context::Context ()
+{
+  daddy_context_ = 0;
+  init_ = false;
+  iterator_count_  = 0;
+  implementation_ = SCM_EOL;
+  properties_scm_ = SCM_EOL;
+  accepts_list_ = SCM_EOL;
+  context_list_ = SCM_EOL;
+  definition_ = SCM_EOL;
+  
+  smobify_self ();
+
+  Scheme_hash_table *tab = new Scheme_hash_table ;
+  properties_scm_ = tab->self_scm ();
+  scm_gc_unprotect_object (tab->self_scm ());
+}
+
+Context *
+Context::find_existing_context (SCM n, String id)
 {
   if ((is_alias (n) && (id_string_ == id || id.is_empty ())) || n == ly_symbol2scm ("Current"))
     return this;
 
-  Translator_group* r = 0;
-  for (SCM p = trans_group_list_; !r && gh_pair_p (p); p = ly_cdr (p))
+  Context* r = 0;
+  for (SCM p = context_list_; !r && gh_pair_p (p); p = ly_cdr (p))
     {
-      Translator *  t = unsmob_translator (ly_car (p));
+      Context *  t = unsmob_context (ly_car (p));
       
-      r = dynamic_cast<Translator_group*> (t)->find_existing_translator (n, id);
+      r = dynamic_cast<Context*> (t)->find_existing_context (n, id);
     }
 
   return r;
 }
 
 
-Translator_group*
-Translator_group::find_create_translator (SCM n, String id, SCM operations)
+Context*
+Context::find_create_context (SCM n, String id,
+                             SCM operations)
 {
-  Translator_group * existing = find_existing_translator (n,id);
+  Context * existing = find_existing_context (n,id);
   if (existing)
     return existing;
 
   if (n == ly_symbol2scm ("Bottom"))
     {
-      Translator_group* tg = get_default_interpreter ();
+      Context* tg = get_default_interpreter ();
       tg->id_string_ = id;
       return tg;
     }
@@ -47,18 +133,18 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations)
     TODO: use accepts_list_.
    */
   Link_array<Context_def> path
-    = unsmob_context_def (definition_)->path_to_acceptable_translator (n, get_output_def ());
+    = unsmob_context_def (definition_)->path_to_acceptable_context (n, get_output_def ());
 
   if (path.size ())
     {
-      Translator_group * current = this;
+      Context * current = this;
 
       // start at 1.  The first one (index 0) will be us.
       for (int i=0; i < path.size (); i++)
        {
          SCM ops = (i == path.size () -1) ? operations : SCM_EOL;
 
-         Translator_group * new_group
+         Context * new_group
            = path[i]->instantiate (ops);
 
          if (i == path.size () -1)
@@ -66,7 +152,7 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations)
              new_group->id_string_ = id;
            }
 
-         current->add_fresh_group_translator (new_group);
+         current->add_context (new_group);
          apply_property_operations (new_group, ops);
          
          current = new_group;
@@ -75,9 +161,9 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations)
       return current;
     }
 
-  Translator_group *ret = 0;
-  if (daddy_trans_)
-    ret = daddy_trans_->find_create_translator (n, id, operations);
+  Context *ret = 0;
+  if (daddy_context_)
+    ret = daddy_context_->find_create_context (n, id, operations);
   else
     {
       warning (_f ("Cannot find or create `%s' called `%s'",
@@ -92,7 +178,7 @@ Translator_group::find_create_translator (SCM n, String id, SCM operations)
   none.
 */
 SCM
-default_child_context_name (Translator_group const *tg)
+default_child_context_name (Context const *tg)
 {
   return gh_pair_p (tg->accepts_list_)
     ? ly_car (scm_last_pair (tg->accepts_list_))
@@ -101,18 +187,18 @@ default_child_context_name (Translator_group const *tg)
 
 
 bool
-Translator_group::is_bottom_context () const
+Context::is_bottom_context () const
 {
   return !gh_symbol_p (default_child_context_name (this));
 }
 
-Translator_group*
-Translator_group::get_default_interpreter ()
+Context*
+Context::get_default_interpreter ()
 {
   if (!is_bottom_context ())
     {
       SCM nm = default_child_context_name (this);
-      SCM st = get_output_def ()->find_translator (nm);
+      SCM st = get_output_def ()->find_context_def (nm);
 
       Context_def *t = unsmob_context_def (st);
       if (!t)
@@ -120,8 +206,8 @@ Translator_group::get_default_interpreter ()
          warning (_f ("can't find or create: `%s'", ly_symbol2string (nm).to_str0 ()));
          t = unsmob_context_def (this->definition_);
        }
-      Translator_group *tg = t->instantiate (SCM_EOL);
-      add_fresh_group_translator (tg);
+      Context *tg = t->instantiate (SCM_EOL);
+      add_context (tg);
       if (!tg->is_bottom_context ())
        return tg->get_default_interpreter ();
       else
@@ -133,35 +219,35 @@ Translator_group::get_default_interpreter ()
 /*
   PROPERTIES
  */
-Translator_group*
-Translator_group::where_defined (SCM sym) const
+Context*
+Context::where_defined (SCM sym) const
 {
   if (properties_dict ()->contains (sym))
     {
-      return (Translator_group*)this;
+      return (Context*)this;
     }
 
-  return (daddy_trans_) ? daddy_trans_->where_defined (sym) : 0;
+  return (daddy_context_) ? daddy_context_->where_defined (sym) : 0;
 }
 
 /*
   return SCM_EOL when not found.
 */
 SCM
-Translator_group::internal_get_property (SCM sym) const
+Context::internal_get_property (SCM sym) const
 {
   SCM val =SCM_EOL;
   if (properties_dict ()->try_retrieve (sym, &val))
     return val;
 
-  if (daddy_trans_)
-    return daddy_trans_->internal_get_property (sym);
+  if (daddy_context_)
+    return daddy_context_->internal_get_property (sym);
   
   return val;
 }
 
 bool
-Translator_group::is_alias (SCM sym) const
+Context::is_alias (SCM sym) const
 {
   if (sym == ly_symbol2scm ("Bottom")
       && !gh_pair_p (accepts_list_))
@@ -170,7 +256,7 @@ Translator_group::is_alias (SCM sym) const
 }
 
 void
-Translator_group::internal_set_property (SCM sym, SCM val)
+Context::internal_set_property (SCM sym, SCM val)
 {
 #ifndef NDEBUG
   if (internal_type_checking_global_b)
@@ -184,8 +270,171 @@ Translator_group::internal_set_property (SCM sym, SCM val)
   TODO: look up to check whether we have inherited var? 
  */
 void
-Translator_group::unset_property (SCM sym)
+Context::unset_property (SCM sym)
 {
   properties_dict ()->remove (sym);
 }
 
+/**
+   Remove a context from the hierarchy.
+ */
+Context *
+Context::remove_context (Context*trans)
+{
+  assert (trans);
+
+  context_list_ = scm_delq_x (trans->self_scm (), context_list_);
+  trans->daddy_context_ = 0;
+  return trans;
+}
+
+/*
+  ID == "" means accept any ID.
+ */
+Context *
+find_context_below (Context * where,
+                   String type, String id)
+{
+  if (where->is_alias (ly_symbol2scm (type.to_str0 ())))
+    {
+      if (id == "" || where->id_string_ == id)
+       return where;
+    }
+  
+  Context * found = 0;
+  for (SCM s = where->context_list_;
+       !found && gh_pair_p (s); s = gh_cdr (s))
+    {
+      Context * tr = unsmob_context (gh_car (s));
+
+      found = find_context_below (tr, type, id);
+    }
+
+  return found; 
+}
+
+SCM
+Context::properties_as_alist () const
+{
+  return properties_dict()->to_alist();
+}
+
+String
+Context::context_name () const
+{
+  Context_def * td = unsmob_context_def (definition_ );
+  return ly_symbol2string (td->get_context_name ());
+}
+
+
+Score_context*
+Context::get_score_context () const
+{
+  if (Score_context *sc =dynamic_cast<Score_context*> ((Context*)this))
+    return sc;
+  else if (daddy_context_)
+    return daddy_context_->get_score_context ();
+  else
+    return 0;
+}
+
+Music_output_def *
+Context::get_output_def () const
+{
+  return  (daddy_context_)
+    ? daddy_context_->get_output_def () : 0;
+}
+
+Context::~Context()
+{
+  
+}
+
+Moment
+Context::now_mom () const
+{
+  return daddy_context_->now_mom();
+}
+
+int
+Context::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Context *sc = (Context *) ly_cdr (s);
+     
+  scm_puts ("#<", port);
+  scm_puts (classname (sc), port);
+  if (Context_def *d=unsmob_context_def (sc->definition_))
+    {
+      scm_puts (" ", port);
+      scm_display (d->get_context_name (), port);
+    }
+
+  if (Context *td=dynamic_cast<Context *> (sc))
+    {
+      scm_puts ("=", port);
+      scm_puts (td->id_string_.to_str0 (), port);
+    }
+  
+
+  scm_puts (" ", port);
+  scm_display (sc->implementation_, port);
+  
+#if 0
+  Translator * tr = unsmob_translator (sc->implementation_);
+  if  (Translator_group *tg = dynamic_cast<Translator_group*> (tr))
+    scm_display (tg->get_simple_trans_list (), port);
+#endif
+  
+  /*
+    don't try to print properties, that is too much hassle.
+   */
+  scm_puts (" >", port);
+  
+  return 1;
+}
+
+SCM
+Context::mark_smob (SCM sm)
+{
+  Context * me = (Context*) SCM_CELL_WORD_1 (sm);
+  
+  scm_gc_mark (me->context_list_);
+  scm_gc_mark (me->definition_);  
+  scm_gc_mark (me->properties_scm_);  
+  scm_gc_mark (me->accepts_list_);
+  scm_gc_mark (me->implementation_);
+
+  return me->properties_scm_;
+}
+
+IMPLEMENT_SMOBS (Context);
+IMPLEMENT_DEFAULT_EQUAL_P (Context);
+IMPLEMENT_TYPE_P(Context,"ly:context?");
+
+bool
+Context::try_music (Music* m)
+{
+  Translator*  t = unsmob_translator (implementation_);
+  if (!t)
+    return false;
+  
+  bool b = t->try_music (m);
+  if (!b && daddy_context_)
+    b = daddy_context_->try_music (m);
+
+  return b;
+}
+
+
+Global_context*
+Context::get_global_context () const
+{
+  if (dynamic_cast<Global_context *>((Context*) this))
+    return dynamic_cast<Global_context *> ((Context*) this);
+
+  if (daddy_context_)
+    return daddy_context_->get_global_context ();
+
+  programming_error ("No Global context!");
+  return 0;
+}
index 7b2300ca7eb1a24ad5e15550f8328bc101e70775..80071f70b43fe8a0b70d5cadfbaafc82d9761cbe 100644 (file)
@@ -109,5 +109,5 @@ Custos::print (SCM smob)
 }
 
 ADD_INTERFACE (Custos, "custos-interface",
-  "Engrave custodes",
+  "A custos object.",
   "style adjust-if-on-staffline neutral-direction neutral-position");
index 4cb993c719295870709b475e224c6411c299b120..cb7e96c56c1b8adf7f42ee9901182314a7a94b4c 100644 (file)
@@ -310,6 +310,8 @@ Dot_column::add_head (Grob * me, Grob *rh)
 
 
 ADD_INTERFACE (Dot_column, "dot-column-interface",
-  "Interface that groups dots so they form a column",
-  "positioning-done direction stem");
+              "Groups dot objects so they form a column, and position dots so they do not "
+              "clash with staff lines "
+              ,
+              "positioning-done direction stem");
 
index f87c719e3b0ea6ec440d7077d6e43a14e87b4bcb..049ec030260ffda67f473f559adcd0da1c509c92 100644 (file)
@@ -53,9 +53,9 @@ Dots::print (SCM d)
 
 
 ADD_INTERFACE (Dots, "dots-interface",
-  "The dots to go with a notehead/rest.  A separate interface, since they "
-" are a party in collision resolution. "
-" #'direction is the Direction to handle staff-line collisions in.",
-  "direction dot-count");
+              "The dots to go with a notehead or rest."
+              "@code{direction} sets the preferred direction to move in case of staff "
+              "line collisions.",
+              "direction dot-count");
 
 
index 54cc4845398a108eea5ce230e2640695a803b632..834b7fd74a3f3f2de37240234723c1d54453db6e 100644 (file)
@@ -106,7 +106,7 @@ Drum_notes_engraver::process_music ()
              Item *p  = make_item ("Script");
              SCM desc  = SCM_EOL;
              make_script_from_event (p, &desc,
-                                     daddy_trans_, script,
+                                     daddy_context_, script,
                                      0);
 
              if (p->get_grob_property ("follow-into-staff"))
index 6532e48f43fc05ce094c5731db2651b8f521ac9c..dcbc4f3320c3c344cb2bb32105722f7843992352 100644 (file)
@@ -10,7 +10,7 @@
 #include "event.hh"
 #include "audio-item.hh"
 #include "audio-column.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 
 class Drum_note_performer : public Performer {
@@ -21,8 +21,6 @@ protected:
   virtual bool try_music (Music *ev) ;
   virtual void stop_translation_timestep ();
   virtual void create_audio_elements ();
-
-  Global_translator* get_global_translator ();
 private:
   Link_array<Music> note_evs_;
   Link_array<Audio_note> notes_;
@@ -57,28 +55,12 @@ Drum_note_performer::create_audio_elements ()
   note_evs_.clear ();
 }
 
-Global_translator*
-Drum_note_performer::get_global_translator ()
-{
-  Translator *t = this;
-  Global_translator *global =0;
-  do
-    {
-      t = t->daddy_trans_ ;
-      global = dynamic_cast<Global_translator*> (t);
-    }
-  while (!global);
-
-  return global;
-}
-
-
 void
 Drum_note_performer::stop_translation_timestep ()
 {
   // why don't grace notes show up here?
   // --> grace notes effectively do not get delayed
-  Global_translator* global = get_global_translator ();
+  Global_context * global = get_global_context ();
   for (int i=0; i < notes_.size (); i++)
     {
       Audio_note* n = notes_[i];
index cec29c08678a29e4f227dcbfc51343626134d3e4..e2b73d28902870c4272738dc4e4befda63a87bdc 100644 (file)
@@ -16,7 +16,7 @@
 #include "engraver.hh"
 #include "group-interface.hh"
 #include "directional-element-interface.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "axis-group-interface.hh"
 #include "script.hh"
 
@@ -239,7 +239,7 @@ Dynamic_engraver::process_music ()
            {
              cresc_  = make_spanner ("TextSpanner");
              cresc_->set_grob_property ("style", s);
-             daddy_trans_->set_property ((start_type
+             daddy_context_->set_property ((start_type
                                            + "Spanner").to_str0 (), SCM_EOL);
              s = get_property ((start_type + "Text").to_str0 ());
              /*
@@ -249,7 +249,7 @@ Dynamic_engraver::process_music ()
                {
                  cresc_->set_grob_property ("edge-text",
                                             gh_cons (s, scm_makfrom0str ("")));
-                 daddy_trans_->set_property ((start_type + "Text").to_str0 (),
+                 daddy_context_->set_property ((start_type + "Text").to_str0 (),
                                                SCM_EOL);
                }
            }
index 0cbdd68c08fee9dc0ba2f6a80a51dc0a50a1bd8b..26201fb3beaaf0fe9cf05c9e0220d7168e2354f9 100644 (file)
 #include "warn.hh"
 #include "paper-score.hh"
 #include "grob.hh"
+#include "context.hh"
+
+
 
 void
 Engraver_group_engraver::announce_grob (Grob_info info)
 {
   announce_infos_.push (info);
-  Engraver::announce_grob (info);
+  get_daddy_engraver ()->announce_grob (info);
 }
 
-void
-Engraver_group_engraver::process_acknowledged_grobs_in_simple_children ()
-{
-  for (SCM p = get_simple_trans_list (); gh_pair_p (p); p = ly_cdr (p))
-    {
-      Translator * t = unsmob_translator (ly_car (p));
-      Engraver * eng = dynamic_cast<Engraver*> (t);
-      if (eng)
-       eng->process_acknowledged_grobs ();
-    }
-}
 
 SCM find_acknowledge_engravers (SCM gravlist, SCM meta);
 SCM find_accept_engravers (SCM gravlist, SCM music_descr);
@@ -79,66 +71,37 @@ Engraver_group_engraver::acknowledge_grobs ()
        {
          Translator * t = unsmob_translator (ly_car (p));
          Engraver * eng = dynamic_cast<Engraver*> (t);
-         if (eng && eng!= info.origin_trans_)
+         if (eng && eng != info.origin_trans_)
            eng->acknowledge_grob (info);
        }
     }
 }
 
+
 void
 Engraver_group_engraver::do_announces ()
 {
-  for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p))
+  do
     {
-      Translator * t = unsmob_translator (ly_car (p));
-      dynamic_cast<Engraver_group_engraver*> (t)->do_announces ();
-    }
+      engraver_each (get_simple_trans_list (),
+                    &Engraver::process_acknowledged_grobs);
+
+      if (!announce_infos_.size())
+       break;
 
-   process_acknowledged_grobs_in_simple_children ();
-    
-   do
-    {
       acknowledge_grobs ();
       announce_infos_.clear ();
-      process_acknowledged_grobs_in_simple_children ();
     }
-   while (announce_infos_.size ());
+  while (1);
 }
 
 
 
-/*
-  order is : top to bottom (as opposed to do_announces)
- */
-void
-Engraver_group_engraver::process_music ()
-{
-   for (SCM p = get_simple_trans_list (); gh_pair_p (p); p =ly_cdr (p))
-    {
-      Translator * t = unsmob_translator (ly_car (p));
-      Engraver * eng = dynamic_cast<Engraver*> (t);
-
-      if (eng)
-       eng->process_music ();
-    }
-   for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p))
-    {
-      Translator * t = unsmob_translator (ly_car (p));
-      Engraver*eng = dynamic_cast<Engraver*> (t);
-      if (eng)
-       eng->process_music ();
-    }
-}
-
 void
 Engraver_group_engraver::initialize ()
 {
-  /*
-    docme: why bool_f.
-    
-   */
   SCM tab = scm_make_vector (gh_int2scm (61), SCM_BOOL_F);
-  set_property ("acknowledgeHashTable", tab);
+  daddy_context_->set_property ("acknowledgeHashTable", tab);
 
   Translator_group::initialize ();
 }
@@ -189,3 +152,44 @@ find_acknowledge_engravers (SCM gravlist, SCM meta_alist)
 }
 
 
+/* c&p engraver-group.cc */
+void
+recurse_down_engravers (Context * c, Engraver_method ptr, bool context_first)
+{
+  Engraver_group_engraver * tg
+    = dynamic_cast<Engraver_group_engraver*> (unsmob_translator (c->implementation_));
+
+
+  if (!context_first)
+    {
+      engraver_each (tg->get_simple_trans_list (),
+                    ptr);
+
+      (tg->*ptr) ();
+    }
+
+  for (SCM s = c->context_list_ ; gh_pair_p (s);
+       s =gh_cdr (s))
+    {
+      recurse_down_engravers (unsmob_context (gh_car (s)), ptr, context_first);
+    }
+
+  if (context_first)
+    {
+      engraver_each (tg->get_simple_trans_list (),
+                    ptr);
+      (tg->*ptr) ();
+    }
+}
+
+
+void
+engraver_each (SCM list, Engraver_method method)
+{
+  for (SCM p = list; gh_pair_p (p); p = ly_cdr (p))
+    {
+      Engraver * e = dynamic_cast<Engraver*>(unsmob_translator (ly_car (p)));
+      if (e)
+       (e->*method) ();
+    }
+}
index d8338972c935267add9cf1a438bc8a0f00c4d93d..201f44655f009da118ce1d05c38a272f45237baa 100644 (file)
 #include "warn.hh"
 #include "spanner.hh"
 #include "item.hh"
+#include "context.hh"
+#include "score-context.hh"
+
+Engraver_group_engraver*
+Engraver::get_daddy_engraver () const
+{
+  return dynamic_cast<Engraver_group_engraver*> (get_daddy_translator ());
+}
 
 void
 Engraver::announce_grob (Grob_info inf)
 {
-  get_daddy_grav ()->announce_grob (inf);
+  get_daddy_engraver ()->announce_grob (inf);
 }
 
+
 /*
   CAUSE is the object (typically a Music object)  that
   was the reason for making E.
@@ -40,9 +49,7 @@ Engraver::announce_grob (Grob* e, SCM cause)
   if (!i.origin_trans_)
     i.origin_trans_ = this;
 
-
-
-  get_daddy_grav ()->announce_grob (i);
+  get_daddy_engraver ()->announce_grob (i);
 }
 
 
@@ -50,17 +57,11 @@ Engraver::announce_grob (Grob* e, SCM cause)
 void
 Engraver::typeset_grob (Grob*p)
 {
-  get_daddy_grav ()->typeset_grob (p);
+  Engraver *dad = get_daddy_engraver ();
+  dad->typeset_grob (p);
 }
 
 
-Engraver_group_engraver*
-Engraver::get_daddy_grav () const
-{
-  return (daddy_trans_)
-       ? dynamic_cast<Engraver_group_engraver *> (daddy_trans_)
-       : 0;
-}
 
 void
 Engraver::process_music ()
@@ -73,9 +74,16 @@ Engraver::Engraver()
 
 
 Score_engraver* 
-Engraver::top_engraver () const
+Engraver::get_score_engraver () const
+{
+  SCM t = get_score_context ()->implementation_;
+  return dynamic_cast<Score_engraver*> (unsmob_translator (t));
+}
+
+
+void
+Engraver::do_announces ()
 {
-  return dynamic_cast<Score_engraver*> (top_translator());
 }
 
 ENTER_DESCRIPTION(Engraver,
index 29713a52dc1e7ccc2c979b178f219298644812ff..09a847bb2442e1cf34d0b1601e3df2b91ad9e07f 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "warn.hh"
 #include "event-chord-iterator.hh"
 #include "music-list.hh"
@@ -16,7 +16,7 @@ Event_chord_iterator::Event_chord_iterator ()
 {
 }
 
-Translator_group*
+Context *
 Event_chord_iterator::get_req_translator ()
 {
   assert (get_outlet ());
index dcd9e4ed2083ddb03fe92dbfffca58f090944105..91023c09a6f9c6b4ac7ff699dce3a35a3d10c9b5 100644 (file)
@@ -11,7 +11,7 @@ source file of the GNU LilyPond music typesetter
 #include "text-item.hh"
 #include "event.hh"
 #include "item.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 class Figured_bass_engraver : public Engraver
 {
@@ -82,7 +82,7 @@ Figured_bass_engraver::process_music ()
          for (int i = 0; i <figures_.size (); i++)
            l = gh_cons (figures_[i]->self_scm(), l);
 
-         SCM markup = scm_call_2 (proc, l, daddy_trans_->self_scm ());
+         SCM markup = scm_call_2 (proc, l, daddy_context_->self_scm ());
 
          figure_ = make_item ("BassFigure");
          figure_->set_grob_property ("text", markup);
index 8f0a89f0ce9be681cebabe8088651af892628510..4767976066d4a843f3e294dbf3b5bbb202430e19 100644 (file)
@@ -7,12 +7,12 @@
   
  */
 
-
+#include "input.hh"
 #include "folded-repeat-iterator.hh"
 #include "repeated-music.hh"
 #include "music-list.hh"
 #include "simultaneous-music-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 Folded_repeat_iterator::Folded_repeat_iterator ()
 {
@@ -140,7 +140,7 @@ Folded_repeat_iterator::derived_mark()const
 }
 
 void
-Folded_repeat_iterator::derived_substitute (Translator_group*f, Translator_group*t) 
+Folded_repeat_iterator::derived_substitute (Context *f, Context *t) 
 {
   if (main_iter_)
     main_iter_->substitute_outlet (f,t);
index 7ef99111b45ce6634b0ff31ab65f237af9ca435f..dfc08b45c445f48bc2bf675f3dd716a361a090eb 100644 (file)
@@ -33,7 +33,7 @@ Font_size_engraver::acknowledge_grob (Grob_info gi)
   /*
     We only want to process a grob once.
    */
-  if (gi.origin_trans_->daddy_trans_ != daddy_trans_)
+  if (gi.origin_trans_->daddy_context_ != daddy_context_)
     return ;
   
   if (gh_number_p (sz) && gh_scm2double (sz))
index 461b55e9d8eecdb51520c363db2b9efeb03f2299..dbaad085684c3a4ed23d127ac6fc9195034c0eba 100644 (file)
@@ -38,7 +38,7 @@ Forbid_line_break_engraver::start_translation_timestep()
       Grob *g = unsmob_grob (gh_cdar (busy));
       if (Rhythmic_head::has_interface (g))
        {
-         top_engraver()->forbid_breaks();
+         get_score_engraver()->forbid_breaks();
        }
       busy = gh_cdr(busy);
     }
diff --git a/lily/global-context.cc b/lily/global-context.cc
new file mode 100644 (file)
index 0000000..154aca0
--- /dev/null
@@ -0,0 +1,184 @@
+/*
+  global-translator.cc -- implement global_context
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+#include <stdio.h>
+
+#include "warn.hh"
+#include "music.hh"
+#include "event.hh"
+#include "music-list.hh"
+#include "music-iterator.hh"
+#include "global-context.hh"
+#include "score-context.hh"
+#include "context-def.hh"
+#include "music-output-def.hh"
+
+Global_context::Global_context (Music_output_def*o)
+{
+  output_def_ = o;
+  accepts_list_ = scm_list_n (ly_symbol2scm ("Score"),
+                             SCM_UNDEFINED);
+  definition_ = o->find_context_def (ly_symbol2scm ("Global"));
+}
+
+Music_output_def* 
+Global_context::get_output_def () const
+{
+  return output_def_;
+}
+
+void
+Global_context::add_moment_to_process (Moment m)
+{
+  if (m  > final_mom_)
+    return;
+
+  if (m < now_mom_)
+    programming_error ("Trying to freeze in time.");
+  
+  for (int i=0; i <  extra_mom_pq_.size (); i++)
+    if (extra_mom_pq_[i] == m)
+      return;
+  extra_mom_pq_.insert (m);
+}
+
+Moment
+Global_context::sneaky_insert_extra_moment (Moment w)
+{
+  while (extra_mom_pq_.size () && extra_mom_pq_.front () <= w)
+    w = extra_mom_pq_.get ();
+  return w;
+}
+
+int
+Global_context::get_moments_left () const
+{
+  return extra_mom_pq_.size ();
+}
+
+void
+Global_context::prepare (Moment m)
+{
+  prev_mom_  = now_mom_;
+  now_mom_ = m;
+
+  if (get_score_context ())
+    get_score_context ()->prepare (m);
+}
+
+Moment
+Global_context::now_mom () const
+{
+  return now_mom_;
+}
+
+Score_context*
+Global_context::get_score_context () const
+{
+  return (gh_pair_p (context_list_))
+    ? dynamic_cast<Score_context*> (unsmob_context (gh_car (context_list_)))
+    : 0;
+}
+
+Music_output*
+Global_context::get_output ()
+{
+  return get_score_context ()->get_output ();
+}
+
+void
+Global_context::one_time_step ()
+{
+  get_score_context ()->one_time_step ();
+  apply_finalizations ();
+  check_removal ();
+}
+
+void
+Global_context::finish ()
+{
+  if (get_score_context ())
+    get_score_context ()->finish ();
+}
+
+void
+Global_context::run_iterator_on_me (Music_iterator * iter)
+{
+  if (iter-> ok ())
+    prev_mom_ = now_mom_ = iter->pending_moment ();
+
+  bool first = true;
+  while (iter->ok () || get_moments_left ())
+    {
+      Moment w;
+      w.set_infinite (1);
+      if (iter->ok ())
+       {
+         w = iter->pending_moment ();
+       }
+
+      w = sneaky_insert_extra_moment (w);
+      if (w.main_part_.is_infinity ())
+       break ;
+      
+#if 0      
+      //      printf ("proccing %s\n ",       w.to_string ().to_str0 ());
+      if (first)
+       {
+         /*
+           Huh? 
+          */
+         set_property ("measurePosition", w.smobbed_copy ());
+       }
+#endif
+      
+      prepare (w);
+
+      if (iter->ok ())
+       iter->process (w);
+
+      if (!get_score_context ()) 
+       {
+         SCM key = ly_symbol2scm ("Score");
+         Context_def * t = unsmob_context_def (get_output_def ()
+                                               ->find_context_def (key));
+         if (!t)
+           error (_f ("can't find `%s' context", "Score"));
+         
+         add_context (t->instantiate (SCM_EOL));
+
+         Score_context *sc = dynamic_cast<Score_context*> (t);
+         sc->prepare (w);
+       }
+      
+      one_time_step ();
+      first = false;      
+    }
+}
+
+void
+Global_context::apply_finalizations ()
+{
+  SCM lst = get_property ("finalizations");
+  set_property ("finalizations" , SCM_EOL); 
+  for (SCM s = lst ; gh_pair_p (s); s = gh_cdr (s))
+    {
+      scm_primitive_eval (gh_car (s));
+    }
+}
+
+/*
+   Add a function to execute before stepping to the next time step.
+ */
+void
+Global_context::add_finalization (SCM x)
+{
+  SCM lst = get_property ("finalizations");
+  lst = scm_cons (x, lst);
+  set_property ("finalizations" ,lst); 
+}
+
index 1edda61cbb9a8cb655f1cc46a3f9eea003673f7e..e69de29bb2d1d6434b8b29ae775ad8c2e48c5391 100644 (file)
@@ -1,162 +0,0 @@
-/*
-  global-translator.cc -- implement Global_translator
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-#include <stdio.h>
-
-#include "warn.hh"
-#include "music.hh"
-#include "event.hh"
-#include "music-list.hh"
-#include "music-iterator.hh"
-#include "global-translator.hh"
-
-Global_translator::Global_translator ()
-{
-  output_def_ = 0;
-}
-
-Music_output_def* 
-Global_translator::get_output_def () const
-{
-  return output_def_;
-}
-
-void
-Global_translator::add_moment_to_process (Moment m)
-{
-  if (m  > final_mom_)
-    return;
-
-  if (m < now_mom_)
-    programming_error ("Trying to freeze in time.");
-  
-  for (int i=0; i <  extra_mom_pq_.size (); i++)
-    if (extra_mom_pq_[i] == m)
-      return;
-  extra_mom_pq_.insert (m);
-}
-
-Moment
-Global_translator::sneaky_insert_extra_moment (Moment w)
-{
-  while (extra_mom_pq_.size () && extra_mom_pq_.front () <= w)
-    w = extra_mom_pq_.get ();
-  return w;
-}
-
-int
-Global_translator::get_moments_left () const
-{
-  return extra_mom_pq_.size ();
-}
-
-void
-Global_translator::prepare (Moment m)
-{
-  prev_mom_  = now_mom_;
-  now_mom_ = m;
-}
-
-Moment
-Global_translator::now_mom () const
-{
-  return now_mom_;
-}
-
-
-
-Music_output*
-Global_translator::get_output ()
-{
-  return 0;
-}
-
-void
-Global_translator::one_time_step ()
-{
-}
-
-void
-Global_translator::start ()
-{
-}
-void
-Global_translator::finish ()
-{
-}
-
-void
-Global_translator::run_iterator_on_me (Music_iterator * iter)
-{
-  if (iter-> ok ())
-    prev_mom_ = now_mom_ = iter->pending_moment ();
-
-  bool first = true;
-  while (iter->ok () || get_moments_left ())
-    {
-      Moment w;
-      w.set_infinite (1);
-      if (iter->ok ())
-       {
-         w = iter->pending_moment ();
-       }
-
-      w = sneaky_insert_extra_moment (w);
-      if (w.main_part_.is_infinity ())
-       break ;
-      
-      
-      //      printf ("proccing %s\n ",       w.to_string ().to_str0 ());
-      if (first)
-       {
-         first = false;
-         set_property ("measurePosition", w.smobbed_copy ());
-       }
-
-      prepare (w);
-      if (iter->ok ())
-       iter->process (w);
-      
-      one_time_step ();
-    }
-}
-
-void
-Global_translator::apply_finalizations ()
-{
-  SCM lst = get_property ("finalizations");
-  set_property ("finalizations" , SCM_EOL); 
-  for (SCM s = lst ; gh_pair_p (s); s = gh_cdr (s))
-    {
-      scm_primitive_eval (gh_car (s));
-    }
-}
-
-/*
-   Add a function to execute before stepping to the next time step.
- */
-void
-Global_translator::add_finalization (SCM x)
-{
-  SCM lst = get_property ("finalizations");
-  lst = scm_cons (x, lst);
-  set_property ("finalizations" ,lst); 
-}
-
-
-Global_translator *
-Translator::top_translator()const
-{
-  if (dynamic_cast<Global_translator*>((Translator*)this))
-    return dynamic_cast<Global_translator*> ((Translator*)this);
-
-  if (daddy_trans_)
-    return daddy_trans_->top_translator ();
-
-  programming_error ("No top translator!");
-  return 0;
-}
index 9f394c6176fea4b08356aba4993a70715242b0d8..3611d5fcac4ada11b81ef0567c303ab304d379a7 100644 (file)
@@ -11,7 +11,7 @@
 #include "grace-iterator.hh"
 
 
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 
 void
index 6d57705f9f90f925e70ff1c53bf2690a3a630951..f4042ec2968f6705661258deb0ed63826b0ce54d 100644 (file)
@@ -10,7 +10,7 @@
 #include "grob-info.hh"
 #include "music.hh"
 #include "translator-group.hh"
-
+#include "context.hh"
 
 Grob_info::Grob_info ()
 {
@@ -25,15 +25,15 @@ Grob_info::music_cause ()
   return unsmob_music (cause);
 }
 
-Link_array<Translator>
-Grob_info::origin_transes (Translator* end) const
+Link_array<Context>
+Grob_info::origin_contexts (Translator* end) const
 {
-  Translator * t = origin_trans_;
-  Link_array<Translator> r;
+  Context * t = origin_trans_->daddy_context_;
+  Link_array<Context> r;
   do {
     r.push (t);
-    t = t->daddy_trans_;
-  } while (t && t != end->daddy_trans_);
+    t = t->daddy_context_;
+  } while (t && t != end->daddy_context_);
   
   return r;
 }
index c681814026be960f235b4c2dc1e9ec5590b0469d..4fdf5d2b4f33febe41d3ac8699fc49b9835fe924 100644 (file)
@@ -6,7 +6,7 @@
   (c) 2001--2004  Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "engraver.hh"
 #include "grob.hh"
 #include "warn.hh"
@@ -56,7 +56,7 @@ Grob_pq_engraver::Grob_pq_engraver()
 void
 Grob_pq_engraver::initialize ()
 {
-  daddy_trans_->set_property ("busyGrobs", SCM_EOL); 
+  daddy_context_->set_property ("busyGrobs", SCM_EOL); 
 }
 
 void
@@ -117,7 +117,7 @@ Grob_pq_engraver::stop_translation_timestep ()
   
   busy = scm_merge_x (current_list, busy, ly_grob_pq_less_p_proc);
   current_grobs_.clear ();
-  daddy_trans_->set_property ("busyGrobs", busy);
+  daddy_context_->set_property ("busyGrobs", busy);
 }
 
 void
@@ -139,7 +139,7 @@ Grob_pq_engraver::start_translation_timestep ()
     }
 
   if (start_busy != busy)
-    daddy_trans_->set_property ("busyGrobs", busy);
+    daddy_context_->set_property ("busyGrobs", busy);
 
 }
 
index 53d2c608f46f578451a89c515a828f2d487e8e09..ca3c5ef046ac149b007b29c047fa9647bb4657bb 100644 (file)
@@ -29,20 +29,6 @@ LY_DEFINE (ly_get_grob_property,
 "Grob properties are stored as GUILE association lists, with symbols as\n"
 "keys. All lookup functions identify undefined properties with\n"
 "end-of-list (i.e. @code{'()} in Scheme or @code{SCM_EOL} in C)\n"
-"\n"
-"Properties are stored in two ways:\n"
-"@itemize @bullet\n"
-"@item mutable properties.\n"
-"Grob properties that change from object to object. The storage of\n"
-"these are private to a grob. For example pointers to other grobs are\n"
-"always stored in the mutable properties.\n"
-"\n"
-"@item immutable properties.\n"
-"Grob properties that are shared across different grobs of the same\n"
-"type. The storage is shared, and hence it is read-only. Typically, this\n"
-"is used to store function callbacks, and default settings. They are\n"
-"initially read from @file{scm/grob-description.scm}.\n"
-"@end itemize\n"
 "\n")
 {
   Grob * sc = unsmob_grob (grob);
@@ -135,7 +121,7 @@ LY_DEFINE (ly_get_system,
 LY_DEFINE (ly_get_original,
           "ly:get-original",
           1, 0, 0, (SCM grob),
-          "Return the original Grob of @var{grob}")
+          "Return the unbroken original Grob of @var{grob}.")
 {
   Grob *me = unsmob_grob (grob);
   SCM_ASSERT_TYPE (me, grob, SCM_ARG1, __FUNCTION__, "grob");
index 57d0b00a33eb7da3b8187dcaba79ca9fb3825488..60acbdb54fa9bf5d23fdfa7c2e1b5a5fbfaf5aaa 100644 (file)
@@ -599,7 +599,7 @@ Grob::name () const
 void
 Grob::add_offset_callback (SCM cb, Axis a)
 {
-  if (!has_offset_callback_b (cb, a))
+  if (!has_offset_callback (cb, a))
   {
     dim_cache_[a].offset_callbacks_ = gh_cons (cb, dim_cache_[a].offset_callbacks_);
     dim_cache_[a].offsets_left_ ++;
@@ -607,14 +607,14 @@ Grob::add_offset_callback (SCM cb, Axis a)
 }
 
 bool
-Grob::has_extent_callback_b (SCM cb, Axis a)const
+Grob::has_extent_callback (SCM cb, Axis a)const
 {
   return scm_equal_p (cb, dim_cache_[a].dimension_) == SCM_BOOL_T;
 }
 
 
 bool
-Grob::has_offset_callback_b (SCM cb, Axis a)const
+Grob::has_offset_callback (SCM cb, Axis a)const
 {
   return scm_memq (cb, dim_cache_[a].offset_callbacks_) != SCM_BOOL_F;
 }
@@ -819,7 +819,7 @@ ADD_INTERFACE (Grob, "grob-interface",
 "\n"
               "Grobs have a properties: Scheme variables, that can be read and set. "
               "They have two types. Immutable variables "
-              "define the default style and behavior.  They are shared between  many objects "
+              "define the default style and behavior.  They are shared between  many objects. "
               "They can be changed using @code{\\override} and @code{\\revert}. "
               "\n\n"
               "Mutable properties are variables that are specific to one grob. Typically, "
index fcb3c621da2a87e69ad6eab9dcc94b398f64b673..42bd74e54e5402fb3ab7668fe8d26166ce5da5b8 100644 (file)
@@ -135,6 +135,6 @@ Hairpin::print (SCM smob)
 
 
 ADD_INTERFACE (Hairpin, "hairpin-interface",
-  "hairpin crescendo.",
+  "A hairpin (de)crescendo.",
   "grow-direction height if-text-padding");
 
index b5071cc8155e3a64429bc6f3a2a6fe6bd70b08f8..eacd67fd7ae5aae0c5ad8caf7b351c94f6f5baec 100644 (file)
@@ -101,9 +101,9 @@ Hara_kiri_group_spanner::add_interesting_item (Grob* me,Grob* n)
 
 
 ADD_INTERFACE (Hara_kiri_group_spanner,"hara-kiri-group-interface",
-  "  As Vertical_group_spanner, but keep track of interesting items.  If       \
-we don't contain any interesting items after linebreaking, then                        \
-gracefully commit suicide.  Objective: don't disgrace Lily by                  \
-typesetting empty lines in orchestral scores.",                                        \
-  "items-worth-living remove-first");
+              "A group spanner that  keeps track of interesting items.  If it "
+              "doesn't contain any after linebreaking, then it "
+              "will remove itself and all its children."
+              ,
+              "items-worth-living remove-first");
 
index 1d3479ecaa3a116e023270bdb33f9aede118ffea..bc95f413c80712a4f594ebd29edf48295e3da34a 100644 (file)
 /**
   Data container for broadcasts 
   */
-struct Audio_element_info {
+class Audio_element_info {
+public:
   Audio_element * elem_;
   Music *event_;
-  Translator *  origin_trans_;
-  Link_array<Translator> origin_transes (Translator*) const;  
+  Translator *origin_trans_;
+
+  Link_array<Context> origin_contexts (Translator*) const;  
 
   Audio_element_info (Audio_element*, Music*);
   Audio_element_info ();
index 667b8e02d67c2bef0563ae81ff3e4e74d1f41b32..233af0a9bca5300f7521e6b71e995aee119ba2e8 100644 (file)
@@ -19,7 +19,7 @@ public:
   Chord_tremolo_iterator ();
   Chord_tremolo_iterator (Chord_tremolo_iterator const & );
 protected:
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
 
   virtual void derived_mark () const;
   virtual Moment pending_moment () const;
index 0011b7c7c8399f655859cb0cf9e369f1fb32fb77..a1d9bc3d937581cc30b0cfa0b3e314fa24e5f46f 100644 (file)
@@ -41,15 +41,15 @@ public:
   SCM get_translator_names (SCM) const;
   void set_acceptor (SCM accepts, bool add);
 
-  Link_array<Context_def> path_to_acceptable_translator (SCM type_string, Music_output_def* odef) const;
-  Translator_group * instantiate (SCM extra_ops);
+  Link_array<Context_def> path_to_acceptable_context (SCM type_string, Music_output_def* odef) const;
+  Context * instantiate (SCM extra_ops);
 
   SCM to_alist () const;
   bool is_alias (SCM) const;
   static SCM make_scm () ;
 
   SCM clone_scm ()const;
-  void apply_default_property_operations (Translator_group*);
+  void apply_default_property_operations (Context *);
 private:
   DECLARE_SMOBS (Context_def,foo);
   Context_def ();
index e69de29bb2d1d6434b8b29ae775ad8c2e48c5391..09015d26ecd0b100f95056c988e1cc658cdc82bb 100644 (file)
@@ -0,0 +1,91 @@
+/*   
+     context.hh -- declare  Context
+
+     source file of the GNU LilyPond music typesetter
+
+     (c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ */
+
+#ifndef CONTEXT_HH
+#define CONTEXT_HH
+
+#include "moment.hh"
+#include "lily-proto.hh"
+
+
+class Context
+{
+  Scheme_hash_table *properties_dict () const;
+  Context (Context const &src);
+  
+  DECLARE_SMOBS (Context, dummy);
+
+  void terminate ();
+public:
+  SCM definition_;
+  SCM properties_scm_;
+  SCM context_list_;
+  SCM accepts_list_;
+  Context * daddy_context_;
+  
+  Context ();
+  void execute_pushpop_property (SCM prop, SCM sym, SCM val);
+  SCM internal_get_property (SCM name_sym) const;
+
+  Context *remove_context (Context*trans);
+  void check_removal ();
+
+  SCM properties_as_alist () const;
+  void unset_property (SCM var_sym);
+  void internal_set_property (SCM var_sym, SCM value);  
+
+  Context *where_defined (SCM name_sym) const;
+  String context_name () const;
+  Global_context * get_global_context () const;
+  
+  virtual Score_context * get_score_context () const;  
+  bool is_alias (SCM) const;
+  void add_context (Context *trans);
+  bool is_bottom_context () const;
+  bool is_removable () const;
+  bool try_music (Music *);
+  
+  virtual Music_output_def *get_output_def () const;
+  virtual Moment now_mom () const;
+  Context *find_existing_context (SCM context_name, String id);
+  Context *find_create_context (SCM context_name,
+                                           String id, SCM ops);
+  Link_array<Context> path_to_acceptable_context (SCM alias,
+                                                 Music_output_def*) const;
+  Context *get_default_interpreter ();
+  String id_string_;
+
+  SCM implementation_;
+private:
+  friend class Interpretation_context_handle;
+  int iterator_count_;
+  bool init_;
+};
+
+/*
+  Context arg? 
+ */
+
+void apply_property_operations (Context*tg, SCM pre_init_ops);
+void execute_pushpop_property (Context * trg, SCM prop, SCM eltprop, SCM val);
+SCM updated_grob_properties (Context* tg, SCM sym);
+Context * find_context_below (Context * where,
+                   String type, String id);
+
+Context * unsmob_context (SCM);
+
+#define set_property(x,y) internal_set_property(ly_symbol2scm(x),y)
+
+/*
+  C&P! 
+ */
+#define get_property(x) internal_get_property(ly_symbol2scm(x))
+DECLARE_UNSMOB(Context,context);
+
+#endif /* CONTEXT_HH */
+
index 4b1da55e8c5e501b07373c7b279e41fe669605b0..f18a60f15f807179ee29486fe3f8161b7451fef7 100644 (file)
 #include "translator-group.hh"
 
 
-/**
-  Group a number of engravers. Usually delegates everything to its contents.
-  Postfix: group
-  */
-class Engraver_group_engraver : public Engraver,
+class Engraver_group_engraver : public virtual Engraver,
                                public virtual Translator_group
 {
 protected:
   Array<Grob_info> announce_infos_;
-
-  
   
 public:
   TRANSLATOR_DECLARATIONS(Engraver_group_engraver);
@@ -36,12 +30,15 @@ public:
   virtual void initialize ();
   virtual void do_announces ();
   virtual void announce_grob (Grob_info);
-  virtual void process_music ();
 private:
   virtual void acknowledge_grobs ();
-  virtual void process_acknowledged_grobs_in_simple_children ();
 };
 
+typedef void (Engraver::*Engraver_method) (void);
+
+void recurse_down_engravers (Context * c, Engraver_method ptr, bool context_first);
+void engraver_each (SCM list, Engraver_method method);
+
 #endif // ENGRAVERGROUP_HH
 
 
index 63928813f5e540af337d3673674e985f2298db86..b7dcefb83f44ca782f5a717f1d8a03053f7b6847 100644 (file)
@@ -48,22 +48,22 @@ protected:
   virtual void announce_grob (Grob*, SCM cause);
   virtual void announce_grob (Grob_info);
   virtual void process_music ();
-
-  Score_engraver * top_engraver () const;
-
+  virtual void do_announces ();
+  Engraver_group_engraver*get_daddy_engraver () const;
 
 public:
-  Engraver_group_engraver * get_daddy_grav () const;
+  Score_engraver * get_score_engraver () const;
   /**
     override other ctor
    */
   TRANSLATOR_DECLARATIONS(Engraver);
 };
 
-#define make_item(x) make_item_from_properties (daddy_trans_, ly_symbol2scm (x))
-#define make_spanner(x) make_spanner_from_properties (daddy_trans_, ly_symbol2scm (x))
-Item* make_item_from_properties (Translator_group* tg, SCM x);
-Spanner* make_spanner_from_properties (Translator_group * tg, SCM x);
+#define make_item(x) make_item_from_properties (daddy_context_, ly_symbol2scm (x))
+#define make_spanner(x) make_spanner_from_properties (daddy_context_, ly_symbol2scm (x))
+Item* make_item_from_properties (Context * tg, SCM x);
+Spanner* make_spanner_from_properties (Context * tg, SCM x);
+
 
 
 
index 2dce5d8b3b93e66dd31007b96259cdd933803a7d..27dac491791c297717bd171ea9d4bbc356822ffa 100644 (file)
@@ -21,7 +21,7 @@ class Event_chord_iterator : public Simple_music_iterator
   /**
      Find a bottom notation context to deliver events to.
    */
-  virtual Translator_group* get_req_translator ();
+  virtual Context * get_req_translator ();
 
 
   /*
index 4ae007d8decd557b44827f2c2f7c787e698ca3bd..793ef3740a52179a78d068e69d78164cb6a05ec3 100644 (file)
@@ -24,7 +24,7 @@ public:
   Folded_repeat_iterator (Folded_repeat_iterator const &src);
   Folded_repeat_iterator ();
   virtual void derived_mark () const;
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
 
 
   virtual void construct_children ();
diff --git a/lily/include/global-context.hh b/lily/include/global-context.hh
new file mode 100644 (file)
index 0000000..ba75d26
--- /dev/null
@@ -0,0 +1,48 @@
+/*
+  global-context.hh -- declare Global_context
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+*/
+
+
+#ifndef GLOBAL_CONTEXT_HH
+#define GLOBAL_CONTEXT_HH
+
+#include "context.hh"
+#include "pqueue.hh"
+
+class Global_context : public virtual Context
+{
+  PQueue<Moment> extra_mom_pq_;
+  Music_output_def*  output_def_;
+  
+  friend class Music_output_def;
+public:
+  Global_context (Music_output_def*);
+  int get_moments_left () const;
+  Moment sneaky_insert_extra_moment (Moment);
+  void add_moment_to_process (Moment);
+  void run_iterator_on_me (Music_iterator*);
+  virtual Score_context*get_score_context () const;
+  
+  void apply_finalizations ();
+  void add_finalization (SCM);
+
+  virtual Music_output *get_output ();     
+  virtual void prepare (Moment);
+  virtual void one_time_step ();
+  virtual void finish ();
+  virtual Music_output_def* get_output_def () const; 
+  virtual Moment now_mom () const;
+
+  Moment final_mom_;
+  Moment prev_mom_;
+  Moment now_mom_;
+protected:
+};
+
+
+
+#endif // GLOBAL_CONTEXT_HH
diff --git a/lily/include/global-translator.hh b/lily/include/global-translator.hh
deleted file mode 100644 (file)
index 979e398..0000000
+++ /dev/null
@@ -1,50 +0,0 @@
-/*
-  global-translator.hh -- declare Global_translator
-
-  source file of the GNU LilyPond music typesetter
-
-  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-*/
-
-
-#ifndef GLOBAL_TRANSLATOR_HH
-#define GLOBAL_TRANSLATOR_HH
-
-#include "translator-group.hh"
-#include "moment.hh"
-#include "pqueue.hh"
-
-class Global_translator : public virtual Translator_group
-{
-  PQueue<Moment> extra_mom_pq_;
-  Music_output_def*  output_def_;
-  friend class Music_output_def;
-public:
-  VIRTUAL_COPY_CONS (Translator);
-  Global_translator ();
-
-  int get_moments_left () const;
-  Moment sneaky_insert_extra_moment (Moment);
-  void add_moment_to_process (Moment);
-  void run_iterator_on_me (Music_iterator*);
-
-  void apply_finalizations ();
-  void add_finalization (SCM);
-  
-  virtual Music_output *get_output ();     
-  virtual void prepare (Moment);
-  virtual void one_time_step ();
-  virtual void finish ();
-  virtual void start ();
-  virtual Music_output_def* get_output_def () const; 
-  virtual Moment now_mom () const;
-
-  Moment final_mom_;
-  Moment prev_mom_;
-  Moment now_mom_;
-protected:
-};
-
-
-
-#endif // GLOBAL_TRANSLATOR_HH
index 0e9de960d20d662b779f19c9ee9e7f70b07a084e..833aa9415816a34f5d138054e48b4dfea7ece9e6 100644 (file)
@@ -14,7 +14,7 @@
 #include "lily-proto.hh"
 #include "parray.hh"
 
-/**
+/*
   Data container for broadcasts.
   */
 struct Grob_info {
@@ -25,7 +25,7 @@ struct Grob_info {
 
 public:
   Music * music_cause ();
-  Link_array<Translator> origin_transes (Translator*) const;
+  Link_array<Context> origin_contexts (Translator*) const;
   Grob_info ();
 };
 
index 4a111b233dd7444021524fd6c1295a96caca41b5..f5d47300d51bc8d1d4835eddc11687b9391a4eee 100644 (file)
@@ -143,9 +143,9 @@ public:
 
 
   // duh. slim down interface here. (todo)
-  bool has_offset_callback_b (SCM callback, Axis)const;
+  bool has_offset_callback (SCM callback, Axis)const;
   void add_offset_callback (SCM callback, Axis);
-  bool has_extent_callback_b (SCM, Axis)const;  
+  bool has_extent_callback (SCM, Axis)const;  
   void set_extent (SCM , Axis);
   Real get_offset (Axis a) const;
   
index b2288817303908862560bf6f35d5cdb69c23dca5..fef97760236d214902e24d3bd23833fed542fa63 100644 (file)
@@ -17,18 +17,18 @@ public:
   ~Interpretation_context_handle ();
   Interpretation_context_handle ();
   Interpretation_context_handle* clone () const;
-  void set_translator (Translator_group*);
+  void set_translator (Context *);
   bool try_music (Music *);
   void operator = (Interpretation_context_handle const&);
   Interpretation_context_handle (Interpretation_context_handle const&);
-  Translator_group * get_outlet () const;
+  Context * get_outlet () const;
 
   int get_count () const;
   void quit ();
 private:
-  Translator_group * outlet_;
+  Context * outlet_;
   void down ();
-  void up (Translator_group*);
+  void up (Context *);
 };
 
 #endif /* INTERPRETATION_CONTEXT_HANDLE_HH */
index 659a6b606bf402b72639606ceac36214de24155b..57863cdb80789e52c0e8d4f8014551166bcd4713 100644 (file)
@@ -43,6 +43,7 @@ class Change_translator;
 class Chord_tremolo_iterator;
 class Cluster_engraver;
 class Column_x_positions;
+class Context;
 class Context_specced_music;
 class Engraver;
 class Engraver;
@@ -50,7 +51,7 @@ class Engraver_group_engraver;
 class Folded_repeat_iterator;
 class Font_metric;
 class Font_size_engraver;
-class Global_translator;
+class Global_context;
 class Gourlay_breaking;
 class Grace_engraver_group;
 class Grace_iterator;
@@ -130,6 +131,7 @@ class Scheme_hash_table;
 class Score;
 class Grob;
 class Score_engraver;
+class Score_context;
 class Score_performer;
 class Sequential_music;
 class Sequential_music_iterator;
index 4259b862f1aa4d2a2b782c4e9d327a42a80577a9..59429c2517735aaf3a5b8d3f86167d27dd5fea1c 100644 (file)
@@ -16,7 +16,7 @@
 void init_type_ ## CL ()\
 {\
   SCM subr = scm_c_define_gsubr (FUNCNAME, 1, 0, 0, (Scheme_function_unknown) CL::smob_p);\
-  ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", "Check if @var{x} is a " #CL " object");\
+  ly_add_function_documentation (subr, FUNCNAME, "(SCM x)", "Check if @var{x} is a @code{" #CL "} object");\
   scm_c_export (FUNCNAME, NULL);\
 }\
 ADD_SCM_INIT_FUNC (init_type_ ## CL, init_type_ ## CL)
index 7d7c5eef2a459c1f7679a442fd981ee523d639f2..b482b7ccc5206cf465cc479f7faff2bcdc1935e5 100644 (file)
@@ -74,18 +74,18 @@ public:
   /**
     The translation unit that we this iterator is reporting  to now.
    */
-  Translator_group* get_outlet () const;
+  Context * get_outlet () const;
 
-  void set_translator (Translator_group*);
+  void set_translator (Context *);
   
   /** Get an iterator matching the type of MUS, and use TRANS to find
     an accompanying translation unit
    */
   static SCM get_static_get_iterator (Music * mus);
-  void init_translator (Music  *, Translator_group *); 
+  void init_translator (Music  *, Context *); 
   void quit ();
-  void substitute_outlet (Translator_group* from, Translator_group *to);
-  virtual void derived_substitute (Translator_group*, Translator_group*);
+  void substitute_outlet (Context * from, Context *to);
+  virtual void derived_substitute (Context *, Context *);
   virtual Moment pending_moment () const;
   virtual bool ok () const;
 
index 9a004b389c9fd72356416ce3e23a52f8a03b7749..9a6e2d48448f63926b6972c5d1cb8eefbd1ce69f 100644 (file)
@@ -31,10 +31,9 @@ public:
   Music_output_def (Music_output_def const&);
   Music_output_def ();
 
-  Global_translator *get_global_translator ();
-  Translator_group *get_group_translator (String type) const;
+  Context *get_group_translator (String type) const;
   void assign_translator (SCM transdef);
-  SCM find_translator (SCM name) const;
+  SCM find_context_def (SCM name) const;
   String outname_string () ;
   SCM get_scmvar (String id)const;
   SCM lookup_variable  (SCM sym) const;
index 006d3dce14a2038dc7beb95856b232cef284f475..0befe300b0ebdde34d6d730b9bfa74bf8c737d46 100644 (file)
@@ -24,7 +24,7 @@ public:
   DECLARE_SCHEME_CALLBACK(constructor, ());  
   Music_wrapper_iterator ();
 
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
 
   virtual void derived_mark () const;
   virtual void construct_children () ;
index 2caee1e3b4dcd0df65186f6c5f8e5e40fcbf8881..6fec818e84cdf9ddb675a5cb26efaa6fe34e0e1c 100644 (file)
@@ -18,7 +18,7 @@ public:
   DECLARE_SCHEME_CALLBACK(constructor, ());
   Percent_repeat_iterator ();
 protected:
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
 
   virtual void derived_mark () const;
   virtual Moment pending_moment () const;
index 4a5227735167d34bae4df8e2e1a6adcf9a0d8bbe..a8d607526e375b4adf83f3e87c2b389b2aedf9fa 100644 (file)
 #include "performer.hh"
 #include "translator-group.hh"
 
-/**
-  Group a number of performers. Usually delegates everything to its contents.
-*/
+typedef void (Performer::*Performer_method) (void);
 
 class Performer_group_performer : public Performer, public virtual Translator_group {
 public:
   TRANSLATOR_DECLARATIONS(Performer_group_performer);
   
   virtual void do_announces ();
-  virtual void process_music ();
   virtual void announce_element (Audio_element_info);
 protected:
   Array<Audio_element_info> announce_infos_;
-  void create_audio_elements ();
 
 private:
   void acknowledge_audio_elements ();
 };
 
+void recurse_down_performers (Context * c, Performer_method ptr,
+                              bool context_first);
+void performer_each (SCM list, Performer_method method);
+
 #endif // PERFORMER_GROUP_PERFORMER_HH
 
index de5731a207337c10dda154c9ad8447819b778d45..2fc46d3a1d10532bbe45e715be91b2a0cbf74032 100644 (file)
@@ -23,7 +23,7 @@ class Performer : public virtual Translator
 public:
   VIRTUAL_COPY_CONS (Translator);
   friend class Performer_group_performer;  
-  Performer_group_performer* get_daddy_perf () const;
+  Performer_group_performer* get_daddy_performer () const;
 
 protected:
   virtual void announce_element (Audio_element_info);
@@ -32,6 +32,7 @@ protected:
   virtual int get_tempo () const;
   virtual void play_element (Audio_element * elem );
   virtual void process_music ();
+  virtual void do_announces ();
 };
 
 
diff --git a/lily/include/score-context.hh b/lily/include/score-context.hh
new file mode 100644 (file)
index 0000000..796fbee
--- /dev/null
@@ -0,0 +1,27 @@
+/*   
+score-context.hh -- declare Score_notation_context
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
+#ifndef SCORE_CONTEXT_HH
+#define SCORE_CONTEXT_HH
+
+#include "global-context.hh"
+
+
+class Score_context : public Context
+{
+ public:
+  virtual Music_output *get_output ();     
+  virtual void prepare (Moment);
+  virtual void finish ();
+  virtual void one_time_step ();
+};
+
+
+
+#endif /* SCORE_CONTEXT_HH */
index 5168f9c72cefbe01a144a309a4381c946f880ae2..bb9af2f5a44945c524b17fb0a94ec8526cf242d5 100644 (file)
 #define SCORE_ENGRAVER_HH
 
 #include "engraver-group-engraver.hh"
-#include "global-translator.hh"
+#include "score-translator.hh"
 
-/**
-  Top level engraver. Puts elements into appropriate columns.
- */
-class Score_engraver : 
-  public Engraver_group_engraver, public Global_translator 
+class Score_engraver : public virtual Score_translator,
+                      public virtual Engraver_group_engraver
 {
   System *system_;
   int breaks_;                 // used for stat printing
@@ -31,11 +28,11 @@ class Score_engraver :
   void set_columns (Paper_column*,Paper_column*);
   void typeset_all ();
 protected:
-  /* Global_translator */
-  virtual void prepare (Moment);
+  /* Score_translator */
   virtual void finish ();
+  virtual void prepare (Moment);
   virtual void one_time_step ();
-
+  
   /* Engraver_group_engraver interface */
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music*);
index 29de4d2c3fb4a87b31b020f8b5fd9f30c27fdf0f..ecd7b1101c73635209afbd56aeefdd28ffb02e9e 100644 (file)
@@ -9,13 +9,12 @@
 #define SCORE_PERFORMER_HH
 
 #include "performer-group-performer.hh"
-#include "global-translator.hh"
+#include "score-translator.hh"
 
 /**
   Top level performer. Completely takes care of MIDI output
  */
-class Score_performer: 
-  public Performer_group_performer, public Global_translator 
+class Score_performer : public Score_translator, public virtual Performer_group_performer
 {
 public:
   TRANSLATOR_DECLARATIONS(Score_performer);
@@ -23,10 +22,8 @@ public:
   Performance *performance_;
 
 protected:
-  virtual void finish ();
   virtual void prepare (Moment mom);
   virtual void one_time_step ();
-  virtual void start ();
   virtual void initialize ();
   virtual void announce_element (Audio_element_info);
   virtual int get_tempo () const;
index 4417e9f2335eef4e18c779c3a84409c7e77c0646..6a741548c6ddf6d3687f94a1f3bec40fdb2f3d3e 100644 (file)
@@ -29,7 +29,7 @@ public:
 };
 
 void make_script_from_event (Grob *p,
-                            SCM * descr, Translator_group*tg,
+                            SCM * descr, Context *tg,
                             SCM type, 
                             int index);
 #endif /* Stem_SCRIPT_HH */
index 1ee4526dce42e99378e76df067b710ff690d26a8..b8bf6354f7f13b1000a3b38a5f4510d4803e032d 100644 (file)
@@ -56,7 +56,7 @@ public:
   DECLARE_SCHEME_CALLBACK(constructor, ());
   Sequential_iterator ();
   Sequential_iterator (Sequential_iterator const&);
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
 
   virtual void derived_mark () const;
 
index 237885d2b111b49c335d25fc47fa30f06ce9a4b2..a351ef50aaf85d293d47b36ed76eff4ac0c3eeb7 100644 (file)
@@ -17,7 +17,7 @@ class Simultaneous_music_iterator : public Music_iterator
 public:
   Simultaneous_music_iterator ();
   Simultaneous_music_iterator (Simultaneous_music_iterator const&);
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
   virtual void derived_mark () const;
   DECLARE_SCHEME_CALLBACK(constructor, ());
   
index d5dc380628e2fc222688501caca2ac6b7de03f5c..aacb932b9d27be58fa320435249f0363ba413528 100644 (file)
@@ -58,9 +58,6 @@ public:
 };
 
 
-void apply_push_property (Translator_group*trans, SCM syms, SCM eprop, SCM val);
-void apply_pop_property (Translator_group*trans, SCM syms, SCM eprop);
-
 
 #endif // PROPERTY_HH
 #endif
index 36ac26cf2f874126c4dd2610a278c40fa8753715..851c8f5a571ac71308d5d74f685d270e34789564 100644 (file)
 #include "parray.hh"
 #include "smobs.hh"
 
-// egcs
-typedef void (Translator::*Method_pointer) (void);
-#define set_property(x,y) internal_set_property(ly_symbol2scm(x),y)
+typedef void (Translator::*Translator_method) (void);
 
-class Scheme_hash_table;
-
-
-/** Make some kind of Elements from Events. Elements are made by
-  hierarchically grouped Translators
-  */
 class Translator_group : public virtual Translator {
-public:
-  String id_string_;
-private:
-  int iterator_count_;
-  friend class Interpretation_context_handle;
-
-  Scheme_hash_table *properties_dict () const;
-  SCM add_translator (SCM, Translator*);
 protected:
-  ~Translator_group ();
-
-  virtual SCM get_simple_trans_list ();
-
+  
 public:
-  void execute_pushpop_property (SCM prop, SCM sym, SCM val);
-  SCM internal_get_property (SCM name_sym) const;
-  SCM properties_as_alist () const;
-  void unset_property (SCM var_sym);
-  void internal_set_property (SCM var_sym, SCM value);  
-
-  Translator_group *where_defined (SCM name_sym) const;
-  String context_name () const;  
-  Translator_group (Translator_group const &);
-  Translator_group ();
-
-  bool is_alias (SCM) const;
-  void add_fresh_group_translator (Translator *trans);
-  void add_used_group_translator (Translator *trans);
-  bool is_bottom_context () const;
-  bool is_removable () const;
-  void terminate_translator (Translator*r);
-  Translator *remove_translator (Translator*trans);
-  void check_removal ();
-  Translator_group *find_existing_translator (SCM context_name, String id);
-  Translator_group *find_create_translator (SCM context_name,
-                                           String id, SCM ops);
-  Link_array<Translator_group>
-    path_to_acceptable_translator (SCM alias,
-                                  Music_output_def*) const;
-  Translator_group*get_default_interpreter ();
   VIRTUAL_COPY_CONS (Translator);
+
 public:
-  bool try_music_on_nongroup_children (Music *m);
-  
-  virtual void do_announces ();
+  virtual Translator_group* get_daddy_translator ()const;
+  virtual SCM get_simple_trans_list ();
   virtual bool try_music (Music* req);       
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();   
   virtual void initialize ();
-  virtual void finalize ();
-  virtual void each (Method_pointer);
 };
 
 
-bool melisma_busy (Translator* tr); // where to put this? --hwn
-void apply_property_operations (Translator_group*tg, SCM pre_init_ops);
-SCM names_to_translators (SCM namelist, Translator_group*tg);
-void execute_pushpop_property (Translator_group * trg,
-                              SCM prop, SCM eltprop, SCM val);
-SCM updated_grob_properties (Translator_group* tg, SCM sym);
+SCM names_to_translators (SCM namelist, Context*tg);
+void recurse_down_translators (Context * c, Translator_method ptr, bool context_first);
+void translator_each (SCM list, Translator_method method);
+
 
 #endif // TRANSLATOR_GROUP_HH
index fe4d51aaa5e9b5cbcda1284b28be3eee2e332772..3178beff9eb25ad39a0ebb4d1cf0e23cbf55136a 100644 (file)
@@ -39,46 +39,31 @@ public:
   Music_output_def * output_def_;
   
   Translator (Translator const &);
+  Context * daddy_context_ ;
 
-  
-  Translator_group * daddy_trans_ ;
   void removal_processing ();
   virtual Music_output_def *get_output_def () const;
-
   SCM internal_get_property (SCM symbol) const;
-  
+  virtual Translator_group* get_daddy_translator ()const;
   virtual Moment now_mom () const;  
 
-  /*
-    ugh: bubbled up.
-   */
-  SCM definition_;
-  SCM properties_scm_;
-  SCM trans_group_list_;
-  SCM accepts_list_;
-  virtual SCM get_simple_trans_list ();
 public:
   DECLARE_SMOBS (Translator, dummy);
-private:
-  /*
-    ugh: bubbled up from Translator_group. 
-   */
-
 protected:                     // should be private.
   SCM simple_trans_list_;
   friend class Context_def;
 public:
-  Global_translator * top_translator () const;
+  Score_context * get_score_context () const;
+  Global_context * get_global_context () const;
+  
   TRANSLATOR_DECLARATIONS(Translator);
   virtual bool try_music (Music *req);
   virtual void stop_translation_timestep ();
   virtual void start_translation_timestep ();
-  virtual void do_announces () ;
   virtual void initialize () ;
   virtual void finalize ();
 };
 
-
 /**
   A macro to automate administration of translators.
  */
@@ -134,4 +119,5 @@ void add_translator (Translator*trans);
 
 Translator*get_translator (SCM s);
 DECLARE_UNSMOB(Translator,translator);
+bool melisma_busy (Translator*);
 #endif // TRANSLATOR_HH
index 34e49abedeac77395e7b0c442c5b62f3336f150b..5b2ab6b198e0b77b0db10a6f78caafaab666fb7b 100644 (file)
@@ -14,7 +14,7 @@
 #include "side-position-interface.hh"
 #include "align-interface.hh"
 #include "axis-group-interface.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "text-item.hh"
 
 class Instrument_name_engraver : public Engraver
@@ -42,7 +42,7 @@ Instrument_name_engraver::Instrument_name_engraver ()
 void
 Instrument_name_engraver::initialize ()
 {
-  daddy_trans_->set_property ("instrumentSupport", SCM_EOL); 
+  daddy_context_->set_property ("instrumentSupport", SCM_EOL); 
 }
 
 void
@@ -111,7 +111,7 @@ Instrument_name_engraver::acknowledge_grob (Grob_info i)
       SCM nl = gh_cons (i.grob_->self_scm (),
                        get_property ("instrumentSupport"));
 
-      daddy_trans_->set_property ("instrumentSupport", nl);
+      daddy_context_->set_property ("instrumentSupport", nl);
     }
 }
 
index 9f2242203d58381206ba36d09b65a7983a52492c..bb8175bc0208fb4edbd8c4698d211f0ad8b282f1 100644 (file)
@@ -7,7 +7,7 @@
  */
 
 #include "interpretation-context-handle.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 Interpretation_context_handle::Interpretation_context_handle ()
 {
@@ -42,7 +42,7 @@ Interpretation_context_handle::~Interpretation_context_handle ()
 }
 
 void
-Interpretation_context_handle::up (Translator_group*t)
+Interpretation_context_handle::up (Context *t)
 {
   outlet_ = t;
   t->iterator_count_ ++;
@@ -78,7 +78,7 @@ Interpretation_context_handle::operator = (Interpretation_context_handle const &
 }
 
 void
-Interpretation_context_handle::set_translator (Translator_group*trans)
+Interpretation_context_handle::set_translator (Context *trans)
 {
   if (outlet_ ==trans)
     return;
@@ -88,7 +88,7 @@ Interpretation_context_handle::set_translator (Translator_group*trans)
     up (trans);
 }
 
-Translator_group*
+Context *
 Interpretation_context_handle::get_outlet () const
 {
   
index 061e1544779e093ea184afc9f024fd28b60896f3..41aeaffbdb99c56e3e527eaf5346081f039e27bf 100644 (file)
@@ -12,7 +12,7 @@
 #include "item.hh"
 #include "bar-line.hh"
 #include "staff-symbol-referencer.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "engraver.hh"
 #include "pitch.hh"
 #include "protected-scm.hh"
@@ -168,8 +168,8 @@ Key_engraver::read_ev (Key_change_ev const * r)
     if (gh_scm2int (ly_cdar (s)))
       accs = gh_cons (ly_car (s), accs);
 
-  daddy_trans_->set_property ("keySignature", accs);
-  daddy_trans_->set_property ("tonic" ,
+  daddy_context_->set_property ("keySignature", accs);
+  daddy_context_->set_property ("tonic" ,
                              r->get_mus_property ("tonic"));
 }
 
@@ -178,18 +178,18 @@ void
 Key_engraver::start_translation_timestep ()
 {
   key_ev_ = 0;
-  daddy_trans_->set_property ("lastKeySignature", get_property ("keySignature"));
+  daddy_context_->set_property ("lastKeySignature", get_property ("keySignature"));
 }
 
 
 void
 Key_engraver::initialize ()
 {
-  daddy_trans_->set_property ("keySignature", SCM_EOL);
-  daddy_trans_->set_property ("lastKeySignature", SCM_EOL);
+  daddy_context_->set_property ("keySignature", SCM_EOL);
+  daddy_context_->set_property ("lastKeySignature", SCM_EOL);
 
   Pitch p(0,0,0);
-  daddy_trans_->set_property ("tonic", p.smobbed_copy ());
+  daddy_context_->set_property ("tonic", p.smobbed_copy ());
 
 }
 
index a026118b98667e4b2dc3406725988d42bd772aa6..8501e4c5d67a144fbfe4caa1bc856e0acd7fb915 100644 (file)
@@ -12,7 +12,8 @@
 #include "note-head.hh"
 #include "rest.hh"
 #include "warn.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 /*
  * This abstract class provides the general framework for ligatures of
@@ -114,9 +115,9 @@ Ligature_engraver::override_stencil_callback ()
 {
   SCM target_callback = ly_symbol2scm ("print-function");
   SCM source_callback = ly_symbol2scm ("ligature-primitive-callback");
-  SCM noteHeadProperties = updated_grob_properties (daddy_trans_, ly_symbol2scm ("NoteHead"));
+  SCM noteHeadProperties = updated_grob_properties (daddy_context_, ly_symbol2scm ("NoteHead"));
   SCM value = ly_cdr (scm_sloppy_assq (source_callback, noteHeadProperties));
-  execute_pushpop_property (daddy_trans_, ly_symbol2scm ("NoteHead"),
+  execute_pushpop_property (daddy_context_, ly_symbol2scm ("NoteHead"),
                            target_callback, value);
 }
 
@@ -138,7 +139,7 @@ Ligature_engraver::revert_stencil_callback ()
 {
   SCM symbol = ly_symbol2scm ("NoteHead");
   SCM key = ly_symbol2scm ("print-function");
-  execute_pushpop_property (daddy_trans_, symbol, key, SCM_UNDEFINED);
+  execute_pushpop_property (daddy_context_, symbol, key, SCM_UNDEFINED);
 }
 
 void
@@ -173,7 +174,7 @@ Ligature_engraver::process_music ()
   if (ligature_)
     {
       // TODO: maybe forbid breaks only if not transcribing
-      top_engraver ()->forbid_breaks ();
+      get_score_engraver ()->forbid_breaks ();
     }
 
   if (reqs_drul_[START])
index 091eac7cf1050d3e9b3202276568a08332663212..cc8c17b851e5dc39bcb6f136494f2557562b1be5 100644 (file)
@@ -98,10 +98,10 @@ Line_interface::line (Grob *me, Offset from, Offset to)
 
 ADD_INTERFACE(Line_interface, "line-interface",
              "Generic line objects. Any object using lines supports this.  Normally,"
-             "you get a straight line. If dash-period is defined, a dashed line is "
-             "produced; the length of the dashes is tuned with" 
+             "you get a straight line. If @code{dash-period} is defined, a dashed line is "
+             "produced; the length of the dashes is tuned with 
              "@code{dash-fraction}. If the latter is set to 0, a dotted line is "
-             "produced. If @code{dash-fraction} is negative, the line is set "
+             "produced. If @code{dash-fraction} is negative, the line is made "
              "transparent.",
              
              "dash-period dash-fraction thickness style")
index 2f91fd7aa5328d49834871f1e8be8c477b49546d..2207d85a44d793e62a531341385c866f008a6ffe 100644 (file)
@@ -290,10 +290,12 @@ Line_spanner::print (SCM smob)
 
 
 ADD_INTERFACE (Line_spanner, "line-spanner-interface",
-  "Generic line drawn between two objects, eg. for use with glissandi.\n"
-"gap is measured in staff-spaces.\n"
-"The property 'type is one of: line, dashed-line, trill, dotted-line or zigzag.\n"
-"\n",
-  "gap zigzag-width zigzag-length thickness");
+              "Generic line drawn between two objects, e.g. for use with glissandi.\n"
+              "The property @code{style} can be @code{line}, "
+              "@code{dashed-line}, @code{trill}, \n"
+              "@code{dotted-line} or @code{zigzag}.\n"
+              "\n"
+              ,
+              "gap zigzag-width zigzag-length thickness");
 
 
index 667aef9431a0b3dcca41d2ff3475f048b749521f..f9753cfad4f1f623ee8eb5938d2869d58e1d197c 100644 (file)
@@ -728,7 +728,10 @@ LY_DEFINE(ly_bracket ,"ly:bracket",
 LY_DEFINE(ly_filled_box ,"ly:round-filled-box",
          3, 0, 0,
          (SCM xext, SCM yext, SCM blot),
-         "Make a filled-box of dimensions @var{xext}, @var{yext} and roundness @var{blot}.")
+         "Make a @code{Stencil} "
+         " that prints a filled-box of dimensions @var{xext}, "
+         "@var{yext} and roundness @var{blot}."
+         )
 {
   SCM_ASSERT_TYPE(is_number_pair (xext), xext, SCM_ARG1, __FUNCTION__, "number pair") ;
   SCM_ASSERT_TYPE(is_number_pair (yext), yext, SCM_ARG2, __FUNCTION__, "number pair") ;
index 938a7a9c2d36e26da32714a2040fcb5a7e1aa22f..1783677b8237411a1ce31a6c76846a022875ef92 100644 (file)
@@ -7,7 +7,7 @@
   
  */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "lyric-combine-music.hh"
 #include "event.hh"
 #include "note-head.hh"
@@ -29,7 +29,7 @@ protected:
 
   virtual bool ok () const;
   virtual void derived_mark () const;
-  virtual void derived_substitute (Translator_group*,Translator_group*) ;
+  virtual void derived_substitute (Context *,Context *) ;
 private:
   bool get_busy_status ()const ;
   bool melisma_busy (); 
@@ -39,10 +39,12 @@ private:
 };
 
 
+#include "translator.hh"
+
 bool
 melisma_busy (Translator* tr)
 {
-  SCM melisma_properties = tr->get_property ("melismaBusyProperties");
+  SCM melisma_properties = tr->daddy_context_->get_property ("melismaBusyProperties");
   bool busy = false;
 
   for (; gh_pair_p (melisma_properties);
@@ -97,7 +99,7 @@ Lyric_combine_music_iterator::derived_mark()const
 }
 
 void
-Lyric_combine_music_iterator::derived_substitute (Translator_group*f,Translator_group* t)
+Lyric_combine_music_iterator::derived_substitute (Context *f,Context * t)
 {
   if (music_iter_)
     music_iter_->substitute_outlet (f,t);
@@ -124,7 +126,7 @@ Lyric_combine_music_iterator::get_busy_status () const
   if (try_music (busy_req))
     return true;
   
-  Translator_group * tr = music_iter_->get_outlet ();
+  Context * tr = music_iter_->get_outlet ();
 
   SCM grobs = tr->get_property ("busyGrobs");
   Moment now = tr->now_mom();
index 1ad79cdf563c4505f99c215b36a2958583cbf0d9..3396fe194053084bee25186f30952c6120125756 100644 (file)
@@ -8,7 +8,7 @@ source file of the GNU LilyPond music typesetter
  */
 
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "engraver.hh"
 #include "note-head.hh"
 #include "lyric-extender.hh"
@@ -50,7 +50,7 @@ private:
   void add_lyric_extender (Grob_info);
   void add_stanza_number (Grob_info);
   Phrasing_association *get_phrasing_assoc (String nm);
-  String get_voice_name_for_lyric (Translator_group*tr);
+  String get_voice_name_for_lyric (Context *tr);
   Link_array<Phrasing_association> assocs_;
 };
 
@@ -95,12 +95,12 @@ Lyric_phrasing_engraver::get_phrasing_assoc (String nm)
 
 
 String
-Lyric_phrasing_engraver::get_voice_name_for_lyric (Translator_group*tr)
+Lyric_phrasing_engraver::get_voice_name_for_lyric (Context *tr)
 {
   SCM voice_context = tr->get_property ("associatedVoiceContext");
   if (Translator *vc = unsmob_translator (voice_context))
     {
-      return dynamic_cast<Translator_group*> (vc)->id_string_;
+      return dynamic_cast<Context *> (vc)->id_string_;
     }
   
   SCM voice = tr->get_property ("associatedVoice");
@@ -121,9 +121,9 @@ Lyric_phrasing_engraver::get_voice_name_for_lyric (Translator_group*tr)
 void
 Lyric_phrasing_engraver::add_lyric_extender (Grob_info inf)
 {
-  Translator_group * tr = inf.origin_trans_->daddy_trans_;
+  Context * tr = inf.origin_trans_->daddy_context_;
   while (tr && !tr->is_alias (ly_symbol2scm ("Lyrics")))
-    tr = tr->daddy_trans_;
+    tr = tr->daddy_context_;
 
   if (!tr)
     return;
@@ -136,9 +136,9 @@ Lyric_phrasing_engraver::add_lyric_extender (Grob_info inf)
 void
 Lyric_phrasing_engraver::add_stanza_number  (Grob_info inf)
 {
-  Translator_group * tr = inf.origin_trans_->daddy_trans_;
+  Context * tr = inf.origin_trans_->daddy_context_;
   while (tr && !tr->is_alias (ly_symbol2scm ("Lyrics")))
-    tr = tr->daddy_trans_;
+    tr = tr->daddy_context_;
 
   if (!tr)
     return;
@@ -150,9 +150,9 @@ Lyric_phrasing_engraver::add_stanza_number  (Grob_info inf)
 void
 Lyric_phrasing_engraver::add_voice_phrasing (Grob_info inf)
 {
-  Translator_group * tr = inf.origin_trans_->daddy_trans_;
+  Context * tr = inf.origin_trans_->daddy_context_;
   while (tr && !tr->is_alias (ly_symbol2scm ("Voice")))
-    tr = tr->daddy_trans_;
+    tr = tr->daddy_context_;
 
   if (!tr)
     return;
@@ -165,9 +165,9 @@ Lyric_phrasing_engraver::add_voice_phrasing (Grob_info inf)
 void
 Lyric_phrasing_engraver::add_lyric_phrasing (Grob_info inf)
 {
-  Translator_group * tr = inf.origin_trans_->daddy_trans_;
+  Context * tr = inf.origin_trans_->daddy_context_;
   while (tr && !tr->is_alias (ly_symbol2scm ("Lyrics")))
-    tr = tr->daddy_trans_;
+    tr = tr->daddy_context_;
 
   if (!tr)
     return;
index 82d27d3643687c80eeec55e565f3d6cb2e71d06f..5016287deca95cd8285dba4a38ca7bd580b62a55 100644 (file)
@@ -9,7 +9,7 @@
 #include <ctype.h>
 
 #include "bar-line.hh"
-
+#include "context.hh"
 #include "engraver-group-engraver.hh"
 #include "engraver.hh"
 #include "item.hh"
@@ -127,12 +127,12 @@ Mark_engraver::process_music ()
            {
              int mark_count = gh_scm2int (m);
              mark_count ++;
-             daddy_trans_->set_property ("rehearsalMark",
-                                         gh_int2scm (mark_count));
+             daddy_context_->set_property ("rehearsalMark",
+                                           gh_int2scm (mark_count));
            }
 
          if (gh_number_p (m))
-           m = scm_call_2 (proc, m, daddy_trans_->self_scm ());
+           m = scm_call_2 (proc, m, daddy_context_->self_scm ());
          else
            warning ("rehearsalMark does not have integer value.");
        }
index 45dd6ff0cd76a01b13153fd9e70da1155705e459..df169a9474cb09ff4e3fd1839ed0ff0f33d52ba1 100644 (file)
@@ -6,10 +6,11 @@
   (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
  */
 
-#include "score-engraver.hh"
 #include "spanner.hh"
 #include "warn.hh"
 #include "side-position-interface.hh"
+#include "global-context.hh"
+#include "engraver.hh"
 
 class Measure_grouping_engraver : public Engraver
 {
@@ -92,7 +93,7 @@ Measure_grouping_engraver::process_music ()
 
 
              stop_grouping_mom_ = now.main_part_ + Rational(grouplen - 1) * bl ;
-             top_engraver ()->add_moment_to_process (Moment (stop_grouping_mom_));
+             get_global_context ()->add_moment_to_process (Moment (stop_grouping_mom_));
 
              if (grouplen == 3)
                grouping_->set_grob_property ("style", ly_symbol2scm ("triangle"));
index 2896a3d8e8730c57ce24672887f94ab908ed2171..d6b4b6f6ce10cdfdc02a3dccea87348080e06080 100644 (file)
@@ -59,7 +59,8 @@ Measure_grouping::print (SCM grob)
 }
 
 ADD_INTERFACE (Measure_grouping,"measure-grouping-interface",
-              "indicate groups of beats. Valid choices for 'type are 'bracket and 'triangle.",
+              "This objectt indicates groups of beats. "
+              "Valid choices for @code{style} are @code{bracket} and @code{triangle}.",
               "thickness style height");
 
   
index 7513fb4e22d4735dede3cbb02a85cdfb1255ed4f..f8b9a5e68b1c797f7a19142d8e657d41a5632cca 100644 (file)
@@ -13,7 +13,8 @@
 #include "engraver.hh"
 #include "event.hh"
 #include "grob.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 /**
    Signal existence of melismas.
index 058994f906753317dabfe5efccafb1f1ba418d3a..b892ed32c7692bc343551f33dbc361bf35e925ca 100644 (file)
@@ -13,6 +13,7 @@
 #include "engraver.hh"
 #include "engraver-group-engraver.hh"
 #include "item.hh"
+#include "context.hh"
 
 /**
   put stuff over or next to  bars.  Examples: bar numbers, marginal notes,
@@ -100,7 +101,7 @@ Metronome_mark_engraver::process_music ()
 
       SCM proc = get_property ("metronomeMarkFormatter");
       SCM result= scm_call_2 (proc, mark_ev_->self_scm (),
-                             daddy_trans_->self_scm()); 
+                             daddy_context_->self_scm()); 
       
       text_->set_grob_property ("text", result);
     }
index 9b52517e3ce4641b4ac79763846e04af112b7387..39c509f7347b455a4c058e54236ab82265248136 100644 (file)
@@ -103,7 +103,7 @@ LY_DEFINE (div_moment,"ly:div-moment", 2,0,0, (SCM a, SCM b),
 }
 
 LY_DEFINE (ly_moment_less_p,"ly:moment<?", 2,0,0, (SCM a, SCM b),
-          "Comparation.")
+          "Compare two moments.")
 {
   Moment * ma = unsmob_moment (a);
   Moment * mb = unsmob_moment (b);
index 4a4c10f955f4b0ff2909b91907f55df794101ff3..972859178fd4da198838c44a08cd44ec4547473f 100644 (file)
@@ -13,7 +13,7 @@
 
 #include "warn.hh"
 #include "music-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "music-wrapper.hh"
 #include "music-wrapper-iterator.hh"
 #include "simple-music-iterator.hh"
@@ -35,14 +35,14 @@ Music_iterator::~Music_iterator ()
 {
 }
 
-Translator_group
+Context 
 Music_iterator::get_outlet () const
 {
   return handle_.get_outlet ();
 }
 
 void
-Music_iterator::set_translator (Translator_group *trans)
+Music_iterator::set_translator (Context *trans)
 {
   handle_.set_translator (trans);
 }
@@ -115,7 +115,7 @@ Music_iterator::music_start_mom ()const
 }
 
 void
-Music_iterator::init_translator (Music *m, Translator_group *report)
+Music_iterator::init_translator (Music *m, Context *report)
 {
   music_ = m;
   assert (m);
@@ -124,7 +124,7 @@ Music_iterator::init_translator (Music *m, Translator_group *report)
 }
 
 void
-Music_iterator::substitute_outlet (Translator_group*f, Translator_group *t)
+Music_iterator::substitute_outlet (Context *f, Context *t)
 {
   if (get_outlet () == f)
     set_translator (t);
@@ -132,7 +132,7 @@ Music_iterator::substitute_outlet (Translator_group*f, Translator_group *t)
 }
 
 void
-Music_iterator::derived_substitute (Translator_group*,Translator_group*)
+Music_iterator::derived_substitute (Context *,Context *)
 {
 }
 
index 6743e62f6d4f46bcb5e2960bc39af1f32aacd0bc..e1f86f7387e01582ee371d15e3e303b59e93a8e8 100644 (file)
@@ -10,7 +10,7 @@
 
 #include "warn.hh"
 #include "music-output-def.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "context-def.hh"
 #include "main.hh"
 #include "file-path.hh"
@@ -83,7 +83,7 @@ Music_output_def::assign_translator (SCM transdef)
   find the translator for NAME. NAME must be a symbol.
  */
 SCM
-Music_output_def::find_translator (SCM name) const
+Music_output_def::find_context_def (SCM name) const
 {  
   SCM val  =SCM_EOL;
   translator_tab_->try_retrieve (name, &val);
@@ -91,24 +91,6 @@ Music_output_def::find_translator (SCM name) const
 }
 
 
-Global_translator *
-Music_output_def::get_global_translator () 
-{
-  SCM key = ly_symbol2scm ("Score");
-  Context_def * t = unsmob_context_def (find_translator (key));
-
-  if (!t)
-    error (_f ("can't find `%s' context", "Score"));
-
-  Translator_group * tg = t->instantiate (SCM_EOL);
-  dynamic_cast<Global_translator*> (tg)->output_def_ = this;
-  
-
-  tg->initialize ();
-  
-  return dynamic_cast <Global_translator *> (tg);
-}
-
 int
 Music_output_def::print_smob (SCM s, SCM p, scm_print_state *)
 {
index 4e264db1874b7431218b8740ae402b38f83fed1c..e88f773d904e43aa4d9bbe36c459364b5fc0e79f 100644 (file)
@@ -29,7 +29,7 @@ Music_wrapper_iterator::derived_mark () const
 }
 
 void
-Music_wrapper_iterator::derived_substitute (Translator_group*f,Translator_group*t) 
+Music_wrapper_iterator::derived_substitute (Context *f,Context *t) 
 {
   
   if (child_iter_)
index fefeda054dbe86d8beeba3a5a3aaa94fab817a57..9514210f3336e2604f5ec87d5d107bd73f6e87bd 100644 (file)
@@ -292,15 +292,13 @@ LY_DEFINE(ly_music_name, "ly:music-name", 1, 0, 0,
 // to do  property args 
 LY_DEFINE(ly_extended_make_music,
          "ly:make-bare-music", 2, 0, 0,  (SCM type, SCM props),
-         "Make a music object/expression of type @var{type}, init with\n"
-"@var{props}. Warning: this interface will likely change in the near\n"
-"future.\n"
-"\n"
-"Music is the data type that music expressions are stored in. The data\n"
-"type does not yet offer many manipulations.\n"
-"\n"
-"WARNING: only for internal use. Please use make-music-by-name. \n"
-)
+         "Make a C++ music object of type @var{type}, initialize with\n"
+         "@var{props}. \n\n"
+         ""
+         "This function is for internal use, and is only called by "
+         "@code{make-music-by-name}, which is the preferred interface "
+         "for creating music objects. "
+         )
 {
   SCM_ASSERT_TYPE(gh_string_p (type), type, SCM_ARG1, __FUNCTION__, "string");
 
@@ -313,10 +311,10 @@ LY_DEFINE(ly_extended_make_music,
 // to do  property args 
 LY_DEFINE(ly_get_mutable_properties,
          "ly:get-mutable-properties", 1, 0, 0,  (SCM mus),
-"Return an alist signifying the mutable properties of @var{mus}.\n"
-"The immutable properties are not available; they should be initialized\n"
-"by the functions make-music-by-name function.\n"
-)
+         "Return an alist containing the mutable properties of @var{mus}.\n"
+         "The immutable properties are not available; they should be initialized\n"
+         "by the  @code{make-music-by-name} function.\n"
+         )
 {
   Music *m = unsmob_music (mus);
   SCM_ASSERT_TYPE(m, mus, SCM_ARG1, __FUNCTION__, "music");
@@ -324,7 +322,7 @@ LY_DEFINE(ly_get_mutable_properties,
   return m->get_property_alist (true);
 }
 
-LY_DEFINE(ly_music_list_p,"music-list?", 1, 0, 0, 
+LY_DEFINE(ly_music_list_p,"ly:music-list?", 1, 0, 0, 
   (SCM l),"Type predicate: return true if @var{l} is a list of music objects.")
 {
   if (scm_list_p (l) != SCM_BOOL_T)
diff --git a/lily/new-accidental-engraver.cc b/lily/new-accidental-engraver.cc
deleted file mode 100644 (file)
index 9b3d6a0..0000000
+++ /dev/null
@@ -1,553 +0,0 @@
-/*
-  new-accidental-engraver.cc -- implement new_accidental_engraver
-
-  (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
-  Modified 2001--2004 by Rune Zedeler <rz@daimi.au.dk>
-
-  This is an experimental file - producing correct accidentals but
-  unfortunately ruining the spacing. -rz
-  
-*/
-
-#include "event.hh"
-
-#include "item.hh"
-#include "tie.hh"
-#include "rhythmic-head.hh"
-#include "engraver-group-engraver.hh"
-#include "accidental-placement.hh"
-#include "side-position-interface.hh"
-#include "engraver.hh"
-#include "arpeggio.hh"
-#include "warn.hh"
-
-#include "translator-group.hh"
-
-/**
-
-
-FIXME: should not compute vertical positioning of accidentals, but
-get them from the noteheads
-
-The algorithm for accidentals should be documented, and made
-tweakable.
-
-*/
-
-struct New_accidental_entry {
-  int pass_done_;
-  int number_accidentals_;
-  int number_cautionaries_;
-  bool different_;
-  Music * melodic_;
-  Grob * accidental_;
-  Translator_group *origin_;
-  Grob*  head_;
-  New_accidental_entry();
-};
-
-New_accidental_entry::New_accidental_entry()
-{
-  pass_done_ = 0;
-  number_accidentals_ = 0;
-  number_cautionaries_ = 0;
-  different_ = false;
-  melodic_ = 0;
-  accidental_ = 0;
-  origin_ = 0;
-  head_ = 0;
-}
-
-struct New_accidental_engraver : Engraver {
-protected:
-  TRANSLATOR_DECLARATIONS (New_accidental_engraver);
-  virtual void process_music ();
-  virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
-  virtual void process_acknowledged_grobs ();
-  virtual void finalize ();
-  virtual void process_grobs_first_pass ();
-  virtual void process_grobs_second_pass ();
-
-  public:
-
-  /*
-    TODO -> property.
-    
-    This is not a property, and it is not protected.  This poses a
-    very small risk of the value being GC'd from under us.
-  */
-  SCM last_keysig_;
-
-  /*
-    Urgh. Since the accidentals depend on lots of variables, we have to
-    store all information before we can really create the accidentals.
-  */
-  Link_array<Grob> arpeggios_;
-
-  Grob * accidental_placement_;
-  
-
-  /*
-    The next 
-   */
-  Array<New_accidental_entry> accidentals_;
-  
-  Link_array<Grob> ties_;
-
-
-};
-
-
-New_accidental_engraver::New_accidental_engraver ()
-{
-  last_keysig_ = SCM_BOOL_F;
-  accidental_placement_ = 0;
-}
-
-/* inserts the source alist into the destination alist, erasing old entries.
-   result is: dest = merged
-*/ 
-static SCM merge_alists_front_x (SCM src, SCM dest) {
-  if(gh_pair_p(src)) {
-    dest = merge_alists_front_x(ly_cdr(src),dest);
-    dest = ly_assoc_front_x(dest, ly_caar(src), ly_cdar(src));
-  }
-  return dest;
-}
-
-static void merge_property_on_children (Translator_group * trans,
-                                      const char * from_sym, const char * to_sym)
-{
-  SCM from = trans->get_property(from_sym);
-  SCM to = trans->get_property(to_sym);
-  to = merge_alists_front_x(from, to);
-  trans->set_property (to_sym,  to);
-  trans->set_property (from_sym, SCM_EOL);
-  for (SCM p = trans -> trans_group_list_; gh_pair_p (p); p = ly_cdr(p)) {
-    Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
-    merge_property_on_children(trg, from_sym, to_sym);
-  }
-}
-
-static void merge_property_on_family (Translator_group * trans,
-                                     const char * from_sym, const char * to_sym)
-{
-  merge_property_on_children (trans, from_sym, to_sym);
-  trans = trans->daddy_trans_;
-  while (trans)
-    {
-      SCM from = trans->get_property(from_sym);
-      SCM to = trans->get_property(to_sym);
-      to = merge_alists_front_x(from, to);
-      trans->set_property (to_sym,  to);
-      trans->set_property (from_sym, SCM_EOL);
-      trans = trans->daddy_trans_;
-    }
-}
-
-static void set_property_on_children (Translator_group * trans, const char * sym, SCM val)
-{
-  trans->set_property (sym, val);
-  for (SCM p = trans -> trans_group_list_; gh_pair_p (p); p = ly_cdr(p)) {
-    Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
-    set_property_on_children(trg,sym,ly_deep_copy(val));
-  }
-}
-
-static void set_property_on_family(Translator_group * trans, const char * sym, SCM val)
-{
-  set_property_on_children (trans, sym, val);
-  trans = trans->daddy_trans_;
-  while (trans)
-    {
-      trans -> set_property (sym,  ly_deep_copy (val));
-      trans = trans->daddy_trans_;
-    }
-}
-
-/*
-calculates the number of accidentals on basis of the current local key sig
-  (passed as argument)
-  Returns number of accidentals (0, 1 or 2).
-    Negative (-1 or -2) if accidental has changed.
-
-*/
-static int
-number_accidentals (SCM sig, Music * note, Pitch *pitch, SCM curbarnum, SCM lazyness, 
-                   bool ignore_octave_b)
-{
-  int n = pitch->get_notename ();
-  int o = pitch->get_octave ();
-  int a = pitch->get_alteration (); 
-  int curbarnum_i = gh_scm2int (curbarnum);
-  int accbarnum_i = 0;
-
-  SCM prev;
-  if (ignore_octave_b)
-    prev = ly_assoc_cdr (gh_int2scm (n), sig);
-  else
-    prev = scm_assoc (gh_cons (gh_int2scm (o), gh_int2scm (n)), sig);
-
-  /* should really be true unless prev == SCM_BOOL_F */
-  if (gh_pair_p (prev) && gh_pair_p (ly_cdr (prev)))
-    {
-      accbarnum_i = gh_scm2int (ly_cddr (prev));
-      prev = gh_cons (ly_car (prev), ly_cadr (prev));
-    }
-  
-  /* If an accidental was not found or the accidental was too old */
-  if (prev == SCM_BOOL_F ||
-      (gh_number_p (lazyness) && curbarnum_i > accbarnum_i + gh_scm2int (lazyness)))
-    prev = scm_assoc (gh_int2scm (n), sig);
-
-
-  SCM prev_acc = (prev == SCM_BOOL_F) ? gh_int2scm (0) : ly_cdr (prev);
-
-  int p = gh_number_p (prev_acc) ? gh_scm2int (prev_acc) : 0;
-
-  int num;
-  if (a == p
-      && !to_boolean (note->get_mus_property ("force-accidental"))
-      && gh_number_p (prev_acc))
-    num = 0;
-  else if ( (abs (a)<abs (p) || p*a<0) && a != 0 )
-    num = 2;
-  else
-    num = 1;
-  
-  return a == p ? num : -num;
-}
-
-static int
-number_accidentals (Music * note, Pitch *pitch, Translator_group * origin, 
-                   SCM accidentals, SCM curbarnum)
-{
-  int number = 0;
-
-  bool diff = false;
-  if (gh_pair_p (accidentals) && !gh_symbol_p (ly_car (accidentals)))
-    warning (_f ("Accidental typesetting list must begin with context-name: %s", 
-                ly_scm2string (ly_car (accidentals)).to_str0 ()));
-  
-  while (gh_pair_p (accidentals) && origin)
-    {
-      // If pair then it is a new accidentals typesetting rule to be checked
-      if (gh_pair_p (ly_car (accidentals)))
-       {
-         SCM type = gh_caar (accidentals);
-         SCM lazyness = gh_cdar (accidentals);
-         SCM localsig = origin->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, pitch, curbarnum, lazyness, any_octave_b);
-             diff = diff || (n < 0);
-             number = max (number, abs (n));     
-           }
-         else
-           warning (_f ("unknown accidental typesetting: %s. Ignored", 
-                        ly_symbol2string (type).to_str0 ()));
-       }
-      
-
-      /*
-       if symbol then it is a context name. Scan parent contexts to find it.
-      */
-      else if (gh_symbol_p (ly_car (accidentals)))
-       {
-         SCM context = ly_car (accidentals);
-         
-         while (origin && !origin->is_alias (context))
-           origin = origin->daddy_trans_;
-      
-         if (!origin)
-           warning (_f ("Symbol is not a parent context: %s. Ignored", 
-                        ly_symbol2string (context).to_str0 ()));
-       }
-      else warning (_f ("Accidental typesetting must be pair or context-name: %s", 
-                       ly_scm2string (ly_car (accidentals)).to_str0 ()));
-      
-      accidentals = ly_cdr (accidentals);
-    }
-  return diff ? -number : number;
-}
-
-
-/* 
-  Perhaps one should join the two functions into one function taking an
-  argument (pass).
-  OTOH even though code would be smaller, spaghetti-level would increase.
-*/
-void
-New_accidental_engraver::process_grobs_first_pass ()
-{
-  SCM accidentals =  get_property ("autoAccidentals");
-  SCM cautionaries =  get_property ("autoCautionaries");
-  SCM barnum = get_property ("currentBarNumber");
-
-  for (int i = 0; i  < accidentals_.size (); i++) 
-    {
-      if (accidentals_[i].pass_done_ >= 1)
-       continue;
-      accidentals_[i].pass_done_  = 1;
-
-      Grob * support = accidentals_[i].head_;
-      Music * note = accidentals_[i].melodic_;
-      Translator_group * origin = accidentals_[i].origin_;
-      Pitch * pitch = unsmob_pitch (note->get_mus_property ("pitch"));
-
-      int num;
-      num = number_accidentals (note, pitch, origin, accidentals, barnum);
-      accidentals_[i].number_accidentals_ = abs(num);
-      accidentals_[i].different_ = num<0;
-
-      num = number_accidentals (note, pitch, origin, cautionaries, barnum);
-      accidentals_[i].number_cautionaries_ = abs(num);
-      accidentals_[i].different_ = accidentals_[i].different_ || num<0;
-
-      bool tie_changes = false;
-      for (int j = 0; j < ties_.size (); j++)
-       if (support == Tie::head (ties_[j], RIGHT))
-         tie_changes = accidentals_[i].different_;
-      int n = pitch->get_notename ();
-      int o = pitch->get_octave ();
-      int a = pitch->get_alteration ();
-      SCM o_s = gh_int2scm (o);
-      SCM n_s = gh_int2scm (n);
-      SCM on_s = gh_cons (o_s,n_s);
-      
-      while (origin)
-       {
-         SCM sigch = origin->get_property ("localKeySignatureChanges");
-         SCM alt;
-         if (tie_changes)
-           /*
-             Remember an alteration that is different both from
-             that of the tied note and of the key signature.
-           */
-           alt = SCM_BOOL_T;
-         else
-           alt = gh_int2scm (a);
-         bool other_alt_same_oct = false;
-         bool other_alt_any_oct = false;
-         for (SCM j = sigch; gh_pair_p(j); j = ly_cdr(j)) {
-           SCM entry = ly_car(j);
-           /* if same notename has a different alt already recorded: */
-           if(gh_equal_p(ly_cdar(entry),n_s) && !gh_equal_p(ly_cadr(entry),alt))
-             {
-               /* if it is also in same octave */
-               if(gh_equal_p(ly_caar(entry),o_s))
-                 other_alt_same_oct = true;
-               else
-                 other_alt_any_oct = true;
-             }
-         }
-         if(other_alt_same_oct)
-           alt = SCM_BOOL_T;
-         sigch = ly_assoc_front_x (sigch, on_s, gh_cons(alt,barnum)); 
-         if(other_alt_any_oct && !other_alt_same_oct) {
-           sigch = ly_assoc_front_x (sigch, on_s, gh_cons(SCM_BOOL_T,barnum));
-         }
-         origin->set_property ("localKeySignatureChanges",  sigch);
-         origin = origin->daddy_trans_;  
-       }
-    }
-}
-
-void
-New_accidental_engraver::process_grobs_second_pass ()
-{
-  SCM accidentals =  get_property ("autoAccidentals");
-  SCM cautionaries =  get_property ("autoCautionaries");
-  SCM barnum = get_property ("currentBarNumber");
-  
-  bool extra_natural_b = get_property ("extraNatural") == SCM_BOOL_T;
-  for (int i = 0; i  < accidentals_.size (); i++) 
-    {
-      if (accidentals_[i].pass_done_ >= 2)
-       continue;
-      accidentals_[i].pass_done_  = 2;
-      Grob * support = accidentals_[i].head_;
-      Music * note = accidentals_[i].melodic_;
-      Translator_group * origin = accidentals_[i].origin_;
-      
-      Pitch * pitch = unsmob_pitch (note->get_mus_property ("pitch"));
-
-      int num;
-      num = number_accidentals (note, pitch, origin, accidentals, barnum);
-      accidentals_[i].number_accidentals_ =
-       max (accidentals_[i].number_accidentals_, abs(num));
-      accidentals_[i].different_ = accidentals_[i].different_ || num<0;
-
-      num = number_accidentals (note, pitch, origin, cautionaries, barnum);
-      accidentals_[i].number_cautionaries_ =
-       max (accidentals_[i].number_cautionaries_, abs(num));
-      accidentals_[i].different_ = accidentals_[i].different_ || num<0;
-
-
-      bool cautionary = to_boolean (note->get_mus_property ("cautionary"));
-      
-      if (accidentals_[i].number_cautionaries_ >accidentals_[i].number_accidentals_ )
-       {
-         num = accidentals_[i].number_cautionaries_;
-         cautionary = true;
-       }
-      else
-         num = accidentals_[i].number_accidentals_;
-
-      bool tie_changes = false;
-      Grob *tie_break_reminder = 0;
-      for (int j = 0; j < ties_.size (); j++)
-       if (support == Tie::head (ties_[j], RIGHT))
-         {
-           tie_changes = accidentals_[i].different_;
-           tie_break_reminder = ties_[j];
-         }
-      
-      if (num)
-       {
-         Grob * a = make_item ("Accidental");
-         a->set_parent (support, Y_AXIS);
-         
-         if (!accidental_placement_)
-           {
-             accidental_placement_ = make_item ("AccidentalPlacement");
-             announce_grob (accidental_placement_, a->self_scm());
-           }
-         
-         Accidental_placement::add_accidental (accidental_placement_, a);
-         announce_grob (a, SCM_EOL);
-         
-         
-         SCM accs = gh_cons (gh_int2scm (pitch->get_alteration ()), SCM_EOL);
-         if (num == 2 && extra_natural_b)
-           accs = gh_cons (gh_int2scm (0), accs);
-         
-         if (cautionary)
-           {
-             a->set_grob_property ("cautionary", SCM_BOOL_T);
-           }
-         
-         if (tie_break_reminder)
-           {
-             a->set_grob_property ("tie", tie_break_reminder->self_scm());
-           }
-         
-         
-         support->set_grob_property ("accidental-grob", a->self_scm ());
-         
-         a->set_grob_property ("accidentals", accs);
-         accidentals_[i].accidental_ = a;
-         /*
-           We add the accidentals to the support of the arpeggio, so it is
-           put left of the accidentals. 
-         */
-         for (int i = 0;  i < arpeggios_.size ();  i++)
-           Side_position_interface::add_support (arpeggios_[i], a);
-       }       
-    }
-}
-
-void
-New_accidental_engraver::process_acknowledged_grobs ()
-{
-  if (accidentals_.size () && accidentals_.top().pass_done_ < 1)
-    process_grobs_first_pass ();
-}
-
-void
-New_accidental_engraver::finalize ()
-{
-
-}
-
-void
-New_accidental_engraver::stop_translation_timestep ()
-{
-  merge_property_on_family(daddy_trans_, "localKeySignatureChanges", "localKeySignature");
-  if (accidentals_.size () && accidentals_.top().pass_done_ < 2)
-    process_grobs_second_pass ();
-
-  for (int i = 0; i < accidentals_.size(); i++)
-    {
-      Grob *a = accidentals_[i].accidental_;
-      if (a)
-       {
-         typeset_grob (a);
-       }
-    }
-
-  if (accidental_placement_)
-    typeset_grob(accidental_placement_);
-  accidental_placement_ = 00;
-
-  set_property_on_family(daddy_trans_, "localKeySignatureChanges", SCM_EOL);  
-  accidentals_.clear();
-  arpeggios_.clear ();
-  ties_.clear ();
-}
-
-void
-New_accidental_engraver::acknowledge_grob (Grob_info info)
-{
-  Music * note =  info.music_cause ();
-
-  if (note
-      && note->is_mus_type ("note-event")
-      && Rhythmic_head::has_interface (info.grob_))
-    {
-      New_accidental_entry entry ;
-      entry.head_ = info.grob_;
-      entry.origin_ = info.origin_trans_->daddy_trans_;
-      entry.melodic_ = note;
-
-      accidentals_.push (entry);
-    }
-  else if (Tie::has_interface (info.grob_))
-    {
-      ties_.push (info.grob_);
-    }
-  else if (Arpeggio::has_interface (info.grob_))
-    {
-      arpeggios_.push (info.grob_); 
-    }
-  
-}
-
-void
-New_accidental_engraver::process_music ()
-{
-  SCM sig = get_property ("keySignature");
-
-  /* Detect key sig changes.
-     Update all parents and children
-  */
-  if (last_keysig_ != sig)
-    {
-      set_property_on_family(daddy_trans_, "localKeySignature", sig);
-      set_property_on_family(daddy_trans_, "localKeySignatureChanges", SCM_EOL); //This souldn't be neccesary
-      last_keysig_ = sig;
-    }
-}
-
-
-
-
-
-ENTER_DESCRIPTION (New_accidental_engraver,
-"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.",
-                  
-              "Accidental",
-/* accepts */     "",
-              "rhythmic-head-interface tie-interface arpeggio-interface",
-              "localKeySignature localKeySignatureChanges extraNatural autoAccidentals autoCautionaries",
-                  "localKeySignature localKeySignatureChanges");
index 35e7e3328e566457f5b6ce20664dd41b87eddcd7..9af231f9e91ef87ccfafe89f8b1cb477bdf8a1f5 100644 (file)
@@ -112,7 +112,7 @@ New_fingering_engraver::add_script (Grob * head,
   Finger_tuple ft ;
 
   Grob * g=  make_item ("Script");
-  make_script_from_event (g, &ft.description_, daddy_trans_,
+  make_script_from_event (g, &ft.description_, daddy_context_,
                          event->get_mus_property ("articulation-type"), 0);
   if (g)
     {
index 43660044adf729333cc7bf1f6dba195493ac996f..0278c0eaf2153ff8e7970103657e5e35d7098cf5 100644 (file)
@@ -7,7 +7,7 @@ source file of the GNU LilyPond music typesetter
 
  */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "lyric-combine-music.hh"
 #include "event.hh"
 #include "grob.hh"
@@ -29,14 +29,14 @@ protected:
   virtual bool run_always ()const;
   virtual bool ok () const;
   virtual void derived_mark () const;
-  virtual void derived_substitute (Translator_group*,Translator_group*);
+  virtual void derived_substitute (Context *,Context *);
 private:
   bool start_new_syllable () ;
   void find_voice ();
 
   bool made_association_;
-  Translator_group * lyrics_context_;
-  Translator_group* music_context_;
+  Context * lyrics_context_;
+  Context * music_context_;
   Music_iterator * lyric_iter_;
 };
 
@@ -123,7 +123,7 @@ New_lyric_combine_music_iterator::derived_mark()const
 }
 
 void
-New_lyric_combine_music_iterator::derived_substitute (Translator_group*f, Translator_group*t)
+New_lyric_combine_music_iterator::derived_substitute (Context *f, Context *t)
 {
   if (lyric_iter_)
     lyric_iter_->substitute_outlet (f,t);
@@ -133,32 +133,6 @@ New_lyric_combine_music_iterator::derived_substitute (Translator_group*f, Transl
     music_context_ = t; 
 }
 
-/*
-  ID == "" means accept any ID.
- */
-Translator_group *
-find_context_below (Translator_group * where,
-                   String type, String id)
-{
-  if (where->is_alias (ly_symbol2scm (type.to_str0 ())))
-    {
-      if (id == "" || where->id_string_ == id)
-       return where;
-    }
-  
-  Translator_group * found = 0;
-  for (SCM s = where->trans_group_list_;
-       !found && gh_pair_p (s); s = gh_cdr (s))
-    {
-      Translator_group * tr = dynamic_cast<Translator_group*> (unsmob_translator (gh_car (s)));
-
-      found = find_context_below (tr, type, id);
-    }
-
-  return found; 
-}
-
-
 
 void
 New_lyric_combine_music_iterator::construct_children ()
@@ -188,12 +162,12 @@ New_lyric_combine_music_iterator::find_voice ()
   
       if (gh_string_p (voice_name))
        {
-         Translator_group *t = get_outlet ();
-         while (t && t->daddy_trans_)
-           t = t->daddy_trans_;
+         Context *t = get_outlet ();
+         while (t && t->daddy_context_)
+           t = t->daddy_context_;
 
          String name = ly_scm2string (voice_name);
-         Translator_group *voice = find_context_below (t, "Voice", name);
+         Context *voice = find_context_below (t, "Voice", name);
          if (!voice)
            get_music ()->origin ()->warning (_f ("cannot find Voice: %s\n",
                                                  name.to_str0 ())); 
@@ -221,7 +195,7 @@ New_lyric_combine_music_iterator::process (Moment )
   if (!music_context_)
     return ;
   
-  if (!music_context_->daddy_trans_)
+  if (!music_context_->daddy_context_)
     {
       /*
        The melody has died.
index c45b7fd4630f11f0754c9c7ec025b8180910693a..79e3e7c889a457921f25c294903af7b0192e9660 100644 (file)
@@ -6,7 +6,7 @@
      (c) 2004 Han-Wen Nienhuys
 */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "event.hh"
 #include "music-sequence.hh"
 #include "lily-guile.hh"
@@ -21,7 +21,7 @@ public:
 
   DECLARE_SCHEME_CALLBACK(constructor, ()); 
 protected:
-  virtual void derived_substitute (Translator_group*f, Translator_group*t) ;
+  virtual void derived_substitute (Context *f, Context *t) ;
   virtual void derived_mark () const;
   New_pc_iterator (New_pc_iterator const &);
 
@@ -57,10 +57,10 @@ private:
   Interpretation_context_handle shared_;
   Interpretation_context_handle solo_;
   
-  void substitute_both (Translator_group * to1,
-                       Translator_group * to2);
+  void substitute_both (Context * to1,
+                       Context * to2);
 
-  void kill_mmrest (Translator_group*);
+  void kill_mmrest (Context *);
   void chords_together ();
   void solo1 ();
   void solo2 ();
@@ -88,8 +88,8 @@ New_pc_iterator::derived_mark () const
 }
 
 void
-New_pc_iterator::derived_substitute (Translator_group*f,
-                                    Translator_group*t)
+New_pc_iterator::derived_substitute (Context *f,
+                                    Context *t)
 {
   if (first_iter_)
     first_iter_->substitute_outlet (f,t);
@@ -147,7 +147,7 @@ New_pc_iterator::chords_together ()
 
 
 void
-New_pc_iterator::kill_mmrest (Translator_group * tg)
+New_pc_iterator::kill_mmrest (Context * tg)
 {
   static Music * mmrest;
   if (!mmrest)
@@ -186,10 +186,10 @@ New_pc_iterator::solo1 ()
 }
 
 void
-New_pc_iterator::substitute_both (Translator_group * to1,
-                                 Translator_group * to2)
+New_pc_iterator::substitute_both (Context * to1,
+                                 Context * to2)
 {
-  Translator_group *tos[]  = {to1,to2};
+  Context *tos[]  = {to1,to2};
   Music_iterator *mis[] = {first_iter_, second_iter_}; 
   Interpretation_context_handle *hs[] = {
     &null_,
@@ -207,7 +207,7 @@ New_pc_iterator::substitute_both (Translator_group * to1,
 
   for (int j =  0; hs[j]; j++)
     {
-      Translator_group* t = hs[j]->get_outlet ();
+      Context * t = hs[j]->get_outlet ();
       if (t != to1 && t != to2)
        kill_mmrest (t);
     }
@@ -293,8 +293,8 @@ New_pc_iterator::construct_children ()
                          
                          SCM_UNDEFINED);
 
-  Translator_group *tr
-    =  get_outlet ()->find_create_translator (ly_symbol2scm ("Voice"),
+  Context *tr
+    =  get_outlet ()->find_create_context (ly_symbol2scm ("Voice"),
                                             "shared",props);
 
   shared_.set_translator (tr);
@@ -304,14 +304,14 @@ New_pc_iterator::construct_children ()
    */
   set_translator (tr);
 
-  Translator_group *solo_tr
-    =  get_outlet ()->find_create_translator (ly_symbol2scm ("Voice"),
+  Context *solo_tr
+    =  get_outlet ()->find_create_context (ly_symbol2scm ("Voice"),
                                              "solo",props);
 
   solo_ .set_translator (solo_tr);
 
-  Translator_group *null
-    =  get_outlet ()->find_create_translator (ly_symbol2scm ("Devnull"),
+  Context *null
+    =  get_outlet ()->find_create_context (ly_symbol2scm ("Devnull"),
                                             "", SCM_EOL);
 
   if (!null)
@@ -319,7 +319,7 @@ New_pc_iterator::construct_children ()
   
   null_.set_translator (null);
 
-  Translator_group *one = tr->find_create_translator (ly_symbol2scm ("Voice"),
+  Context *one = tr->find_create_context (ly_symbol2scm ("Voice"),
                                                      "one", props);
 
   one_.set_translator (one);
@@ -328,7 +328,7 @@ New_pc_iterator::construct_children ()
   first_iter_ = unsmob_iterator (get_iterator (unsmob_music (gh_car (lst))));
 
 
-  Translator_group *two = tr->find_create_translator (ly_symbol2scm ("Voice"),
+  Context *two = tr->find_create_context (ly_symbol2scm ("Voice"),
                                                      "two", props);
   two_.set_translator (two);
   set_translator (two);
index e2eb02f0432ec900d2c67c18e3793731f4c075de..6cb90f4e710bedb07e7a1562bf4e2da0b89b6f17 100644 (file)
@@ -15,7 +15,8 @@
 #include "rhythmic-head.hh"
 #include "side-position-interface.hh"
 #include "staff-symbol-referencer.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 /**
    Create line-spanner grobs for lines that connect note heads.
@@ -36,7 +37,7 @@ protected:
 
 private:
   Spanner* line_; 
-  Translator* last_staff_;
+  Context* last_staff_;
   bool follow_;
   Grob* head_;
   Grob* last_head_;
@@ -59,11 +60,12 @@ Note_head_line_engraver::acknowledge_grob (Grob_info info)
       head_ = info.grob_;
       if (to_boolean (get_property ("followVoice")))
        {
-         Translator_group  * tr = daddy_trans_;
+         Context * tr = daddy_context_;
          while (tr && !tr->is_alias (ly_symbol2scm ( "Staff")))
-           tr = tr->daddy_trans_ ;
+           tr = tr->daddy_context_ ;
 
-         if (tr && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_)
+         if (tr
+             && tr->is_alias (ly_symbol2scm ("Staff")) && tr != last_staff_)
            {
              if (last_head_)
                follow_ = true;
index 22df5b0fb80e1c9550220bc4971acaa8cd4218e2..cab4f8e28761efbbeb3e03e4dcb7d0d034b13bda 100644 (file)
@@ -10,7 +10,7 @@
 #include "event.hh"
 #include "audio-item.hh"
 #include "audio-column.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 
 /**
@@ -25,8 +25,7 @@ protected:
 
   virtual void stop_translation_timestep ();
   virtual void create_audio_elements ();
-  Global_translator* get_global_translator ();
-
 private:
   Link_array<Music> note_evs_;
   Link_array<Audio_note> notes_;
@@ -61,29 +60,13 @@ Note_performer::create_audio_elements ()
     }
 }
 
-Global_translator*
-Note_performer::get_global_translator ()
-{
-  Translator *t = this;
-  Global_translator *global =0;
-  do
-    {
-      t = t->daddy_trans_ ;
-      global = dynamic_cast<Global_translator*> (t);
-    }
-  while (!global);
-
-  return global;
-}
-
 
 void
 Note_performer::stop_translation_timestep ()
 {
-
   // why don't grace notes show up here?
   // --> grace notes effectively do not get delayed
-  Global_translator* global = get_global_translator ();
+  Global_context * global = get_global_context ();
   for (int i=0; i < notes_.size (); i++)
     {
       Audio_note* n = notes_[i];
index 40cb91d5ba79727d05542d814a9ed9e1940978cb..6a8600e7d4932e5156cea292f0a7d4f3c48a17b7 100644 (file)
@@ -448,6 +448,6 @@ Note_spacing::stem_dir_correction (Grob*me, Item * rcolumn,
 
 
 ADD_INTERFACE (Note_spacing,"note-spacing-interface",
-  "",
+  "This object calculates spacing wishes for individual voices.",
   "left-items right-items stem-spacing-correction knee-spacing-correction");
 
index 3d43a85a6e646b693ac6fa9d9179d48f249f11d9..7af3914c8e6d242f493e6862714c914f8cb4eee0 100644 (file)
@@ -9,7 +9,8 @@
 
 #include "engraver.hh"
 #include "grob.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 class Output_property_engraver : public Engraver
 {
@@ -59,17 +60,17 @@ Output_property_engraver::acknowledge_grob (Grob_info inf)
        }
       else
        {
-         Translator_group * d =
-           dynamic_cast<Translator_group*> (inf.origin_trans_);
+         Context * d =
+           dynamic_cast<Context *> (inf.origin_trans_);
 
          if (!d)
-           d = dynamic_cast<Translator_group*> (inf.origin_trans_->daddy_trans_);
+           d = dynamic_cast<Context *> (inf.origin_trans_->daddy_context_);
          
          SCM proc = o->get_mus_property ("procedure");
          scm_call_3 (proc,
                      inf.grob_->self_scm(),
                      d->self_scm(), 
-                     daddy_trans_->self_scm());
+                     daddy_context_->self_scm());
        }
     }
 }
index af2469199941743b690c33b9f83a375518e11e42..9de3eda80e405dfc05968d5176c10e617f79893d 100644 (file)
 
 
 ADD_INTERFACE (Paper_column, "paper-column-interface",
-  "  Paper_columns form the top-most item parent. (The Paper_columns X\n"
-"  parent is System, which is a spanner.)\n"
-"\n"
-"  Paper_columns form the units for the spacing engine. They are\n"
-"  numbered, the first (leftmost) is column 0. Numbering happens before\n"
-"  line-breaking, and columns are not renumbered after line breaking.\n"
-"\n"
-"  Since many columns go unused, you should only use the rank field to\n"
-"  get ordering information.  Two adjacent columns may have\n"
-"  non-adjacent numbers.\n"
-"\n"
-"  Don't be confused by right-items: each spacing wish can also contain\n"
-"  a number of items, with which a spacing constraint may be kept. It's\n"
-"  a little baroque, but it might come in handy later on?\n"
-"\n",
-  "between-cols between-system-string when bounded-by-me shortest-playing-duration shortest-starter-duration");
-
+              "@code{Paper_column} objects form the top-most X-parents for items. "
+              "  The are two types of columns: musical columns, where are attached to, and "
+              "  non-musical columns, where bar-lines, clefs etc. are attached to. "
+              "  The spacing engine determines the X-positions of these objects."
+              "\n\n"
+              "They are\n"
+              "  numbered, the first (leftmost) is column 0. Numbering happens before\n"
+              "  line-breaking, and columns are not renumbered after line breaking.\n"
+              "  Since many columns go unused, you should only use the rank field to\n"
+              "  get ordering information.  Two adjacent columns may have\n"
+              "  non-adjacent numbers.\n"
+              "\n"
+              ,
+              "between-cols between-system-string when bounded-by-me "
+              "shortest-playing-duration shortest-starter-duration");
 
 void
 Paper_column::do_break_processing ()
index ac8af7494b60d7d71e3b0261429ee1340daf3dc4..31f2dd7a63c7d359df817c53a01faa1e93ce4663 100644 (file)
@@ -83,7 +83,7 @@ Paper_score::process (String outname)
   /*
     Be sure to set breakability on first & last column.
    */
-  {
+  { /* doubly, also done in Score_engraver */
     Link_array<Grob> pc (system_->columns ());
   
     pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
index 9f0096c2f53c30ac82e661dfa4e007ccb494de1b..a7ba07ef8b49c299090f2594e3a39767ef163890 100644 (file)
@@ -1386,25 +1386,21 @@ command_element:
        | BAR STRING                    {
                Music *t = set_property_music (ly_symbol2scm ("whichBar"), $2);
 
-               Music *csm = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               csm->set_mus_property ("element", t->self_scm ());
-               scm_gc_unprotect_object (t->self_scm ());
-
-               $$ = csm;
+               Music *csm = context_spec_music (ly_symbol2scm ("Timing"), SCM_UNDEFINED,
+                                       t, SCM_EOL);
+               $$ = context_spec_music (ly_symbol2scm ("Score"), SCM_UNDEFINED, csm, SCM_EOL);
                $$->set_spot (THIS->here_input ());
-
-               csm->set_mus_property ("context-type", ly_symbol2scm ("Timing"));
+               t->set_spot (THIS->here_input ());
        }
        | PARTIAL duration_length       {
                Moment m = - unsmob_duration ($2)->get_length ();
                Music * p = set_property_music (ly_symbol2scm ( "measurePosition"),m.smobbed_copy ());
-
-               Music * sp = MY_MAKE_MUSIC("ContextSpeccedMusic");
-               sp->set_mus_property ("element", p->self_scm ());
-               scm_gc_unprotect_object (p->self_scm ());
-
-               $$ =sp ;
-               sp-> set_mus_property ("context-type", ly_symbol2scm ("Timing"));
+               p->set_spot (THIS->here_input ());
+               p = context_spec_music (ly_symbol2scm ("Timing"), SCM_UNDEFINED,
+                                       p, SCM_EOL);
+               p = context_spec_music (ly_symbol2scm ("Score"), SCM_UNDEFINED,
+                                       p, SCM_EOL);
+               $$ =p ;
        }
        | CLEF STRING  {
                static SCM proc ;
index 09009b0baf5650aeb991d2ef84799f0be0b2fa4b..87e08fa3ec2db045d9030304071d52cfd8e59db6 100644 (file)
@@ -10,7 +10,7 @@
 #include "engraver.hh"
 #include "repeated-music.hh"
 #include "engraver-group-engraver.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 #include "misc.hh"
 #include "spanner.hh"
@@ -19,7 +19,8 @@
 #include "bar-line.hh"
 
 #include "score-engraver.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 /**
   This acknowledges repeated music with "percent" style.  It typesets
@@ -113,7 +114,7 @@ Percent_repeat_engraver::try_music (Music * m)
       repeat_ = rp;
 
       
-      Global_translator *global =top_engraver();
+      Global_context *global = get_global_context ();
       for (int i = 0; i < count; i++)  
        global->add_moment_to_process (next_moment_ + Moment (i) * body_length_);
   
@@ -146,11 +147,11 @@ Percent_repeat_engraver::process_music ()
        forbid breaks on a % line. Should forbid all breaks, really.
        */
 
-           top_engraver()->forbid_breaks ();   // guh. Use properties!      
+         get_score_engraver ()->forbid_breaks ();      // guh. Use properties!      
        }
       next_moment_ = next_moment_ + body_length_;
 
-      top_engraver()->add_moment_to_process (next_moment_);
+      get_global_context ()->add_moment_to_process (next_moment_);
     }
 }
 
index e2358a03e41eebe53fe66cf8db133f3abbba5c8b..8bb34c4e662505d7d9d67e3697a6bea71ead04fb 100644 (file)
@@ -86,7 +86,7 @@ Percent_repeat_iterator::derived_mark()const
 }
 
 void
-Percent_repeat_iterator::derived_substitute(Translator_group*f,Translator_group*t )
+Percent_repeat_iterator::derived_substitute(Context *f,Context *t )
 {
   if (child_iter_)
     child_iter_->substitute_outlet (f,t);
index 55776074c00c61d4e60ce672ed57b8e10db26961..90029772505feb2716eee44c2f43587c01fd7cc8 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "performer-group-performer.hh"
-
+#include "context.hh"
 #include "audio-element.hh"
 #include "warn.hh"
 
@@ -27,21 +27,11 @@ void
 Performer_group_performer::announce_element (Audio_element_info info)
 {
   announce_infos_.push (info);
-  Performer::announce_element (info);
-}
-
-
+  Translator *t
+    = unsmob_translator (daddy_context_->daddy_context_->implementation_);
 
-void
-Performer_group_performer::create_audio_elements ()
-{
-  for (SCM p = get_simple_trans_list (); gh_pair_p (p); p = ly_cdr (p))
-    {
-      Translator * t = unsmob_translator (ly_car (p));
-      Performer * eng = dynamic_cast<Performer*> (t);
-      if (eng)
-       eng->create_audio_elements ();
-    }
+  if (Performer_group_performer * eg = dynamic_cast<Performer_group_performer*> (t))
+    eg->announce_element (info);
 }
 
 void
@@ -64,29 +54,16 @@ Performer_group_performer::acknowledge_audio_elements ()
 void
 Performer_group_performer::do_announces ()
 {
-  for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p))
+  while (1)
     {
-      Translator * t = unsmob_translator (ly_car (p));
-      dynamic_cast<Performer_group_performer*> (t)->do_announces ();
-    }
-
+      performer_each (get_simple_trans_list (),
+                     &Performer::create_audio_elements);
   
-  create_audio_elements ();
-    
-  while (announce_infos_.size ())
-    {
+      if (!announce_infos_.size ())
+       break ;
+      
       acknowledge_audio_elements ();
       announce_infos_.clear ();
-      create_audio_elements ();
-    }
-
-  if (announce_infos_.size ())
-    {
-#if 0  //printf?  -> include <stdio.h>     
-      printf ("do_announces: elt: %s\n",
-             classname (announce_infos_[0].elem_));
-#endif      
-      announce_infos_.clear ();
     }
 }
 
@@ -94,27 +71,44 @@ Performer_group_performer::Performer_group_performer()
 {
 }
 
-/*
-  C & P from Engraver.
-
-  Should move into Translator ? 
- */
+/* c&p engraver-group.cc */
 void
-Performer_group_performer::process_music ()
+recurse_down_performers (Context * c, Performer_method ptr, bool context_first)
 {
-   for (SCM p = get_simple_trans_list (); gh_pair_p (p); p =ly_cdr (p))
+  Performer_group_performer * tg
+    = dynamic_cast<Performer_group_performer*> (unsmob_translator (c->implementation_));
+
+
+  if (!context_first)
     {
-      Translator * t = unsmob_translator (ly_car (p));
-      Performer * eng = dynamic_cast<Performer*> (t);
+      performer_each (tg->get_simple_trans_list (),
+                    ptr);
 
-      if (eng)
-       eng->process_music ();
+      (tg->*ptr) ();
     }
-   for (SCM p = trans_group_list_; gh_pair_p (p); p =ly_cdr (p))
+
+  for (SCM s = c->context_list_ ; gh_pair_p (s);
+       s =gh_cdr (s))
+    {
+      recurse_down_performers (unsmob_context (gh_car (s)), ptr, context_first);
+    }
+
+  if (context_first)
+    {
+      performer_each (tg->get_simple_trans_list (),
+                    ptr);
+      (tg->*ptr) ();
+    }
+}
+
+
+void
+performer_each (SCM list, Performer_method method)
+{
+  for (SCM p = list; gh_pair_p (p); p = ly_cdr (p))
     {
-      Translator * t = unsmob_translator (ly_car (p));
-      Performer*eng = dynamic_cast<Performer*> (t);
-      if (eng)
-       eng->process_music ();
+      Performer * e = dynamic_cast<Performer*>(unsmob_translator (ly_car (p)));
+      if (e)
+       (e->*method) ();
     }
 }
index 6d618346eaf452f11d74c009185584a7449baeca..ebf5a030fbbd947bcdd6a71718a7a5601c161101 100644 (file)
@@ -7,28 +7,32 @@
                Jan Nieuwenhuizen <janneke@gnu.org>
  */
 
-
+#include "context.hh"
 #include "performer-group-performer.hh"
 #include "warn.hh"
 
+void
+Performer::do_announces ()
+{
+}
+
 void 
 Performer::play_element (Audio_element* p) 
 { 
-  get_daddy_perf ()->play_element (p); 
+  get_daddy_performer ()->play_element (p); 
 }
 
 int
 Performer::get_tempo () const
 {
-  return get_daddy_perf ()->get_tempo ();
+  return get_daddy_performer ()->get_tempo ();
 }
 
 Performer_group_performer*
-Performer::get_daddy_perf () const
+Performer::get_daddy_performer () const
 {
-  return (daddy_trans_) 
-    ?dynamic_cast<Performer_group_performer *> (daddy_trans_)
-    : 0;
+  return
+    dynamic_cast<Performer_group_performer *> (get_daddy_translator ());
 }
 
 void
@@ -47,10 +51,9 @@ Performer::announce_element (Audio_element_info i)
 {
   if (!i.origin_trans_)
     i.origin_trans_= this;
-  get_daddy_perf ()->announce_element (i);
+  get_daddy_performer ()->announce_element (i);
 }
 
-
 void
 Performer::process_music ()
 {
index b3aa443e9ad8d81ef341705f6b70aae106878059..80baaabdd128521b402306d66327fc78813186b9 100644 (file)
@@ -8,7 +8,8 @@
 #include "slur.hh"
 #include "warn.hh"
 #include "note-column.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "engraver.hh"
 #include "spanner.hh"
 
index fb9a2ac4f664dcc718332351c9a868ffa991d1ec..7ec72e0ca6184a9bb01e999680301c691bb21f5b 100644 (file)
@@ -87,5 +87,6 @@ Piano_pedal_bracket::print (SCM smob)
 
 
 ADD_INTERFACE (Piano_pedal_bracket,"piano-pedal-bracket-interface",
-              "The bracket of the piano pedal.  It can be tuned through the regular bracket properties (bracket-flare, edge-height, shorten-pair).",
+              "The bracket of the piano pedal.  It can be tuned through the regular "
+              "bracket properties.",
               "edge-height shorten-pair bracket-flare pedal-text");
index 77283f3bce6442ec8bcaa617e1b5cd8b50cd12fe..f4663da8c6e567481a3d61c5e7c908e22ccdbc31 100644 (file)
@@ -18,7 +18,8 @@
 #include "staff-symbol-referencer.hh"
 #include "item.hh"
 #include "axis-group-interface.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "directional-element-interface.hh"
 #include "note-column.hh"
 #include "warn.hh"
index 76ab39c9e222c682709ce616f3d03be2036c704f..e01026da3dc764521dcf39ccdebd4459e1ce3dbb 100644 (file)
@@ -309,17 +309,17 @@ Pitch::less_p (SCM p1, SCM p2)
  */
 
 LY_DEFINE(make_pitch, "ly:make-pitch", 3, 0, 0, 
-         (SCM o, SCM n, SCM a),
+         (SCM octave, SCM note, SCM alter),
          "@var{octave} is specified by an integer, zero for the octave containing "
          "middle C.  @var{note} is a number from 0 to 6, with 0 corresponding to C "
-         "and 6 corresponding to B.  The shift is zero for a natural, negative for "
+         "and 6 corresponding to B.  The @var{alter} is zero for a natural, negative for "
          "flats, or positive for sharps. ")
 {
-  SCM_ASSERT_TYPE(gh_number_p (o), o, SCM_ARG1, __FUNCTION__, "number");
-  SCM_ASSERT_TYPE(gh_number_p (n), n, SCM_ARG2, __FUNCTION__, "number");
-  SCM_ASSERT_TYPE(gh_number_p (a), a, SCM_ARG3, __FUNCTION__, "number");
+  SCM_ASSERT_TYPE(scm_integer_p (octave)== SCM_BOOL_T , octave, SCM_ARG1, __FUNCTION__, "integer");
+  SCM_ASSERT_TYPE(scm_integer_p (note)== SCM_BOOL_T, note, SCM_ARG2, __FUNCTION__, "integer");
+  SCM_ASSERT_TYPE(scm_integer_p (alter)== SCM_BOOL_T, alter, SCM_ARG3, __FUNCTION__, "integer");
 
-  Pitch p (gh_scm2int (o), gh_scm2int (n), gh_scm2int (a));
+  Pitch p (gh_scm2int (octave), gh_scm2int (note), gh_scm2int (alter));
   return p.smobbed_copy ();
 }
 
@@ -407,8 +407,9 @@ LY_DEFINE(pitch_less, "ly:pitch<?", 2,0,0, (SCM p1, SCM p2),
 
 LY_DEFINE(ly_pitch_diff, "ly:pitch-diff", 2 ,0 ,0,
          (SCM pitch, SCM  root),
-         "Return pitch with value DELTA =  PITCH - ROOT, ie, "
-         "ROOT == (ly:pitch-transpose PITCH DELTA).")
+         "Return pitch @var{delta} such that @code{pitch} transposed by "
+         "@var{delta} equals @var{root}"
+         )
 {
   Pitch *p = unsmob_pitch (pitch);
   Pitch *r = unsmob_pitch (root);
index 9ce3befab7f2cae94df932a9b76b4d9678d893ec..9cc019ca6f950be01f387947ee1262bd371be093 100644 (file)
@@ -9,9 +9,7 @@
 #include "property-iterator.hh"
 #include "music.hh"
 #include "context-def.hh"
-#include "translator-group.hh"
-#include "global-translator.hh"
-
+#include "global-context.hh"
 
 bool check_grob(Music *mus, SCM sym);
 
@@ -50,8 +48,8 @@ SCM
 Property_iterator::once_finalization(SCM translator, SCM music )
 {
   Music * m = unsmob_music (music);
-  Translator_group * tg
-    = dynamic_cast<Translator_group*> (unsmob_translator (translator));
+  Context * tg
+    = dynamic_cast<Context *> (unsmob_context (translator));
   SCM sym = m->get_mus_property ("symbol");
 
   tg->unset_property (sym);
@@ -66,8 +64,7 @@ Property_iterator::do_quit ()
       SCM trans = get_outlet ()->self_scm();
       SCM music = get_music()->self_scm();
 
-      Global_translator * tg=  get_outlet ()->top_translator ();
-
+      Global_context * tg = get_outlet ()->get_global_context ();
       tg->add_finalization (scm_list_n (once_finalization_proc,
                                        trans, music, SCM_UNDEFINED));
     }
@@ -123,7 +120,7 @@ SCM
 Push_property_iterator::once_finalization (SCM trans, SCM music)
 {
   Music * mus = unsmob_music (music);
-  Translator_group * tg = dynamic_cast<Translator_group*> (unsmob_translator (trans));
+  Context * tg = dynamic_cast<Context *> (unsmob_context (trans));
     
   SCM sym = mus->get_mus_property ("symbol");
   if (check_grob (mus, sym))
@@ -143,7 +140,7 @@ Push_property_iterator::do_quit ()
       SCM trans = get_outlet ()->self_scm();
       SCM music = get_music ()->self_scm();
 
-      Global_translator * tg=  get_outlet ()->top_translator ();
+      Global_context * tg=  get_outlet ()->get_global_context ();
       tg->add_finalization (scm_list_n (once_finalization_proc,
                                        trans, music, SCM_UNDEFINED));
     }
index 1deac7f2b7ceb5c4e3e627cd3267578cf2cf0ac3..2a0970b50961c22557d29d32339c0ec79c19eb6c 100644 (file)
@@ -65,13 +65,10 @@ Recording_group_engraver::finalize ()
 bool
 Recording_group_engraver::try_music (Music  *m)
 {
-  bool here_success = Translator_group::try_music_on_nongroup_children (m);
-  bool retval = here_success;
-  if (!here_success && daddy_trans_)
-    retval = daddy_trans_->try_music (m);
-      
+  bool retval = Translator_group::try_music (m);
+
   SCM seq = gh_cdar (accumulator_);
-  seq = gh_cons (gh_cons  (m->self_scm(), gh_bool2scm (here_success)),
+  seq = gh_cons (gh_cons  (m->self_scm(), gh_bool2scm (retval)),
                 seq);
   
   scm_set_cdr_x  (gh_car (accumulator_), seq);
index 18907b15b38f3c998bc140bd2727df55b906ca5a..11619e2b784b4bfa9e401dbc941a3c601b79cb91 100644 (file)
@@ -6,8 +6,10 @@
   (c) 2000--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
+
 #include "engraver.hh"
 #include "translator-group.hh"
+#include "context.hh"
 #include "repeated-music.hh"
 
 
@@ -36,7 +38,7 @@ public:
 void
 Repeat_acknowledge_engraver::initialize ()
 {
-  daddy_trans_->set_property ("repeatCommands", SCM_EOL);
+  daddy_context_->set_property ("repeatCommands", SCM_EOL);
 }
 
 
@@ -47,9 +49,9 @@ Repeat_acknowledge_engraver::Repeat_acknowledge_engraver ()
 void
 Repeat_acknowledge_engraver::start_translation_timestep ()
 {
-  Translator_group * tr = daddy_trans_->where_defined (ly_symbol2scm ("repeatCommands"));
+  Context * tr = daddy_context_->where_defined (ly_symbol2scm ("repeatCommands"));
   if (!tr)
-    tr = daddy_trans_;
+    tr = daddy_context_;
 
   tr->set_property ("repeatCommands", SCM_EOL);
 }
@@ -102,7 +104,7 @@ Repeat_acknowledge_engraver::process_music ()
     {
       if (s != "" || (volta_found && !gh_string_p (wb)))
        {
-         daddy_trans_->set_property ("whichBar", scm_makfrom0str (s.to_str0 ()));
+         daddy_context_->set_property ("whichBar", scm_makfrom0str (s.to_str0 ()));
        }
     }
 }
index ffc32784b59b2034c1b25227c87daed2a3222abe..a349217c2943096ef60cbb58b8c30d5f91d2be38 100644 (file)
@@ -173,6 +173,6 @@ Rest::polyphonic_offset_callback (SCM smob, SCM)
 }
 
 ADD_INTERFACE (Rest,"rest-interface",
-  "a rest",
+  "A rest symbol.",
   "style minimum-distance");
 
diff --git a/lily/score-context.cc b/lily/score-context.cc
new file mode 100644 (file)
index 0000000..fe78acd
--- /dev/null
@@ -0,0 +1,49 @@
+/*   
+score-context.cc -- implement
+
+source file of the GNU LilyPond music typesetter
+
+(c) 2004 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+ */
+
+
+#include "score-context.hh"
+#include "score-translator.hh"
+
+
+void
+Score_context::prepare (Moment w)
+{
+  Translator*  t = unsmob_translator (implementation_);
+  Score_translator * s = dynamic_cast<Score_translator *> (t);
+
+  s->prepare (w);
+}
+
+void
+Score_context::finish ()
+{
+  Translator*  t = unsmob_translator (implementation_);
+  Score_translator * s = dynamic_cast<Score_translator *> (t);
+
+  s->finish ();
+}
+
+void
+Score_context::one_time_step ()
+{
+  Translator*  t = unsmob_translator (implementation_);
+  Score_translator * s = dynamic_cast<Score_translator *> (t);
+  s->one_time_step();
+}
+
+
+Music_output*
+Score_context::get_output ()
+{
+  Translator*  t = unsmob_translator (implementation_);
+  Score_translator * s = dynamic_cast<Score_translator *> (t);
+  return s->get_output ();
+}
+
index a100c17d0412f7aa9eed18c94262628a2fdea3b0..c6748a34528651bed3623863e7cadd690d955265 100644 (file)
 #include "score-engraver.hh"
 #include "paper-score.hh"
 #include "paper-column.hh"
-
 #include "paper-def.hh"
 #include "axis-group-interface.hh"
 #include "context-def.hh"
-
 #include "staff-spacing.hh"
 #include "note-spacing.hh"
+#include "context.hh"
+#include "global-context.hh"
+
+
+
 
 /*
   TODO: the column creation logic is rather hairy. Revise it.
@@ -44,15 +47,12 @@ Score_engraver::make_columns ()
   if (!command_column_)
     {
       SCM nmp
-       = updated_grob_properties (this,
+       = updated_grob_properties (daddy_context_,
                                   ly_symbol2scm ("NonMusicalPaperColumn"));
-      SCM pc = updated_grob_properties (this,
+      SCM pc = updated_grob_properties (daddy_context_,
                                        ly_symbol2scm ("PaperColumn"));
       
       set_columns (new Paper_column (nmp), new Paper_column (pc));
-  
-      command_column_->set_grob_property ("breakable", SCM_BOOL_T);
-
 
       Grob_info i1;
       i1.grob_ = command_column_;
@@ -69,20 +69,18 @@ Score_engraver::make_columns ()
 }
 
 void
-Score_engraver::prepare (Moment w)
+Score_engraver::prepare (Moment m)
 {
-  Global_translator::prepare (w);
-
   /*
     TODO: don't make columns when skipTypesetting is true.
    */
   make_columns ();
-  
-  command_column_->set_grob_property ("when", now_mom_.smobbed_copy ());
-  musical_column_->set_grob_property ("when", now_mom_.smobbed_copy ());
 
+  SCM w = m.smobbed_copy ();
+  command_column_->set_grob_property ("when", w);
+  musical_column_->set_grob_property ("when", w);
   
-  Translator_group::start_translation_timestep();
+  recurse_down_translators (daddy_context_, &Translator::start_translation_timestep, false);
 }
 
 void
@@ -90,9 +88,8 @@ Score_engraver::finish ()
 {
   if ((breaks_%8))
     progress_indication ("[" + to_string (breaks_) + "]");
-   
-  check_removal ();
-  finalize ();
+
+  recurse_down_translators (daddy_context_, &Translator::finalize, true);
 }
 
 /*
@@ -106,13 +103,11 @@ Score_engraver::initialize ()
     error (_f ("can't find `%s'", "feta20.afm")
           + "\n" +_ ("Fonts have not been installed properly.  Aborting"));
    
-  unsmob_context_def (definition_)->apply_default_property_operations (this);
 
-  assert (!daddy_trans_);
   pscore_ = new Paper_score;
   pscore_->paper_ = dynamic_cast<Paper_def*> (get_output_def ());
 
-  SCM props = updated_grob_properties (this, ly_symbol2scm ("System"));
+  SCM props = updated_grob_properties (daddy_context_, ly_symbol2scm ("System"));
 
   pscore_->typeset_line (new System (props));
   
@@ -128,7 +123,7 @@ Score_engraver::initialize ()
 void
 Score_engraver::finalize ()
 {
-  Engraver_group_engraver::finalize ();
+  Score_translator::finalize ();
 
   Grob * cc
     = unsmob_grob (get_property ("currentCommandColumn"));
@@ -138,33 +133,17 @@ Score_engraver::finalize ()
   typeset_all ();
 }
 
+
 void
 Score_engraver::one_time_step ()
 {
   if (!to_boolean (get_property ("skipTypesetting")))
     {
-      process_music ();
-      do_announces ();
+      recurse_down_engravers (daddy_context_, &Engraver::process_music, false);
+      recurse_down_engravers (daddy_context_, &Engraver::do_announces, true);
     }
   
-  stop_translation_timestep ();
-  
-  apply_finalizations ();
-  check_removal ();
-
-
-  for (int i = announce_infos_.size(); i--;)
-    {
-      Grob *g = announce_infos_[i].grob_;
-      if (!dynamic_cast<Paper_column*> (g)) // ugh.
-       {
-         String msg= "Grob "
-           + g->name()
-           + " was created too late!";
-         g->programming_error (msg);
-       }
-    }
-  announce_infos_.clear ();
+  recurse_down_translators (daddy_context_, &Translator::stop_translation_timestep, true);
 }
 
 void
@@ -262,12 +241,12 @@ Score_engraver::set_columns (Paper_column *new_command,
   musical_column_ = new_musical;
   if (new_command)
     {
-      set_property ("currentCommandColumn", new_command->self_scm ());  
+      daddy_context_->set_property ("currentCommandColumn", new_command->self_scm ());  
     }
   
   if (new_musical)
     {
-      set_property ("currentMusicalColumn", new_musical->self_scm ());
+      daddy_context_->set_property ("currentMusicalColumn", new_musical->self_scm ());
     }
 }
 
@@ -307,15 +286,9 @@ Score_engraver::try_music (Music*r)
   return gotcha;
 }
 
-/*
-  TODO:  use property Score.breakForbidden = #t
- */
 void
 Score_engraver::forbid_breaks ()
 {
-  /*
-    result is junked.
-   */
   if (command_column_)
     command_column_->set_grob_property ("breakable", SCM_EOL);
 }
index 9c1e55f3c23365a6fecfd2af8a5f586a60f66cc6..d44a836e35a26cf9a699d2e0a9e1d3973c9ee9f7 100644 (file)
@@ -51,54 +51,31 @@ void
 Score_performer::announce_element (Audio_element_info info)
 {
   announce_infos_.push (info);
-
-
-  /*
-    huh?
-    copied from score-engraver, but
-    this way staff gets in list twice
-  if (Audio_item* i = dynamic_cast<Audio_item*> (info.elem_))
-    performance_->add_element (i);
-  */
 }
 
 void 
 Score_performer::prepare (Moment m)
 {
-  Global_translator::prepare (m);
   audio_column_ = new Audio_column (m);
   play_element (audio_column_);
-  start_translation_timestep ();
+  recurse_down_translators (daddy_context_, &Translator::start_translation_timestep, true);
 }
 
 
 void 
 Score_performer::one_time_step ()
 {
-  process_music ();
-  do_announces ();
-  stop_translation_timestep ();
-  check_removal ();
-}
-
-void
-Score_performer::start ()
-{
+  recurse_down_performers (daddy_context_, &Performer::process_music, false);
+  recurse_down_performers (daddy_context_, &Performer::do_announces, true);
+  recurse_down_translators (daddy_context_, &Translator::stop_translation_timestep, false);
 }
 
-
 int
 Score_performer::get_tempo () const
 {
   return performance_->midi_->get_tempo (Moment (Rational (1, 4)));
 }
 
-void
-Score_performer::finish ()
-{
-  check_removal ();
-  finalize ();
-}
 
 Music_output *
 Score_performer::get_output ()
@@ -111,7 +88,6 @@ Score_performer::get_output ()
 void
 Score_performer::initialize ()
 {
-  unsmob_context_def (definition_)->apply_default_property_operations (this);
   performance_ = new Performance;
   performance_->midi_ = dynamic_cast<Midi_def*> (get_output_def ());
 
index eabb2fde9028dbcb24ae513241b0c0eeb07e9e8f..04f0aa013e7acc3701f1dcec4eb7aef2c0f5d161 100644 (file)
@@ -16,7 +16,7 @@
 #include "music-output.hh"
 #include "music-iterator.hh"
 #include "music.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "scm-hash.hh"
 #include "cpu-timer.hh"
 #include "main.hh"
@@ -112,7 +112,9 @@ LY_DEFINE(ly_run_translator, "ly:run-translator",
   SCM_ASSERT_TYPE (odef, output_def, SCM_ARG2, __FUNCTION__, "Output definition");
   
   Cpu_timer timer;
-  Global_translator * trans = odef->get_global_translator ();
+  
+  Global_context * trans = new Global_context (odef);
+  
   if (!trans)
     {
       programming_error ("no toplevel translator");
@@ -133,7 +135,6 @@ LY_DEFINE(ly_run_translator, "ly:run-translator",
       return SCM_BOOL_F;       // todo: shoudl throw exception.
     }
 
-  trans->start ();
   trans->run_iterator_on_me (iter);
   iter->quit();
   scm_remember_upto_here_1 (protected_iter);
@@ -154,11 +155,10 @@ LY_DEFINE(ly_render_output, "ly:render-output",
          "and  dump the result to @var{out-filename}, using "
          "@var{header} for the bibliographic information.")
 {
-  Translator *tr = unsmob_translator (context);
-  Global_translator * gt = dynamic_cast<Global_translator*> (tr);
+  Global_context * gt = dynamic_cast<Global_context *> (unsmob_context (context));
   
   SCM_ASSERT_TYPE(gt, context, SCM_ARG1, __FUNCTION__,
-                 "Score context");
+                 "Global context");
   SCM_ASSERT_TYPE(ly_module_p(header), header, SCM_ARG2, __FUNCTION__,
                  "module");
   SCM_ASSERT_TYPE(gh_string_p (out_filename), out_filename, SCM_ARG3, __FUNCTION__,
@@ -181,6 +181,7 @@ default_rendering (SCM mus, SCM outdef, SCM head, SCM outname)
 {
   SCM context = ly_run_translator (mus, outdef);
   
-  if (unsmob_translator (context))
+  if (unsmob_context (context))
     ly_render_output (context,  head, outname);
 }
+
index 7d8ca6fcfe18534ee01eaf46f82495ec2051345b..56248d3b2b01032492cb34176aae22ebf5c880d8 100644 (file)
@@ -51,7 +51,7 @@ Script_column::before_line_breaking (SCM smob)
     {
       Grob *sc = unsmob_grob (gh_car (s));
 
-      if (!sc->has_offset_callback_b (Side_position_interface::aligned_side_proc, X_AXIS))
+      if (!sc->has_offset_callback (Side_position_interface::aligned_side_proc, X_AXIS))
        staff_sided.push (sc);
     }
   
index e313e0a0e02e901b7bca1b499f831217ee75bd41..ac3c720d1dc782d63d3c1a0955da90594de12038 100644 (file)
@@ -11,7 +11,8 @@
 #include "rhythmic-head.hh"
 #include "engraver.hh"
 #include "note-column.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "warn.hh"
 
 struct Script_tuple
@@ -83,7 +84,7 @@ copy_property (Grob * g , SCM sym, SCM alist)
   ScriptStaccato , ScriptMarcato, etc. )
  */
 void make_script_from_event (Grob *p,
-                            SCM * descr, Translator_group*tg,
+                            SCM * descr, Context *tg,
                             SCM art_type, 
                             int index)
 {
@@ -133,7 +134,7 @@ Script_engraver::process_music ()
 
       Grob * p = make_item ("Script");
 
-      make_script_from_event (p, &scripts_[i].description_, daddy_trans_,
+      make_script_from_event (p, &scripts_[i].description_, daddy_context_,
                              l->get_mus_property ("articulation-type"),
                              i);
 
index 010b48bf2a49172a89069dfc9fcc5ffcf15f1218..917dfabc79a53127c9dcde68414b7c74e677f7a7 100644 (file)
@@ -105,6 +105,19 @@ Self_alignment_interface::aligned_on_self (SCM element_smob, SCM axis)
 
 
 ADD_INTERFACE (Self_alignment_interface, "self-alignment-interface",
-  "Position self using some alignment",
-  "self-alignment-X self-alignment-Y");
+              "Position this object on itself and/or on its parent. To this end, the following functions "
+              " are provided: \n"
+              "@table @code \n"
+              "@item Self_alignment_interface::aligned_on_self\n"
+              "  Align self on reference point, using @code{self-alignment-X} and "
+              "@code{self-alignment-Y}."
+              "@item Self_alignment_interface::aligned_on_parent\n"
+              "@item Self_alignment_interface::centered_on_parent\n"
+              "  Shift the object so its own reference point is centered on the  "
+              " extent of the parent \n"
+              "@item Self_alignment_interface::centered_on_other_axis_parent\n"
+              " For X-axis, center on the Y-parent, and vice versa.\n "
+              "@end table\n"
+              ,
+              "self-alignment-X self-alignment-Y");
 
index aef4a23a66112f3c7a9a401a15e5ad891fea4280..5f9722190030800f685774d77148b455a4f95961 100644 (file)
@@ -16,7 +16,8 @@
 #include "note-spacing.hh"
 #include "group-interface.hh"
 #include "accidental-placement.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 
 struct Spacings
@@ -115,7 +116,7 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i)
     return;
   if (it->get_parent (X_AXIS)
       && it->get_parent (X_AXIS)
-      ->has_extent_callback_b(Axis_group_interface::group_extent_callback_proc, X_AXIS))
+      ->has_extent_callback(Axis_group_interface::group_extent_callback_proc, X_AXIS))
     return;
 
   
@@ -139,7 +140,7 @@ Separating_line_group_engraver::acknowledge_grob (Grob_info i)
       if (ib)
        {
          p_ref_->set_grob_property ("breakable", SCM_BOOL_T);
-         daddy_trans_->set_property ("breakableSeparationItem", p_ref_->self_scm ());
+         daddy_context_->set_property ("breakableSeparationItem", p_ref_->self_scm ());
        }
       announce_grob(p_ref_, SCM_EOL);
 
@@ -178,7 +179,7 @@ void
 Separating_line_group_engraver::start_translation_timestep ()
 {
   if (break_item_)
-    daddy_trans_->unset_property (ly_symbol2scm ("breakableSeparationItem"));
+    daddy_context_->unset_property (ly_symbol2scm ("breakableSeparationItem"));
   break_item_ =0;
 }
 
index e0fef5778b2776a6ac882a43d0e19b71229f733c..c63d812ccb95b790fd7a7f54c7363555dac51997 100644 (file)
@@ -7,7 +7,7 @@
 */
 
 #include "translator-group.hh"
-
+#include "context.hh"
 #include "sequential-iterator.hh"
 #include "music-list.hh"
 
@@ -72,7 +72,7 @@ Sequential_iterator::derived_mark ()const
 
 
 void
-Sequential_iterator::derived_substitute (Translator_group*f,Translator_group*t)
+Sequential_iterator::derived_substitute (Context *f,Context *t)
 {
   if (iter_)
     iter_->substitute_outlet (f,t);
@@ -215,13 +215,13 @@ Sequential_iterator::next_element (bool)
 void
 Sequential_iterator::descend_to_child ()
 {
-  Translator_group  * child_report = child_report = iter_->get_outlet ();
-  Translator_group * me_report = get_outlet ();
+  Context * child_report = child_report = iter_->get_outlet ();
+  Context * me_report = get_outlet ();
 
-  Translator_group * c = child_report;
+  Context * c = child_report;
   while (c && c != me_report)
     {
-      c= c->daddy_trans_;
+      c= c->daddy_context_;
     }
   
   if (c == me_report)
index c3092876992e2e3b26df8b3b25473df99211504e..775318febea31e5216220cd473f5756fc5973326 100644 (file)
@@ -6,7 +6,9 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "translator-group.hh"
+#include "context.hh"
+
+
 #include "warn.hh"
 #include "sequential-music-iterator.hh"
 #include "music-list.hh"
index a974a4495844c270bd6a41c0437ff1216ff1f781..9efea370b38fb8dddb60e99e4a33cb991786f901 100644 (file)
@@ -244,8 +244,8 @@ Side_position_interface::set_axis (Grob*me, Axis a)
 Axis
 Side_position_interface::get_axis (Grob*me)
 {
-  if (me->has_offset_callback_b (Side_position_interface::aligned_side_proc, X_AXIS)
-      || me->has_offset_callback_b (Side_position_interface::aligned_side_proc , X_AXIS))
+  if (me->has_offset_callback (Side_position_interface::aligned_side_proc, X_AXIS)
+      || me->has_offset_callback (Side_position_interface::aligned_side_proc , X_AXIS))
     return X_AXIS;
 
   
index df3c947ba681f8352f6e6bb6de52711dfcd40a42..a60735b306967810cb7b6ba96f1b3129624f6334 100644 (file)
@@ -6,7 +6,7 @@
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "warn.hh"
 #include "simultaneous-music-iterator.hh"
 #include "music-list.hh"
@@ -27,7 +27,7 @@ Simultaneous_music_iterator::derived_mark()const
 }
 
 void
-Simultaneous_music_iterator::derived_substitute(Translator_group*f,Translator_group*t)
+Simultaneous_music_iterator::derived_substitute(Context *f,Context *t)
 {
   for (SCM s = children_list_; gh_pair_p (s); s = gh_cdr(s))
     unsmob_iterator (gh_car (s))-> substitute_outlet (f,t);
@@ -53,8 +53,8 @@ Simultaneous_music_iterator::construct_children ()
         number number as name */
 
       SCM name = unsmob_context_def (get_outlet ()->definition_)->get_context_name ();
-      Translator_group * t = (j && separate_contexts_b_)
-       ? get_outlet ()->find_create_translator (name, to_string (j), SCM_EOL)
+      Context * t = (j && separate_contexts_b_)
+       ? get_outlet ()->find_create_context (name, to_string (j), SCM_EOL)
        : get_outlet ();
 
       if (!t)
index 3ca67f6e72a277e0fc815b8431606a6624da9817..3fabaad0ce75d13f5d341c54ab1cd1abb1642c02 100644 (file)
@@ -10,7 +10,7 @@
 #include "engraver.hh"
 #include "repeated-music.hh"
 #include "engraver-group-engraver.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 #include "misc.hh"
 #include "spanner.hh"
@@ -19,7 +19,8 @@
 #include "bar-line.hh"
 
 #include "score-engraver.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 /**
   This acknowledges repeated music with "percent" style.  It typesets
@@ -94,7 +95,7 @@ Slash_repeat_engraver::try_music (Music * m)
       else
        return false;
       
-      Global_translator *global =top_engraver();
+      Global_context *global =get_global_context ();
       for (int i = 0; i < count; i++)  
        global->add_moment_to_process (next_moment_ + Moment (i) * body_length_);
   
@@ -113,7 +114,7 @@ Slash_repeat_engraver::process_music ()
       announce_grob(beat_slash_, repeat_->self_scm());
       next_moment_ = next_moment_ + body_length_;
 
-      top_engraver()->add_moment_to_process (next_moment_);
+      get_global_context ()->add_moment_to_process (next_moment_);
     }
 }
 
index 172a9ff42e75c01dd659575b67effec00446a524..3daf274d6b8144e08cea3e7c7db757f1cdb9d54b 100644 (file)
@@ -8,7 +8,8 @@
 #include "slur.hh"
 #include "warn.hh"
 #include "note-column.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "engraver.hh"
 #include "spanner.hh"
 
@@ -87,7 +88,7 @@ Slur_engraver::try_music (Music *ev)
 void
 Slur_engraver::set_melisma (bool m)
 {
-  daddy_trans_->set_property ("slurMelismaBusy", m ? SCM_BOOL_T :SCM_BOOL_F);
+  daddy_context_->set_property ("slurMelismaBusy", m ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
 void
index ac086bee8844e76a943087d78e27b795331ebd9d..43d538b4ced1cf12ed102b2d5c01eae3fffa2d0d 100644 (file)
@@ -10,7 +10,7 @@
 #include "event.hh"
 #include "audio-item.hh"
 #include "audio-column.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "warn.hh"
 
 /*
@@ -51,7 +51,7 @@ Slur_performer::process_music ()
 void
 Slur_performer::set_melisma (bool ml)
 {
-  daddy_trans_->set_property ("slurMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
+  daddy_context_->set_property ("slurMelismaBusy", ml ? SCM_BOOL_T :SCM_BOOL_F);
 }
 
 void
index 87df4b71543206ebdd07419e81fab2d7a0dca97e..2c40260f23124d78a56134ba2489ff9688d27bcd 100644 (file)
@@ -102,8 +102,8 @@ Spaceable_grob::remove_interface (Grob*me)
 
 
 ADD_INTERFACE (Spaceable_grob,"spaceable-grob-interface",
-              "A grob (a Paper_column) that takes part in the \n"
-              "spacing problem. ",
-  "measure-length spacing-wishes penalty minimum-distances ideal-distances "
-"left-neighbors right-neighbors");
+              "A layout object that takes part in the spacing problem. "
+              ,
+              "measure-length spacing-wishes penalty minimum-distances ideal-distances "
+              "left-neighbors right-neighbors");
 
index 9b33ae95f3f997829f9a99f1b27ebd392b3a7559..763f7c5c1a545a4099b5e8e6e8841e849f283b69 100644 (file)
@@ -45,8 +45,8 @@ Span_arpeggio_engraver::Span_arpeggio_engraver ()
 void
 Span_arpeggio_engraver::acknowledge_grob (Grob_info info)
 {
-    if (info.origin_transes (this).size ()
-        && Arpeggio::has_interface (info.grob_))
+  if (Arpeggio::has_interface (info.grob_)
+      && info.origin_contexts (this).size ()) // huh? what's this test for? 
     {
       arpeggios_.push (info.grob_);
     }
index 0738451478e05603963c73c4513fc3c49bc716b1..f8e7b445b1deec9074ce73f218d921f693488cd6 100644 (file)
@@ -47,9 +47,8 @@ Span_bar_engraver::Span_bar_engraver ()
 void
 Span_bar_engraver::acknowledge_grob (Grob_info i)
 {
-  int depth = i.origin_transes (this).size ();
-  if (depth > 1
-      && Bar_line::has_interface (i.grob_))
+  int depth = i.origin_contexts (this).size ();
+  if (depth && Bar_line::has_interface (i.grob_))
     {
       Item * it = dynamic_cast<Item*> (i.grob_);
       bars_.push (it);
index be285af113b5994bec4c987e044f4f4bc3df53e9..553e0a2d7556902299c941c7288a7a440be1d879 100644 (file)
@@ -9,7 +9,8 @@ source file of the GNU LilyPond music typesetter
 #include "staff-symbol.hh"
 #include "engraver.hh"
 #include "grob.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 
 class Staff_collecting_engraver : public Engraver
 {
@@ -31,7 +32,7 @@ Staff_collecting_engraver::acknowledge_grob (Grob_info gi)
       SCM staffs = get_property ("stavesFound");
       staffs = gh_cons (gi.grob_->self_scm (), staffs);
 
-      daddy_trans_->set_property ("stavesFound", staffs);
+      daddy_context_->set_property ("stavesFound", staffs);
     }
 }
 
index 1c5e99f0665b887646b21b7b87c52d67d7de1731..f7ff09da207ca65914ae71699059e7358e4f7321 100644 (file)
@@ -12,6 +12,7 @@
 #include "audio-item.hh"
 #include "audio-staff.hh"
 #include "performer-group-performer.hh"
+#include "context.hh"
 
 /** Perform a staff. Individual notes should have their instrument
  (staff-wide) set, so we override play_element ()
@@ -64,7 +65,7 @@ Staff_performer::initialize ()
   audio_staff_ = new Audio_staff;
   announce_element (Audio_element_info (audio_staff_, 0));
 
-  name_ = new Audio_text (Audio_text::TRACK_NAME, id_string_);
+  name_ = new Audio_text (Audio_text::TRACK_NAME, daddy_context_->id_string_);
   announce_element (Audio_element_info (name_, 0));
 
   tempo_ = new Audio_tempo (get_tempo ());
index cd4295e9af2929fbaeaccaa6aa39e7283c684190..78fc02ad2a633765fe5dc72469cdd5a7ae458eaa 100644 (file)
@@ -149,7 +149,7 @@ Staff_symbol_referencer::set_position (Grob*me,Real p)
 
     }
 
-  if (me->has_offset_callback_b (Staff_symbol_referencer::callback_proc, Y_AXIS))
+  if (me->has_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS))
     return ; 
 
   me->add_offset_callback (Staff_symbol_referencer::callback_proc, Y_AXIS);
@@ -173,8 +173,8 @@ compare_position (Grob *const  &a, Grob * const &b)
 }
 
 ADD_INTERFACE (Staff_symbol_referencer,"staff-symbol-referencer-interface",
-              "Object whose Y position is meant relative to a staff "
-              "symbol. These objects usually have "
-              "Staff_symbol_referencer::callback in their Y-offset-callback. "
+              "An object whose Y position is meant relative to a staff "
+              "symbol. These usually have "
+              "@code{Staff_symbol_referencer::callback} in their @code{Y-offset-callbacks}. "
               ,
               "staff-position");
index bb0a9674c05b4bb6e2e1fa93c0144868be28295a..f6e8d6890f4154efdcaaa9f31de40ee372d0cf8d 100644 (file)
@@ -123,7 +123,7 @@ Staff_symbol::get_ledger_line_thickness (Grob * me)
 
 ADD_INTERFACE (Staff_symbol,"staff-symbol-interface",
               "This spanner draws the lines of a staff. "
-              "A staff symbol definines a vertical unit, the staff space "
+              "A staff symbol definines a vertical unit, the staff space. "
               "Quantities that go by a half staff space are called positions "
               "The center (i.e. middle line "
               "or space) is position 0. The length of the symbol may be set by hand "
index f8d19adcbe7a17e00de6223c90dbef15cb94c383..ddd5c55154cda616d6039fe4f5ad87531ea2d222 100644 (file)
@@ -13,7 +13,8 @@
 #include "misc.hh"
 #include "stem-tremolo.hh"
 #include "item.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "engraver.hh"
 
 
@@ -87,7 +88,7 @@ Stem_engraver::acknowledge_grob (Grob_info i)
                else
                  requested_type = 8; 
              else
-               daddy_trans_->set_property ("tremoloFlags", gh_int2scm (requested_type));
+               daddy_context_->set_property ("tremoloFlags", gh_int2scm (requested_type));
 
              int tremolo_flags = intlog2 (requested_type) - 2
                - (duration_log > 2 ? duration_log - 2 : 0);
@@ -147,13 +148,13 @@ Stem_engraver::stop_translation_timestep ()
       if (gh_number_p (prop))
        {
          Stem::set_beaming (stem_,gh_scm2int (prop),LEFT);
-         daddy_trans_->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
+         daddy_context_->unset_property (ly_symbol2scm ("stemLeftBeamCount"));
        }
       prop = get_property ("stemRightBeamCount");
       if (gh_number_p (prop))
        {
          Stem::set_beaming (stem_,gh_scm2int (prop), RIGHT);
-         daddy_trans_->unset_property (ly_symbol2scm ("stemRightBeamCount"));
+         daddy_context_->unset_property (ly_symbol2scm ("stemRightBeamCount"));
        }
 
       typeset_grob (stem_);
index 327433bbdbe1cb0f2e9a6eb610833569ce436a7f..2445018e082daf1dc26db913a40751f6b3e020cc 100644 (file)
@@ -199,5 +199,5 @@ Stem_tremolo::set_stem (Grob*me,Grob *s)
 
 
 ADD_INTERFACE (Stem_tremolo,"stem-tremolo-interface",
-  "",
+  "A beam slashing a stem to indicate a tremolo.",
   "stem beam-width beam-thickness flag-count");
index 50c3b49fa02772dd9a69bf674e5027b2cc79d8f5..993e6253f69f00bf05c846cccb3a79f261879320 100644 (file)
@@ -851,6 +851,13 @@ void
 Stem::calc_stem_info (Grob *me)
 {
   Direction my_dir = get_grob_direction (me);
+
+  if (!my_dir)
+    {
+      programming_error ("No stem dir set?");
+      my_dir  = UP;
+    }
+  
   Real staff_space = Staff_symbol_referencer::staff_space (me);
   Grob *beam = get_beam (me);
   Real beam_translation = Beam::get_beam_translation (beam);
index 9f2f06567ce362610a57d94861da8efb8165400c..40905bfdeb2390a481c28f5485ad13f3f79f9527 100644 (file)
 LY_DEFINE(ly_stencil_set_extent_x,"ly:stencil-set-extent!", 3 , 0, 0, 
          (SCM mol, SCM axis, SCM np),
          "Set the extent (@var{extent} must be a pair of numbers) of @var{mol} in \n"
-"@var{axis} direction (0 or 1 for x- and y-axis respectively).\n"
-"\n"
-"Note that an extent @code{(A . B)} is an interval and hence @code{A} is\n"
-"smaller than @code{B}, and is often negative.\n"
-)
+         "@var{axis} direction (0 or 1 for x- and y-axis respectively).\n"
+         )
 {
   Stencil* m = unsmob_stencil (mol);
   SCM_ASSERT_TYPE (m, mol, SCM_ARG1, __FUNCTION__, "stencil");
@@ -151,37 +148,14 @@ LY_DEFINE(ly_stencil_add ,
 LY_DEFINE(ly_make_stencil,
          "ly:make-stencil", 3, 0, 0,  (SCM expr, SCM xext, SCM yext),
          " \n"
-"The objective of any typesetting system is to put ink on paper in the \n"
-"right places. For LilyPond, this final stage is left to the @TeX{} and \n"
-"the printer subsystem. For lily, the last stage in processing a score is \n"
-"outputting a description of what to put where.  This description roughly \n"
-"looks like \n"
-"@example \n"
-"        PUT glyph AT (x,y) \n"
-"        PUT glyph AT (x,y) \n"
-"        PUT glyph AT (x,y)  \n"
-"@end example \n"
-"you merely have to look at the tex output of lily to see this. \n"
-"Internally these instructions are encoded in Stencils.@footnote{At some \n"
-"point LilyPond also contained Atom-objects, but they have been replaced \n"
-"by Scheme expressions, making the name outdated.}  A stencil is \n"
-"what-to-print-where information that also contains dimension information \n"
-"(how large is this glyph?). \n"
-" \n"
-"Conceptually, Stencils can be constructed from Scheme code, by \n"
-"translating a Stencil and by combining two stencils. In BNF \n"
-"notation: \n"
-" \n"
-"@example \n"
-"Stencil  :: COMBINE Stencil Stencil \n"
-"           | TRANSLATE Offset Stencil \n"
-"           | GLYPH-DESCRIPTION \n"
-"           ; \n"
-"@end example \n"
-" \n"
-"If you are interested in seeing how this information is stored, you \n"
-"can run with the @code{-f scm} option. The scheme expressions are then \n"
-"dumped in the output file.")
+         "Stencils are a device independent output expressions."
+         "They carry two pieces of information: \n\n"
+         "1: a specification of how to print this object. "
+         "This specification is processed by the output backends, for example "
+         "@file{scm/output-tex.scm}.\n\n"
+         "2: the vertical and horizontal extents of the object.\n\n"
+         
+         )
 {
   SCM_ASSERT_TYPE (is_number_pair (xext), xext, SCM_ARG2, __FUNCTION__, "number pair");
   SCM_ASSERT_TYPE (is_number_pair (yext), yext, SCM_ARG3, __FUNCTION__, "number pair");  
index 967fc24d5f749a18e57d638b6cb5e2a4d67e3769..3dc7288556bba046239b3bce18e53058f10cc544 100644 (file)
@@ -73,7 +73,7 @@ System_start_delimiter_engraver::process_music ()
   if (!delim_)
     {
       SCM delim_name =get_property ("systemStartDelimiter");
-      delim_ = make_spanner_from_properties (daddy_trans_, delim_name);
+      delim_ = make_spanner_from_properties (daddy_context_, delim_name);
 
       delim_->set_bound (LEFT, unsmob_grob (get_property ("currentCommandColumn")));
       announce_grob (delim_, SCM_EOL);
index f01ef8a37a4cb37b9a7156d15796ad30fed47543..baf283a5015e8e124258c6d1cb0f647e766c8767 100644 (file)
@@ -184,7 +184,7 @@ System_start_delimiter::staff_brace (Grob*me, Real y)
 
 ADD_INTERFACE (System_start_delimiter,"system-start-delimiter-interface",
               "The brace, bracket or bar in front of the system. "
-              "It is implemented as a spanner"
+              "It is implemented as a spanner."
               ,
               "collapse-height thickness "
               "arch-height arch-angle arch-thick arch-width bracket-thick glyph");
index 1d0c28ae4c6188cc0ca8170ae7e6c933de072f9c..aaad06c87010a63ef564b166f8f48973e051e4b8 100644 (file)
@@ -466,14 +466,12 @@ System::post_processing (bool last_line)
 
   /*
     generate all stencils  to trigger all font loads.
-
-    (ugh. This is not very memory efficient.)  */
-
+  */
   SCM all = get_grob_property ("all-elements")  ;
   all = uniquify_list (all);
 
   /*
-    triger font loads first.
+    trigger font loads first.
 
     This might seem inefficient, but Stencils are cached per grob
     anyway.
index 3fe2d788f5174433d0a8332a6a6210436d163f31..0b81994daaf4e920c651fc51efd544ecdf5a64d9 100644 (file)
@@ -79,7 +79,7 @@ Text_item::markup_p (SCM x)
 }
 
 ADD_INTERFACE (Text_item,"text-interface",
-  "A scheme markup text, see @usermanref{Text markup}.",
+  "A scheme markup text, see @usermanref{Text-markup}.",
   "text baseline-skip word-space");
 
 
index 7b4232d2ff1ab80e5a10115ba279ec494b066863..78a5e49ec58014485df090fe8a98d9116a9ed954 100644 (file)
@@ -9,7 +9,8 @@
 
 #include "event.hh"
 #include "tie.hh"
-#include "translator-group.hh"
+#include "context.hh"
+
 #include "spanner.hh"
 #include "tie-column.hh"
 #include "engraver.hh"
@@ -83,7 +84,7 @@ void
 Tie_engraver::process_music ()
 {
   if (event_)
-    daddy_trans_->set_property ("tieMelismaBusy", SCM_BOOL_T);
+    daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T);
 }
 
 void
@@ -132,7 +133,7 @@ Tie_engraver::acknowledge_grob (Grob_info i)
 void
 Tie_engraver::start_translation_timestep ()
 {
-  daddy_trans_->set_property ("tieMelismaBusy",
+  daddy_context_->set_property ("tieMelismaBusy",
                              gh_bool2scm (heads_to_tie_.size ()));
       
 }
index 5d16b88b01f070f7c85846b39189bcc139edeba8..40b265f9aeaa8ec878552e19591fa2a5bdf33dab 100644 (file)
@@ -7,7 +7,7 @@
   
  */
 
-#include "translator-group.hh"
+#include "context.hh"
 #include "audio-item.hh"
 #include "event.hh"
 #include "pqueue.hh"
@@ -64,7 +64,7 @@ void
 Tie_performer::process_music ()
 {
   if (event_)
-    daddy_trans_->set_property ("tieMelismaBusy", SCM_BOOL_T);
+    daddy_context_->set_property ("tieMelismaBusy", SCM_BOOL_T);
 }
 
 
index 7bd174bc02f27903ed00bd658558777d6ef494b1..df703cbb33b9cca4fa4254b9069aba2400637e1e 100644 (file)
@@ -10,8 +10,7 @@
 #include "time-scaled-music-iterator.hh"
 #include "time-scaled-music.hh"
 #include "event.hh"
-#include "translator-group.hh"
-
+#include "context.hh"
 
 void
 Time_scaled_music_iterator::process (Moment m)
index c9139b95bb1b56c636e5ed16939d7cdd0e55841e..83ff379f518833f03c0d998cd2b77ab7739b8aca 100644 (file)
@@ -5,8 +5,7 @@
 
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "translator-group.hh"
-
+#include "context.hh"
 #include "grob-info.hh"
 #include "multi-measure-rest.hh"
 #include "timing-translator.hh"
@@ -74,14 +73,14 @@ Timing_engraver::start_translation_timestep ()
        }
     }
 
-  daddy_trans_->set_property ("whichBar", which);
+  daddy_context_->set_property ("whichBar", which);
 }
 
 void
 Timing_engraver::stop_translation_timestep ()
 {
   Timing_translator::stop_translation_timestep ();
-  daddy_trans_->set_property ("whichBar", SCM_EOL);
+  daddy_context_->set_property ("whichBar", SCM_EOL);
   last_moment_ = now_mom ();
 }
 
index 80e71deadfed26d3e5fec9cb8ea795e9f84b74ac..f2ff5c4fea13b1d483494ed733defe729796e571 100644 (file)
 #include "timing-translator.hh"
 
 #include "translator-group.hh"
-#include "global-translator.hh"
+#include "global-context.hh"
 #include "multi-measure-rest.hh"
 
 
 void
 Timing_translator::stop_translation_timestep ()
 {
-  Translator *t = this;
-  Global_translator *global =0;
-  do
-    {
-      t = t->daddy_trans_ ;
-      global = dynamic_cast<Global_translator*> (t);
-    }
-  while (!global);
+  Global_context *global = get_global_context ();
 
   /* allbars == ! skipbars */
   SCM sb = get_property ("skipBars");
@@ -57,14 +50,14 @@ Timing_translator::initialize ()
     move this to engraver-init.ly? 
    */
  
-  daddy_trans_->set_property ("timing" , SCM_BOOL_T);  
-  daddy_trans_->set_property ("currentBarNumber" , gh_int2scm (1));
+  daddy_context_->set_property ("timing" , SCM_BOOL_T);  
+  daddy_context_->set_property ("currentBarNumber" , gh_int2scm (1));
 
-  daddy_trans_->set_property ("timeSignatureFraction",
+  daddy_context_->set_property ("timeSignatureFraction",
                                gh_cons (gh_int2scm (4), gh_int2scm (4)));
-  daddy_trans_->set_property ("measurePosition", Moment (Rational (0)).smobbed_copy ());
-  daddy_trans_->set_property ("measureLength", Moment (Rational (1)).smobbed_copy ());
-  daddy_trans_->set_property ("beatLength", Moment (Rational (1,4)).smobbed_copy ());
+  daddy_context_->set_property ("measurePosition", Moment (Rational (0)).smobbed_copy ());
+  daddy_context_->set_property ("measureLength", Moment (Rational (1)).smobbed_copy ());
+  daddy_context_->set_property ("beatLength", Moment (Rational (1,4)).smobbed_copy ());
 }
 
 Rational
@@ -101,14 +94,7 @@ Timing_translator::measure_position () const
 void
 Timing_translator::start_translation_timestep ()
 {
-  Translator *t = this;
-  Global_translator *global =0;
-  do
-    {
-      t = t->daddy_trans_ ;
-      global = dynamic_cast<Global_translator*> (t);
-    }
-  while (!global);
+  Global_context *global =get_global_context ();
 
   Moment now = global->now_mom_;
   Moment dt = now  - global->prev_mom_;
@@ -136,7 +122,7 @@ Timing_translator::start_translation_timestep ()
   else
     {
       measposp = now;
-      daddy_trans_->set_property ("measurePosition", measposp.smobbed_copy ());
+      daddy_context_->set_property ("measurePosition", measposp.smobbed_copy ());
     }
   
   measposp += dt;
@@ -158,8 +144,8 @@ Timing_translator::start_translation_timestep ()
       b ++;
     }
 
-  daddy_trans_->set_property ("currentBarNumber", gh_int2scm (b));
-  daddy_trans_->set_property ("measurePosition", measposp.smobbed_copy ());
+  daddy_context_->set_property ("currentBarNumber", gh_int2scm (b));
+  daddy_context_->set_property ("measurePosition", measposp.smobbed_copy ());
 }
 
 ENTER_DESCRIPTION(Timing_translator,"","","","","","");
index cc09ca0668a6ccaeca7031a7a4628ffbd620d944..10806b34c0f83afce2c242ab5a22052b689a7d49 100644 (file)
 #include "moment.hh"
 #include "scm-hash.hh"
 #include "context-def.hh"
+#include "context.hh"
 #include "main.hh"
 #include "music.hh"
 
-Translator_group::Translator_group (Translator_group const&s)
-  : Translator (s)
+Translator_group*
+Translator_group::get_daddy_translator () const
 {
-  iterator_count_ =0;
-  
-  Scheme_hash_table * tab =  new Scheme_hash_table (*s.properties_dict ());
-  properties_scm_ = tab->self_scm ();
-  scm_gc_unprotect_object (tab->self_scm ());
-}
-
-Scheme_hash_table*
-Translator_group::properties_dict () const
-{
-  return Scheme_hash_table::unsmob (properties_scm_);
-}
-
-Translator_group::~Translator_group ()
-{
-  
-  //assert (is_removable ());
-}
-
-
-Translator_group::Translator_group ()
-{
-  iterator_count_  = 0;
-  Scheme_hash_table *tab = new Scheme_hash_table ;
-  properties_scm_ = tab->self_scm ();
-
-  scm_gc_unprotect_object (tab->self_scm ());
-}
-
-void
-Translator_group::check_removal ()
-{
-  SCM next = SCM_EOL; 
-  for (SCM p = trans_group_list_; gh_pair_p (p); p = next)
-    {
-      next = ly_cdr (p);
-
-      Translator_group *trg =  dynamic_cast<Translator_group*> (unsmob_translator (ly_car (p)));
-
-      trg->check_removal ();
-      if (trg->is_removable ())
-       terminate_translator (trg);
-    }
-}
-
-SCM
-Translator_group::add_translator (SCM list, Translator *t)
-{
-  /*
-    Must append, since list ordering must be preserved.
-   */
-  list = gh_append2 (list, gh_cons (t->self_scm (), SCM_EOL));
-  t->daddy_trans_ = this;
-  t->output_def_ = output_def_;
-
-  return list;
-}
-
-
-void
-Translator_group::add_used_group_translator (Translator *t)
-{
-  trans_group_list_ = add_translator (trans_group_list_,t);
+  Translator *t
+    = unsmob_translator (daddy_context_->daddy_context_->implementation_);
+  return dynamic_cast<Translator_group*> (t);
 }
 
 
 void
-Translator_group::add_fresh_group_translator (Translator*t)
-{
-  Translator_group*tg = dynamic_cast<Translator_group*> (t);
-  trans_group_list_ = add_translator (trans_group_list_,t);
-  scm_gc_unprotect_object (t->self_scm ());
-
-  Context_def * td = unsmob_context_def (tg->definition_);
-
-  /*
-    this can not move before add_translator(), because \override
-    operations require that we are in the hierarchy.
-   */
-  td->apply_default_property_operations (tg);
-
-  t->initialize ();
-}
-
-bool
-Translator_group::try_music (Music* m)
-{
-  bool hebbes_b = try_music_on_nongroup_children (m);
-  
-  if (!hebbes_b && daddy_trans_)
-    hebbes_b = daddy_trans_->try_music (m);
-  
-  return hebbes_b ;
-}
-
-void
-Translator_group::terminate_translator (Translator*r)
-{
-  r->finalize ();
-  /*
-    Return value ignored. GC does the rest.
-   */
-  remove_translator (r);
-}
-
-
-/**
-   Remove a translator from the hierarchy.
- */
-Translator *
-Translator_group::remove_translator (Translator*trans)
-{
-  assert (trans);
-
-  trans_group_list_ = scm_delq_x (trans->self_scm (), trans_group_list_);
-  trans->daddy_trans_ = 0;
-  return trans;
-}
-
-
-static void
-static_each (SCM list, Method_pointer method)
+translator_each (SCM list, Translator_method method)
 {
   for (SCM p = list; gh_pair_p (p); p = ly_cdr (p))
     (unsmob_translator (ly_car (p))->*method) ();
-  
-}
-
-void
-Translator_group::each (Method_pointer method) 
-{
-  static_each (get_simple_trans_list (), method);
-  static_each (trans_group_list_, method);
 }
 
 
-
-
-/*
-  STUBS
-*/
-void
-Translator_group::stop_translation_timestep ()
-{
-  each (&Translator::stop_translation_timestep);
-}
-
-void
-Translator_group::start_translation_timestep ()
-{
-  each (&Translator::start_translation_timestep);
-}
-
-void
-Translator_group::do_announces ()
-{
-  each (&Translator::do_announces);
-}
-
 void
 Translator_group::initialize ()
 {
   SCM tab = scm_make_vector (gh_int2scm (19), SCM_BOOL_F);
-  set_property ("acceptHashTable", tab);
-  each (&Translator::initialize);
+  daddy_context_->set_property ("acceptHashTable", tab);
 }
 
-void
-Translator_group::finalize ()
-{
-  each (&Translator::finalize);
-}
 
 bool
 translator_accepts_any_of (Translator*tr, SCM ifaces)
@@ -220,7 +70,7 @@ find_accept_translators (SCM gravlist, SCM ifaces)
 }
 
 bool
-Translator_group::try_music_on_nongroup_children (Music *m )
+Translator_group::try_music (Music* m)
 {
   SCM tab = get_property ("acceptHashTable");
   SCM name = scm_sloppy_assq (ly_symbol2scm ("name"),
@@ -248,22 +98,7 @@ Translator_group::try_music_on_nongroup_children (Music *m )
 }
 
 SCM
-Translator_group::properties_as_alist () const
-{
-  return properties_dict()->to_alist();
-}
-
-String
-Translator_group::context_name () const
-{
-  Context_def * td = unsmob_context_def (definition_ );
-  return ly_symbol2string (td->get_context_name ());
-}
-
-
-
-SCM
-names_to_translators (SCM namelist, Translator_group*tg)
+names_to_translators (SCM namelist, Context*tg)
 {
   SCM l = SCM_EOL;
   for (SCM s = namelist; gh_pair_p (s) ; s = ly_cdr (s))
@@ -277,9 +112,7 @@ names_to_translators (SCM namelist, Translator_group*tg)
          SCM str = tr->self_scm ();
          l = gh_cons (str, l);
 
-         tr->daddy_trans_ = tg;
-         tr->output_def_  = tg->output_def_;
-
+         tr->daddy_context_ = tg;
          scm_gc_unprotect_object (str);
        }
     }
@@ -293,3 +126,33 @@ Translator_group::get_simple_trans_list ()
   return simple_trans_list_;
 }
 
+
+void
+recurse_down_translators (Context * c, Translator_method ptr, bool context_first)
+{
+  Translator_group * tg
+    = dynamic_cast<Translator_group*> (unsmob_translator (c->implementation_));
+
+
+  if (!context_first)
+    {
+      translator_each (tg->get_simple_trans_list (),
+                         ptr);
+
+      (tg->*ptr) ();
+    }
+
+  for (SCM s = c->context_list_ ; gh_pair_p (s);
+       s =gh_cdr (s))
+    {
+      recurse_down_translators (unsmob_context (gh_car (s)), ptr, context_first);
+    }
+
+  if (context_first)
+    {
+      translator_each (tg->get_simple_trans_list (),
+                    ptr);
+
+      (tg->*ptr) ();
+    }
+}
index eaf82c3166275c650b4da23b2637fb4722aaaa49..3b793713d15c56cec51ce4221774a5d8041c2492 100644 (file)
@@ -9,7 +9,7 @@
  */
 
 #include "main.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "warn.hh"
 #include "item.hh"
 #include "spanner.hh"
@@ -29,7 +29,7 @@
 
 
 void
-execute_pushpop_property (Translator_group * trg,
+execute_pushpop_property (Context * trg,
                          SCM prop, SCM eltprop, SCM val)
 {
   if (gh_symbol_p (prop) && gh_symbol_p (eltprop))
@@ -37,7 +37,7 @@ execute_pushpop_property (Translator_group * trg,
       if (val != SCM_UNDEFINED)
        {
          SCM prev = SCM_EOL;
-         Translator_group * where = trg->where_defined (prop);
+         Context * where = trg->where_defined (prop);
 
          /*
            Don't mess with MIDI.
@@ -113,7 +113,7 @@ execute_pushpop_property (Translator_group * trg,
   PRE_INIT_OPS is in the order specified, and hence must be reversed.
  */
 void
-apply_property_operations (Translator_group*tg, SCM pre_init_ops)
+apply_property_operations (Context *tg, SCM pre_init_ops)
 {
   SCM correct_order = scm_reverse (pre_init_ops);
   for (SCM s = correct_order; gh_pair_p (s); s = ly_cdr (s))
@@ -141,14 +141,17 @@ apply_property_operations (Translator_group*tg, SCM pre_init_ops)
   contexts has changed. The alist is updated if necessary. 
    */
 SCM
-updated_grob_properties (Translator_group* tg, SCM sym)
+updated_grob_properties (Context * tg, SCM sym)
 {
   assert (gh_symbol_p (sym));
   
   tg = tg->where_defined (sym);
+  if (!tg)
+    return SCM_EOL;
+  
   SCM daddy_props
-    = (tg->daddy_trans_)
-    ? updated_grob_properties (tg->daddy_trans_, sym)
+    = (tg->daddy_context_)
+    ? updated_grob_properties (tg->daddy_context_, sym)
     : SCM_EOL;
   
   SCM props  = tg->internal_get_property (sym);
@@ -184,14 +187,14 @@ updated_grob_properties (Translator_group* tg, SCM sym)
 }
 
 Item*
-make_item_from_properties (Translator_group* tg, SCM x)
+make_item_from_properties (Context * tg, SCM x)
 {
   SCM props = updated_grob_properties (tg, x);
   return new Item (props);
 }
 
 Spanner*
-make_spanner_from_properties (Translator_group *tg, SCM x)
+make_spanner_from_properties (Context *tg, SCM x)
 {
   SCM props = updated_grob_properties (tg, x);
   return new Spanner (props);
index 1ccee6c729b10d4883bc2a9419538cf8d9d107cb..6df422ae5f40cf5a06d35800d44b9dd733c29d4e 100644 (file)
 #include "translator-group.hh"
 #include "lily-guile.hh"
 
-LY_DEFINE(ly_get_context_property,
-         "ly:get-context-property", 2, 0, 0,
-         (SCM context, SCM name),
-         "retrieve the value of @var{name} from context @var{context}")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr=   dynamic_cast<Translator_group*> (t);
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Translator group");
-  SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-
-  return tr->internal_get_property (name);
-  
-}
-
-LY_DEFINE(ly_set_context_property,
-         "ly:set-context-property!", 3, 0, 0,
-         (SCM context, SCM name, SCM val),
-         "set value of property @var{name} in context @var{context} to @var{val}.")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr=   dynamic_cast<Translator_group*> (t);
-
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-  SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-
-  tr->internal_set_property (name, val);
-
-  return SCM_UNSPECIFIED;
-}
-
-
-LY_DEFINE(ly_context_property_where_defined,
-         "ly:context-property-where-defined", 2, 0, 0,
-         (SCM context, SCM name),
-         "Return the context above @var{context} where @var{name}  is defined.")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr = dynamic_cast<Translator_group*> (t);
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-  SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-
-
-  tr = tr->where_defined (name);
-
-  if (tr)
-    return tr->self_scm();
-
-  return SCM_EOL;
-}
-
-LY_DEFINE(ly_unset_context_property,
-         "ly:unset-context-property", 2, 0, 0,
-         (SCM context, SCM name),
-         "Unset value of property @var{name} in context @var{context}.")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr = dynamic_cast<Translator_group*> (t);
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-  SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-
-  tr->unset_property (name);
-
-  return SCM_UNSPECIFIED;
-}
-
-
-
-LY_DEFINE(ly_context_parent,
-         "ly:context-parent", 1, 0, 0,
-         (SCM context),
-         "Return the parent of @var{context}, #f if none.")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr=   dynamic_cast<Translator_group*> (t);
-
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
-  tr =  tr->daddy_trans_ ;
-  if (tr)
-    return tr->self_scm();
-  else
-    return SCM_BOOL_F;
-}
-
-/*
-  Todo: should support translator IDs, and creation?
- */
-LY_DEFINE(ly_translator_find,
-         "ly:translator-find", 2, 0,0,
-         (SCM context, SCM name),
-         "Find a parent of @var{context} that has name or alias @var{name}. "
-         "Return @code{#f} if not found." )
-{
-  Translator_group* tr=   dynamic_cast<Translator_group*> ( unsmob_translator (context));
-
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "context");
-  SCM_ASSERT_TYPE(gh_symbol_p (name), name, SCM_ARG2, __FUNCTION__, "symbol");
-  
-  while (tr)
-    {
-      if (tr->is_alias (name))
-       return tr->self_scm();
-      tr =  tr->daddy_trans_ ;
-    }
-  
-  return SCM_BOOL_F;
-}
-
-
-LY_DEFINE(ly_context_properties,
-         "ly:context-properties", 1, 0, 0,
-         (SCM context),
-         "Return all properties  of @var{context} in an alist.")
-{
-  Translator *t = unsmob_translator (context);
-  Translator_group* tr=   dynamic_cast<Translator_group*> (t);
-
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
-  return tr->properties_as_alist ();
-}
 
 
 
@@ -149,30 +28,6 @@ LY_DEFINE(ly_translator_name,
 }
 
 
-LY_DEFINE(ly_context_id,
-         "ly:context-id", 1,0,0,  (SCM context),
-         "Return the id string of @var{context}, i.e. for @code{\\context Voice "
-"= one .. } it will return the string @code{one}.")
-{
-  Translator_group* tr =  dynamic_cast<Translator_group*> (unsmob_translator (context));
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
-  return scm_makfrom0str (tr->id_string_. to_str0 ());
-}
-
-
-LY_DEFINE(ly_context_name,
-         "ly:context-name", 1,0,0,  (SCM context),
-         "Return the name of @var{context}, i.e. for @code{\\context Voice "
-"= one .. } it will return the symbol @code{Voice}.")
-{
-  Translator_group* tr =  dynamic_cast<Translator_group*> (unsmob_translator (context));
-  SCM_ASSERT_TYPE(tr, context, SCM_ARG1, __FUNCTION__, "Context");
-
-  return unsmob_context_def (tr->definition_)->get_context_name (); 
-}
-
-
 LY_DEFINE(ly_translator_description,
          "ly:translator-description",
          1,0,0, (SCM me),
@@ -185,56 +40,13 @@ LY_DEFINE(ly_translator_description,
 }
 
 
-LY_DEFINE(ly_context_pushpop_property,
-         "ly:context-pushpop-property", 3, 1, 0,
-         (SCM context, SCM grob, SCM eltprop, SCM val),
-         "Do a single @code{\\override} or @code{\\revert} operation "
-         "in @var{context}. The grob definition @code{grob} is extended with "
-         "@code{eltprop} (if @var{val} is specified) "
-         "or reverted (if  unspecified).")
-{
-  Translator_group *tg = dynamic_cast<Translator_group*> (unsmob_translator (context));
-
-  SCM_ASSERT_TYPE(tg, context, SCM_ARG1, __FUNCTION__, "context");
-  SCM_ASSERT_TYPE(gh_symbol_p (grob), grob, SCM_ARG2, __FUNCTION__, "symbol");
-  SCM_ASSERT_TYPE(gh_symbol_p (eltprop), eltprop, SCM_ARG3, __FUNCTION__, "symbol");
-
-  execute_pushpop_property (tg, grob, eltprop, val);
-
-  return SCM_UNDEFINED;
-}
-
-LY_DEFINE(ly_context_p,
-         "ly:context?", 1, 0, 0,
-         (SCM x),
-         "Type predicate: is @var{x} a context?")
-{
-  Translator_group *tg = dynamic_cast<Translator_group*> (unsmob_translator (x));
-
-  return SCM_BOOL (tg);
-}
-         
-
 int
 Translator::print_smob (SCM s, SCM port, scm_print_state *)
 {
   Translator *sc = (Translator *) ly_cdr (s);
      
   scm_puts ("#<Translator ", port);
-  if (Context_def *d=unsmob_context_def (sc->definition_))
-    {
-      scm_display (d->get_context_name (), port);
-    }
-  else
-    scm_display (ly_translator_name (s), port);
-
-  if (Translator_group *td=dynamic_cast<Translator_group*> (sc))
-    {
-      scm_puts ("=", port);
-      scm_puts (td->id_string_.to_str0 (), port);
-    }
-  
-  scm_display (sc->simple_trans_list_, port);
+  scm_puts (classname (sc), port);
 
   /*
     don't try to print properties, that is too much hassle.
index c4ab9083ab94078c57e63c0cd50b55b886f85f4f..ee0709fbe19fbf063311039bb35f904aad88cd5b 100644 (file)
@@ -11,8 +11,9 @@
 #include "warn.hh"
 #include "translator-group.hh"
 #include "context-def.hh"
-
+#include "global-context.hh"
 #include "moment.hh"
+#include "context.hh"
 #include "ly-smobs.icc"
 
 
@@ -23,32 +24,22 @@ Translator::~Translator ()
 void
 Translator::init ()
 {
+  self_scm_ = SCM_EOL;
   simple_trans_list_ = SCM_BOOL_F;
-  trans_group_list_ = SCM_EOL;
-  properties_scm_ = SCM_EOL;
-  definition_ = SCM_EOL;
-  daddy_trans_ =0;
-  accepts_list_ = SCM_EOL;
+  daddy_context_ =0;
+  smobify_self ();
 }
 
 Translator::Translator ()
 {
-  self_scm_ = SCM_EOL;
   init ();
-  output_def_ = 0;
-  smobify_self ();
 }
 
-Translator::Translator (Translator const &s)
+Translator::Translator (Translator const &)
 {
-  self_scm_ = SCM_EOL;
   init ();
-  output_def_ = s.output_def_;
-
-  smobify_self ();
 }
 
-
 bool
 Translator::try_music (Music *)
 {
@@ -59,27 +50,29 @@ Translator::try_music (Music *)
 Moment
 Translator::now_mom () const
 {
-  return daddy_trans_->now_mom ();
+  return daddy_context_->now_mom ();
 }
 
-void
-Translator::do_announces ()
+Music_output_def *
+Translator::get_output_def () const
 {
+  return daddy_context_->get_output_def ();
 }
 
-Music_output_def *
-Translator::get_output_def () const
+
+Translator_group*
+Translator::get_daddy_translator () const
 {
-  return
-    (daddy_trans_)
-    ? daddy_trans_->get_output_def ()
-    : 0;
+  Translator *t
+    = unsmob_translator (daddy_context_->implementation_);
+  return dynamic_cast<Translator_group*> (t);
 }
 
+
 SCM
 Translator::internal_get_property (SCM sym) const
 {
-  return daddy_trans_->internal_get_property (sym);
+  return daddy_context_->internal_get_property (sym);
 }
 
 void
@@ -121,13 +114,7 @@ SCM
 Translator::mark_smob (SCM sm)
 {
   Translator * me = (Translator*) SCM_CELL_WORD_1 (sm);
-  scm_gc_mark (me->simple_trans_list_);
-  scm_gc_mark (me->trans_group_list_);
-  scm_gc_mark (me->definition_);  
-  scm_gc_mark (me->properties_scm_);  
-  scm_gc_mark (me->accepts_list_);
-
-  return me->properties_scm_;
+  return me->simple_trans_list_;
 }
 
 SCM
@@ -136,6 +123,21 @@ Translator::translator_description () const
   return SCM_EOL;
 }
 
+
+Global_context *
+Translator::get_global_context () const
+{
+  return daddy_context_ ->get_global_context ();
+}
+
+
+Score_context *
+Translator::get_score_context () const
+{
+  return daddy_context_->get_score_context ();
+}  
+
+
 SCM
 Translator::static_translator_description ()const
 {
@@ -146,9 +148,3 @@ Translator::static_translator_description ()const
 IMPLEMENT_SMOBS (Translator);
 IMPLEMENT_DEFAULT_EQUAL_P (Translator);
 IMPLEMENT_TYPE_P(Translator,"ly:translator?");
-
-SCM
-Translator::get_simple_trans_list()
-{
-  return SCM_EOL;
-}
index a9633115384449b9c305e3426383c271586a40c9..b1b261d80054602d30db196c420c45ab64f2136c 100644 (file)
@@ -10,7 +10,7 @@ source file of the GNU LilyPond music typesetter
 
 #include "music.hh"
 #include "sequential-iterator.hh"
-#include "translator-group.hh"
+#include "context.hh"
 
 class Unfolded_repeat_iterator : public Sequential_iterator
 {
@@ -107,7 +107,7 @@ Volta_repeat_iterator::add_repeat_command (SCM what)
   SCM reps = ly_symbol2scm ("repeatCommands");
   SCM current_reps = get_outlet ()->internal_get_property (reps);
 
-  Translator_group * where = get_outlet ()->where_defined (reps);
+  Context * where = get_outlet ()->where_defined (reps);
   if (where
       && current_reps == SCM_EOL || gh_pair_p (current_reps))
     {
index 0007e6cb5e34e54171e0475fc89667c8ed4a37d1..97681de90a14135cd44b53351619a1e60583d2d6 100644 (file)
@@ -5,7 +5,7 @@
 
   (c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
-#include "translator-group.hh"
+#include "context.hh"
 #include "paper-column.hh"
 #include "align-interface.hh"
 #include "span-bar.hh"
@@ -16,7 +16,7 @@
 class Vertical_align_engraver : public Engraver
 {
   Spanner * valign_;
-  bool qualifies_b (Grob_info) const;  
+  bool qualifies (Grob_info) const;  
 public:
   TRANSLATOR_DECLARATIONS(Vertical_align_engraver);
 protected:
@@ -53,18 +53,18 @@ Vertical_align_engraver::finalize ()
 }
 
 bool
-Vertical_align_engraver::qualifies_b (Grob_info i) const
+Vertical_align_engraver::qualifies (Grob_info i) const
 {
-  int sz = i.origin_transes ((Translator*)this).size ()  ;
+  int sz = i.origin_contexts ((Translator*)this).size ()  ;
 
-  return sz > 1 && Axis_group_interface::has_interface (i.grob_)
+  return sz > 0 && Axis_group_interface::has_interface (i.grob_)
     && !i.grob_->get_parent (Y_AXIS) && Axis_group_interface::axis_b (i.grob_, Y_AXIS);
 }
 
 void
 Vertical_align_engraver::acknowledge_grob (Grob_info i)
 {
-  if (qualifies_b (i))
+  if (qualifies (i))
     {
       Align_interface::add_element (valign_,i.grob_, get_property ("verticalAlignmentChildCallback"));
     }
index 7e2b3376a34eed2403a239be03aa819fcfefe993..0a33d68e76b59556155cf125043c12952d08f8a4 100644 (file)
@@ -8,7 +8,7 @@
  */
 
 #include "engraver.hh"
-#include "translator-group.hh"
+#include "context.hh"
 #include "volta-bracket.hh"
 #include "item.hh"
 #include "note-column.hh"
index 3c59e9bdbd3ea19ea32644b414dc60d2c9d7b6b9..08e3ff8d6762818b165e8ba4e3ee26620afb40e3 100644 (file)
@@ -1,5 +1,11 @@
 \version "2.1.23"
 
+\translator {
+    \name Global
+
+    % nothing else needed -- tweaks are ignored anyway.
+    \accepts Score
+    }
 
 %
 % setup for Request->Element conversion. Guru-only
     \name DrumVoice
     \alias Voice
 
-    \description " A voice on a percussion staff."
-    
-    
+    \description "A voice on a percussion staff."
     \remove "Arpeggio_engraver"
     \consists "Multi_measure_rest_engraver"
     \consists "Text_spanner_engraver"
index daba5a3261fcf9fdc3344859c9a5d271e30eba14..5538b8324ba3f266e151bb7393b1bb62fd4c6fe8 100644 (file)
     \consists "Key_performer"
     \consists "Tempo_performer"
     \consists "Time_signature_performer"
-
 }
+\translator {
+    \name Global
+    \accepts Score
+    }
 \translator {
     \StaffContext
     \name DrumStaff
index 529433ae545f670bac789f1c7bc53ace5e9b9c38..7bd3be3f46c0ac3ba7ba95c4b15779242e2de1ae 100644 (file)
@@ -66,7 +66,7 @@ extents of a cluster spanner at this X position.
 
 (ly:add-interface
  'multi-measure-interface
- "Multi measure rest, and friends (mmrest number, mmrest text)."
+ "Multi measure rest, and the text or number that is printed over it."
  '())
 
 
index f3f0ec958350fe51d718a2fc6ab9bda7459a782d..9b9cb21e60c0f07e6da24cc7f2db481aca53f588 100644 (file)
@@ -31,7 +31,7 @@
      (X-extent-callback ,procedure? "Procedure that calculates the
 extent of this object. If this value is set to @code{#f}, the object
 is empty in the X direction.  The procedure takes a grob and axis
-argument, and returns a number-pair.
+argument, and returns a number-pair.
 ")
 
      (X-offset-callbacks ,list? "A list of functions determining this
@@ -561,7 +561,8 @@ paper-columns or note-column objects.")
      (dependencies ,grob-list? "list of score-grob pointers that indicate who to compute first for certain global passes.")
      (elements ,grob-list? "list of grobs, type depending on the Grob where this is set in.")
      (heads ,grob-list? "List of note heads.")
-     (items-worth-living ,grob-list? "list of interesting items. If empty in a particular system, clear that system.")
+     (items-worth-living ,grob-list? "A list of interesting items. If
+empty in a particular staff, then that staff is erased.")
      (details ,list? "alist of parameters for detailed grob behavior.")
      (note-heads ,grob-list? "List of note head grobs")
      (side-support-elements ,grob-list? "the support, a list of grobs.")
@@ -583,10 +584,11 @@ columns.
 
      (positioning-done ,boolean?
                       "Used to signal that a positioning element
-did it's job. This ensures that a positioning is only done once.")
+did its job. This ensures that a positioning is only done once.")
 
 
-     (script-stencil ,pair? "Index code for script -- internal, see script.cc.")
+     (script-stencil ,pair? "Pair (@code{type} . @code{arg}), which
+acts as an index for looking up a Stencil object.")
 
      (meta ,list? "Contains meta information. It is an alist with the
 entries @code{name} and @code{interfaces}.")
index 8419b2528cbd2bffae903dbc5395bcb8bb81ff2d..2326ae35f7a03ad50cd1781c4bd5f5fa04d94f77 100644 (file)
        (axes . (0))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (before-line-breaking-callback . ,Paper_column::before_line_breaking)
+       (breakable . #t)
        ;; debugging stuff: print column number.
 ;      (print-function . ,Paper_column::print) (font-name . "cmr8")    (Y-extent-callback . #f)
 
index 2fd7a35326809c55689907dd3157f4573b5a9a1b..0c70e7a78e34de627ce2cacbc81bf7bf7e253813 100644 (file)
@@ -30,7 +30,7 @@
 TODO: consider making type into symbol") 
      (absolute-octave ,integer?
                      "The absolute octave for a octave check note.")
-     (articulations ,music-list?
+     (articulations ,ly:music-list?
                    "Articulation events specifically for this note.")
      (articulation-type ,string? "key for script definitions alist.
 
@@ -56,7 +56,7 @@ eg. @code{\\tag #'part ...} could tag a piece of music as only being active in a
      (tempo-unit ,ly:duration? "The unit for the metronome count.")
      (tonic ,ly:pitch? "Base of the scale")
      (element ,ly:music? "The single child of a Music_wrapper music object, or the body of a repeat.")
-     (elements ,music-list? "A list of elements for sequential of simultaneous music, or the alternatives of repeated music. ")
+     (elements ,ly:music-list? "A list of elements for sequential of simultaneous music, or the alternatives of repeated music. ")
      (force-accidental ,boolean? "If set, a cautionary accidental should always be printed on this note")
      (grob-property ,symbol? "The symbol of the grob property to set. ")
      (grob-value ,scheme? "The value of the grob property to set")
index 4b218337620ec145fc89e158e6666324d69545fc..ab4066cd91cac409548f92bbd3639ff2a57bf2d5 100644 (file)
@@ -451,7 +451,6 @@ L1 is copied, L2 not.
    (,ly:duration? . "duration")
    (,ly:grob? . "layout object")
    (,ly:input-location? . "input location")
-   (,ly:input-location? . "input location")   
    (,ly:moment? . "moment")
    (,ly:music? . "music")
    (,ly:pitch? . "pitch")
@@ -459,7 +458,7 @@ L1 is copied, L2 not.
    (,ly:font-metric? . "font metric")
    (,markup-list? . "list of markups")
    (,markup? . "markup")
-   (,music-list? . "list of music")
+   (,ly:music-list? . "list of music")
    (,number-or-grob? . "number or grob")
    (,number-or-string? . "number or string")
    (,number-pair? . "pair of numbers")
index 29194e3326b4745a73b41641282b59553a2c04e8..34b02c98c8193f4e3efe92d8a9c13bcd71d1b708 100644 (file)
@@ -428,7 +428,8 @@ Rest can contain a list of beat groupings
        (basic  (list set1 set2 set3 set4)))
 
     (context-spec-music
-     (make-sequential-music basic) 'Timing)))
+     (context-spec-music
+      (make-sequential-music basic) 'Timing) 'Score)))
 
 (define-public (make-mark-set label)
   "make the music for the \\mark command."
index e396af48236cd640126707cd4153069a7d847c47..fddb60115a728f886dfb9fd5dea83423ae9452a5 100644 (file)
@@ -1892,6 +1892,11 @@ def conv (str):
        return str
        
 conversions.append (((2,1,23), conv, """Property setting syntax in \\translator{ }"""))
+def conv (str):
+       str = re.sub (r'music-list\?', 'ly:music-list?', str)
+       return str
+
+conversions.append (((2,1,24), conv, """music-list? -> ly:music-list?"""))
 
 
 ################################