1 #include "scommands.hh"
11 Score::set(Paperdef*p)
17 Score::output(String s)
20 if (paper_->outfile=="")
23 *mlog << "output to " << paper_->outfile << "...\n";
24 Tex_stream the_output(paper_->outfile);
25 pscore_->output(the_output);
32 *mlog << "Processing ...";
33 set(commands_->parse(last()));
37 paper_ = new Paperdef;
39 commands_->clean(last());
41 /// distribute commands to disciples
42 distribute_commands();
44 pscore_ = new PScore(paper_);
45 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
46 sc->set_output(pscore_);
50 // do this after processing, staffs first have to generate PCols.
56 *mlog << "Calculating ... ";
57 pscore_->calc_breaking();
58 // TODO: calculate vertical structs
59 // TODO: calculate mixed structs.
63 // remove empty cols with no spacing attached.
64 /* should rethink ownership of cols
69 for (PCursor<Staff * > sc(staffs_); sc.ok(); sc++)
72 for (PCursor<Score_column*> c(cols_); c.ok(); ) {
74 mtor << "removing : ";
81 pscore_->clean_cols();
83 /* this sux. We should have Score_column create the appropriate PCol.
84 Unfortunately, PCols don't know about their position.
87 PCursor<Score_column*>
88 Score::create_cols(Real w)
90 Score_column* c1 = new Score_column(w);
91 Score_column* c2 = new Score_column(w);
96 PCursor<Score_column*> scc(cols_);
98 for (; scc.ok(); scc++) {
99 assert(scc->when != w);
105 cols_.bottom().add(c1);
106 cols_.bottom().add(c2);
107 scc = cols_.bottom();
118 Score::find_col(Real w,bool mus)
120 PCursor<Score_column*> scc(cols_);
121 for (; scc.ok(); scc++) {
122 if (scc->when == w && scc->musical == mus)
127 scc = create_cols(w);
134 Score::distribute_commands(void)
136 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
137 sc->add_commands(*commands_);
144 staffs_.bottom().add(s);
151 PCursor<Score_column*> sc(cols_);
152 for (; sc.ok(); sc++) {
153 pscore_->add(sc->pcol);
160 for (PCursor<Staff*> stc(staffs_); stc.ok(); stc++) {
161 l = MAX(l, stc->last());
170 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
172 assert(sc->score_ == this);
176 for (PCursor<Score_column*> cc(cols_); cc.ok() && (cc+1).ok(); cc++) {
177 assert(cc->when <= (cc+1)->when);
189 for (PCursor<Staff*> sc(staffs_); sc.ok(); sc++) {
192 for (PCursor<Score_column*> sc(cols_); sc.ok(); sc++) {
204 commands_ = new Score_commands;
215 Score::set(Score_commands*c)