X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fcontext-property.cc;h=851bbe0a413a94f3c1fd6590293f1b974f3b79e4;hb=b05241299d5e20c07676430c516d3ed0d35a8e9a;hp=2fc887300d15cb49acee7e9ebc291e6946e519e4;hpb=5d4dac8980f796c7e4c97f1a4f19822c0fc4fff7;p=lilypond.git diff --git a/lily/context-property.cc b/lily/context-property.cc index 2fc887300d..851bbe0a41 100644 --- a/lily/context-property.cc +++ b/lily/context-property.cc @@ -4,16 +4,18 @@ source file of the GNU LilyPond music typesetter - (c) 2004--2005 Han-Wen Nienhuys + (c) 2004--2006 Han-Wen Nienhuys */ #include "context.hh" #include "engraver.hh" +#include "international.hh" #include "item.hh" #include "main.hh" +#include "paper-column.hh" +#include "simple-closure.hh" #include "spanner.hh" #include "warn.hh" -#include "paper-column.hh" SCM lookup_nested_property (SCM alist, @@ -116,7 +118,7 @@ execute_general_pushpop_property (Context *context, { SCM base = updated_grob_properties (context, context_property); current_context_val = scm_cons (base, base); - context->internal_set_property (context_property, current_context_val); + context->set_property (context_property, current_context_val); } if (!scm_is_pair (current_context_val)) @@ -136,9 +138,10 @@ execute_general_pushpop_property (Context *context, bool ok = true; if (!scm_is_pair (scm_cdr (grob_property_path))) { - ok = !ly_is_procedure (new_value) - && type_check_assignment (symbol, new_value, - ly_symbol2scm ("backend-type?")); + if (!ly_is_procedure (new_value) + && !is_simple_closure (new_value)) + ok = type_check_assignment (symbol, new_value, + ly_symbol2scm ("backend-type?")); /* tack onto alist. We can use set_car, since @@ -177,7 +180,7 @@ execute_general_pushpop_property (Context *context, if (new_alist == daddy) context->unset_property (context_property); else - context->internal_set_property (context_property, scm_cons (new_alist, daddy)); + context->set_property (context_property, scm_cons (new_alist, daddy)); } } @@ -221,7 +224,7 @@ apply_property_operations (Context *tg, SCM pre_init_ops) execute_general_pushpop_property (tg, context_prop, grob_prop_path, val); } else if (type == ly_symbol2scm ("assign")) - tg->internal_set_property (scm_car (entry), scm_cadr (entry)); + tg->set_property (scm_car (entry), scm_cadr (entry)); } } @@ -271,51 +274,3 @@ updated_grob_properties (Context *tg, SCM sym) return copy; } } - -Grob * -make_grob_from_properties (Engraver *tr, SCM symbol, SCM cause, char const *name) -{ - Context *context = tr->context (); - - SCM props = updated_grob_properties (context, symbol); - - Object_key const *key = context->get_grob_key (name); - 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 (tr)->announce_grob (grob, cause); - - return grob; -} - -Item * -make_item_from_properties (Engraver *tr, SCM x, SCM cause, char const *name) -{ - Item *it = dynamic_cast (make_grob_from_properties (tr, x, cause, name)); - assert (it); - return it; -} - -Paper_column * -make_paper_column_from_properties (Engraver *tr, SCM x, char const *name) -{ - return dynamic_cast (make_grob_from_properties (tr, x, SCM_EOL, name)); -} - -Spanner * -make_spanner_from_properties (Engraver *tr, SCM x, SCM cause, char const *name) -{ - Spanner *sp = dynamic_cast (make_grob_from_properties (tr, x, cause, name)); - assert (sp); - return sp; -}