]> git.donarmstrong.com Git - lilypond.git/blobdiff - lily/axis-group-interface.cc
patch::: 1.5.14.jcn1
[lilypond.git] / lily / axis-group-interface.cc
index f7e8c22bf166e60e022a7ff8694a63a0fdbdbf89..02960f6aba86bc48e5214622d2e9c5e7356483a4 100644 (file)
@@ -3,30 +3,30 @@
   
   source file of the GNU LilyPond music typesetter
   
-  (c) 2000 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+  (c) 2000--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
   
  */
 #include "hara-kiri-group-spanner.hh"
 #include "axis-group-interface.hh"
-#include "score-element.hh"
+#include "grob.hh"
 
 void
-Axis_group_interface::add_element (Score_element*me,Score_element *e)
+Axis_group_interface::add_element (Grob*me,Grob *e)
 {
-  for (SCM ax = me->get_elt_property ("axes"); ax != SCM_EOL ; ax = gh_cdr (ax))
+  for (SCM ax = me->get_grob_property ("axes"); ax != SCM_EOL ; ax = ly_cdr (ax))
     {
-      Axis a = (Axis) gh_scm2int (gh_car (ax));
+      Axis a = (Axis) gh_scm2int (ly_car (ax));
       
       if (!e->parent_l (a))
        e->set_parent (me, a);
     }
 
-  Pointer_group_interface (me).add_element (e);
+  Pointer_group_interface::add_element (me, "elements", e);
   me->add_dependency (e);
 }
 
 bool
-Axis_group_interface::axis_b (Score_element*me,Axis a )
+Axis_group_interface::axis_b (Grob*me,Axis a)
 {
   /*
     urg. FIXME, check for Hara_kiri_group_spanner shouldn't be necessary?
@@ -34,54 +34,52 @@ Axis_group_interface::axis_b (Score_element*me,Axis a )
     
    */
   return me->has_extent_callback_b (group_extent_callback_proc, a) ||
   (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent_proc, a));
+ (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent_proc, a));
 }
 
 Interval
-Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM elts)
+Axis_group_interface::relative_group_extent (Axis a, Grob *common, SCM elts)
 {
   Interval r;
-  for (SCM s = elts; gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = elts; gh_pair_p (s); s = ly_cdr (s))
     {
-      Score_element * se = unsmob_element (gh_car (s));
-      Interval dims = se->extent (a);
+      Grob * se = unsmob_grob (ly_car (s));
+      Interval dims = se->extent (common, a);
       if (!dims.empty_b ())
-       r.unite (dims + se->relative_coordinate (common, a));
+       r.unite (dims);
     }
   return r;
 }
 
-MAKE_SCHEME_CALLBACK(Axis_group_interface,group_extent_callback,2);
+MAKE_SCHEME_CALLBACK (Axis_group_interface,group_extent_callback,2);
 SCM
 Axis_group_interface::group_extent_callback (SCM element_smob, SCM scm_axis)
 {
-  Score_element *me = unsmob_element (element_smob);
+  Grob *me = unsmob_grob (element_smob);
   Axis a = (Axis) gh_scm2int (scm_axis);
 
-  Score_element * common =(Score_element*) me;
+  Grob * common = (Grob*) me;
 
-  for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
+  for (SCM s = me->get_grob_property ("elements"); gh_pair_p (s); s = ly_cdr (s))
     {
-      Score_element * se = unsmob_element (gh_car (s));
+      Grob * se = unsmob_grob (ly_car (s));
       common = se->common_refpoint (common, a);
     }
 
   Real my_coord = me->relative_coordinate (common, a);
-  Interval r (relative_group_extent (a, common, me->get_elt_property ("elements")));
+  Interval r (relative_group_extent (a, common, me->get_grob_property ("elements")));
 
   return ly_interval2scm (r - my_coord);
 }
 
-
-
 void
-Axis_group_interface::set_axes (Score_element*me,Axis a1, Axis a2)
+Axis_group_interface::set_axes (Grob*me,Axis a1, Axis a2)
 {
   // set_interface () ?
   SCM sa1= gh_int2scm (a1);
   SCM sa2 = gh_int2scm (a2);
 
-  SCM axes = me->get_elt_property ("axes");
+  SCM axes = me->get_grob_property ("axes");
   
   if (!gh_pair_p (axes)
       || scm_memq (sa1, axes) == SCM_BOOL_F
@@ -90,7 +88,7 @@ Axis_group_interface::set_axes (Score_element*me,Axis a1, Axis a2)
       SCM ax = gh_cons (sa1, SCM_EOL);
       if (a1 != a2)
        ax= gh_cons (sa2, ax);
-      me->set_elt_property ("axes", ax);
+      me->set_grob_property ("axes", ax);
     }
 
   if (a1 != X_AXIS && a2 != X_AXIS)
@@ -101,24 +99,24 @@ Axis_group_interface::set_axes (Score_element*me,Axis a1, Axis a2)
   /*
     why so convoluted ? (fixme/documentme?) 
    */
-  if (me->has_extent_callback_b (Score_element::molecule_extent_proc, a1))
+  if (me->has_extent_callback_b (Grob::molecule_extent_proc, a1))
     me->set_extent_callback (Axis_group_interface::group_extent_callback_proc,a1);
-  if (me->has_extent_callback_b (Score_element::molecule_extent_proc, a2))
+  if (me->has_extent_callback_b (Grob::molecule_extent_proc, a2))
     me->set_extent_callback (Axis_group_interface::group_extent_callback_proc,a2);
 }
 
-Link_array<Score_element
-Axis_group_interface::get_children (Score_element*me)
+Link_array<Grob
+Axis_group_interface::get_children (Grob*me)
 {
-  Link_array<Score_element> childs;
+  Link_array<Grob> childs;
   childs.push (me) ;
 
   if (!has_interface (me))
     return childs;
   
-  for (SCM ep = me->get_elt_property ("elements"); gh_pair_p (ep); ep = gh_cdr (ep))
+  for (SCM ep = me->get_grob_property ("elements"); gh_pair_p (ep); ep = ly_cdr (ep))
     {
-      Score_element* e = unsmob_element (gh_car (ep));
+      Grob* e = unsmob_grob (ly_car (ep));
       if (e)
        childs.concat (Axis_group_interface::get_children (e));
     }
@@ -127,15 +125,13 @@ Axis_group_interface::get_children (Score_element*me)
 }
 
 bool
-Axis_group_interface::has_interface (Score_element*me)
+Axis_group_interface::has_interface (Grob*me)
 {
   return me && me->has_interface (ly_symbol2scm ("axis-group-interface"));
 }
 
-
-
 void
-Axis_group_interface::set_interface (Score_element*me)
+Axis_group_interface::set_interface (Grob*me)
 {
   if (!has_interface (me))
     {