]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/property-iterator.cc
Fix some bugs in the dynamic engraver and PostScript backend
[lilypond.git] / lily / property-iterator.cc
index 35eee1dbe264f87de76abe7be55523f3aadf6b0c..a4c993b75644a943fa5ce77255385bf71793c367 100644 (file)
@@ -3,14 +3,15 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1997--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
 #include "property-iterator.hh"
 
-#include "music.hh"
 #include "context-def.hh"
 #include "global-context.hh"
+#include "international.hh"
+#include "music.hh"
 
 bool check_grob (Music *mus, SCM sym);
 
@@ -71,25 +72,30 @@ Property_iterator::do_quit ()
     }
 }
 
-SCM list_p = 0;
-
-/*
-  This is a rather crude check: we merely check if the translator
-  property is a list.
-*/
 bool
 check_grob (Music *mus, SCM sym)
 {
-  if (!list_p)
-    list_p = scm_c_eval_string ("list?");
-
-  SCM type = scm_object_property (sym, ly_symbol2scm ("translation-type?"));
-  bool ok = type == list_p;
+  bool g = to_boolean (scm_object_property (sym, ly_symbol2scm ("is-grob?")));
 
-  if (!ok)
+  if (!g)
     mus->origin ()->warning (_f ("not a grob name, `%s'",
                                 ly_symbol2string (sym)));
-  return ok;
+
+  return g;
+}
+
+SCM
+get_property_path (Music *m)
+{
+  SCM grob_property_path = m->get_property ("grob-property-path");
+
+  SCM eprop = m->get_property ("grob-property");
+  if (scm_is_symbol (eprop))
+    {
+      grob_property_path = scm_list_1 (eprop);
+    }
+
+  return grob_property_path;
 }
 
 void
@@ -98,14 +104,15 @@ Push_property_iterator::process (Moment m)
   SCM sym = get_music ()->get_property ("symbol");
   if (check_grob (get_music (), sym))
     {
-      SCM eprop = get_music ()->get_property ("grob-property");
+      SCM grob_property_path = get_property_path (get_music ());
       SCM val = get_music ()->get_property ("grob-value");
 
       if (to_boolean (get_music ()->get_property ("pop-first"))
          && !to_boolean (get_music ()->get_property ("once")))
-       execute_pushpop_property (get_outlet (), sym, eprop, SCM_UNDEFINED);
+       
+       execute_general_pushpop_property (get_outlet (), sym, grob_property_path, SCM_UNDEFINED);
 
-      execute_pushpop_property (get_outlet (), sym, eprop, val);
+      execute_general_pushpop_property (get_outlet (), sym, grob_property_path, val);
     }
   Simple_music_iterator::process (m);
 }
@@ -120,9 +127,9 @@ Push_property_iterator::once_finalization (SCM trans, SCM music)
   SCM sym = mus->get_property ("symbol");
   if (check_grob (mus, sym))
     {
-      SCM eprop = mus->get_property ("grob-property");
+      SCM grob_property_path = get_property_path (mus);
 
-      execute_pushpop_property (tg, sym, eprop, SCM_UNDEFINED);
+      execute_general_pushpop_property (tg, sym, grob_property_path, SCM_UNDEFINED);
     }
   return SCM_UNSPECIFIED;
 }
@@ -148,8 +155,8 @@ Pop_property_iterator::process (Moment m)
 
   if (check_grob (get_music (), sym))
     {
-      SCM eprop = get_music ()->get_property ("grob-property");
-      execute_pushpop_property (get_outlet (), sym, eprop, SCM_UNDEFINED);
+      SCM grob_property_path = get_property_path (get_music ());
+      execute_general_pushpop_property (get_outlet (), sym, grob_property_path, SCM_UNDEFINED);
     }
   Simple_music_iterator::process (m);
 }