]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-system-scheme.cc
* lily/include/paper-system.hh (class Paper_system): remove
[lilypond.git] / lily / paper-system-scheme.cc
1 /*
2   paper-system-scheme.cc -- implement Paper_system bindings
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
7 */
8
9 #include "paper-system.hh"
10
11 LY_DEFINE (ly_paper_system_height, "ly:paper-system-extent",
12            2, 0, 0, (SCM system, SCM axis),
13            "Return the extent of @var{system}.")
14 {
15   Paper_system *ps = unsmob_paper_system (system);
16   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
17   SCM_ASSERT_TYPE (is_axis (axis), axis, SCM_ARG2, __FUNCTION__, "axis");
18   Axis ax = (Axis)scm_to_int (axis);
19   return ly_interval2scm (ps->to_stencil ().extent (ax));
20 }
21
22 LY_DEFINE (ly_paper_system_stencil, "ly:paper-system-stencil",
23            1, 0, 0, (SCM system),
24            "Return the height of @var{system}.")
25 {
26   Paper_system *ps = unsmob_paper_system (system);
27   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
28   return ps->to_stencil ().smobbed_copy ();
29 }
30
31 LY_DEFINE (ly_paper_system_staff_extent, "ly:paper-system-staff-extents",
32            1, 0, 0, (SCM system),
33            "Return the top and bottom staff refpoint.")
34 {
35   Paper_system *ps = unsmob_paper_system (system);
36   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
37   return ly_interval2scm (ps->staff_refpoints ());
38 }
39
40
41
42 LY_DEFINE (ly_paper_system_property, "ly:paper-system-property",
43            2, 1, 0, (SCM system, SCM sym, SCM dfault),
44            "Return the value for @var{sym}. Properties may be set by "
45            "setting the @code{line-break-system-details} property of "
46            "NonMusicalPaperColumn.  If the property is not found, "
47            "return @var{dfault}, "
48            "or @code{'()} if undefined.")
49 {
50   Paper_system *ps = unsmob_paper_system (system);
51   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
52   if (dfault == SCM_UNDEFINED)
53     dfault = SCM_EOL;
54
55   SCM retval = ps->internal_get_property (sym);
56   if (retval == SCM_EOL)
57     return dfault;
58   else
59     return retval;
60 }
61
62