]> git.donarmstrong.com Git - lilypond.git/commitdiff
Add 'whiteout as a Grob interface property
authorTrevor Daniels <t.daniels@treda.co.uk>
Thu, 3 Dec 2009 15:26:13 +0000 (15:26 +0000)
committerTrevor Daniels <t.daniels@treda.co.uk>
Wed, 23 Dec 2009 16:51:11 +0000 (16:51 +0000)
 - If true, the grob will be printed on a white
   background which overlays grobs in lower
   layers.  As the order of printing grobs in the
   same layer is generally unpredictable this
   should always be used in conjunction with
   explicit layer settings.

input/regression/whiteout-lower-layers.ly [new file with mode: 0644]
lily/grob.cc
scm/define-grob-properties.scm
scm/define-grobs.scm

diff --git a/input/regression/whiteout-lower-layers.ly b/input/regression/whiteout-lower-layers.ly
new file mode 100644 (file)
index 0000000..75dbd96
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.13.9"
+
+\header { texidoc = "If the 'whiteout property of a
+grob is set to #t, that part of all objects in lower
+layers which falls under the extent of the grob is
+whited out.  Here the TimeSignature whites out the
+Tie but not the StaffSymbol.
+"
+}
+
+\relative c' {
+  \time 3/4
+  \override Staff.StaffSymbol #'layer = #4
+  \once \override Tie #'layer = #2
+  b'2.~
+  \once \override Staff.TimeSignature #'whiteout = ##t
+  \once \override Staff.TimeSignature #'layer = #3
+  \time 5/4
+  b4
+}
+
index a6e715d206b428f0164ab0c2c3b01795eeae9213..b27350b92996e694a9acffe8ff94cbb2513a8e86 100644 (file)
@@ -155,6 +155,15 @@ Grob::get_print_stencil () const
          retval = Stencil (retval.extent_box (), expr);
        }
 
+      /* process whiteout */
+      if (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()));
+        }
     }
 
   return retval;
@@ -662,6 +671,7 @@ ADD_INTERFACE (Grob,
               "staff-symbol "
               "stencil "
               "transparent "
+              "whiteout "
               );
 
 /****************************************************************
index b3a10bd53a5c0a7b3d0bae714257244e4ec89c49..e7b67b052811345b9b4fe7464c20fc1a8db3b2ea 100644 (file)
@@ -845,6 +845,8 @@ one below this grob.")
 ;;
      (when ,ly:moment? "Global time step associated with this column
 happen?")
+     (whiteout ,boolean? "If true, the grob is printed over a white
+background to white-out underlying material.  Usually #f by default.")
      (width ,ly:dimension? "The width of a grob measured in staff
 space.")
      (word-space ,ly:dimension? "Space to insert between words in
index 79de22f001ff74dabc6e8d0d3429a21b99b737b5..7c459a0bca6ed52c278723bd15c5e65fa0ff8b01 100644 (file)
        (font-size . -2)
        (stem-attachment . (0.0 . 1.35))
        (stencil . ,ly:text-interface::print)
+       (whiteout . #t)
        (X-offset . ,ly:self-alignment-interface::x-aligned-on-self)
        (Y-offset . ,ly:staff-symbol-referencer::callback)
        (meta . ((class . Item)