]> git.donarmstrong.com Git - lilypond.git/commitdiff
Use callback to retrieve OctavateEight break-visibility from clef
authorReinhold Kainhofer <reinhold@kainhofer.com>
Tue, 28 Dec 2010 20:46:15 +0000 (21:46 +0100)
committerReinhold Kainhofer <reinhold@kainhofer.com>
Wed, 29 Dec 2010 01:04:23 +0000 (02:04 +0100)
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.).

Documentation/notation/changing-defaults.itely
input/regression/clef-oct-visibility.ly [new file with mode: 0644]
lily/clef-engraver.cc
scm/define-grobs.scm
scm/output-lib.scm

index 7a294693fee8f31043d3e37acb2d209d2db1f887..aaf17246d09900f4c6ad8797150cdc8dff6ffc18 100644 (file)
@@ -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 (file)
index 0000000..0f8d480
--- /dev/null
@@ -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
+}
+
index 37151c2fbec387ed25aac8a17e744f1bc8bacc50..d17ee6a19b5794ca5634fff0e66a6245a04b7fe9 100644 (file)
@@ -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;
 
index 0f66726b474a564c163d2e8e79ccb6e397bcc40a..d47633d48d17f817f725a4d9286395c2defa5a92 100644 (file)
 
     (OctavateEight
      . (
-       (break-visibility . ,begin-of-line-visible)
+       (break-visibility . ,inherit-x-parent-visibility)
        (font-shape . italic)
        (font-size . -4)
        (self-alignment-X . ,CENTER)
index 6c10913d388718bfb91414107c41b132f0eb2885..292755e27e21a0ab7a76a8a008ce682164b9817e 100644 (file)
@@ -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))