* lily/parser.yy (book_body): Grok Composite_music and \header.
(markup): Push NOTES mode before score_block.
2004-05-09 Jan Nieuwenhuizen <janneke@gnu.org>
+ * input/test/markup-score.ly: Remove \notes.
+
+ * lily/parser.yy (book_body): Grok Composite_music and \header.
+ (markup): Push NOTES mode before score_block.
+
* mf/feta-klef.mf:
* mf/feta-bolletjes.mf: Oops. Comment-out canvast test code.
@item @code{\apply} has been renamed to @code{\applymusic}.
@item Music can be used as a markup.
-When inserting a @code{score} block as part of a @code{\markup},
-it produces a rendered markup of the music.
+When inserting a @code{\score} block as part of a @code{\markup}, it
+produces a rendered markup of the music.
@example
@c TODO, see input/test/markup-score.ly
(ly:export
#@{ \override Voice.TextScript #'extra-offset = #(cons $dx $dy) #@}))
-\score @{
- \notes @{
- c'^"normal text"
- %% the following statement is the same as
- %% \override Voice.TextScript #'extra-offset = #(cons 2 -3)
- #(textoffset 2 -3)
- c'^"text with offset"
- @}
+@{
+ c'^"normal text"
+ %% The following embedded scheme call is the same as
+ %% \override Voice.TextScript #'extra-offset = #(cons 2 -3)
+ #(textoffset 2 -3)
+ c'^"text with offset"
@}
@end example
-@item Music lists are allowed at toplevel.
+@item A music list at toplevel is interpreted as implicit @code{\score}
+a @code{\score} block at toplevel is interpreted as an implicit
+@code{\book} and @code{\notes} mode is the default lexer mode. The
+result is that
@example
\header @{ title = "The Title" @}
-\notes @{ a b c @}
+@{ a b c @}
@end example
is the same as
@}
@end example
-These toplevel forms are handled by
-@code{default-toplevel-music-handler}. Similarly, a @code{score}
+Actually, a toplevel music list is now handled quite flexibly by
+@code{default-toplevel-music-handler}. Similarly, a @code{\score}
block at toplevel is handled by @code{default-toplevel-score-handler}
and a @code{book} at toplevel is handled by
-@code{default-toplevel-book-handler}.
+@code{default-toplevel-book-handler}. The default behavior of these
+handlers produces the results described above.
@ignore
@code{ly:parse-file}, so the following fragment processes two files
@verbatim
- #(ly:parse-file "another.ly")
- \score { \notes { c4 }}
+#(ly:parse-file "another.ly")
+\score { \notes { c4 }}
@end verbatim
@item The @code{font-encoding} property can now be used to select
block. The @code{piece} name from the header will be printed before
each movement.
-@c FIXME: introduce \BOOK
+@ignore
+
+FIXME: introduce \BOOK
+
+FIXME: Using "Adagio" as a name is confusing, it's more common to be
+a plain tempo indication.
+
+Since today (CVS-1.211) we also allow headers and composite music
+inside book:
-@c FIXME: Using "Adagio" as a name is confusing, it's more common to be
-@c a plain tempo indication.
+ \header { ... }
+ \book {
+ \header { ... }
+ { ... }
+ \header { ... }
+ { ... }
+ }
+
+@end ignore
@cindex Engraved by LilyPond
@cindex signature line
}
-%%\new PianoStaff <<
- <<
+%% FIXME:
+%% THIS does not parse:
+%\new PianoStaff <<
+
+%% and THIS: gives incorrect results (all lyrics below pianostaff)
+%\context PianoStaff <<
+
+%% only this works as advertised...
+<<
\new Staff \relative {
d'2 d c4 bes a2 \break
c2 c d4 f g2
NOT MUCH CAN GO WRONG!
}
\newlyrics {
- My next Li -- ly verse
- Not much can go wrong!
+ MY NEXT LI -- LY VERSE
+ NOT MUCH CAN GO WRONG!
}
>>
\header {
- %% WIP
- %% this would be more useful as a footnote, but we don't have
- %% (sensible) header/footer+footnotes yet (2.3.1).
+ %% When vertical dimension and stacking works properly, this
+ %% should be broken up into a few regression tests.
+
+ %% Too bad that '{' is overloaded, we need something (the bit arbitrary
+ %% `\score' now, to introduce to-markup-stencil-rendered music.
+
texidoc = "Use \\score block as markup command."
+
}
\version "2.3.1"
}
tuning = \markup {
- \score { \notes { \clef bass <c, g, d g>1 } \paper{ \inBed }}
+ \score { { \clef bass <c, g, d g>1 } \paper{ \inBed }}
}
#(define-public (my-footer paper page-number)
%% wtf, no horizontal shift?
"" %%\kern #-10
\translate #'(-15 . 0)
- \score { \notes \times 2/3 { c'8 c' c' } \paper { \noCruftInBed }}
+ \score { \times 2/3 { c'8 c' c' } \paper { \noCruftInBed }}
" ="
- \score { \notes { c'8[ c'] } \paper { \noCruftInBed } }
+ \score { { c'8[ c'] } \paper { \noCruftInBed } }
}
\header {
(c) 1997--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-
-
#ifndef MUSIC_HH
#define MUSIC_HH
Music* make_music_by_name (SCM sym);
SCM ly_deep_mus_copy (SCM);
+SCM ly_music_scorify (SCM);
-#endif // MUSIC_HH
+#endif /* MUSIC_HH */
return sc->self_scm ();
}
-
LY_DEFINE (ly_music_scorify, "ly:music-scorify",
1, 0, 0,
(SCM music),
scm_gc_unprotect_object (score->self_scm ());
return score->self_scm ();
}
-
}
;
+/* FIXME:
+ * Use 'handlers' like for toplevel-* stuff?
+ * grok \paper and \midi? */
book_body:
{
$$ = new Book;
$$->set_spot (THIS->here_input ());
}
| book_body score_block {
- $$->scores_.push ($2);
- scm_gc_unprotect_object ($2->self_scm ());
+ Score *score = $2;
+ $$->scores_.push (score);
+ scm_gc_unprotect_object (score->self_scm ());
+ }
+ | book_body Composite_music {
+ Music *music = $2;
+ Score *score
+ = unsmob_score (ly_music_scorify (music->self_scm ()));
+ $$->scores_.push (score);
+ scm_gc_unprotect_object (music->self_scm ());
+ }
+ | lilypond_header {
+ THIS->header_ = $1;
}
| book_body error {
}
| STRING_IDENTIFIER {
$$ = $1;
}
- | score_block {
+ | {
+ SCM nn = THIS->lexer_->lookup_identifier ("pitchnames");
+ THIS->lexer_->push_note_state (alist_to_hashq (nn));
+ }
+ /* cont */ score_block {
/* WIP this is a bit arbitrary,
we should also allow \book or Composite_music.
However, you'd typically want to change paper
settings, and need a \score block anyway. */
- Score *score = $1;
+
+ THIS->lexer_->pop_state ();
+ Score *score = $2;
Book *book = new Book;
book->scores_.push (score);
void
Score_engraver::typeset_grob (Grob *elem)
{
+ (void) elem;
// elems_.push (elem);
}