From 9d97f779a59dd5507eb446b985be82036c53e27b Mon Sep 17 00:00:00 2001 From: Rune Zedeler Date: Sat, 14 Dec 2002 00:33:10 +0000 Subject: [PATCH] set-bar-number-visibility --- ChangeLog | 9 ++++++++ Documentation/user/refman.itely | 39 ++++++++++++++++++++++++++++----- aclocal.m4 | 3 +++ scm/output-lib.scm | 5 +++++ 4 files changed, 51 insertions(+), 5 deletions(-) diff --git a/ChangeLog b/ChangeLog index f54aa5180f..ce7a2bbd00 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,12 @@ +2002-12-14 Rune Zedeler + + * scm/output-lib.scm (set-bar-number-visibility): Context-function + Added. + + * Documentation/user/refman.itely (Bar numbers): + set-bar-number-visibility added, modulo-bar-number removed again + (sorry). + 2002-12-14 Heikki Junes * scm/output-lib.scm (modulo-bar-number-visible): add function. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 003aee82f6..b978b6d0ba 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -3527,11 +3527,40 @@ adds a box around the bar numbers: } @end lilypond -By replacing @code{#(every-nth-bar-number-visible 5)} with -@code{#(modulo-bar-number-visible 4 1)} in the example above, -every fourth bar counting from the first bar will be numbered. -To number all bars use @code{#(default-bar-number-visibility)}. -The first bar, however, is not numbered. +If you would like the bar numbers to appear at regular intervals, but +not starting from measure zero, you can use the context function, +@code{set-bar-number-visibility}, to automatically set +@code{barNumberVisibility} so that the bar numbers appear at regular +intervals, starting from the @code{\applycontext}: + +@example +resetBarnum = \context Score \applycontext + #(set-bar-number-visibility 4) +... +\property Score.BarNumber \override #'break-visibility = + #end-of-line-invisible +\mark "A" \resetBarnum +\repeat unfold 10 c1 +\mark \default \resetBarnum +\repeat unfold 8 c +@end example +@lilypond[noindent,noquote] +resetBarnum = \context Score \applycontext + #(set-bar-number-visibility 4) +\score { + < + \notes \transpose c c'' { + \property Score.BarNumber \override #'break-visibility =#end-of-line-invisible + \property Score.RehearsalMark \override #'padding = #2.5 + \mark "A" \resetBarnum + \repeat unfold 10 c1 + \mark \default \resetBarnum + \repeat unfold 8 c + \bar "|." + } + > +} +@end lilypond See also @seeinternals{BarNumber}. diff --git a/aclocal.m4 b/aclocal.m4 index 133034bd8c..5dbbe94ae1 100644 --- a/aclocal.m4 +++ b/aclocal.m4 @@ -1,4 +1,7 @@ dnl aclocal.m4 -*-shell-script-*- +dnl WARNING WARNING WARNING +dnl do not edit! this is aclocal.m4, generated from /home/rz/lilypond/lilypond/stepmake/aclocal.m4 +dnl aclocal.m4 -*-shell-script-*- dnl StepMake subroutines for configure.in diff --git a/scm/output-lib.scm b/scm/output-lib.scm index d58fd45dca..3845138d35 100644 --- a/scm/output-lib.scm +++ b/scm/output-lib.scm @@ -209,6 +209,11 @@ centered, X==1 is at the right, X == -1 is at the left." (define-public ((modulo-bar-number-visible n m) barnum) (and (> barnum 1) (= m (modulo barnum n)))) +(define-public ((set-bar-number-visibility n) tr) + (let* ((bn (ly:get-context-property tr 'currentBarNumber))) + (ly:set-context-property tr 'barNumberVisibility (modulo-bar-number-visible n (modulo bn n)))) +) + (define-public (default-bar-number-visibility barnum) (> barnum 1)) ;; See documentation of Item::visibility_lambda_ -- 2.39.5