2 axis-group-spanner.cc -- implement Axis_group_spanner
4 source file of the GNU LilyPond music typesetter
6 (c) 1997--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "axis-group-spanner.hh"
12 #include "paper-column.hh"
14 /** Do stuff if we're not broken. In this case the last and first
15 columns usually are pre- and postbreak respectively,
16 so the items from these columns need adjusting.
19 Axis_group_spanner::do_break_processing_if_unbroken()
21 Link_array<Score_element> elems = elem_l_arr ();
22 Line_of_score *my_line = line_l();
23 for (int i=0; i < elems.size(); i++)
25 if (!elems[i]->line_l())
27 Item * item_l = dynamic_cast<Item*> (elems[i]);
29 && item_l->breakable_b ()
30 && item_l->break_status_dir() == 0)
32 // last two checks are paranoia
33 Score_element * broken_item_l =
34 item_l->find_broken_piece (my_line);
35 add_element (broken_item_l);
38 Spanner *spanner_l = dynamic_cast<Spanner*> (elems[i]);
41 Score_element *broken_spanner_l =
42 spanner_l->find_broken_piece (my_line);
43 add_element (broken_spanner_l);
45 remove_element (elems[i]);
52 Axis_group_spanner::do_break_processing()
55 bool breaking_self_b = ! Spanner::line_l();
58 do_break_processing_if_unbroken();
59 Spanner::do_break_processing();
64 Link_array<Score_element> loose_elems = elem_l_arr ();
68 for (int i=0; i < loose_elems.size (); i++)
70 Score_element* elt = loose_elems[i];
72 with which axes do we have to meddle?
76 for (int a = X_AXIS; a < NO_AXES; ++a)
77 if (elt->parent_l (Axis (a)) == this)
88 for (int i=0; i < loose_elems.size(); i++)
90 Score_element * elt = loose_elems[i];
91 Line_of_score *elt_line = elt->line_l();
93 Axis a1= (Axis)axeses[2*i]; // ugh.
94 Axis a2= (Axis)axeses[2*i+1]; // ugh.
97 /* this piece doesn't know where it belongs.
98 Find out if it was broken, and use the broken remains
102 Item *it = dynamic_cast <Item *> (elt) ;
103 if (Spanner * sp =dynamic_cast <Spanner *> (elt))
105 for (int j =0; j < sp->broken_into_l_arr_.size(); j++)
107 Line_of_score *l = sp->broken_into_l_arr_[j]->line_l ();
109 Axis_group_spanner * my_broken_l
110 = dynamic_cast<Axis_group_spanner*>(find_broken_piece (l));
112 Score_element * broken_span_l
113 = sp->find_broken_piece (l);
116 my_broken_l->add_element (broken_span_l, a1, a2);
119 else if (it && it->broken_original_b ())
125 Item * broken_item = it->find_broken_piece (j);
126 Line_of_score * item_line_l = broken_item->line_l() ;
130 Axis_group_spanner * v
131 = dynamic_cast<Axis_group_spanner*>(find_broken_piece (item_line_l));
133 v->add_element (broken_item, a1, a2);
136 broken_item->set_elt_property (transparent_scm_sym, SCM_BOOL_T);
137 broken_item->set_empty (true);
141 while (flip(&j) != LEFT);
146 /* this piece *does* know where it belongs.
147 Put it in appropriate piece of this spanner
149 Axis_group_spanner * my_broken_l
150 = dynamic_cast<Axis_group_spanner*> (find_broken_piece (elt->line_l()));
151 my_broken_l->add_element (elt, a1, a2);
155 Spanner::do_break_processing();
159 Axis_group_spanner::do_print() const
161 Axis_group_element::do_print();
163 Spanner::do_print ();
168 Axis_group_spanner::do_width () const
170 return Spanner::do_width ();