source file of the GNU LilyPond music typesetter
- (c) 1996, 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "axis-group-interface.hh"
+#include "debug.hh"
#include "line-of-score.hh"
+#include "main.hh"
+#include "paper-column.hh"
#include "paper-def.hh"
#include "paper-outputter.hh"
-#include "paper-column.hh"
#include "paper-score.hh"
+#include "string.hh"
#include "warn.hh"
+
Line_of_score::Line_of_score()
{
- set_axes (Y_AXIS,X_AXIS);
+ set_elt_property ("columns", SCM_EOL);
+ Axis_group_interface (this).set_interface ();
+ Axis_group_interface (this).set_axes (Y_AXIS,X_AXIS);
}
-bool
-Line_of_score::contains_b (Paper_column const* c) const
-{
- return cols_.find_l ((Paper_column*)(c));
-}
-// const?
-Line_of_score*
-Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j)
-{
- const Link_array<Paper_column> &curline (breaking[j].cols_);
- const Array<Real> &config (breaking[j].config_);
- Line_of_score *line_l=0;
- line_l = dynamic_cast <Line_of_score*> (clone());
- line_l->rank_i_ = j;
-
- line_l->cols_ = curline;
- line_l->set_bounds(LEFT,curline[0]);
- line_l->set_bounds(RIGHT,curline.top());
-
- for (int i=0; i < curline.size(); i++)
+void
+Line_of_score::output_lines ()
+{
+ for (int i=0; i < broken_into_l_arr_.size (); i++)
{
- curline[i]->translate_axis (config[i],X_AXIS);
- curline[i]->line_l_ = dynamic_cast<Line_of_score*> (line_l);
- }
+ Line_of_score *line_l = dynamic_cast<Line_of_score*> (broken_into_l_arr_[i]);
- broken_into_l_arr_.push (line_l);
- return line_l;
+ progress_indication ("[");
+ line_l->post_processing ();
+ progress_indication (to_str (i));
+ line_l->output_line (i + 1 == broken_into_l_arr_.size ());
+ progress_indication ("]");
+ }
}
+// const?
void
-Line_of_score::add_column (Paper_column*p)
+Line_of_score::break_into_pieces (Array<Column_x_positions> const &breaking)
{
- cols_.push (p);
- add_element (p);
+ for (int i=0; i < breaking.size (); i++)
+ {
+ Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone());
+ line_l->rank_i_ = i;
+ Link_array<Paper_column> c (breaking[i].cols_);
+ pscore_l_->typeset_element (line_l);
+ line_l->set_bound(LEFT,c[0]);
+ line_l->set_bound(RIGHT,c.top ());
+ for (int j=0; j < c.size(); j++)
+ {
+ c[j]->translate_axis (breaking[i].config_[j],X_AXIS);
+ c[j]->line_l_ = line_l;
+ }
+
+ broken_into_l_arr_.push (line_l);
+ }
}
void
-Line_of_score::do_print() const
-{
- Spanner::do_print();
- Axis_group_spanner::do_print ();
-}
-
-Link_array<Score_element>
-Line_of_score::get_extra_dependencies () const
+Line_of_score::add_column (Paper_column*p)
{
- Link_array<Score_element> r (Axis_group_spanner::get_extra_dependencies ());
- for (int i=0; i < cols_.size (); i++)
- r.push (cols_[i]);
- return r;
+ set_elt_property ("columns",
+ gh_cons (p->self_scm_, get_elt_property ("columns")));
+ Axis_group_interface (this).add_element (p);
}
-void
-Line_of_score::do_substitute_element_pointer (Score_element*o, Score_element*n)
-{
- if (Paper_column *p = dynamic_cast<Paper_column*>(o))
- cols_.substitute (p, dynamic_cast<Paper_column*>(n));
-}
void
-Line_of_score::output_all (bool last_line)
+Line_of_score::output_line (bool last_line)
{
Interval i(extent(Y_AXIS));
if (i.empty_b())
- warning (_ ("Huh? Empty Line_of_score?"));
+ programming_error ("Huh? Empty Line_of_score?");
else
translate_axis (- i[MAX], Y_AXIS);
pscore_l_->outputter_l_->start_line (i.length ());
- Super_element::output_all ();
+ output_all ();
if (last_line)
pscore_l_->outputter_l_->stop_last_line();
else
{
return p1->rank_i_ - p2->rank_i_;
}
+
+void
+Line_of_score::post_processing ()
+{
+ calculate_dependencies (POSTCALCED, POSTCALCING, &Score_element::after_line_breaking);
+}
+
+void
+Line_of_score::output_all ()
+{
+ calculate_dependencies (BREWED, BREWING, &Score_element::output_processing);
+}
+
+
+
+