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);
}
}
-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
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);
}
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;
}
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);
}