]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/dot-configuration.cc
Fix 790.
[lilypond.git] / lily / dot-configuration.cc
index 7676c14dd4cc3628d804b20016c147464d8aa862..559f83be2e1a2ae9990e4ac636dba5ae1d8316c7 100644 (file)
@@ -5,10 +5,12 @@
   terms of the GNU General Public License.  LilyPond comes with NO
   WARRANTY.
 
-  (c) 1997--2007 Han-Wen Nienhuys <hanwen@xs4all.nl>
+  (c) 1997--2009 Han-Wen Nienhuys <hanwen@xs4all.nl>
 */
 
+#include <cstdio>
 #include "dot-configuration.hh"
+#include "dot-formatting-problem.hh"
 #include "staff-symbol-referencer.hh"
 
 
@@ -47,7 +49,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 +62,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 +143,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;
+}