]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob-property.cc
*** empty log message ***
[lilypond.git] / lily / grob-property.cc
index ac452e36b220615be9f48500a294d6c341db0716..38306c536b01fe84367e13b16c2545259f3d166c 100644 (file)
@@ -16,6 +16,7 @@
 #include "item.hh"
 #include "program-option.hh"
 #include "profile.hh"
+#include "simple-closure.hh"
 
 SCM
 Grob::get_property_alist_chain (SCM def) const
@@ -68,12 +69,6 @@ Grob::internal_set_property (SCM sym, SCM v)
 }
 
 //#define PROFILE_PROPERTY_ACCESSES
-
-/*
-  Ugh C&P Coding.
-
-  Retrieve property without triggering callback.
- */
 SCM
 Grob::get_property_data (SCM sym) const
 {
@@ -106,7 +101,8 @@ SCM
 Grob::internal_get_property (SCM sym) const
 {
   SCM val = get_property_data (sym);
-  if (ly_is_procedure (val))
+  if (ly_is_procedure (val)
+      || is_simple_closure (val))
     {
       val = ((Grob*)this)->try_callback (sym, val);
     }
@@ -117,7 +113,7 @@ Grob::internal_get_property (SCM sym) const
 #ifndef NDEBUG
 #include "protected-scm.hh"
 Protected_scm grob_property_callback_stack = SCM_EOL;
-bool debug_property_callbacks = 1;
+bool debug_property_callbacks = 0;
 #endif
 
 SCM
@@ -135,7 +131,15 @@ Grob::try_callback (SCM sym, SCM proc)
   if (debug_property_callbacks)
     grob_property_callback_stack = scm_acons (sym, proc, grob_property_callback_stack);
 #endif
-  SCM value = scm_call_1 (proc, self_scm ());
+
+  SCM value = SCM_EOL;
+  if (ly_is_procedure (proc))
+    value = scm_call_1 (proc, self_scm ());
+  else if (is_simple_closure (proc))
+    {
+      value = evaluate_with_simple_closure (self_scm (),
+                                           simple_closure_expression (proc));
+    }
 #ifndef NDEBUG
   if (debug_property_callbacks)
     grob_property_callback_stack = scm_cdr (grob_property_callback_stack);