]> git.donarmstrong.com Git - lilypond.git/commitdiff
Moves grobs with their Y parents if parents have outside-staff-priority.
authorMike Solomon <mike@apollinemike.com>
Thu, 28 Jul 2011 08:28:04 +0000 (10:28 +0200)
committerMike Solomon <mike@apollinemike.com>
Thu, 28 Jul 2011 08:28:04 +0000 (10:28 +0200)
This is immediately useful for tuplet brackets, as the tuplet numbers
are now shifted with them if brackets have outside staff priority.

input/regression/tuplet-bracket-outside-staff-priority.ly [new file with mode: 0644]
lily/axis-group-interface.cc
lily/context.cc
lily/include/axis-group-interface.hh
lily/tuplet-engraver.cc

diff --git a/input/regression/tuplet-bracket-outside-staff-priority.ly b/input/regression/tuplet-bracket-outside-staff-priority.ly
new file mode 100644 (file)
index 0000000..fa6b082
--- /dev/null
@@ -0,0 +1,21 @@
+\version "2.15.6"
+\header {
+
+  texidoc = "Tuplet brackets' outside staff priority can be
+set.  Brackets, by default, carry their numbers with them."
+
+}
+
+\relative c'' {
+  % Plain old tuplet
+  \times 2/3 { a8 r a }
+  % With nothing set, collisions abound both horizontally and
+  % vertically
+  \times 2/3 { a8^\espressivo r a^\espressivo }
+  % Setting the staff priority prevents collisions
+  \override TupletBracket #'outside-staff-priority = #1
+  \times 2/3 { a8^\espressivo r a^\espressivo }
+  % Note that, with the outside-staff-priority set, this bracket
+  % should be at the same vertical level as the first one
+  \times 2/3 { a8 r a }
+}
index 0b399fd2482e5fa8ef9da603a416471dd9281ac8..e0bd31663f89d1134018b224976ffc237adfb7d8 100644 (file)
@@ -666,6 +666,15 @@ add_grobs_of_one_priority (Skyline_pair *const skylines,
     }
 }
 
+bool
+Axis_group_interface::has_outside_staff_parent (Grob *me)
+{
+  return (me
+          ? (scm_is_number (me->get_property ("outside-staff-priority"))
+             || has_outside_staff_parent (me->get_parent (Y_AXIS)))
+          : false);
+}
+
 // TODO: it is tricky to correctly handle skyline placement of cross-staff grobs.
 // For example, cross-staff beams cannot be formatted until the distance between
 // staves is known and therefore any grobs that depend on the beam cannot be placed
@@ -699,7 +708,7 @@ Axis_group_interface::skyline_spacing (Grob *me, vector<Grob*> elements)
   Skyline_pair skylines;
   for (i = 0; i < elements.size ()
         && !scm_is_number (elements[i]->get_property ("outside-staff-priority")); i++)
-    if (!to_boolean (elements[i]->get_property ("cross-staff")))
+    if (!(to_boolean (elements[i]->get_property ("cross-staff")) || has_outside_staff_parent (elements[i])))
       add_boxes (elements[i], x_common, y_common, &boxes, &skylines);
 
   SCM padding_scm = me->get_property ("skyline-horizontal-padding");
index 0d7fbe35f6d1ffa65deba31f35405d22897bb030..4dbb6e5657721e436dc4f52227d24409c62a53e8 100644 (file)
@@ -490,13 +490,10 @@ Context::instrumented_set_property (SCM sym, SCM val, const char*, int, const ch
 void
 Context::internal_set_property (SCM sym, SCM val)
 {
-  bool type_check_ok = type_check_assignment (sym, val, ly_symbol2scm ("translation-type?"));
-
   if (do_internal_type_checking_global)
-    assert (type_check_ok);
+    assert (type_check_assignment (sym, val, ly_symbol2scm ("translation-type?")));
 
-  if (type_check_ok)
-    properties_dict ()->set (sym, val);
+  properties_dict ()->set (sym, val);
 }
 
 /*
index fa662020967bfbe57f6234c2ef9cded251b94225..1537f1d35861f89d79318289612b9f814e57bee6 100644 (file)
@@ -53,6 +53,7 @@ struct Axis_group_interface
   static Interval rest_of_line_pure_height (Grob *me, int, int);
   static Interval part_of_line_pure_height (Grob *me, bool begin, int, int);
 
+  static bool has_outside_staff_parent (Grob *me);
   static Skyline_pair skyline_spacing (Grob *me, vector<Grob*> elements);
   static void add_element (Grob *me, Grob *);
   static void set_axes (Grob *, Axis, Axis);
index 39c120dd751be00ac4b640a45ae960c165d1ff66..3829c98283632ed0f4583e68c99a4e577bdd23b3 100644 (file)
@@ -182,6 +182,8 @@ Tuplet_engraver::process_music ()
       tuplets_[i].number_ = make_spanner ("TupletNumber",
                                          tuplets_[i].event_->self_scm ());
       tuplets_[i].number_->set_object ("bracket", tuplets_[i].bracket_->self_scm ());
+      tuplets_[i].number_->set_parent (tuplets_[i].bracket_, X_AXIS);
+      tuplets_[i].number_->set_parent (tuplets_[i].bracket_, Y_AXIS);
       tuplets_[i].bracket_->set_object ("tuplet-number", tuplets_[i].number_->self_scm ());
       tuplets_[i].stop_moment_.grace_part_ = 0;