]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
Several fixes for annotate-spacing.
[lilypond.git] / lily / system.cc
index 8a071cce90c9d89e6f88816eba4cfc43867ed0f1..f4a37cd24dfa66d13eb4f891cf7c02cea064abfa 100644 (file)
@@ -38,6 +38,7 @@
 #include "staff-symbol-referencer.hh"
 #include "text-interface.hh"
 #include "warn.hh"
+#include "unpure-pure-container.hh"
 
 System::System (System const &src)
   : Spanner (src)
@@ -197,8 +198,7 @@ System::do_break_substitution_and_fixup_refpoints ()
         }
     }
 
-  if (be_verbose_global)
-    message (_f ("Element count %d", count + element_count ()) + "\n");
+  debug_output (_f ("Element count %d", count + element_count ()) + "\n");
 }
 
 SCM
@@ -216,16 +216,14 @@ System::get_paper_systems ()
   SCM lines = scm_c_make_vector (broken_intos_.size (), SCM_EOL);
   for (vsize i = 0; i < broken_intos_.size (); i++)
     {
-      if (be_verbose_global)
-        progress_indication ("[");
+      debug_output ("[", false);
 
       System *system = dynamic_cast<System *> (broken_intos_[i]);
 
       scm_vector_set_x (lines, scm_from_int (i),
                         system->get_paper_system ());
 
-      if (be_verbose_global)
-        progress_indication (to_string (i) + "]");
+      debug_output (to_string (i) + "]", false);
     }
   return lines;
 }
@@ -398,8 +396,7 @@ System::pre_processing ()
   for (vsize i = 0; i < all_elements_->size (); i++)
     all_elements_->grob (i)->discretionary_processing ();
 
-  if (be_verbose_global)
-    message (_f ("Grob count %d", element_count ()));
+  debug_output (_f ("Grob count %d", element_count ()));
 
   /*
     order is significant: broken grobs are added to the end of the
@@ -540,6 +537,9 @@ System::get_paper_system ()
   pl->set_property ("page-break-penalty", right_bound->get_property ("page-break-penalty"));
   pl->set_property ("page-turn-penalty", right_bound->get_property ("page-turn-penalty"));
 
+  if (right_bound->original () == dynamic_cast<System*> (original ())->get_bound (RIGHT))
+    pl->set_property ("last-in-score", SCM_BOOL_T);
+
   Interval staff_refpoints;
   if (Grob *align = get_vertical_alignment ())
     {
@@ -840,6 +840,63 @@ System::get_maybe_pure_bound (Direction d, bool pure, int start, int end)
   return pure ? get_pure_bound (d, start, end) : get_bound (d);
 }
 
+enum {
+  SPACEABLE_STAVES,
+  NONSPACEABLE_STAVES,
+  ALL_STAVES
+};
+
+static SCM
+get_maybe_spaceable_staves (SCM smob, int filter)
+{
+  System *me = dynamic_cast<System*> (unsmob_grob (smob));
+  Grob *align = me->get_vertical_alignment ();
+  SCM ret = SCM_EOL;
+
+  if (align)
+    {
+      SCM *tail = &ret;
+      extract_grob_set (align, "elements", staves);
+
+      for (vsize i = 0; i < staves.size (); ++i)
+        {
+          bool spaceable = Page_layout_problem::is_spaceable (staves[i]);
+          if (staves[i]->is_live () &&
+              ((filter == ALL_STAVES)
+               || (filter == SPACEABLE_STAVES && spaceable)
+               || (filter == NONSPACEABLE_STAVES && !spaceable)))
+            {
+              *tail = scm_cons (staves[i]->self_scm (), SCM_EOL);
+              tail = SCM_CDRLOC (*tail);
+            }
+        }
+    }
+
+  return ret;
+}
+
+MAKE_SCHEME_CALLBACK (System, get_staves, 1)
+SCM
+System::get_staves (SCM smob)
+{
+  return get_maybe_spaceable_staves (smob, ALL_STAVES);
+}
+
+MAKE_SCHEME_CALLBACK (System, get_spaceable_staves, 1)
+SCM
+System::get_spaceable_staves (SCM smob)
+{
+  return get_maybe_spaceable_staves (smob, SPACEABLE_STAVES);
+}
+
+MAKE_SCHEME_CALLBACK (System, get_nonspaceable_staves, 1)
+SCM
+System::get_nonspaceable_staves (SCM smob)
+{
+  return get_maybe_spaceable_staves (smob, NONSPACEABLE_STAVES);
+}
+
+
 ADD_INTERFACE (System,
                "This is the top-level object: Each object in a score"
                " ultimately has a @code{System} object as its X and"