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"
10 #include "staffline.hh"
14 #include "paper-def.hh"
20 take out hard coded TeX stuff.
24 Line_of_score::TeX_string() const
26 String s("\\hbox{%<- line of score\n");
28 s+= "\\scorelineerrormark";
31 Real lastpos = cols[0]->hpos_f_;
32 for (int i=0; i < cols.size(); i++){
34 // all items in the current line & staff.
36 Real delta = col_l->hpos_f_ - lastpos;
39 if (col_l->error_mark_b_) {
40 chunk_str += String("\\columnerrormark");
42 // now output the items.
43 for (iter_top(col_l->its,j); j.ok(); j++) {
44 chunk_str += j->TeX_string();
47 for (iter_top(col_l->starters,j); j.ok(); j++) {
48 if (j->name() != name())
49 chunk_str += j->TeX_string();
54 s +=String( "\\kern ") + print_dimen(delta);
56 lastpos = col_l->hpos_f_;
64 Line_of_score::Line_of_score()
72 IMPLEMENT_STATIC_NAME(Line_of_score);
73 IMPLEMENT_IS_TYPE_B1(Line_of_score,Spanner);
76 Line_of_score::add(Score_elem*e)
78 if( !e->dependent_size()) // avoid excess dependencies.
83 Line_of_score::contains_b(PCol const* c)const
85 return cols.find_l((PCol*)c);
89 Line_of_score::set_breaking(Array<Col_hpositions> const &breaking)
91 for (int j=0; j < breaking.size(); j++) {
92 const Array<PCol*> &curline(breaking[j].cols);
93 const Array<PCol*> &errors(breaking[j].error_col_l_arr_);
94 const Array<Real> &config(breaking[j].config);
96 for (int i=0; i < errors.size(); i++)
97 errors[i]->error_mark_b_ = true;
99 Line_of_score *line_l=0;
100 Line_of_score *line_p =0;
102 if (breaking.size() >1) {
103 line_p = (Line_of_score*)clone()->spanner();
108 ((Array<PCol*> &)line_l->cols) = curline;
109 line_l->left_col_l_ = curline[0];
110 line_l->right_col_l_= curline.top();
113 pscore_l_->typeset_broken_spanner(line_p);
114 broken_into_l_arr_.push(line_p);
117 for (int i=0; i < curline.size(); i++){
118 curline[i]->hpos_f_ = config[i];
119 curline[i]->line_l_ = (Line_of_score*)line_l;
125 Line_of_score::break_into_pieces()
129 Link_array<Line_of_score>
130 Line_of_score::get_lines()const
132 Link_array<Line_of_score> ret;
134 if(broken_into_l_arr_.size())
135 for (int i=0; i < broken_into_l_arr_.size(); i++) {
136 ret.push((Line_of_score*)broken_into_l_arr_[i]);
139 ret.push((Line_of_score*)this); // ugh
145 Line_of_score::do_print()const
151 Line_of_score::do_width()const
153 return Spanner::do_width();