]> git.donarmstrong.com Git - lilypond.git/blob - lily/skyline-pair.cc
add vcs lines to debian/control
[lilypond.git] / lily / skyline-pair.cc
1 /*
2   This file is part of LilyPond, the GNU music typesetter.
3
4   Copyright (C) 2008--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
5   
6
7   LilyPond is free software: you can redistribute it and/or modify
8   it under the terms of the GNU General Public License as published by
9   the Free Software Foundation, either version 3 of the License, or
10   (at your option) any later version.
11
12   LilyPond is distributed in the hope that it will be useful,
13   but WITHOUT ANY WARRANTY; without even the implied warranty of
14   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15   GNU General Public License for more details.
16
17   You should have received a copy of the GNU General Public License
18   along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
19 */
20
21 #include "skyline-pair.hh"
22
23 #include "ly-smobs.icc"
24
25 Skyline_pair::Skyline_pair ()
26   : skylines_ (Skyline (DOWN), Skyline (UP))
27 {
28 }
29
30 Skyline_pair::Skyline_pair (vector<Box> const &boxes, Real padding, Axis a)
31   : skylines_ (Skyline (boxes, padding, a, DOWN), Skyline (boxes, padding, a, UP))
32 {
33 }
34
35 Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a)
36   : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP))
37 {
38 }
39
40 void
41 Skyline_pair::raise (Real r)
42 {
43   skylines_[UP].raise (r);
44   skylines_[DOWN].raise (r);
45 }
46
47 void
48 Skyline_pair::shift (Real r)
49 {
50   skylines_[UP].shift (r);
51   skylines_[DOWN].shift (r);
52 }
53
54 void
55 Skyline_pair::insert (Box const &b, Real padding, Axis a)
56 {
57   skylines_[UP].insert (b, padding, a);
58   skylines_[DOWN].insert (b, padding, a);
59 }
60
61 void
62 Skyline_pair::merge (Skyline_pair const &other)
63 {
64   skylines_[UP].merge (other[UP]);
65   skylines_[DOWN].merge (other[DOWN]);
66 }
67
68 void
69 Skyline_pair::print () const
70 {
71   skylines_[UP].print ();
72   skylines_[DOWN].print ();
73 }
74
75 void
76 Skyline_pair::print_points () const
77 {
78   skylines_[UP].print ();
79   skylines_[DOWN].print ();
80 }
81
82
83 bool
84 Skyline_pair::is_empty () const
85 {
86   return skylines_[UP].is_empty ()
87     && skylines_[DOWN].is_empty ();
88 }
89
90 Skyline&
91 Skyline_pair::operator [] (Direction d)
92 {
93   return skylines_[d];
94 }
95
96 Skyline const&
97 Skyline_pair::operator [] (Direction d) const
98 {
99   return skylines_[d];
100 }
101
102 IMPLEMENT_SIMPLE_SMOBS (Skyline_pair);
103 IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?");
104 IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair);
105
106 SCM
107 Skyline_pair::mark_smob (SCM)
108 {
109   return SCM_EOL;
110 }
111
112 int
113 Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
114 {
115   Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
116   (void) r;
117
118   scm_puts ("#<Skyline-pair>", port);
119   return 1;
120 }