]> git.donarmstrong.com Git - lilypond.git/blob - lily/vertical-group-spanner.cc
d858349ca59bd5f7de0c2b124d6afc7d0cee9a76
[lilypond.git] / lily / vertical-group-spanner.cc
1 /*
2   vertical-group-spanner.cc -- implement Vertical_group_spanner
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 1997 Han-Wen Nienhuys <hanwen@stack.nl>
7 */
8
9 #include "vertical-group-spanner.hh"
10 #include "item.hh"
11 #include "p-col.hh"
12
13 /**
14   Uncouple all elements of this Vertical_group. Ugh!
15  */
16 void
17 Vertical_group_spanner::remove_all()
18 {
19     for (int i=0; i < elem_l_arr_.size(); i++){
20         elem_l_arr_[i]->y_group_l_ = 0;
21     }
22     elem_l_arr_.set_size(0);
23     junk_dependencies();   
24 }
25
26 void
27 Vertical_group_spanner::do_break_processing()
28 {
29     set_my_columns();
30     if ( line_l() ) {
31         return;
32     }
33     break_into_pieces( false );
34
35     Link_array<Score_elem> elem_l_arr = elem_l_arr_;
36     remove_all();
37     
38     
39     
40     for (int i=0; i < elem_l_arr.size(); i++) {
41         Score_elem * elt = elem_l_arr[i];
42         Line_of_score *elt_line = elt->line_l();
43         
44         if  ( elt-> y_group_l_ )
45             continue;
46         
47         if ( ! elt_line ){ 
48             if (elt->spanner()) {
49                 Spanner * sp = elt->spanner();
50                 
51                 for (int j =0; j < broken_into_l_arr_.size(); j++) {
52                     Vertical_group_spanner * my_broken_l
53                          = (Vertical_group_spanner*)broken_into_l_arr_[j];
54                     
55                     Spanner * broken_span_l 
56                         = sp->find_broken_piece(my_broken_l->line_l());
57                     
58                     if (broken_span_l) {
59                         my_broken_l->add_element(broken_span_l );
60                     }
61                 }
62             } else if (elt->item() && elt->item()->pcol_l_->breakpoint_b()
63                        && elt->item()->break_status_i() == 0) {
64                 for (int j =0; j < 2; j++) {
65                     Item * my_item = elt->item()->broken_to_a_[j];
66                     Line_of_score * item_line_l_ = my_item->line_l() ;
67                     if ( ! item_line_l_ ) 
68                         continue;
69                     
70                     Vertical_group_spanner * v
71                         = (Vertical_group_spanner*)find_broken_piece( item_line_l_);
72                     if (v) {
73                         v->add_element( my_item );
74                     }
75                 }
76             }
77         } else {
78             Vertical_group_spanner * my_broken_l
79                 = (Vertical_group_spanner*)find_broken_piece( elt->line_l() );
80             my_broken_l->add_element( elt );
81         }
82     }
83     for (int j =0; j < broken_into_l_arr_.size(); j++) 
84         broken_into_l_arr_[j]->break_processing();      
85 }
86
87 Vertical_group_spanner::Vertical_group_spanner()
88 {
89 }
90
91 void
92 Vertical_group_spanner::do_print() const
93 {
94     Vertical_group::do_print();
95 }
96
97
98
99 IMPLEMENT_IS_TYPE_B2(Vertical_group_spanner, Spanner, Vertical_group);
100
101 Vertical_group_spanner::Vertical_group_spanner(Vertical_group_spanner const &s)
102     : Spanner(s), Vertical_group(s)
103 {
104 }