From: fred Date: Sun, 24 Mar 2002 19:53:14 +0000 (+0000) Subject: lilypond-0.1.7 X-Git-Tag: release/1.5.59~4151 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=35c053aa4c00b6d5f897d359bdf722b9c90430f3;p=lilypond.git lilypond-0.1.7 --- diff --git a/lily/elem-group-item.cc b/lily/elem-group-item.cc index 138bd146a3..c22739a849 100644 --- a/lily/elem-group-item.cc +++ b/lily/elem-group-item.cc @@ -13,7 +13,7 @@ void Horizontal_vertical_group_item::do_print()const { - Horizontal_vertical_group::do_print(); + Horizontal_vertical_group_element::do_print(); } -IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group,Item); +IMPLEMENT_IS_TYPE_B2(Horizontal_vertical_group_item,Horizontal_vertical_group_element,Item); diff --git a/lily/horizontal-group-item.cc b/lily/horizontal-group-item.cc index 15af0bd803..409f2feadf 100644 --- a/lily/horizontal-group-item.cc +++ b/lily/horizontal-group-item.cc @@ -9,33 +9,10 @@ #include "p-col.hh" #include "horizontal-group-item.hh" -IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group, Item); +IMPLEMENT_IS_TYPE_B2(Horizontal_group_item, Horizontal_group_element, Axis_group_item); void -Horizontal_group_item::OK() const -{ - for (int i=0; i < elem_l_arr_.size(); i++) { - Item * it_l = elem_l_arr_[i]->item(); - - assert(it_l&& it_l->pcol_l_ == pcol_l_ ); - } -} - -void -Horizontal_group_item::do_breakable_col_processing() -{ - if (!pcol_l_->breakable_b()) - return; - OK(); - copy_breakable_items(); - - Link_array elems = elem_l_arr_; - - for (int i=0; i < elems.size(); i++) { - Item* it_l = elems[i]->item(); - for ( int j=0; j < 2; j++) { - Item *new_l = it_l->find_prebroken_piece(broken_to_a_[j]->pcol_l_); - ((Horizontal_group_item*)broken_to_a_[j])->add_element( new_l ); - } - } +Horizontal_group_item::do_print() const +{ + Axis_group_item::do_print(); } diff --git a/lily/include/axis-group-item.hh b/lily/include/axis-group-item.hh new file mode 100644 index 0000000000..a461f52c25 --- /dev/null +++ b/lily/include/axis-group-item.hh @@ -0,0 +1,30 @@ +/* + axis-item.hh -- declare Axis_group_item + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef AXIS_ITEM_HH +#define AXIS_ITEM_HH + +#include "axis-group.hh" +#include "item.hh" + +/** + A grouping item. Its special support is in do_breakable_col_processing(). + */ + +class Axis_group_item : public virtual Axis_group_element, public Item { +protected: + virtual void do_breakable_col_processing(); + void OK()const; + virtual void do_print() const; +public: + DECLARE_MY_RUNTIME_TYPEINFO; + +}; + +#endif // AXIS_ITEM_HH diff --git a/lily/include/bar.hh b/lily/include/bar.hh index 9a7a8b92b6..c03527e6cc 100644 --- a/lily/include/bar.hh +++ b/lily/include/bar.hh @@ -8,6 +8,8 @@ #define BAR_HH #include "item.hh" /** + A vertical bar. + TODO: connections with pre and postbreak */ class Bar:public Item { diff --git a/lily/include/elem-group-item.hh b/lily/include/elem-group-item.hh index bf532c035d..b1248cc990 100644 --- a/lily/include/elem-group-item.hh +++ b/lily/include/elem-group-item.hh @@ -10,15 +10,25 @@ #ifndef ELEM_GROUP_ITEM_HH #define ELEM_GROUP_ITEM_HH +#include "axis-group-item.hh" #include "elem-group.hh" -#include "item.hh" -class Horizontal_vertical_group_item : public Item, public Horizontal_vertical_group { + +/** + Treat a collection of items as a unity + */ +class Horizontal_vertical_group_item : public Axis_group_item, public Horizontal_vertical_group_element { +protected: + virtual void do_print() const; + virtual void remove_all() { Horizontal_vertical_group_element::remove_all(); } public: + virtual void add_element(Score_elem*e) { Horizontal_vertical_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Horizontal_vertical_group_element::remove_element(e); } + DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_vertical_group_item); -protected: - virtual void do_print() const; + + }; #endif // ELEM_GROUP_ITEM_HH diff --git a/lily/include/horizontal-group-item.hh b/lily/include/horizontal-group-item.hh index 3495af9f97..f1fc8b3c9c 100644 --- a/lily/include/horizontal-group-item.hh +++ b/lily/include/horizontal-group-item.hh @@ -11,15 +11,19 @@ #define HORIZONTAL_GROUP_ITEM_HH #include "elem-group.hh" -#include "item.hh" +#include "axis-group-item.hh" -class Horizontal_group_item : public Item, public Horizontal_group { +class Horizontal_group_item : public Axis_group_item, public Horizontal_group_element { +protected: + virtual void remove_all() { Horizontal_group_element::remove_all(); } + virtual void do_print() const; +public: + virtual void add_element(Score_elem*e) { Horizontal_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Horizontal_group_element::remove_element(e); } DECLARE_MY_RUNTIME_TYPEINFO; SCORE_ELEM_CLONE(Horizontal_group_item); -protected: - virtual void do_breakable_col_processing(); - void OK()const; - virtual void do_print() const { Elbement_group::do_print(); } + + }; #endif // HORIZONTAL_GROUP_ITEM_HH diff --git a/lily/include/spanner-elem-group.hh b/lily/include/spanner-elem-group.hh index 821c762cf0..2f65af207b 100644 --- a/lily/include/spanner-elem-group.hh +++ b/lily/include/spanner-elem-group.hh @@ -13,7 +13,7 @@ #include "spanner.hh" #include "elem-group.hh" -class Spanner_elem_group : public Spanner, public Horizontal_vertical_group { +class Spanner_elem_group : public Spanner, public Horizontal_vertical_group_element { protected: virtual Interval do_width()const; diff --git a/lily/include/vertical-group-spanner.hh b/lily/include/vertical-group-spanner.hh index d092d96488..ab90bdb6b6 100644 --- a/lily/include/vertical-group-spanner.hh +++ b/lily/include/vertical-group-spanner.hh @@ -10,26 +10,21 @@ #ifndef SPAN_VERTICAL_GROUP_HH #define SPAN_VERTICAL_GROUP_HH -#include "spanner.hh" +#include "axis-group-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 +/** An element which groups a line. + */ +class Vertical_group_spanner : public Axis_group_spanner, public Vertical_group_element { 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&); - + SCORE_ELEM_CLONE(Vertical_group_spanner); + virtual void remove_all() { Vertical_group_element::remove_all(); } public: - Vertical_group_spanner(); DECLARE_MY_RUNTIME_TYPEINFO; + virtual void add_element(Score_elem*e) { Vertical_group_element::add_element(e); } + virtual void remove_element(Score_elem*e) { Vertical_group_element::remove_element(e); } + }; #endif // SPAN_VERTICAL_GROUP_HH diff --git a/lily/spanner-elem-group.cc b/lily/spanner-elem-group.cc index 8e2c98bf19..d463c2889d 100644 --- a/lily/spanner-elem-group.cc +++ b/lily/spanner-elem-group.cc @@ -11,7 +11,7 @@ -IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group); +IMPLEMENT_IS_TYPE_B2(Spanner_elem_group,Spanner,Horizontal_vertical_group_element); Interval Spanner_elem_group::do_width() const @@ -24,7 +24,7 @@ Spanner_elem_group::do_print() const { #ifndef NPRINT Spanner::do_print(); - Horizontal_vertical_group::do_print(); + Horizontal_vertical_group_element::do_print(); #endif } diff --git a/lily/vertical-align-grav.cc b/lily/vertical-align-grav.cc index c6690f6ef1..1ab374c1d8 100644 --- a/lily/vertical-align-grav.cc +++ b/lily/vertical-align-grav.cc @@ -35,8 +35,8 @@ void Vertical_align_engraver::acknowledge_element(Score_elem_info i) { if ( i.origin_grav_l_arr_.size() == 2 && - i.elem_l_->is_type_b(Vertical_group::static_name()) && - !i.elem_l_->y_group_l_ ) { + i.elem_l_->is_type_b(Vertical_group_element::static_name()) && + !i.elem_l_->axis_group_l_a_[Y_AXIS] ) { assert( !valign_p_->contains_b( i.elem_l_) ); valign_p_->add ( i.elem_l_ ); diff --git a/lily/vertical-group-spanner.cc b/lily/vertical-group-spanner.cc index d858349ca5..2e11db7420 100644 --- a/lily/vertical-group-spanner.cc +++ b/lily/vertical-group-spanner.cc @@ -10,95 +10,4 @@ #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) -{ -} +IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Axis_group_spanner, Vertical_group_element);