-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Am Dienstag, 7. Oktober 2008 schrieb Reinhold Kainhofer:
> Am Dienstag, 7. Oktober 2008 schrieb Han-Wen Nienhuys:
> > You can't do this; the format-metronome-markup is run during
> > interpreting, from Metronome_mark_engraver, which will pass the
> > context object by doing context()->self_scm() in C++.
>
> Actually, as Graham noticed, there is only one spot where the context is
> used, namely to obtain the tempoHideNote property, which Graham doesn't
> need anyway.
> A quick hack would be to simply pass some random context to the function
> and hope that things work out. For example, one can pass the default paper
> block (nothing special about that block, but it was the first thing that
> came to my mind, since we already had something similar with extracting the
> papersize names):

A much cleaner way would be to change the format-metronome-markup function to 
make the context argument optional. If it is not given, simply default to #f 
for hide-note:

(define-public (format-metronome-markup text dur count . context)
  (let* ((ctx (and (pair? context) (car context)))
         (hide-note (and ctx (eq? #t (ly:context-property 
ctx 'tempoHideNote))))
         (note-mark (if (and (not hide-note) (ly:duration? dur))
...

I don't know how useful this might be in general, but since it's such an easy 
feature (and I don't think it breaks anything), I prepared a patch:

http://codereview.appspot.com/7055

What do you think?


One can then simply call 

\version "2.11.62"
\header{ 
  piece = #(format-metronome-markup "Allegro" (ly:make-duration 2) 120)
}
\relative c' { c }


Cheers,
Reinhold
- -- 
- ------------------------------------------------------------------
Reinhold Kainhofer, Vienna University of Technology, Austria
email: [EMAIL PROTECTED], http://reinhold.kainhofer.com/
 * Financial and Actuarial Mathematics, TU Wien, http://www.fam.tuwien.ac.at/
 * K Desktop Environment, http://www.kde.org, KOrganizer maintainer
 * Chorvereinigung "Jung-Wien", http://www.jung-wien.at/
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.6 (GNU/Linux)

iD8DBQFI65hzTqjEwhXvPN0RAlOyAKChx/0LCn2ph+/PVI4tCwjUthBqQwCfeLyO
31eNxmo64CxN3XQssiHs9zI=
=2UuL
-----END PGP SIGNATURE-----


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

Reply via email to