2 script-column.cc -- implement Script_column
4 source file of the GNU LilyPond music typesetter
6 (c) 1999--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
9 #include "script-column.hh"
10 #include "side-position-interface.hh"
12 #include "group-interface.hh"
15 Script_column::add_staff_sided (Grob
*me
, Item
*i
)
17 SCM p
= i
->get_grob_property ("script-priority");
21 Pointer_group_interface::add_element (me
, "scripts",i
);
23 me
->add_dependency (i
);
27 staff_side_compare (Grob
* const &i1
,
30 SCM p1
= i1
->get_grob_property ("script-priority");
31 SCM p2
= i2
->get_grob_property ("script-priority");
33 return gh_scm2int (p1
) - gh_scm2int (p2
);
36 MAKE_SCHEME_CALLBACK (Script_column
,before_line_breaking
,1);
39 Script_column::before_line_breaking (SCM smob
)
41 Grob
* me
= unsmob_grob (smob
);
42 Drul_array
<Link_array
<Grob
> > arrs
;
43 Link_array
<Grob
> staff_sided
44 = Pointer_group_interface__extract_elements (me
, (Grob
*)0, "scripts");
47 for (int i
=0; i
< staff_sided
.size (); i
++)
49 arrs
[Side_position_interface::get_direction (staff_sided
[i
])]
50 .push (staff_sided
[i
]);
55 Link_array
<Grob
> &arr (arrs
[d
]);
57 arr
.sort (staff_side_compare
);
60 for (int i
=0; i
< arr
.size (); i
++)
64 Side_position_interface::add_support (arr
[i
],last
);
66 arr
[i
]->remove_grob_property ("script-priority");
70 } while (flip (&d
) != DOWN
);
72 return SCM_UNSPECIFIED
;