+/*
+ p-col.cc -- implement PCol
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "p-col.hh"
#include "p-score.hh"
-#include "p-staff.hh"
+
#include "debug.hh"
Interval
for (iter_top(its,i); i.ok(); i++)
w.unite(i->width());
- if (w.empty())
+ if (w.empty_b())
w.unite(Interval(0,0));
return w;
}
+void
+PCol::clean_breakable_items()
+{
+ if (!line_l_) {
+ its.junk_links();
+ }
+ if (prebreak_p_)
+ prebreak_p_->clean_breakable_items();
+ if (postbreak_p_)
+ postbreak_p_->clean_breakable_items();
+}
+
int
-PCol::rank() const
+PCol::rank_i() const
{
-#if 0
- if(!pscore_l_)
- return -1;
- PCursor<PCol*> me=pscore_l_->find_col( (PCol*)this);
- if (!me.ok())
- return -1;
- PCursor<PCol*> bot(pscore_l_->cols.top());
- return me - bot;
-#endif
- assert(rank_i_ != -1);
return rank_i_;
}
#ifndef NPRINT
mtor << "PCol {";
- if (rank() >= 0)
- mtor << "rank: " << rank_i_ << '\n';
+ mtor << "rank: " << rank_i_ << '\n';
mtor << "# symbols: " << its.size() ;
if (breakable_b()){
int
PCol::compare(PCol const &c1, PCol const &c2)
{
- return c1.rank() - c2.rank();
+ return c1.rank_i() - c2.rank_i();
}
void
if (breakable_b())
return;
- prebreak_p_ = new PCol(this);
- postbreak_p_ = new PCol(this);
+ do_set_breakable();
prebreak_p_->pscore_l_ = pscore_l_;
postbreak_p_->pscore_l_ = pscore_l_;
+
+ prebreak_p_->daddy_l_ = postbreak_p_->daddy_l_ = this;
+}
+void
+PCol::do_set_breakable()
+{
+ prebreak_p_ = new PCol;
+ postbreak_p_ = new PCol;
+}
+
+
+bool
+PCol::breakpoint_b() const
+{
+ return !line_l_;
}
bool
return prebreak_p_||postbreak_p_;
}
-PCol::PCol(PCol *parent)
+PCol::PCol()
{
- daddy_l_ = parent;
+ used_b_ = false;
+ error_mark_b_ = false;
+ daddy_l_ = 0;
prebreak_p_=0;
postbreak_p_=0;
line_l_=0;
- hpos = -1.0;
+ hpos_f_ = -1.0;
pscore_l_ = 0;
+ rank_i_ = -1;
}
PCol::~PCol()
{
delete prebreak_p_;
- delete postbreak_p_;
+ delete postbreak_p_;
}
void
bool
PCol::used_b()const
{
- return breakable_b() || its.size();
+ return daddy_l_ || breakable_b() || its.size()|| used_b_;
}