2 scoreline.cc -- implement Line_of_score
4 source file of the GNU LilyPond music typesetter
6 (c) 1996, 1997 Han-Wen Nienhuys <hanwen@stack.nl>
9 #include "scoreline.hh"
13 #include "paper-def.hh"
20 take out hard coded TeX stuff.
23 Line_of_score::TeX_string() const
25 String s ("\\hbox{%<- line of score\n");
27 s+= "\\scorelineerrormark";
30 Real lastpos = cols[0]->hpos_f_;
31 for (int i=0; i < cols.size(); i++)
34 // all items in the current line & staff.
38 Link_array<Score_elem> elems;
40 if (col_l->error_mark_b_)
42 chunk_str += String ("\\columnerrormark");
45 // now output the items.
46 for (iter_top (col_l->its,j); j.ok(); j++)
52 for (iter_top (col_l->starters,j); j.ok(); j++)
54 if (j->name() != name ())
58 for (int j =0; j< elems.size(); j++)
60 Offset o = elems[j]->absolute_offset();
61 o[X_AXIS] += cols[i]->hpos_f_;
62 s += elems[j]->TeX_string_without_offset (o);
70 Line_of_score::Line_of_score()
79 IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
82 Line_of_score::add (Score_elem*e)
84 // avoid excess dependencies.
85 if (!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
90 Line_of_score::contains_b (PCol const* c)const
92 return cols.find_l ((PCol*)c);
96 Line_of_score::set_breaking (Array<Col_hpositions> const &breaking)
98 for (int j=0; j < breaking.size(); j++)
100 const Array<PCol*> &curline (breaking[j].cols);
101 const Array<PCol*> &errors (breaking[j].error_col_l_arr_);
102 const Array<Real> &config (breaking[j].config);
104 for (int i=0; i < errors.size(); i++)
105 errors[i]->error_mark_b_ = true;
107 Line_of_score *line_l=0;
108 Line_of_score *line_p =0;
110 if (breaking.size() >1)
112 line_p = (Line_of_score*)clone()->spanner ();
113 line_p->copy_dependencies (*this);
119 ((Array<PCol*> &)line_l->cols) = curline;
120 line_l->left_col_l_ = curline[0];
121 line_l->right_col_l_= curline.top();
125 pscore_l_->typeset_broken_spanner (line_p);
126 broken_into_l_arr_.push (line_p);
129 for (int i=0; i < curline.size(); i++)
131 curline[i]->hpos_f_ = config[i];
132 curline[i]->line_l_ = (Line_of_score*)line_l;
138 Line_of_score::break_into_pieces (bool)
142 Link_array<Line_of_score>
143 Line_of_score::get_lines()const
145 Link_array<Line_of_score> ret;
147 if (broken_into_l_arr_.size())
148 for (int i=0; i < broken_into_l_arr_.size(); i++)
150 ret.push ((Line_of_score*)broken_into_l_arr_[i]);
153 ret.push ((Line_of_score*)this); // ugh
159 Line_of_score::do_print()const
165 Line_of_score::do_width()const
167 return Spanner::do_width();