2 This file is part of LilyPond, the GNU music typesetter.
4 Copyright (C) 2008--2012 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 "international.hh"
24 #include "ly-smobs.icc"
26 Skyline_pair::Skyline_pair ()
27 : skylines_ (Skyline (DOWN), Skyline (UP))
31 Skyline_pair::Skyline_pair (vector<Box> const &boxes, Real padding, Axis a)
32 : skylines_ (Skyline (boxes, padding, a, DOWN), Skyline (boxes, padding, a, UP))
36 Skyline_pair::Skyline_pair (Box const &b, Real padding, Axis a)
37 : skylines_ (Skyline (b, padding, a, DOWN), Skyline (b, padding, a, UP))
42 Skyline_pair::raise (Real r)
44 skylines_[UP].raise (r);
45 skylines_[DOWN].raise (r);
49 Skyline_pair::shift (Real r)
51 skylines_[UP].shift (r);
52 skylines_[DOWN].shift (r);
56 Skyline_pair::insert (Box const &b, Real padding, Axis a)
58 skylines_[UP].insert (b, padding, a);
59 skylines_[DOWN].insert (b, padding, a);
63 Skyline_pair::merge (Skyline_pair const &other)
65 skylines_[UP].merge (other[UP]);
66 skylines_[DOWN].merge (other[DOWN]);
70 Skyline_pair::print () const
72 skylines_[UP].print ();
73 skylines_[DOWN].print ();
77 Skyline_pair::print_points () const
79 skylines_[UP].print ();
80 skylines_[DOWN].print ();
84 Skyline_pair::is_empty () const
86 return skylines_[UP].is_empty ()
87 && skylines_[DOWN].is_empty ();
91 Skyline_pair::operator [] (Direction d)
97 Skyline_pair::operator [] (Direction d) const
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)
113 Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
115 Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
118 scm_puts ("#<Skyline-pair>", port);
122 MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2);
124 Skyline_pair::skyline (SCM smob, SCM dir_scm)
126 Skyline_pair *sp = Skyline_pair::unsmob (smob);
127 Direction dir = robust_scm2dir (dir_scm, UP);
131 warning (_f ("direction must not be CENTER in ly:skyline-pair::skyline"));
135 return (*sp)[dir].smobbed_copy ();