X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fskyline-pair.cc;h=6f6b4e1b889b5bf0529c0069cfd374bfe507e98a;hb=d83a0cf0693c3119aa0f2861ec2db4405d3ea31e;hp=2f7ea73575a7e70347de237308d1c44a3e25a20c;hpb=1c846b2c2348b4e0ca4a3c2e8fb267047ba2d203;p=lilypond.git diff --git a/lily/skyline-pair.cc b/lily/skyline-pair.cc index 2f7ea73575..6f6b4e1b88 100644 --- a/lily/skyline-pair.cc +++ b/lily/skyline-pair.cc @@ -1,8 +1,8 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 2008--2011 Han-Wen Nienhuys - + Copyright (C) 2008--2012 Han-Wen Nienhuys + LilyPond is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by @@ -20,6 +20,7 @@ #include "skyline-pair.hh" +#include "international.hh" #include "ly-smobs.icc" Skyline_pair::Skyline_pair () @@ -79,21 +80,20 @@ Skyline_pair::print_points () const skylines_[DOWN].print (); } - bool Skyline_pair::is_empty () const { return skylines_[UP].is_empty () - && skylines_[DOWN].is_empty (); + && skylines_[DOWN].is_empty (); } -Skyline& +Skyline & Skyline_pair::operator [] (Direction d) { return skylines_[d]; } -Skyline const& +Skyline const & Skyline_pair::operator [] (Direction d) const { return skylines_[d]; @@ -118,3 +118,19 @@ Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *) scm_puts ("#", port); return 1; } + +MAKE_SCHEME_CALLBACK (Skyline_pair, skyline, 2); +SCM +Skyline_pair::skyline (SCM smob, SCM dir_scm) +{ + Skyline_pair *sp = Skyline_pair::unsmob (smob); + Direction dir = robust_scm2dir (dir_scm, UP); + + if (dir == CENTER) + { + warning (_f ("direction must not be CENTER in ly:skyline-pair::skyline")); + dir = UP; + } + + return (*sp)[dir].smobbed_copy (); +}