1 #include "idealspacing.hh"
5 #include "paper-def.hh"
8 #include "scoreline.hh"
10 #include "tex-stream.hh"
15 PScore::get_spacing(PCol*l, PCol*r)
19 Idealspacing*i_p =new Idealspacing(l,r);
20 suz.bottom().add(i_p);
30 for (iter_top(cols,c); c.ok(); )
34 c->set_rank(rank_i++);
42 PScore::add(PStaff *s)
44 assert(s->pscore_l_ == this);
45 staffs.bottom().add(s);
50 PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
54 Idealspacing*s_l=get_spacing(c1,c2);
62 PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
64 do_connect(c1,c2,d,h);
65 do_connect(c1->postbreak_p_, c2,d,h);
66 do_connect(c1, c2->prebreak_p_,d,h);
67 do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
71 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
76 typeset_item(i, c->prebreak_p_, s);
81 typeset_item(i, c->postbreak_p_, s);
90 /* first do this, because i->width() may follow the 0-pointer */
95 PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
97 span_p->pstaff_l_ = ps;
98 spanners.bottom().add(span_p);
99 ps->spans.bottom().add(span_p);
101 // do not init start/stop fields. These are for broken spans only.
102 span_p->add_processing();
110 if (p->breakable_b()){
111 p->prebreak_p_->pscore_l_ = this;
112 p->postbreak_p_->pscore_l_ = this;
114 cols.bottom().add(p);
117 PScore::PScore( Paper_def*p)
123 PScore::output(Tex_stream &ts)
127 ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
128 for (iter_top(lines,lic); lic.ok(); lic++) {
129 ts << "% line of score no. " << l++ <<"\n";
130 ts << lic->TeXstring();
132 ts << "\\interscoreline\n";
138 PScore::select_items(PStaff*ps, PCol*pc)
142 for (iter_top(pc->its,i); i.ok(); i++){
143 if (i->pstaff_l_ == ps)
144 ret.push((Item*)(Item const *)i);
153 for (iter_top(cols,cc); cc.ok(); cc++)
155 for (iter_top(suz,i); i.ok(); i++)
161 PScore::print() const
166 mtor << "\ncolumns: ";
167 for (iter_top(cols,cc); cc.ok(); cc++)
170 mtor << "\nideals: ";
171 for (iter_top(suz,i); i.ok(); i++)
180 for (iter_top(spanners,i); i.ok(); i++) {
183 for (iter_top(its,i); i.ok(); i++){
189 PScore::postprocess()
191 for (iter_top(broken_spans,i); i.ok(); i++) { // could chase spans as well.
192 i->post_processing();
194 for (iter_top(its,i); i.ok(); i++){
195 i->post_processing();
198 for (iter_top(broken_spans,i); i.ok(); i++) {
199 i->molecule_processing();
201 for (iter_top(its,i); i.ok(); i++){
202 i->molecule_processing();
205 for (iter_top(lines,i); i.ok(); i++)
211 PScore::find_col(PCol const *c)const
213 PCol const *what = c;
215 what = what->daddy_l_;
217 return cols.find((PCol*)what);
221 PScore::add_broken(Spanner*s)
223 assert(s->left_col_l_->line_l_ == s->right_col_l_->line_l_);
224 broken_spans.bottom().add(s);
225 s->left_col_l_->starters.bottom().add (s);
226 s->right_col_l_->stoppers.bottom().add (s);
230 PScore::set_breaking(Array<Col_hpositions> breaking)
232 for (int j=0; j < breaking.size(); j++) {
233 Array<PCol*> &curline(breaking[j].cols);
234 Array<Real> &config(breaking[j].config);
236 Line_of_score *s_p = new Line_of_score(curline,this);
237 lines.bottom().add(s_p);
238 for (int i=0; i < curline.size(); i++){
239 curline[i]->hpos = config[i];
245 PScore::calc_breaking()
248 set_breaking(w.solve());
256 *mlog << "Preprocessing ... " <<flush;
258 *mlog << "\nCalculating column positions ... " <<flush;
260 *mlog << "\nPostprocessing ..." << endl;