From: hanwen Date: Sat, 7 Feb 2004 00:41:06 +0000 (+0000) Subject: * scm/music-functions.scm (voicify-music): add \context Staff for X-Git-Tag: release/2.1.20~13 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3d7ad4c0b5cb231a79ec48ee0523b92c4b856184;p=lilypond.git * scm/music-functions.scm (voicify-music): add \context Staff for << \\ >> polyphony. * lily/parser.yy (verbose_command_req): \skip now creates SkipMusic, and does not lead to spurious staves. * scm/define-music-types.scm (music-descriptions): rename NonEventSkip to SkipMusic --- diff --git a/ChangeLog b/ChangeLog index 730b35772a..06e1170816 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,5 +1,14 @@ 2004-02-07 Han-Wen Nienhuys + * scm/music-functions.scm (voicify-music): add \context Staff for + << \\ >> polyphony. + + * lily/parser.yy (verbose_command_req): \skip now creates + SkipMusic, and does not lead to spurious staves. + + * scm/define-music-types.scm (music-descriptions): rename + NonEventSkip to SkipMusic + * input/no-notation/midi-lyric-barcheck.ly: new file. * input/regression/collision-dots-invert.ly: new file. diff --git a/Documentation/user/refman.itely b/Documentation/user/refman.itely index 467b40f3af..56a31c8c0b 100644 --- a/Documentation/user/refman.itely +++ b/Documentation/user/refman.itely @@ -250,7 +250,7 @@ with note name `@code{s}' or with @code{\skip @var{duration}}: a2 s4 a4 \skip 1 a4 @end lilypond -The @code{s} syntax is only available in Note mode and Chord mode. In +The @code{s} syntax is only available in note mode and chord mode. In other situations, you should use the @code{\skip} command: @lilypond[raggedright,verbatim] @@ -265,9 +265,19 @@ other situations, you should use the @code{\skip} command: The skip command is merely an empty musical placeholder. It does not produce any output, not even transparent output. +The @code{s} skip command does create @internalsref{Staff} and +@internalsref{Voice} when necessary, similar to note and rest +commands. For example, the following results in an empty staff. + +@lilypond[raggedright,verbatim] +\score { \notes { s4 } } +@end lilypond + +The same fragment using @code{\skip} results in an empty page. + @seealso -Internals: @internalsref{SkipEvent}. +Internals: @internalsref{SkipEvent}, @internalsref{SkipMusic}. diff --git a/input/test/staff-container.ly b/input/test/staff-container.ly index 8ef7ab4bd2..8ad2a1753e 100644 --- a/input/test/staff-container.ly +++ b/input/test/staff-container.ly @@ -1,4 +1,4 @@ -\version "2.1.7" +\version "2.1.20" \header { @@ -21,7 +21,7 @@ what you would expect. %% %% s4 would create a staff. %% -quarterSkip = #(make-nonevent-skip (ly:make-duration 2 0)) +quarterSkip = #(make-skip-music (ly:make-duration 2 0)) \score { \notes \relative c'' << diff --git a/lily/note-spacing.cc b/lily/note-spacing.cc index 1b60b1cec5..40cb91d5ba 100644 --- a/lily/note-spacing.cc +++ b/lily/note-spacing.cc @@ -20,6 +20,14 @@ #include "accidental-placement.hh" #include "paper-def.hh" + +/* + +TODO: detect hshifts due to collisions, and account for them in +spacing? + +*/ + void Note_spacing::get_spacing (Grob *me, Item* right_col, Real base_space, Real increment, Real *space, Real *fixed) diff --git a/lily/parser.yy b/lily/parser.yy index 15b37c1988..c9dace074f 100644 --- a/lily/parser.yy +++ b/lily/parser.yy @@ -385,9 +385,8 @@ yylex (YYSTYPE *s, void * v) %type Music_list %type property_operation context_mod translator_mod optional_context_mod %type music_output_def_body music_output_def_head -%type shorthand_command_req %type post_event tagged_post_event -%type command_req verbose_command_req +%type command_req %type string_number_event %type string bare_number number_expression number_term number_factor %type score_block score_body @@ -1317,6 +1316,12 @@ command_element: $$-> set_spot (THIS->here_input ()); $1-> set_spot (THIS->here_input ()); } + | SKIP duration_length { + Music * skip = MY_MAKE_MUSIC("SkipMusic"); + skip->set_mus_property ("duration", $2); + + $$ = skip; + } | OCTAVE { THIS->push_spot (); } pitch { Music *l = MY_MAKE_MUSIC("RelativeOctaveCheck"); @@ -1406,31 +1411,16 @@ command_element: ; command_req: - shorthand_command_req { $$ = $1; } - | verbose_command_req { $$ = $1; } - ; - -shorthand_command_req: BREATHE { $$ = MY_MAKE_MUSIC("BreathingSignEvent"); } | E_TILDE { $$ = MY_MAKE_MUSIC("PesOrFlexaEvent"); } - ; - -verbose_command_req: - MARK DEFAULT { + | MARK DEFAULT { Music * m = MY_MAKE_MUSIC("MarkEvent"); $$ = m; } - - | SKIP duration_length { - Music * skip = MY_MAKE_MUSIC("SkipEvent"); - skip->set_mus_property ("duration", $2); - - $$ = skip; - } | tempo_event { $$ = $1; } diff --git a/scm/define-music-types.scm b/scm/define-music-types.scm index 878086a91c..a85ea9bc11 100644 --- a/scm/define-music-types.scm +++ b/scm/define-music-types.scm @@ -531,9 +531,12 @@ For example, transposed music.") (types . (general-music event)) )) - (NonEventSkip + (SkipMusic . ( - (description . "Filler that takes up duration, but does not print anything. This also does not create any event-accepting contexts. ") + (description . "Filler that takes up duration, does not print anything, and also +does not create staffs or voices implicitly. + +Syntax: @code{\\skip }@var{duration}.") (internal-class-name . "Music") (length . ,ly:music-duration-length) (iterator-ctor . ,Simple_music_iterator::constructor) @@ -542,12 +545,13 @@ For example, transposed music.") (SkipEvent . ( - (description . "Filler that takes up duration, but does not print anything.") + (description . "Filler that takes up duration, but does not print anything. + +Syntax: @code{s}@var{duration}") (internal-class-name . "Event") (types . (general-music event rhythmic-event skip-event)) )) - (SpanEvent . ( (description . "Event for anything that is started at a different time than stopped.") diff --git a/scm/music-functions.scm b/scm/music-functions.scm index f343098560..7693d1b774 100644 --- a/scm/music-functions.scm +++ b/scm/music-functions.scm @@ -283,8 +283,8 @@ i.e. this is not an override" )) -(define-public (make-nonevent-skip dur) - (let* ((m (make-music-by-name 'NonEventSkip))) +(define-public (make-skip-music dur) + (let* ((m (make-music-by-name 'SkipMusic))) (ly:set-mus-property! m 'duration dur) m )) @@ -501,8 +501,6 @@ Rest can contain a list of beat groupings ;;; splitting chords into voices. -;; todo: spec \context Staff for <<\\>> -;; (define (voicify-list lst number) "Make a list of Musics. diff --git a/scripts/convert-ly.py b/scripts/convert-ly.py index fd8aa4e5c4..47b8b60cd1 100644 --- a/scripts/convert-ly.py +++ b/scripts/convert-ly.py @@ -1815,6 +1815,15 @@ def conv (str): conversions.append (((2,1,19), conv, """Drum notation changes, Removing \chordmodifiers, \notenames. Harmonic notes. Thread context removed. Lyrics context removed.""")) +def conv (str): + str = re.sub (r'nonevent-skip', 'skip-music', str) + return str + +conversions.append (((2,1,20), conv, """nonevent-skip -> skip-music""" )) + + + + ################################ # END OF CONVERSIONS ################################