]> git.donarmstrong.com Git - lilypond.git/commitdiff
* scm/define-music-types.scm (music-descriptions): use
authorHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 Aug 2006 00:26:16 +0000 (00:26 +0000)
committerHan-Wen Nienhuys <hanwen@xs4all.nl>
Sun, 20 Aug 2006 00:26:16 +0000 (00:26 +0000)
apply-output-event for ApplyOutputEvent

* lily/output-property-engraver.cc (listen_apply_output): rename
from listen_layout_instruction.

* lily/piano-pedal-engraver.cc (struct Pedal_type_info): new
function protect()

ChangeLog
lily/apply-context-iterator.cc
lily/output-property-engraver.cc
lily/piano-pedal-engraver.cc
scm/define-event-classes.scm
scm/define-music-types.scm

index f2746e16ad6479796ec7e40269a6d986db4d205d..f013f38465f121c6a505f94191836920a5f2dacf 100644 (file)
--- a/ChangeLog
+++ b/ChangeLog
@@ -1,3 +1,14 @@
+2006-08-20  Han-Wen Nienhuys  <hanwen@lilypond.org>
+
+       * scm/define-music-types.scm (music-descriptions): use
+       apply-output-event for ApplyOutputEvent
+
+       * lily/output-property-engraver.cc (listen_apply_output): rename
+       from listen_layout_instruction.
+
+       * lily/piano-pedal-engraver.cc (struct Pedal_type_info): new
+       function protect()
+
 2006-08-19  Han-Wen Nienhuys  <hanwen@lilypond.org>
 
        * scm/lily.scm (lilypond-all): option read-file-list: substitute
index 0f6e6daff8b8a8d7aae140e700054e886a9b1c58..adf708da35259234ec376c6414ebc904d1110d33 100644 (file)
@@ -12,9 +12,6 @@
 #include "music.hh"
 #include "simple-music-iterator.hh"
 
-/**
-   Iterate a property.
-*/
 class Apply_context_iterator : public Simple_music_iterator
 {
 public:
index 76a2b6cb3f1cce306b05d95e4011d45efef509f6..ca6f8687325095124fbbde6d45cf5170dfd345f8 100644 (file)
@@ -20,15 +20,16 @@ class Output_property_engraver : public Engraver
   TRANSLATOR_DECLARATIONS (Output_property_engraver);
 protected:
   vector<Stream_event*> props_;
+  
   DECLARE_ACKNOWLEDGER (grob);
-  DECLARE_TRANSLATOR_LISTENER (layout_instruction);
+  DECLARE_TRANSLATOR_LISTENER (apply_output);
 
   void stop_translation_timestep ();
 };
 
-IMPLEMENT_TRANSLATOR_LISTENER (Output_property_engraver, layout_instruction);
+IMPLEMENT_TRANSLATOR_LISTENER (Output_property_engraver, apply_output);
 void
-Output_property_engraver::listen_layout_instruction (Stream_event *ev)
+Output_property_engraver::listen_apply_output (Stream_event *ev)
 {
   /*
     UGH. Only swallow the output property event in the context
@@ -73,7 +74,7 @@ ADD_TRANSLATOR (Output_property_engraver,
                "",
                
                /* accept */
-               "layout-instruction-event",
+               "apply-output-event",
                
                /* read */
                "",
index 8e9b9252f0e0f4c2831c0a3019e7347296d1935a..90844c6d24ef7ad396a5c00d68bac56efc8be705 100644 (file)
@@ -40,12 +40,27 @@ typedef enum Pedal_type {SOSTENUTO, SUSTAIN, UNA_CORDA, NUM_PEDAL_TYPES};
 struct Pedal_type_info
 {
   string base_name_;
-  Protected_scm event_class_sym_;
-  Protected_scm style_sym_;
-  Protected_scm strings_sym_;
+  SCM event_class_sym_;
+  SCM style_sym_;
+  SCM strings_sym_;
   
   const char *pedal_line_spanner_c_str_;
   const char *pedal_c_str_;
+
+  Pedal_type_info ()
+  {
+    event_class_sym_ = SCM_EOL;
+    style_sym_ = SCM_EOL;
+    strings_sym_ = SCM_EOL;
+    pedal_line_spanner_c_str_ = 0;
+    pedal_c_str_ = 0;
+  }
+  void protect ()
+  {
+    scm_gc_protect_object (event_class_sym_);
+    scm_gc_protect_object (style_sym_);
+    scm_gc_protect_object (strings_sym_);
+  }
 };
 
 struct Pedal_info
@@ -138,13 +153,21 @@ init_pedal_types ()
          }
       base_ident += String_convert::to_lower (string (name, prev_pos, cur_pos - prev_pos));
 
-      Pedal_type_info *tbl = &pedal_types_[i];
-      tbl->base_name_ = name;
-      tbl->event_class_sym_ = scm_str2symbol ((base_ident + "-event").c_str ());
-      tbl->pedal_line_spanner_c_str_ = strdup ((base_name + "PedalLineSpanner").c_str ());
-      tbl->style_sym_ = scm_str2symbol (("pedal" + base_name + "Style").c_str ());
-      tbl->strings_sym_ = scm_str2symbol (("pedal" + base_name + "Strings").c_str ());
-      tbl->pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
+      /*
+       be careful, as we don't want to loose references to the _sym_ members.
+       */
+      Pedal_type_info info;
+      info.event_class_sym_ = scm_str2symbol ((base_ident + "-event").c_str ());
+      info.style_sym_ = scm_str2symbol (("pedal" + base_name + "Style").c_str ());
+      info.strings_sym_ = scm_str2symbol (("pedal" + base_name + "Strings").c_str ());
+      
+      info.pedal_line_spanner_c_str_ = strdup ((base_name + "PedalLineSpanner").c_str ());
+      info.base_name_ = name;
+      info.pedal_c_str_ = strdup ((base_name + "Pedal").c_str ());
+
+      info.protect ();
+      
+      pedal_types_[i] = info;
     }
 }
 ADD_SCM_INIT_FUNC (Piano_pedal_engraver_init_pedal_types_, init_pedal_types);
index d8056ba6d8d0c45adbcffee63267d20cf8b2167d..b0fe109e2fd4cbe9b4fa53e5004e829c13cb3f7f 100644 (file)
@@ -23,6 +23,7 @@
       multi-measure-text-event note-grouping-event
       pes-or-flexa-event repeat-tie-event spacing-section-event
       layout-instruction-event))
+    (layout-instruction-event . (apply-output-event))
     (script-event . (articulation-event text-script-event))
     (part-combine-event . (solo1-event solo2-event unisono-event))
     (break-event . (line-break-event page-break-event page-turn-event))
index d72eea02a1362529c9fa5e17df3c3cd63e654228..7a06764063cbee8827fbeea1176481500b881966 100644 (file)
@@ -50,7 +50,7 @@ arguments to func are 1. the grob, 2. the originating context,
 3. context where FUNC is called.
 
 ")
-       (types . (general-music event layout-instruction-event))
+       (types . (general-music event apply-output-event))
        ))
     (ArpeggioEvent 
      . (
@@ -337,7 +337,7 @@ SYNTAX
 
 @code{\\override [ @var{Ctxt} . ] @var{Obj} @var{prop} = @var{val}}
 ")
-       (types . (general-music layout-instruction-event))
+       (types . (general-music layout-instruction-event override-property-event))
        (iterator-ctor . ,ly:push-property-iterator::constructor)
        ))
     (PageBreakEvent