2 g-script-column.cc -- implement G_script_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "g-script-column.hh"
10 #include "g-staff-side.hh"
12 static G_staff_side_item
*
13 get_g_staff_side (Item
*i
)
15 Graphical_element
*e1
= i
->dim_cache_
[Y_AXIS
]->parent_l_
->element_l ();
17 return dynamic_cast<G_staff_side_item
*>(e1
);
21 G_script_column::add_staff_sided (Item
*i
)
23 SCM p
= get_g_staff_side (i
)->get_elt_property (script_priority_scm_sym
);
27 staff_sided_item_l_arr_
.push (i
);
32 staff_side_compare (Item
* const &i1
,
35 Score_element
*e1
= get_g_staff_side (i1
);
36 Score_element
*e2
= get_g_staff_side (i2
);
38 SCM p1
= e1
->get_elt_property (script_priority_scm_sym
);
39 SCM p2
= e2
->get_elt_property (script_priority_scm_sym
);
41 return gh_scm2int (SCM_CDR(p1
)) - gh_scm2int (SCM_CDR(p2
));
45 G_script_column::do_pre_processing ()
47 Drul_array
<Link_array
<Item
> > arrs
;
49 for (int i
=0; i
< staff_sided_item_l_arr_
.size (); i
++)
51 G_staff_side_item
* ip
= get_g_staff_side (staff_sided_item_l_arr_
[i
]);
52 arrs
[ip
->dir_
].push (staff_sided_item_l_arr_
[i
]);
57 Link_array
<Item
> &arr(arrs
[d
]);
59 arr
.sort (staff_side_compare
);
62 for (int i
=0; i
< arr
.size (); i
++)
64 G_staff_side_item
* gs
= get_g_staff_side (arr
[i
]);
67 gs
->add_support (last
);
68 gs
->add_support (get_g_staff_side (last
));
71 gs
->remove_elt_property (script_priority_scm_sym
);
75 } while (flip (&d
) != DOWN
);