From 717fc3946992cd2c0fc92fe2377da017b5f52ef2 Mon Sep 17 00:00:00 2001 From: fred Date: Sun, 24 Mar 2002 19:48:20 +0000 Subject: [PATCH] lilypond-0.0.76 --- lily/include/col-info.hh | 36 +++++++++++++++ lily/p-score.cc | 97 +++++++++++++--------------------------- 2 files changed, 66 insertions(+), 67 deletions(-) create mode 100644 lily/include/col-info.hh diff --git a/lily/include/col-info.hh b/lily/include/col-info.hh new file mode 100644 index 0000000000..985df3b69d --- /dev/null +++ b/lily/include/col-info.hh @@ -0,0 +1,36 @@ +/* + col-info.hh -- declare + + source file of the GNU LilyPond music typesetter + + (c) 1997 Han-Wen Nienhuys +*/ + + +#ifndef COL_INFO_HH +#define COL_INFO_HH + +#include "lily-proto.hh" +#include "pointer.hh" +#include "interval.hh" + +/// helper struct for #Spacing_problem# +struct Colinfo { + PCol *pcol_l_; + P fixpos_p_; + Interval width; + int rank_i_; + /// did some tricks to make this column come out. + bool ugh_b_; + /* *************** */ + Colinfo(); + Colinfo(PCol *,Real const *); + + void print() const; + bool fixed() const { return fixpos_p_.get_C();} + Real fixed_position()const { return *fixpos_p_; } + Real minright() const { return width.right; } + Real minleft() const { return -width.left; } +}; + +#endif // COL_INFO_HH diff --git a/lily/p-score.cc b/lily/p-score.cc index 92e8d4e871..0e093c9693 100644 --- a/lily/p-score.cc +++ b/lily/p-score.cc @@ -7,7 +7,6 @@ */ #include "super-elem.hh" -#include "idealspacing.hh" #include "debug.hh" #include "lookup.hh" #include "spanner.hh" @@ -15,9 +14,21 @@ #include "scoreline.hh" #include "p-score.hh" #include "tex-stream.hh" -#include "break.hh" +#include "word-wrap.hh" #include "p-col.hh" +PScore::PScore(Paper_def*p) +{ + paper_l_ = p; + super_elem_l_ = new Super_elem; + typeset_element(super_elem_l_); +} + +PScore::~PScore() +{ + super_elem_l_->unlink_all(); +} + void PScore::typeset_element(Score_elem * elem_p) { @@ -60,10 +71,10 @@ PScore::typeset_broken_spanner(Spanner*span_p) void PScore::typeset_unbroken_spanner(Spanner*span_p) { - spanners.bottom().add(span_p); + span_p_list_.bottom().add(span_p); span_p->pscore_l_=this; - if ( span_p->left_col_l_) + if (span_p->left_col_l_) span_p->left_col_l_->used_b_ = true; if ( span_p->right_col_l_) span_p->right_col_l_->used_b_ = true; @@ -72,23 +83,12 @@ PScore::typeset_unbroken_spanner(Spanner*span_p) span_p->add_processing(); } -Idealspacing* -PScore::get_spacing(PCol*l, PCol*r) -{ - assert(l!=r); - - Idealspacing*i_p =new Idealspacing(l,r); - suz.bottom().add(i_p); - - return i_p; -} - void PScore::clean_cols() { int rank_i = 0; - for (iter_top(cols,c); c.ok(); ) + for (iter_top(col_p_list_,c); c.ok(); ) if (!c->used_b()) { delete c.remove_p(); } else { @@ -97,27 +97,6 @@ PScore::clean_cols() } } -void -PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h) -{ - if (!c1 || !c2 ) - return; - Idealspacing*s_l=get_spacing(c1,c2); - - - s_l->hooke = h; - s_l->space =d; -} - -void -PScore::connect(PCol* c1, PCol *c2, Real d, Real h) -{ - do_connect(c1,c2,d,h); - do_connect(c1->postbreak_p_, c2,d,h); - do_connect(c1, c2->prebreak_p_,d,h); - do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h); -} - void PScore::add(PCol *p) { @@ -126,14 +105,7 @@ PScore::add(PCol *p) p->prebreak_p_->pscore_l_ = this; p->postbreak_p_->pscore_l_ = this; } - cols.bottom().add(p); -} - -PScore::PScore(Paper_def*p) -{ - paper_l_ = p; - super_elem_l_ = new Super_elem; - typeset_element(super_elem_l_); + col_p_list_.bottom().add(p); } void @@ -145,19 +117,12 @@ PScore::output(Tex_stream &ts) } -PScore::~PScore() -{ - super_elem_l_->unlink_all(); -} - void PScore::OK()const { #ifndef NDEBUG - for (iter_top(cols,cc); cc.ok(); cc++) + for (iter_top(col_p_list_,cc); cc.ok(); cc++) cc->OK(); - for (iter_top(suz,i); i.ok(); i++) - i->OK(); #endif } @@ -171,15 +136,12 @@ PScore::print() const for (iter_top(elem_p_list_,cc); cc.ok(); cc++) cc->print(); mtor << "\n unbroken spanners: "; - for (iter(spanners.top(), i); i.ok(); i++) + for (iter(span_p_list_.top(), i); i.ok(); i++) i->print(); mtor << "\ncolumns: "; - for (iter_top(cols,cc); cc.ok(); cc++) + for (iter_top(col_p_list_,cc); cc.ok(); cc++) cc->print(); - mtor << "\nideals: "; - for (iter_top(suz,i); i.ok(); i++) - i->print(); mtor << "}\n"; #endif } @@ -205,7 +167,7 @@ PScore::find_col(PCol const *c)const if (what->daddy_l_ ) what = what->daddy_l_; - return cols.find((PCol*)what); + return col_p_list_.find((PCol*)what); } @@ -216,7 +178,7 @@ PScore::set_breaking(Array const &breaking) super_elem_l_->break_processing(); - for (iter(spanners.top(),i); i.ok(); ) { + for (iter(span_p_list_.top(),i); i.ok(); ) { Spanner *span_p = i.remove_p(); if (span_p->broken_b()) { span_p->unlink(); @@ -234,7 +196,7 @@ PScore::set_breaking(Array const &breaking) i++; } - for (iter_top(cols, i); i.ok(); i++) + for (iter_top(col_p_list_, i); i.ok(); i++) i->clean_breakable_items(); } @@ -242,6 +204,7 @@ void PScore::calc_breaking() { Word_wrap w(*this); + set_breaking(w.solve()); } @@ -264,8 +227,8 @@ PScore::breakable_col_range(PCol*l,PCol*r)const { Link_array ret; - PCursor start(l ? find_col(l)+1 : cols.top() ); - PCursor stop(r ? find_col(r) : cols.bottom()); + PCursor start(l ? find_col(l)+1 : col_p_list_.top() ); + PCursor stop(r ? find_col(r) : col_p_list_.bottom()); /* ugh! windows-suck-suck-suck. @@ -283,8 +246,8 @@ PScore::col_range(PCol*l,PCol*r)const { Link_array ret; - PCursor start(l ? find_col(l)+1 : cols.top() ); - PCursor stop(r ? find_col(r) : cols.bottom()); + PCursor start(l ? find_col(l)+1 : col_p_list_.top() ); + PCursor stop(r ? find_col(r) : col_p_list_.bottom()); ret.push(l); /* @@ -301,8 +264,8 @@ PScore::broken_col_range(PCol*l,PCol*r)const { Link_array ret; - PCursor start(l ? find_col(l)+1 : cols.top() ); - PCursor stop(r ? find_col(r) : cols.bottom()); + PCursor start(l ? find_col(l)+1 : col_p_list_.top() ); + PCursor stop(r ? find_col(r) : col_p_list_.bottom()); /* ugh! windows-suck-suck-suck. -- 2.39.5