]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/paper-column.cc
* lily/paper-column.cc (before_line_breaking): urg. bugfix.
[lilypond.git] / lily / paper-column.cc
index 3f7d17a4000f3c37917a2df4c375956a4ff0e8c8..df02af8fa84494e0b6cd2c1ad49a6c1615590397 100644 (file)
@@ -9,7 +9,7 @@
 #include "moment.hh"
 #include "paper-column.hh"
 #include "paper-score.hh"
-#include "debug.hh"
+#include "warn.hh"
 #include "axis-group-interface.hh"
 #include "spaceable-grob.hh"
 #include "molecule.hh"
 #include "font-interface.hh"
 
 
-/*
-  Paper_columns form the top-most item parent. (The Paper_columns X
+
+
+
+ADD_INTERFACE (Paper_column, "paper-column-interface",
+  "  Paper_columns form the top-most item parent. (The Paper_columns X
   parent is System, which is a spanner.)
 
   Paper_columns form the units for the spacing engine. They are
   Since many columns go unused, you should only use the rank field to
   get ordering information.  Two adjacent columns may have
   non-adjacent numbers.
-  
- */
+
+  Don't be confused by right-items: each spacing wish can also contain
+  a number of items, with which a spacing constraint may be kept. It's
+  a little baroque, but it might come in handy later on?
+
+",
+  "between-cols between-system-string when bounded-by-me shortest-playing-duration shortest-starter-duration");
+
 
 void
 Paper_column::do_break_processing ()
@@ -39,6 +48,7 @@ Paper_column::do_break_processing ()
   Item::do_break_processing ();
 }
 
+
 int
 Paper_column::rank_i (Grob*me) 
 {
@@ -60,10 +70,6 @@ Paper_column::column_l () const
 Paper_column::Paper_column (SCM l)
   : Item (l)           // guh.?
 {
-  Axis_group_interface::set_interface (this);
-  Axis_group_interface::set_axes (this, X_AXIS, X_AXIS);
-  Spaceable_grob::set_interface (this);
-
   line_l_=0;
   rank_i_ = -1;
 }
@@ -127,3 +133,36 @@ Paper_column::brew_molecule (SCM p)
   return t.smobbed_copy ();                                            
 }
 
+/*
+  This is all too hairy. We use bounded-by-me to make sure that some
+  columns are kept "alive". Unfortunately, when spanners are suicided,
+  this falls apart again. (sigh.)
+
+  THIS IS BROKEN KLUDGE. WE SHOULD INVENT SOMETHING BETTER. 
+ */
+MAKE_SCHEME_CALLBACK(Paper_column,before_line_breaking,1);
+SCM
+Paper_column::before_line_breaking (SCM grob)
+{
+  Grob *me = unsmob_grob (grob);
+
+  SCM c = me->get_grob_property ("bounded-by-me");
+  SCM *ptrptr = &c;
+
+  while (gh_pair_p (*ptrptr))
+    {
+      Grob * g = unsmob_grob (gh_car (*ptrptr));
+
+      if (!g || !g->live ())
+       {
+         *ptrptr = gh_cdr (*ptrptr);
+       }
+      else
+       {
+         ptrptr = SCM_CDRLOC (*ptrptr);
+       }
+    }
+
+  me->set_grob_property ("bounded-by-me", c);
+  return SCM_UNSPECIFIED;
+}