]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-system-scheme.cc
* lily/book.cc (process): bugfix: flip ?: cases.
[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_title_p, "ly:paper-system-title?",
23            1, 0, 0, (SCM system),
24            "Is  @var{system} a title system?")
25 {
26   Paper_system *ps = unsmob_paper_system (system);
27   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
28   return SCM_BOOL (ps->is_title ());
29 }
30
31 LY_DEFINE (ly_paper_system_number, "ly:paper-system-number",
32            1, 0, 0, (SCM system),
33            "Return the number of @var{system}.")
34 {
35   Paper_system *ps = unsmob_paper_system (system);
36   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
37   return scm_from_int (ps->number_);
38 }
39
40 LY_DEFINE (ly_paper_system_break_before_penalty, "ly:paper-system-break-before-penalty",
41            1, 0, 0, (SCM system),
42            "Return the score for page break after @var{system}.")
43 {
44   Paper_system *ps = unsmob_paper_system (system);
45   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
46   return scm_from_int (int (ps->break_before_penalty ()));
47 }
48
49 LY_DEFINE (ly_paper_system_stencil, "ly:paper-system-stencil",
50            1, 0, 0, (SCM system),
51            "Return the height of @var{system}.")
52 {
53   Paper_system *ps = unsmob_paper_system (system);
54   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
55   return ps->to_stencil ().smobbed_copy ();
56 }
57
58 LY_DEFINE (ly_paper_system_staff_extent, "ly:paper-system-staff-extents",
59            1, 0, 0, (SCM system),
60            "Return the top and bottom staff refpoint.")
61 {
62   Paper_system *ps = unsmob_paper_system (system);
63   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
64   return ly_interval2scm (ps->staff_refpoints ());
65 }
66
67
68
69 LY_DEFINE (ly_paper_system_property, "ly:paper-system-property",
70            2, 1, 0, (SCM system, SCM sym, SCM dfault),
71            "Return the value for @var{sym}. Properties may be set by "
72            "setting the @code{line-break-system-details} property of "
73            "NonMusicalPaperColumn.  If the property is not found, "
74            "return @var{dfault}, "
75            "or @code{'()} if undefined.")
76 {
77   Paper_system *ps = unsmob_paper_system (system);
78   SCM_ASSERT_TYPE (ps, system, SCM_ARG1, __FUNCTION__, "paper-system");
79   if (dfault == SCM_UNDEFINED)
80     dfault = SCM_EOL;
81
82   SCM retval = ps->internal_get_property (sym);
83   if (retval == SCM_EOL)
84     return dfault;
85   else
86     return retval;
87 }
88
89