+// Returns the spacing spec connecting BEFORE to AFTER. A return
+// value of SCM_BOOL_F means that there should be no spring (in
+// practice, this means that we use a very flexible spring).
+SCM
+Page_layout_problem::get_spacing_spec (Grob *before, Grob *after)
+{
+ if (is_spaceable (before))
+ {
+ if (is_spaceable (after))
+ return before->get_property ("next-staff-spacing");
+ else
+ {
+ Direction affinity = to_dir (after->get_property ("staff-affinity"));
+ return (affinity == DOWN) ? SCM_BOOL_F : after->get_property ("inter-staff-spacing");
+ }
+ }
+ else
+ {
+ if (is_spaceable (after))
+ {
+ Direction affinity = to_dir (before->get_property ("staff-affinity"));
+ return (affinity == UP) ? SCM_BOOL_F : before->get_property ("inter-staff-spacing");
+ }
+ else
+ {
+ Direction before_affinity = to_dir (before->get_property ("staff-affinity"));
+ Direction after_affinity = to_dir (after->get_property ("staff-affinity"));
+ if (after_affinity > before_affinity)
+ {
+ warning (_ ("staff-affinities should only decrease"));
+ after_affinity = before_affinity;
+ }
+ if (before_affinity != UP)
+ return before->get_property ("inter-loose-line-spacing");
+ else if (after_affinity != DOWN)
+ return before->get_property ("inter-loose-line-spacing");
+ }
+ }
+ return SCM_BOOL_F;
+}
+