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++){
33 // all items in the current line & staff.
37 Link_array<Score_elem> elems;
39 if (col_l->error_mark_b_) {
40 chunk_str += String("\\columnerrormark");
43 // now output the items.
44 for (iter_top(col_l->its,j); j.ok(); j++) {
49 for (iter_top(col_l->starters,j); j.ok(); j++) {
50 if (j->name() != name())
54 for (int j =0; j< elems.size(); j++) {
55 Offset o = elems[j]->absolute_offset();
56 o[X_AXIS] += cols[i]->hpos_f_;
57 s += elems[j]->TeX_string_without_offset(o);
65 Line_of_score::Line_of_score()
74 IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
77 Line_of_score::add(Score_elem*e)
79 // avoid excess dependencies.
80 if(!( e->axis_group_l_a_[0] || e->axis_group_l_a_[1]))
85 Line_of_score::contains_b(PCol const* c)const
87 return cols.find_l((PCol*)c);
91 Line_of_score::set_breaking(Array<Col_hpositions> const &breaking)
93 for (int j=0; j < breaking.size(); j++) {
94 const Array<PCol*> &curline(breaking[j].cols);
95 const Array<PCol*> &errors(breaking[j].error_col_l_arr_);
96 const Array<Real> &config(breaking[j].config);
98 for (int i=0; i < errors.size(); i++)
99 errors[i]->error_mark_b_ = true;
101 Line_of_score *line_l=0;
102 Line_of_score *line_p =0;
104 if (breaking.size() >1) {
105 line_p = (Line_of_score*)clone()->spanner();
106 line_p->copy_dependencies( *this );
111 ((Array<PCol*> &)line_l->cols) = curline;
112 line_l->left_col_l_ = curline[0];
113 line_l->right_col_l_= curline.top();
116 pscore_l_->typeset_broken_spanner(line_p);
117 broken_into_l_arr_.push(line_p);
120 for (int i=0; i < curline.size(); i++){
121 curline[i]->hpos_f_ = config[i];
122 curline[i]->line_l_ = (Line_of_score*)line_l;
128 Line_of_score::break_into_pieces(bool)
132 Link_array<Line_of_score>
133 Line_of_score::get_lines()const
135 Link_array<Line_of_score> ret;
137 if (broken_into_l_arr_.size())
138 for (int i=0; i < broken_into_l_arr_.size(); i++) {
139 ret.push((Line_of_score*)broken_into_l_arr_[i]);
142 ret.push((Line_of_score*)this); // ugh
148 Line_of_score::do_print()const
154 Line_of_score::do_width()const
156 return Spanner::do_width();