*/
#include "super-elem.hh"
-#include "idealspacing.hh"
#include "debug.hh"
#include "lookup.hh"
#include "spanner.hh"
#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)
{
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;
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 {
}
}
-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)
{
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
}
-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
}
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
}
if (what->daddy_l_ )
what = what->daddy_l_;
- return cols.find((PCol*)what);
+ return col_p_list_.find((PCol*)what);
}
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();
i++;
}
- for (iter_top(cols, i); i.ok(); i++)
+ for (iter_top(col_p_list_, i); i.ok(); i++)
i->clean_breakable_items();
}
PScore::calc_breaking()
{
Word_wrap w(*this);
+
set_breaking(w.solve());
}
{
Link_array<PCol> ret;
- PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
- PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+ PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+ PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
/*
ugh! windows-suck-suck-suck.
{
Link_array<PCol> ret;
- PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
- PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+ PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+ PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
ret.push(l);
/*
{
Link_array<PCol> ret;
- PCursor<PCol*> start(l ? find_col(l)+1 : cols.top() );
- PCursor<PCol*> stop(r ? find_col(r) : cols.bottom());
+ PCursor<PCol*> start(l ? find_col(l)+1 : col_p_list_.top() );
+ PCursor<PCol*> stop(r ? find_col(r) : col_p_list_.bottom());
/*
ugh! windows-suck-suck-suck.