]> git.donarmstrong.com Git - lilypond.git/commitdiff
lilypond-1.3.94
authorfred <fred>
Tue, 26 Mar 2002 23:56:56 +0000 (23:56 +0000)
committerfred <fred>
Tue, 26 Mar 2002 23:56:56 +0000 (23:56 +0000)
12 files changed:
lily/axis-group-interface.cc
lily/bar.cc
lily/collision.cc
lily/dot-column.cc
lily/include/score-element.hh
lily/item.cc
lily/rest-collision.cc
lily/separation-item.cc
lily/spacing-spanner.cc
lily/sustain-pedal.cc
lily/text-item.cc
lily/tie-column.cc

index 4d7db9b45210cb619abc8d113a6f95000eaf7014..f7e8c22bf166e60e022a7ff8694a63a0fdbdbf89 100644 (file)
@@ -33,8 +33,8 @@ Axis_group_interface::axis_b (Score_element*me,Axis a )
 
     
    */
-  return me->has_extent_callback_b (group_extent_callback, a) ||
-    (me->has_extent_callback_b (Hara_kiri_group_spanner::y_extent, 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));
 }
 
 Interval
@@ -51,9 +51,13 @@ Axis_group_interface::relative_group_extent (Axis a, Score_element *common, SCM
   return r;
 }
 
-Interval
-Axis_group_interface::group_extent_callback (Score_element *me, Axis a)
+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);
+  Axis a = (Axis) gh_scm2int (scm_axis);
+
   Score_element * common =(Score_element*) me;
 
   for (SCM s = me->get_elt_property ("elements"); gh_pair_p (s); s = gh_cdr (s))
@@ -65,7 +69,7 @@ Axis_group_interface::group_extent_callback (Score_element *me, Axis a)
   Real my_coord = me->relative_coordinate (common, a);
   Interval r (relative_group_extent (a, common, me->get_elt_property ("elements")));
 
-  return r - my_coord;
+  return ly_interval2scm (r - my_coord);
 }
 
 
@@ -90,15 +94,17 @@ Axis_group_interface::set_axes (Score_element*me,Axis a1, Axis a2)
     }
 
   if (a1 != X_AXIS && a2 != X_AXIS)
-    me->set_extent_callback (0, X_AXIS);
+    me->set_extent_callback (SCM_EOL, X_AXIS);
   if (a1 != Y_AXIS && a2 != Y_AXIS)
-    me->set_extent_callback (0, Y_AXIS);
-  
-  //  if (!me->has_extent_callback_b (a1))
-  if (me->has_extent_callback_b (Score_element::molecule_extent, a1))
-    me->set_extent_callback (Axis_group_interface::group_extent_callback,a1);
-  if (me->has_extent_callback_b (Score_element::molecule_extent, a2))
-    me->set_extent_callback (Axis_group_interface::group_extent_callback,a2);
+    me->set_extent_callback (SCM_EOL, Y_AXIS);
+
+  /*
+    why so convoluted ? (fixme/documentme?) 
+   */
+  if (me->has_extent_callback_b (Score_element::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))
+    me->set_extent_callback (Axis_group_interface::group_extent_callback_proc,a2);
 }
 
 Link_array<Score_element> 
index 80dad453c00c6fe8375e0a856f3f6754c1365690..11bcc3830259c46a5b3537d607e16dd34d775f06 100644 (file)
@@ -20,7 +20,7 @@
 #include "item.hh"
 #include "staff-symbol-referencer.hh"
 
-MAKE_SCHEME_CALLBACK(Bar,brew_molecule);
+MAKE_SCHEME_CALLBACK(Bar,brew_molecule,1);
 
 SCM 
 Bar::brew_molecule (SCM smob) 
@@ -122,7 +122,7 @@ Bar::simple_barline (Score_element*me,Real w, Real h)
   return me->lookup_l ()->filledbox (Box (Interval(0,w), Interval(-h/2, h/2)));
 }
 
-MAKE_SCHEME_CALLBACK(Bar,before_line_breaking );
+MAKE_SCHEME_CALLBACK(Bar,before_line_breaking ,1);
 
 SCM
 Bar::before_line_breaking  (SCM smob)
@@ -143,8 +143,7 @@ Bar::before_line_breaking  (SCM smob)
   if (!gh_string_p (g))
     {
       me->set_elt_property ("molecule-callback", SCM_BOOL_T);
-      me->set_extent_callback (0, X_AXIS);
-
+      me->set_extent_callback (SCM_EOL, X_AXIS);
       // leave y_extent for spanbar? 
     }
 
@@ -169,7 +168,7 @@ Bar::has_interface (Score_element*m)
 }
 
 
-MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size);
+MAKE_SCHEME_CALLBACK(Bar,get_staff_bar_size,1);
 SCM
 Bar::get_staff_bar_size (SCM smob) 
 {
index 728ffbb9330c54c303af115493c11dcf25752d01..14c0e4fe82a6c9e390a24e9249182b2639524fc9 100644 (file)
 #include "axis-group-interface.hh"
 #include "item.hh"
 
-void
-Collision::add_column (Score_element*me,Score_element* ncol_l)
-{
-  ncol_l->add_offset_callback (force_shift_callback, X_AXIS);
-  Axis_group_interface::add_element (me, ncol_l);
-  me->add_dependency (ncol_l);
-}
 
-Real
-Collision::force_shift_callback (Score_element * c, Axis a)
+MAKE_SCHEME_CALLBACK(Collision,force_shift_callback,2);
+SCM
+Collision::force_shift_callback (SCM element_smob, SCM axis)
 {
+  Score_element *me = unsmob_element (element_smob);
+  Axis a = (Axis) gh_scm2int (axis);
   assert (a == X_AXIS);
   
-  Score_element * me = c->parent_l (a);
+   me = me->parent_l (a);
   /*
     ugh. the way DONE is done is not clean
    */
@@ -36,7 +32,7 @@ Collision::force_shift_callback (Score_element * c, Axis a)
       do_shifts (me);
     }
   
-  return 0.0;
+  return gh_double2scm (0.0);
 }
 
 /*
@@ -228,3 +224,11 @@ Collision::forced_shift (Score_element *me)
 
 
 
+
+void
+Collision::add_column (Score_element*me,Score_element* ncol_l)
+{
+  ncol_l->add_offset_callback (Collision::force_shift_callback_proc, X_AXIS);
+  Axis_group_interface::add_element (me, ncol_l);
+  me->add_dependency (ncol_l);
+}
index 738052d5a213d020da2409b1f5f086575881b939..d91e1b9de43f4365b3d0550d0f38d5ec4fa8955b 100644 (file)
 
 
 
-void
-Dot_column::add_head (Score_element * me, Score_element *rh)
-{
-  Score_element * d = unsmob_element (rh->get_elt_property ("dot"));
-  if (d)
-    {
-      Side_position::add_support (me,rh);
-
-      Pointer_group_interface gi (me, "dots");
-      gi.add_element (d);
-      
-      d->add_offset_callback (force_shift_callback , Y_AXIS);
-      Axis_group_interface::add_element (me, d);
-    }
-}
-
-
 
 
 void
@@ -63,14 +46,17 @@ Dot_column::set_interface (Score_element* me)
  */
 
 
-Real
-Dot_column::force_shift_callback (Score_element * dot, Axis a)
+MAKE_SCHEME_CALLBACK(Dot_column,force_shift_callback,2);
+SCM
+Dot_column::force_shift_callback (SCM element_smob, SCM axis)
 {
+  Score_element *me = unsmob_element (element_smob);
+  Axis a = (Axis) gh_scm2int (axis);
   assert (a == Y_AXIS);
 Score_element * me = dot->parent_l (X_AXIS);
me = me->parent_l (X_AXIS);
   SCM dots = me->get_elt_property ("dots");
   do_shifts (dots);
-  return 0.0;
+  return gh_double2scm (0.0);
 }
 
 SCM
@@ -130,3 +116,21 @@ Dot_column::has_interface (Score_element*m)
 {
   return m && m->has_interface (ly_symbol2scm ("dot-column-interface"));
 }
+
+
+void
+Dot_column::add_head (Score_element * me, Score_element *rh)
+{
+  Score_element * d = unsmob_element (rh->get_elt_property ("dot"));
+  if (d)
+    {
+      Side_position::add_support (me,rh);
+
+      Pointer_group_interface gi (me, "dots");
+      gi.add_element (d);
+      
+      d->add_offset_callback (Dot_column::force_shift_callback_proc , Y_AXIS);
+      Axis_group_interface::add_element (me, d);
+    }
+}
+
index b867d2119e2b5d5d53af55b19e0098bfb167ef63..99742defe0d9ea2ee76f236ad81146d3006aace8 100644 (file)
 #include "smobs.hh"
 #include "dimension-cache.hh"
 
-typedef Interval (*Extent_callback)(Score_element *,Axis);
-typedef Real (*Offset_callback)(Score_element *,Axis);
-
-
-
 /**
     for administration of what was done already
     */
@@ -103,8 +98,6 @@ public:
   Paper_def *paper_l () const;
   Lookup const *lookup_l () const;
 
-  void add_processing ();
-
   /**
     add a dependency. It may be the 0 pointer, in which case, it is ignored.
     */
@@ -124,8 +117,6 @@ public:
      #funcptr# is the function to call to update this element.
    */
   void calculate_dependencies (int final, int busy, SCM funcname);
-
-
   static SCM handle_broken_smobs (SCM, SCM criterion);
 
   virtual void do_break_processing ();
@@ -136,16 +127,11 @@ public:
   Molecule get_molecule () const;
   void suicide ();
   
-  static Interval preset_extent (Score_element *,Axis);
-  static Interval point_dimension_callback (Score_element *,Axis );
-  static Interval molecule_extent (Score_element *,Axis);
-
-protected:
-  ///executed directly after the item is added to the Paper_score
-  virtual void do_add_processing ();
-  static Interval dim_cache_callback (Dimension_cache const*);
-  
-public:
+  DECLARE_SCHEME_CALLBACK(preset_extent, (SCM smob, SCM axis));
+  DECLARE_SCHEME_CALLBACK(point_dimension_callback, (SCM smob, SCM axis));
+  DECLARE_SCHEME_CALLBACK(molecule_extent, (SCM smob, SCM axis));
+
+
   static SCM ly_set_elt_property (SCM, SCM,SCM);
   static SCM ly_get_elt_property (SCM, SCM);  
 
@@ -153,7 +139,7 @@ public:
   void set_interface (SCM intf);
 
 
-  static SCM brew_molecule (SCM);
+  DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM ));
   virtual void handle_broken_dependencies ();
   virtual void handle_prebroken_dependencies ();
 
@@ -188,12 +174,13 @@ public:
   Score_element*common_refpoint (SCM elt_list, Axis a) const;
 
   // duh. slim down interface here. (todo)
-  bool has_offset_callback_b (Offset_callback, Axis)const;
-  void add_offset_callback (Offset_callback, Axis);
-  bool has_extent_callback_b (Extent_callback, Axis)const;  
+  bool has_offset_callback_b (SCM callback, Axis)const;
+  void add_offset_callback (SCM callback, Axis);
+  bool has_extent_callback_b (SCM, Axis)const;  
+  void set_extent_callback (SCM , Axis);
   bool has_extent_callback_b (Axis) const;
-  void set_extent_callback (Extent_callback , Axis);
 
+  
   /**
     Invoke callbacks to get offset relative to parent.
    */
@@ -204,7 +191,7 @@ public:
   void set_parent (Score_element* e, Axis);
   
   Score_element *parent_l (Axis a) const;
-  static SCM fixup_refpoint (SCM);
+  DECLARE_SCHEME_CALLBACK(fixup_refpoint, (SCM));
 };
 
 Score_element * unsmob_element (SCM);
index eac4533b4c9eee8898b416c994bff2e43e7ba7da..811ed663e07d1918d8b076ca70b0ea8a3fb99c7e 100644 (file)
@@ -168,8 +168,8 @@ Item::handle_prebroken_dependencies ()
        suicide ();
       else if (empty)
        {
-         set_extent_callback (0, X_AXIS);
-         set_extent_callback (0,  Y_AXIS);
+         set_extent_callback (SCM_EOL, X_AXIS);
+         set_extent_callback (SCM_EOL, Y_AXIS);
        }
       else if (trans)
        set_elt_property ("molecule-callback", SCM_BOOL_T);
index a6cecb90135d5c6ca75ea4228041d576355c1658..dad5f9cea40493ad3206eb48028cc4a389ebcac4 100644 (file)
 #include "staff-symbol-referencer.hh"
 #include "duration.hh"
 
-Real
-Rest_collision::force_shift_callback (Score_element *them, Axis a)
+MAKE_SCHEME_CALLBACK(Rest_collision,force_shift_callback,2);
+SCM
+Rest_collision::force_shift_callback (SCM element_smob, SCM axis)
 {
+  Score_element *them = unsmob_element (element_smob);
+  Axis a = (Axis) gh_scm2int (axis);
   assert (a == Y_AXIS);
 
   Score_element * rc = unsmob_element (them->get_elt_property ("rest-collision"));
@@ -37,7 +40,7 @@ Rest_collision::force_shift_callback (Score_element *them, Axis a)
       do_shift (rc, elts);
     }
   
-  return 0.0;
+  return gh_double2scm (0.0);
 }
 
 void
@@ -47,7 +50,7 @@ Rest_collision::add_column (Score_element*me,Score_element *p)
   Pointer_group_interface gi (me);  
   gi.add_element (p);
 
-  p->add_offset_callback (&Rest_collision::force_shift_callback, Y_AXIS);
+  p->add_offset_callback (Rest_collision::force_shift_callback_proc, Y_AXIS);
   p->set_elt_property ("rest-collision", me->self_scm ());
 }
 
@@ -231,7 +234,7 @@ Rest_collision::do_shift (Score_element *me, SCM elts)
 void
 Rest_collision::set_interface (Score_element*me)
 {
-  me->set_extent_callback (0, X_AXIS);
-  me->set_extent_callback (0, Y_AXIS);
+  me->set_extent_callback (SCM_EOL, X_AXIS);
+  me->set_extent_callback (SCM_EOL, Y_AXIS);
 }
 
index a50bea8d4f51af988151cbaa3ef1ae244998cf7b..fa73f2f4bd6f142a8ab4dcbf2369b1706b2bf115 100644 (file)
@@ -15,8 +15,8 @@
 void
 Separation_item::set_interface (Score_element*s)
 {
-  s->set_extent_callback (0, X_AXIS);
-  s->set_extent_callback (0,  Y_AXIS);
+  s->set_extent_callback (SCM_EOL, X_AXIS);
+  s->set_extent_callback (SCM_EOL, Y_AXIS);
 }
 
 void
index 5ad98d494ecf7f6b5227e2a1e0726d2240dfbdd9..5483955386c4fd83684bc8a2678f33d639ad0e68 100644 (file)
@@ -19,8 +19,8 @@
 void
 Spacing_spanner::set_interface (Score_element*me)
 {
-  me->set_extent_callback (0, X_AXIS);
-  me->set_extent_callback (0, Y_AXIS);  
+  me->set_extent_callback (SCM_EOL, X_AXIS);
+  me->set_extent_callback (SCM_EOL, Y_AXIS) ; 
 }
 
 /*
@@ -309,7 +309,7 @@ Spacing_spanner::stem_dir_correction (Score_element*me, Score_element*l, Score_e
 }
   
 
-MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs);
+MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs,1);
 SCM
 Spacing_spanner::set_springs (SCM smob)
 {
index f3efc6e76bd50ddc782b082bae2f3605b99e22bb..b4bd9f53a35b006fd27b6cb432e4298ca06e6ebf 100644 (file)
 struct Sustain_pedal
 {
 public:
-   static SCM brew_molecule (SCM);
+  DECLARE_SCHEME_CALLBACK(brew_molecule, (SCM));
 };
 
 
-MAKE_SCHEME_CALLBACK(Sustain_pedal,brew_molecule);
-
+MAKE_SCHEME_CALLBACK(Sustain_pedal,brew_molecule,1);
 SCM
 Sustain_pedal::brew_molecule (SCM smob) 
 {
index 4a576ac7c2a503254b7cb1bf95302b5380f40c11..feca94f8845ef460a56e1ffec8d37189e196ef10 100644 (file)
 
 struct Text_item
 {
-  static SCM brew_molecule (SCM);
+  DECLARE_SCHEME_CALLBACK( brew_molecule, (SCM));
 };
 
 
-MAKE_SCHEME_CALLBACK(Text_item,brew_molecule)
+MAKE_SCHEME_CALLBACK(Text_item,brew_molecule,1);
 
 SCM 
 Text_item::brew_molecule (SCM sm) 
index 257885be9e9d59c8af1d599a7a38d9c4bdd64a1e..32d6f4a1add79311731ee8bc9b9dc6aced65de3e 100644 (file)
@@ -20,8 +20,8 @@ void
 Tie_column::set_interface (Score_element*me)
 {
   me->set_interface (ly_symbol2scm ("tie-column"));
-  me->set_extent_callback (0, X_AXIS);
-  me->set_extent_callback (0, Y_AXIS);  
+  me->set_extent_callback (SCM_EOL, X_AXIS);
+  me->set_extent_callback (SCM_EOL, Y_AXIS) ; 
 }
 
 bool
@@ -104,7 +104,7 @@ Tie_column::set_directions (Score_element*me)
   
 }
 
-MAKE_SCHEME_CALLBACK(Tie_column,after_line_breaking);
+MAKE_SCHEME_CALLBACK(Tie_column,after_line_breaking,1);
 SCM
 Tie_column::after_line_breaking (SCM smob)
 {