]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/grob.cc
Let \autochange accept optional arguments for the turning-point and clefs
[lilypond.git] / lily / grob.cc
index 2377a5d963f92d794916185c6518b395fcf29aca..d5dcf6794dd90233209e94d924972f8fe5612815 100644 (file)
@@ -38,6 +38,7 @@
 #include "system.hh"
 #include "unpure-pure-container.hh"
 #include "warn.hh"
+#include "lily-imports.hh"
 
 
 Grob *
@@ -141,15 +142,36 @@ Grob::get_print_stencil () const
       retval = *m;
       bool transparent = to_boolean (get_property ("transparent"));
 
+      /* Process whiteout before color and grob-cause to prevent colored */
+      /* whiteout background and larger file sizes with \pointAndClickOn. */
+      /* A grob has to be visible, otherwise the whiteout property has no effect. */
+      /* Calls the scheme procedure stencil-whiteout in scm/stencils.scm */
+      if (!transparent && (scm_is_number (get_property("whiteout"))
+                           || to_boolean (get_property ("whiteout"))))
+        {
+          Real thickness = robust_scm2double (get_property("whiteout"), 3.0)
+               * layout ()->get_dimension (ly_symbol2scm ("line-thickness"));
+          retval = *unsmob<Stencil>
+            (Lily::stencil_whiteout (retval.smobbed_copy (),
+                                     scm_from_double (thickness)));
+        }
+
+      /* Calls the scheme procedure stencil-whiteout-box in scm/stencils.scm */
+      if (!transparent && to_boolean (get_property ("whiteout-box")))
+        {
+          retval = *unsmob<Stencil>
+            (Lily::stencil_whiteout_box (retval.smobbed_copy ()));
+        }
+
       if (transparent)
         retval = Stencil (m->extent_box (), SCM_EOL);
       else
         {
-          SCM expr = m->expr ();
-          expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
-                             self_scm (), expr);
+          SCM expr = scm_list_3 (ly_symbol2scm ("grob-cause"),
+                                 self_scm (),
+                                 retval.expr ());
 
-          retval = Stencil (m->extent_box (), expr);
+          retval = Stencil (retval.extent_box (), expr);
         }
 
       SCM rot = get_property ("rotation");
@@ -173,17 +195,6 @@ Grob::get_print_stencil () const
           retval = Stencil (retval.extent_box (), expr);
         }
 
-      /* process whiteout */
-      /* a grob has to be visible, otherwise the whiteout property has no effect */
-      if (!transparent && to_boolean (get_property ("whiteout")))
-        {
-          /* Call the scheme procedure stencil-whiteout in scm/stencils.scm */
-          /* to add a round-filled-box stencil to the stencil list */
-          retval
-            = *unsmob<Stencil> (scm_call_1 (ly_lily_module_constant ("stencil-whiteout"),
-                                           retval.smobbed_copy ()));
-        }
-
       SCM id = get_property ("id");
       if (scm_is_string (id))
         {
@@ -478,7 +489,7 @@ Grob::extent (Grob *refp, Axis a) const
     if(!isinf (offset))
       real_ext.translate(offset);
     else
-      this->warning(_f ("ignored infinite %s-offset",
+      warning(_f ("ignored infinite %s-offset",
                         a == X_AXIS ? "X" : "Y"));
 
   return real_ext;
@@ -754,7 +765,7 @@ Grob::name () const
   SCM meta = get_property ("meta");
   SCM nm = scm_assq (ly_symbol2scm ("name"), meta);
   nm = (scm_is_pair (nm)) ? scm_cdr (nm) : SCM_EOL;
-  return scm_is_symbol (nm) ? ly_symbol2string (nm) : this->class_name ();
+  return scm_is_symbol (nm) ? ly_symbol2string (nm) : class_name ();
 }
 
 ADD_INTERFACE (Grob,
@@ -828,6 +839,7 @@ ADD_INTERFACE (Grob,
                "transparent "
                "vertical-skylines "
                "whiteout "
+               "whiteout-box "
               );
 
 /****************************************************************