2 paper-system-scheme.cc -- implement Paper_system bindings.
4 source file of the GNU LilyPond music typesetter
6 (c) 2008 Han-Wen Nienhuys <hanwen@lilypond.org>
12 #include "skyline-pair.hh"
14 LY_DEFINE (ly_paper_system_p, "ly:paper-system?",
18 return ly_prob_type_p (obj, ly_symbol2scm ("paper-system"));
21 LY_DEFINE (ly_paper_system_minimum_distance, "ly:paper-system-minimum-distance",
22 2, 0, 0, (SCM sys1, SCM sys2),
23 "Measure the minimum distance between these two paper-systems,"
24 " using their stored skylines if possible and falling back to"
25 " their extents otherwise.")
28 Prob *p1 = unsmob_prob (sys1);
29 Prob *p2 = unsmob_prob (sys2);
30 Skyline_pair *sky1 = Skyline_pair::unsmob (p1->get_property ("vertical-skylines"));
31 Skyline_pair *sky2 = Skyline_pair::unsmob (p2->get_property ("vertical-skylines"));
34 ret = (*sky1)[DOWN].distance ((*sky2)[UP]);
37 Stencil *s1 = unsmob_stencil (p1->get_property ("stencil"));
38 Stencil *s2 = unsmob_stencil (p2->get_property ("stencil"));
39 Interval iv1 = s1->extent (Y_AXIS);
40 Interval iv2 = s2->extent (Y_AXIS);
41 ret = iv2[UP] - iv1[DOWN];
43 return scm_from_double (ret);