10 Score::add_command_seq(svec
<Command
*> com
)
14 Real when
= com
[0]->when
;
16 PCursor
<Command
*> pc(commands_
);
17 while (pc
.ok()&&pc
->when
<= when
)
20 for (int i
= 0; i
< com
.sz(); i
++) {
21 assert(com
[i
]->when
== when
);
31 Score::add(Command
*c
)
34 if (c
->code
== TYPESET
&& c
->args
[0] == "BAR") {
35 /* should be encapsulated in BREAKs
46 seq
.add(new Command(k
));
47 seq
.add(new Command(*c
));
48 k
.code
= BREAK_MIDDLE
;
49 seq
.add(new Command(k
));
50 seq
.add(new Command(*c
));
52 seq
.add(new Command(k
));
54 seq
.add(new Command(k
));
57 seq
.add(new Command(*c
));
66 staffs_
.bottom().add(s
);
73 PCursor
<Score_column
*> sc(cols_
);
74 for (;sc
.ok(); sc
++) {
75 pscore_
->add(sc
->pcol
);
79 this sux. Really makeshift.
81 first and last column should be breakable.
82 Remove any command past the last musical column.
98 PCursor
<Command
*> bot(commands_
.bottom());
100 while (bot
.ok() && bot
->when
> l
) {
102 mtor
<<"removing "<< bot
->code
<<" at " << bot
->when
<<'\n';
104 bot
= commands_
.bottom();
107 if (bot
->when
!= l
|| bot
->code
!= BREAK_END
) {
122 for (PCursor
<Staff
*> stc(staffs_
); stc
.ok(); stc
++) {
123 l
= MAX(l
, stc
->last());
128 Score::clean_commands()
131 for (PCursor
<Command
*> cc(commands_
); cc
.ok(); ) {
133 mtor
<< "remming \n";
144 /// distribute commands to disciples
145 distribute_commands();
147 pscore_
= new PScore
;
148 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
149 sc
->set_output(pscore_
);
153 // do this after processing, staffs first have to generate PCols.
159 pscore_
->calc_breaking();
160 // TODO: calculate vertical structs
161 // TODO: calculate mixed structs.
164 // remove empty cols with no spacing attached.
165 /* should rethink ownership of cols
170 for (PCursor
<Staff
* > sc(staffs_
); sc
.ok(); sc
++)
173 for (PCursor
<Score_column
*> c(cols_
); c
.ok(); ) {
174 if (!c
->pcol
->used
) {
175 mtor
<< "removing : ";
182 pscore_
->clean_cols();
184 /* this sux. We should have Score_column create the appropriate PCol.
185 Unfortunately, PCols don't know about their position.
188 PCursor
<Score_column
*>
189 Score::create_cols(Mtime w
)
191 Score_column
* c1
= new Score_column(w
);
192 Score_column
* c2
= new Score_column(w
);
197 PCursor
<Score_column
*> scc(cols_
);
199 for (; scc
.ok(); scc
++) {
200 assert(scc
->when
!= w
);
206 cols_
.bottom().add(c1
);
207 cols_
.bottom().add(c2
);
208 scc
= cols_
.bottom();
219 Score::find_col(Mtime w
,bool mus
)
221 PCursor
<Score_column
*> scc(cols_
);
222 for (; scc
.ok(); scc
++) {
223 if (scc
->when
== w
&& scc
->musical
== mus
)
228 scc
= create_cols(w
);
235 Score::distribute_commands(void)
237 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
238 sc
->add_commands(commands_
);
244 Score::output(String s
)
250 *mlog
<< "output to " << outfile
<< "...\n";
251 Tex_stream
the_output(outfile
);
252 pscore_
->output(the_output
);
259 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
261 assert(sc
->score_
== this);
265 for (PCursor
<Score_column
*> cc(cols_
); cc
.ok() && (cc
+1).ok(); cc
++) {
266 assert(cc
->when
<= (cc
+1)->when
);
268 for (PCursor
<Command
*> cc(commands_
); cc
.ok() && (cc
+1).ok(); cc
++) {
269 assert(cc
->when
<= (cc
+1)->when
);
279 for (PCursor
<Staff
*> sc(staffs_
); sc
.ok(); sc
++) {
282 for (PCursor
<Score_column
*> sc(cols_
); sc
.ok(); sc
++) {
292 /****************************************************************/
294 Score_column::Score_column(Mtime w
)
302 Score_column::used() {
307 Score_column::print() const
310 mtor
<< "Score_column { mus "<< musical
<<" at " << when
<<'\n';
311 mtor
<< " # symbols: " << pcol
->its
.size() << "\n";
312 mtor
<< "durations: [" ;
313 for (int i
=0; i
< durations
.sz(); i
++)
314 mtor
<< durations
[i
] << " ";