lilypond-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Colored box behind a single note


From: David Kastrup
Subject: Re: Colored box behind a single note
Date: Fri, 26 Jul 2019 15:58:37 +0200
User-agent: Gnus/5.13 (Gnus v5.13) Emacs/27.0.50 (gnu/linux)

Werner LEMBERG <address@hidden> writes:

> [Moving the discussion to lilypond-devel.]
>
>>> A loop?
>
> Attached a new version of the patch, now using a loop.
>
>
>     Werner
>
> diff --git a/lily/horizontal-bracket-engraver.cc 
> b/lily/horizontal-bracket-engraver.cc
> index 608af35965..a42268a357 100644
> --- a/lily/horizontal-bracket-engraver.cc
> +++ b/lily/horizontal-bracket-engraver.cc
> @@ -56,10 +56,23 @@ Horizontal_bracket_engraver::listen_note_grouping 
> (Stream_event *ev)
>  {
>    Direction d = to_dir (ev->get_property ("span-direction"));
>  
> +  // Allow one single-moment bracket.  Abbreviating a horizontal bracket's
> +  // `START' span-direction with `L' and `STOP' with `R', this means that we
> +  // can have
> +  //
> +  //   LLL...LLR
> +  //
> +  // or
> +  //
> +  //   LRRR...RR
> +  //
> +  // events attached to a single moment (we don't take care of the order of
> +  // `L' and `R' events).
> +
>    if (d == STOP)
>      {
>        pop_count_++;
> -      if (pop_count_ > bracket_stack_.size ())
> +      if (pop_count_ > bracket_stack_.size () + 1)
>          ev->origin ()->warning (_ ("do not have that many brackets"));
>      }
>    else
> @@ -68,22 +81,33 @@ Horizontal_bracket_engraver::listen_note_grouping 
> (Stream_event *ev)
>        events_.push_back (ev);
>      }
>  
> -  if (pop_count_ && push_count_)
> +  if (pop_count_ >= 2 && push_count_ >= 2)
>      ev->origin ()->warning (_ ("conflicting note group events"));
>  }

Those number changes do not appear like reflecting some design but
rather like poking the code until the wanted construct happens not to
cause warnings or errors.  Why increase push/pop counts by 2 when
admitting one more level?  Why allow popping exactly 1 more than
pushing?

-- 
David Kastrup



reply via email to

[Prev in Thread] Current Thread [Next in Thread]