From 03b5368b31bed546689477110ecff2aaf800c1c9 Mon Sep 17 00:00:00 2001 From: Keith OHara Date: Sat, 6 Sep 2014 00:38:27 -0700 Subject: [PATCH] move NullVoice back to Staff Uses of NullVoice have been established that depend on it producing note-heads with pitch associated with a Staff. --- lily/accidental-engraver.cc | 26 ++++++++++++-------------- ly/engraver-init.ly | 10 +++++++--- ly/performer-init.ly | 1 + scm/define-context-properties.scm | 5 ++++- 4 files changed, 24 insertions(+), 18 deletions(-) diff --git a/lily/accidental-engraver.cc b/lily/accidental-engraver.cc index dde27348f8..9aa20975d9 100644 --- a/lily/accidental-engraver.cc +++ b/lily/accidental-engraver.cc @@ -464,22 +464,20 @@ Accidental_engraver::acknowledge_rhythmic_head (Grob_info info) Stream_event *note = info.event_cause (); if (note && (note->in_event_class ("note-event") - || note->in_event_class ("trill-span-event"))) + || note->in_event_class ("trill-span-event")) + // option to skip accidentals on string harmonics + && (to_boolean (get_property ("harmonicAccidentals")) + || info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic")) + // ignore accidentals in non-printing voices like NullVoice + && !to_boolean (info.context ()->get_property ("nullAccidentals"))) { - /* - string harmonics usually don't have accidentals. - */ - if (info.grob ()->get_property ("style") != ly_symbol2scm ("harmonic") - || to_boolean (get_property ("harmonicAccidentals"))) - { - Accidental_entry entry; - entry.head_ = info.grob (); - entry.origin_engraver_ = dynamic_cast (info.origin_translator ()); - entry.origin_ = entry.origin_engraver_->context (); - entry.melodic_ = note; + Accidental_entry entry; + entry.head_ = info.grob (); + entry.origin_engraver_ = dynamic_cast (info.origin_translator ()); + entry.origin_ = entry.origin_engraver_->context (); + entry.melodic_ = note; - accidentals_.push_back (entry); - } + accidentals_.push_back (entry); } } diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index b904935f43..18cc463f9f 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -99,6 +99,7 @@ \defaultchild "Voice" \accepts "Voice" \accepts "CueVoice" + \accepts "NullVoice" \description "Handles clefs, bar lines, keys, accidentals. It can contain @code{Voice} contexts." @@ -785,9 +786,12 @@ context." \override NoteHead.X-extent = #(lambda (g) (ly:stencil-extent (ly:note-head::print g) X)) - \omit Accidental - \omit AccidentalCautionary - \omit AccidentalSuggestion + % generate no accidentals + nullAccidentals = ##t + + %% keep noteheads inside the staff + \consists "Pitch_squash_engraver" + squashedPosition = 0 % the engravers that control the 'busy' flags for note-onsets and melismata \consists "Grob_pq_engraver" diff --git a/ly/performer-init.ly b/ly/performer-init.ly index 297a40d2f5..5eb2572b70 100644 --- a/ly/performer-init.ly +++ b/ly/performer-init.ly @@ -26,6 +26,7 @@ \name Staff \accepts Voice \accepts CueVoice + \accepts NullVoice \defaultchild Voice \consists "Staff_performer" diff --git a/scm/define-context-properties.scm b/scm/define-context-properties.scm index d630629228..498b8b2d02 100644 --- a/scm/define-context-properties.scm +++ b/scm/define-context-properties.scm @@ -487,7 +487,10 @@ ChordNames context.") defined strings to full list of strings and fret numbers. Parameters: The context, a list of note events, a list of tabstring events, and the fretboard grob if a fretboard is desired.") - + (nullAccidentals ,boolean? "The @code{Accidental_engraver} +generates no accidentals for notes in contexts were this is set. +In addition to supressing the printed accidental, this option removes +any effect the note would have had on accidentals in other voices.") (ottavation ,markup? "If set, the text for an ottava spanner. Changing this creates a new text spanner.") -- 2.39.5