]> git.donarmstrong.com Git - lilypond.git/commitdiff
* lily/include/translator.icc: new file.
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Jul 2005 23:37:26 +0000 (23:37 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Mon, 18 Jul 2005 23:37:26 +0000 (23:37 +0000)
* lily/paper-column-engraver.cc (process_music): new
file. Separate Paper_column factory from Score_engraver.

* lily/vertically-spaced-context-engraver.cc: administer
spaceable-staves property of System.

* lily/translator-group-ctors.cc: new file.

* lily/context-property.cc (make_grob_from_properties): construct
the right Grob class programmatically, looking at the class entry
for the meta property.

* lily/break-align-engraver.cc (stop_translation_timestep): call
Break_align_interface::add_element() directly.

* lily/context.cc (measure_position): measure_position() is now a
normal function.

* lily/include/translator.hh (class Translator): rename
process_acknowledged_grobs() to process_acknowledged() and move to
Translator.

* scm/define-grobs.scm (all-grob-descriptions): add a 'class meta
field for each grob description.

* lily/include/translator-group.hh (class Translator_group):
change to base class. Separate class from Translator. This gets
rid of virtual inheritance for Engravers/Performers.

* lily/staff-performer.cc (class Staff_performer): derive
Staff_performer from Performer, not Performer_group_performer

* Lily/translator-group.cc (precomputed_recurse_over_translators):
new function.
(precompute_method_bindings): new function. Precompute lists of
Translators, so we only call methods (process_music,
start_translation_timestep, etc.) for Translators needing
it. Also: dispose of pointer-to-member-function calls.

* lily/engraver-group-engraver.cc: remove engraver_each,
recurse_down_engravers ()

* lily/note-head.cc (internal_print): only call
glyph-name-procedure if  style != default. 3 %  speed increase (wtk2-fugue1).

166 files changed:
ChangeLog
Documentation/user/advanced-notation.itely
Documentation/user/basic-notation.itely
Documentation/user/changing-defaults.itely
lily/accidental-engraver.cc
lily/ambitus-engraver.cc
lily/arpeggio-engraver.cc
lily/auto-beam-engraver.cc
lily/axis-group-engraver.cc
lily/axis-group-interface.cc
lily/bar-engraver.cc
lily/bar-number-engraver.cc
lily/beam-engraver.cc
lily/beam-performer.cc
lily/break-align-engraver.cc
lily/break-align-interface.cc
lily/breathing-sign-engraver.cc
lily/chord-name-engraver.cc
lily/chord-tremolo-engraver.cc
lily/clef-engraver.cc
lily/cluster-engraver.cc
lily/coherent-ligature-engraver.cc
lily/collision-engraver.cc
lily/completion-note-heads-engraver.cc
lily/context-def.cc
lily/context-property.cc
lily/context.cc
lily/custos-engraver.cc
lily/dot-column-engraver.cc
lily/dot-column.cc
lily/drum-note-engraver.cc
lily/drum-note-performer.cc
lily/dynamic-engraver.cc
lily/dynamic-performer.cc
lily/engraver-group-engraver.cc
lily/engraver.cc
lily/extender-engraver.cc
lily/figured-bass-engraver.cc
lily/fingering-engraver.cc
lily/font-size-engraver.cc
lily/forbid-break-engraver.cc
lily/glissando-engraver.cc
lily/grace-engraver.cc
lily/gregorian-ligature-engraver.cc
lily/grid-line-span-engraver.cc
lily/grid-point-engraver.cc
lily/grob-pq-engraver.cc
lily/hara-kiri-engraver.cc
lily/hara-kiri-group-spanner.cc
lily/horizontal-bracket-engraver.cc
lily/hyphen-engraver.cc
lily/include/accidental-interface.hh
lily/include/axis-group-engraver.hh
lily/include/axis-group-interface.hh
lily/include/context.hh
lily/include/engraver-group-engraver.hh
lily/include/engraver.hh
lily/include/gregorian-ligature-engraver.hh
lily/include/ligature-engraver.hh
lily/include/paper-column-engraver.hh [new file with mode: 0644]
lily/include/performer-group-performer.hh
lily/include/performer.hh
lily/include/recording-group-engraver.hh [new file with mode: 0644]
lily/include/score-engraver.hh
lily/include/score-performer.hh
lily/include/staff-symbol-engraver.hh
lily/include/timing-translator.hh
lily/include/translator-group.hh
lily/include/translator.hh
lily/include/translator.icc [new file with mode: 0644]
lily/include/type-swallow-translator.hh
lily/instrument-name-engraver.cc
lily/item.cc
lily/key-engraver.cc
lily/key-performer.cc
lily/ledger-line-engraver.cc
lily/ligature-bracket-engraver.cc
lily/ligature-engraver.cc
lily/lyric-engraver.cc
lily/lyric-performer.cc
lily/mark-engraver.cc
lily/measure-grouping-engraver.cc
lily/melisma-translator.cc
lily/mensural-ligature-engraver.cc
lily/metronome-engraver.cc
lily/multi-measure-rest-engraver.cc
lily/new-fingering-engraver.cc
lily/note-collision.cc
lily/note-column.cc
lily/note-head-line-engraver.cc
lily/note-head.cc
lily/note-heads-engraver.cc
lily/note-name-engraver.cc
lily/note-performer.cc
lily/ottava-engraver.cc
lily/output-property-engraver.cc
lily/paper-column-engraver.cc [new file with mode: 0644]
lily/part-combine-engraver.cc
lily/percent-repeat-engraver.cc
lily/performer-group-performer.cc
lily/performer.cc
lily/phrasing-slur-engraver.cc
lily/piano-pedal-engraver.cc
lily/piano-pedal-performer.cc
lily/pitch-squash-engraver.cc
lily/pitched-trill-engraver.cc
lily/recording-group-engraver.cc
lily/repeat-acknowledge-engraver.cc
lily/rest-collision-engraver.cc
lily/rest-engraver.cc
lily/rhythmic-column-engraver.cc
lily/score-context.cc
lily/score-engraver.cc
lily/score-performer.cc
lily/script-column-engraver.cc
lily/script-engraver.cc
lily/separating-line-group-engraver.cc
lily/slash-repeat-engraver.cc
lily/slur-engraver.cc
lily/slur-performer.cc
lily/spacing-engraver.cc
lily/span-arpeggio-engraver.cc
lily/span-bar-engraver.cc
lily/span-bar.cc
lily/span-dynamic-performer.cc
lily/spanner.cc
lily/staff-collecting-engraver.cc
lily/staff-performer.cc
lily/staff-symbol-engraver.cc
lily/stanza-number-align-engraver.cc
lily/stanza-number-engraver.cc
lily/stem-engraver.cc
lily/string-number-engraver.cc
lily/swallow-engraver.cc
lily/swallow-perf.cc
lily/system-start-delimiter-engraver.cc
lily/system-start-delimiter.cc
lily/system.cc
lily/tab-note-heads-engraver.cc
lily/tab-staff-symbol-engraver.cc
lily/tempo-performer.cc
lily/text-engraver.cc
lily/text-spanner-engraver.cc
lily/tie-engraver.cc
lily/tie-performer.cc
lily/time-signature-engraver.cc
lily/time-signature-performer.cc
lily/timing-engraver.cc
lily/timing-translator.cc
lily/translator-group-ctors.cc [new file with mode: 0644]
lily/translator-group.cc
lily/translator-scheme.cc
lily/translator.cc
lily/trill-spanner-engraver.cc
lily/tuplet-engraver.cc
lily/type-swallow-translator.cc
lily/vaticana-ligature-engraver.cc
lily/vertical-align-engraver.cc
lily/vertically-spaced-context-engraver.cc [new file with mode: 0644]
lily/volta-engraver.cc
ly/engraver-init.ly
ly/performer-init.ly
scm/define-context-properties.scm
scm/define-grobs.scm
scm/document-translation.scm
scm/framework-scm.scm

index 899077133918a46cad39229f644eb3fd6f7526b5..e28aa7f588ede569171ef297993dd9ebd4a19987 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,52 @@
+2005-07-19  Han-Wen Nienhuys  <hanwen@xs4all.nl>
+
+       * lily/include/translator.icc: new file. 
+
+       * lily/paper-column-engraver.cc (process_music): new
+       file. Separate Paper_column factory from Score_engraver.
+
+       * lily/vertically-spaced-context-engraver.cc: administer
+       spaceable-staves property of System.
+
+       * lily/translator-group-ctors.cc: new file.
+
+       * lily/context-property.cc (make_grob_from_properties): construct
+       the right Grob class programmatically, looking at the class entry
+       for the meta property.
+
+       * lily/break-align-engraver.cc (stop_translation_timestep): call
+       Break_align_interface::add_element() directly.
+
+       * lily/context.cc (measure_position): measure_position() is now a
+       normal function.
+
+       * lily/include/translator.hh (class Translator): rename
+       process_acknowledged_grobs() to process_acknowledged() and move to
+       Translator.
+
+       * scm/define-grobs.scm (all-grob-descriptions): add a 'class meta
+       field for each grob description.
+
+       * lily/include/translator-group.hh (class Translator_group):
+       change to base class. Separate class from Translator. This gets
+       rid of virtual inheritance for Engravers/Performers.
+
+       * lily/staff-performer.cc (class Staff_performer): derive
+       Staff_performer from Performer, not Performer_group_performer 
+
+       * Lily/translator-group.cc (precomputed_recurse_over_translators):
+       new function.
+       (precompute_method_bindings): new function. Precompute lists of
+       Translators, so we only call methods (process_music,
+       start_translation_timestep, etc.) for Translators needing
+       it. Also: dispose of pointer-to-member-function calls.
+
+       * lily/engraver-group-engraver.cc: remove engraver_each,
+       recurse_down_engravers ()
+
+       * lily/note-head.cc (internal_print): only call
+       glyph-name-procedure if  style != default. 3 %  speed increase (wtk2-fugue1).
+
 2005-07-16  Graham Percival  <gperlist@shaw.ca>
 
        * ly/titling-init.ly: add printallheaders option.
index afd7e54352e6f49f75c72c99514751c0eed64f2e..b71f053475d49e94f303e73ea1b66e64676cec32 100644 (file)
@@ -1455,13 +1455,21 @@ tsMarkup =\markup {
 @end lilypond
 
 Each staff can also have its own time signature.  This is done by
-moving the @internalsref{Timing_engraver} to the @internalsref{Staff}
+moving the @internalsref{Timing_translator} to the @internalsref{Staff}
 context.
 
 @example
 \layout @{
-  \context @{ \Score \remove "Timing_engraver" @}
-  \context @{ \Staff \consists "Timing_engraver" @}
+  \context @{ \Score
+     \remove "Timing_translator"
+     \remove "Default_bar_line_engraver"
+  @}
+  \context @{
+    \Staff
+    \consists "Timing_translator"
+    \consists "Default_bar_line_engraver"
+  @}
+    
 @}
 @end example
 
@@ -1486,8 +1494,15 @@ Now, each staff has its own time signature.
 
 @lilypond[quote,raggedright]
 \layout{
-  \context{ \Score \remove "Timing_engraver" }
-  \context{ \Staff \consists "Timing_engraver" }
+  \context{
+     \Score
+     \remove "Timing_translator"
+     \remove "Default_bar_line_engraver"
+    }
+  \context{ \Staff
+    \consists "Timing_translator"
+    \consist  "Default_bar_line_engraver"
+  }
 }
 
 \relative c' <<
index 7ab1949fe2a51aba56280c8e24c1a168f5085986..d5646c2ac8172cef3cf1ecb64983baf55b471b1f 100644 (file)
@@ -1072,7 +1072,7 @@ measure is subdivided in 2, 2, 2 and 3.  This is passed to
 
 @seealso
 
-Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_engraver}.
+Program reference: @internalsref{TimeSignature}, and @internalsref{Timing_translator}.
 
 
 @refbugs
index 58ae5e18335450ae886622e4415b7935af42641d..526b8490ff11e63339bbe77e6ed258745c9d396d 100644 (file)
@@ -436,27 +436,30 @@ sophisticated method of blanking objects is shown in @ref{Common tweaks}.
 
 The next example shows a practical application.  Bar lines and time
 signatures are normally synchronized across the score.  This is done
-by the @code{Timing_engraver}.  This plug-in keeps an administration of
-time signature, location within the measure, etc.  By moving the
-@code{Timing_engraver} engraver from @code{Score} to @code{Staff}
-context, we can have a score where each staff has its own time
-signature.
+by the @code{Timing_translator} and @code{Default_bar_line_engraver}.
+This plug-in keeps an administration of time signature, location
+within the measure, etc.  By moving thes engraver from @code{Score} to
+@code{Staff} context, we can have a score where each staff has its own
+time signature.
 
 @cindex polymetric scores
 @cindex Time signatures, multiple
 
 @lilypond[quote,relative=1,raggedright,verbatim,fragment]
 \new Score \with {
-  \remove "Timing_engraver"
+  \remove "Timing_translator"
+  \remove "Default_bar_line_engraver"
 } <<
   \new Staff \with {
-    \consists "Timing_engraver"
+    \consists "Timing_translator"
+    \consists "Default_bar_line_engraver"
   } {
       \time 3/4
       c4 c c c c c
   }
   \new Staff \with {
-    \consists "Timing_engraver"
+    \consists "Timing_translator"
+    \consists "Default_bar_line_engraver"
   } {
        \time 2/4
        c4 c c c c c
index 971f976239282837587b8f2ff169892427780882..6898520441fa1bfcb8031f49418658212f2351ab 100644 (file)
@@ -19,6 +19,8 @@
 #include "music.hh"
 #include "pitch.hh"
 
+#include "translator.icc"
+
 class Accidental_entry
 {
 public:
@@ -51,11 +53,11 @@ public:
 
 protected:
   TRANSLATOR_DECLARATIONS (Accidental_engraver);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void initialize ();
-  virtual void process_acknowledged_grobs ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
   virtual void finalize ();
 
   virtual void derived_mark () const;
@@ -301,7 +303,7 @@ Accidental_engraver::get_bar_number ()
 }
 
 void
-Accidental_engraver::process_acknowledged_grobs ()
+Accidental_engraver::process_acknowledged ()
 {
   if (accidentals_.size () && !accidentals_.top ().done_)
     {
index a07b04fa052af5f08a956e5fdde5ebe73cfe8ed5..82f05c3974a7e279cb498366275f186e693c540f 100644 (file)
 #include "axis-group-interface.hh"
 #include "side-position-interface.hh"
 
+#include "translator.icc"
+
 class Ambitus_engraver : public Engraver
 {
 public:
   TRANSLATOR_DECLARATIONS (Ambitus_engraver);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
   virtual void derived_mark () const;
 
@@ -185,6 +187,8 @@ Ambitus_engraver::finalize ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Ambitus_engraver,
                /* descr */ "",
                /* creats*/ "Ambitus AmbitusLine AmbitusNoteHead AmbitusAccidental",
index fc324c1582766a5cc652837f1e288cebe7a2ad39..856b5a7303899c61a934af799fca2f4eeea3ae78 100644 (file)
@@ -15,6 +15,8 @@
 #include "side-position-interface.hh"
 #include "note-column.hh"
 
+#include "translator.icc"
+
 class Arpeggio_engraver : public Engraver
 {
 public:
@@ -22,8 +24,8 @@ public:
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
 private:
   Item *arpeggio_;
index 636caeae8ac952acae0944e1fb6f4e7683e2ad9f..a83b635329356f5fce5fb35e8f7bf2998932ff64 100644 (file)
 #include "context.hh"
 #include "duration.hh"
 
+#include "translator.icc"
+
 
 class Auto_beam_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Auto_beam_engraver);
 
 protected:
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual bool try_music (Music *);
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
 
 private:
   bool test_moment (Direction, Moment);
@@ -367,7 +369,7 @@ Auto_beam_engraver::acknowledge_grob (Grob_info info)
 }
 
 void
-Auto_beam_engraver::process_acknowledged_grobs ()
+Auto_beam_engraver::process_acknowledged ()
 {
   if (extend_mom_ > now_mom ())
     return ; 
index 965d16db4cd07b01a4179f44c4ce23a2dda39247..105c92539712dfe86b90529c5c8916b64960522b 100644 (file)
@@ -9,12 +9,12 @@
 #include "axis-group-engraver.hh"
 
 #include "spanner.hh"
-#include "paper-column.hh"
 #include "axis-group-interface.hh"
-#include "engraver-group-engraver.hh"
 #include "warn.hh"
 #include "context.hh"
 
+#include "translator.icc"
+
 Axis_group_engraver::Axis_group_engraver ()
 {
   must_be_last_ = true;
@@ -80,7 +80,7 @@ Axis_group_engraver::acknowledge_grob (Grob_info i)
   cyclic parent relationship if we have two Axis_group_engravers in
   the context.  */
 void
-Axis_group_engraver::process_acknowledged_grobs ()
+Axis_group_engraver::process_acknowledged ()
 {
   if (!staffline_)
     return;
index 5de391440030710cbb94ed27950b3ac21527aa2e..24838b9be03369ca04b588b2350ea588e9255e01 100644 (file)
@@ -8,6 +8,7 @@
 
 #include "axis-group-interface.hh"
 
+#include "pointer-group-interface.hh"
 #include "grob.hh"
 #include "hara-kiri-group-spanner.hh"
 #include "warn.hh"
index dad72a4fe4f7648f1125d65df46ea1e2d4569b36..c67ee1a30902bff2747844bd48e5f821e77b8797 100644 (file)
@@ -12,6 +12,8 @@
 #include "warn.hh"
 #include "item.hh"
 
+#include "translator.icc"
+
 /*
   generate bars. Either user ("|:"), or default (new measure)
 */
@@ -23,8 +25,8 @@ public:
 
 protected:
   virtual void finalize ();
-  virtual void stop_translation_timestep ();
-  virtual void process_acknowledged_grobs ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
 
 private:
   void typeset_bar ();
@@ -63,12 +65,12 @@ Bar_engraver::finalize ()
   This is a little hairy : whichBar may be set by
   Repeat_acknowledge_engraver::process_music, which is at score
   context. This means that grobs could should be created after
-  process_music. We do stuff process_acknowledged_grobs (), just to be
+  process_music. We do stuff process_acknowledged (), just to be
   on the safe side.
 */
 
 void
-Bar_engraver::process_acknowledged_grobs ()
+Bar_engraver::process_acknowledged ()
 {
   if (!bar_ && scm_is_string (get_property ("whichBar")))
     create_bar ();
index 9b3eedb1bf244da86737b4b1bc3e3f70b64bf60e..7fc92c0a5dca3766201e7bd271d673ee52939e5b 100644 (file)
@@ -13,6 +13,8 @@
 #include "context.hh"
 #include "grob-array.hh"
 
+#include "translator.icc"
+
 /*
   TODO: detect the top staff (stavesFound), and acknowledge staff-group
   system-start-delims. If we find these, and the top staff is in the
@@ -24,9 +26,9 @@ class Bar_number_engraver : public Engraver
 protected:
   Item *text_;
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   void create_items ();
   TRANSLATOR_DECLARATIONS (Bar_number_engraver);
 };
index 8a9bb34b2df08cbb6f5f3d579b1223d414f094cf..da3354134adacb682213d96bbcb701d6d595ad3e 100644 (file)
@@ -19,6 +19,8 @@
 #include "context.hh"
 #include "duration.hh"
 
+#include "translator.icc"
+
 class Beam_engraver : public Engraver
 {
 protected:
@@ -46,13 +48,13 @@ protected:
   void set_melisma (bool);
 
   Moment last_stem_added_at_;
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void finalize ();
 
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
   virtual bool valid_start_point ();
   virtual bool valid_end_point ();
index 679bb6b3527d093aa5a62a4753a823e00c8378d7..861f66f35aa3436d9961e21feaa26986b859782d 100644 (file)
@@ -13,6 +13,8 @@
 #include "warn.hh"
 #include "music.hh"
 
+#include "translator.icc"
+
 class Beam_performer : public Performer
 {
 public:
@@ -20,8 +22,8 @@ public:
 
 protected:
   virtual bool try_music (Music *ev);
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   void set_melisma (bool);
 private:
   Music *start_ev_;
index 11cfa556c43beac77dfff82df940be5c14afc66e..affc8a63a0a0998a77012cc38bf4a8e3c071bb90 100644 (file)
@@ -13,6 +13,8 @@
 #include "context.hh"
 #include "translator-group.hh"
 
+#include "translator.icc"
+
 class Break_align_engraver : public Engraver
 {
   Item *align_;
@@ -22,29 +24,15 @@ class Break_align_engraver : public Engraver
   void add_to_group (SCM, Item *);
 protected:
   virtual void acknowledge_grob (Grob_info i);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void derived_mark () const;
-  void add_column (SCM);
-
 public:
   TRANSLATOR_DECLARATIONS (Break_align_engraver);
 };
 
-void
-Break_align_engraver::add_column (SCM smob)
-{
-  Grob *e = unsmob_grob (smob);
-  Break_align_interface::add_element (align_, e);
-}
-
 void
 Break_align_engraver::stop_translation_timestep ()
 {
-  for (SCM p = column_alist_; scm_is_pair (p); p = scm_cdr (p))
-    {
-      SCM pair = scm_car (p);
-      add_column (scm_cdr (pair));
-    }
   column_alist_ = SCM_EOL;
 
   align_ = 0;
@@ -89,8 +77,14 @@ Break_align_engraver::acknowledge_grob (Grob_info inf)
          align_ = make_item ("BreakAlignment", SCM_EOL);
 
          Context *origin = inf.origin_contexts (this)[0];
-         left_edge_ = make_item_from_properties (dynamic_cast<Engraver *>
-                                                 (origin->implementation ()),
+
+         Translator_group *tg = origin ->implementation ();
+         Engraver *random_source =  dynamic_cast<Engraver*> (unsmob_translator (scm_car (tg->get_simple_trans_list ())));
+
+         /*
+           Make left edge appear to come from same context as clef/bar-line etc.
+          */
+         left_edge_ = make_item_from_properties (random_source,
                                                  ly_symbol2scm ("LeftEdge"),
                                                  SCM_EOL,
                                                  "LeftEdge");
@@ -121,6 +115,8 @@ Break_align_engraver::add_to_group (SCM align_name, Item *item)
       group->set_parent (align_, Y_AXIS);
 
       column_alist_ = scm_assoc_set_x (column_alist_, align_name, group->self_scm ());
+
+      Break_align_interface::add_element (align_, group);
     }
   Axis_group_interface::add_element (group, item);
 }
index d9d977af51b3f6d9a60d1e16f57771da36327478..7d377cefdd0859b99c99b3245fb82bc68847b5c5 100644 (file)
@@ -9,8 +9,9 @@
 #include <math.h>
 
 #include "break-align-interface.hh"
-#include "libc-extension.hh"   // isinf
 
+#include "libc-extension.hh"   // isinf
+#include "pointer-group-interface.hh"
 #include "self-alignment-interface.hh"
 #include "side-position-interface.hh"
 #include "axis-group-interface.hh"
index ba23eede6d3179b589000798c7cabcb1e9950278..32ba194d033a37da4d4bfb951155fd9753071249 100644 (file)
@@ -24,8 +24,8 @@ public:
 
 protected:
   virtual bool try_music (Music *req);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Music *breathing_sign_req_;
@@ -46,7 +46,7 @@ Breathing_sign_engraver::try_music (Music *r)
 }
 
 void
-Breathing_sign_engraver::process_acknowledged_grobs ()
+Breathing_sign_engraver::process_acknowledged ()
 {
   if (breathing_sign_req_ && ! breathing_sign_)
     {
@@ -62,6 +62,8 @@ Breathing_sign_engraver::stop_translation_timestep ()
   breathing_sign_req_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Breathing_sign_engraver,
                /* descr */ "",
                /* creats*/ "BreathingSign",
index d3109d4d14a59e7e21591af4df80c45c487bcdbd..8256b32aa096ea79f7a71d518d6c629df7ee18c2 100644 (file)
@@ -22,8 +22,8 @@ class Chord_name_engraver : public Engraver
 {
   TRANSLATOR_DECLARATIONS (Chord_name_engraver);
 protected:
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual bool try_music (Music *);
   virtual void finalize ();
   virtual void derived_mark () const;
@@ -150,6 +150,8 @@ Chord_name_engraver::stop_translation_timestep ()
   The READs description is not strictly accurate:
   which properties are read depend on the chord naming function active.
 */
+#include "translator.icc"
+
 ADD_TRANSLATOR (Chord_name_engraver,
                /* descr */ "Catch note-events "
                "and generate the appropriate chordname.",
index e3d3078eccb9a800836b52175af4ce2d765517bc..7bb5d93a2b17bf7b729d346566b53b80b639690d 100644 (file)
@@ -57,9 +57,9 @@ protected:
   virtual void finalize ();
   virtual bool try_music (Music *);
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Chord_tremolo_engraver::Chord_tremolo_engraver ()
@@ -207,6 +207,8 @@ Chord_tremolo_engraver::stop_translation_timestep ()
   typeset_beam ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Chord_tremolo_engraver,
                /* descr */ "Generates beams for  tremolo repeats.",
                /* creats*/ "Beam",
index e7a0d003045da9accfed077dc02c672bd29388f0..090647ae71771d4eae6eef463c23b0a438f5840e 100644 (file)
@@ -25,8 +25,8 @@ public:
   Direction octave_dir_;
 
 protected:
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 private:
   Item *clef_;
@@ -182,6 +182,8 @@ Clef_engraver::stop_translation_timestep ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Clef_engraver,
                /* descr */ "Determine and set reference point for pitches",
                /* creats*/ "Clef OctavateEight",
index 838156145bcbf003c9cd9dcfe431ca27cb038fa0..b64e80f8fbb19f369e68b234a5a723901430de3f 100644 (file)
@@ -19,9 +19,9 @@ class Cluster_spanner_engraver : public Engraver
 protected:
   TRANSLATOR_DECLARATIONS (Cluster_spanner_engraver);
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
 private:
   Link_array<Music> cluster_notes_;
@@ -125,6 +125,8 @@ Cluster_spanner_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Cluster_spanner_engraver,
                /* descr */     "Engraves a cluster using Spanner notation ",
                /* creats*/     "ClusterSpanner ClusterSpannerBeacon",
index 9fd9930f7de1aef560d0282f1860b99133fe398c..160ca72963237956987a1d7cc973c12a9b9c6b97 100644 (file)
@@ -217,6 +217,8 @@ Coherent_ligature_engraver::typeset_ligature (Spanner *ligature,
   collect_accidentals (ligature, primitives);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Coherent_ligature_engraver,
                /* descr */ "This is an abstract class.  Subclasses such as Gregorian_ligature_engraver handle ligatures by glueing special ligature heads together.",
                /* creats*/ "",
index 66813fb37ce70629dd7e0b374cd9be5e87b391a2..0c5b63b89cdb17942c89a52020816e13765ba94b 100644 (file)
@@ -19,14 +19,14 @@ class Collision_engraver : public Engraver
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 public:
   TRANSLATOR_DECLARATIONS (Collision_engraver);
 };
 
 void
-Collision_engraver::process_acknowledged_grobs ()
+Collision_engraver::process_acknowledged ()
 {
   if (col_ || note_columns_.size () < 2)
     return;
@@ -64,6 +64,8 @@ Collision_engraver::Collision_engraver ()
   col_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Collision_engraver,
                /* descr */ "Collect NoteColumns, and as soon as there are two or more, put them in a NoteCollision object.",
                /* creats*/ "NoteCollision",
index 88ca639052a112bd4cf57765ffc7ad4d2df9be7c..23ab662adc83a65d8693ea53a135ac9ccb81ba31 100644 (file)
@@ -65,10 +65,10 @@ public:
 
 protected:
   virtual void initialize ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual bool try_music (Music *req);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 void
@@ -312,6 +312,8 @@ Completion_heads_engraver::Completion_heads_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Completion_heads_engraver,
                /* descr */ "This engraver replaces "
                "@code{Note_heads_engraver}. It plays some trickery to "
index fc9466fb1a6beaf67b86a6c6f582ea6708b36727..43194b3cacecf0883b8992ec3496e2e24add42df 100644 (file)
@@ -293,21 +293,18 @@ filter_engravers (SCM ell)
 Context *
 Context_def::instantiate (SCM ops, Object_key const *key)
 {
-  Context *tg = 0;
+  Context *context = 0;
 
   if (context_name_ == ly_symbol2scm ("Score"))
-    tg = new Score_context (key);
+    context = new Score_context (key);
   else
-    tg = new Context (key);
+    context = new Context (key);
 
-  tg->definition_ = self_scm ();
+  context->definition_ = self_scm ();
 
   SCM trans_names = get_translator_names (ops);
 
-  Translator_group *g = dynamic_cast<Translator_group *>
-    (get_translator (translator_group_type_));
-  g = dynamic_cast<Translator_group *> (g->clone ());
-
+  Translator_group *g = get_translator_group (translator_group_type_);
   SCM trans_list = SCM_EOL;
 
   for (SCM s = trans_names; scm_is_pair (s); s = scm_cdr (s))
@@ -333,7 +330,7 @@ Context_def::instantiate (SCM ops, Object_key const *key)
              trans_list = scm_cons (str, trans_list);
            }
 
-         tr->daddy_context_ = tg;
+         tr->daddy_context_ = context;
          scm_gc_unprotect_object (str);
        }
     }
@@ -346,20 +343,20 @@ Context_def::instantiate (SCM ops, Object_key const *key)
 
   g->simple_trans_list_ = trans_list;
 
-  tg->implementation_ = g->self_scm ();
+  context->implementation_ = g->self_scm ();
   if (dynamic_cast<Engraver *> (g))
     g->simple_trans_list_ = filter_performers (g->simple_trans_list_);
   else if (dynamic_cast<Performer *> (g))
     g->simple_trans_list_ = filter_engravers (g->simple_trans_list_);
 
-  g->daddy_context_ = tg;
-  tg->aliases_ = context_aliases_;
+  g->context_ = context;
+  context->aliases_ = context_aliases_;
 
   scm_gc_unprotect_object (g->self_scm ());
 
-  tg->accepts_list_ = get_accepted (ops);
+  context->accepts_list_ = get_accepted (ops);
     
-  return tg;
+  return context;
 }
 
 SCM
index 15685b1c22c33c09142cc0020cea4b9767e90e02..5c0789943eee3a6cefd16d04e2e95e3f9988987c 100644 (file)
@@ -13,6 +13,7 @@
 #include "main.hh"
 #include "spanner.hh"
 #include "warn.hh"
+#include "paper-column.hh"
 
 /*
   Grob descriptions (ie. alists with layout properties) are
@@ -191,30 +192,51 @@ updated_grob_properties (Context *tg, SCM sym)
     }
 }
 
-Item *
-make_item_from_properties (Engraver *tr, SCM x, SCM cause, const char *name)
+Grob *
+make_grob_from_properties (Engraver *tr, SCM symbol, SCM cause, const char *name)
 {
   Context *context = tr->context ();
 
-  SCM props = updated_grob_properties (context, x);
+  SCM props = updated_grob_properties (context, symbol);
 
   Object_key const *key = context->get_grob_key (name);
-  Item *it = new Item (props, key);
-
-  dynamic_cast<Engraver *> (tr)->announce_grob (it, cause);
+  Grob *grob = 0;
+  
+  SCM handle = scm_sloppy_assq (ly_symbol2scm ("meta"), props);
+  SCM klass = scm_cdr (scm_sloppy_assq (ly_symbol2scm ("class"), scm_cdr (handle)));
+  
+  if (klass == ly_symbol2scm ("Item"))
+    grob = new Item (props, key);
+  else if (klass == ly_symbol2scm ("Spanner"))
+    grob = new Spanner (props, key);
+  else if (klass == ly_symbol2scm ("Paper_column"))
+    grob = new Paper_column (props, key);
+
+  assert (grob);
+  dynamic_cast<Engraver *> (tr)->announce_grob (grob, cause);
+
+  return grob;
+}
 
+Item *
+make_item_from_properties (Engraver *tr, SCM x, SCM cause, const char *name)
+{
+  Item *it = dynamic_cast<Item*> (make_grob_from_properties (tr, x, cause, name));
+  assert (it);
   return it;
 }
 
-Spanner *
-make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, const char *name)
+Paper_column *
+make_paper_column_from_properties (Engraver *tr, SCM x, const char *name)
 {
-  Context *context = tr->context ();
-
-  SCM props = updated_grob_properties (context, x);
-  Spanner *it = new Spanner (props, context->get_grob_key (name));
+  return dynamic_cast<Paper_column*> (make_grob_from_properties (tr, x, SCM_EOL, name));
+}
 
-  dynamic_cast<Engraver *> (tr)->announce_grob (it, cause);
 
-  return it;
+Spanner *
+make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, const char *name)
+{
+  Spanner* sp = dynamic_cast<Spanner*> (make_grob_from_properties (tr, x, cause, name));
+  assert (sp);
+  return sp;
 }
index 52b0b4332cc50698f093c0d4c1a750859139fb69..4efc562baf0ebec810dfb3cd246b27cd23b0417a 100644 (file)
@@ -36,7 +36,9 @@ Context::check_removal ()
       trg->check_removal ();
       if (trg->is_removable ())
        {
-         recurse_over_translators (trg, &Translator::finalize, UP);
+         recurse_over_translators (trg, &Translator::finalize,
+                                   &Translator_group::finalize,
+                                   UP);
          remove_context (trg);
        }
     }
@@ -72,7 +74,10 @@ Context::add_context (Context *t)
         operations require that we are in the hierarchy.  */
       td->apply_default_property_operations (t);
 
-      recurse_over_translators (t, &Translator::initialize, DOWN);
+      recurse_over_translators (t,
+                               &Translator::initialize,
+                               &Translator_group::initialize,
+                               DOWN);
     }
 }
 
@@ -485,10 +490,10 @@ Context::print_smob (SCM s, SCM port, scm_print_state *)
       scm_display (d->get_context_name (), port);
     }
 
-  if (Context *td = dynamic_cast<Context *> (sc))
+  if (!sc->id_string_.is_empty ())
     {
       scm_puts ("=", port);
-      scm_puts (td->id_string_.to_str0 (), port);
+      scm_puts (sc->id_string_.to_str0 (), port);
     }
 
   scm_puts (" ", port);
@@ -523,7 +528,7 @@ IMPLEMENT_TYPE_P (Context, "ly:context?");
 bool
 Context::try_music (Music *m)
 {
-  Translator *t = implementation ();
+  Translator_group *t = implementation ();
   if (!t)
     return false;
 
@@ -556,7 +561,7 @@ Context::get_parent_context () const
 Translator_group *
 Context::implementation () const
 {
-  return dynamic_cast<Translator_group *> (unsmob_translator (implementation_));
+  return dynamic_cast<Translator_group *> (unsmob_translator_group (implementation_));
 }
 
 void
@@ -572,3 +577,38 @@ Context::clear_key_disambiguations ()
       unsmob_context (scm_car (s))->clear_key_disambiguations ();
     }
 }
+
+
+/*
+  Ugh. Where to put this? 
+*/
+Rational
+measure_length (Context const *context)
+{
+  SCM l = context->get_property ("measureLength");
+  Rational length (1); 
+  if (unsmob_moment (l))
+    length = unsmob_moment (l)->main_part_;
+  return length;
+}
+
+Moment
+measure_position (Context const *context)
+{
+  SCM sm = context->get_property ("measurePosition");
+
+  Moment m = 0;
+  if (unsmob_moment (sm))
+    {
+      m = *unsmob_moment (sm);
+
+      if (m.main_part_ < Rational (0))
+       {
+         Rational length (measure_length (context));
+         while (m.main_part_ < Rational (0))
+           m.main_part_ += length;
+       }
+    }
+
+  return m;
+}
index 05532c117e05c3ec0a4e98350fd2d69abba47a75..4343d696f8a0afec1624300257c5fb556a96b6b1 100644 (file)
@@ -26,10 +26,10 @@ class Custos_engraver : public Engraver
 {
 public:
   TRANSLATOR_DECLARATIONS (Custos_engraver);
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
 
 private:
@@ -89,7 +89,7 @@ Custos_engraver::acknowledge_grob (Grob_info info)
 }
 
 void
-Custos_engraver::process_acknowledged_grobs ()
+Custos_engraver::process_acknowledged ()
 {
   if (scm_is_string (get_property ("whichBar")))
     custos_permitted = true;
@@ -133,6 +133,8 @@ Custos_engraver::finalize ()
   custodes_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Custos_engraver,
                /* descr */ "",
                /* creats*/ "Custos",
index ddbae5bf33f6bdd6cf2b71896348bc50d196ecc4..48b4500600b7d8b48507f61dd86614fc844d2fa6 100644 (file)
@@ -22,7 +22,7 @@ public:
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Dot_column_engraver::Dot_column_engraver ()
@@ -66,6 +66,8 @@ Dot_column_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Dot_column_engraver,
                /* descr */ "Engraves dots on dotted notes shifted to the right of the note.\n"
                "If omitted, then dots appear on top of the notes.",
index 69566653b2958eeff319253e93d410de3ad7bdc0..ec43a4373505da3043ce2435ec917350d1629b62 100644 (file)
@@ -19,6 +19,7 @@
 #include "side-position-interface.hh"
 #include "axis-group-interface.hh"
 #include "stem.hh"
+#include "pointer-group-interface.hh"
 
 /*
   TODO: let Dot_column communicate with stem via Note_column.
index f002607f355ff654fa6f9e3c62ecc7b45904837c..e88fd5e5303496f9775f3f4ad3a0a60916226fef 100644 (file)
@@ -27,9 +27,9 @@ public:
 
 protected:
   virtual bool try_music (Music *ev);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Drum_notes_engraver::Drum_notes_engraver ()
@@ -163,6 +163,8 @@ Drum_notes_engraver::stop_translation_timestep ()
   events_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Drum_notes_engraver,
                /* descr */ "Generate noteheads.",
                /* creats*/ "NoteHead Dots Script",
index f91331873591cbf6e91520f0cadb4995eca5b259..2556a291fa444e0c0119ca7ead1516e4a9e9ad8c 100644 (file)
@@ -21,7 +21,7 @@ public:
 
 protected:
   virtual bool try_music (Music *ev);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
 
 private:
@@ -29,6 +29,11 @@ private:
   Link_array<Audio_note> notes_;
 };
 
+
+Drum_note_performer::Drum_note_performer ()
+{
+}
+
 void
 Drum_note_performer::create_audio_elements ()
 {
@@ -85,10 +90,8 @@ Drum_note_performer::try_music (Music *ev)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Drum_note_performer,
                "Play drum notes.", "",
                "note-event busy-playing-event", "", "", "");
-
-Drum_note_performer::Drum_note_performer ()
-{
-}
index 2d56df20d3e8e036df27a29a3d0e0262f0b0a68f..97bafa4c00dd3e9b52926eb81876ebf8ebb1eae6 100644 (file)
@@ -20,6 +20,7 @@
 #include "staff-symbol-referencer.hh"
 #include "warn.hh"
 #include "self-alignment-interface.hh"
+#include "pointer-group-interface.hh"
 
 /*
   TODO:
@@ -62,8 +63,8 @@ protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Dynamic_engraver::Dynamic_engraver ()
@@ -424,6 +425,8 @@ Dynamic_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Dynamic_engraver,
                /* descr */
                "This engraver creates hairpins, dynamic texts, and their vertical\n"
index 3fda6d4dbe37959d42d1d54f3b45ef5eb0e0a4dc..b264e72edd6fe84cb7a0ec09e7603b0886f66ba8 100644 (file)
@@ -24,7 +24,7 @@ public:
   TRANSLATOR_DECLARATIONS (Dynamic_performer);
 protected:
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
 
 private:
@@ -125,6 +125,8 @@ Dynamic_performer::try_music (Music *r)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Dynamic_performer,
                /*descr*/                "",
                /* creats*/ "",
index d68e0579c15e4d0e2918e36a45f3b304666bf9e4..ae3000aebfab989740fc651158cd01322c1d348b 100644 (file)
@@ -18,7 +18,13 @@ void
 Engraver_group_engraver::announce_grob (Grob_info info)
 {
   announce_infos_.push (info);
-  get_daddy_engraver ()->announce_grob (info);
+
+  Engraver_group_engraver * dad_eng =
+    context_->get_parent_context ()
+    ? dynamic_cast<Engraver_group_engraver*> (context_->get_parent_context ()->implementation ())
+    : 0;
+  if (dad_eng)
+    dad_eng->announce_grob (info);
 }
 
 SCM find_acknowledge_engravers (SCM gravlist, SCM meta);
@@ -30,7 +36,7 @@ Engraver_group_engraver::acknowledge_grobs ()
   if (!announce_infos_.size ())
     return;
 
-  SCM tab = get_property ("acknowledgeHashTable");
+  SCM tab = context_->get_property ("acknowledgeHashTable");
   SCM name_sym = ly_symbol2scm ("name");
   SCM meta_sym = ly_symbol2scm ("meta");
 
@@ -59,7 +65,7 @@ Engraver_group_engraver::acknowledge_grobs ()
       SCM acklist = scm_hashq_ref (tab, nm, SCM_UNDEFINED);
       if (acklist == SCM_BOOL_F)
        {
-         acklist = find_acknowledge_engravers (scm_cons (self_scm (), get_simple_trans_list ()), meta);
+         acklist = find_acknowledge_engravers (get_simple_trans_list (), meta);
          scm_hashq_set_x (tab, nm, acklist);
        }
 
@@ -81,7 +87,7 @@ int
 Engraver_group_engraver::pending_grob_count () const
 {
   int count = announce_infos_.size ();
-  for (SCM s = context ()->children_contexts ();
+  for (SCM s = context_->children_contexts ();
        scm_is_pair (s); s = scm_cdr (s))
     {
       Context *c = unsmob_context (scm_car (s));
@@ -111,9 +117,7 @@ Engraver_group_engraver::do_announces ()
 
       while (1)
        {
-         engraver_each (get_simple_trans_list (),
-                        &Engraver::process_acknowledged_grobs);
-
+         precomputed_translator_foreach (PROCESS_ACKNOWLEDGED);
          if (announce_infos_.size () == 0)
            break;
 
@@ -133,17 +137,20 @@ Engraver_group_engraver::initialize ()
   Translator_group::initialize ();
 }
 
-Engraver_group_engraver::Engraver_group_engraver () {}
+Engraver_group_engraver::Engraver_group_engraver ()
+{
+}
 
-ADD_TRANSLATOR (Engraver_group_engraver,
-               /* descr */ "A group of engravers taken together",
-               /* creats*/ "",
-               /* accepts */ "",
-               /* acks  */ "",
-               /* reads */ "",
-               /* write */ "");
+#include "translator.icc"
+
+ADD_TRANSLATOR_GROUP (Engraver_group_engraver,
+                     /* descr */ "A group of engravers taken together",
+                     /* creats*/ "",
+                     /* accepts */ "",
+                     /* acks  */ "",
+                     /* reads */ "",
+                     /* write */ "");
 
-/*****************/
 
 bool
 engraver_valid (Translator *tr, SCM ifaces)
@@ -172,43 +179,3 @@ find_acknowledge_engravers (SCM gravlist, SCM meta_alist)
 
   return l;
 }
-
-/* 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 *> (c->implementation ());
-
-  if (!context_first)
-    {
-      engraver_each (tg->get_simple_trans_list (),
-                    ptr);
-
-      (tg->*ptr) ();
-    }
-
-  for (SCM s = c->children_contexts (); scm_is_pair (s);
-       s = scm_cdr (s))
-    {
-      recurse_down_engravers (unsmob_context (scm_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; scm_is_pair (p); p = scm_cdr (p))
-    {
-      Engraver *e = dynamic_cast<Engraver *> (unsmob_translator (scm_car (p)));
-      if (e)
-       (e->*method) ();
-    }
-}
index b7bc326c1506e23763cce11847ed3c1c94f6f815..b1a11fcd3a1cab2d9675588b78a33d201a8cf35c 100644 (file)
@@ -41,7 +41,7 @@ Engraver::announce_grob (Grob *e, SCM cause)
 
   Grob_info i (this, e);
 
-  Engraver *g = get_daddy_engraver ();
+  Engraver_group_engraver *g = get_daddy_engraver ();
   if (g)
     g->announce_grob (i);
 }
@@ -56,6 +56,8 @@ Engraver::get_score_engraver () const
   return dynamic_cast<Score_engraver *> (get_score_context ()->implementation ());
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Engraver,
                "", "",
                "",
index e3fc6914d1951622b291761c8442e9b12e7887f2..f44460530d373a9fa998a863e1757a3214bc823e 100644 (file)
@@ -31,8 +31,8 @@ protected:
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Extender_engraver::Extender_engraver ()
@@ -148,6 +148,8 @@ Extender_engraver::finalize ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Extender_engraver,
                /* descr */ "Create lyric extenders",
                /* creats*/ "LyricExtender",
index a15b12c3e8f35846ad1b220eeac06134e7ae5f5e..daddfaf972123e78eda9f4178c8066bbb71a32a7 100644 (file)
@@ -21,8 +21,8 @@ protected:
   Grob *figure_;
 
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Figured_bass_engraver::Figured_bass_engraver ()
@@ -83,6 +83,8 @@ Figured_bass_engraver::process_music ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Figured_bass_engraver,
                /* descr */ "Make figured bass numbers.",
                /* creats*/ "BassFigure",
index 73e78489fe13fd0d33ad3761d9412e5127e62b31..c2db873a77ef88ef89bd0d400b33068c4e8c53d2 100644 (file)
@@ -23,9 +23,9 @@ public:
   TRANSLATOR_DECLARATIONS (Fingering_engraver);
 protected:
   virtual bool try_music (Music *m);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 
 private:
@@ -143,6 +143,8 @@ Fingering_engraver::Fingering_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Fingering_engraver,
                /* descr */ "Create fingering-scripts",
                /* creats*/ "Fingering",
index d1ac0e634b5cbce42ec98a4dcb02707b3836ac0e..762226f2c997d4f4361ee2f50a231f742326bcb8 100644 (file)
@@ -42,6 +42,8 @@ Font_size_engraver::acknowledge_grob (Grob_info gi)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Font_size_engraver,
                /* descr */ "Puts fontSize into font-relative-size grob property.",
                /* creats*/ "",
index 474188706081d40ea990535a156416fd0c5d1109..c51e0b0ff5d8ad702eb5b44a357a5bc87fdbe8f4 100644 (file)
@@ -17,7 +17,7 @@ class Forbid_line_break_engraver : public Engraver
 {
 public:
   TRANSLATOR_DECLARATIONS (Forbid_line_break_engraver);
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 };
 
 Forbid_line_break_engraver::Forbid_line_break_engraver (){}
@@ -45,6 +45,8 @@ Forbid_line_break_engraver::start_translation_timestep ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Forbid_line_break_engraver,
                /* descr */ "Forbid line breaks when note heads are still playing at some point.",
                /* creats*/ "",
index c1288efaf352a7c6aa9e6572efb8947e4e3af56a..0ad3384bfa5bf48cffd600c59f5498922ee5a226 100644 (file)
@@ -23,9 +23,9 @@ public:
 protected:
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 private:
   Spanner *line_;
   Spanner *last_line_;
@@ -106,6 +106,8 @@ Glissando_engraver::finalize ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Glissando_engraver,
                /* descr */ "Engrave a glissandi",
                /* creats*/ "Glissando",
index 10b08cd1d6645552cf9ffb6d09a7c22fc727745a..25fe3dedecb59c8fd4672ef75822f2d721db2ea5 100644 (file)
@@ -14,7 +14,7 @@ class Grace_engraver : public Engraver
 {
   void consider_change_grace_settings ();
 protected:
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void derived_mark () const;
   virtual void initialize (); 
 
@@ -105,6 +105,8 @@ Grace_engraver::start_translation_timestep ()
   consider_change_grace_settings ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Grace_engraver,
                /* descr */ "Set font size and other properties for grace notes.",
                /* creats*/ "",
index 4840904b8edf60635c5ce2029e8cea2602c7d29c..b6f65b9fa8be444e966dcc375b9f1f3b06832b70 100644 (file)
@@ -273,6 +273,8 @@ Gregorian_ligature_engraver::stop_translation_timestep ()
   pes_or_flexa_req_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Gregorian_ligature_engraver,
                /* descr */ "This is an abstract class.  Subclasses such as Vaticana_ligature_engraver handle ligatures by glueing special ligature heads together.",
                /* creats*/ "",
index 5ad0bed8a0b2b8acba8aeddb13fb8dcc8925984e..9a49bdf58e29afdc078a952577a662ebbdc2d528 100644 (file)
@@ -20,7 +20,7 @@ public:
   TRANSLATOR_DECLARATIONS (Grid_line_span_engraver);
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Grid_line_span_engraver::Grid_line_span_engraver ()
@@ -58,6 +58,8 @@ Grid_line_span_engraver::stop_translation_timestep ()
   lines_.set_size (0);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Grid_line_span_engraver,
                /* descr */ "This engraver makes cross-staff linelines: It catches all normal "
                "line lines, and draws a single span-line across them.",
index d7e019b70bafa18aefebd8bf8a5f108f9fa0efab..e28c30fbee90a2ecf84000729ba9de7a1d504978 100644 (file)
@@ -16,7 +16,7 @@ class Grid_point_engraver : public Engraver
 public:
   TRANSLATOR_DECLARATIONS (Grid_point_engraver);
 protected:
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 void
@@ -38,6 +38,8 @@ Grid_point_engraver::Grid_point_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Grid_point_engraver,
                /* descr */ "generate grid points.",
                /* creats*/ "GridPoint",
index 542880c184d6808d185e9ae82a692440add911a0..08def8d83be11d20ffbf08fc4c42bfada4c9d42e 100644 (file)
@@ -18,8 +18,8 @@ public:
 protected:
   virtual void initialize ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void start_translation_timestep ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Grob_pq_engraver::Grob_pq_engraver ()
@@ -109,6 +109,8 @@ Grob_pq_engraver::start_translation_timestep ()
     context ()->set_property ("busyGrobs", busy);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Grob_pq_engraver,
 
                /* descr */ "Administrate when certain grobs (eg. note heads) stop playing; this \
index 343bdb08c84c3ad28a1c29af3bd9c7b9d15115fe..d6a28d48874d79d6e42868166ad1b60160211696 100644 (file)
@@ -18,7 +18,7 @@ protected:
   virtual Spanner *get_spanner ();
   virtual void acknowledge_grob (Grob_info);
   virtual void add_element (Grob *e);
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 
   SCM interesting_;
 public:
@@ -66,6 +66,8 @@ Hara_kiri_engraver::Hara_kiri_engraver ()
   interesting_ = SCM_EOL;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Hara_kiri_engraver,
                /* descr */ "Like Axis_group_engraver, but make a hara-kiri spanner, and add "
                "interesting items (ie. note heads, lyric syllables and normal rests) ",
index accfe9c3b9a53f9d30d541ffe9a6cb68ff7437ca..eac63e509335e3f7d51723f019bf24ba97c550f3 100644 (file)
@@ -9,6 +9,7 @@
 
 #include "hara-kiri-group-spanner.hh"
 
+#include "pointer-group-interface.hh"
 #include "axis-group-interface.hh"
 #include "spanner.hh"
 #include "warn.hh"
index 9614c0f3773307bb11be049325d3b8d0a202822d..0a4a388fb9e3590dfd6867c700ddd2d78cc2e677 100644 (file)
@@ -22,11 +22,13 @@ public:
   int push_count_;
 
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 };
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Horizontal_bracket_engraver,
                "Create horizontal brackets over notes for musical analysis purposes.",
                "HorizontalBracket",
index 29857100fa5d3e701a5f85123f5175bd3e8c6132..0e826430df73533a351a75dc8be3c9e961a4c78a 100644 (file)
@@ -27,8 +27,8 @@ protected:
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 private:
 };
 
@@ -136,6 +136,8 @@ Hyphen_engraver::stop_translation_timestep ()
   ev_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Hyphen_engraver,
                /* descr */ "Create lyric hyphens",
                /* creats*/ "LyricHyphen",
index 835762d320a6921b0d40355198f9da0cdd7652b9..b5eac587dbd84b7632a694e918b519ae51f75f30 100644 (file)
@@ -21,7 +21,8 @@ public:
   static bool has_interface (Grob *);
 
   static String get_fontcharname (String style, int alteration);
-  static Array<Box> Accidental_interface::accurate_boxes (Grob *me, Grob **common);
+  static Array<Box> Accidental_interface::accurate_boxes (Grob *me,
+                                                         Grob **common);
 };
 
 #endif
index b7dbd62719563cc109322a9cf97494828fecee45..131c6663d67d851d37d7663a90622fa6c04b07e9 100644 (file)
@@ -21,10 +21,10 @@ class Axis_group_engraver : public Engraver
 protected:
   Spanner *staffline_;
   Link_array<Grob> elts_;
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
   virtual Spanner *get_spanner ();
   virtual void add_element (Grob *);
 public:
index 5a220237bef1334730a18c3b7cde1dab8efeee4d..75a5a2aa56b72f75c0f071018561e4a4eae86ef9 100644 (file)
@@ -9,7 +9,8 @@
 #ifndef AXIS_GROUP_INTERFACE_HH
 #define AXIS_GROUP_INTERFACE_HH
 
-#include "pointer-group-interface.hh"
+#include "lily-proto.hh"
+#include "lily-guile.hh"
 
 /**
  */
index 07299a166c735d70419328d7b0c0602d5737f177..de4f346fdc72a1d5df2d996323e9a1ab733e51b4 100644 (file)
@@ -110,5 +110,8 @@ Grob *get_current_note_head (Context *voice);
 Grob *get_current_rest (Context *voice);
 DECLARE_UNSMOB (Context, context);
 
+Moment measure_position (Context const *context);
+Rational measure_length (Context const *context);
+
 #endif /* CONTEXT_HH */
 
index 63b126eabfdce6a1a2955e54535b1916f36f5e65..e235b9673194ac15dfbf666c1e86d2757fd183d3 100644 (file)
 #include "engraver.hh"
 #include "translator-group.hh"
 
-class Engraver_group_engraver : public virtual Engraver,
-                               public virtual Translator_group
+class Engraver_group_engraver : public virtual Translator_group
 {
 protected:
   Array<Grob_info> announce_infos_;
 
 public:
-  TRANSLATOR_DECLARATIONS (Engraver_group_engraver);
+  VIRTUAL_COPY_CONSTRUCTOR ( Translator_group, Engraver_group_engraver);
+  Engraver_group_engraver ();
 
   virtual void initialize ();
-  virtual void do_announces ();
+  PRECOMPUTED_VIRTUAL void do_announces ();
   virtual void announce_grob (Grob_info);
-
   int pending_grob_count () const;
 private:
   virtual void acknowledge_grobs ();
index b3335bab4158335f9f0ee2351e178fbc7f163d7f..54e4f287769303f64332105f98034495bbaf9133 100644 (file)
@@ -17,7 +17,7 @@
    a struct which processes events, and creates the #Grob#s.
    It may use derived classes.
 */
-class Engraver : public virtual Translator
+class Engraver : public Translator
 {
 
   friend class Engraver_group_engraver;
@@ -29,13 +29,6 @@ protected:
     Default: ignore the info
   */
   virtual void acknowledge_grob (Grob_info) {}
-
-  /** Do things with stuff found in acknowledge_grob. Ugh. Should
-      be looped with acknowledge_grob.
-
-  */
-  virtual void process_acknowledged_grobs () {}
-
   virtual void announce_grob (Grob_info);
   Engraver_group_engraver *get_daddy_engraver () const;
 
@@ -54,7 +47,9 @@ public:
 
 #define make_item(x, cause) make_item_from_properties (this, ly_symbol2scm (x), cause, x)
 #define make_spanner(x, cause) make_spanner_from_properties (this, ly_symbol2scm (x), cause, x)
+#define make_paper_column(x) make_paper_column_from_properties (this, ly_symbol2scm (x), x)
 Item *make_item_from_properties (Engraver *tg, SCM x, SCM cause, const char *name);
 Spanner *make_spanner_from_properties (Engraver *tg, SCM x, SCM cause, const char *name);
+Paper_column *make_paper_column_from_properties (Engraver *tg, SCM x, const char *name);
 
 #endif // ENGRAVER_HH
index 5ac0dd4e91e36c0c7e0cd953a449f7ac4cc57608..ab76c345e5673fb68be7b666a8d75cecef89e7dd 100644 (file)
@@ -22,7 +22,7 @@ protected:
   virtual void build_ligature (Spanner *ligature, Array<Grob_info> primitives);
   virtual void transform_heads (Spanner *ligature,
                                Array<Grob_info> primitives); /* abstract method */
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 #endif // GREGORIAN_LIGATURE_ENGRAVER_HH
index a7e32816ffb8457285ce2d1a3c7fc1e5191af281..3b6f6c8c931de6edf8ae02c71145f3f11148632b 100644 (file)
 class Ligature_engraver : public Engraver
 {
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
 
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual Spanner *create_ligature_spanner (); /* abstract method */
   virtual void typeset_ligature (Spanner *ligature,
                                 Array<Grob_info> primitives); /* abstract method */
diff --git a/lily/include/paper-column-engraver.hh b/lily/include/paper-column-engraver.hh
new file mode 100644 (file)
index 0000000..fce6782
--- /dev/null
@@ -0,0 +1,46 @@
+/*
+  paper-column-engraver.hh -- declare Paper_column_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef PAPER_COLUMN_ENGRAVER_HH
+#define PAPER_COLUMN_ENGRAVER_HH
+
+
+#include "engraver.hh"
+
+
+class Paper_column_engraver : public Engraver
+{
+  void make_columns ();
+  void set_columns (Paper_column*, Paper_column*); 
+  TRANSLATOR_DECLARATIONS(Paper_column_engraver);
+
+protected:
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  virtual void initialize ();
+  virtual void finalize ();
+  virtual bool try_music (Music*);
+  virtual void acknowledge_grob (Grob_info);
+
+  System *system_;
+  Music *break_event_;
+  int breaks_;                 // used for stat printing
+  Paper_column *command_column_;
+  Paper_column *musical_column_;
+  Link_array<Item> items_;
+  bool first_;
+  Moment last_moment_;
+public:
+  // ug.h 
+  void forbid_breaks ();
+
+};
+
+#endif /* PAPER_COLUMN_ENGRAVER_HH */
index 52939cf9ea4f948a66a91f72fdf36849dccb4345..afaeb96c49d7efbdd4a949e7fb637301810b40e2 100644 (file)
 
 typedef void (Performer:: *Performer_method) (void);
 
-class Performer_group_performer : public Performer, public virtual Translator_group
+class Performer_group_performer : public virtual Translator_group
 {
 public:
-  TRANSLATOR_DECLARATIONS (Performer_group_performer);
+  VIRTUAL_COPY_CONSTRUCTOR (Translator_group,Performer_group_performer);
 
-  virtual void do_announces ();
+  PRECOMPUTED_VIRTUAL void do_announces ();
   virtual void announce_element (Audio_element_info);
+  virtual void play_element (Audio_element *p);
+  virtual int get_tempo () const;
+  
 protected:
   Array<Audio_element_info> announce_infos_;
 
index 9d224cc460b1d9a6ac789125f6cebbc6af9b956e..0473d1c181d9ed00fc1ba35b0ee815d3882f141a 100644 (file)
@@ -14,7 +14,7 @@
 
 /* Convert a music definition into a audio representation.
    A baseclass.  */
-class Performer : public virtual Translator
+class Performer : public Translator
 {
 public:
   VIRTUAL_COPY_CONSTRUCTOR (Translator, Performer);
diff --git a/lily/include/recording-group-engraver.hh b/lily/include/recording-group-engraver.hh
new file mode 100644 (file)
index 0000000..efb77d9
--- /dev/null
@@ -0,0 +1,31 @@
+/*
+  recording-group-engraver.hh -- declare
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef RECORDING_GROUP_ENGRAVER_HH
+#define RECORDING_GROUP_ENGRAVER_HH
+
+
+#include "engraver-group-engraver.hh"
+
+class Recording_group_engraver : public Engraver_group_engraver
+{
+public:
+  VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Recording_group_engraver);
+  virtual bool try_music (Music *m);
+  void add_music (SCM, SCM);
+  Recording_group_engraver ();
+  virtual void stop_translation_timestep ();
+  virtual void finalize ();
+  virtual void derived_mark () const;
+  virtual void fetch_precomputable_methods (Translator_group_void_method ptrs[]);
+
+  SCM now_events_;
+  SCM accumulator_;
+};
+#endif /* RECORDING_GROUP_ENGRAVER_HH */
index 6286759fee6404bb9b66f2491674111cb5db10a0..c045994d5b138e330aa3eeab604424946f5a441f 100644 (file)
@@ -16,16 +16,12 @@ class Score_engraver : public virtual Score_translator,
                       public virtual Engraver_group_engraver
 {
   System *system_;
-  int breaks_;                 // used for stat printing
 
   Link_array<Grob> elems_;
-  Paper_column *command_column_;
-  Paper_column *musical_column_;
   Paper_score *pscore_;
 
-  void make_columns ();
-  void set_columns (Paper_column *, Paper_column *);
   void typeset_all ();
+
 protected:
   /* Score_translator */
   virtual void finish ();
@@ -34,19 +30,19 @@ protected:
 
   
   /* Engraver_group_engraver interface */
-  virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
   virtual void initialize ();
   virtual void finalize ();
   virtual void announce_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
   /*
     Translator interface
    */
   virtual void derived_mark () const;
+
 public:
-  TRANSLATOR_DECLARATIONS (Score_engraver);
+  Score_engraver ();
   void forbid_breaks ();
   virtual SCM get_output ();
 };
index cd3ebefa6904a39cebb936cbc9fa9d3cccdd45a3..953127e1328d925e6e8c45f0d53da16cd4a26896 100644 (file)
 class Score_performer : public Score_translator, public virtual Performer_group_performer
 {
 public:
-  TRANSLATOR_DECLARATIONS (Score_performer);
+  VIRTUAL_COPY_CONSTRUCTOR (Translator_group,Score_performer);
   ~Score_performer ();
   Performance *performance_;
 
+  Score_performer ();
 protected:
   virtual void prepare (Moment mom);
   virtual void finish ();
index c588882071d9f03afbe924b01d04ba6578925f70..7a67ca78519b1d4732461f5d07c3899f0738f589 100644 (file)
@@ -30,12 +30,12 @@ protected:
   virtual void start_spanner ();
   virtual void stop_spanner ();
 
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
   virtual ~Staff_symbol_engraver ();
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 #endif /* STAFF_SYMBOL_ENGRAVER_HH */
index f58489ea48328f38a44706a0c14fe62d81959261..0477c16e4501565f59046671506ce01f7d911788 100644 (file)
 
 #include "parray.hh"
 
-class Timing_translator : public virtual Translator
+class Timing_translator : public Translator
 {
 public:
   TRANSLATOR_DECLARATIONS (Timing_translator);
 
 protected:
   virtual void initialize ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 
 public:
-  Moment measure_position () const;
   Rational measure_length () const;
 };
+
+
 #endif // TIMING_TRANSLATOR_HH
index ed33f010e5b19ae287ea36c8877e63b4f3e22b33..5f8a93ab3ec45a99b8cd992513fe9bef5432851a 100644 (file)
@@ -9,32 +9,83 @@
 #ifndef TRANSLATOR_GROUP_HH
 #define TRANSLATOR_GROUP_HH
 
-
-
 #include "translator.hh"
 #include "parray.hh"
 
 typedef void (Translator:: *Translator_method) (void);
+typedef void (Translator_group:: *Translator_group_method) (void);
+typedef void (*Translator_group_void_method)(Translator_group*);
 
-class Translator_group : public virtual Translator
+struct Translator_method_binding
 {
+  Translator *translator_;
+  Translator_void_method_ptr method_;
+  
+  Translator_method_binding()
+  {
+  }
+  Translator_method_binding (Translator*tr, Translator_void_method_ptr ptr)
+  {
+    translator_ = tr;
+    method_ = ptr;
+  }
+  void invoke ()
+  {
+    if (method_)
+      (*method_)(translator_);
+  }
+};
+
+
+class Translator_group
+{
+private:
+  void precompute_method_bindings ();
+  Array<Translator_method_binding>
+    precomputed_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
+
+  Translator_group_void_method
+    precomputed_self_method_bindings_[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
+
+public:
+  VIRTUAL_COPY_CONSTRUCTOR (Translator_group, Translator_group);
+  DECLARE_SMOBS (Translator_group, dummy);
+  
 public:
-  VIRTUAL_COPY_CONSTRUCTOR (Translator, Translator_group);
   virtual Translator_group *get_daddy_translator ()const;
   virtual SCM get_simple_trans_list ();
   virtual bool try_music (Music *req);
   virtual void initialize ();
+  virtual void finalize ();
+
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  
+  virtual void fetch_precomputable_methods (Translator_group_void_method[]);
+  
   Translator_group ();
 
+  void precomputed_translator_foreach (Translator_precompute_index);
+  void call_precomputed_self_method (Translator_precompute_index);
+  
+
+  Context * context () const { return context_; }
 protected:
   SCM simple_trans_list_;
-
+  Context *context_;
+  
   friend class Context_def;
   virtual void derived_mark () const;
 };
 
 SCM names_to_translators (SCM namelist, Context *tg);
-void recurse_over_translators (Context *c, Translator_method ptr, Direction);
-void translator_each (SCM list, Translator_method method);
+void recurse_over_translators (Context *c, Translator_method ptr,
+                              Translator_group_method ptr2, Direction);
+void precomputed_recurse_over_translators (Context *c, Translator_precompute_index idx, Direction dir);
+Translator_group *get_translator_group (SCM sym);
+
+#define ADD_TRANSLATOR_GROUP(classname, desc, grobs, accepted, acked, read, write) \
+
+DECLARE_UNSMOB (Translator_group, translator_group);
 
 #endif // TRANSLATOR_GROUP_HH
index 7d965e4b5a4631517184f7b6a56343356d993131..351149548c3cf4d79e997bca9b65625c9786ee65 100644 (file)
 #include "input.hh"
 #include "smobs.hh"
 
-/* copied from lily-guile.hh */
-#ifndef get_property
-#define get_property(x) internal_get_property (ly_symbol2scm (x))
-#endif
 
+
+typedef void (*Translator_void_method_ptr)(Translator*);
+
+#define DECLARE_STATIC_METHOD(x) static void x ## _static (Translator*)
 #define TRANSLATOR_DECLARATIONS(NAME)                  \
   public:                                              \
+    DECLARE_STATIC_METHOD(start_translation_timestep); \
+    DECLARE_STATIC_METHOD(stop_translation_timestep);  \
+    DECLARE_STATIC_METHOD(process_music);              \
+    DECLARE_STATIC_METHOD(process_acknowledged);       \
   NAME ();                                             \
   VIRTUAL_COPY_CONSTRUCTOR (Translator, NAME);         \
   static SCM static_description_;                      \
+  virtual void fetch_precomputable_methods (Translator_void_method_ptr methods[]);\
   virtual SCM static_translator_description () const;  \
   virtual SCM translator_description () const;
 
+
+enum Translator_precompute_index {
+  START_TRANSLATION_TIMESTEP,
+  STOP_TRANSLATION_TIMESTEP,
+  PROCESS_MUSIC,
+  PROCESS_ACKNOWLEDGED,
+  TRANSLATOR_METHOD_PRECOMPUTE_COUNT,
+};
+
+/* nothing */
+#define PRECOMPUTED_VIRTUAL 
+
+
 /*
   Translate music into grobs.
 */
@@ -51,14 +69,17 @@ public:
   virtual Output_def *get_output_def () const;
   virtual Translator_group *get_daddy_translator ()const;
   virtual Moment now_mom () const;
+  
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
   virtual void initialize ();
-  virtual void process_music ();
-  virtual void do_announces ();
   virtual void finalize ();
 
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+
+  
   Score_context *get_score_context () const;
   Global_context *get_global_context () const;
 
@@ -71,54 +92,6 @@ protected:                   // should be private.
   friend class Context_def;
   friend class Context;
 };
-
-/**
-   A macro to automate administration of translators.
-*/
-#define ADD_THIS_TRANSLATOR(T)                                         \
-  SCM T::static_description_ = SCM_EOL;                                        \
-  static void _ ## T ## _adder ()                                      \
-  {                                                                    \
-    T *t = new T;                                                      \
-    T::static_description_ = t->static_translator_description ();      \
-    scm_permanent_object (T::static_description_);                     \
-    add_translator (t);                                                        \
-  }                                                                    \
-  SCM T::translator_description () const                               \
-  {                                                                    \
-    return static_description_;                                                \
-  }                                                                    \
-  ADD_GLOBAL_CTOR (_ ## T ## _adder);
-
-#define ADD_TRANSLATOR(classname, desc, grobs, accepted, acked, read, write) \
-  ADD_THIS_TRANSLATOR (classname);                                     \
-  SCM                                                                  \
-  classname::static_translator_description () const                    \
-  {                                                                    \
-    SCM static_properties = SCM_EOL;                                   \
-    /*  static_properties = acons (name , gh_str02scm (Translator::name (self_scm ())),        \
-       static_properties_);                                            \
-    */                                                                 \
-    static_properties = scm_acons (ly_symbol2scm ("grobs-created"),    \
-                                  parse_symbol_list (grobs), static_properties); \
-                                                                       \
-    static_properties = scm_acons (ly_symbol2scm ("description"),      \
-                                  scm_makfrom0str (desc), static_properties); \
-                                                                       \
-    static_properties = scm_acons (ly_symbol2scm ("interfaces-acked"), \
-                                  parse_symbol_list (acked), static_properties); \
-    static_properties = scm_acons (ly_symbol2scm ("events-accepted"),  \
-                                  parse_symbol_list (accepted), static_properties); \
-                                                                       \
-    static_properties = scm_acons (ly_symbol2scm ("properties-read"),  \
-                                  parse_symbol_list (read), static_properties); \
-                                                                       \
-    static_properties = scm_acons (ly_symbol2scm ("properties-written"), \
-                                  parse_symbol_list (write), static_properties); \
-                                                                       \
-    return static_properties;                                          \
-  }
-
 void add_translator (Translator *trans);
 
 Translator *get_translator (SCM s);
diff --git a/lily/include/translator.icc b/lily/include/translator.icc
new file mode 100644 (file)
index 0000000..5bffbf8
--- /dev/null
@@ -0,0 +1,109 @@
+/*
+  translator.icc -- declare Translator glue wiring.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#ifndef TRANSLATOR_ICC
+#define TRANSLATOR_ICC
+
+/**
+   A macro to automate administration of translators.
+*/
+#define ADD_THIS_TRANSLATOR(T)                                         \
+  SCM T::static_description_ = SCM_EOL;                                        \
+  static void _ ## T ## _adder ()                                      \
+  {                                                                    \
+    T *t = new T;                                                      \
+    T::static_description_ = t->static_translator_description ();      \
+    scm_permanent_object (T::static_description_);                     \
+    add_translator (t);                                                        \
+  }                                                                    \
+  SCM T::translator_description () const                               \
+  {                                                                    \
+    return static_description_;                                                \
+  }                                                                    \
+  ADD_GLOBAL_CTOR (_ ## T ## _adder);
+
+#define ADD_TRANSLATOR(classname, desc, grobs, accepted, acked, read, write) \
+  DEFINE_STATIC_METHODS(classname);\
+  IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(classname); \
+  ADD_THIS_TRANSLATOR (classname);                                     \
+  SCM                                                                  \
+  classname::static_translator_description () const                    \
+  {                                                                    \
+    SCM static_properties = SCM_EOL;                                   \
+    /*  static_properties = acons (name , gh_str02scm (Translator::name (self_scm ())),        \
+       static_properties_);                                            \
+    */                                                                 \
+    static_properties = scm_acons (ly_symbol2scm ("grobs-created"),    \
+                                  parse_symbol_list (grobs), static_properties); \
+                                                                       \
+    static_properties = scm_acons (ly_symbol2scm ("description"),      \
+                                  scm_makfrom0str (desc), static_properties); \
+                                                                       \
+    static_properties = scm_acons (ly_symbol2scm ("interfaces-acked"), \
+                                  parse_symbol_list (acked), static_properties); \
+    static_properties = scm_acons (ly_symbol2scm ("events-accepted"),  \
+                                  parse_symbol_list (accepted), static_properties); \
+                                                                       \
+    static_properties = scm_acons (ly_symbol2scm ("properties-read"),  \
+                                  parse_symbol_list (read), static_properties); \
+                                                                       \
+    static_properties = scm_acons (ly_symbol2scm ("properties-written"), \
+                                  parse_symbol_list (write), static_properties); \
+                                                                       \
+    return static_properties;                                          \
+  }
+
+
+/*
+  FIXME: should be able to cast statically to (T*) -iow.- remove
+  Translator as a virtual base class.
+ */
+#define DEFINE_STATIC_METHOD(T, x) \
+void \
+T::x ## _static (Translator* tr) \
+{ \
+  T * t_ptr = (T*) (tr);       \
+  t_ptr->x ();\
+}
+
+#define DEFINE_STATIC_METHODS(T) \
+  DEFINE_STATIC_METHOD(T,start_translation_timestep)\
+  DEFINE_STATIC_METHOD(T,stop_translation_timestep)\
+  DEFINE_STATIC_METHOD(T,process_music)\
+  DEFINE_STATIC_METHOD(T,process_acknowledged)
+
+#define IMPLEMENT_FETCH_PRECOMPUTABLE_METHODS(T) \
+void \
+T::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])\
+{                                                                      \
+  ptrs[START_TRANSLATION_TIMESTEP] =                                   \
+    ((Translator_void_method_ptr) &T::start_translation_timestep == \
+     (Translator_void_method_ptr) &Translator::start_translation_timestep)     \
+    ? 0                                                                        \
+    : &T::start_translation_timestep_static;                           \
+                                                                       \
+  ptrs[STOP_TRANSLATION_TIMESTEP] =                                    \
+    ((Translator_void_method_ptr) &T::stop_translation_timestep == (Translator_void_method_ptr) &Translator::stop_translation_timestep) \
+    ? 0                                                                        \
+    : &T::stop_translation_timestep_static;                            \
+                                                                       \
+  ptrs[PROCESS_MUSIC] =                                                        \
+    ((Translator_void_method_ptr) &T::process_music == (Translator_void_method_ptr) &Translator::process_music)                        \
+    ? 0                                                                        \
+    : &T::process_music_static;                                                \
+                                                                       \
+  ptrs[PROCESS_ACKNOWLEDGED] =                                         \
+    ((Translator_void_method_ptr) &T::process_acknowledged == (Translator_void_method_ptr) &Translator::process_acknowledged)  \
+    ? 0                                                                        \
+    : &T::process_acknowledged_static;                                         \
+}
+
+
+#endif /* TRANSLATOR_ICC */
+
index 700bef1f56f8d967d0d831823c5b5a6056f19d93..8b612f2a7eea84dd6ff5c00fd2dc47c85cd8eed2 100644 (file)
@@ -14,7 +14,7 @@
 /** eat a certain type of event
     (Duh, it's good for your skin)
 */
-class Type_swallow_translator : public virtual Translator
+class Type_swallow_translator : public Translator
 {
 protected:
   String swallow_string_;
index 8ded1dabca55aec1579f4d7d5abfa1cf91d75077..f1182ea8b62123c5aa3e78f82bbd6a0a430858ed 100644 (file)
@@ -28,8 +28,8 @@ protected:
   virtual void create_text ();
   virtual void initialize ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   
 };
 
@@ -129,6 +129,8 @@ Instrument_name_engraver::process_music ()
     create_text ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Instrument_name_engraver,
                /* descr */ " Prints the name of the instrument (specified by "
                " @code{Staff.instrument} and @code{Staff.instr}) "
@@ -175,6 +177,8 @@ Vocal_name_engraver::create_text ()
     text_->set_property ("text", txt);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Vocal_name_engraver,
                /* descr */ " Prints the name of the a lyric voice (specified by "
                " @code{Staff.vocalName} and @code{Staff.vocNam}) "
index 973a574c5736ceb76ed8ca65ddcc1028647b5774..fa591c9c5497170c3b402c98576cc36c984bb8b1 100644 (file)
@@ -25,7 +25,6 @@ Item::Item (SCM s, Object_key const *key)
   : Grob (s, key)
 {
   broken_to_drul_[LEFT] = broken_to_drul_[RIGHT] = 0;
-  interfaces_ = scm_cons (ly_symbol2scm ("item-interface"), interfaces_);
 }
 
 /**
index acd5aaa68dcf0a9ce2d8d62a09f750a7900b211f..2ccdef5ec12ac84527d62afe9f7fd696e42d200a 100644 (file)
@@ -37,9 +37,9 @@ protected:
   virtual void initialize ();
   virtual void finalize ();
   virtual bool try_music (Music *ev);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 };
 
@@ -180,6 +180,8 @@ Key_engraver::initialize ()
   context ()->set_property ("tonic", p.smobbed_copy ());
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Key_engraver,
                /* descr */ "",
                /* creats*/ "KeySignature",
index 3f7cc6ac2fe1ffbbd9da30e273c89cdf9ae0d892..065dd57fcdff4d92bb086931a04390c643d3a00c 100644 (file)
@@ -20,7 +20,7 @@ public:
 protected:
   virtual bool try_music (Music *ev);
   virtual void create_audio_elements ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Music *key_ev_;
@@ -96,6 +96,8 @@ Key_performer::try_music (Music *ev)
   return true;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Key_performer,
                "", "",
                "key-change-event",
index 11c496b299f82bb2f58a941341873b19da8ee4ce..32568dd30955c2e13b2d390fd5fd5df0436eac32 100644 (file)
@@ -20,7 +20,7 @@ public:
 
 protected:
   virtual void finalize ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 
   void start_spanner ();
@@ -86,6 +86,8 @@ Ledger_line_engraver::acknowledge_grob (Grob_info s)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Ledger_line_engraver,
                "Creates the spanner to draw ledger lines, and notices objects that need ledger lines",
                /* creats*/ "LedgerLineSpanner",
index 9eddeb71daf22f3bb5958a45364c24a080546c21..175f8d12698cd97ec487bfb72e03b8df07b2cba4 100644 (file)
@@ -50,6 +50,8 @@ Ligature_bracket_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Ligature_bracket_engraver,
                /* descr */ "Handles Ligature_events by engraving Ligature brackets.",
                /* creats*/ "TupletBracket",
index 70f490e3b48ea7df52e6be95c0f7d3acb5c75ec2..2df8616c4e7fe8bf00e14a4514c09c3f8646c842 100644 (file)
@@ -285,6 +285,8 @@ Ligature_engraver::acknowledge_grob (Grob_info info)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Ligature_engraver,
                /* descr */ "Abstract class; a concrete subclass handles Ligature_events by engraving Ligatures in a concrete style.",
                /* creats */ "",
index 340a5d914cdff0e1cab9149d9b53ccc57e2d908a..75c28f91174f47d51a9cb2b53f770dee94844aa3 100644 (file)
@@ -22,9 +22,9 @@
 class Lyric_engraver : public Engraver
 {
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 public:
   TRANSLATOR_DECLARATIONS (Lyric_engraver);
@@ -144,6 +144,8 @@ Lyric_engraver::stop_translation_timestep ()
   event_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Lyric_engraver,
                /* descr */ "",
                /* creats*/ "LyricText",
index 9d747f4e772c3a03a5f970b1770b4a01be6faa8a..535801cb9f8b73e87a267abb1acefe012519d133 100644 (file)
@@ -17,7 +17,7 @@ public:
 protected:
 
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
 
 private:
@@ -68,4 +68,6 @@ Lyric_performer::try_music (Music *req)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Lyric_performer, "", "", "lyric-event", "", "", "");
index a45c9c59bb5808c483fdcc4cfd8e46dc80330e2a..d938b39004a63bf7f20563799e57f31d4058d10b 100644 (file)
@@ -26,11 +26,11 @@ public:
 protected:
   Item *text_;
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   void create_items (Music *);
   virtual bool try_music (Music *ev);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 private:
   Music *mark_ev_;
@@ -130,6 +130,8 @@ Mark_engraver::process_music ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Mark_engraver,
                /* descr */ "This engraver will create RehearsalMark objects. "
                "It puts them on top of all staves (which is taken from "
index f44a8b3b5b2a7115f44b479a6f4949610809a2da..7a7ebd635db67ead1d653a5bba0811a2f28904e8 100644 (file)
@@ -20,7 +20,7 @@ protected:
   Spanner *grouping_;
   Rational stop_grouping_mom_;
 
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
 };
@@ -104,6 +104,8 @@ Measure_grouping_engraver::Measure_grouping_engraver ()
   grouping_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Measure_grouping_engraver,
                /* descr */ "Creates MeasureGrouping to indicate beat subdivision.",
                /* creats*/ "MeasureGrouping",
index 3c24d3c7713287fe5a794477c8033e0de537d3fd..18549114899b1a1933cd45bd86f43a10e56a865a 100644 (file)
@@ -19,8 +19,8 @@ public:
   TRANSLATOR_DECLARATIONS (Melisma_translator);
 protected:
   virtual bool try_music (Music *);
-  virtual void process_music ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   Music *event_;
 };
 
@@ -65,6 +65,8 @@ Melisma_translator::Melisma_translator ()
   event_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Melisma_translator,
                /* descr */ "This translator collects melisma information about ties, beams, and user settings (@code{melismaBusy}, and signals it to the @code{\addlyrics} code.  ",
                /* creats*/ "",
index bca756e2f394c7504f7097014c3f74be009352f5..5a6c662f909adbbb86a31c06f77a4b4c9b518df1 100644 (file)
@@ -383,6 +383,8 @@ Mensural_ligature_engraver::build_ligature (Spanner *ligature,
   fold_up_primitives (primitives);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Mensural_ligature_engraver,
                /* descr */ "Handles Mensural_ligature_events by glueing special ligature heads together.",
                /* creats*/ "MensuralLigature",
index 12020d306d5db969eae707519581b88f1e423fea..9535798f7a7c328c8d9fe1fd56bdf2b7a7a03100 100644 (file)
@@ -29,9 +29,9 @@ protected:
 
   void create_items (Music *);
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *ev);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Metronome_mark_engraver::Metronome_mark_engraver ()
@@ -85,6 +85,8 @@ Metronome_mark_engraver::process_music ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Metronome_mark_engraver,
                /* descr */ "Engrave metro nome marking. This delegates the formatting work "
                "to the function in the metronomeMarkFormatter property. "
index 399b94b6d816bd83c294ccd5667b1022ce646076..b32ce988cbe53b930e13caa039d45d35b3893172 100644 (file)
@@ -22,9 +22,9 @@ public:
 
 protected:
   virtual bool try_music (Music *);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void finalize ();
 
 private:
@@ -246,6 +246,8 @@ Multi_measure_rest_engraver::finalize ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Multi_measure_rest_engraver,
                /* descr */
                "Engraves multi-measure rests that are produced with @code{R}.  Reads "
index a32d324f1f39249af20a6cff98075ffeec41beb9..6bed794981a8846a8c337f4d8708b8749353693e 100644 (file)
@@ -49,7 +49,7 @@ class New_fingering_engraver : public Engraver
 public:
   TRANSLATOR_DECLARATIONS (New_fingering_engraver);
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   void add_fingering (Grob *, Music *, Music *);
   void add_script (Grob *, Music *, Music *);
@@ -360,6 +360,8 @@ New_fingering_engraver::New_fingering_engraver ()
   stem_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (New_fingering_engraver,
                /* descr */ "Create fingering-scripts for notes in a new chord.  "
                "This engraver is ill-named, since it "
index 9f2df9024081b5d5eaac5d09af8d0c39ab7773b9..e1af7de632700f64506ad69ac3ffdd91df0e3920 100644 (file)
@@ -19,6 +19,7 @@
 #include "stem.hh"
 #include "side-position-interface.hh"
 #include "dot-column.hh"
+#include "pointer-group-interface.hh"
 
 MAKE_SCHEME_CALLBACK (Note_collision_interface, force_shift_callback, 2);
 
index 787773019ed7f7eadf5684989807f9dd6ccde98c..4c81e4af067df13f5657ae214161e379a484076c 100644 (file)
@@ -18,6 +18,7 @@
 #include "rest.hh"
 #include "note-head.hh"
 #include "accidental-placement.hh"
+#include "pointer-group-interface.hh"
 
 /*
   TODO: figure out if we can prune this class. This is just an
index 555ac18ec19ba3bc149ca61dd097c9ef61b064c5..8dde1e86401560354110c49fb807c3d3d8884ffd 100644 (file)
@@ -27,8 +27,8 @@ public:
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Spanner *line_;
@@ -71,7 +71,7 @@ Note_head_line_engraver::acknowledge_grob (Grob_info info)
 }
 
 void
-Note_head_line_engraver::process_acknowledged_grobs ()
+Note_head_line_engraver::process_acknowledged ()
 {
   if (!line_ && follow_ && last_head_ && head_)
     {
@@ -99,6 +99,8 @@ Note_head_line_engraver::stop_translation_timestep ()
   head_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Note_head_line_engraver,
                /* descr */ "Engrave a line between two note heads, for example a glissando.  If "
                " followVoice is set, staff switches also generate a line.",
index abf3599ac2a37838e3b89bae5bb430aa9e1f1ff8..796e01b3a342eca856f5cea7140eca97db558b97 100644 (file)
@@ -41,8 +41,9 @@ internal_print (Grob *me, String *font_char)
   SCM log = scm_int2num (Note_head::get_balltype (me));
   SCM proc = me->get_property ("glyph-name-procedure");
 
-  String suffix =  to_string (robust_scm2int (me->get_property ("duration-log"), 2));
-  if (ly_is_procedure (proc))
+  String suffix =  to_string (min (robust_scm2int (me->get_property ("duration-log"), 2), 2));
+  if (style != ly_symbol2scm ("default")
+      && ly_is_procedure (proc))
     suffix = ly_scm2string (scm_call_2 (proc, log, style));
   
   Font_metric *fm = Font_interface::get_default_font (me);
index b74d9faff170f1138819e3fae13bb690296450d8..91de2a5047890cd64e56985b75511a0645a4f974 100644 (file)
@@ -28,8 +28,8 @@ public:
 
 protected:
   virtual bool try_music (Music *ev);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Note_heads_engraver::Note_heads_engraver ()
@@ -131,6 +131,8 @@ Note_heads_engraver::stop_translation_timestep ()
   note_evs_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Note_heads_engraver,
                /* descr */ "Generate noteheads.",
                /* creats*/ "NoteHead Dots",
index 0a3814f477791903f22dcd93a1454f04e57a2b5a..a40cb2ac3f47bb58112fe8f6901f8c70c7916d12 100644 (file)
@@ -17,8 +17,8 @@ public:
   Link_array<Music> events_;
   Link_array<Item> texts_;
   virtual bool try_music (Music *m);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 bool
@@ -66,6 +66,8 @@ Note_name_engraver::Note_name_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Note_name_engraver,
                /* descr */ "",
                /* creats*/ "NoteName",
index 640449cc3a79665e410319fa1d83189c970a7aa6..333196f9bdb23d9180927f3958503190945a582b 100644 (file)
@@ -24,7 +24,7 @@ public:
 protected:
   virtual bool try_music (Music *ev);
 
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
 
 private:
@@ -88,6 +88,8 @@ Note_performer::try_music (Music *ev)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Note_performer, "", "",
                "note-event busy-playing-event", "", "", "");
 
index f4da2e415312ecd155b471833696f213f9a337e8..44f3741c370758ed0ae0d842d409de5e9dbe09e2 100644 (file)
@@ -18,8 +18,8 @@ public:
 protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void derived_mark () const;
 private:
   Spanner *span_;
@@ -121,6 +121,8 @@ Ottava_spanner_engraver::finalize ()
   last_ottavation_ = SCM_EOL;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Ottava_spanner_engraver,
                /* descr */ "Create a text spanner when the ottavation property changes..",
                /* creats*/ "OttavaBracket",
index 2400383e61a46cd2e869279f66ca9dc110973b31..f31cd652fc855241046e36c56dd4dcbf90eb5443 100644 (file)
@@ -17,7 +17,7 @@ TRANSLATOR_DECLARATIONS (Output_property_engraver);
 protected:
   Link_array<Music> props_;
 
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music*);
 };
@@ -79,6 +79,8 @@ Output_property_engraver::Output_property_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Output_property_engraver,
 /* descr */       "Interpret Music of Output_property type, and apply a function "
 " to any Graphic objects that satisfies the predicate.",
diff --git a/lily/paper-column-engraver.cc b/lily/paper-column-engraver.cc
new file mode 100644 (file)
index 0000000..72e66f4
--- /dev/null
@@ -0,0 +1,235 @@
+/*
+  paper-column-engraver.cc -- implement Paper_column_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "paper-column-engraver.hh"
+#include "system.hh"
+#include "item.hh"
+#include "paper-column.hh"
+#include "staff-spacing.hh"
+#include "note-spacing.hh"
+#include "pointer-group-interface.hh"
+#include "context.hh"
+#include "axis-group-interface.hh"
+#include "warn.hh"
+
+
+
+Paper_column_engraver::Paper_column_engraver ()
+{
+  command_column_ = 0;
+  musical_column_ = 0;
+  breaks_ = 0;
+  break_event_ = 0;
+  system_ = 0;
+  first_ = true;
+}
+
+void
+Paper_column_engraver::finalize ()
+{
+  if ((breaks_ % 8))
+    progress_indication ("[" + to_string (breaks_) + "]");
+
+  if (command_column_)
+    {
+      command_column_->set_property ("breakable", SCM_BOOL_T);
+      system_->set_bound (RIGHT, command_column_);
+    }  
+}
+
+void
+Paper_column_engraver::make_columns ()
+{
+  /*
+    ugh.
+  */
+  Paper_column *p1 = make_paper_column ("NonMusicalPaperColumn");
+  Paper_column *p2 = make_paper_column ("PaperColumn");
+
+  SCM m = now_mom().smobbed_copy();
+  p1->set_property ("when", m);
+  p2->set_property ("when", m);
+      
+  set_columns (p1, p2);
+}
+
+
+void
+Paper_column_engraver::initialize ()
+{
+  system_ = dynamic_cast<System*> (unsmob_grob (get_property ("rootSystem")));
+  make_columns ();
+
+  
+  system_->set_bound (LEFT, command_column_);
+  command_column_->set_property ("breakable", SCM_BOOL_T);
+}
+
+void
+Paper_column_engraver::acknowledge_grob (Grob_info gi)
+{
+  Item *item = dynamic_cast<Item *> (gi.grob ());
+  if (!item)
+    {
+      programming_error ("Spanner found in Paper_column_engraver::acknowledge_grob()"); 
+      return;
+    }
+  
+  items_.push (item);
+  
+  if (Staff_spacing::has_interface (item))
+    {
+      Pointer_group_interface::add_grob (command_column_,
+                                        ly_symbol2scm ("spacing-wishes"),
+                                        gi.grob ());
+    }
+  if (Note_spacing::has_interface (item))
+    {
+      Pointer_group_interface::add_grob (musical_column_,
+                                        ly_symbol2scm ("spacing-wishes"),
+                                        gi.grob ());
+    }
+}
+
+void
+Paper_column_engraver::set_columns (Paper_column *new_command,
+                                   Paper_column *new_musical)
+{
+  command_column_ = new_command;
+  musical_column_ = new_musical;
+  if (new_command)
+    {
+      context ()->set_property ("currentCommandColumn", new_command->self_scm ());
+    }
+
+  if (new_musical)
+    {
+      context ()->set_property ("currentMusicalColumn", new_musical->self_scm ());
+    }
+
+  system_->add_column (command_column_);
+  system_->add_column (musical_column_);
+}
+
+
+void
+Paper_column_engraver::forbid_breaks ()
+{
+  if (command_column_ && !first_)
+    command_column_->set_property ("breakable", SCM_EOL);
+}
+
+
+bool
+Paper_column_engraver::try_music (Music *m)
+{
+  break_event_ = m;
+
+  return true;
+}
+
+void
+Paper_column_engraver::process_music ()
+{
+  if (break_event_)
+    {
+      SCM pen = command_column_->get_property ("penalty");
+      Real total_penalty = scm_is_number (pen) ? scm_to_double (pen) : 0.0;
+
+      SCM mpen = break_event_->get_property ("penalty");
+      if (scm_is_number (mpen))
+       total_penalty += scm_to_double (mpen);
+
+      command_column_->set_property ("penalty", scm_make_real (total_penalty));
+
+      /* ugh.  arbitrary, hardcoded */
+      if (total_penalty > 10000.0)
+       forbid_breaks ();
+
+      SCM page_pen = command_column_->get_property ("page-penalty");
+      Real total_pp = scm_is_number (page_pen) ? scm_to_double (page_pen) : 0.0;
+      SCM mpage_pen = break_event_->get_property ("page-penalty");
+      if (scm_is_number (mpage_pen))
+       total_pp += scm_to_double (mpage_pen);
+
+      command_column_->set_property ("page-penalty", scm_make_real (total_pp));
+    }
+
+
+  bool start_of_measure = (last_moment_.main_part_ != now_mom ().main_part_
+                          && !measure_position (context ()).main_part_);
+
+  /*
+    We can't do this in start_translation_timestep(), since time sig
+    changes won't have happened by then.
+  */
+  if (start_of_measure)
+    {
+      Moment mlen = Moment (measure_length (context ()));
+      Grob * column = unsmob_grob (get_property ("currentCommandColumn"));
+      if (column)
+       column->set_property ("measure-length", mlen.smobbed_copy ());
+      else
+       programming_error("No command column?");
+    }
+}
+
+void
+Paper_column_engraver::stop_translation_timestep ()
+{
+  for (int i = 0; i < items_.size (); i++)
+    {
+      Item *elem = items_[i];
+      if (!elem->get_parent (X_AXIS)
+         || !unsmob_grob (elem->get_object ("axis-group-parent-X")))
+       {
+         bool br = to_boolean (elem->get_property ("breakable"));
+         Axis_group_interface::add_element (br ? command_column_ : musical_column_, elem);
+       }
+    }
+  items_.clear ();
+  
+  if (to_boolean (command_column_->get_property ("breakable")))
+    {
+      breaks_++;
+      if (! (breaks_%8))
+       progress_indication ("[" + to_string (breaks_) + "]");
+    }
+
+  first_ = false;
+}
+
+void
+Paper_column_engraver::start_translation_timestep ()
+{
+  /*
+    TODO: don't make columns when skipTypesetting is true.
+  */
+  if (!first_)
+    make_columns ();
+}
+
+
+
+#include "translator.icc"
+
+ADD_TRANSLATOR (Paper_column_engraver,
+               /* descr */ "Takes care of generating columns."
+               "\n\n "
+               "This engraver decides whether a column is breakable. The default is "
+               "that a column is always breakable. However, when every Bar_engraver "
+               "that does not have a barline at a certain point will call "
+               "Score_engraver::forbid_breaks to stop linebreaks.  In practice, this "
+               "means that you can make a breakpoint by creating a barline (assuming "
+               "that there are no beams or notes that prevent a breakpoint.) ",
+               /* creats*/ "PaperColumn NonMusicalPaperColumn",
+               /* accepts */ "break-event",
+               /* acks  */ "item-interface",
+               /* reads */ "",
+               /* write */ "currentCommandColumn currentMusicalColumn");
index 191fd30b5243603753cd5642ed51d4cdc7cd49be..6e4d63d12df9961207c384a6a6220483914c6ea7 100644 (file)
@@ -21,8 +21,8 @@ class Part_combine_engraver : public Engraver
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
 private:
   Item *text_;
@@ -92,6 +92,8 @@ Part_combine_engraver::stop_translation_timestep ()
   event_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Part_combine_engraver,
                /* descr */ "Part combine engraver for orchestral scores:               "
                "Print markings a2, Solo, Solo II, and unisono ",
index db9225a0554a0e7c7782f926a78033e0242b4b1a..208ba3600f42eddc85e7fff359f91702846df8e6 100644 (file)
@@ -57,9 +57,9 @@ protected:
 protected:
   virtual void finalize ();
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Percent_repeat_engraver::Percent_repeat_engraver ()
@@ -198,6 +198,8 @@ Percent_repeat_engraver::stop_translation_timestep ()
   typeset_perc ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Percent_repeat_engraver,
                /* descr */ "Make whole bar and double bar repeats.",
                /* creats*/ "PercentRepeat DoublePercentRepeat",
index 053a5f32fce04e61dc2fabdeff25d6e3e6ded9fa..098def5c970e422142008ce630766a82b8a7d8e3 100644 (file)
@@ -13,7 +13,9 @@
 #include "audio-element.hh"
 #include "warn.hh"
 
-ADD_TRANSLATOR (Performer_group_performer,
+#include "translator.icc"
+
+ADD_TRANSLATOR_GROUP (Performer_group_performer,
                /* descr */ "",
                /* creats*/ "",
                /* accepts */ "",
@@ -25,7 +27,7 @@ void
 Performer_group_performer::announce_element (Audio_element_info info)
 {
   announce_infos_.push (info);
-  Translator *t
+  Translator_group *t
     = context ()->get_parent_context ()->implementation ();
 
   if (Performer_group_performer *eg = dynamic_cast<Performer_group_performer *> (t))
@@ -49,12 +51,22 @@ Performer_group_performer::acknowledge_audio_elements ()
     }
 }
 
+void
+performer_each (SCM list, Performer_method method)
+{
+  for (SCM p = list; scm_is_pair (p); p = scm_cdr (p))
+    {
+      Performer *e = dynamic_cast<Performer *> (unsmob_translator (scm_car (p)));
+      if (e)
+       (e->*method) ();
+    }
+}
+
 void
 Performer_group_performer::do_announces ()
 {
   while (1)
     {
-      create_audio_elements ();
       performer_each (get_simple_trans_list (),
                      &Performer::create_audio_elements);
 
@@ -66,17 +78,27 @@ Performer_group_performer::do_announces ()
     }
 }
 
-Performer_group_performer::Performer_group_performer ()
+
+void
+Performer_group_performer::play_element (Audio_element *e)
 {
+  Context *c = context_->get_parent_context ();
+  if (c)
+    {
+      Performer_group_performer *pgp = dynamic_cast<Performer_group_performer*> (c->implementation ());
+      pgp->play_element (e);
+    }
 }
 
-void
-performer_each (SCM list, Performer_method method)
+int
+Performer_group_performer::get_tempo () const
 {
-  for (SCM p = list; scm_is_pair (p); p = scm_cdr (p))
+  Context *c = context_->get_parent_context ();
+  if (c)
     {
-      Performer *e = dynamic_cast<Performer *> (unsmob_translator (scm_car (p)));
-      if (e)
-       (e->*method) ();
+      Performer_group_performer *pgp = dynamic_cast<Performer_group_performer*> (c->implementation ());
+      return pgp->get_tempo ();
     }
+  return 60;
 }
+  
index 260c5d7154ade8a0996cf7d75807074bc820397e..f5e9e7f6020bd557bc9bfadca646b149603ce46f 100644 (file)
@@ -45,5 +45,6 @@ Performer::announce_element (Audio_element_info i)
 {
   if (!i.origin_trans_)
     i.origin_trans_ = this;
+
   get_daddy_performer ()->announce_element (i);
 }
index d4d064d451ef523e7a7f4a55efcdad1fa19762ba..333cba4e7b1ca7ba9cf3b1d3d278eadd1dc31855 100644 (file)
@@ -28,9 +28,9 @@ class Phrasing_slur_engraver : public Engraver
 protected:
   virtual bool try_music (Music *);
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 public:
   TRANSLATOR_DECLARATIONS (Phrasing_slur_engraver);
@@ -144,6 +144,8 @@ Phrasing_slur_engraver::stop_translation_timestep ()
   events_[START] = events_[STOP] = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Phrasing_slur_engraver,
                /* descr */ "Print phrasing slurs. Similar to @ref{Slur_engraver}",
                /* creats*/ "PhrasingSlur",
index f6564f67b1ce9d9c0b24c824f32271b69a7ade41..9f586a44ac9cf4b7cf80f1050ffde511a0fc96c8 100644 (file)
@@ -64,9 +64,9 @@ protected:
   virtual void initialize ();
   virtual void finalize ();
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 private:
 
@@ -525,6 +525,8 @@ Piano_pedal_engraver::typeset_all (Pedal_info *p)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Piano_pedal_engraver,
                /* descr */ "Engrave piano pedal symbols and brackets.",
                /* creats*/ "SostenutoPedal SustainPedal UnaCordaPedal SostenutoPedalLineSpanner SustainPedalLineSpanner UnaCordaPedalLineSpanner",
index dd118981abf6ec0d6f0a276a2d12e43aea2c799a..554bbfab2c88b9cc312126b0f038d5451686c683 100644 (file)
@@ -30,8 +30,8 @@ protected:
   virtual void initialize ();
   virtual bool try_music (Music *);
   virtual void create_audio_elements ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 
 private:
   Link_array<Audio_piano_pedal> audios_;
@@ -141,6 +141,8 @@ Piano_pedal_performer::try_music (Music *r)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Piano_pedal_performer, "", "",
                "pedal-event",
                "", "", "");
index 870a5a93154ba82ddc0db33b087af1feae9b18a7..066c743d7ce2e3fb4a7cb21f9c6b1dbccf1e7b4e 100644 (file)
@@ -32,6 +32,8 @@ Pitch_squash_engraver::Pitch_squash_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Pitch_squash_engraver,
                /* descr */
                "Set the vertical position of noteheads to "
index 2af1190d8169ed1d36b5a1e0930207672db4a4f8..38cba0810a1769daee915c9914613e726d1bb2fb 100644 (file)
@@ -27,9 +27,9 @@ public:
   
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual bool try_music (Music*);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 private:
   Item *trill_head_;
   Item *trill_group_;
@@ -142,6 +142,8 @@ Pitched_trill_engraver::try_music (Music *)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Pitched_trill_engraver,
                /* descr */ "Print the bracketed notehead after a notehead with trill.",
                /* creats*/ "TrillPitchHead TrillPitchAccidental TrillPitchGroup",
index 5cf6c7130410bb5e6106e962960f9b93db4d5bbe..f546ee40152fcb021e43876f4eb5f97c06785642 100644 (file)
@@ -6,23 +6,9 @@
   (c) 2003--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
+#include "recording-group-engraver.hh"
 #include "context.hh"
-#include "engraver-group-engraver.hh"
-#include "protected-scm.hh"
 
-class Recording_group_engraver : public Engraver_group_engraver
-{
-public:
-  TRANSLATOR_DECLARATIONS (Recording_group_engraver);
-  virtual bool try_music (Music *m);
-  void add_music (SCM, SCM);
-  virtual void stop_translation_timestep ();
-  virtual void finalize ();
-  virtual void initialize ();
-  virtual void derived_mark () const;
-  SCM now_events_;
-  SCM accumulator_;
-};
 
 void
 Recording_group_engraver::derived_mark () const
@@ -32,12 +18,6 @@ Recording_group_engraver::derived_mark () const
   scm_gc_mark (accumulator_);
 }
 
-void
-Recording_group_engraver::initialize ()
-{
-  Engraver_group_engraver::initialize ();
-}
-
 Recording_group_engraver::Recording_group_engraver ()
 {
   accumulator_ = SCM_EOL;
@@ -53,10 +33,8 @@ Recording_group_engraver::add_music (SCM music, SCM success)
 void
 Recording_group_engraver::stop_translation_timestep ()
 {
-  Engraver_group_engraver::stop_translation_timestep ();
-
-  accumulator_ = scm_acons (scm_cons (now_mom ().smobbed_copy (),
-                                     get_property ("instrumentTransposition")),
+  accumulator_ = scm_acons (scm_cons (context ()->now_mom ().smobbed_copy (),
+                                     context ()->get_property ("instrumentTransposition")),
                            now_events_,
                            accumulator_);
   now_events_ = SCM_EOL;
@@ -65,8 +43,7 @@ Recording_group_engraver::stop_translation_timestep ()
 void
 Recording_group_engraver::finalize ()
 {
-  Engraver_group_engraver::finalize ();
-  SCM proc = get_property ("recordEventSequence");
+  SCM proc = context()->get_property ("recordEventSequence");
 
   if (ly_is_procedure (proc))
     scm_call_2 (proc, context ()->self_scm (), scm_cdr (accumulator_));
@@ -81,7 +58,22 @@ Recording_group_engraver::try_music (Music *m)
   return retval;
 }
 
-ADD_TRANSLATOR (Recording_group_engraver,
+void
+recording_engraver (Translator_group *tg)
+{
+  Recording_group_engraver *rg = dynamic_cast<Recording_group_engraver*> (tg);
+  rg->stop_translation_timestep ();
+}
+
+void
+Recording_group_engraver::fetch_precomputable_methods (Translator_group_void_method ptrs[])
+{
+  ptrs[STOP_TRANSLATION_TIMESTEP] = &recording_engraver;
+}
+
+#include "translator.icc"
+
+ADD_TRANSLATOR_GROUP (Recording_group_engraver,
                "Engraver_group_engraver that records all music events "
                "for this context. Calls the procedure "
                "in @code{recordEventSequence} when finished.",
index 77b840d597ac1cdbfc9da837840902cda6df8d07..7afe740b7a3b51f83943917bf55d4f0a19a79ec4 100644 (file)
@@ -11,6 +11,8 @@
 #include "context.hh"
 #include "repeated-music.hh"
 
+#include "translator.icc"
+
 /*
   Objective:
 
@@ -27,8 +29,8 @@ public:
 
   TRANSLATOR_DECLARATIONS (Repeat_acknowledge_engraver);
 protected:
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void initialize ();
 };
 
@@ -105,6 +107,7 @@ Repeat_acknowledge_engraver::process_music ()
     }
 }
 
+
 ADD_TRANSLATOR (Repeat_acknowledge_engraver,
                /* descr */ "Acknowledge repeated music, and convert the contents of "
                "repeatCommands ainto an appropriate setting for whichBar.",
index 2d718092f0d26dbabc42fc6ffcdb6b4e3bb0e4c7..1f8c1c455590fa1c99c18d2c817be3d1cf1797e5 100644 (file)
@@ -18,8 +18,8 @@ class Rest_collision_engraver : public Engraver
   Link_array<Grob> note_columns_;
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 public:
   TRANSLATOR_DECLARATIONS (Rest_collision_engraver);
 };
@@ -31,7 +31,7 @@ Rest_collision_engraver::Rest_collision_engraver ()
 }
 
 void
-Rest_collision_engraver::process_acknowledged_grobs ()
+Rest_collision_engraver::process_acknowledged ()
 {
   if (rest_collision_
       || note_columns_.is_empty ()
@@ -65,6 +65,8 @@ Rest_collision_engraver::stop_translation_timestep ()
   rest_count_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Rest_collision_engraver,
                /* descr */ "Handles collisions of rests.",
                /* creats*/ "RestCollision",
index 0116992b6797fa14121836a91ad383e3a6720b0c..e276d303c8015439c50049070d6c2088e626f9eb 100644 (file)
@@ -23,9 +23,9 @@ class Rest_engraver : public Engraver
   Grob *rest_;
 protected:
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 public:
   TRANSLATOR_DECLARATIONS (Rest_engraver);
@@ -106,6 +106,8 @@ Rest_engraver::try_music (Music *m)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Rest_engraver,
                /* descr */ "",
                /* creats*/ "Rest Dots",
index 3f059df4e29c402e37b63815d3321e34c9f33d74..de2fcc46fa2a0abd86dcb0aee29aabe1d64d203e 100644 (file)
@@ -51,8 +51,8 @@ class Rhythmic_column_engraver : public Engraver
 protected:
 
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Rhythmic_column_engraver::Rhythmic_column_engraver ()
@@ -66,7 +66,7 @@ Rhythmic_column_engraver::Rhythmic_column_engraver ()
 }
 
 void
-Rhythmic_column_engraver::process_acknowledged_grobs ()
+Rhythmic_column_engraver::process_acknowledged ()
 {
   if (rheads_.size ())
     {
@@ -145,6 +145,8 @@ Rhythmic_column_engraver::stop_translation_timestep ()
   stem_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Rhythmic_column_engraver,
                /* descr */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
                /* creats*/ "NoteColumn NoteSpacing",
index 15e2e5e9facc7db7ab8c4e97d9c3fe88136514ba..34f82cc247a38c9ef55a81be563824220c9494dc 100644 (file)
@@ -13,7 +13,7 @@
 void
 Score_context::prepare (Moment w)
 {
-  Translator *t = implementation ();
+  Translator_group *t = implementation ();
   Score_translator *s = dynamic_cast<Score_translator *> (t);
 
   s->prepare (w);
@@ -22,7 +22,7 @@ Score_context::prepare (Moment w)
 void
 Score_context::finish ()
 {
-  Translator *t = implementation ();
+  Translator_group *t = implementation ();
   Score_translator *s = dynamic_cast<Score_translator *> (t);
 
   s->finish ();
@@ -31,7 +31,7 @@ Score_context::finish ()
 void
 Score_context::one_time_step ()
 {
-  Translator *t = implementation ();
+  Translator_group *t = implementation ();
   Score_translator *s = dynamic_cast<Score_translator *> (t);
   s->one_time_step ();
 }
@@ -39,7 +39,7 @@ Score_context::one_time_step ()
 SCM
 Score_context::get_output ()
 {
-  Translator *t = implementation ();
+  Translator_group *t = implementation ();
   Score_translator *s = dynamic_cast<Score_translator *> (t);
   return s->get_output ();
 }
index 985be103ae359d066116a2d61cc074d87a8b4fbb..658b44ac137523012806b0a1de821418921dfe2f 100644 (file)
 #include "output-def.hh"
 #include "axis-group-interface.hh"
 #include "context-def.hh"
-#include "staff-spacing.hh"
-#include "note-spacing.hh"
 #include "global-context.hh"
 #include "open-type-font.hh"
+#include "paper-column-engraver.hh"
 
 /*
   TODO: the column creation logic is rather hairy. Revise it.
@@ -28,9 +27,6 @@
 Score_engraver::Score_engraver ()
 {
   system_ = 0;
-  command_column_ = 0;
-  musical_column_ = 0;
-  breaks_ = 0;
   pscore_ = 0;
 }
 
@@ -43,55 +39,21 @@ Score_engraver::derived_mark () const
   Engraver_group_engraver::derived_mark ();
 }
 
-void
-Score_engraver::make_columns ()
-{
-  /*
-    ugh.
-  */
-  if (!command_column_)
-    {
-      SCM nmp
-       = updated_grob_properties (context (),
-                                  ly_symbol2scm ("NonMusicalPaperColumn"));
-
-      Object_key const *key1 = context ()->get_grob_key ("NonMusicalPaperColumn");
-
-      SCM pc = updated_grob_properties (context (),
-                                       ly_symbol2scm ("PaperColumn"));
-      Object_key const *key2 = context ()->get_grob_key ("PaperColumn");
-      set_columns (new Paper_column (nmp, key1), new Paper_column (pc, key2));
-
-      Grob_info i1 (this, command_column_);
-      announce_grob (i1);
-
-      Grob_info i2 (this, musical_column_);
-      announce_grob (i2);
-    }
-}
 
 void
 Score_engraver::prepare (Moment m)
 {
-  /*
-    TODO: don't make columns when skipTypesetting is true.
-  */
-  make_columns ();
-
-  SCM w = m.smobbed_copy ();
-  command_column_->set_property ("when", w);
-  musical_column_->set_property ("when", w);
-
-  recurse_over_translators (context (), &Translator::start_translation_timestep, DOWN);
+  (void) m;
+  
+  precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, DOWN);
 }
 
 void
 Score_engraver::finish ()
 {
-  if ((breaks_ % 8))
-    progress_indication ("[" + to_string (breaks_) + "]");
-
-  recurse_over_translators (context (), &Translator::finalize, UP);
+  recurse_over_translators (context (), &Translator::finalize,
+                           &Translator_group::finalize,
+                           UP);
 }
 
 #define MUSIC_FONT "emmentaler-20"
@@ -114,19 +76,16 @@ Score_engraver::initialize ()
             + _ ("Aborting"));
     }
 
-  pscore_ = new Paper_score (dynamic_cast<Output_def *> (get_output_def ()));
+  pscore_ = new Paper_score (dynamic_cast<Output_def *> (context ()->get_output_def ()));
   scm_gc_unprotect_object (pscore_->self_scm ()); 
 
   SCM props = updated_grob_properties (context (), ly_symbol2scm ("System"));
 
   Object_key const *sys_key = context ()->get_grob_key ("System");
   pscore_->typeset_system (new System (props, sys_key));
-
   system_ = pscore_->root_system ();
-  make_columns ();
-  system_->set_bound (LEFT, command_column_);
-  command_column_->set_property ("breakable", SCM_BOOL_T);
-
+  context ()->set_property ("rootSystem",  system_->self_scm ());
+  
   Engraver_group_engraver::initialize ();
 }
 
@@ -135,24 +94,20 @@ Score_engraver::finalize ()
 {
   Score_translator::finalize ();
 
-  Grob *cc
-    = unsmob_grob (get_property ("currentCommandColumn"));
-  system_->set_bound (RIGHT, cc);
-  cc->set_property ("breakable", SCM_BOOL_T);
-
   typeset_all ();
 }
 
 void
 Score_engraver::one_time_step ()
 {
-  if (!to_boolean (get_property ("skipTypesetting")))
+  if (!to_boolean (context ()->get_property ("skipTypesetting")))
     {
-      recurse_over_translators (context (), &Engraver::process_music, UP);
+      precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP);
       Engraver_group_engraver::do_announces ();
     }
 
-  recurse_over_translators (context (), &Translator::stop_translation_timestep, UP);
+  precomputed_recurse_over_translators (context (), STOP_TRANSLATION_TIMESTEP, UP);
+  typeset_all ();
 }
 
 void
@@ -170,68 +125,34 @@ Score_engraver::typeset_all ()
     {
       Grob *elem = elems_[i];
 
-      if (dynamic_cast<Item *> (elem))
-       {
-         if ((!elem->get_parent (X_AXIS)
-              || !unsmob_grob (elem->get_object ("axis-group-parent-X")))
-             && elem != command_column_
-             && elem != musical_column_)
-           {
-             bool br = to_boolean (elem->get_property ("breakable"));
-             Axis_group_interface::add_element (br ? command_column_ : musical_column_, elem);
-           }
-       }
       if (!elem->get_parent (Y_AXIS))
        Axis_group_interface::add_element (system_, elem);
     }
   elems_.clear ();
 }
 
-void
-Score_engraver::stop_translation_timestep ()
+SCM
+Score_engraver::get_output ()
 {
-  // this generates all items.
-  Engraver_group_engraver::stop_translation_timestep ();
-
-  typeset_all ();
-  if (to_boolean (command_column_->get_property ("breakable")))
-    {
-      breaks_++;
-      if (! (breaks_%8))
-       progress_indication ("[" + to_string (breaks_) + "]");
-    }
-
-  command_column_ = 0;
-  musical_column_ = 0;
+  Music_output *o = pscore_;
+  return o->self_scm ();
 }
 
+
+/*
+  UGH UGH
+ */
 void
-Score_engraver::set_columns (Paper_column *new_command,
-                            Paper_column *new_musical)
+Score_engraver::forbid_breaks ()
 {
-  assert (!command_column_ && !musical_column_);
-
-  command_column_ = new_command;
-  musical_column_ = new_musical;
-  if (new_command)
-    {
-      context ()->set_property ("currentCommandColumn", new_command->self_scm ());
-    }
-
-  if (new_musical)
+  for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s))
     {
-      context ()->set_property ("currentMusicalColumn", new_musical->self_scm ());
+      Translator *tr = unsmob_translator (scm_car (s));
+      if (Paper_column_engraver* pce = dynamic_cast<Paper_column_engraver*> (tr))
+       {
+         pce->forbid_breaks ();
+       }
     }
-
-  system_->add_column (command_column_);
-  system_->add_column (musical_column_);
-}
-
-SCM
-Score_engraver::get_output ()
-{
-  Music_output *o = pscore_;
-  return o->self_scm ();
 }
 
 bool
@@ -240,73 +161,12 @@ Score_engraver::try_music (Music *m)
   if (Engraver_group_engraver::try_music (m))
     return true;
 
-  if (m->is_mus_type ("break-event"))
-    {
-      SCM pen = command_column_->get_property ("penalty");
-      Real total_penalty = scm_is_number (pen) ? scm_to_double (pen) : 0.0;
-
-      SCM mpen = m->get_property ("penalty");
-      if (scm_is_number (mpen))
-       total_penalty += scm_to_double (mpen);
-
-      command_column_->set_property ("penalty", scm_make_real (total_penalty));
-
-      /* ugh.  arbitrary, hardcoded */
-      if (total_penalty > 10000.0)
-       forbid_breaks ();
-
-      SCM page_pen = command_column_->get_property ("page-penalty");
-      Real total_pp = scm_is_number (page_pen) ? scm_to_double (page_pen) : 0.0;
-      SCM mpage_pen = m->get_property ("page-penalty");
-      if (scm_is_number (mpage_pen))
-       total_pp += scm_to_double (mpage_pen);
-
-      command_column_->set_property ("page-penalty", scm_make_real (total_pp));
-      return true;
-    }
   return false;
 }
 
-void
-Score_engraver::forbid_breaks ()
-{
-  if (command_column_)
-    command_column_->set_property ("breakable", SCM_EOL);
-}
-
-void
-Score_engraver::acknowledge_grob (Grob_info gi)
-{
-  if (Staff_spacing::has_interface (gi.grob ()))
-    {
-      Pointer_group_interface::add_grob (command_column_,
-                                        ly_symbol2scm ("spacing-wishes"),
-                                        gi.grob ());
-    }
-  if (Note_spacing::has_interface (gi.grob ()))
-    {
-      Pointer_group_interface::add_grob (musical_column_,
-                                        ly_symbol2scm ("spacing-wishes"),
-                                        gi.grob ());
-    }
-
-  if (Axis_group_interface::has_interface (gi.grob ())
-      && gi.grob ()->internal_has_interface (ly_symbol2scm ("vertically-spaceable-interface")))
-    {
-      SCM spaceable = get_property ("verticallySpacedContexts");
-      Context *orig = gi.origin_contexts (this)[0];
-
-      if (scm_memq (ly_symbol2scm (orig->context_name ().to_str0 ()),
-                   spaceable) != SCM_BOOL_F)
-       {
-         Pointer_group_interface::add_grob (system_,
-                                            ly_symbol2scm ("spaceable-staves"),
-                                            gi.grob ());
-       }
-    }
-}
+#include "translator.icc"
 
-ADD_TRANSLATOR (Score_engraver,
+ADD_TRANSLATOR_GROUP (Score_engraver,
                /* descr */ "Top level engraver. Takes care of generating columns and the complete  system (ie. System) "
                "\n\n "
                "This engraver decides whether a column is breakable. The default is "
index 0c341dd98c3635115fb67cc9416cf7a02745f098..a8784405f04b93530625672dfdd43ef267223693 100644 (file)
@@ -16,8 +16,9 @@
 #include "warn.hh"
 #include "context-def.hh"
 #include "output-def.hh"
+#include "context.hh"
 
-ADD_TRANSLATOR (Score_performer,
+ADD_TRANSLATOR_GROUP (Score_performer,
                /* descr */ "",
                /* creats*/ "",
                /* accepts */ "",
@@ -55,21 +56,24 @@ Score_performer::prepare (Moment m)
 {
   audio_column_ = new Audio_column (m);
   play_element (audio_column_);
-  recurse_over_translators (context (), &Translator::start_translation_timestep, UP);
+  precomputed_recurse_over_translators (context (), START_TRANSLATION_TIMESTEP, UP);
 }
 
 void
 Score_performer::finish ()
 {
-  recurse_over_translators (context (), &Translator::finalize, UP);
+  recurse_over_translators (context (),
+                           &Translator::finalize,
+                           &Translator_group::finalize,
+                           UP);
 }
 
 void
 Score_performer::one_time_step ()
 {
-  recurse_over_translators (context (), &Performer::process_music, UP);
-  recurse_over_translators (context (), &Performer::do_announces, UP);
-  recurse_over_translators (context (), &Translator::stop_translation_timestep, UP);
+  precomputed_recurse_over_translators (context (), PROCESS_MUSIC, UP);
+  do_announces ();
+  precomputed_recurse_over_translators (context (), STOP_TRANSLATION_TIMESTEP, UP);
 }
 
 int
@@ -101,7 +105,7 @@ Score_performer::initialize ()
 {
   performance_ = new Performance;
   scm_gc_unprotect_object (performance_->self_scm ());
-  performance_->midi_ = get_output_def ();
+  performance_->midi_ = context ()->get_output_def ();
 
   Translator_group::initialize ();
 }
index a7ae23ec4a94042cdbb0c3b91b133cd6c734a12f..78cefe92f5d6ac0eb6343bfbaa60aa5627249fae 100644 (file)
@@ -10,6 +10,9 @@
 #include "script-column.hh"
 #include "side-position-interface.hh"
 
+#include "translator.icc"
+
+
 /**
    Find potentially colliding scripts, and put them in a
    Script_column, that will fix the collisions.  */
@@ -22,8 +25,8 @@ public:
   TRANSLATOR_DECLARATIONS (Script_column_engraver);
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Script_column_engraver::Script_column_engraver ()
@@ -53,7 +56,7 @@ Script_column_engraver::acknowledge_grob (Grob_info inf)
 }
 
 void
-Script_column_engraver::process_acknowledged_grobs ()
+Script_column_engraver::process_acknowledged ()
 {
   if (!scol_ && scripts_.size () > 1)
     {
index f6dec3a7c4372d368c47f6720be40145b51ed452..9f2f760d9fef2aab7020c2de31aa72826e1cd4b2 100644 (file)
@@ -39,8 +39,8 @@ class Script_engraver : public Engraver
 
 protected:
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void acknowledge_grob (Grob_info);
 
 public:
@@ -237,6 +237,8 @@ Script_engraver::stop_translation_timestep ()
   scripts_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Script_engraver,
                /* descr */ "Handles note scripted articulations.",
                /* creats*/ "Script",
index b3bfe12aef26341b65f526653d8410af24d5c5df..b8b36943f303112f9ab4f39cb0d73cf682e0f2f6 100644 (file)
@@ -6,16 +6,18 @@
   (c) 1998--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
+#include "engraver.hh"
+
 #include "separating-group-spanner.hh"
 #include "separation-item.hh"
 #include "paper-column.hh"
 #include "output-def.hh"
-#include "engraver.hh"
 #include "axis-group-interface.hh"
 #include "note-spacing.hh"
 #include "accidental-placement.hh"
 #include "context.hh"
 #include "grob-array.hh"
+#include "pointer-group-interface.hh"
 
 struct Spacings
 {
@@ -51,10 +53,10 @@ protected:
   Spanner *sep_span_;
 
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
 public:
   TRANSLATOR_DECLARATIONS (Separating_line_group_engraver);
 };
@@ -217,6 +219,8 @@ Separating_line_group_engraver::stop_translation_timestep ()
   musical_item_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Separating_line_group_engraver,
                /* descr */ "Generates objects for computing spacing parameters.",
                /* creats*/ "SeparationItem SeparatingGroupSpanner StaffSpacing",
index ee1ea2fd441213d131faadd664d92995ed7739a5..74d1f52b9f57c0c3067ae1efb63b8917a0503bab 100644 (file)
@@ -46,9 +46,9 @@ protected:
   Item *double_percent_;
 protected:
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 Slash_repeat_engraver::Slash_repeat_engraver ()
@@ -119,6 +119,8 @@ Slash_repeat_engraver::stop_translation_timestep ()
   beat_slash_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Slash_repeat_engraver,
                /* descr */ "Make beat repeats.",
                /* creats*/ "RepeatSlash",
index f87e78279dd76f71037e1b1ea6b0a194e68bdbd6..cb1da18560ab0f92d92e7ba43401827817581b5f 100644 (file)
@@ -30,9 +30,9 @@ class Slur_engraver : public Engraver
 protected:
   virtual bool try_music (Music *);
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void finalize ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 public:
   TRANSLATOR_DECLARATIONS (Slur_engraver);
@@ -156,6 +156,8 @@ Slur_engraver::stop_translation_timestep ()
   events_[START] = events_[STOP] = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Slur_engraver,
                /* descr */ "Build slurs grobs from slur events",
                /* creats*/ "Slur",
index eb879a7f99d1ce4b6fc44ab5793860cf15ae853f..9742d753d99d0dcede78c22a06a55b3b40b3156a 100644 (file)
@@ -24,8 +24,8 @@ public:
 
 protected:
   virtual bool try_music (Music *ev);
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   void set_melisma (bool);
 private:
   Music *start_ev_;
@@ -89,6 +89,8 @@ Slur_performer::try_music (Music *m)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Slur_performer, "", "",
                "slur-event", "", "", "");
 
index 5637e335511c92676733cda15aa0f08c38d09c85..b2b27ff282448a83bbb13bbf83ea220f3c32c891 100644 (file)
@@ -47,9 +47,9 @@ class Spacing_engraver : public Engraver
   TRANSLATOR_DECLARATIONS (Spacing_engraver);
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void start_translation_timestep ();
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
 };
 
@@ -172,6 +172,8 @@ Spacing_engraver::start_translation_timestep ()
     stopped_durations_.push (playing_durations_.get ());
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Spacing_engraver,
                /* descr */ "make a SpacingSpanner and do bookkeeping of shortest starting and playing notes  ",
                /* creats*/ "SpacingSpanner",
index 5f77670b3f0afdcd668c6e1bb937ffaf2280508a..69736c2f8320785af6178130bcc281daf4805c4f 100644 (file)
@@ -25,8 +25,8 @@ public:
 
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_acknowledged_grobs ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Item *span_arpeggio_;
@@ -49,7 +49,7 @@ Span_arpeggio_engraver::acknowledge_grob (Grob_info info)
 }
 
 void
-Span_arpeggio_engraver::process_acknowledged_grobs ()
+Span_arpeggio_engraver::process_acknowledged ()
 {
   /*
     connectArpeggios is slightly brusque; we should really read a grob
@@ -98,6 +98,8 @@ Span_arpeggio_engraver::stop_translation_timestep ()
   arpeggios_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Span_arpeggio_engraver,
                /* descr */ "",
                /* creats*/ "Arpeggio",
index 80339b3ce8f6ff493fd4d6df62ffa7e319ca47b3..f98f8d321422665374e0be2353c648c665168ac8 100644 (file)
@@ -28,7 +28,7 @@ public:
   TRANSLATOR_DECLARATIONS (Span_bar_engraver);
 protected:
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Span_bar_engraver::Span_bar_engraver ()
@@ -72,6 +72,8 @@ Span_bar_engraver::stop_translation_timestep ()
   bars_.set_size (0);
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Span_bar_engraver,
                /* descr */ "This engraver makes cross-staff barlines: It catches all normal "
                "bar lines, and draws a single span-bar across them.",
index 261791f1d041e4f938797a56b2a41fcf749cec61..ae50a097f525ff86ec94a3567e6914e90397a09e 100644 (file)
@@ -16,6 +16,8 @@
 #include "axis-group-interface.hh"
 #include "bar-line.hh"
 #include "grob.hh"
+#include "pointer-group-interface.hh"
+
 
 void
 Span_bar::add_bar (Grob *me, Grob *b)
index bb99c704877c6b8ec292d7891dfc3d35a5fc6162..7b367c2899de0c06423861e26bee0ba02c4da3f6 100644 (file)
@@ -31,8 +31,8 @@ public:
 protected:
   virtual bool try_music (Music *);
   virtual void acknowledge_audio_element (Audio_element_info);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Audio_dynamic *audio_;
@@ -179,6 +179,8 @@ Span_dynamic_performer::try_music (Music *r)
     }
   return false;
 }
+#include "translator.icc"
+
 ADD_TRANSLATOR (Span_dynamic_performer,
                "", "",
                "crescendo-event decrescendo-event",
index 776f4097d111dbacf3b809f0b9138f7eeeca6c02..1909eee4feda1bc1372c0435d00263d39a595e00 100644 (file)
@@ -209,8 +209,6 @@ Spanner::Spanner (SCM s, Object_key const *key)
   break_index_ = 0;
   spanned_drul_[LEFT] = 0;
   spanned_drul_[RIGHT] = 0;
-
-  interfaces_ = scm_cons (ly_symbol2scm ("spanner-interface"), interfaces_);
 }
 
 Spanner::Spanner (Spanner const &s, int count)
index f9b97e4c67ff70b0dde52a9c8cc3a5721323ceac..5784dd79c7c3fbcc59e479a9b2b6a7679dff6922 100644 (file)
@@ -34,6 +34,8 @@ Staff_collecting_engraver::acknowledge_grob (Grob_info gi)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Staff_collecting_engraver,
                /* descr */ "Maintain the stavesFound variable",
 
index 902744a6cc7c44f22efdad40e28a1dada7be24b4..a687a686e07b91546e44d2003a249a84ce6c14ce 100644 (file)
@@ -16,7 +16,7 @@
 /** Perform a staff. Individual notes should have their instrument
     (staff-wide) set, so we override play_element ()
 */
-class Staff_performer : public Performer_group_performer
+class Staff_performer : public Performer
 {
 public:
   TRANSLATOR_DECLARATIONS (Staff_performer);
@@ -26,11 +26,11 @@ public:
   String instrument_string_;
 
 protected:
-  virtual void play_element (Audio_element *p);
+  virtual void acknowledge_audio_element (Audio_element *p);
   virtual void finalize ();
   virtual void initialize ();
   virtual void create_audio_elements ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 private:
   Audio_staff *audio_staff_;
@@ -40,6 +40,8 @@ private:
   Audio_tempo *tempo_;
 };
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Staff_performer, "", "",
                "",
                "", "", "");
@@ -68,8 +70,6 @@ Staff_performer::initialize ()
 
   tempo_ = new Audio_tempo (get_tempo ());
   announce_element (Audio_element_info (tempo_, 0));
-
-  Performer_group_performer::initialize ();
 }
 
 void
@@ -89,7 +89,6 @@ Staff_performer::create_audio_elements ()
       play_element (instrument_);
       play_element (instrument_name_);
     }
-  Performer_group_performer::create_audio_elements ();
 }
 
 void
@@ -111,13 +110,11 @@ Staff_performer::stop_translation_timestep ()
     }
   instrument_name_ = 0;
   instrument_ = 0;
-  Performer_group_performer::stop_translation_timestep ();
 }
 
 void
 Staff_performer::finalize ()
 {
-  Performer_group_performer::finalize ();
   Performer::play_element (audio_staff_);
   audio_staff_ = 0;
 }
@@ -138,12 +135,11 @@ Staff_performer::new_instrument_string ()
 }
 
 void
-Staff_performer::play_element (Audio_element *p)
+Staff_performer::acknowledge_audio_element (Audio_element *p)
 {
   if (Audio_item *ai = dynamic_cast<Audio_item *> (p))
     {
       audio_staff_->add_audio_item (ai);
     }
-  Performer::play_element (p);
 }
 
index 8725390805016dbb94ebcc5d306f41f0e8cd6f90..f9e79a6b94425bc0645897baf19cf6f35e95808e 100644 (file)
@@ -108,6 +108,8 @@ Staff_symbol_engraver::acknowledge_grob (Grob_info s)
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Staff_symbol_engraver,
                /* descr */ "Create the constellation of five (default) "
                "staff lines.",
index 0c9e40b6e2cf5fc473964a2f7d08510ea00e4dd1..5024f3423b53971d676cb59de0438cfba4a0a000 100644 (file)
@@ -23,7 +23,7 @@ protected:
   Link_array<Grob> lyrics_;
   Link_array<Grob> stanza_numbers_;
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Stanza_number_align_engraver::Stanza_number_align_engraver ()
@@ -52,6 +52,8 @@ Stanza_number_align_engraver::stop_translation_timestep ()
   lyrics_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Stanza_number_align_engraver,
                "This engraver ensures that stanza numbers are neatly aligned. ",
                "",
index d74f0d8bcb5dbbb978e80c3d6c7f3aa9057c4742..618add3881caf06e97f47d7313be3727a09edd4e 100644 (file)
@@ -21,8 +21,8 @@ class Stanza_number_engraver : public Engraver
   SCM last_stanza_;
 public:
   TRANSLATOR_DECLARATIONS (Stanza_number_engraver);
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
 };
 
@@ -67,6 +67,8 @@ Stanza_number_engraver::stop_translation_timestep ()
   text_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Stanza_number_engraver,
                /* descr */ "",
                /* creats*/ "StanzaNumber",
index 36e7661242c5c0edb3be981ef39f9c54d820b1be..e9369c1842bb3dde853616f284ee07e7049f6efd 100644 (file)
@@ -34,7 +34,7 @@ protected:
   void make_stem (Grob_info);
 
   virtual void acknowledge_grob (Grob_info);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual bool try_music (Music *);
 };
 
@@ -171,6 +171,8 @@ Stem_engraver::try_music (Music *m)
   return false;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Stem_engraver,
                /* descr */ "Create stems and single-stem tremolos.  It also works together with "
                "the beam engraver for overriding beaming.",
index 503445facb7caee0502b7aa0debaa2c6baf138bd..c21eff2aa4710de6092ddaaf5a787bb63f443242 100644 (file)
@@ -32,6 +32,8 @@ String_number_engraver::String_number_engraver ()
   engraver should provide this functionality.
 */
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (String_number_engraver,
                /* descr */ "Swallow string-number-events - the purpose of this engraver is to"
                " process tab for normal notation. To provent warnings for unprocessed "
index e9178e7142526840b740a164453cbde666320b4f..9d51eb6edd21ed040564f4ffdee3ac3fd033faa7 100644 (file)
@@ -26,6 +26,8 @@ Swallow_engraver::Swallow_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Swallow_engraver,
                /* descr */ "This engraver swallows everything given to it silently. The purpose of "
                "this is to prevent spurious \"event junked\" warnings.",
index 3bf237d1015ad8699e13d695f25924214f1ee74f..2c0dbad55c0ae46686930c40c71d490b99a2d07e 100644 (file)
@@ -31,6 +31,8 @@ Swallow_performer::try_music (Music *m)
 Swallow_performer::Swallow_performer ()
 {}
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Swallow_performer,
                /* descr */ "",
                /* creats*/ "",
index 4b4f33c17be572a1349a72aeb7bdf58f2005d5f9..1646ee5477111a5474ecfcc036f21c0662b317cd 100644 (file)
@@ -22,7 +22,7 @@ public:
 protected:
   Spanner *delim_;
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
 };
 
@@ -82,6 +82,8 @@ System_start_delimiter_engraver::finalize ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (System_start_delimiter_engraver,
                /* descr */ "Creates a system start delimiter (ie. SystemStart@{Bar, Brace, Bracket@} spanner",
                /* creats*/ "SystemStartBar SystemStartBrace SystemStartBracket",
index e2d323b8c8f2c235a0514a37bf0cc8f9f02483c2..b49dc452e0547e49a6054bdb3b6db84f09388129 100644 (file)
@@ -19,6 +19,7 @@
 #include "lookup.hh"
 #include "item.hh"
 
+#include "pointer-group-interface.hh"
 
 
 Stencil
index 4cf4f13c47d8590ce265f2bb73b52906963884bc..73e65dfeb386ef417952e7a8aab1523defb2d815 100644 (file)
@@ -25,6 +25,7 @@
 #include "paper-system.hh"
 #include "tweak-registration.hh"
 #include "grob-array.hh"
+#include "pointer-group-interface.hh"
 
 System::System (System const &src, int count)
   : Spanner (src, count)
@@ -428,22 +429,22 @@ Link_array<Grob>
 System::columns () const
 {
   extract_grob_set (this, "columns", ro_columns);
-  Link_array<Grob> columns (ro_columns);
-  
-  bool found = false;
-  for (int i = columns.size (); i--;)
+
+  int last_breakable = ro_columns.size ();
+
+  while  (last_breakable --)
     {
-      bool brb = Item::is_breakable (columns[i]);
-      found = found || brb;
-
-      /*
-       the last column should be breakable. Weed out any columns that
-       seem empty. We need to retain breakable columns, in case
-       someone forced a breakpoint.
-      */
-      if (!found || !Paper_column::is_used (columns[i]))
-       columns.del (i);
+      if (Item::is_breakable (ro_columns [last_breakable]))
+       break;
     }
+
+  Link_array<Grob> columns;
+  for (int i = 0; i <= last_breakable; i++)
+    {
+      if (Paper_column::is_used (ro_columns[i]))
+       columns.push (ro_columns[i]);
+    }
+
   return columns;
 }
 
index d4210c42fc5edd1cb94dd856367febdc11bb5809..3aab0a9e862aa8eff8d38fa707aab70d36896fd4 100644 (file)
@@ -36,9 +36,9 @@ public:
 
 protected:
   virtual bool try_music (Music *event);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 };
 
 Tab_note_heads_engraver::Tab_note_heads_engraver ()
@@ -165,6 +165,8 @@ Tab_note_heads_engraver::stop_translation_timestep ()
   tabstring_events_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Tab_note_heads_engraver,
                /* descr */ "Generate one or more tablature noteheads from Music of type NoteEvent.",
                /* creats*/ "TabNoteHead Dots",
index c6c22b519fd55ed793faa2c8fd40188a49238c87..1227d2e0f076a95e2551ec7b690ed7e2d41a9130 100644 (file)
@@ -35,6 +35,8 @@ Tab_staff_symbol_engraver::Tab_staff_symbol_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Tab_staff_symbol_engraver,
                /* descr */ "Create a staff-symbol, but look at stringTunings for the number of lines."
                "staff lines.",
index 58310da1dc69ca5eb2c484f7e98529fa19602bee..c58ba137f69bbc575b73acd0fe6a56717ecb4d2c 100644 (file)
@@ -21,7 +21,7 @@ public:
 protected:
 
   virtual bool try_music (Music *req);
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
 
 private:
@@ -77,6 +77,8 @@ Tempo_performer::try_music (Music *req)
   return true;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Tempo_performer, "", "",
                "metronome-change-event",
                "", "", "");
index 1766ac64b710a3a5c937af577d776033ac360876..b9f95093042ee0c1ecbdb89bee66921e63bc9b6f 100644 (file)
@@ -24,8 +24,8 @@ public:
   TRANSLATOR_DECLARATIONS (Text_engraver);
 protected:
   virtual bool try_music (Music *m);
-  virtual void stop_translation_timestep ();
-  virtual void process_acknowledged_grobs ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_acknowledged ();
   virtual void acknowledge_grob (Grob_info);
 };
 
@@ -72,7 +72,7 @@ Text_engraver::acknowledge_grob (Grob_info inf)
 }
 
 void
-Text_engraver::process_acknowledged_grobs ()
+Text_engraver::process_acknowledged ()
 {
   if (texts_.size ())
     return;
@@ -119,6 +119,8 @@ Text_engraver::Text_engraver ()
 {
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Text_engraver,
                /* descr */ "Create text-scripts",
                /* creats*/ "TextScript",
index 5c177c5a96ae10ecf59a4fcb955ca47b8429bdd5..69f4c55c848da4fbd412681bbaf912e685f2e535 100644 (file)
@@ -18,8 +18,8 @@ protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 private:
   Spanner *span_;
@@ -139,6 +139,8 @@ Text_spanner_engraver::finalize ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Text_spanner_engraver,
                /* descr */ "Create text spanner from a Music.",
                /* creats*/ "TextSpanner",
index 0705690f171645ccca8eb6db9cb29ac9f1b951de..cf5364015cb9daadad230e4086fd462d29683db0 100644 (file)
@@ -53,12 +53,12 @@ class Tie_engraver : public Engraver
   Spanner *tie_column_;
 
 protected:
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void derived_mark () const;
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   void typeset_tie (Grob *);
 public:
   TRANSLATOR_DECLARATIONS (Tie_engraver);
@@ -208,6 +208,8 @@ Tie_engraver::typeset_tie (Grob *her)
   index_set_cell (her->get_property ("head-pair"), RIGHT, new_head_drul[RIGHT]->self_scm ());
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Tie_engraver,
                /* descr */ "Generate ties between noteheads of equal pitch.",
                /* creats*/ "Tie TieColumn",
index 7dc078bd95299ab06f70af88b6d43765476e0ec2..f47e3ae597914533cc389217095a5a66eca30e07 100644 (file)
@@ -24,11 +24,11 @@ class Tie_performer : public Performer
   bool ties_created_;
 
 protected:
-  virtual void stop_translation_timestep ();
-  virtual void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
   virtual void acknowledge_audio_element (Audio_element_info);
   virtual bool try_music (Music *);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 public:
   TRANSLATOR_DECLARATIONS (Tie_performer);
 };
@@ -108,6 +108,8 @@ Tie_performer::stop_translation_timestep ()
   now_heads_.clear ();
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Tie_performer,
                /* descr */ "Generate ties between noteheads of equal pitch.",
                /* creats*/ "",
index 77fd444f129f399ab70f0277491f6811668341e8..c904595505b5e824856ddbc2e17c6fc6aaad9efb 100644 (file)
@@ -20,8 +20,8 @@ class Time_signature_engraver : public Engraver
   SCM last_time_fraction_;
 
 protected:
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 public:
   TRANSLATOR_DECLARATIONS (Time_signature_engraver);
 };
@@ -68,6 +68,8 @@ Time_signature_engraver::stop_translation_timestep ()
   time_signature_ = 0;
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Time_signature_engraver,
                /* descr */ "Create a TimeSignature whenever @code{timeSignatureFraction} changes",
                /* creats*/ "TimeSignature",
index 072990db3f48989beaed0b5496ae94e1860b32dd..45c74e208e8f6a3ce511912a68b12dee357bd6a9 100644 (file)
@@ -18,7 +18,7 @@ public:
 
 protected:
 
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
   virtual void create_audio_elements ();
   virtual void derived_mark () const;
   SCM prev_fraction_;
@@ -69,4 +69,6 @@ Time_signature_performer::stop_translation_timestep ()
     }
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Time_signature_performer, "", "", "", "", "", "");
index 1c30fcd34f085bb5ba56a07d408e7d1f7648dd01..54c3543d711ba9ce844414f44fc5ed51859d429f 100644 (file)
@@ -1,81 +1,54 @@
 /*
-  timing-engraver.cc -- implement Timing_engraver
+  timing-engraver.cc -- implement Default_bar_line_engraver
 
   source file of the GNU LilyPond music typesetter
 
   (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
-#include "timing-translator.hh"
 #include "engraver.hh"
-
 #include "context.hh"
 #include "multi-measure-rest.hh"
 #include "grob.hh"
 #include "warn.hh"
 
 
-class Timing_engraver : public Timing_translator, public Engraver
+class Default_bar_line_engraver : public Engraver
 {
 protected:
   /* Need to know whether we're advancing in grace notes, or not. */
   Moment last_moment_;
 
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
-  virtual void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
 
 public:
-  TRANSLATOR_DECLARATIONS (Timing_engraver);
+  TRANSLATOR_DECLARATIONS (Default_bar_line_engraver);
 };
 
-ADD_TRANSLATOR (Timing_engraver,
-               /* descr */ " Responsible for synchronizing timing information from staves.  "
-               "Normally in @code{Score}.  In order to create polyrhythmic music, "
-               "this engraver should be removed from @code{Score} and placed in "
-               "@code{Staff}. "
-               "\n\nThis engraver adds the alias @code{Timing} to its containing context.",
+#include "translator.icc"
+
+ADD_TRANSLATOR (Default_bar_line_engraver,
+               "This engraver determines what kind of automatic bar lines should be produced, "
+               "and sets @code{whichBar} accordingly. It should be at the same "
+               "level as @ref{Timing_translator}. ",  
                /* creats*/ "",
                /* accepts */ "",
                /* acks  */ "",
-               /* reads */ "automaticBars whichBar barAlways defaultBarType "
-               "skipBars timing measureLength measurePosition currentBarNumber",
-               /* write */ "");
+               /* reads */
+               "measurePosition automaticBars whichBar barAlways defaultBarType "
+               "measureLength",
+               /* write */ "automaticBars");
 
 
-Timing_engraver::Timing_engraver ()
+Default_bar_line_engraver::Default_bar_line_engraver ()
 {
   last_moment_.main_part_ = Rational (-1);
 }
 
 void
-Timing_engraver::process_music ()
+Default_bar_line_engraver::start_translation_timestep ()
 {
-  Timing_translator::process_music ();
-
-  bool start_of_measure = (last_moment_.main_part_ != now_mom ().main_part_
-                          && !measure_position ().main_part_);
-
-  /*
-    We can't do this in start_translation_timestep(), since time sig
-    changes won't have happened by then.
-  */
-  if (start_of_measure)
-    {
-      Moment mlen = Moment (measure_length ());
-      Grob * column = unsmob_grob (get_property ("currentCommandColumn"));
-      if (column)
-       column->set_property ("measure-length", mlen.smobbed_copy ());
-      else
-       programming_error("No command column?");
-    }
-}
-
-void
-Timing_engraver::start_translation_timestep ()
-{
-  Timing_translator::start_translation_timestep ();
-
   SCM automatic_bars = get_property ("automaticBars");
   Moment now = now_mom ();
   SCM which = get_property ("whichBar");
@@ -84,7 +57,7 @@ Timing_engraver::start_translation_timestep ()
   if (!scm_is_string (which))
     which = SCM_EOL;
 
-  Moment mp = measure_position ();
+  Moment mp = measure_position (context ());
   bool start_of_measure = (last_moment_.main_part_ != now.main_part_
                           && !mp.main_part_);
 
@@ -104,9 +77,8 @@ Timing_engraver::start_translation_timestep ()
 }
 
 void
-Timing_engraver::stop_translation_timestep ()
+Default_bar_line_engraver::stop_translation_timestep ()
 {
-  Timing_translator::stop_translation_timestep ();
   context ()->set_property ("whichBar", SCM_EOL);
   last_moment_ = now_mom ();
 }
index fc9ddc83a8c0d0a993d61b61e4865349cb92bead..b105d17d6052f35caa37081ac21ae699f6208cd1 100644 (file)
@@ -28,7 +28,7 @@ Timing_translator::stop_translation_timestep ()
   bool timb = to_boolean (tim);
   if (timb && allbars)
     {
-      Moment barleft = (measure_length () - measure_position ());
+      Moment barleft = (measure_length () - measure_position (context ()));
       Moment now = now_mom ();
 
       if (barleft > Moment (0)
@@ -76,21 +76,6 @@ Timing_translator::Timing_translator ()
 {
 }
 
-Moment
-Timing_translator::measure_position () const
-{
-  SCM sm = get_property ("measurePosition");
-
-  Moment m = 0;
-  if (unsmob_moment (sm))
-    {
-      m = *unsmob_moment (sm);
-      while (m.main_part_ < Rational (0))
-       m.main_part_ += measure_length ();
-    }
-
-  return m;
-}
 
 void
 Timing_translator::start_translation_timestep ()
@@ -150,8 +135,17 @@ Timing_translator::start_translation_timestep ()
   context ()->set_property ("measurePosition", measposp.smobbed_copy ());
 }
 
+#include "translator.icc"
+
 ADD_TRANSLATOR (Timing_translator,
                "This engraver adds the alias "
-               "@code{Timing} to its containing context.",
+               "@code{Timing} to its containing context."
+               "Responsible for synchronizing timing information from staves.  "
+               "Normally in @code{Score}.  In order to create polyrhythmic music, "
+               "this engraver should be removed from @code{Score} and placed in "
+               "@code{Staff}. "
+               "\n\nThis engraver adds the alias @code{Timing} to its containing context."
+
+               ,
 
                "", "", "", "", "");
diff --git a/lily/translator-group-ctors.cc b/lily/translator-group-ctors.cc
new file mode 100644 (file)
index 0000000..ead3290
--- /dev/null
@@ -0,0 +1,36 @@
+/*
+  translator-group-ctors.cc -- implement Translator_group factory.
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+
+#include "score-engraver.hh"
+#include "score-performer.hh"
+#include "engraver-group-engraver.hh"
+#include "performer-group-performer.hh"
+#include "recording-group-engraver.hh"
+
+/*
+  Quick & dirty.
+ */
+Translator_group *
+get_translator_group (SCM sym)
+{
+  if (sym == ly_symbol2scm ("Engraver_group_engraver"))
+    return new Engraver_group_engraver ();
+  else if (sym == ly_symbol2scm ("Performer_group_performer"))
+    return new Performer_group_performer();
+  else if (sym == ly_symbol2scm ("Score_engraver"))
+    return new Score_engraver();
+  else if (sym == ly_symbol2scm ("Score_performer"))
+    return new Score_performer();
+  else if (sym == ly_symbol2scm ("Recording_group_engraver"))
+    return new Recording_group_engraver();
+
+  assert (0);
+  return 0;
+}
index 1ec1f8216335e2393ece2f7af15f127c1121a4c9..c05c6226f9201b896bce152306f0a662abff448d 100644 (file)
@@ -16,6 +16,7 @@
 #include "main.hh"
 #include "music.hh"
 
+
 Translator_group *
 Translator_group::get_daddy_translator () const
 {
@@ -32,10 +33,17 @@ translator_each (SCM list, Translator_method method)
 void
 Translator_group::initialize ()
 {
+  precompute_method_bindings ();
+
   SCM tab = scm_make_vector (scm_int2num (19), SCM_BOOL_F);
   context ()->set_property ("acceptHashTable", tab);
 }
 
+void
+Translator_group::finalize ()
+{
+}
+
 bool
 translator_accepts_any_of (Translator *tr, SCM ifaces)
 {
@@ -66,7 +74,7 @@ find_accept_translators (SCM gravlist, SCM ifaces)
 bool
 Translator_group::try_music (Music *m)
 {
-  SCM tab = get_property ("acceptHashTable");
+  SCM tab = context ()->get_property ("acceptHashTable");
   SCM name = scm_sloppy_assq (ly_symbol2scm ("name"),
                              m->get_property_alist (false));
 
@@ -99,23 +107,47 @@ Translator_group::get_simple_trans_list ()
 
                            
 void
-recurse_over_translators (Context *c, Translator_method ptr, Direction dir)
+precomputed_recurse_over_translators (Context *c, Translator_precompute_index idx, Direction dir)
 {
   Translator_group *tg
     = dynamic_cast<Translator_group *> (c->implementation ());
   
   if (dir == DOWN)
     {
-      translator_each (tg->get_simple_trans_list (),
-                      ptr);
+      tg->precomputed_translator_foreach (idx);
+      tg->call_precomputed_self_method (idx);
+    }
+
+  for (SCM s = c->children_contexts (); scm_is_pair (s);
+       s = scm_cdr (s))
+    {
+      precomputed_recurse_over_translators (unsmob_context (scm_car (s)), idx, dir);
+    }
+
+  if (dir == UP)
+    {
+      tg->precomputed_translator_foreach (idx);
+      tg->call_precomputed_self_method (idx);
+    }
+
+}
 
-      (tg->*ptr) ();
+void
+recurse_over_translators (Context *c, Translator_method ptr, Translator_group_method tg_ptr, Direction dir)
+{
+  Translator_group *tg
+    = dynamic_cast<Translator_group *> (c->implementation ());
+  
+  if (dir == DOWN)
+    {
+      (tg->*tg_ptr) ();
+      translator_each (tg->get_simple_trans_list (), ptr);
     }
 
   for (SCM s = c->children_contexts (); scm_is_pair (s);
        s = scm_cdr (s))
     {
-      recurse_over_translators (unsmob_context (scm_car (s)), ptr, dir);
+      recurse_over_translators (unsmob_context (scm_car (s)), ptr, tg_ptr, dir);
     }
 
   if (dir == UP)
@@ -123,17 +155,100 @@ recurse_over_translators (Context *c, Translator_method ptr, Direction dir)
       translator_each (tg->get_simple_trans_list (),
                       ptr);
 
-      (tg->*ptr) ();
+      (tg->*tg_ptr) ();
     }
 }
 
 Translator_group::Translator_group ()
 {
   simple_trans_list_ = SCM_EOL;
+  context_ = 0;
+  smobify_self ();
 }
 
 void
 Translator_group::derived_mark () const
 {
-  scm_gc_mark (simple_trans_list_);
 }
+
+
+void
+Translator_group::precompute_method_bindings ()
+{
+  for (SCM s = simple_trans_list_; scm_is_pair (s); s = scm_cdr (s))
+    {
+      Translator *tr = unsmob_translator (scm_car (s));
+      Translator_void_method_ptr ptrs[TRANSLATOR_METHOD_PRECOMPUTE_COUNT];
+      tr->fetch_precomputable_methods (ptrs);
+
+      assert (tr);
+      for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
+       {
+         if (ptrs[i])
+           {
+             precomputed_method_bindings_[i].push (Translator_method_binding (tr, ptrs[i]));
+           }
+       }
+    }
+
+  fetch_precomputable_methods (precomputed_self_method_bindings_);
+}
+
+void
+Translator_group::precomputed_translator_foreach (Translator_precompute_index idx)
+{
+  Array<Translator_method_binding> &bindings(precomputed_method_bindings_[idx]);
+  for (int i = 0; i < bindings.size (); i++)
+    {
+      bindings[i].invoke ();
+    }
+}
+
+void
+Translator_group::fetch_precomputable_methods (Translator_group_void_method ptrs[])
+{
+  for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
+    ptrs[i] = 0;
+}
+
+void
+Translator_group::call_precomputed_self_method (Translator_precompute_index idx)
+{
+  if (precomputed_self_method_bindings_[idx])
+    (*precomputed_self_method_bindings_[idx])(this);
+}
+
+
+Translator_group::~Translator_group ()
+{
+}
+
+#include "ly-smobs.icc"
+
+IMPLEMENT_SMOBS (Translator_group);
+IMPLEMENT_DEFAULT_EQUAL_P (Translator_group);
+IMPLEMENT_TYPE_P (Translator_group, "ly:translator-group?");
+
+
+int
+Translator_group::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Translator_group *me = (Translator_group *) SCM_CELL_WORD_1 (s);
+  scm_puts ("#<Translator_group ", port);
+  scm_puts (classname (me), port);
+  scm_display (me->simple_trans_list_, port);
+  scm_puts (" >", port);
+  return 1;
+}
+
+
+SCM
+Translator_group::mark_smob (SCM smob)
+{
+  Translator_group *me = (Translator_group*)SCM_CELL_WORD_1 (smob);
+
+  me->derived_mark ();
+  
+  return me->simple_trans_list_;
+}
+
index 6efd36b591955244c208bbfe6191775468a49034..4266e5cf8ef6dc9045fa63336ac558f6939f4f9f 100644 (file)
@@ -30,13 +30,3 @@ LY_DEFINE (ly_translator_description, "ly:translator-description",
   return tr->translator_description ();
 }
 
-int
-Translator::print_smob (SCM s, SCM port, scm_print_state *)
-{
-  Translator *me = (Translator *) SCM_CELL_WORD_1 (s);
-  scm_puts ("#<Translator ", port);
-  scm_puts (classname (me), port);
-  scm_puts (" >", port);
-  return 1;
-}
-
index e1f3408a38b79f441ab928b239ef8baa8d895bf4..e67ffcda221bceef24705d1e2fad3851adb85f55 100644 (file)
@@ -13,6 +13,7 @@
 #include "context-def.hh"
 #include "global-context.hh"
 
+#include "translator.icc"
 #include "ly-smobs.icc"
 
 Translator::~Translator ()
@@ -28,13 +29,14 @@ Translator::init ()
   smobify_self ();
 }
 
+
 void
-Translator::do_announces ()
+Translator::process_music ()
 {
 }
 
 void
-Translator::process_music ()
+Translator::process_acknowledged ()
 {
 }
 
@@ -156,3 +158,21 @@ void
 Translator::derived_mark () const
 {
 }
+
+void
+Translator::fetch_precomputable_methods (Translator_void_method_ptr ptrs[])
+{
+  for (int i = 0; i < TRANSLATOR_METHOD_PRECOMPUTE_COUNT; i++)
+    ptrs[i] = 0;
+}
+
+int
+Translator::print_smob (SCM s, SCM port, scm_print_state *)
+{
+  Translator *me = (Translator *) SCM_CELL_WORD_1 (s);
+  scm_puts ("#<Translator ", port);
+  scm_puts (classname (me), port);
+  scm_puts (" >", port);
+  return 1;
+}
+
index 454227c297392225089b8fbcb7e3fb7805bae138..b5572185612a3e0b0daf84bf7e99dcd24dc216f8 100644 (file)
@@ -17,6 +17,8 @@
 #include "side-position-interface.hh"
 #include "engraver.hh"
 
+#include "translator.icc"
+
 class Trill_spanner_engraver : public Engraver
 {
 public:
@@ -25,8 +27,8 @@ protected:
   virtual void finalize ();
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *);
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
 private:
   Spanner *span_;
index 2b1df50fa280a04300c64bd37f766e65cda1d39b..7bec0b218e4632597fd2874ceb00ddeba5275821 100644 (file)
@@ -12,6 +12,8 @@
 #include "engraver.hh"
 #include "spanner.hh"
 
+#include "translator.icc"
+
 struct Tuplet_description
 {
   Music *music_;
@@ -35,8 +37,8 @@ protected:
 
   virtual void acknowledge_grob (Grob_info);
   virtual bool try_music (Music *r);
-  virtual void start_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void start_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 };
 
 bool
index 47c40fe0eb97ae3881b4930357a33bc69db9d1fd..2c2924072749121c310d9e31588bd77f664868ea 100644 (file)
@@ -9,7 +9,9 @@
 #include "translator.hh"
 #include "music.hh"
 
-class Skip_event_swallow_translator : public virtual Translator
+#include "translator.icc"
+
+class Skip_event_swallow_translator : public Translator
 {
 protected:
   virtual bool try_music (Music *) { return true; }
@@ -18,7 +20,7 @@ public:
   TRANSLATOR_DECLARATIONS (Skip_event_swallow_translator);
 };
 
-class Rest_swallow_translator : public virtual Translator
+class Rest_swallow_translator : public Translator
 {
 protected:
   virtual bool try_music (Music *) { return true; }
@@ -48,7 +50,7 @@ ADD_TRANSLATOR (Rest_swallow_translator,
 
                "");
 
-class Note_swallow_translator : public virtual Translator
+class Note_swallow_translator : public Translator
 {
 protected:
   virtual bool try_music (Music *) { return true; }
@@ -57,7 +59,9 @@ public:
   TRANSLATOR_DECLARATIONS (Note_swallow_translator);
 };
 
-Note_swallow_translator::Note_swallow_translator (){}
+Note_swallow_translator::Note_swallow_translator ()
+{
+}
 
 ADD_TRANSLATOR (Note_swallow_translator,
                "Swallow notes",
index e6b0f002b87730f9311a81e6bf0e2b24ab5a9547..2804346e2e632f82efa27d434765478ea6c7ddcc 100644 (file)
@@ -16,6 +16,8 @@
 #include "output-def.hh"
 #include "paper-column.hh"
 
+#include "translator.icc"
+
 /*
  * This class implements the notation specific aspects of Vaticana
  * style ligatures for Gregorian chant notation.
index efcb08e794a951e0ef11a33d91a179bd6efff102..8cf85f25720cba64473db6395d300e948a7cbe50 100644 (file)
@@ -16,6 +16,8 @@
 #include "pointer-group-interface.hh"
 #include "grob-array.hh"
 
+#include "translator.icc"
+
 class Vertical_align_engraver : public Engraver
 {
   Spanner *valign_;
@@ -28,7 +30,7 @@ public:
 protected:
   virtual void derived_mark () const;
   virtual void acknowledge_grob (Grob_info);
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void process_music ();
   virtual void finalize ();
   virtual void initialize ();
 };
diff --git a/lily/vertically-spaced-context-engraver.cc b/lily/vertically-spaced-context-engraver.cc
new file mode 100644 (file)
index 0000000..f62fbe0
--- /dev/null
@@ -0,0 +1,67 @@
+/*
+  vertically-spaced-contexts-engraver.cc -- implement Vertically_spaced_contexts_engraver
+
+  source file of the GNU LilyPond music typesetter
+
+  (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+
+*/
+
+#include "engraver.hh"
+#include "grob.hh"
+#include "axis-group-interface.hh"
+#include "context.hh"
+#include "pointer-group-interface.hh"
+
+class Vertically_spaced_contexts_engraver : public Engraver
+{
+  TRANSLATOR_DECLARATIONS(Vertically_spaced_contexts_engraver);
+protected:
+  virtual void acknowledge_grob (Grob_info);
+  virtual void initialize ();
+
+private:
+  Grob * system_;
+};
+
+
+
+Vertically_spaced_contexts_engraver::Vertically_spaced_contexts_engraver ()
+{
+  system_ = 0;
+}
+
+void
+Vertically_spaced_contexts_engraver::initialize ()
+{
+  system_ = unsmob_grob (get_property ("rootSystem"));
+}
+
+void
+Vertically_spaced_contexts_engraver::acknowledge_grob (Grob_info gi)
+{
+  if (Axis_group_interface::has_interface (gi.grob ())
+      && gi.grob ()->internal_has_interface (ly_symbol2scm ("vertically-spaceable-interface")))
+    {
+      SCM spaceable = get_property ("verticallySpacedContexts");
+      Context *orig = gi.origin_contexts (this)[0];
+
+      if (scm_memq (ly_symbol2scm (orig->context_name ().to_str0 ()),
+                   spaceable) != SCM_BOOL_F)
+       {
+         Pointer_group_interface::add_grob (system_,
+                                            ly_symbol2scm ("spaceable-staves"),
+                                            gi.grob ());
+       }
+    }
+}
+
+#include "translator.icc"
+
+ADD_TRANSLATOR (Vertically_spaced_contexts_engraver,
+               /* descr */ "",
+               /* creats*/ "",
+               /* accepts */ "",
+               /* acks  */ "axis-group-interface",
+               /* reads */ "verticallySpacedContexts",
+               /* write */ "verticallySpacedContexts");
index 03e940650d32e43ac20ee09c4758b4a255b9e60b..a344a8535dd294e9dd6cf7bf5727cad7eb50aae4 100644 (file)
@@ -15,6 +15,8 @@
 #include "warn.hh"
 #include "staff-symbol.hh"
 
+#include "translator.icc"
+
 /*
   Create Volta spanners, by reading repeatCommands  property, usually
   set by Unfolded_repeat_iterator.
@@ -27,8 +29,8 @@ protected:
 
   virtual void acknowledge_grob (Grob_info);
   virtual void finalize ();
-  virtual void stop_translation_timestep ();
-  virtual void process_music ();
+  PRECOMPUTED_VIRTUAL void stop_translation_timestep ();
+  PRECOMPUTED_VIRTUAL void process_music ();
 
   Moment started_mom_;
   Spanner *volta_span_;
index ed3c6134fb8c29869f7307fd4bfca3ccd55f90b8..11ebe1013b0d6a5187a39de99f8c46757f4ce3eb 100644 (file)
@@ -418,14 +418,17 @@ AncientRemoveEmptyStaffContext = \context {
     not contained in any other context).  It is instantiated
     automatically when an output definition (a @code{\score} or
     @code{\layout} block) is processed."
-  
+
+
+  \consists "Paper_column_engraver"
+  \consists "Vertically_spaced_contexts_engraver"
   \consists "Repeat_acknowledge_engraver"
   \consists "Staff_collecting_engraver"
 
   %% move the alias along with the engraver.
 
-  \consists "Timing_engraver"
-  
+  \consists "Timing_translator"
+  \consists "Default_bar_line_engraver"
   \consists "Output_property_engraver"
   \consists "System_start_delimiter_engraver"
   \consists "Mark_engraver"    
index d667a12206f4df097a9b857b02d4ddb302fa9d28..e38e1fae4e8d9644faf11ffd428e1a410d078607 100644 (file)
@@ -4,10 +4,11 @@
                                % setup for Request->Element conversion. Guru-only
                                %
 \context {
-    \type "Staff_performer"
+    \type "Performer_group_performer"
     \name Staff
     \accepts Voice
-
+    
+    \consists "Staff_performer"
     \consists "Key_performer"
     \consists "Tempo_performer"
     \consists "Time_signature_performer"
 
 
 \context {
-    \type "Staff_performer" % Performer_group_performer ?
+    \type "Performer_group_performer"
+    \consists "Staff_performer" % Performer_group_performer ?
     \consists "Lyric_performer"
     \name Lyrics
     \consists "Time_signature_performer"
index d15ed9b30340df60fea37cb075d7852b8af7a455..e63dd9675a023f8f3ddd558143b72db5e175e23a 100644 (file)
@@ -177,7 +177,7 @@ every bar line.
      (defaultBarType ,string? "Sets the default type of bar line.
 See @code{whichBar} for information on available bar types.
 
-This variable is  read by @internalsref{Timing_engraver} at
+This variable is  read by @internalsref{Timing_translator} at
 @internalsref{Score} level.
 ")
 
@@ -300,13 +300,11 @@ sustain pedals: @code{text}, @code{bracket} or @code{mixed} (both).")
      (printKeyCancellation ,boolean? "Print restoration alterations before a key signature change. ")
      (printPartCombineTexts ,boolean? "set Solo/A due texts in the part combiner?")
      (printOctaveNames ,boolean? "Print octave marks for the NoteNames context.")
-     (recordEventSequence ,procedure? "When
-@internalsref{Recording_group_engraver} is in this context, then upon
-termination of the context, this function is called with current
-context and a list of music objects.  The list of contains entries
-with start times, music objects and whether they are processed in this
-context.")
-     
+     (recordEventSequence ,procedure? "When Recording_group_engraver
+is in this context, then upon termination of the context, this
+function is called with current context and a list of music objects.
+The list of contains entries with start times, music objects and
+whether they are processed in this context.")
 
      (rehearsalMark ,integer? "The last rehearsal mark printed.")
      (repeatCommands ,list? "This property is read to find any command of the form @code{(volta . @var{x})}, where @var{x} is a string or @code{#f}")
index 91dc17cc1eec26d4ce097bec75ef6a79a3050f3d..48829773c9a6ac3f788957465ad06de26957f79c 100644 (file)
@@ -23,7 +23,8 @@
        (inside-slur . #t)
        (cautionary-style . parentheses)
        (after-line-breaking-callback . ,Accidental_interface::after_line_breaking)
-       (meta . ((interfaces . (item-interface accidental-interface
+       (meta . ((class . Item)
+                (interfaces . (accidental-interface
                                               font-interface))))
        ))
 
@@ -34,7 +35,8 @@
        ;; this is quite small, but it is very ugly to have
        ;; accs closer to the previous note than to the next one.
        (right-padding . 0.15)
-       (meta . ((interfaces . (item-interface accidental-placement-interface))))
+       (meta . ((class . Item)
+                (interfaces . (accidental-placement-interface))))
        ))
     (Ambitus
      . (
        (breakable . #t)
        (break-align-symbol . ambitus)
        (break-visibility . ,begin-of-line-visible)
-       (meta . ((interfaces . (axis-group-interface
-                               break-aligned-interface ambitus-interface item-interface))))
+       (meta . ((class . Item)
+                (interfaces . (axis-group-interface
+                               break-aligned-interface ambitus-interface))))
        ))
 
     (AmbitusLine
      . (
-       (print-function . ,Ambitus::print)
-       (join-heads . #t)
-       (thickness . 2)
-       (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
+       (print-function . ,Ambitus::print)
+       (join-heads . #t)
+       (thickness . 2)
+       (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
 
-       (meta . ((interfaces . (ambitus-interface staff-symbol-referencer-interface item-interface font-interface))))
-       ))
+       (meta . ((class . Item)
+                (interfaces . (ambitus-interface staff-symbol-referencer-interface font-interface))))
+       ))
     (AmbitusAccidental
      . (
        (print-function . ,Accidental_interface::print)
@@ -73,7 +77,8 @@
        (direction . -1)
        (cautionary-style . parentheses)
        (after-line-breaking-callback . ,Accidental_interface::after_line_breaking)
-       (meta . ((interfaces . (item-interface
+       (meta . ((class . Item)
+                (interfaces . (item-interface
                                accidental-interface break-aligned-interface
                                side-position-interface font-interface))))
        ))
        (print-function . ,Note_head::print)
        (glyph-name-procedure . ,find-notehead-symbol)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
-       (meta . ((interfaces . (font-interface note-head-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface note-head-interface
                                               ambitus-interface
                                               staff-symbol-referencer-interface
                                               rhythmic-head-interface
                                               ledgered-interface
-                                              item-interface ))))
+                                              ))))
        ))
 
     (Arpeggio
        (direction . -1)
        (padding . 0.5)
        (staff-position . 0.0)
-       (meta . ((interfaces . (arpeggio-interface
+       (meta . ((class . Item)
+                (interfaces . (arpeggio-interface
                                staff-symbol-referencer-interface side-position-interface
-                               item-interface font-interface))))
+                               font-interface))))
        ))
 
     (BarLine
        (thin-kern . 3.0)
        (hair-thickness . 1.9)
        (thick-thickness . 6.0)
-       (meta . ((interfaces . (bar-line-interface
-                               item-interface break-aligned-interface font-interface))))
+       (meta . ((class . Item)
+                (interfaces . (bar-line-interface
+                               break-aligned-interface font-interface))))
        ))
 
 
        (self-alignment-X . 1)
 
        (meta .
-             ((interfaces . (side-position-interface
+             ((class . Item)
+              (interfaces . (side-position-interface
                              text-interface
                              self-alignment-interface
-                             font-interface item-interface break-aligned-interface))))
+                             font-interface break-aligned-interface))))
 
-            ))
+       ))
 
     (BassFigure
      . (
        ;; layout16 become too small.
        (font-size . -4)
        (kern . 0.2)
-       (meta . ((interfaces . (text-interface
-                               rhythmic-grob-interface bass-figure-interface item-interface
+       (meta . ((class . Item)
+                (interfaces . (text-interface
+                               rhythmic-grob-interface bass-figure-interface
                                self-alignment-interface font-interface))))
        ))
     (Beam
                               ,Beam::slope_damping
                               ,Beam::shift_region_to_valid
                               ,Beam::quanting
-                             ))
+                              ))
 
        ;; TODO: should be in SLT.
        (thickness . 0.48) ; in staff-space
        (font-family . roman)
        
        (space-function . ,Beam::space_function)
-       (meta . ((interfaces . (staff-symbol-referencer-interface beam-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (staff-symbol-referencer-interface beam-interface))))
        ))
 
     (BreakAlignment
                                 clef staff-bar key-cancellation key-signature
                                 time-signature custos)
 
-                               ; unbroken
+                                       ; unbroken
                                (instrument-name left-edge ambitus breathing-sign
                                                 clef staff-bar key-cancellation key-signature
                                                 staff
                                                 time-signature custos)
-                               ; begin of line
+                                       ; begin of line
                                (instrument-name left-edge ambitus breathing-sign
                                                 clef key-cancellation key-signature staff-bar
                                                 time-signature custos)
                                ))
        (axes . (0))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
-       (meta . ((interfaces . (break-alignment-interface item-interface axis-group-interface)))))
-       )
+       (meta . ((class . Item)
+                (interfaces . (break-alignment-interface axis-group-interface)))))
+     )
 
     (BreakAlignGroup
      . (
        (axes . (0))
        (X-offset-callbacks . (,Break_align_interface::alignment_callback))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
-       (meta . ((interfaces . (break-aligned-interface item-interface axis-group-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (break-aligned-interface axis-group-interface ))))
        ))
 
     (BreathingSign
        (text . ,(make-musicglyph-markup "scripts.rcomma"))
        (Y-offset-callbacks . (,Breathing_sign::offset_callback))
        (break-visibility . ,begin-of-line-invisible)
-       (meta . ((interfaces . (break-aligned-interface breathing-sign-interface text-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (break-aligned-interface
+                               breathing-sign-interface text-interface font-interface ))))
        ))
 
     (Clef
                        (right-edge . (extra-space . 0.5))
                        ))
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
-       (meta . ((interfaces . (clef-interface
+       (meta . ((class . Item)
+                (interfaces . (clef-interface
                                staff-symbol-referencer-interface font-interface
-                               break-aligned-interface item-interface ))))
+                               break-aligned-interface ))))
        ))
 
     (ClusterSpannerBeacon
      . (
        (print-function . #f)
        (Y-extent-callback . ,Cluster_beacon::height)
-       (meta . ((interfaces . (cluster-beacon-interface item-interface))))
+       (meta . ((class . Item)
+                (interfaces . (cluster-beacon-interface))))
        ))
 
     (ClusterSpanner
        (minimum-length . 0.0)
        (padding . 0.25)
        (style . ramp)
-       (meta . ((interfaces . (cluster-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (cluster-interface))))
        ))
 
 
        (word-space . 0.0)
        (font-family . sans)
        (font-size . 1.5)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface
                                rhythmic-grob-interface text-interface chord-name-interface
                                item-interface))))
        ))
        ;; todo: add X self alignment?
        (baseline-skip . 2)
        (font-series . bold)
-       (meta . ((interfaces . (text-script-interface
+       (meta . ((class . Item)
+                (interfaces . (text-script-interface
                                text-interface side-position-interface
-                               font-interface item-interface ))))
+                               font-interface ))))
        ))
     
     (Custos
                        (first-note . (minimum-fixed-space . 0.0))
                        (right-edge . (extra-space . 0.1))
                        ))
-       (meta . ((interfaces
+       (meta . ((class . Item)
+                (interfaces
                  . (custos-interface staff-symbol-referencer-interface
                                      font-interface
-                                     break-aligned-interface item-interface ))))
+                                     break-aligned-interface ))))
        ))
 
     (DotColumn
        (direction . ,RIGHT)
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (X-offset-callbacks . (,Dot_column::side_position))
-       (meta . ((interfaces . (dot-column-interface axis-group-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (dot-column-interface axis-group-interface ))))
        ))
 
     (Dots
      . (
        (print-function . ,Dots::print)
        (dot-count . 1)
-       (meta . ((interfaces . (font-interface
-                               staff-symbol-referencer-interface dots-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (font-interface
+                               staff-symbol-referencer-interface dots-interface ))))
        ))
 
     (DoublePercentRepeat
        (thickness . 0.48)
        (break-align-symbol . staff-bar)
        (break-visibility . ,begin-of-line-invisible)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface
                                break-aligned-interface
-                               percent-repeat-interface item-interface ))))
+                               percent-repeat-interface ))))
        ))
     
     (DynamicText
        (font-encoding . fetaDynamic)
        (font-shape . italic)
        (self-alignment-Y . 0)
-       (meta . ((interfaces . (font-interface text-interface self-alignment-interface
-                                              dynamic-interface script-interface item-interface))))
+       (meta . ((class . Item)
+                (interfaces . (font-interface text-interface self-alignment-interface
+                                              dynamic-interface script-interface))))
        ))
+    
     (DynamicTextSpanner
      . ((print-function . ,Dynamic_text_spanner::print)
-
-;; rather ugh with NCSB
-;      (font-series . bold)
+       
+       ;; rather ugh with NCSB
+                                       ;       (font-series . bold)
        (font-shape . italic)
        (style . dashed-line)
 
-       ; need to blend with dynamic texts.
+                                       ; need to blend with dynamic texts.
        (font-size . 1)
        (bound-padding . 0.75)
        (dash-fraction . 0.2)
        (dash-period . 3.0)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Spanner)
+                (interfaces . (font-interface
                                text-interface
                                dynamic-interface dynamic-text-spanner-interface
-                               item-interface))))
-        ))
+                               spanner-interface))))
+       ))
 
     (DynamicLineSpanner
      . (
        (minimum-space . 1.2)
        (direction . -1)
        
-       (meta . ((interfaces . (dynamic-interface axis-group-interface
-                                                 side-position-interface spanner-interface))))))
+       (meta . ((class . Spanner)
+                (interfaces . (dynamic-interface axis-group-interface
+                                                 side-position-interface))))))
 
     (Fingering
      . (
        (print-function . ,Text_interface::print)
 
-       ; sync with TextScript (?)
+                                       ; sync with TextScript (?)
        (padding . 0.5)
        (staff-padding . 0.5)
        (self-alignment-X . 0)
        (script-priority . 100)
        (font-encoding . fetaNumber)
        (font-size . -5)                ; don't overlap when next to heads.
-       (meta . ((interfaces . (finger-interface
+       (meta . ((class . Item)
+                (interfaces . (finger-interface
                                font-interface text-script-interface text-interface
                                side-position-interface self-alignment-interface
                                item-interface))))
        (Y-extent-callback . #f)                        
        (after-line-breaking-callback . ,Line_spanner::after_line_breaking)
        (print-function . ,Line_spanner::print)
-       (meta . ((interfaces . (line-interface line-spanner-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (line-interface line-spanner-interface))))
        ))
 
     (GridPoint
      . (
        (X-extent . (0 . 0))
        (Y-extent . (0 . 0))
-       (meta . ((interfaces . (grid-point-interface))))
+       (meta . ((class . Item)
+                (interfaces . (grid-point-interface))))
        ))
 
     (GridLine
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self
                               ,Self_alignment_interface::centered_on_parent))
        (layer . 0)
-       (meta . ((interfaces . (self-alignment-interface grid-line-interface)))
-       )))
-       
+       (meta . ((class . Spanner)
+                (interfaces . (self-alignment-interface grid-line-interface)))
+             )))
+    
     (Hairpin
      . (
        (print-function . ,Hairpin::print)
        (bound-padding . 1.0)
        (self-alignment-Y . 0)
        (Y-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
-       (meta . ((interfaces . (hairpin-interface
+       (meta . ((class . Spanner)
+                (interfaces . (hairpin-interface
                                line-interface self-alignment-interface dynamic-interface
                                spanner-interface))))
        ))
        (staff-padding . 0.2)
        (direction . -1)
        (bracket-flare . (0.5 . 0.5))
-       (meta . ((interfaces . (horizontal-bracket-interface
+       (meta . ((class . Spanner)
+                (interfaces . (horizontal-bracket-interface
                                side-position-interface
                                line-interface
                                spanner-interface))))
        (break-align-symbol . instrument-name)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface
                                self-alignment-interface side-position-interface text-interface
-                               break-aligned-interface item-interface ))))
+                               break-aligned-interface ))))
        ))
 
     (KeyCancellation
        (break-visibility . ,begin-of-line-invisible)
        (breakable . #t)
        
-       (meta . ((interfaces . (key-signature-interface font-interface
-                                                       break-aligned-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (key-signature-interface font-interface
+                                                       break-aligned-interface ))))
        ))
     (KeySignature
      . (
        (break-visibility . ,begin-of-line-visible)
        (breakable . #t)
        
-       (meta . ((interfaces . (key-signature-interface font-interface
-                                                       break-aligned-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (key-signature-interface font-interface
+                                                       break-aligned-interface ))))
        ))
     (LedgerLineSpanner
      . (
        (spacing-procedure . ,Ledger_line_spanner::set_spacing_rods)
        (print-function . ,Ledger_line_spanner::print)
        (layer . 0)
-       (meta . ((interfaces . (spanner-interface ledger-line-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (ledger-line-interface))))
        ))
 
     (LeftEdge
                        (key-cancellation . (extra-space . 0.0))
                        
                        ))
-       (meta . ((interfaces . (break-aligned-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (break-aligned-interface ))))
        ))
 
     (LigatureBracket
        (before-line-breaking-callback . ,Tuplet_bracket::before_line_breaking)
        (after-line-breaking-callback . ,Tuplet_bracket::after_line_breaking)
        (print-function . ,Tuplet_bracket::print)
-       (meta . ((interfaces . (tuplet-bracket-interface line-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (tuplet-bracket-interface line-interface))))
        ))
 
     (LyricHyphen
        (length . 0.66)
        (minimum-length . 0.3)
        (padding . 0.07)
-;      (spacing-procedure . ,Hyphen_spanner::set_spacing_rods)
+                                       ;       (spacing-procedure . ,Hyphen_spanner::set_spacing_rods)
        (print-function . ,Hyphen_spanner::print)
        (Y-extent . (0 . 0))
-       (meta . ((interfaces . (lyric-interface lyric-hyphen-interface
+       (meta . ((class . Spanner)
+                (interfaces . (lyric-interface lyric-hyphen-interface
                                                spanner-interface))))
        ))
 
        (thickness . 0.8) ; linethickness
        (minimum-length . 1.5)
        (Y-extent . (0 . 0))
-       (meta . ((interfaces . (lyric-interface
-                               lyric-extender-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (lyric-interface
+                               lyric-extender-interface))))
        ))
 
     (LyricText
        (word-space . 0.6)
        (font-series . bold-narrow)
        (font-size . 1.0)
-       (meta . ((interfaces . (rhythmic-grob-interface
+       (meta . ((class . Item)
+                (interfaces . (rhythmic-grob-interface
                                lyric-syllable-interface
                                self-alignment-interface text-interface
-                               font-interface item-interface ))))
+                               font-interface ))))
        ))
 
     (MensuralLigature
        (flexa-width . 2.0)
        (ligature-primitive-callback . ,Mensural_ligature::brew_ligature_primitive)
        (print-function . ,Mensural_ligature::print)
-       (meta . ((interfaces . (mensural-ligature-interface font-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (mensural-ligature-interface font-interface))))
        ))
 
-     (MetronomeMark
+    (MetronomeMark
      . (
        (print-function . ,Text_interface::print)
        (Y-offset-callbacks . (,Side_position_interface::aligned_side)) 
        (direction . 1)
        (padding . 0.8)
-       (meta . ((interfaces . (text-interface
+       (meta . ((class . Item)
+                (interfaces . (text-interface
                                side-position-interface font-interface
-                               metronome-mark-interface item-interface))))
+                               metronome-mark-interface))))
        ))
     (MeasureGrouping
      . (
        (thickness . 1)
        (height . 2.0)
        (staff-padding . 3)
-       (meta . ((interfaces . (spanner-interface side-position-interface
+       (meta . ((class . Spanner)
+                (interfaces . (side-position-interface
                                                  measure-grouping-interface))))
        ))
     (MultiMeasureRest
        (thick-thickness . 6.6)
        (hair-thickness . 2.0)
        (padding . 1)
-       (meta . ((interfaces . (multi-measure-rest-interface
+       (meta . ((class . Spanner)
+                (interfaces . (multi-measure-rest-interface
                                multi-measure-interface rest-interface
                                font-interface staff-symbol-referencer-interface))))
        ))
        (padding . 0.4)
        (staff-padding . 0.4)
        (font-encoding . fetaNumber)
-       (meta . ((interfaces . (side-position-interface
+       (meta . ((class . Spanner)
+                (interfaces . (side-position-interface
                                multi-measure-interface self-alignment-interface
-                               font-interface spanner-interface text-interface))))
+                               font-interface text-interface))))
        ))
     (MultiMeasureRestText
      . (
        (direction . 1)
        (padding . 0.2)
        (staff-padding . 0.25)
-       (meta . ((interfaces . (side-position-interface
+       (meta . ((class . Spanner)
+                (interfaces . (side-position-interface
                                multi-measure-interface self-alignment-interface font-interface
-                               spanner-interface text-interface))))
+                               text-interface))))
        ))
 
     (NoteCollision
        (axes . (0 1))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
-       (meta . ((interfaces . (note-collision-interface axis-group-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (note-collision-interface axis-group-interface ))))
        ))
 
     (NoteColumn
        (axes . (0 1))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
-       (meta . ((interfaces . (axis-group-interface note-column-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (axis-group-interface note-column-interface ))))
        ))
 
     (NoteHead
        (glyph-name-procedure . ,find-notehead-symbol)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (stem-attachment-function . ,note-head-style->attachment-coordinates)
-       (meta . ((interfaces . (rhythmic-grob-interface
+       (meta . ((class . Item)
+                (interfaces . (rhythmic-grob-interface
                                rhythmic-head-interface font-interface note-head-interface
                                ledgered-interface
-                               staff-symbol-referencer-interface item-interface ))))
+                               staff-symbol-referencer-interface ))))
        ))
 
     (NoteSpacing
        ;; If you ever change this back, please document! --hwn
        (knee-spacing-correction . 1.0)
        
-       (meta . ((interfaces . (spacing-interface note-spacing-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (spacing-interface note-spacing-interface ))))
        ))
 
 
     (NoteName
      . (
        (print-function . ,Text_interface::print)
-       (meta . ((interfaces . (note-name-interface
-                               text-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (note-name-interface
+                               text-interface font-interface ))))
        ))
 
     (OctavateEight
        (padding . 0.6)
        (staff-padding . 0.2)
        (font-size . -4)
-       (meta . ((interfaces . (text-interface self-alignment-interface side-position-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (text-interface self-alignment-interface side-position-interface font-interface ))))
        ))
 
     (OttavaBracket
        (dash-fraction . 0.3)
        (edge-height . (0 . 1.2))
        (direction . 1)
-       (meta . ((interfaces . (ottava-bracket-interface
+       (meta . ((class . Spanner)
+                (interfaces . (ottava-bracket-interface
                                line-interface side-position-interface
-                               font-interface text-interface spanner-interface))))             
+                               font-interface text-interface))))               
        ))
 
     (PaperColumn
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
 
        ;; debugging
-;;             (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans") (Y-extent-callback . #f)
-       (meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface ))))
+       ;;              (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans") (Y-extent-callback . #f)
+       (meta . ((class . Paper_column)
+                (interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface ))))
        ))
 
     (PhrasingSlur
        (Y-extent-callback . ,Slur::height)
        (height-limit . 2.0)
        (ratio . 0.333)
-       (meta . ((interfaces . (slur-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (slur-interface))))
        ))
 
     (NonMusicalPaperColumn
        (breakable . #t)
        
        ;; debugging stuff: print column number.
-;;     (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans")   (Y-extent-callback . #f)
+       ;;      (print-function . ,Paper_column::print) (font-size . -6) (font-name . "sans")   (Y-extent-callback . #f)
 
 
-       (meta . ((interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface item-interface ))))
+       (meta . ((class . Paper_column)
+                (interfaces . (paper-column-interface axis-group-interface spaceable-grob-interface ))))
        ))
 
     (PercentRepeat
        (slope . 1.0)
        (thickness . 0.48)
        (font-encoding . fetaMusic)
-       (meta . ((interfaces . (multi-measure-rest-interface spanner-interface font-interface percent-repeat-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (multi-measure-rest-interface
+                               font-interface percent-repeat-interface))))
        ))
 
     ;; an example of a text spanner
        (edge-height . (1.0 . 1.0))
        (shorten-pair . (0.0 . 0.0))
        (thickness .  1.0)
-       (meta . ((interfaces . (line-interface
-                               piano-pedal-interface piano-pedal-bracket-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (line-interface
+                               piano-pedal-interface piano-pedal-bracket-interface))))
        ))
 
     (RehearsalMark
        (baseline-skip . 2)
        (break-visibility . ,end-of-line-invisible)
        (padding . 0.8)
-       (meta . ((interfaces . (text-interface
+       (meta . ((class . Item)
+                (interfaces . (text-interface
                                side-position-interface font-interface mark-interface
-                               self-alignment-interface item-interface ))))
+                               self-alignment-interface ))))
        ))
     
 
        (Y-offset-callbacks . (,Hara_kiri_group_spanner::force_hara_kiri_callback))
        (Y-extent-callback . ,Hara_kiri_group_spanner::y_extent)
        (axes . (1))
-       (meta . ((interfaces . (axis-group-interface
+       (meta . ((class . Spanner)
+                (interfaces . (axis-group-interface
                                vertically-spaceable-interface hara-kiri-group-interface
-                               item-interface spanner-interface))))
+                               spanner-interface))))
        ))
 
     (RepeatSlash
        (print-function . ,Percent_repeat_item_interface::beat_slash)
        (thickness . 0.48)
        (slope . 1.7)
-       (meta . ((interfaces . (percent-repeat-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (percent-repeat-interface ))))
        ))
     (Rest
      . (
                               ,Rest::polyphonic_offset_callback
                               ))
        (minimum-distance . 0.25)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface
                                rhythmic-head-interface
                                rhythmic-grob-interface
                                staff-symbol-referencer-interface
-                               rest-interface item-interface ))
-               ))))
+                               rest-interface ))
+                ))))
 
     (RestCollision
      . (
        (minimum-distance . 0.75)
-       (meta . ((interfaces . (rest-collision-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (rest-collision-interface ))))
        ))
 
     (Script
        (X-offset-callbacks . (,Self_alignment_interface::centered_on_parent))
        (before-line-breaking-callback . ,Script_interface::before_line_breaking)
        (font-encoding . fetaMusic)
-       (meta . ((interfaces . (script-interface
-                               side-position-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (script-interface
+                               side-position-interface font-interface ))))
        ))
 
     (ScriptColumn
      . (
        (before-line-breaking-callback . ,Script_column::before_line_breaking)
-       (meta . ((interfaces . (script-column-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (script-column-interface ))))
        ))
 
 
      . (
        (X-extent-callback . #f)
        (Y-extent-callback . #f)
-       (meta . ((interfaces . (spacing-interface separation-item-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (spacing-interface separation-item-interface ))))
        ))
 
     (SeparatingGroupSpanner
      . (
        (spacing-procedure . ,Separating_group_spanner::set_spacing_rods)
-       (meta . ((interfaces . (only-prebreak-interface spacing-interface separation-spanner-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (only-prebreak-interface spacing-interface separation-spanner-interface))))
        ))
     
     (Slur
                                        ; Slur::height)
        (height-limit . 2.0)
        (ratio . 0.25)
-       (meta . ((interfaces . (slur-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (slur-interface))))
        ))
 
     (SpacingSpanner
        (shortest-duration-space . 2.0)
        (spacing-increment . 1.2)
        (base-shortest-duration . ,(ly:make-moment 3 16))
-       (meta . ((interfaces . (spacing-interface spacing-spanner-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (spacing-interface spacing-spanner-interface))))
        ))
 
     (SpanBar
        (thin-kern . 3.0)
        (hair-thickness . 1.6)
        (thick-thickness . 6.0)
-       (meta . ((interfaces . (span-bar-interface font-interface
-                                                  bar-line-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (span-bar-interface font-interface
+                                                  bar-line-interface ))))
        ))
 
     (StanzaNumber
        (padding . 1.0)
        (X-offset-callbacks . (,Side_position_interface::aligned_side))
        (direction . ,LEFT)
-       (meta . ((interfaces . (side-position-interface
-                               stanza-number-interface text-interface font-interface item-interface ))))               
+       (meta . ((class . Item)
+                (interfaces . (side-position-interface
+                               stanza-number-interface text-interface font-interface ))))              
        ))
 
     (StringNumber
        (script-priority . 100)
        (font-encoding . fetaNumber)
        (font-size . -5)                ; don't overlap when next to heads.
-       (meta . ((interfaces . (string-number-interface
+       (meta . ((class . Item)
+                (interfaces . (string-number-interface
                                font-interface text-script-interface text-interface
                                side-position-interface self-alignment-interface
                                item-interface))))
        (breakable . #t)
        (stem-spacing-correction . 0.4)
 
-       (meta . ((interfaces . (spacing-interface staff-spacing-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (spacing-interface staff-spacing-interface ))))
        ))
 
     (SostenutoPedal
        (padding . 0.0) ;; padding relative to SostenutoPedalLineSpanner
        (font-shape . italic)
        (self-alignment-X . 0)
-       (meta . ((interfaces . (text-interface
-                               self-alignment-interface font-interface item-interface))))
+       (meta . ((class . Item)
+                (interfaces . (text-interface
+                               self-alignment-interface font-interface))))
        ))
 
     (SostenutoPedalLineSpanner
        (padding . 1.2)
        (minimum-space . 1.0)
        (direction . -1)
-       (meta . ((interfaces . (piano-pedal-interface
-                               axis-group-interface side-position-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (piano-pedal-interface
+                               axis-group-interface side-position-interface))))
        ))
 
     (StaffSymbol
        (line-count . 5)
        (ledger-line-thickness . (1.0 . 0.1))
        (layer . 0)
-       (meta . ((interfaces . (staff-symbol-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (staff-symbol-interface))))
        ))
-       
+    
     (Stem
      . (
        ;; this list is rather long. Trim --hwn
        
        ;; The 'normal' minima
        (beamed-minimum-free-lengths . (1.83 1.5 1.25))
-       ;(beamed-minimum-free-lengths . (2.0 1.83 1.25))
+                                       ;(beamed-minimum-free-lengths . (2.0 1.83 1.25))
        
        ;; The 'extreme case' minima
        (beamed-extreme-minimum-free-lengths . (2.0 1.25))
        (X-extent-callback . ,Stem::width_callback)     
        (Y-extent-callback . ,Stem::height)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
-       (meta . ((interfaces . (stem-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (stem-interface font-interface ))))
        ))
 
     (StemTremolo
 
        (beam-width . 1.6) ; staff-space
        (beam-thickness . 0.48) ; staff-space
-       (meta . ((interfaces . (stem-tremolo-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (stem-tremolo-interface ))))
        ))
 
     (SustainPedal
        (direction . 1)
        (padding . 0.0)  ;; padding relative to SustainPedalLineSpanner
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
-       (meta . ((interfaces . (piano-pedal-interface
+       (meta . ((class . Item)
+                (interfaces . (piano-pedal-interface
                                text-spanner-interface text-interface self-alignment-interface
-                               font-interface item-interface))))
+                               font-interface))))
        ))
 
     (SustainPedalLineSpanner
        (staff-padding . 1.2)
        (minimum-space . 1.0)
        (direction . -1)
-       (meta . ((interfaces . (piano-pedal-interface
-                               axis-group-interface side-position-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (piano-pedal-interface
+                               axis-group-interface side-position-interface))))
        ))
 
     (System
        (axes . (0 1))
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
-       (meta . ((interfaces . (system-interface axis-group-interface spanner-interface))))
+       (meta . ((class . System)
+                (interfaces . (system-interface axis-group-interface))))
        ))
 
     (SystemStartBrace
        (collapse-height . 5.0)
        (font-encoding . fetaBraces)
        (Y-extent-callback . #f)
-       (meta . ((interfaces . (system-start-delimiter-interface font-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (system-start-delimiter-interface font-interface))))
        ))
 
     (SystemStartBracket
        (glyph . "bracket")
        (collapse-height . 1)
        (thickness . 0.45)
-       (meta . ((interfaces . (font-interface system-start-delimiter-interface
-                                              spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (font-interface system-start-delimiter-interface
+                                             ))))
        ))
 
     (SystemStartBar
        (glyph . "bar-line")
        (thickness . 1.6)
        (after-line-breaking-callback . ,System_start_delimiter::after_line_breaking)
-       (meta . ((interfaces . (system-start-delimiter-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (system-start-delimiter-interface))))
        ))
 
 
        (font-size . -2)
        (stem-attachment-function . ,tablature-stem-attachment-function)
        (font-series . bold)
-       (meta . ((interfaces
+       (meta . ((class . Item)
+                (interfaces
                  . (rhythmic-head-interface
                     font-interface 
                     note-head-interface staff-symbol-referencer-interface
-                    text-interface item-interface ))))
+                    text-interface ))))
        ))
 
 
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
        (direction . -1)
 
-       ; sync with Fingering ?
+                                       ; sync with Fingering ?
        (padding . 0.5)
        (staff-padding . 0.5)
        (script-priority . 200)
        ;; todo: add X self alignment?
-       (meta . ((interfaces . (text-script-interface
+       (meta . ((class . Item)
+                (interfaces . (text-script-interface
                                text-interface side-position-interface font-interface
-                               item-interface ))))
+                               ))))
        ))
     
     (TextSpanner
        (dash-fraction . 0.2)
        (dash-period . 3.0)
        (direction . 1)
-       (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
+       (meta . ((class . Spanner)
+                (interfaces . (text-spanner-interface
+                               side-position-interface font-interface))))              
        ))
 
     
        (x-gap . -0.1)
        (y-offset . 0.6)
        (minimum-length . 2.5)
-       (meta . ((interfaces . (tie-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (tie-interface))))
        ))
 
     (TieColumn
        (before-line-breaking-callback . ,Tie_column::before_line_breaking)
        (X-extent-callback . #f)
        (Y-extent-callback . #f)        
-       (meta . ((interfaces . (tie-column-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (tie-column-interface))))
        ))
 
     (TimeSignature
                        ))
        (breakable . #t)
        (style . C)
-       (meta . ((interfaces . (time-signature-interface break-aligned-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (time-signature-interface break-aligned-interface font-interface ))))
        ))
 
 
        (padding . 0.5)
        (direction . 1)
        (Y-offset-callbacks . (,Side_position_interface::aligned_side))
-       (meta . ((interfaces . (text-spanner-interface side-position-interface font-interface spanner-interface))))             
+       (meta . ((class . Spanner)
+                (interfaces . (text-spanner-interface side-position-interface font-interface))))               
        ))
     
     (TrillPitchAccidental
        (direction . ,LEFT)
        (font-size . -4)
        (print-function . ,Accidental_interface::print)
-       (meta . ((interfaces . (item-interface
+       (meta . ((class . Item)
+                (interfaces . (item-interface
                                accidental-interface
                                side-position-interface font-interface))))
        ))
        (print-function . ,parenthesize-elements)
        (direction . ,RIGHT)
        (padding . 0.3)
-       (meta . ((interfaces . (side-position-interface
+       (meta . ((class . Item)
+                (interfaces . (side-position-interface
                                note-head-interface rhythmic-head-interface
                                font-interface accidental-interface
-                               item-interface axis-group-interface))))
+                               axis-group-interface))))
        ))
 
     (TrillPitchHead
        (duration-log . 2)
        (Y-offset-callbacks . (,Staff_symbol_referencer::callback))
        (font-size . -4)
-       (meta . ((interfaces . (item-interface
+       (meta . ((class . Item)
+                (interfaces . (item-interface
                                rhythmic-head-interface
                                font-interface pitched-trill-interface
                                ledgered-interface staff-symbol-referencer-interface))))
        (font-shape . italic)
 
        (font-size . -2)
-       (meta . ((interfaces . (text-interface line-interface
+       (meta . ((class . Spanner)
+                (interfaces . (text-interface line-interface
                                               tuplet-bracket-interface
-                                              font-interface spanner-interface))))
+                                              font-interface))))
        ))
 
     (UnaCordaPedal
        (direction . 1)
        (padding . 0.0)  ;; padding relative to UnaCordaPedalLineSpanner
        (X-offset-callbacks . (,Self_alignment_interface::aligned_on_self))
-       (meta . ((interfaces . (text-interface self-alignment-interface font-interface item-interface ))))
+       (meta . ((class . Item)
+                (interfaces . (text-interface self-alignment-interface font-interface ))))
        ))
 
     (UnaCordaPedalLineSpanner
        (staff-padding . 1.2)
        (minimum-space . 1.0)
        (direction . -1)
-       (meta . ((interfaces . (piano-pedal-interface axis-group-interface side-position-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (piano-pedal-interface axis-group-interface side-position-interface))))
        ))
 
     (VaticanaLigature
        (flexa-width . 2.0)
        (ligature-primitive-callback . ,Vaticana_ligature::brew_ligature_primitive)
        (print-function . ,Vaticana_ligature::print)
-       (meta . ((interfaces . (vaticana-ligature-interface font-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (vaticana-ligature-interface font-interface))))
        ))
 
 
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        (stacking-dir . -1)
-       (meta . ((interfaces . (align-interface axis-group-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (align-interface axis-group-interface))))
        ))
 
     (VerticalAxisGroup
        (Y-extent-callback . ,Axis_group_interface::group_extent_callback)      
        (X-extent-callback . ,Axis_group_interface::group_extent_callback)
        
-       (meta . ((interfaces . (axis-group-interface
-                               vertically-spaceable-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (axis-group-interface
+                               vertically-spaceable-interface))))
        ))
 
     (VocalName
        (break-align-symbol . clef)
        (break-visibility . ,begin-of-line-visible)
        (baseline-skip . 2)
-       (meta . ((interfaces . (font-interface
+       (meta . ((class . Item)
+                (interfaces . (font-interface
                                self-alignment-interface
                                side-position-interface text-interface
-                               break-aligned-interface item-interface ))))
+                               break-aligned-interface))))
        ))
 
     (VoltaBracket
        (height . 2.0) ;; staffspace;
        (minimum-space . 5)
        (font-size . -4)
-       (meta . ((interfaces . (volta-bracket-interface
+       (meta . ((class . Spanner)
+                (interfaces . (volta-bracket-interface
                                line-interface text-interface
-                               side-position-interface font-interface spanner-interface))))
+                               side-position-interface font-interface))))
        ))
 
 
        (Y-extent-callback . #f)                        
        (print-function . ,Line_spanner::print)
        (after-line-breaking-callback . ,Line_spanner::after_line_breaking)
-       (meta . ((interfaces . (line-spanner-interface line-interface spanner-interface))))
+       (meta . ((class . Spanner)
+                (interfaces . (line-spanner-interface line-interface))))
        ))
-   ))
+    ))
 
 (define (completize-grob-entry x)
-  "transplant assoc key into 'name entry of 'meta of X
+  "transplant assoc key into 'name entry of 'meta of X. Set interfaces for Item, Spanner etc.
 "
+;;  (display (car x))
+;;  (newline)
   (let* ((name-sym  (car x))
         (grob-entry (cdr x))
-        (metaentry (cdr (assoc 'meta grob-entry)))
+        (meta-entry (cdr (assoc 'meta grob-entry)))
+        (class (cdr (assoc 'class meta-entry)))
         (ifaces-entry
-         (cdr (assoc 'interfaces metaentry)))
-
-       )
-    (set! metaentry (assoc-set! metaentry 'name name-sym))
-    (set! metaentry (assoc-set! metaentry 'interfaces
-                               (cons 'grob-interface ifaces-entry)))
-    (set! grob-entry (assoc-set! grob-entry 'meta metaentry))
+         (cdr (assoc 'interfaces meta-entry)))
+        )
+
+    (cond
+     ((eq? 'Item class)
+      (set! ifaces-entry (cons 'item-interface ifaces-entry)))
+     ((eq? 'Spanner class)
+      (set! ifaces-entry (cons 'spanner-interface ifaces-entry)))
+     ((eq? 'Paper_column class)
+      (set! ifaces-entry (cons 'item-interface
+                              (cons 'paper-column-interface ifaces-entry))))
+     ((eq? 'System class)
+      (set! ifaces-entry (cons 'system-interface
+                              (cons 'spanner-interface ifaces-entry))))
+     (else
+      (ly:warning "Unknown class ~a" class)))
+     
+
+    (set! ifaces-entry (cons 'grob-interface ifaces-entry))
+    
+    (set! meta-entry (assoc-set! meta-entry 'name name-sym))
+    (set! meta-entry (assoc-set! meta-entry 'interfaces
+                                ifaces-entry))
+    (set! grob-entry (assoc-set! grob-entry 'meta meta-entry))
     (cons name-sym grob-entry)))
 
 (set! all-grob-descriptions (map completize-grob-entry all-grob-descriptions))
      all-grob-descriptions)
 
 (set! all-grob-descriptions (sort all-grob-descriptions alist<?))
+
+
index 7799a0d275c37ccfa0fa731ff12e89f89077bf1c..a7ce3b993442f69302ad4e675465ff13d5953fdf 100644 (file)
 
 (define (document-engraver-by-name name)
   "NAME is a symbol."
-  (let* ((eg (find-engraver-by-name name )))
+  
+  (let* ((eg (find-engraver-by-name name)))
 
     (cons (string-append "@code{" (ref-ify (symbol->string name)) "}")
          (engraver-doc-string eg #f))))
                   (cdr desc-handle) "(not documented)"))
         
         (accepts (cdr (assoc 'accepts context-desc)))
-        (group (assq-ref context-desc 'group-type))
-
-        (consists (append
-                   (if group (list group)
-                       '())
-                   (cdr (assoc 'consists context-desc))))
+        (consists (cdr (assoc 'consists context-desc)))
         (props (cdr (assoc 'property-ops context-desc)))
         (grobs  (context-grobs context-desc))
         (grob-refs (map (lambda (x) (ref-ify x)) grobs)))
index d1ee804cd86da114701a0b93c6ecff83b17a7959..058217e0b329a35ccf1d0359a47d84b77d10800f 100644 (file)
@@ -22,7 +22,9 @@
    (lambda (page)
      (display
        ";;;;;;;;;;;;;;;;;;;;;;;;;;\n;;;PAGE\n" file)
-     (pretty-print (ly:stencil-expr page) file))
+;     (pretty-print (ly:stencil-expr page) file)
+     (write (ly:stencil-expr page) file)
+     )
    (ly:paper-book-pages book))))
 
 (define-public output-classic-framework output-framework)