From 205b8c57c9d2ff16adfa82bad73965a3e90645a5 Mon Sep 17 00:00:00 2001 From: David Kastrup Date: Sat, 11 Apr 2015 18:35:47 +0200 Subject: [PATCH] Issue 4333: Cue notes should not be included in ambitus This works by adding a boolean `ignore-ambitus' property to the `note-head-interface'. --- input/regression/ambitus-cue.ly | 7 +++++-- lily/ambitus-engraver.cc | 3 ++- lily/note-head.cc | 1 + ly/engraver-init.ly | 3 ++- scm/define-grob-properties.scm | 7 +++++-- scm/define-grobs.scm | 1 + 6 files changed, 16 insertions(+), 6 deletions(-) diff --git a/input/regression/ambitus-cue.ly b/input/regression/ambitus-cue.ly index 83b10e3ac7..bf6f6fc990 100644 --- a/input/regression/ambitus-cue.ly +++ b/input/regression/ambitus-cue.ly @@ -1,4 +1,4 @@ -\version "2.16.0" +\version "2.19.19" \header { texidoc = "Ambitus for pieces beginning with @code{\\cueDuringWithClef}. @@ -8,6 +8,9 @@ a cue is frequently in a different clef, so the @code{\\cueDuringWithClef} command is handy. Using this command at the beginning of a piece should leave the ambitus displayed based on the main clef. + +An @code{Ambitus_engraver} should ignore notes in @code{CueVoice} +contexts. " } @@ -21,7 +24,7 @@ on the main clef. \layout { \context { - \Voice + \Staff \consists "Ambitus_engraver" } } diff --git a/lily/ambitus-engraver.cc b/lily/ambitus-engraver.cc index 0a76267c7e..58716c3ccf 100644 --- a/lily/ambitus-engraver.cc +++ b/lily/ambitus-engraver.cc @@ -136,7 +136,8 @@ void Ambitus_engraver::acknowledge_note_head (Grob_info info) { Stream_event *nr = info.event_cause (); - if (nr && nr->in_event_class ("note-event")) + if (nr && nr->in_event_class ("note-event") + && !to_boolean (info.grob ()->get_property ("ignore-ambitus"))) { SCM p = nr->get_property ("pitch"); /* diff --git a/lily/note-head.cc b/lily/note-head.cc index 89c0047c0f..3c6dc82763 100644 --- a/lily/note-head.cc +++ b/lily/note-head.cc @@ -207,6 +207,7 @@ ADD_INTERFACE (Note_head, "duration-log " "note-names " "accidental-grob " + "ignore-ambitus " "glyph-name " "stem-attachment " "style " diff --git a/ly/engraver-init.ly b/ly/engraver-init.ly index 12a5fcf2ed..5d695ebf5c 100644 --- a/ly/engraver-init.ly +++ b/ly/engraver-init.ly @@ -16,7 +16,7 @@ %%%% You should have received a copy of the GNU General Public License %%%% along with LilyPond. If not, see . -\version "2.19.16" +\version "2.19.19" \context { \name "Global" @@ -277,6 +277,7 @@ multiple voices on the same staff." \name "CueVoice" \alias "Voice" fontSize = #-4 + \override NoteHead.ignore-ambitus = ##t \override Stem.length-fraction = #(magstep -4) \override Beam.length-fraction = #(magstep -4) \override Beam.beam-thickness = #0.35 diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm index d0753500aa..e35a05439d 100644 --- a/scm/define-grob-properties.scm +++ b/scm/define-grob-properties.scm @@ -214,8 +214,9 @@ increments from this initial value.") dash structure. Each @code{dash-element} has a starting t value, an ending t-value, a @code{dash-fraction}, and a @code{dash-period}.") (dash-fraction ,number? "Size of the dashes, relative to -@code{dash-period}. Should be between @code{0.1} and @code{1.0} -(continuous line). If set to @code{0.0}, a dotted line is produced") +@code{dash-period}. Should be between @code{0.1} and +@code{1.0} (continuous line). If set to @code{0.0}, a dotted line is +produced") (dash-period ,number? "The length of one dash together with whitespace. If negative, no line is drawn at all.") (default-direction ,ly:dir? "Direction determined by note head @@ -530,6 +531,8 @@ the string will be assigned to the @code{id} attribute of a group () that encloses the stencils that comprise the grob. In the Postscript backend, as there is no way to group items, the setting of the id property will have no effect.") + (ignore-ambitus ,boolean? "If set, don't consider this notehead +for ambitus calculation.") (ignore-collision ,boolean? "If set, don't do note collision resolution on this @code{NoteColumn}.") (implicit ,boolean? "Is this an implicit bass figure?") diff --git a/scm/define-grobs.scm b/scm/define-grobs.scm index 252733d166..f077c80168 100644 --- a/scm/define-grobs.scm +++ b/scm/define-grobs.scm @@ -154,6 +154,7 @@ . ( (duration-log . 2) (glyph-name . ,note-head::calc-glyph-name) + (ignore-ambitus . #t) (stencil . ,ly:note-head::print) (Y-offset . ,staff-symbol-referencer::callback) (Y-extent . ,grob::always-Y-extent-from-stencil) -- 2.39.2