*/
- 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
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))
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);
}
}
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>
#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)
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)
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?
}
}
-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)
{
#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
*/
do_shifts (me);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
/*
+
+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);
+}
-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
*/
-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
{
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);
+ }
+}
+
#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
*/
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.
*/
#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 ();
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);
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 ();
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.
*/
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);
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);
#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"));
do_shift (rc, elts);
}
- return 0.0;
+ return gh_double2scm (0.0);
}
void
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 ());
}
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);
}
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
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) ;
}
/*
}
-MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs);
+MAKE_SCHEME_CALLBACK(Spacing_spanner, set_springs,1);
SCM
Spacing_spanner::set_springs (SCM smob)
{
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)
{
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)
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
}
-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)
{