From 982d3cb1b1745b5de6443779adc6cd4a0c15a119 Mon Sep 17 00:00:00 2001 From: Trevor Daniels Date: Thu, 3 Dec 2009 15:26:13 +0000 Subject: [PATCH] Add 'whiteout as a Grob interface property - 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 | 21 +++++++++++++++++++++ lily/grob.cc | 10 ++++++++++ scm/define-grob-properties.scm | 2 ++ scm/define-grobs.scm | 1 + 4 files changed, 34 insertions(+) create mode 100644 input/regression/whiteout-lower-layers.ly diff --git a/input/regression/whiteout-lower-layers.ly b/input/regression/whiteout-lower-layers.ly new file mode 100644 index 0000000000..75dbd96dc6 --- /dev/null +++ b/input/regression/whiteout-lower-layers.ly @@ -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 +} + diff --git a/lily/grob.cc b/lily/grob.cc index a6e715d206..b27350b929 100644 --- a/lily/grob.cc +++ b/lily/grob.cc @@ -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 " ); /**************************************************************** diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index b3a10bd53a..e7b67b0528 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -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 diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 79de22f001..7c459a0bca 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1888,6 +1888,7 @@ (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) -- 2.11.4.GIT