]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/skyline-pair.cc
lilypond-manuals.css: edit color scheme and some spacing
[lilypond.git] / lily / skyline-pair.cc
index 6175d1e27580655aca34bae9ec9d8acaebddbe3f..bab43494a6c68564cbae3886b64a543749a72c5f 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2008--2012 Han-Wen Nienhuys <hanwen@lilypond.org>
+  Copyright (C) 2008--2015 Han-Wen Nienhuys <hanwen@lilypond.org>
 
 
   LilyPond is free software: you can redistribute it and/or modify
@@ -21,7 +21,6 @@
 #include "skyline-pair.hh"
 
 #include "international.hh"
-#include "ly-smobs.icc"
 
 Skyline_pair::Skyline_pair ()
   : skylines_ (Skyline (DOWN), Skyline (UP))
@@ -55,13 +54,6 @@ Skyline_pair::raise (Real r)
   skylines_[DOWN].raise (r);
 }
 
-void
-Skyline_pair::deholify ()
-{
-  skylines_[UP].deholify ();
-  skylines_[DOWN].deholify ();
-}
-
 void
 Skyline_pair::shift (Real r)
 {
@@ -76,52 +68,6 @@ Skyline_pair::insert (Box const &b, Axis a)
   skylines_[DOWN].insert (b, a);
 }
 
-Real
-Skyline_pair::left () const
-{
-  return min (skylines_[UP].left (), skylines_[DOWN].left ());
-}
-
-Real
-Skyline_pair::right () const
-{
-  return max (skylines_[UP].right (), skylines_[DOWN].right ());
-}
-
-// This function comes with the same caveats as smallest_shift:
-// if the skylines are not contiguous, we may report false
-// intersections.
-bool
-Skyline_pair::intersects (Skyline_pair const &other) const
-{
-  return skylines_[UP].distance (other[DOWN]) > 0
-         && other[UP].distance (skylines_[DOWN]) > 0;
-}
-
-Real
-Skyline_pair::smallest_shift (Skyline_pair const &other, Direction d,
-                              Real h_pad, Real v_pad)
-{
-  // If skylines_[UP] avoids other[DOWN] or skylines_[DOWN] avoids
-  // other[UP] then we will not intersect.
-  // Note that this is not guaranteed to return the smallest shift
-  // if one Skyline_pair is not connected: the smallest_shift left
-  // in the case of
-  // AAA
-  // BBBBBB
-  //    AAA
-  // will result in
-  //    AAA
-  // BBBBBB
-  //       AAA
-  // even though the originals did not collide.  If it becomes necessary,
-  // this case could be handled by splitting the Skyline_pairs up into
-  // their connected components.
-
-  return d * min (d * skylines_[UP].smallest_shift (other[DOWN], d, h_pad, v_pad),
-                  d * skylines_[DOWN].smallest_shift (other[UP], d, h_pad, v_pad));
-}
-
 void
 Skyline_pair::merge (Skyline_pair const &other)
 {
@@ -136,6 +82,18 @@ Skyline_pair::print () const
   skylines_[DOWN].print ();
 }
 
+Real
+Skyline_pair::left () const
+{
+  return min (skylines_[UP].left (), skylines_[DOWN].left ());
+}
+
+Real
+Skyline_pair::right () const
+{
+  return max (skylines_[UP].right (), skylines_[DOWN].right ());
+}
+
 void
 Skyline_pair::print_points () const
 {
@@ -150,13 +108,6 @@ Skyline_pair::is_empty () const
          && skylines_[DOWN].is_empty ();
 }
 
-bool
-Skyline_pair::is_singleton () const
-{
-  return skylines_[UP].is_singleton ()
-         && skylines_[DOWN].is_singleton ();
-}
-
 Skyline &
 Skyline_pair::operator [] (Direction d)
 {
@@ -169,31 +120,14 @@ Skyline_pair::operator [] (Direction d) const
   return skylines_[d];
 }
 
-IMPLEMENT_SIMPLE_SMOBS (Skyline_pair);
-IMPLEMENT_TYPE_P (Skyline_pair, "ly:skyline-pair?");
-IMPLEMENT_DEFAULT_EQUAL_P (Skyline_pair);
+const char * const Skyline_pair::type_p_name_ = "ly:skyline-pair?";
 
-SCM
-Skyline_pair::mark_smob (SCM)
-{
-  return SCM_EOL;
-}
-
-int
-Skyline_pair::print_smob (SCM s, SCM port, scm_print_state *)
-{
-  Skyline_pair *r = (Skyline_pair *) SCM_CELL_WORD_1 (s);
-  (void) r;
-
-  scm_puts ("#<Skyline-pair>", 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);
+  Skyline_pair *sp = unsmob<Skyline_pair> (smob);
   Direction dir = robust_scm2dir (dir_scm, UP);
 
   if (dir == CENTER)