]> git.donarmstrong.com Git - lilypond.git/blob - lily/line-of-score.cc
ac6c0a10bbf67b98c13fd25910e461dd9a1befe0
[lilypond.git] / lily / line-of-score.cc
1 /*
2   scoreline.cc -- implement Line_of_score
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1996,  1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
7 */
8
9 #include "line-of-score.hh"
10 #include "spanner.hh"
11
12 #include "paper-def.hh"
13 #include "p-col.hh"
14 #include "p-score.hh"
15
16
17 Line_of_score::Line_of_score()
18 {
19   error_mark_b_ = 0;
20 }
21
22
23
24
25 void
26 Line_of_score::add_element (Score_element*e)
27 {
28   // avoid excess dependencies.
29   if (! (e->parent_l (X_AXIS) || e->parent_l (Y_AXIS)) )
30     add_dependency (e);
31 }
32
33 bool
34 Line_of_score::contains_b (Paper_column const* c) const
35 {
36   return cols_.find_l ((Paper_column*)(c));
37 }
38
39 Line_of_score*
40 Line_of_score::set_breaking (Array<Column_x_positions> const &breaking, int j) const
41 {
42   const Link_array<Paper_column> &curline (breaking[j].cols);
43   const Link_array<Paper_column> &errors (breaking[j].error_col_l_arr_);
44   const Array<Real> &config (breaking[j].config);
45         
46   for (int i=0; i < errors.size(); i++)
47     errors[i]->error_mark_b_ = true;
48
49   Line_of_score *line_l=0;
50         
51   if (breaking.size() >1) 
52     {
53       line_l = dynamic_cast <Line_of_score*> (clone());
54     }
55   else 
56     line_l = (Line_of_score*)( this);
57
58   line_l->cols_ = curline;
59   /*  Array<Paper_column*> &
60       ((Array<Paper_column*> &)) = */
61   line_l->set_bounds(LEFT,curline[0]);
62       
63   line_l->set_bounds(RIGHT,curline.top());
64         
65   for (int i=0; i < curline.size(); i++)
66     {
67       curline[i]->translate_axis (config[i],X_AXIS);
68       curline[i]->line_l_ = dynamic_cast<Line_of_score*>(line_l);
69     }
70
71   return line_l;
72 }
73
74
75
76
77 void
78 Line_of_score::do_print() const
79 {
80   Spanner::do_print();
81 }
82
83 Interval
84 Line_of_score::do_width() const
85
86   return Spanner::do_width();
87 }
88
89 Link_array<Score_element>
90 Line_of_score::get_extra_dependencies () const
91 {
92   Link_array<Score_element> r;
93   for (int i=0; i < cols_.size (); i++)
94     r.push (cols_[i]);
95   return r;
96 }
97
98
99