]> git.donarmstrong.com Git - lilypond.git/blob - lily/system-scheme.cc
284dc4102cdd632752036502cf0dc93655b9ea97
[lilypond.git] / lily / system-scheme.cc
1 /*
2   system-scheme.cc -- implement scheme bindings to System
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2007 Joe Neeman <joeneeman@gmail.com>
7 */
8
9 #include "align-interface.hh"
10 #include "pointer-group-interface.hh"
11 #include "system.hh"
12
13
14 LY_DEFINE (ly_system_print, "ly:system-print",
15            1, 0, 0, (SCM system),
16            "Draw the system and return the prob containing its"
17            " stencil.")
18 {
19   Grob *me = unsmob_grob (system);
20   System *me_system = dynamic_cast<System*> (me);
21   SCM_ASSERT_TYPE (me, system, SCM_ARG1, __FUNCTION__, "grob");
22
23   return me_system->get_paper_system ();
24 }
25
26 LY_DEFINE (ly_system_stretch, "ly:system-stretch",
27            2, 0, 0, (SCM system, SCM amount_scm),
28            "Stretch the system vertically by the given amount."
29            "  This must be called before the system is drawn (for example"
30            " with @code{ly:system-print}).")
31 {
32   Grob *me = unsmob_grob (system);
33   Real amount = robust_scm2double (amount_scm, 0.0);
34   
35   extract_grob_set (me, "elements", elts);
36   for (vsize i = 0; i < elts.size (); i++)
37     if (Align_interface::has_interface (elts[i]))
38       {
39         Align_interface::stretch (elts[i], amount, Y_AXIS);
40         break;
41       }
42   return SCM_UNDEFINED;
43 }