]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/system.cc
* lily/accidental-placement.cc (position_accidentals): bugfix in
[lilypond.git] / lily / system.cc
index 5fce3e22998e8de4711b0ab3f9b5cb76af9e64f3..61ab2ebbecd69b90bbe3dbc9b6d40b95701bf072 100644 (file)
@@ -43,17 +43,17 @@ System::System (SCM s)
 int
 System::element_count () const
 {
-  return scm_ilength (get_grob_property ("all-elements"));
+  return scm_ilength (get_property ("all-elements"));
 }
 
 int
 System::spanner_count () const
 {
   int k =0;
-  for (SCM s = get_grob_property ("all-elements");
+  for (SCM s = get_property ("all-elements");
        gh_pair_p (s); s = ly_cdr (s))
     {
-      if (dynamic_cast<Spanner*> (unsmob_grob (gh_car(s))))
+      if (dynamic_cast<Spanner*> (unsmob_grob (gh_car (s))))
        k++;
     }
 
@@ -82,8 +82,8 @@ uniquify_list (SCM l)
   int len = scm_ilength (l);
   SCM  * arr = new SCM[len];
   int k = 0;
-  for (SCM s =l ; SCM_NNULLP (s); s = SCM_CDR(s))
-    arr[k++] = SCM_CAR(s);
+  for (SCM s =l ; SCM_NNULLP (s); s = SCM_CDR (s))
+    arr[k++] = SCM_CAR (s);
 
   assert (k == len);
   qsort (arr, len, sizeof (SCM), &scm_default_compare);
@@ -95,14 +95,14 @@ uniquify_list (SCM l)
       if (i && arr[i] == arr[i-1])
        continue;
 
-      SCM_SETCAR(s, arr[i]);
+      SCM_SETCAR (s, arr[i]);
 
       if (i < len - 1)
-       s = SCM_CDR(s);
+       s = SCM_CDR (s);
     }
 
-  SCM_SETCDR(s, SCM_EOL);
-  delete arr;
+  SCM_SETCDR (s, SCM_EOL);
+  delete[] arr;
   
   return l; 
 }
@@ -121,7 +121,7 @@ System::typeset_grob (Grob * elem)
 void
 System::output_lines ()
 {
-  for (SCM s = get_grob_property ("all-elements");
+  for (SCM s = get_property ("all-elements");
        gh_pair_p (s); s = ly_cdr (s))
     {
       Grob * g = unsmob_grob (ly_car (s));
@@ -131,10 +131,10 @@ System::output_lines ()
            Kill no longer needed grobs. 
           */
          Item * it = dynamic_cast<Item*> (g);
-         if (it && Item::breakable_b(it))
+         if (it && Item::is_breakable (it))
            {
-             it->find_prebroken_piece (LEFT)->suicide();
-             it->find_prebroken_piece (RIGHT)->suicide();
+             it->find_prebroken_piece (LEFT)->suicide ();
+             it->find_prebroken_piece (RIGHT)->suicide ();
            }
          g->suicide ();
        }
@@ -149,7 +149,7 @@ System::output_lines ()
   for (int i=0; i < broken_intos_.size (); i++)
     {
       Grob *se = broken_intos_[i];
-      SCM all = se->get_grob_property ("all-elements");
+      SCM all = se->get_property ("all-elements");
       for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
        {
          fixup_refpoint (ly_car (s));
@@ -160,10 +160,10 @@ System::output_lines ()
   /*
     needed for doing items.
    */
-  fixup_refpoints (get_grob_property ("all-elements"));
+  fixup_refpoints (get_property ("all-elements"));
 
   
-  for (SCM s = get_grob_property ("all-elements");
+  for (SCM s = get_property ("all-elements");
        gh_pair_p (s); s = ly_cdr (s))
     {
       unsmob_grob (ly_car (s))->handle_broken_dependencies ();
@@ -171,10 +171,10 @@ System::output_lines ()
   handle_broken_dependencies ();
 
   /*
-    Because the this->get_grob_property (all-elements) contains items
+    Because the this->get_property (all-elements) contains items
     in 3 versions, handle_broken_dependencies () will leave duplicated
     items in all-elements. Strictly speaking this is harmless, but it
-    leads to duplicated symbols in the output. uniquify_list() makes
+    leads to duplicated symbols in the output. uniquify_list () makes
     sure that no duplicates are in the list.
    */
   for (int i=0; i < broken_intos_.size (); i++)
@@ -182,7 +182,7 @@ System::output_lines ()
       /*
        don't do this: strange side effects.
        */
-      //    SCM al = broken_intos_[i]->get_grob_property ("all-elements");
+      //    SCM al = broken_intos_[i]->get_property ("all-elements");
       //      al  = uniquify_list (al); 
     }
   
@@ -207,11 +207,11 @@ System::output_lines ()
 
       if (i < broken_intos_.size () - 1)
        {
-         SCM lastcol =  ly_car (system->get_grob_property ("columns"));
+         SCM lastcol =  ly_car (system->get_property ("columns"));
          Grob*  e = unsmob_grob (lastcol);
 
          SCM between = ly_symbol2scm ("between-system-string");
-         SCM inter = e->internal_get_grob_property (between);
+         SCM inter = e->internal_get_property (between);
          if (gh_string_p (inter))
            {
              pscore_->outputter_
@@ -244,7 +244,7 @@ set_loose_columns (System* which, Column_x_positions const *posns)
       Item * right = 0;
       do
        {
-         SCM between = loose->get_grob_property ("between-cols");
+         SCM between = loose->get_property ("between-cols");
          if (!gh_pair_p (between))
            break;
 
@@ -277,8 +277,8 @@ set_loose_columns (System* which, Column_x_positions const *posns)
       */
       Grob * common = right->common_refpoint (left, X_AXIS);
       
-      Real rx =        right->extent(common, X_AXIS)[LEFT];
-      Real lx = left->extent(common, X_AXIS)[RIGHT];
+      Real rx =        right->extent (common, X_AXIS)[LEFT];
+      Real lx = left->extent (common, X_AXIS)[RIGHT];
       Real total_dx = rx - lx;
       Interval cval =col->extent (col, X_AXIS);
 
@@ -394,12 +394,12 @@ void
 System::add_column (Paper_column*p)
 {
   Grob *me = this;
-  SCM cs = me->get_grob_property ("columns");
+  SCM cs = me->get_property ("columns");
   Grob * prev =  gh_pair_p (cs) ? unsmob_grob (ly_car (cs)) : 0;
 
   p->rank_ = prev ? Paper_column::get_rank (prev) + 1 : 0; 
 
-  me->set_grob_property ("columns",  gh_cons (p->self_scm (), cs));
+  me->set_property ("columns",  gh_cons (p->self_scm (), cs));
 
   Axis_group_interface::add_element (me, p);
 }
@@ -407,29 +407,29 @@ System::add_column (Paper_column*p)
 void
 System::pre_processing ()
 {
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+  for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
     unsmob_grob (ly_car (s))->discretionary_processing ();
 
   if (verbose_global_b)
     progress_indication (_f ("Grob count %d ",  element_count ()));
 
   
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+  for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
     unsmob_grob (ly_car (s))->handle_prebroken_dependencies ();
   
-  fixup_refpoints (get_grob_property ("all-elements"));
+  fixup_refpoints (get_property ("all-elements"));
   
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+  for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
     {
       Grob* sc = unsmob_grob (ly_car (s));
       sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
     }
   
   progress_indication ("\n" + _ ("Calculating line breaks...") + " ");
-  for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+  for (SCM s = get_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
     {
       Grob * e = unsmob_grob (ly_car (s));
-      SCM proc = e->get_grob_property ("spacing-procedure");
+      SCM proc = e->get_property ("spacing-procedure");
       if (gh_procedure_p (proc))
        gh_call1 (proc, e->self_scm ());
     }
@@ -443,7 +443,7 @@ System::pre_processing ()
 void
 System::post_processing (bool last_line)
 {
-  for (SCM s = get_grob_property ("all-elements");
+  for (SCM s = get_property ("all-elements");
        gh_pair_p (s); s = ly_cdr (s))
     {
       Grob* sc = unsmob_grob (ly_car (s));
@@ -466,19 +466,17 @@ System::post_processing (bool last_line)
 
   /*
     generate all stencils  to trigger all font loads.
-
-    (ugh. This is not very memory efficient.)  */
-
-  SCM all = get_grob_property ("all-elements")  ;
+  */
+  SCM all = get_property ("all-elements")  ;
   all = uniquify_list (all);
 
   /*
-    triger font loads first.
+    trigger font loads first.
 
     This might seem inefficient, but Stencils are cached per grob
     anyway.
     */
-  this->get_stencil();
+  this->get_stencil ();
   for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
     {
       Grob * g = unsmob_grob (ly_car (s));
@@ -507,13 +505,13 @@ System::post_processing (bool last_line)
   /* Output elements in three layers, 0, 1, 2.
      The default layer is 1. */
   {
-    Stencil *m = this->get_stencil();
+    Stencil *m = this->get_stencil ();
     if (m)
-      output_stencil (m->get_expr (), Offset(0,0));
+      output_stencil (m->get_expr (), Offset (0,0));
   }
   
   for (int i = 0; i < 3; i++)
-    for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s);
+    for (SCM s = get_property ("all-elements"); gh_pair_p (s);
         s = ly_cdr (s))
       {
        Grob *sc = unsmob_grob (ly_car (s));
@@ -521,7 +519,7 @@ System::post_processing (bool last_line)
        if (!m)
          continue;
        
-       SCM s = sc->get_grob_property ("layer");
+       SCM s = sc->get_property ("layer");
        int layer = gh_number_p (s) ? gh_scm2int (s) : 1;
        if (layer != i)
          continue;
@@ -529,7 +527,7 @@ System::post_processing (bool last_line)
        Offset o (sc->relative_coordinate (this, X_AXIS),
                  sc->relative_coordinate (this, Y_AXIS));
        
-       SCM e = sc->get_grob_property ("extra-offset");
+       SCM e = sc->get_property ("extra-offset");
        if (gh_pair_p (e))
          {
            Offset z = ly_scm2offset (e);
@@ -561,7 +559,7 @@ System::broken_col_range (Item const*l, Item const*r) const
 
   l = l->get_column ();
   r = r->get_column ();
-  SCM s = get_grob_property ("columns");
+  SCM s = get_property ("columns");
 
   while (gh_pair_p (s) && ly_car (s) != r->self_scm ())
     s = ly_cdr (s);
@@ -572,7 +570,7 @@ System::broken_col_range (Item const*l, Item const*r) const
   while (gh_pair_p (s) && ly_car (s) != l->self_scm ())
     {
       Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (ly_car (s)));
-      if (Item::breakable_b (c) && !c->system_)
+      if (Item::is_breakable (c) && !c->system_)
        ret.push (c);
 
       s = ly_cdr (s);
@@ -594,7 +592,7 @@ System::columns ()const
   bool bfound = false;
   for (int i= acs.size (); i -- ;)
     {
-      bool brb = Item::breakable_b (acs[i]);
+      bool brb = Item::is_breakable (acs[i]);
       bfound = bfound || brb;
 
       /*
@@ -612,11 +610,7 @@ System::columns ()const
 
 
 ADD_INTERFACE (System,"system-interface",
-  "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");
+              "This is the toplevel object: each object in a score "
+              "ultimately has a System object as its X and Y parent. "
+              ,
+              "between-system-string all-elements columns");