From: Jan Nieuwenhuizen Date: Sun, 9 May 2004 15:21:10 +0000 (+0000) Subject: * input/test/markup-score.ly: Remove \notes. X-Git-Tag: release/2.3.2~26 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=4d6556d0c849ead8c9de6ffd42245a9728d4af7e;p=lilypond.git * input/test/markup-score.ly: Remove \notes. * lily/parser.yy (book_body): Grok Composite_music and \header. (markup): Push NOTES mode before score_block. --- diff --git a/ChangeLog b/ChangeLog index 4667ce6314..a4c6f54b36 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,10 @@ 2004-05-09 Jan Nieuwenhuizen + * 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. diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index bf83c31e99..379e6629aa 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -23,8 +23,8 @@ here is the new implementation @code{\applymusic}, @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 @@ -41,22 +41,23 @@ introduced using a @code{$} character (@code{$$} results in a single (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 @@ -70,11 +71,12 @@ 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 @@ -113,8 +115,8 @@ Syntactically, @code{\newlyrics} acts like an infix operator. @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 diff --git a/Documentation/user/tutorial.itely b/Documentation/user/tutorial.itely index c47c79cf96..45c0f78ab0 100644 --- a/Documentation/user/tutorial.itely +++ b/Documentation/user/tutorial.itely @@ -1258,10 +1258,25 @@ The header for each piece of music can be put inside the @code{\score} 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 diff --git a/input/regression/newaddlyrics.ly b/input/regression/newaddlyrics.ly index 9c8d78d4f2..c38d6bc13d 100644 --- a/input/regression/newaddlyrics.ly +++ b/input/regression/newaddlyrics.ly @@ -4,8 +4,15 @@ } -%%\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 @@ -28,8 +35,8 @@ 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! } >> diff --git a/input/test/markup-score.ly b/input/test/markup-score.ly index 049862a8d6..7ab00df56b 100644 --- a/input/test/markup-score.ly +++ b/input/test/markup-score.ly @@ -1,9 +1,13 @@ \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" @@ -77,7 +81,7 @@ noCruftInBed = \paper { } tuning = \markup { - \score { \notes { \clef bass 1 } \paper{ \inBed }} + \score { { \clef bass 1 } \paper{ \inBed }} } #(define-public (my-footer paper page-number) @@ -89,9 +93,9 @@ tempoChange = \markup { %% 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 { diff --git a/lily/include/music.hh b/lily/include/music.hh index 902c151b89..5d95c29103 100644 --- a/lily/include/music.hh +++ b/lily/include/music.hh @@ -6,8 +6,6 @@ (c) 1997--2004 Han-Wen Nienhuys */ - - #ifndef MUSIC_HH #define MUSIC_HH @@ -73,5 +71,6 @@ DECLARE_UNSMOB(Music,music); Music* make_music_by_name (SCM sym); SCM ly_deep_mus_copy (SCM); +SCM ly_music_scorify (SCM); -#endif // MUSIC_HH +#endif /* MUSIC_HH */ diff --git a/lily/music.cc b/lily/music.cc index 21356b6745..4d882ba983 100644 --- a/lily/music.cc +++ b/lily/music.cc @@ -371,7 +371,6 @@ LY_DEFINE (ly_music_compress, "ly:music-compress", return sc->self_scm (); } - LY_DEFINE (ly_music_scorify, "ly:music-scorify", 1, 0, 0, (SCM music), @@ -391,4 +390,3 @@ LY_DEFINE (ly_music_scorify, "ly:music-scorify", scm_gc_unprotect_object (score->self_scm ()); return score->self_scm (); } - diff --git a/lily/parser.yy b/lily/parser.yy index d9b2dd85db..5d181da880 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -624,14 +624,28 @@ book_block: } ; +/* 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 { } @@ -2520,12 +2534,18 @@ markup: | 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); diff --git a/lily/score-engraver.cc b/lily/score-engraver.cc index 7df239b584..b8e1e9370d 100644 --- a/lily/score-engraver.cc +++ b/lily/score-engraver.cc @@ -157,6 +157,7 @@ Score_engraver::announce_grob (Grob_info info) void Score_engraver::typeset_grob (Grob *elem) { + (void) elem; // elems_.push (elem); }