]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dot-configuration.cc
Midi2ly: add channel debugging.
[lilypond.git] / lily / dot-configuration.cc
index 7676c14dd4cc3628d804b20016c147464d8aa862..b72bd54ef7d7c842cbf59b11948cd83a98abbe0c 100644 (file)
@@ -1,14 +1,25 @@
 /*
-  dot-implement.cc -- declare Dot_configuration
+  This file is part of LilyPond, the GNU music typesetter.
 
-  Source file of the GNU LilyPond music typesetter.  Distributed under
-  terms of the GNU General Public License.  LilyPond comes with NO
-  WARRANTY.
+  Copyright (C) 1997--2011 Han-Wen Nienhuys <hanwen@xs4all.nl>
 
-  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  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 <cstdio>
 #include "dot-configuration.hh"
+#include "dot-formatting-problem.hh"
 #include "staff-symbol-referencer.hh"
 
 
@@ -47,7 +58,7 @@ Dot_configuration::print () const
   for (Dot_configuration::const_iterator i (begin ());
        i != end (); i++)
     printf ("%d, ", i->first);
-  printf ("} \n");
+  printf ("}\n");
 }
 
 /*
@@ -60,7 +71,7 @@ Dot_configuration::print () const
 Dot_configuration
 Dot_configuration::shifted (int k, Direction d) const
 {
-  Dot_configuration new_cfg;
+  Dot_configuration new_cfg (*problem_);
   int offset = 0;
 
   if (d > 0)
@@ -141,3 +152,19 @@ Dot_configuration::remove_collision (int p)
       *this = (b_up < b_down) ? cfg_up : cfg_down;
     }
 }
+
+Dot_configuration::Dot_configuration (Dot_formatting_problem const &problem)
+{
+  problem_ = &problem;
+}
+
+Real
+Dot_configuration::x_offset () const
+{
+  Real off = 0.0;
+  for (Dot_configuration::const_iterator i (begin ());
+       i != end (); i++)
+    off = max (off, problem_->head_skyline_.height ((*i).first));
+
+  return off;
+}