]> git.donarmstrong.com Git - lilypond.git/blob - lily/paper-system.cc
Update.
[lilypond.git] / lily / paper-system.cc
1 /*
2   paper-system.cc -- implement Paper_system
3
4   source file of the GNU LilyPond music typesetter
5
6   (c) 2004--2005 Jan Nieuwenhuizen <janneke@gnu.org>
7 */
8
9 #include "paper-system.hh"
10
11 #include "virtual-methods.hh"
12
13 #include "ly-smobs.icc"
14
15 IMPLEMENT_SMOBS (Paper_system);
16 IMPLEMENT_TYPE_P (Paper_system, "ly:paper-system?");
17 IMPLEMENT_DEFAULT_EQUAL_P (Paper_system);
18
19 Paper_system::Paper_system (Stencil s, bool is_title)
20 {
21   is_title_ = is_title;
22   number_ = 0;
23   break_before_penalty_ = 0;
24   smobify_self ();
25   stencil_ = s;
26   staff_refpoints_ = Interval (0, 0);
27 }
28
29 Paper_system::~Paper_system ()
30 {
31 }
32
33 SCM
34 Paper_system::mark_smob (SCM smob)
35 {
36   Paper_system *system = (Paper_system *) SCM_CELL_WORD_1 (smob);
37   return system->stencil_.expr ();
38 }
39
40 int
41 Paper_system::print_smob (SCM smob, SCM port, scm_print_state*)
42 {
43   Paper_system *p = (Paper_system *) SCM_CELL_WORD_1 (smob);
44   scm_puts ("#<", port);
45   scm_puts (classname (p), port);
46   scm_puts ("n ", port);
47   scm_puts (to_string (p->number_).to_str0 (), port);
48   scm_puts (", p ", port);
49   scm_puts (to_string (p->break_before_penalty_).to_str0 (), port);
50   if (p->is_title ())
51     scm_puts (" t", port);
52   scm_puts (" >", port);
53   return 1;
54 }
55
56 bool
57 Paper_system::is_title () const
58 {
59   return is_title_;
60 }
61
62 Real
63 Paper_system::break_before_penalty () const
64 {
65   return break_before_penalty_;
66 }
67
68 Stencil
69 Paper_system::to_stencil () const
70 {
71   return stencil_;
72 }