From: fred Date: Mon, 4 Aug 1997 23:30:28 +0000 (+0000) Subject: lilypond-0.1.1 X-Git-Tag: release/1.5.59~6093 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=1c8a529fe559986048129206a28b51bca8acf2b5;p=lilypond.git lilypond-0.1.1 --- diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh new file mode 100644 index 0000000000..d092d96488 --- /dev/null +++ b/lily/include/vertical-group-spanner.hh @@ -0,0 +1,35 @@ +/* + vertical-group-spanner.hh -- declare Vertical_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef SPAN_VERTICAL_GROUP_HH +#define SPAN_VERTICAL_GROUP_HH + +#include "spanner.hh" +#include "elem-group.hh" + +/** An element which groups a line. Due to technical problems, this + cannot be used as a baseclass */ +class Vertical_group_spanner : public Spanner, public Vertical_group +{ +protected: + virtual void do_break_processing(); + virtual void do_print()const; + VIRTUAL_COPY_CONS(Vertical_group_spanner, Score_elem); + +private: + void remove_all(); + /// shouldn't be copied. + Vertical_group_spanner(Vertical_group_spanner const&); + +public: + Vertical_group_spanner(); + DECLARE_MY_RUNTIME_TYPEINFO; +}; + +#endif // SPAN_VERTICAL_GROUP_HH diff --git a/lily/line-group-grav.cc b/lily/line-group-grav.cc index 843fa5b551..2e4b506335 100644 --- a/lily/line-group-grav.cc +++ b/lily/line-group-grav.cc @@ -7,12 +7,12 @@ */ #include "staff-sym.hh" -#include "line-group-grav.hh" +#include "vertical-group-spanner.hh" #include "command-request.hh" #include "bar.hh" #include "debug.hh" #include "staffline.hh" - +#include "line-group-grav.hh" Line_group_engraver::Line_group_engraver() { @@ -22,7 +22,8 @@ Line_group_engraver::Line_group_engraver() void Line_group_engraver::acknowledge_element(Score_elem_info elem) { - staffline_p_->add_element(elem.elem_l_); + if ( !elem.elem_l_->y_group_l_ ) + staffline_p_->add_element(elem.elem_l_); } @@ -37,7 +38,7 @@ Line_group_engraver::do_removal_processing() void Line_group_engraver::do_creation_processing() { - staffline_p_ = new Line_of_staff; + staffline_p_ = new Vertical_group_spanner ; staffline_p_->left_col_l_ = get_staff_info().command_pcol_l(); // don't broadcast to self. diff --git a/lily/vertical-group-spanner.cc b/lily/vertical-group-spanner.cc new file mode 100644 index 0000000000..d858349ca5 --- /dev/null +++ b/lily/vertical-group-spanner.cc @@ -0,0 +1,104 @@ +/* + vertical-group-spanner.cc -- implement Vertical_group_spanner + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + +#include "vertical-group-spanner.hh" +#include "item.hh" +#include "p-col.hh" + +/** + Uncouple all elements of this Vertical_group. Ugh! + */ +void +Vertical_group_spanner::remove_all() +{ + for (int i=0; i < elem_l_arr_.size(); i++){ + elem_l_arr_[i]->y_group_l_ = 0; + } + elem_l_arr_.set_size(0); + junk_dependencies(); +} + +void +Vertical_group_spanner::do_break_processing() +{ + set_my_columns(); + if ( line_l() ) { + return; + } + break_into_pieces( false ); + + Link_array elem_l_arr = elem_l_arr_; + remove_all(); + + + + for (int i=0; i < elem_l_arr.size(); i++) { + Score_elem * elt = elem_l_arr[i]; + Line_of_score *elt_line = elt->line_l(); + + if ( elt-> y_group_l_ ) + continue; + + if ( ! elt_line ){ + if (elt->spanner()) { + Spanner * sp = elt->spanner(); + + for (int j =0; j < broken_into_l_arr_.size(); j++) { + Vertical_group_spanner * my_broken_l + = (Vertical_group_spanner*)broken_into_l_arr_[j]; + + Spanner * broken_span_l + = sp->find_broken_piece(my_broken_l->line_l()); + + if (broken_span_l) { + my_broken_l->add_element(broken_span_l ); + } + } + } else if (elt->item() && elt->item()->pcol_l_->breakpoint_b() + && elt->item()->break_status_i() == 0) { + for (int j =0; j < 2; j++) { + Item * my_item = elt->item()->broken_to_a_[j]; + Line_of_score * item_line_l_ = my_item->line_l() ; + if ( ! item_line_l_ ) + continue; + + Vertical_group_spanner * v + = (Vertical_group_spanner*)find_broken_piece( item_line_l_); + if (v) { + v->add_element( my_item ); + } + } + } + } else { + Vertical_group_spanner * my_broken_l + = (Vertical_group_spanner*)find_broken_piece( elt->line_l() ); + my_broken_l->add_element( elt ); + } + } + for (int j =0; j < broken_into_l_arr_.size(); j++) + broken_into_l_arr_[j]->break_processing(); +} + +Vertical_group_spanner::Vertical_group_spanner() +{ +} + +void +Vertical_group_spanner::do_print() const +{ + Vertical_group::do_print(); +} + + + +IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Spanner, Vertical_group); + +Vertical_group_spanner::Vertical_group_spanner(Vertical_group_spanner const &s) + : Spanner(s), Vertical_group(s) +{ +}