From: Han-Wen Nienhuys Date: Fri, 10 Sep 2004 10:37:13 +0000 (+0000) Subject: * scm/define-context-properties.scm X-Git-Tag: release/2.3.15~2 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=aad9d4e5907d37f9d05ee870aa59976430a5ae6c;p=lilypond.git * scm/define-context-properties.scm (all-internal-translation-properties): add property. Remove definition of quotes property. * Documentation/user/notation.itely (Quoting other voices): document it * lily/quote-iterator.cc (moment_less): add quotedEventTypes property, to determine what events are processed in \quote. --- diff --git a/ChangeLog b/ChangeLog index 1d31b7fa2e..32a74f7868 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,16 @@ +2004-09-10 Han-Wen Nienhuys + + * scm/define-context-properties.scm + (all-internal-translation-properties): add property. Remove + definition of quotes property. + + + * Documentation/user/notation.itely (Quoting other voices): + document it + + * lily/quote-iterator.cc (moment_less): add quotedEventTypes + property, to determine what events are processed in \quote. + 2004-09-10 Juergen Reuter * (many files): removed most occurrences of underscore ("_") diff --git a/Documentation/topdocs/NEWS.texi b/Documentation/topdocs/NEWS.texi index 794a86b1de..c18aea855b 100644 --- a/Documentation/topdocs/NEWS.texi +++ b/Documentation/topdocs/NEWS.texi @@ -7,9 +7,14 @@ @unnumbered New features in 2.3 since 2.2 @itemize @bullet + +@item The types of events quoted with @code{\quote} can now be tuned +with @code{quotedEventTypes}. By default, only notes and rests end up +in quotes. + @item LilyPond will try to keep staves at the same distances across a page, but it will stretch -distances to prevent collisions. This results in a more orderly +distances to prevent collisions. This results in a more even appearance of the page. @item Key signature cancellations are now printed before the bar line, diff --git a/Documentation/user/notation.itely b/Documentation/user/notation.itely index 81a78ea4fd..d014f92b0c 100644 --- a/Documentation/user/notation.itely +++ b/Documentation/user/notation.itely @@ -5463,6 +5463,19 @@ instruments, if they are specified using the @code{\transposition} command. } @end lilypond +The type of events that are present in cue notes can be trimmed with +the @code{quotedEventTypes} property. The default value is +@code{(note-event rest-event)}, which means that only notes of and +rests of the cued voice end up in the @code{\quote}. +Setting + +@example + \set Staff.quotedEventTypes = #'(note-event articulation-event dynamic-event) +@end example + +@noindent +will quote notes (but no rests), together with scripts and dynamics. + @refbugs Only the contents of the first @internalsref{Voice} occurring in an diff --git a/input/regression/quote.ly b/input/regression/quote.ly index 12c1e0cba5..ca222ee135 100644 --- a/input/regression/quote.ly +++ b/input/regression/quote.ly @@ -1,20 +1,31 @@ \header { - texidoc = "With @code{\quote}, fragments of previously entered -music may be quoted. " + texidoc = "With @code{\\quote}, fragments of previously entered +music may be quoted. @code{quotedEventTypes} will determines what +things are quoted. In this example, a 16th rests is not quoted, since +@code{rest-event} is not in @code{quotedEventTypes}." } \version "2.3.4" \paper { raggedright = ##t } + \addquote bla \relative c' { - fis4 g a b } + fis4 r16 a8.-> b-\ff } + +\relative c'' { -\score { - \relative c'' { - c8 d8 \quote bla 2 es8 gis + \set Staff.quotedEventTypes = #'(note-event articulation-event) + c8 d8 << + s2 + \new Voice { + \set fontSize = #-2 + \quote bla 2 + + } >> + es8 gis + } -} diff --git a/lily/quote-iterator.cc b/lily/quote-iterator.cc index 307b860dc9..8b101eb6e8 100644 --- a/lily/quote-iterator.cc +++ b/lily/quote-iterator.cc @@ -31,6 +31,7 @@ public: DECLARE_SCHEME_CALLBACK (constructor, ()); + bool accept_music_type (Music*) const; protected: virtual void derived_mark (); virtual void construct_children (); @@ -39,6 +40,21 @@ protected: virtual bool ok () const; }; +bool +Quote_iterator::accept_music_type (Music *mus) const +{ + SCM accept = get_outlet()->get_property ("quotedEventTypes"); + for (SCM s = mus->get_property ("types"); + ly_c_pair_p (s); s = ly_cdr (s)) + { + if (scm_memq (ly_car (s), accept) != SCM_BOOL_F) + return true; + } + + return false; +} + + void Quote_iterator::derived_mark () { @@ -116,7 +132,6 @@ Quote_iterator::ok () const return ly_c_vector_p (event_vector_) && (event_idx_ <= end_idx_); } - Moment Quote_iterator::pending_moment () const { @@ -124,7 +139,6 @@ Quote_iterator::pending_moment () const return *unsmob_moment (ly_caar (entry)) - start_moment_; } - void Quote_iterator::process (Moment m) { @@ -155,9 +169,10 @@ Quote_iterator::process (Moment m) { SCM ev_acc = ly_car (s); - Music * mus = unsmob_music (ly_car (ev_acc)); - if (mus) + if (!mus) + programming_error ("need music in quote."); + else if (accept_music_type (mus)) { if (quote_pitch || me_pitch) { @@ -182,8 +197,6 @@ Quote_iterator::process (Moment m) if (!b) mus->origin ()->warning (_f ("In quotation: junking event %s", mus->name ())); } - else - programming_error ("need music in quote."); } } event_idx_ ++; diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 8305a01c3b..6169b82938 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -556,7 +556,8 @@ AncientRemoveEmptyStaffContext = \context { (Voice Accidental font-size -4) (Voice Slur direction -1) ) - + + quotedEventTypes = #'(note-event rest-event) } EasyNotation = \context { % TODO: why \context override? diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index f8e1c0b479..3606f84226 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -480,7 +480,10 @@ signature change.") Script_engraver for typesetting note-super/subscripts. See @file{scm/script.scm} for more information ") - (quotes ,hash-table? "Hash table, mapping names to music-event vectors.") + (quotedEventTypes ,list? "List of symbols, representing the +event types that should be duplicated for @code{\\quote} commands.") + +; (quotes ,hash-table? "Hash table, mapping names to music-event vectors.") (stavesFound ,grob-list? "list of all staff-symbols found.") (instrumentSupport ,grob-list? "list of grobs to attach instrument name to.")