]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/rest-collision.cc
patch::: 1.3.62.hwn1
[lilypond.git] / lily / rest-collision.cc
index df842f8f33cbdf5c273f687f9df7fd14adbd2617..a72e0504e30807a98188f432a72c7c813cde513c 100644 (file)
@@ -24,7 +24,7 @@ void
 Rest_collision::add_column (Note_column *nc_l)
 {
   add_dependency (nc_l);
-  Group_interface gi (this);  
+  Pointer_group_interface gi (this);  
   if (nc_l->rest_b ())
     gi.name_ = "rests";
   else
@@ -48,23 +48,28 @@ rhythmic_head2mom (Rhythmic_head* r)
   return to_duration (r->balltype_i (), r->dot_count ()).length_mom ();
 }
 
+/*
+  ugh
+ */
 static Rhythmic_head*
 col2rhythmic_head (Note_column* c)
 {
-  SCM s = c->get_elt_property ("rests");
+  SCM s = c->get_elt_pointer ("rests");
   assert (gh_pair_p (s));
   Score_element* e = unsmob_element (gh_car (s));
   return dynamic_cast<Rhythmic_head*> (e);
 }
 
-void
-Rest_collision::before_line_breaking ()
+GLUE_SCORE_ELEMENT(Rest_collision,after_line_breaking);
+
+SCM
+Rest_collision::member_after_line_breaking ()
 {
   Link_array<Note_column> rest_l_arr =
-    Group_interface__extract_elements (this, (Note_column*) 0, "rests");
+    Pointer_group_interface__extract_elements (this, (Note_column*) 0, "rests");
   Link_array<Note_column> ncol_l_arr =
-    Group_interface__extract_elements (this, (Note_column*) 0, "notes");
-                                     
+    Pointer_group_interface__extract_elements (this, (Note_column*) 0, "notes");
+
   
   /* 
      handle rest-rest and rest-note collisions
@@ -77,11 +82,11 @@ Rest_collision::before_line_breaking ()
 
   // no rests to collide
   if (!rest_l_arr.size())
-    return;
+    return SCM_UNDEFINED;
 
   // no partners to collide with
   if (rest_l_arr.size() + ncol_l_arr.size () < 2)
-    return;
+    return SCM_UNDEFINED;
 
   // meisjes met meisjes
   if (!ncol_l_arr.size()) 
@@ -109,7 +114,7 @@ Rest_collision::before_line_breaking ()
          display_count = gh_scm2int (s);
          for (; i > display_count; i--)
            col2rhythmic_head (rest_l_arr[i-1])
-             ->set_elt_property ("transparent", SCM_BOOL_T);
+             ->set_elt_property ("molecule-callback", SCM_BOOL_T);
        }
       else
        display_count = rest_l_arr.size ();
@@ -142,7 +147,7 @@ Rest_collision::before_line_breaking ()
 
       Interval restdim = rcol->rest_dim ();
       if (restdim.empty_b ())
-       return;
+       return SCM_UNDEFINED;
       
       // staff ref'd?
       Real staff_space = paper_l()->get_var ("interline");
@@ -185,14 +190,15 @@ Rest_collision::before_line_breaking ()
       
       rcol->translate_rests (dir * discrete_dist);
     }
+  return SCM_UNDEFINED;
 }
 
 
-Rest_collision::Rest_collision()
+Rest_collision::Rest_collision(SCM s)
+  : Item (s)
 {
-  set_elt_property ("rests", SCM_EOL);
-  set_elt_property ("notes", SCM_EOL);
-  set_elt_property ("transparent", SCM_BOOL_T);
+  set_elt_pointer ("rests", SCM_EOL);
+  set_elt_pointer ("notes", SCM_EOL);
   set_extent_callback (0, X_AXIS);
   set_extent_callback (0, Y_AXIS);
 }