2 spanner.cc -- implement Spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1996,1997 Han-Wen Nienhuys <hanwen@stack.nl>
14 IMPLEMENT_STATIC_NAME(Spanner);
15 IMPLEMENT_IS_TYPE_B1(Spanner,Score_elem);
18 Spanner::do_print()const
21 mtor << "Between col ";
22 // huh? this does not work
23 // mtor << ( left_col_l_ ? left_col_l_->rank_i() : "nop" );
25 mtor << left_col_l_->rank_i();
29 // mtor << ( right_col_l_ ? right_col_l_->rank_i() : "nop" );
31 mtor << right_col_l_->rank_i();
34 if (broken_into_l_arr_.size())
35 mtor << "with broken pieces\n";
40 Spanner::break_into_pieces()
42 PCol * left = left_col_l_;
43 PCol * right = right_col_l_;
44 if(left->daddy_l_) left = left->daddy_l_;
45 if(right->daddy_l_) right = right->daddy_l_;
48 Link_array<PCol> break_cols = pscore_l_->broken_col_range(left,right);
49 Link_array<Spanner> broken_into_l_arr;
51 break_cols.insert(left,0);
52 break_cols.push(right);
54 for (int i=1; i < break_cols.size(); i++) {
55 Spanner* span_p = clone()->spanner();
56 left = break_cols[i-1];
57 right = break_cols[i];
59 right = right->prebreak_p_;
61 left = left->postbreak_p_;
63 assert(left&&right && left->line_l_ == right->line_l_);
65 span_p->left_col_l_ = left;
66 span_p->right_col_l_ = right;
68 pscore_l_->typeset_broken_spanner(span_p);
69 broken_into_l_arr.push( span_p );
72 broken_into_l_arr_ = broken_into_l_arr;
76 Spanner::do_break_processing()
78 if (!left_col_l_->line_l_)
79 left_col_l_ = left_col_l_->postbreak_p_;
80 if (!right_col_l_->line_l_)
81 right_col_l_ = right_col_l_->prebreak_p_;
86 for (int i=0; i < broken_into_l_arr_.size(); i++)
87 broken_into_l_arr_[i]->handle_broken_dependencies();
89 handle_broken_dependencies();
96 left_col_l_ = right_col_l_ = 0;
101 Spanner::do_width()const
103 Real r = right_col_l_->hpos;
104 Real l = left_col_l_->hpos;
105 assert(*left_col_l_ < *right_col_l_);
108 return Interval(0, r-l);
112 Spanner::line_l()const
114 if ( left_col_l_->line_l_ != right_col_l_->line_l_)
116 return left_col_l_->line_l_;
121 Spanner::find_broken_piece(Line_of_score*l)const
123 for (int i=0; i < broken_into_l_arr_.size(); i++)
124 if(broken_into_l_arr_[i]->line_l() == l)
125 return broken_into_l_arr_[i];
131 Spanner::broken_b()const
133 return broken_into_l_arr_.size();