Re: one bar number per system

2009-09-08 Thread Dan Eble

To whom it may concern,

Here is what I have come up with.  It does not meet my original goal,  
but it is good enough for now.  \barNumber forces a bar number to  
appear at the current or next full-measure bar line.   
\manualBarNumbersOn should appear at the beginning of the score to set  
things up.


A wart that catches my eye is taking the bar number from the grob text  
in bar-number-break-visibility callback.


A useful(?) enhancement would be to make the default visibility a  
parameter of \manualBarNumbersOn.


barNumber =
#(define-music-function (parser location) ()
   (let ((m (make-music 'ApplyContext)))

 (define (force-bar-number ctx)
   (let* ((barnum-table (ly:context-property ctx  
'visibleBarNumbers)))


 (if (not (hash-table? barnum-table)) ; first use in this score?
 (begin
   ; create the set of visible bar numbers
   (set! barnum-table (make-hash-table 16))
   (ly:context-set-property! ctx 'visibleBarNumbers barnum-table)))

 (let* ((barnum (ly:context-property ctx 'currentBarNumber))
(measurePos (ly:context-property ctx 'measurePosition))
(measureLen (ly:context-property ctx 'measureLength))
(mid-measure (and (ly:momentnumber (ly:grob-property grob 'text
 (if (and (hash-table? barnum-table)
  (hash-ref barnum-table barnum))
 end-of-line-invisible
 begin-of-line-visible
 )))

 (ly:context-pushpop-property ctx 'BarNumber 'break-visibility
  bar-number-break-visibility-callback)))

 (set! (ly:music-property musForCtx 'procedure) set-callback)
 (context-spec-music musForCtx 'Score)))
--
Dan

On 2 Sep 2009, at 18:51, Dan Eble wrote:


Thanks for your replies.

\bar allows a break, but does not force it.  Ideally, I would like a  
bar number printed only after a break.


If memory serves, the all-visible override didn't work in mid- 
measure for the upcoming full-measure bar line.  (I do not have the  
time right now to override the next full-measure bar line by hand in  
250 scores.)


I have pieced together an experimental solution to build a hash of  
manually specified measure numbers, which is used by a custom  
barNumberVisibility function.  It doesn't yet work for my multi- 
score book, because I based it on the table of contents  
implementation, so the list is global.  I suppose I need to store  
the list of visible bar numbers in the Score context instead.  Is  
that right?


This will give me a bar number wherever I specify it, whether it is  
the first one after a break or not.  It would be functional, but not  
exactly what I want.

--
Dan

On 2 Sep 2009, at 09:17, Trevor Daniels wrote:



Mats Bengtsson wrote Wednesday, September 02, 2009 1:38 PM


Trevor Daniels wrote:


Does this not work when inserted immediately before
the first full bar on the line? (I haven't actually
tried it)

\once \override Score.BarNumber #'break-visibility = #'#(#t #t #t)

Why not write it as
\once \override Score.BarNumber #'break-visibility = #all-visible

Of course, this method works, but it requires that you manually  
insert it where you know that there will be a line break.


Yes, I know.  But since Dan is already inserting
\bar "" in the places where a mid-bar break is
required I wondered why he could not also insert
this override before the following bar.

Trevor







___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: one bar number per system

2009-09-04 Thread Dan Eble

Thanks for your replies.

\bar allows a break, but does not force it.  Ideally, I would like a  
bar number printed only after a break.


If memory serves, the all-visible override didn't work in mid-measure  
for the upcoming full-measure bar line.  (I do not have the time right  
now to override the next full-measure bar line by hand in 250 scores.)


I have pieced together an experimental solution to build a hash of  
manually specified measure numbers, which is used by a custom  
barNumberVisibility function.  It doesn't yet work for my multi-score  
book, because I based it on the table of contents implementation, so  
the list is global.  I suppose I need to store the list of visible bar  
numbers in the Score context instead.  Is that right?


This will give me a bar number wherever I specify it, whether it is  
the first one after a break or not.  It would be functional, but not  
exactly what I want.

--
Dan

On 2 Sep 2009, at 09:17, Trevor Daniels wrote:



Mats Bengtsson wrote Wednesday, September 02, 2009 1:38 PM


Trevor Daniels wrote:


Does this not work when inserted immediately before
the first full bar on the line? (I haven't actually
tried it)

\once \override Score.BarNumber #'break-visibility = #'#(#t #t #t)

Why not write it as
\once \override Score.BarNumber #'break-visibility = #all-visible

Of course, this method works, but it requires that you manually  
insert it where you know that there will be a line break.


Yes, I know.  But since Dan is already inserting
\bar "" in the places where a mid-bar break is
required I wondered why he could not also insert
this override before the following bar.

Trevor





___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: one bar number per system

2009-09-03 Thread Trevor Daniels


Dan Eble wrote Wednesday, September 02, 2009 11:51 PM


\bar allows a break, but does not force it.  Ideally, I would like 
a  bar number printed only after a break.


If memory serves, the all-visible override didn't work in 
mid-measure  for the upcoming full-measure bar line.  (I do not 
have the time right  now to override the next full-measure bar 
line by hand in 250 scores.)


I understand; thanks.

I have pieced together an experimental solution to build a hash of 
manually specified measure numbers, which is used by a custom 
barNumberVisibility function.  It doesn't yet work for my 
multi-score  book, because I based it on the table of contents 
implementation, so  the list is global.  I suppose I need to store 
the list of visible bar  numbers in the Score context instead.  Is 
that right?


I don't know, but as Bar_number_engraver by default lives in
the Score context you're probably right.  Maybe Mats can
help.

Trevor 




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: one bar number per system

2009-09-02 Thread Trevor Daniels


Mats Bengtsson wrote Wednesday, September 02, 2009 1:38 PM


Trevor Daniels wrote:


Does this not work when inserted immediately before
the first full bar on the line? (I haven't actually
tried it)

\once \override Score.BarNumber #'break-visibility = #'#(#t #t 
#t)

Why not write it as
\once \override Score.BarNumber #'break-visibility = #all-visible

Of course, this method works, but it requires that you manually 
insert it where you know that there will be a line break.


Yes, I know.  But since Dan is already inserting
\bar "" in the places where a mid-bar break is
required I wondered why he could not also insert
this override before the following bar.

Trevor



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: one bar number per system

2009-09-02 Thread Mats Bengtsson



Trevor Daniels wrote:


Does this not work when inserted immediately before
the first full bar on the line? (I haven't actually
tried it)

\once \override Score.BarNumber #'break-visibility = #'#(#t #t #t)

Why not write it as
\once \override Score.BarNumber #'break-visibility = #all-visible

Of course, this method works, but it requires that you manually insert 
it where you know that there will be a line break. What was requested 
was a method to let LilyPond automatically do this when there is a line 
break.


/Mats


___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


Re: one bar number per system

2009-09-02 Thread Trevor Daniels


Dan Eble wrote Tuesday, September 01, 2009 12:33 AM


I would like Lilypond to print one bar number per system, except 
the first.  The
default behavior appears to be to print one bar number per system, 
except the
first, for systems that begin at a measure break.  Systems that 
begin in
mid-measure (e.g. due to \bar "") do not get a bar number on the 
first bar line,

and that is what I would like to change.

I already use a variable \meterBreak to increase the likelihood of 
breaking the
line at chosen places (mid-measure or not), so if there is 
something I could add
to \meterBreak that would force the next bar line to have a 
number, that would

be useful.


Does this not work when inserted immediately before
the first full bar on the line? (I haven't actually
tried it)

\once \override Score.BarNumber #'break-visibility = #'#(#t #t #t)

Trevor



___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user


one bar number per system

2009-08-31 Thread Dan Eble
I would like Lilypond to print one bar number per system, except the first.  The
default behavior appears to be to print one bar number per system, except the
first, for systems that begin at a measure break.  Systems that begin in
mid-measure (e.g. due to \bar "") do not get a bar number on the first bar line,
and that is what I would like to change.

I looked in the snippet reference, but nothing seems to fit.  I do not want to
use rehearsal marks if I can avoid it.

I already use a variable \meterBreak to increase the likelihood of breaking the
line at chosen places (mid-measure or not), so if there is something I could add
to \meterBreak that would force the next bar line to have a number, that would
be useful.

If there is no way to get a number on the next bar, an acceptable alternative
would be to print the current bar number in parentheses at the beginning of the
line.

I have seen how "barNumberVisibility" can be set to a function that considers a
bar number and says whether or not it should be visible, but I am out of my
depth trying to understand if there is any way for such a function to know if a
bar number has already been printed on the current line.

Thanks for any suggestions,
-- 
Dan




___
lilypond-user mailing list
lilypond-user@gnu.org
http://lists.gnu.org/mailman/listinfo/lilypond-user