]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
* lily/grob.cc (get_stencil): simplify: use callback mechanism to
[lilypond.git] / lily / grob.cc
index 4933934c0c8934ebf44681837bedabced6614de7..b85e61824d12a5ece5211269e2e000a6e54e8f4e 100644 (file)
@@ -33,7 +33,7 @@ SCM
 Grob::same_axis_parent_positioning (SCM element_smob, SCM axis)
 {
   Grob *me = unsmob_grob (element_smob);
-  Axis ax = other_axis ((Axis)scm_to_int (axis));
+  Axis ax = Axis (scm_to_int (axis));
   
   Grob *par = me->get_parent (ax);
   if (par)
@@ -146,7 +146,8 @@ Grob::Grob (SCM basicprops,
       else if (ly_is_procedure (cb))
        dim_cache_[a].dimension_callback_ = cb;
       else if (cb == SCM_EOL
-              && ly_is_procedure (get_property ("print-function")))
+              && ly_is_procedure (ly_assoc_get (ly_symbol2scm ("stencil"),
+                                                property_callbacks_, SCM_BOOL_F)))
        dim_cache_[a].dimension_callback_ = stencil_extent_proc;
     }
 
@@ -165,9 +166,6 @@ Grob::Grob (Grob const &s, int copy_index)
   property_callbacks_ = s.property_callbacks_;
   object_alist_ = SCM_EOL;
 
-  /* No properties are copied.  That is the job of
-     handle_broken_dependencies.  */
-  status_ = s.status_;
   pscore_ = 0;
 
   smobify_self ();
@@ -209,36 +207,6 @@ Grob::get_layout () const
   return pscore_ ? pscore_->layout () : 0;
 }
 
-/* Recursively track all dependencies of this Grob.  The status_ field
-   is used as a mark-field.  It is marked with BUSY during execution
-   of this function, and marked with FINAL when finished.
-
-   FUNCPTR is the function to call to update this element.  */
-void
-Grob::calculate_dependencies (int final, int busy, SCM funcname)
-{
-  if (status_ >= final)
-    return;
-
-  if (status_ == busy)
-    {
-      programming_error ("element is busy, come back later");
-      return;
-    }
-
-  status_ = busy;
-
-  extract_grob_set (this, "dependencies", deps);
-  for (int i = 0; i < deps.size (); i++)
-    deps[i]->calculate_dependencies (final, busy, funcname);
-
-  SCM proc = internal_get_property (funcname);
-  if (ly_is_procedure (proc))
-    scm_call_1 (proc, this->self_scm ());
-
-  status_ = final;
-}
-
 Stencil *
 Grob::get_stencil () const
 {
@@ -246,39 +214,27 @@ Grob::get_stencil () const
     return 0;
 
   SCM stil = get_property ("stencil");
-  if (unsmob_stencil (stil))
-    return unsmob_stencil (stil);
-
-  stil = get_uncached_stencil ();
-  if (is_live ())
-    {
-      Grob *me = (Grob *) this;
-      me->set_property ("stencil", stil);
-    }
-
   return unsmob_stencil (stil);
 }
 
-SCM
-Grob::get_uncached_stencil () const
+Stencil
+Grob::get_print_stencil () const
 {
-  SCM proc = get_property ("print-function");
-
-  SCM stil = SCM_EOL;
-  if (ly_is_procedure (proc))
-    stil = scm_apply_0 (proc, scm_list_n (this->self_scm (), SCM_UNDEFINED));
+  SCM stil = get_property ("stencil");
 
+  Stencil retval;
   if (Stencil *m = unsmob_stencil (stil))
     {
+      retval = *m;
       if (to_boolean (get_property ("transparent")))
-       stil = Stencil (m->extent_box (), SCM_EOL).smobbed_copy ();
+       retval = Stencil (m->extent_box (), SCM_EOL);
       else
        {
          SCM expr = m->expr ();
          if (point_and_click_global)
            expr = scm_list_3 (ly_symbol2scm ("grob-cause"), self_scm (), expr);
 
-         stil = Stencil (m->extent_box (), expr).smobbed_copy ();
+         retval = Stencil (m->extent_box (), expr);
        }
 
       /* color support... see interpret_stencil_expression () for more... */
@@ -290,11 +246,12 @@ Grob::get_uncached_stencil () const
                                 color,
                                 m->expr ());
 
-         stil = Stencil (m->extent_box (), expr).smobbed_copy ();
+         retval = Stencil (m->extent_box (), expr);
        }
+
     }
 
-  return stil;
+  return retval;
 }
 
 /*
@@ -745,7 +702,12 @@ ADD_INTERFACE (Grob, "grob-interface",
               "Mutable properties are variables that are specific to one grob. Typically, "
               "lists of other objects, or results from computations are stored in"
               "mutable properties: every call to set-grob-property (or its C++ equivalent) "
-              "sets a mutable property. ",
+              "sets a mutable property. "
+              "\n\n"
+              "The properties @code{after-line-breaking} and @code{before-line-breaking} "
+              "are dummies that are not user-serviceable. "
+
+              ,
 
               /* properties */
               "X-extent "
@@ -754,10 +716,10 @@ ADD_INTERFACE (Grob, "grob-interface",
               "Y-extent "
               "Y-extent-callback "
               "Y-offset-callbacks "
-              "after-line-breaking-callback "
+              "after-line-breaking "
               "axis-group-parent-X "
               "axis-group-parent-Y "
-              "before-line-breaking-callback "
+              "before-line-breaking "
               "callbacks "
               "cause "
               "color "