- left_extent[LEFT] -= robust_scm2double (me->get_property ("left-padding"), 0);
- Interval width (left_extent[LEFT], right_extent[RIGHT]);
+*/
+
+MAKE_SCHEME_CALLBACK (Accidental_placement, calc_positioning_done, 1);
+SCM
+Accidental_placement::calc_positioning_done (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ if (!me->is_live ())
+ return SCM_BOOL_T;
+
+ me->set_property ("positioning-done", SCM_BOOL_T);
+
+ SCM accs = me->get_object ("accidental-grobs");
+ if (!scm_is_pair (accs))
+ return SCM_BOOL_T;
+
+ vector<Accidental_placement_entry*> apes = build_apes (accs);
+
+ Grob *common[] = {me, 0};
+
+ vector<Grob*> heads_and_stems = extract_heads_and_stems (apes);
+
+ common[Y_AXIS] = common_refpoint_of_accidentals (apes, Y_AXIS);
+ common[Y_AXIS] = common_refpoint_of_array (heads_and_stems, common[Y_AXIS], Y_AXIS);
+ common[X_AXIS] = common_refpoint_of_array (heads_and_stems, me, X_AXIS);
+
+ for (vsize i = apes.size (); i--;)
+ set_ape_skylines (apes[i], common);
+ Skyline heads_skyline = build_heads_skyline (heads_and_stems, common);
+
+ stagger_apes (&apes);
+ Interval width = position_apes (me, apes, heads_skyline);