-#include "request.hh"
-#include "voice.hh"
-#include "staffwalker.hh"
#include "debug.hh"
-#include "clef.hh"
-#include "staff.hh"
-#include "command.hh"
#include "complexstaff.hh"
-#include "sccol.hh"
#include "complexwalker.hh"
+#include "complexcolumn.hh"
#include "score.hh"
#include "pscore.hh"
#include "staffsym.hh"
+#include "pscore.hh"
+#include "bar.hh"
+#include "meter.hh"
+#include "sccol.hh"
+#include "commandrequest.hh"
+const NO_LINES = 5;
-Complex_column::Complex_column(Score_column*s, Complex_staff *staff_l)
- : Staff_column(s)
-{
- staff_l_ = staff_l;
-}
-
-Complex_staff::Complex_staff()
-{
- pstaff_l_ = 0;
-}
-
+/** Aside from putting fields right, this generates the staff symbol.
+ */
void
-Complex_column::setup_requests()
+Complex_staff::set_output(PScore* pscore_l )
{
- for (int i = 0 ; i < v_elts.size(); i ++)
- for (iter_top(v_elts[i]->reqs,j); j.ok(); j++) {
+ pstaff_l_ = new PStaff(pscore_l);
+ pscore_l_ = pscore_l;
+ pscore_l_->add(pstaff_l_);
- if (j->barcheck()) {
- if (tdescription_->whole_in_measure) {
- warning( "Barcheck failed", j->defined_ch_c_l_m );
-// staff_l_->the_line_->pscore_l_->heu errorlevel_i_ |= 1;
- }
- continue;
- }
- if (j->mark())
- continue;
- if (j->command())
- continue;
- if (j->groupchange()) // ugh
- first_l_arr_.push(j);
- else
- second_l_arr_.push(j);
- }
-}
-Staff_column*
-Complex_staff::create_col(Score_column*s)
-{
- return new Complex_column(s,this);
-}
-
-void
-Complex_staff::walk()
-{
- for (Complex_walker sc(this); sc.ok(); sc++) {
- sc.col()->setup_requests();
- sc.process();
- }
+
Staff_symbol *span_p = new Staff_symbol(5);
-
+
Score_column* col_last
=score_l_->find_col(score_l_->last(), false);
Score_column* col_first=
score_l_->find_col(0, false);
- col_first->pcol_l_->set_breakable();
- col_last->pcol_l_->set_breakable();
- span_p->set_extent( col_first->pcol_l_->postbreak_p_,
+ span_p->set_extent(col_first->pcol_l_->postbreak_p_,
col_last->pcol_l_->prebreak_p_);
pscore_l_->typeset_spanner(span_p, pstaff_l_);
}
+
+Complex_staff::Complex_staff()
+{
+ pstaff_l_ = 0;
+}
+
+Staff_column*
+Complex_staff::create_col()
+{
+ return new Complex_column(this);
+}
+
+Staff_walker *
+Complex_staff::get_walker_p()
+{
+ return new Complex_walker(this);
+}
+/*
+ score.cc -- implement Score
+
+ source file of the LilyPond music typesetter
+
+ (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "tstream.hh"
#include "score.hh"
#include "sccol.hh"
#include "main.hh"
#include "source.hh"
#include "sourcefile.hh"
+#include "scorewalker.hh"
void
-Score::process()
+Score::setup_music()
{
- *mlog << "\nProcessing music ..." << flush;
-
- assert (paper_p_);
+ *mlog << "\nSetting up music ..." << flush;
if (last() == Moment(0)) {
warning("Need to have music in a score.", defined_ch_c_l_);
}
- // distribute commands to disciples
pscore_p_ = new PScore(paper_p_);
+ find_col(0, false)->set_breakable(); // ugh
+ find_col(last(), false)->set_breakable();
+
+
+
for (iter_top(staffs_,i); i.ok(); i++) {
i->set_output(pscore_p_);
- i->truncate_cols(last());
- i->process();
+ i->setup_staffcols();
+ i->OK();
}
+}
+
+void
+Score::process_music()
+{
+ *mlog << "Processing music ..." << flush;
+ for (Score_walker w(this); w.ok(); w++) {
+ w.process();
+ }
+}
+
+void
+Score::process()
+{
+ setup_music();
+ process_music();
// do this after processing, staffs first have to generate PCols.
- find_col(last(), false)->set_breakable();
do_cols();
print();
calc_idealspacing();
// debugging
OK();
*mlog << endl;
- pscore_p_->process();
+ pscore_p_->process();
}
/**
}
/**
+ Create columns at time #w#.
this sux. We should have Score_column create the appropriate PCol.
- Unfortunately, PCols don't know about their position.
+ Unfortunately, PCols don't know about their position.
+
+ @return cursor pointing to the nonmusical (first) column
*/
PCursor<Score_column*>
Score::create_cols(Moment w)
Score_column* c1 = new Score_column(w);
Score_column* c2 = new Score_column(w);
- c1->musical_ = false;
- c2->musical_ = true;
+ c1->musical_b_ = false;
+ c2->musical_b_ = true;
iter_top(cols_,i);
PCursor<Score_column*>
Score::find_col(Moment w, bool mus)
-{ iter_top( cols_,i);
-
+{
+ iter_top( cols_,i);
for (; i.ok(); i++) {
- if (i->when() == w && i->musical_ == mus)
+ if (i->when() == w && i->musical_b_ == mus)
return i;
if (i->when() > w)
break;
s->score_l_ = this;
staffs_.bottom().add(s);
}
-
-void
-Score::add_marks(Array<String> s_arr, Array<Moment> m_arr)
-{
- for (int i=0; i < s_arr.size(); i++) {
- String mark_str (s_arr[i]);
- if (markers_assoc_.elt_query(mark_str) &&
- m_arr[i] != markers_assoc_[mark_str])
-
- error("Conflicting marker: `" + s_arr[i]+ "\'");
- else
- markers_assoc_[s_arr[i]] = m_arr[i];
- }
-}