#include "align-interface.hh"
#include "directional-element-interface.hh"
-#include "pointer-group-interface.hh"
#include "grob-array.hh"
#include "hara-kiri-group-spanner.hh"
#include "international.hh"
#include "lookup.hh"
#include "paper-column.hh"
#include "paper-score.hh"
+#include "pointer-group-interface.hh"
#include "separation-item.hh"
#include "skyline-pair.hh"
+#include "staff-grouper-interface.hh"
#include "stencil.hh"
#include "system.hh"
#include "warn.hh"
Interval
Axis_group_interface::cached_pure_height (Grob *me, int start, int end)
+{
+ Interval iv = begin_of_line_pure_height (me, start);
+ iv.unite (rest_of_line_pure_height (me, start, end));
+
+ return iv;
+}
+
+Interval
+Axis_group_interface::rest_of_line_pure_height (Grob *me, int start, int end)
{
SCM adjacent_pure_heights = me->get_property ("adjacent-pure-heights");
b.translate (Offset (0, dir*dist));
elements[i]->translate_axis (dir*dist, Y_AXIS);
}
- (*skylines)[dir].insert (b, 0, X_AXIS);
+ skylines->insert (b, 0, X_AXIS);
elements[i]->set_property ("outside-staff-priority", SCM_BOOL_F);
last_affected_position[dir] = b[X_AXIS][RIGHT];
}
return skylines;
}
-MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_max_stretch, 1)
-SCM
-Axis_group_interface::calc_max_stretch (SCM smob)
-{
- Grob *me = unsmob_grob (smob);
- Real ret = 0;
- extract_grob_set (me, "elements", elts);
-
- for (vsize i = 0; i < elts.size (); i++)
- if (Axis_group_interface::has_interface (elts[i]))
- ret += robust_scm2double (elts[i]->get_property ("max-stretch"), 0.0);
-
- return scm_from_double (ret);
-}
-
MAKE_SCHEME_CALLBACK (Axis_group_interface, print, 1)
SCM
Axis_group_interface::print (SCM smob)
return ret.smobbed_copy ();
}
+MAKE_SCHEME_CALLBACK (Axis_group_interface, calc_next_staff_spacing, 1)
+SCM
+Axis_group_interface::calc_next_staff_spacing (SCM smob)
+{
+ Grob *me = unsmob_grob (smob);
+ Grob *grouper = unsmob_grob (me->get_object ("staff-grouper"));
+
+ if (grouper)
+ {
+ Grob *last_in_group = Staff_grouper_interface::get_last_grob (grouper);
+ if (me == last_in_group)
+ return grouper->get_property ("after-last-staff-spacing");
+ else
+ return grouper->get_property ("between-staff-spacing");
+ }
+ return me->get_property ("default-next-staff-spacing");
+}
+
+Real
+Axis_group_interface::minimum_distance (Grob *g1, Grob *g2, Axis a)
+{
+ SCM sym = ly_symbol2scm ((a == Y_AXIS) ? "vertical-skylines" : "horizontal-skylines");
+
+ Skyline_pair *s1 = Skyline_pair::unsmob (g1->get_property (sym));
+ Skyline_pair *s2 = Skyline_pair::unsmob (g2->get_property (sym));
+ if (s1 && s2)
+ return (*s1)[DOWN].distance ((*s2)[UP]);
+ return 0;
+}
+
ADD_INTERFACE (Axis_group_interface,
"An object that groups other layout objects.",
+ // TODO: some of these properties are specific to
+ // VerticalAxisGroup. We should split off a
+ // vertical-axis-group-interface.
/* properties */
"X-common "
"Y-common "
"adjacent-pure-heights "
"axes "
+ "default-next-staff-spacing "
"elements "
+ "inter-loose-line-spacing "
+ "inter-staff-spacing "
"keep-fixed-while-stretching "
"max-stretch "
+ "next-staff-spacing "
"no-alignment "
"pure-Y-common "
"pure-relevant-items "
"pure-relevant-spanners "
+ "staff-affinity "
+ "staff-grouper "
+ "system-Y-offset "
"vertical-skylines "
);