2 g-script-column.cc -- implement Script_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "script-column.hh"
10 #include "staff-side.hh"
11 #include "dimension-cache.hh"
13 static Staff_side_item
*
14 get_Staff_side (Item
*i
)
16 Graphical_element
*e1
= i
->parent_l(Y_AXIS
);
18 return dynamic_cast<Staff_side_item
*>(e1
);
22 Script_column::add_staff_sided (Item
*i
)
24 SCM p
= get_Staff_side (i
)->get_elt_property ("script-priority");
25 if (p
== SCM_UNDEFINED
)
28 staff_sided_item_l_arr_
.push (i
);
33 staff_side_compare (Item
* const &i1
,
36 Score_element
*e1
= get_Staff_side (i1
);
37 Score_element
*e2
= get_Staff_side (i2
);
39 SCM p1
= e1
->get_elt_property ("script-priority");
40 SCM p2
= e2
->get_elt_property ("script-priority");
42 return gh_scm2int (p1
) - gh_scm2int (p2
);
46 Script_column::do_pre_processing ()
48 Drul_array
<Link_array
<Item
> > arrs
;
50 for (int i
=0; i
< staff_sided_item_l_arr_
.size (); i
++)
52 Staff_side_item
* ip
= get_Staff_side (staff_sided_item_l_arr_
[i
]);
53 arrs
[ip
->get_direction ()].push (staff_sided_item_l_arr_
[i
]);
58 Link_array
<Item
> &arr(arrs
[d
]);
60 arr
.sort (staff_side_compare
);
63 for (int i
=0; i
< arr
.size (); i
++)
65 Staff_side_item
* gs
= get_Staff_side (arr
[i
]);
68 gs
->add_support (last
);
69 gs
->add_support (get_Staff_side (last
));
72 gs
->remove_elt_property ("script-priority");
76 } while (flip (&d
) != DOWN
);