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);
29 for (iter_top(cols,c); c.ok(); )
38 PScore::add(PStaff *s)
40 assert(s->pscore_l_ == this);
41 staffs.bottom().add(s);
46 PScore::do_connect(PCol *c1, PCol *c2, Real d, Real h)
50 Idealspacing*s_l=get_spacing(c1,c2);
58 PScore::connect(PCol* c1, PCol *c2, Real d, Real h)
60 do_connect(c1,c2,d,h);
61 do_connect(c1->postbreak_p_, c2,d,h);
62 do_connect(c1, c2->prebreak_p_,d,h);
63 do_connect(c1->postbreak_p_, c2->prebreak_p_,d,h);
67 PScore::typeset_item(Item *i, PCol *c, PStaff *s, int breakstat)
72 typeset_item(i, c->prebreak_p_, s);
77 typeset_item(i, c->postbreak_p_, s);
86 /* first do this, because i->width() may follow the 0-pointer */
91 PScore::typeset_spanner(Spanner*span_p, PStaff*ps)
93 span_p->pstaff_l_ = ps;
94 spanners.bottom().add(span_p);
95 ps->spans.bottom().add(span_p);
97 // do not init start/stop fields. These are for broken spans only.
98 span_p->add_processing();
106 if (p->breakable_b()){
107 p->prebreak_p_->pscore_l_ = this;
108 p->postbreak_p_->pscore_l_ = this;
110 cols.bottom().add(p);
113 PScore::PScore( Paper_def*p)
119 PScore::output(Tex_stream &ts)
123 ts << "\n "<< paper_l_->lookup_l()->texsetting << "%(Tex id)\n";
124 for (iter_top(lines,lic); lic.ok(); lic++) {
125 ts << "% line of score no. " << l++ <<"\n";
126 ts << lic->TeXstring();
128 ts << "\\interscoreline\n";
134 PScore::select_items(PStaff*ps, PCol*pc)
138 for (iter_top(pc->its,i); i.ok(); i++){
139 if (i->pstaff_l_ == ps)
140 ret.push((Item*)(const Item*)i);
149 for (iter_top(cols,cc); cc.ok(); cc++)
151 for (iter_top(suz,i); i.ok(); i++)
157 PScore::print() const
162 mtor << "\ncolumns: ";
163 for (iter_top(cols,cc); cc.ok(); cc++)
166 mtor << "\nideals: ";
167 for (iter_top(suz,i); i.ok(); i++)
176 for (iter_top(spanners,i); i.ok(); i++) {
179 for (iter_top(its,i); i.ok(); i++){
185 PScore::postprocess()
187 for (iter_top(broken_spans,i); i.ok(); i++) { // could chase spans as well.
188 i->post_processing();
190 for (iter_top(its,i); i.ok(); i++){
191 i->post_processing();
194 for (iter_top(broken_spans,i); i.ok(); i++) {
195 i->molecule_processing();
197 for (iter_top(its,i); i.ok(); i++){
198 i->molecule_processing();
201 for (iter_top(lines,i); i.ok(); i++)
207 PScore::find_col(const PCol *c)const
211 what = what->daddy_l_;
213 return cols.find((PCol*)what);
217 PScore::add_broken(Spanner*s)
219 assert(s->left->line_l_ == s->right->line_l_);
220 broken_spans.bottom().add(s);
221 s->left->starters.bottom().add (s);
222 s->right->stoppers.bottom().add (s);
226 PScore::set_breaking(Array<Col_hpositions> breaking)
228 for (int j=0; j < breaking.size(); j++) {
229 Array<PCol*> &curline(breaking[j].cols);
230 Array<Real> &config(breaking[j].config);
232 Line_of_score *s_p = new Line_of_score(curline,this);
233 lines.bottom().add(s_p);
234 for (int i=0; i < curline.size(); i++){
235 curline[i]->hpos = config[i];
241 PScore::calc_breaking()
244 set_breaking(w.solve());
251 *mlog << "Preprocessing ... " <<flush;
253 *mlog << "\nCalculating column positions ... " <<flush;
255 *mlog << "\nPostprocessing ..." << endl;