From: fred Date: Sat, 6 Dec 1997 01:44:06 +0000 (+0000) Subject: lilypond-0.1.36 X-Git-Tag: release/1.5.59~6021 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=3b0dfd9dc5b4c1c8a7dd91acc41918e2d3397183;p=lilypond.git lilypond-0.1.36 --- diff --git a/lily/score-priority-grav.cc b/lily/score-priority-grav.cc new file mode 100644 index 0000000000..1358ec4232 --- /dev/null +++ b/lily/score-priority-grav.cc @@ -0,0 +1,81 @@ +/* + score-align-reg.cc -- implement Score_priority_engraver + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#include "horizontal-group-item.hh" +#include "score-priority-grav.hh" +#include "item.hh" +#include "assoc-iter.hh" +#include "break-align-item.hh" + + +Score_priority_engraver::Score_priority_engraver() +{ +} + +void +Score_priority_engraver::do_pre_move_processing() +{ + for (Assoc_iter i(align_p_assoc_); i.ok() ; i++) + { + if (i.val ()) + { + typeset_element (i.val ()); + i.val () = 0; + } + } + align_p_assoc_.clear (); +} + +void +Score_priority_engraver::acknowledge_element (Score_elem_info inf) +{ + Item * item_l = inf.elem_l_->item (); + if (item_l && item_l->breakable_b_) + { + /* + Don't try to eat up our (probable) parent. + */ + if (inf.origin_grav_l_arr_.size () <= 1 && + item_l->is_type_b (Break_align_item::static_name ())) + return; + + + int p =item_l-> break_priority_i_; + Horizontal_group_item * hg =0; + if (!align_p_assoc_.elt_b(p)) + { + hg = new Horizontal_group_item; + announce_element (Score_elem_info (hg,0)); + align_p_assoc_[p] = hg; + hg->break_priority_i_ = p; + hg->breakable_b_ = true; + } + else + hg = align_p_assoc_[p]; + + Score_elem * unbound_elem = inf.elem_l_; + + + while (unbound_elem->axis_group_l_a_[X_AXIS]) + { + /* We might have added inf.elem_l_ earlier because we added one + of its children. We don't want to add ourselves to ourself + */ + if (unbound_elem->axis_group_l_a_[X_AXIS] == hg) + return; + unbound_elem = unbound_elem->axis_group_l_a_[X_AXIS]; + } + + + hg->add_element (unbound_elem); + } +} + +IMPLEMENT_IS_TYPE_B1(Score_priority_engraver, Engraver); +ADD_THIS_TRANSLATOR(Score_priority_engraver);