From 9551796a06445e9570d5481a73aff11f1d259568 Mon Sep 17 00:00:00 2001 From: Reinhold Kainhofer Date: Tue, 28 Dec 2010 21:46:15 +0100 Subject: [PATCH] Use callback to retrieve OctavateEight break-visibility from clef Do not explicitly assign break-visibility to the OctavateEight, use a callback to retrieve from clef. For one, this allows the user to override the clef's break-visibility and affect the OctavateEight without an explicit setting for it. On the other hand, by overriding the break-visibility from the callback to a custom value (e.g. all-invisible), this makes it finally possible to hide 8 from a treble_8 clef for a tenor piece altogether, while keeping the correct pitch (for MIDI etc.). --- .../notation/changing-defaults.itely | 9 +++--- input/regression/clef-oct-visibility.ly | 28 +++++++++++++++++++ lily/clef-engraver.cc | 6 +--- scm/define-grobs.scm | 2 +- scm/output-lib.scm | 4 +++ 5 files changed, 38 insertions(+), 11 deletions(-) create mode 100644 input/regression/clef-oct-visibility.ly diff --git a/Documentation/notation/changing-defaults.itely b/Documentation/notation/changing-defaults.itely index 7a294693fe..aaf17246d0 100644 --- a/Documentation/notation/changing-defaults.itely +++ b/Documentation/notation/changing-defaults.itely @@ -3047,11 +3047,10 @@ occur only at explicit @code{\bar} commands. @cindex clefs, visibility of octavation The small octavation symbol on octavated clefs is produced by the -@code{OctavateEight} layout object. Its visibility is controlled -independently from that of the @code{Clef} object, so it is -necessary to apply any required @code{break-visibility} overrides -to both the @code{Clef} and the @code{OctavateEight} layout objects -to fully suppress such clef symbols at the start of each line. +@code{OctavateEight} layout object. Its visibility is automatically +inherited from the @code{Clef} object, so it is not necessary to apply +any required @code{break-visibility} overrides to the @code{OctavateEight} +layout objects to suppress octavation symbols for invisible clefs. For explicit clef changes, the @code{explicitClefVisibility} property controls both the clef symbol and any octavation symbol diff --git a/input/regression/clef-oct-visibility.ly b/input/regression/clef-oct-visibility.ly new file mode 100644 index 0000000000..0f8d480b24 --- /dev/null +++ b/input/regression/clef-oct-visibility.ly @@ -0,0 +1,28 @@ +\version "2.13.45" + +\header { + + texidoc = "Octavation signs may be added to clefs. By default, +their break-visibility is derived from the associated clef, but it may +be overridden explicitly. The initial treble_8 clef should not have an +8, while the treble_8 clef after the tenor clef should. +These settings also need to apply to clefs on new lines." + +} +\layout { ragged-right = ##t } + + +\relative c' { + \override Staff.OctavateEight #'break-visibility = #all-invisible + + \clef "treble_8" + c2 c | + c c | \break + c \clef "tenor" c | + \revert Staff.OctavateEight #'break-visibility + \clef "treble_8" + c2 c | + c c | \break + c c +} + diff --git a/lily/clef-engraver.cc b/lily/clef-engraver.cc index 37151c2fbe..d17ee6a19b 100644 --- a/lily/clef-engraver.cc +++ b/lily/clef-engraver.cc @@ -186,11 +186,7 @@ Clef_engraver::stop_translation_timestep () vis = get_property ("explicitClefVisibility"); if (vis) - { - clef_->set_property ("break-visibility", vis); - if (octavate_) - octavate_->set_property ("break-visibility", vis); - } + clef_->set_property ("break-visibility", vis); clef_ = 0; diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 0f66726b47..d47633d48d 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -1324,7 +1324,7 @@ (OctavateEight . ( - (break-visibility . ,begin-of-line-visible) + (break-visibility . ,inherit-x-parent-visibility) (font-shape . italic) (font-size . -4) (self-alignment-X . ,CENTER) diff --git a/scm/output-lib.scm b/scm/output-lib.scm index 6c10913d38..292755e27e 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -234,6 +234,10 @@ and duration-log @var{log}." (define-public center-visible #(#f #t #f)) (define-public end-of-line-visible #(#t #f #f)) (define-public all-invisible #(#f #f #f)) +(define-public (inherit-x-parent-visibility grob) + (let ((parent (ly:grob-parent grob X))) + (ly:grob-property parent 'break-visibility all-invisible))) + (define-public spanbar-begin-of-line-invisible #(#t #f #f)) -- 2.39.5