]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/spanner-scheme.cc
Imported Upstream version 2.14.2
[lilypond.git] / lily / spanner-scheme.cc
index d47e4f028509419217d888a2777f156204aa0c79..f2a9f0f939afd41b66b0218eb53fe348f35536ee 100644 (file)
@@ -1,10 +1,21 @@
-/* 
-  spanner-scheme.cc -- implement Spanner bindings.
-  
-  source file of the GNU LilyPond music typesetter
-  
-  (c) 2007--2009 Han-Wen Nienhuys <hanwen@lilypond.org>
+/*
+  This file is part of LilyPond, the GNU music typesetter.
+
+  Copyright (C) 2007--2011 Han-Wen Nienhuys <hanwen@lilypond.org>
   
+
+  LilyPond is free software: you can redistribute it and/or modify
+  it under the terms of the GNU General Public License as published by
+  the Free Software Foundation, either version 3 of the License, or
+  (at your option) any later version.
+
+  LilyPond is distributed in the hope that it will be useful,
+  but WITHOUT ANY WARRANTY; without even the implied warranty of
+  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+  GNU General Public License for more details.
+
+  You should have received a copy of the GNU General Public License
+  along with LilyPond.  If not, see <http://www.gnu.org/licenses/>.
 */
 
 #include "spanner.hh"
@@ -17,8 +28,21 @@ LY_DEFINE (ly_spanner_bound, "ly:spanner-bound",
 {
   LY_ASSERT_TYPE (unsmob_spanner, spanner, 1);
   LY_ASSERT_TYPE (is_direction, dir, 2);
-  
-  return unsmob_spanner (spanner)->get_bound (to_dir (dir))->self_scm ();
+  Item *bound = unsmob_spanner (spanner)->get_bound (to_dir (dir));
+  return bound ? bound->self_scm () : SCM_EOL;
+}
+
+LY_DEFINE (ly_spanner_set_bound_x, "ly:spanner-set-bound!",
+          3, 0, 0, (SCM spanner, SCM dir, SCM item),
+          "Set grob @var{item} as bound in direction @var{dir} for"
+          " @var{spanner}.")
+{
+  LY_ASSERT_TYPE (unsmob_spanner, spanner, 1);
+  LY_ASSERT_TYPE (is_direction, dir, 2);
+  LY_ASSERT_TYPE (unsmob_item, item, 3);
+
+  unsmob_spanner (spanner)->set_bound (to_dir (dir), unsmob_item (item));
+  return SCM_UNSPECIFIED;
 }
 
 /* TODO: maybe we should return a vector -- random access is more