]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
* lily/melisma-engraver.cc (try_music): use melisma_busy()
[lilypond.git] / lily / system.cc
index 6731500db600efec6be0adda4488b8d824e389ea..4cf53c114a16577c16bfc05377330211598ad160 100644 (file)
@@ -3,7 +3,7 @@
 
   source file of the GNU LilyPond music typesetter
 
-  (c) 1996--2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 1996--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
 */
 
 #include "input-smob.hh"
@@ -45,6 +45,22 @@ System::element_count () const
   return scm_ilength (get_grob_property ("all-elements"));
 }
 
+int
+System::spanner_count () const
+{
+  int k =0;
+  for (SCM s = get_grob_property ("all-elements");
+       gh_pair_p (s); s = ly_cdr (s))
+    {
+      if (dynamic_cast<Spanner*> (unsmob_grob (gh_car(s))))
+       k++;
+    }
+
+  return k;
+}
+  
+
+
 void
 System::typeset_grob (Grob * elem)
 {
@@ -185,31 +201,6 @@ set_loose_columns (System* which, Column_x_positions const *posns)
        }
       while (1);
       
-    
-#if 0
-      Real rx = right->relative_coordinate (right->get_parent (X_AXIS), X_AXIS);
-      Real lx = left->relative_coordinate (left->get_parent (X_AXIS), X_AXIS);
-
-      /*
-       divide space equally over loose columns.
-       */
-      int j = 1;
-      loose = col;
-      while (1)
-       {
-         SCM between = loose->get_grob_property ("between-cols");
-         if (!gh_pair_p (between))
-           break;
-
-         Paper_column *thiscol = dynamic_cast<Paper_column*> (loose);
-
-         thiscol->system_ = which;
-         thiscol->translate_axis (lx + j*(rx - lx)/divide_over, X_AXIS);
-
-         j ++; 
-         loose = dynamic_cast<Item*> (unsmob_grob (ly_cdr (between)));
-       }
-#else
       /*
        We divide the remaining space of the column over the left and
        right side. At the moment, we  
@@ -247,7 +238,6 @@ set_loose_columns (System* which, Column_x_positions const *posns)
 
       col->system_ = which;
       col->translate_axis (lx + dx - cval[LEFT], X_AXIS); 
-#endif
     }
 }
 
@@ -259,7 +249,7 @@ System::break_into_pieces (Array<Column_x_positions> const &breaking)
     {
       System *system = dynamic_cast <System*> (clone ());
       system->rank_ = i;
-      //      system->set_immutable_grob_property ("rank", gh_int2scm (i));
+
       Link_array<Grob> c (breaking[i].cols_);
       pscore_->typeset_line (system);
       
@@ -290,7 +280,6 @@ System::output_molecule (SCM expr, Offset o)
        {
          Input * ip = unsmob_input (head);
       
-
          pscore_->outputter_->output_scheme (scm_list_n (ly_symbol2scm ("define-origin"),
                                                           scm_makfrom0str (ip->file_string ().to_str0 ()),
                                                           gh_int2scm (ip->line_number ()),
@@ -347,11 +336,6 @@ System::add_column (Paper_column*p)
   Axis_group_interface::add_element (me, p);
 }
 
-
-
-/*
-  TODO: use scm_map iso. for loops.
- */
 void
 System::pre_processing ()
 {
@@ -373,7 +357,7 @@ System::pre_processing ()
       sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
     }
   
-  progress_indication ("\n" + _ ("Calculating column positions...") + " ");
+  progress_indication ("\n" + _ ("Calculating line breaks...") + " ");
   for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
     {
       Grob * e = unsmob_grob (ly_car (s));
@@ -395,7 +379,7 @@ System::post_processing (bool last_line)
     }
 
   Interval i (extent (this, Y_AXIS));
-  if (i.empty_b ())
+  if (i.is_empty ())
     programming_error ("Huh?  Empty System?");
   else
     translate_axis (- i[MAX], Y_AXIS);
@@ -427,13 +411,16 @@ System::post_processing (bool last_line)
   /*
     line preamble.
    */
+  Interval j (extent (this, X_AXIS));
+  Real length = j[RIGHT];
+    
   output_scheme (scm_list_n (ly_symbol2scm ("start-system"),
+                         gh_double2scm (length),
                          gh_double2scm (height),
                          SCM_UNDEFINED));
   
   /* Output elements in three layers, 0, 1, 2.
      The default layer is 1. */
-
   {
     Molecule *m = this->get_molecule();
     if (m)
@@ -538,11 +525,11 @@ System::columns ()const
 
 
 ADD_INTERFACE (System,"system-interface",
-  "Super grob, parent of all:
-
-The columns of a score that form one line.  The toplevel grob.  Any
-grob has a Line_of_score as both X and Y reference point. The
-Paper_score contains one grob of this type. Control enters the
-Grob dependency calculation from this single Line_of_score
-object.",
+  "Super grob, parent of all: "
+"\n\n"
+"The columns of a score that form one line.  The toplevel grob.  Any "
+"grob has a Line_of_score as both X and Y reference point. The "
+"Paper_score contains one grob of this type. Control enters the "
+"Grob dependency calculation from this single Line_of_score "
+"object.",
   "between-system-string all-elements columns");