lilypond-devel
[Top][All Lists]
Advanced

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

Re: Add dead-is-alive boolean property to Hara_kiri_group_spanner (issue


From: dak
Subject: Re: Add dead-is-alive boolean property to Hara_kiri_group_spanner (issue 6948058)
Date: Sat, 15 Dec 2012 11:40:17 +0000

Reviewers: lemzwerg,

Message:
On 2012/12/15 10:48:12, lemzwerg wrote:
LGTM.  Do we have a regtest (or rather, an example) which demonstrates
how to
use it?

I don't actually have one.  Since this was inspired by a discussion on
the mailing list, I was sort of hoping that Keith would be able to make
use of this for improving his example.

Description:
Add dead-is-alive boolean property to Hara_kiri_group_spanner

This reverses the decisions that the Hara_kiri_engraver makes.
Particularly in connection with the Keep_alive_together_engraver, this
allows for per-line content-based switching between alternative staff
displays.

Please review this at https://codereview.appspot.com/6948058/

Affected files:
  M lily/hara-kiri-group-spanner.cc
  M scm/define-grob-properties.scm


Index: lily/hara-kiri-group-spanner.cc
diff --git a/lily/hara-kiri-group-spanner.cc b/lily/hara-kiri-group-spanner.cc index cb5aacecc551faf1055579bc47f5d5b50d146684..972c77abdcee474444b30f296be4fedd3a98efd4 100644
--- a/lily/hara-kiri-group-spanner.cc
+++ b/lily/hara-kiri-group-spanner.cc
@@ -77,15 +77,17 @@ bool find_in_range (SCM vector, int low, int hi, int min, int max)
 bool
 Hara_kiri_group_spanner::request_suicide (Grob *me, int start, int end)
 {
+  bool in_Hades = to_boolean (me->get_property ("dead-is-alive"));
+
   if (!request_suicide_alone (me, start, end))
-    return false;
+    return in_Hades;

   extract_grob_set (me, "keep-alive-with", friends);
   for (vsize i = 0; i < friends.size (); ++i)
if (friends[i]->is_live () && !request_suicide_alone (friends[i], start, end))
-      return false;
+      return in_Hades;

-  return true;
+  return !in_Hades;
 }

 bool
@@ -184,6 +186,7 @@ ADD_INTERFACE (Hara_kiri_group_spanner,
                " and all its children.",

                /* properties */
+               "dead-is-alive "
                "items-worth-living "
                "important-column-ranks "
                "keep-alive-with "
Index: scm/define-grob-properties.scm
diff --git a/scm/define-grob-properties.scm b/scm/define-grob-properties.scm
index 0b5585a71aea6d3dcf51178fa80e21ccda500d72..5cc71da64304d191e5f1e6f0a8fc6eca762e01ac 100644
--- a/scm/define-grob-properties.scm
+++ b/scm/define-grob-properties.scm
@@ -217,6 +217,10 @@ an ending t-value, a @code{dash-fraction}, and a @code{dash-period}.")
 @code{1.0} (continuous line).")
      (dash-period ,number? "The length of one dash together with
 whitespace.  If negative, no line is drawn at all.")
+     (dead-is-alive ,boolean? "This reverses the decisions that the
address@hidden makes.  Particularly in connection with the
address@hidden, this allows for per-line
+content-based switching between alternative staff displays.")
      (default-direction ,ly:dir? "Direction determined by note head
 positions.")
      (default-staff-staff-spacing ,list? "The settings to use for





reply via email to

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