From: Mike Solomon Date: Thu, 28 Jul 2011 08:28:04 +0000 (+0200) Subject: Moves grobs with their Y parents if parents have outside-staff-priority. X-Git-Tag: release/2.15.7-1~17 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=72210831b0366cb7c1f7009ba99a56538d68a7e5;p=lilypond.git Moves grobs with their Y parents if parents have outside-staff-priority. This is immediately useful for tuplet brackets, as the tuplet numbers are now shifted with them if brackets have outside staff priority. --- diff --git a/input/regression/tuplet-bracket-outside-staff-priority.ly b/input/regression/tuplet-bracket-outside-staff-priority.ly new file mode 100644 index 0000000000..fa6b082034 --- /dev/null +++ b/input/regression/tuplet-bracket-outside-staff-priority.ly @@ -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 } +} diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 0b399fd248..e0bd31663f 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -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 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"); diff --git a/lily/context.cc b/lily/context.cc index 0d7fbe35f6..4dbb6e5657 100644 --- a/lily/context.cc +++ b/lily/context.cc @@ -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); } /* diff --git a/lily/include/axis-group-interface.hh b/lily/include/axis-group-interface.hh index fa66202096..1537f1d358 100644 --- a/lily/include/axis-group-interface.hh +++ b/lily/include/axis-group-interface.hh @@ -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 elements); static void add_element (Grob *me, Grob *); static void set_axes (Grob *, Axis, Axis); diff --git a/lily/tuplet-engraver.cc b/lily/tuplet-engraver.cc index 39c120dd75..3829c98283 100644 --- a/lily/tuplet-engraver.cc +++ b/lily/tuplet-engraver.cc @@ -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;