From 5d5ac0b2a1d721b5b5c0f2a99ec8945ab77adf3e Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 20:12:50 +0000 Subject: [PATCH] lilypond-1.0.1 --- lily/axis-group-item.cc | 12 ++-- lily/axis-group-spanner.cc | 39 ++++++++---- lily/bar.cc | 26 ++++---- lily/grouping.cc | 2 +- lily/horizontal-align-item.cc | 116 +++------------------------------- lily/p-col.cc | 6 +- 6 files changed, 58 insertions(+), 143 deletions(-) diff --git a/lily/axis-group-item.cc b/lily/axis-group-item.cc index 2706fa8faa..33dfdceba9 100644 --- a/lily/axis-group-item.cc +++ b/lily/axis-group-item.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "axis-group-item.hh" #include "p-col.hh" @@ -13,10 +13,10 @@ IMPLEMENT_IS_TYPE_B2(Axis_group_item, Axis_group_element, Item); void Axis_group_item::OK() const { - Link_array elems = elem_l_arr (); + Link_array elems = elem_l_arr (); for (int i=0; i < elems.size(); i++) { - Item * it_l = elems[i]->item(); + Item * it_l = elems[i]->access_Item (); assert (it_l); } } @@ -31,15 +31,15 @@ Axis_group_item::do_breakable_col_processing() copy_breakable_items(); - Link_array elems = elem_l_arr (); + Link_array elems = elem_l_arr (); for (int i=0; i < elems.size(); i++) { - Item* it_l = elems[i]->item(); + Item* it_l = elems[i]->access_Item (); Direction j=LEFT; do { Item *new_l = - it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_i_); + it_l->find_prebroken_piece (broken_to_drul_[j]->break_status_dir_); ((Axis_group_item*)broken_to_drul_[j])->add_element (new_l); } while (flip(&j)!=LEFT); diff --git a/lily/axis-group-spanner.cc b/lily/axis-group-spanner.cc index 344b4060cc..64a28da895 100644 --- a/lily/axis-group-spanner.cc +++ b/lily/axis-group-spanner.cc @@ -3,10 +3,11 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "axis-group-spanner.hh" +#include "debug.hh" #include "item.hh" #include "p-col.hh" @@ -17,16 +18,16 @@ void Axis_group_spanner::do_break_processing_if_unbroken() { - Link_array elems = elem_l_arr (); + Link_array elems = elem_l_arr (); Line_of_score *my_line = line_l(); for (int i=0; i < elems.size(); i++) { if (!elems[i]->line_l()) { - Item * item_l = elems[i]->item(); + Item * item_l = elems[i]->access_Item (); if (item_l && item_l->breakable_b_ - && item_l->break_status_i() == 0) + && item_l->break_status_dir() == 0) { // last two checks are paranoia Item * broken_item_l = @@ -37,9 +38,11 @@ Axis_group_spanner::do_break_processing_if_unbroken() } } } + void Axis_group_spanner::do_break_processing() { + DOUT << "do_break_processing ()\n"; bool breaking_self_b = ! Spanner::line_l(); if (!breaking_self_b) { @@ -49,12 +52,12 @@ Axis_group_spanner::do_break_processing() } break_into_pieces (); - Link_array loose_elems = elem_l_arr (); + Link_array loose_elems = elem_l_arr (); remove_all(); for (int i=0; i < loose_elems.size(); i++) { - Score_elem * elt = loose_elems[i]; + Score_element * elt = loose_elems[i]; Line_of_score *elt_line = elt->line_l(); if (! elt_line) @@ -62,9 +65,9 @@ Axis_group_spanner::do_break_processing() /* this piece doesn't know where it belongs. Find out if it was broken, and use the broken remains */ - if (elt->spanner()) + if (elt->access_Spanner ()) { - Spanner * sp = elt->spanner(); + Spanner * sp = elt->access_Spanner (); for (int j =0; j < broken_into_l_arr_.size(); j++) { @@ -73,22 +76,22 @@ Axis_group_spanner::do_break_processing() Spanner * broken_span_l = sp->find_broken_piece ( - ((Score_elem*)my_broken_l)->line_l()); + ((Score_element*)my_broken_l)->line_l()); if (broken_span_l) my_broken_l->add_element (broken_span_l); } } - else if (elt->item() - && elt->item()->breakable_b_ - && elt->item()->break_status_i () == 0) + else if (elt->access_Item () + && elt->access_Item ()->breakable_b_ + && elt->access_Item ()->break_status_dir () == 0) { // broken items Direction j=LEFT; do { - Item * my_item = elt->item()->broken_to_drul_[j]; + Item * my_item = elt->access_Item ()->broken_to_drul_[j]; Line_of_score * item_line_l = my_item->line_l() ; if (! item_line_l) continue; @@ -97,6 +100,14 @@ Axis_group_spanner::do_break_processing() = (Axis_group_spanner*)find_broken_piece (item_line_l); if (v) v->add_element (my_item); + else + { + my_item->transparent_b_ = true; + my_item->set_empty (true); + /*my_item->unlink (); + delete my_item;*/ + } + } while (flip(&j) != LEFT); } @@ -119,6 +130,8 @@ void Axis_group_spanner::do_print() const { Axis_group_element::do_print(); + + Spanner::do_print (); } diff --git a/lily/bar.cc b/lily/bar.cc index 701bbd7b86..32120fa1bf 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "bar.hh" @@ -13,18 +13,16 @@ #include "lookup.hh" #include "debug.hh" -Bar::Bar() +IMPLEMENT_IS_TYPE_B1 (Bar,Item); + +Bar::Bar () { breakable_b_ = true; type_str_ = "|"; } - - -IMPLEMENT_IS_TYPE_B1(Bar,Item); - void -Bar::do_print() const +Bar::do_print () const { #ifndef NPRINT DOUT << type_str_; @@ -32,11 +30,10 @@ Bar::do_print() const } Molecule* -Bar::brew_molecule_p() const +Bar::brew_molecule_p () const { - Paper_def *p = paper(); - Atom s = p->lookup_l()->bar (type_str_, - p->get_var ("barsize")); + Paper_def *p = paper (); + Atom s = lookup_l ()->bar (type_str_, p->get_var ("barsize")); Molecule*output = new Molecule (Atom (s)); return output; @@ -51,19 +48,20 @@ static char const *bar_breaks[][3] ={ {"|", "|", ""}, {"", "|s", "|"}, {"", "|:", "|:"}, - {"||.", "||.", ""}, + {"|.", "|.", ""}, {":|", ":|", ""}, {"||", "||", ""}, + {".|.", ".|.", ""}, {0,0,0} }; void -Bar::do_pre_processing() +Bar::do_pre_processing () { for (int i=0; bar_breaks[i][0]; i++) { if (bar_breaks[i][1] == type_str_) - type_str_ = bar_breaks[i][break_status_i()+1]; + type_str_ = bar_breaks[i][break_status_dir ()+1]; } /* diff --git a/lily/grouping.cc b/lily/grouping.cc index 2bdaed7db1..af7d234bf4 100644 --- a/lily/grouping.cc +++ b/lily/grouping.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "debug.hh" diff --git a/lily/horizontal-align-item.cc b/lily/horizontal-align-item.cc index 82a81c2300..a22f30eb5e 100644 --- a/lily/horizontal-align-item.cc +++ b/lily/horizontal-align-item.cc @@ -3,112 +3,18 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "horizontal-align-item.hh" #include "debug.hh" -IMPLEMENT_IS_TYPE_B1(Horizontal_align_item,Item); - -bool -Horizontal_align_item::contains_b (Item *i) const -{ - return item_l_arr_.find_l (i); -} - -void -Horizontal_align_item::add (Item *i,int p) -{ - assert (! contains_b (i)); - priority_i_arr_.push (p); - item_l_arr_.push (i); - add_dependency (i); -} - -void -Horizontal_align_item::do_substitute_dependency (Score_elem*o,Score_elem*n) -{ - int i; - while ((i = item_l_arr_.find_i (o->item())) >=0) - { - if (n) - item_l_arr_[i] = n->item(); - else - item_l_arr_.del (i); - } -} - -struct Horizontal_align_item_content { - Item * item_l_; - int priority_i_; - static int compare (Horizontal_align_item_content const &h1, - Horizontal_align_item_content const &h2) - { - return h1.priority_i_ - h2.priority_i_; - } - Horizontal_align_item_content (Item*i, int p) - { - priority_i_ = p; - item_l_ = i; - } - Horizontal_align_item_content(){item_l_ =0; priority_i_ =0; } -}; - +IMPLEMENT_IS_TYPE_B2(Horizontal_align_item,Align_element,Item); void -Horizontal_align_item::do_pre_processing() +Horizontal_align_item::add_item (Item *i,int p) { - { - Array content; - for (int i =0; i < item_l_arr_.size(); i++) - content.push ( - Horizontal_align_item_content ( - item_l_arr_[i], priority_i_arr_[i])); - content.sort (Horizontal_align_item_content::compare); - item_l_arr_.clear(); - priority_i_arr_.clear(); - for (int i =0; i < content.size(); i++) - { - item_l_arr_.push (content[i].item_l_); - priority_i_arr_.push (content[i].priority_i_); - } - } - - Array dims; - Real total =0; - for (int i =0; i < item_l_arr_.size(); i++) - { - - Interval item_width= item_l_arr_[i]->width(); - if (item_width.empty_b()) - { - item_width = Interval (0,0); - } - dims.push (item_width); - total += item_width.length(); - } - - Real where_f= total * (align_i_-1.0)/2.0; - Real center_dx_f = 0; - for (int i=0 ; i < item_l_arr_.size(); i++) - { - Real dx = where_f -dims[i][-1]; - item_l_arr_[i]->translate_axis (dx , X_AXIS); - if (item_l_arr_[i] == center_l_) - center_dx_f = where_f; - where_f += dims[i].length(); - } - if (center_dx_f && !align_i_) - for (int i=0 ; i < item_l_arr_.size(); i++) - item_l_arr_[i]->translate_axis (- center_dx_f , X_AXIS); - -} - -Interval -Horizontal_align_item::do_width() const -{ - return Interval (0,0); + add_element_priority (i,p); } void @@ -116,16 +22,14 @@ Horizontal_align_item::do_print() const { #ifndef NPRINT Item::do_print (); - DOUT << "contains: "; - for (int i=0 ; i < item_l_arr_.size(); i++) - DOUT << item_l_arr_[i]->name () << ", "; + Align_element::do_print (); #endif } -Horizontal_align_item::Horizontal_align_item() + +Horizontal_align_item::Horizontal_align_item () { - center_l_ = 0; - align_i_ = 0; - set_empty (true); - transparent_b_ = true; + align_dir_ = CENTER; + stacking_dir_ = RIGHT; + axis_ = X_AXIS; } diff --git a/lily/p-col.cc b/lily/p-col.cc index e776b62c92..74ea11e5ea 100644 --- a/lily/p-col.cc +++ b/lily/p-col.cc @@ -3,7 +3,7 @@ source file of the GNU LilyPond music typesetter - (c) 1997--1998 Han-Wen Nienhuys + (c) 1997--1998 Han-Wen Nienhuys */ #include "p-col.hh" @@ -63,9 +63,9 @@ Paper_column::do_print() const DOUT << "post: "; postbreak_l()->print(); } - if (break_status_i_) + if (break_status_dir_) { - DOUT <<'\n' << ((break_status_i_ == LEFT) ? "prebreak" : "postbreak"); + DOUT << '\n' << ((break_status_dir_ == LEFT) ? "prebreak" : "postbreak"); DOUT << '\n'; } -- 2.39.5