]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/constrained-breaking.cc
Issue 5167/6: Changes: show \markup xxx = ... \etc assignments
[lilypond.git] / lily / constrained-breaking.cc
index d269cff48571d91fcfda5bd25a8ade3a0863d86b..df08d5433ce6cefd38c944448a80c20f0350c8cf 100644 (file)
@@ -1,7 +1,7 @@
 /*
   This file is part of LilyPond, the GNU music typesetter.
 
-  Copyright (C) 2006--2011 Joe Neeman <joeneeman@gmail.com>
+  Copyright (C) 2006--2015 Joe Neeman <joeneeman@gmail.com>
 
   LilyPond is free software: you can redistribute it and/or modify
   it under the terms of the GNU General Public License as published by
@@ -202,8 +202,10 @@ Constrained_breaking::solve (vsize start, vsize end, vsize sys_count)
         }
     }
   /* if we get to here, just put everything on one line */
-  warning (_ ("cannot find line breaking that satisfies constraints"));
-  ret.push_back (space_line (0, end_brk));
+  if (sys_count > 0) {
+    warning (_ ("cannot find line breaking that satisfies constraints"));
+    ret.push_back (space_line (0, end_brk));
+  }
   return ret;
 }
 
@@ -291,9 +293,11 @@ Constrained_breaking::line_details (vsize start, vsize end, vsize sys_count)
     }
 
   /* if we get to here, just put everything on one line */
-  Line_details details;
-  fill_line_details (&details, 0, end_brk);
-  ret.push_back (details);
+  if (sys_count > 0) {
+    Line_details details;
+    fill_line_details (&details, 0, end_brk);
+    ret.push_back (details);
+  }
   return ret;
 }
 
@@ -361,10 +365,10 @@ Constrained_breaking::Constrained_breaking (Paper_score *ps, vector<vsize> const
 static SCM
 min_permission (SCM perm1, SCM perm2)
 {
-  if (perm1 == ly_symbol2scm ("force"))
+  if (scm_is_eq (perm1, ly_symbol2scm ("force")))
     return perm2;
-  if (perm1 == ly_symbol2scm ("allow")
-      && perm2 != ly_symbol2scm ("force"))
+  if (scm_is_eq (perm1, ly_symbol2scm ("allow"))
+      && !scm_is_eq (perm2, ly_symbol2scm ("force")))
     return perm2;
   return SCM_EOL;
 }
@@ -517,7 +521,8 @@ Constrained_breaking::fill_line_details (Line_details *const out, vsize start, v
   out->title_space_ = system_markup_space_;
   out->inverse_hooke_ = out->full_height () + system_system_space_;
 
-  out->footnotes_ = sys->get_footnotes_in_range (start_rank, end_rank);
+  out->footnote_heights_ = sys->get_footnote_heights_in_range (start_rank, end_rank);
+  out->in_note_heights_ = sys->get_in_note_heights_in_range (start_rank, end_rank);
 
   out->refpoint_extent_ = sys->pure_refpoint_extent (start_rank, end_rank);
   if (out->refpoint_extent_.is_empty ())
@@ -554,11 +559,21 @@ Line_details::Line_details (Prob *pb, Output_def *paper)
 
   if (scm_is_pair (footnotes))
     for (SCM s = footnotes; scm_is_pair (s); s = scm_cdr (s))
-      footnotes_.push_back (unsmob_stencil (scm_caddar (s)));
+      {
+        Stencil *sten = unsmob<Stencil> (scm_caddar (s));
+        if (!sten)
+          {
+            programming_error ("expecting stencil, got empty pointer");
+            continue;
+          }
+        footnote_heights_.push_back (sten->extent (Y_AXIS).length ());
+      }
 
   last_column_ = 0;
   force_ = 0;
-  Interval stencil_extent = unsmob_stencil (pb->get_property ("stencil"))->extent (Y_AXIS);
+  Stencil *st = unsmob<Stencil> (pb->get_property ("stencil"));
+  Interval stencil_extent = st->is_empty (Y_AXIS) ? Interval (0, 0)
+    : st->extent (Y_AXIS);
   shape_ = Line_shape (stencil_extent, stencil_extent); // pretend it goes all the way across
   tallness_ = 0;
   bottom_padding_ = 0;