2 paper-system.cc -- implement Paper_system
4 source file of the GNU LilyPond music typesetter
6 (c) 2004--2005 Jan Nieuwenhuizen <janneke@gnu.org>
9 #include "paper-system.hh"
12 #include "ly-smobs.icc"
14 IMPLEMENT_SMOBS (Paper_system);
15 IMPLEMENT_TYPE_P (Paper_system, "ly:paper-system?");
16 IMPLEMENT_DEFAULT_EQUAL_P (Paper_system);
18 Paper_system::Paper_system (Stencil s, bool is_title)
22 break_before_penalty_ = 0;
25 staff_refpoints_ = Interval (0, 0);
28 Paper_system::~Paper_system ()
33 Paper_system::mark_smob (SCM smob)
35 Paper_system *system = (Paper_system *) SCM_CELL_WORD_1 (smob);
36 return system->stencil_.expr ();
40 Paper_system::print_smob (SCM smob, SCM port, scm_print_state*)
42 Paper_system *p = (Paper_system *) SCM_CELL_WORD_1 (smob);
43 scm_puts ("#<", port);
44 scm_puts (classname (p), port);
45 scm_puts ("n ", port);
46 scm_puts (to_string (p->number_).to_str0 (), port);
47 scm_puts (", p ", port);
48 scm_puts (to_string (p->break_before_penalty_).to_str0 (), port);
50 scm_puts (" t", port);
51 scm_puts (" >", port);
56 Paper_system::is_title () const
62 Paper_system::break_before_penalty () const
64 return break_before_penalty_;
68 Paper_system::to_stencil () const
74 Paper_system::read_left_bound (Item *left)
77 = robust_scm2double (left->get_property ("page-penalty"), 0.0);
80 = left->get_property ("line-break-system-details");
83 = scm_assoc (ly_symbol2scm ("Y-extent"), details);
86 = scm_assoc (ly_symbol2scm ("refpoint-Y-extent"), details);
88 if (scm_is_pair (yext)
89 && is_number_pair (scm_cdr (yext)))
91 Box b = stencil_.extent_box();
92 b[Y_AXIS] = ly_scm2interval (scm_cdr (yext));
94 stencil_ = Stencil (b, stencil_.expr ());
97 if (scm_is_pair (staff_ext)
98 && is_number_pair (scm_cdr (staff_ext)))
100 staff_refpoints_ = ly_scm2interval (scm_cdr (staff_ext));
105 Paper_system::staff_refpoints () const
107 return staff_refpoints_;