LSR: Update.
[lilypond/mpolesky.git] / lily / skyline-pair.cc
blob92b25577a28c8e77e76a4b38b06652deec3381fb
1 /*
2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2008--2010 Han-Wen Nienhuys <hanwen@lilypond.org>
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.
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.
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/>.
21 #include "skyline-pair.hh"
23 #include "ly-smobs.icc"
25 Skyline_pair::Skyline_pair ()
26 : skylines_ (Skyline (DOWN), Skyline (UP))
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))
35 Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a)
36 : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP))
40 void
41 Skyline_pair::raise (Real r)
43 skylines_[UP].raise (r);
44 skylines_[DOWN].raise (r);
47 void
48 Skyline_pair::shift (Real r)
50 skylines_[UP].shift (r);
51 skylines_[DOWN].shift (r);
54 void
55 Skyline_pair::insert (Box const &b, Real padding, Axis a)
57 skylines_[UP].insert (b, padding, a);
58 skylines_[DOWN].insert (b, padding, a);
61 void
62 Skyline_pair::merge (Skyline_pair const &other)
64 skylines_[UP].merge (other[UP]);
65 skylines_[DOWN].merge (other[DOWN]);
68 void
69 Skyline_pair::print () const
71 skylines_[UP].print ();
72 skylines_[DOWN].print ();
75 void
76 Skyline_pair::print_points () const
78 skylines_[UP].print ();
79 skylines_[DOWN].print ();
83 bool
84 Skyline_pair::is_empty () const
86 return skylines_[UP].is_empty ()
87 && skylines_[DOWN].is_empty ();
90 Skyline&
91 Skyline_pair::operator [] (Direction d)
93 return skylines_[d];
96 Skyline const&
97 Skyline_pair::operator [] (Direction d) const
99 return skylines_[d];
102 IMPLEMENT_SIMPLE_SMOBS (Skyline_pair);
103 IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?");
104 IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair);
107 Skyline_pair::mark_smob (SCM)
109 return SCM_EOL;
113 Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
115 Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
116 (void) r;
118 scm_puts ("#<Skyline-pair>", port);
119 return 1;