From: fred Date: Tue, 26 Mar 2002 23:56:56 +0000 (+0000) Subject: lilypond-1.3.94 X-Git-Tag: release/1.5.59~1259 X-Git-Url: https://git.donarmstrong.com/?a=commitdiff_plain;h=b52a42ba32a2d00e5100bde9dc6aa6af8317f790;p=lilypond.git lilypond-1.3.94 --- diff --git a/lily/axis-group-interface.cc b/lily/axis-group-interface.cc index 4d7db9b452..f7e8c22bf1 100644 --- a/lily/axis-group-interface.cc +++ b/lily/axis-group-interface.cc @@ -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 diff --git a/lily/bar.cc b/lily/bar.cc index 80dad453c0..11bcc38302 100644 --- a/lily/bar.cc +++ b/lily/bar.cc @@ -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) { diff --git a/lily/collision.cc b/lily/collision.cc index 728ffbb933..14c0e4fe82 100644 --- a/lily/collision.cc +++ b/lily/collision.cc @@ -13,20 +13,16 @@ #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); +} diff --git a/lily/dot-column.cc b/lily/dot-column.cc index 738052d5a2..d91e1b9de4 100644 --- a/lily/dot-column.cc +++ b/lily/dot-column.cc @@ -17,23 +17,6 @@ -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); + } +} + diff --git a/lily/include/score-element.hh b/lily/include/score-element.hh index b867d2119e..99742defe0 100644 --- a/lily/include/score-element.hh +++ b/lily/include/score-element.hh @@ -14,11 +14,6 @@ #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); diff --git a/lily/item.cc b/lily/item.cc index eac4533b4c..811ed663e0 100644 --- a/lily/item.cc +++ b/lily/item.cc @@ -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); diff --git a/lily/rest-collision.cc b/lily/rest-collision.cc index a6cecb9013..dad5f9cea4 100644 --- a/lily/rest-collision.cc +++ b/lily/rest-collision.cc @@ -19,9 +19,12 @@ #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); } diff --git a/lily/separation-item.cc b/lily/separation-item.cc index a50bea8d4f..fa73f2f4bd 100644 --- a/lily/separation-item.cc +++ b/lily/separation-item.cc @@ -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 diff --git a/lily/spacing-spanner.cc b/lily/spacing-spanner.cc index 5ad98d494e..5483955386 100644 --- a/lily/spacing-spanner.cc +++ b/lily/spacing-spanner.cc @@ -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) { diff --git a/lily/sustain-pedal.cc b/lily/sustain-pedal.cc index f3efc6e76b..b4bd9f53a3 100644 --- a/lily/sustain-pedal.cc +++ b/lily/sustain-pedal.cc @@ -30,12 +30,11 @@ 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) { diff --git a/lily/text-item.cc b/lily/text-item.cc index 4a576ac7c2..feca94f884 100644 --- a/lily/text-item.cc +++ b/lily/text-item.cc @@ -15,11 +15,11 @@ 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) diff --git a/lily/tie-column.cc b/lily/tie-column.cc index 257885be9e..32d6f4a1ad 100644 --- a/lily/tie-column.cc +++ b/lily/tie-column.cc @@ -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) {