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()
22 Link_array
<Score_element
> elems
= elem_l_arr ();
23 Line_of_score
*my_line
= line_l();
24 for (int i
=0; i
< elems
.size(); i
++)
26 if (!elems
[i
]->line_l())
28 Item
* item_l
= dynamic_cast<Item
*> (elems
[i
]);
30 && item_l
->breakable_b ()
31 && item_l
->break_status_dir() == 0)
33 // last two checks are paranoia
34 Score_element
* broken_item_l
=
35 item_l
->find_broken_piece (my_line
);
36 add_element (broken_item_l
);
39 Spanner
*spanner_l
= dynamic_cast<Spanner
*> (elems
[i
]);
42 Score_element
*broken_spanner_l
=
43 spanner_l
->find_broken_piece (my_line
);
44 add_element (broken_spanner_l
);
46 remove_element (elems
[i
]);
54 Axis_group_spanner::do_break_processing()
56 Spanner::do_break_processing ();
58 bool breaking_self_b
= ! Spanner::line_l();
61 do_break_processing_if_unbroken();
62 Spanner::do_break_processing();
68 Link_array
<Score_element
> loose_elems
= elem_l_arr ();
72 for (int i
=0; i
< loose_elems
.size (); i
++)
74 Score_element
* elt
= loose_elems
[i
];
76 with which axes do we have to meddle?
80 for (int a
= X_AXIS
; a
< NO_AXES
; ++a
)
81 if (elt
->parent_l (Axis (a
)) == this)
92 for (int i
=0; i
< loose_elems
.size(); i
++)
94 Score_element
* elt
= loose_elems
[i
];
95 Line_of_score
*elt_line
= elt
->line_l();
97 Axis a1
= (Axis
)axeses
[2*i
]; // ugh.
98 Axis a2
= (Axis
)axeses
[2*i
+1]; // ugh.
101 /* this piece doesn't know where it belongs.
102 Find out if it was broken, and use the broken remains
106 Item
*it
= dynamic_cast <Item
*> (elt
) ;
107 if (Spanner
* sp
=dynamic_cast <Spanner
*> (elt
))
109 for (int j
=0; j
< sp
->broken_into_l_arr_
.size(); j
++)
111 Line_of_score
*l
= sp
->broken_into_l_arr_
[j
]->line_l ();
113 Axis_group_spanner
* my_broken_l
114 = dynamic_cast<Axis_group_spanner
*>(find_broken_piece (l
));
116 Score_element
* broken_span_l
117 = sp
->find_broken_piece (l
);
120 my_broken_l
->add_element (broken_span_l
, a1
, a2
);
123 else if (it
&& it
->broken_original_b ())
129 Item
* broken_item
= it
->find_broken_piece (j
);
130 Line_of_score
* item_line_l
= broken_item
->line_l() ;
134 Axis_group_spanner
* v
135 = dynamic_cast<Axis_group_spanner
*>(find_broken_piece (item_line_l
));
137 v
->add_element (broken_item
, a1
, a2
);
140 broken_item
->set_elt_property ("transparent", SCM_BOOL_T
);
141 broken_item
->set_empty (X_AXIS
); // UGH.
142 broken_item
->set_empty (Y_AXIS
);
146 while (flip(&j
) != LEFT
);
151 /* this piece *does* know where it belongs.
152 Put it in appropriate piece of this spanner
154 Axis_group_spanner
* my_broken_l
155 = dynamic_cast<Axis_group_spanner
*> (find_broken_piece (elt
->line_l()));
156 my_broken_l
->add_element (elt
, a1
, a2
);
160 Spanner::do_break_processing();