+/*
+ scoreline.cc -- implement Line_of_score
+
+ source file of the GNU LilyPond music typesetter
+
+ (c) 1996, 1997--1998 Han-Wen Nienhuys <hanwen@stack.nl>
+*/
+
#include "scoreline.hh"
-#include "staffline.hh"
#include "dimen.hh"
#include "spanner.hh"
-#include "symbol.hh"
+#include "atom.hh"
#include "paper-def.hh"
-#include "pcol.hh"
-#include "pscore.hh"
+#include "p-col.hh"
+#include "p-score.hh"
+
+
+Line_of_score::Line_of_score()
+{
+ error_mark_b_ = 0;
+}
+
+IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
-String
-Line_of_score::TeXstring() const
+void
+Line_of_score::add (Score_elem*e)
{
- String s("\\vbox{%<- line of score\n");
- for (iter_top(staffs,sc); sc.ok(); sc++){
- s += sc->TeXstring();
- if ((sc+1).ok())
- s+= "\\interstaffline\n";
- }
- s += "}";
- return s;
+ // avoid excess dependencies.
+ if (!(e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
+ add_dependency (e);
}
+bool
+Line_of_score::contains_b (Paper_column const* c) const
+{
+ return cols.find_l ((Paper_column*)c);
+}
-Line_of_score::Line_of_score(Array<PCol *> sv,
- PScore *ps)
+void
+Line_of_score::set_breaking (Array<Col_hpositions> const &breaking)
{
- pscore_l_ = ps;
- for (int i=0; i< sv.size(); i++) {
- PCol *p=(PCol *) sv[i];
- cols.bottom().add(p);
- p->line_l_=this;
+ for (int j=0; j < breaking.size(); j++)
+ {
+ const Array<Paper_column*> &curline (breaking[j].cols);
+ const Array<Paper_column*> &errors (breaking[j].error_col_l_arr_);
+ const Array<Real> &config (breaking[j].config);
+
+ for (int i=0; i < errors.size(); i++)
+ errors[i]->error_mark_b_ = true;
+
+ Line_of_score *line_l=0;
+ Line_of_score *line_p =0;
+
+ if (breaking.size() >1)
+ {
+ line_p = (Line_of_score*)clone()->spanner ();
+ line_l = line_p;
+ }
+ else
+ line_l = this;
+
+ ((Array<Paper_column*> &)line_l->cols) = curline;
+ line_l->set_bounds(LEFT,curline[0]);
+
+ line_l->set_bounds(RIGHT,curline.top());
+
+ if (line_p)
+ {
+ pscore_l_->typeset_broken_spanner (line_p);
+ broken_into_l_arr_.push (line_p);
+ }
+
+ for (int i=0; i < curline.size(); i++)
+ {
+ curline[i]->translate_axis (config[i],X_AXIS);
+ curline[i]->line_l_ = (Line_of_score*)line_l;
+ }
}
+}
+
- for (iter_top(pscore_l_->staffs,sc); sc.ok(); sc++)
- staffs.bottom().add(new Line_of_staff(this, sc));
+void
+Line_of_score::break_into_pieces (bool)
+{
+
}
-/* construct a line with the named columns. Make the line field
- in each column point to this
-
- #sv# isn't really const!!
- */
+Link_array<Line_of_score>
+Line_of_score::get_lines() const
+{
+ Link_array<Line_of_score> ret;
+
+ if (broken_into_l_arr_.size())
+ for (int i=0; i < broken_into_l_arr_.size(); i++)
+ {
+ ret.push ((Line_of_score*)broken_into_l_arr_[i]);
+ }
+ else
+ ret.push ((Line_of_score*)this); // ugh
+
+ return ret;
+}
void
-Line_of_score::process()
+Line_of_score::do_print() const
{
- for (iter_top(staffs,i); i.ok(); i++)
- i->process();
+ Spanner::do_print();
+}
+
+Interval
+Line_of_score::do_width() const
+{
+ return Spanner::do_width();
+}
+
+Link_array<Score_elem>
+Line_of_score::get_extra_dependencies () const
+{
+ Link_array<Score_elem> r;
+ for (int i=0; i < cols.size (); i++)
+ r.push (cols[i]);
+ return r;
+}
+
+void
+Line_of_score::do_unlink ()
+{
+ Spanner::do_unlink ();
+ for (int i=0; i < cols.size (); i++)
+ cols[i]->line_l_ =0;
+ cols.set_size (0);
+}
+
+
+void
+Line_of_score::do_junk_links ()
+{
+ cols.set_size (0);
}
-