source file of the GNU LilyPond music typesetter
-(c) 2002 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+(c) 2002--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "note-collision.hh"
#include "accidental-interface.hh"
-/*
- Hmm. why not group-extent?
- */
-MAKE_SCHEME_CALLBACK(Accidental_placement,extent_callback, 2);
-SCM
-Accidental_placement::extent_callback(SCM s, SCM axis)
-{
- Grob * me =unsmob_grob (s);
- Axis a = Axis (gh_scm2int (axis));
-
- assert (a == X_AXIS);
-
- SCM w = position_accidentals (me);
- return w;
-}
-
MAKE_SCHEME_CALLBACK(Accidental_placement,alignment_callback, 2);
SCM
Accidental_placement::alignment_callback(SCM s, SCM )
position_accidentals (par);
}
- return gh_int2scm (0);
+ return scm_int2num (0);
}
Pitch *p= unsmob_pitch (mcause->get_mus_property ("pitch"));
- int n = p->notename_i_;
+ int n = p->get_notename ();
- SCM accs = me->get_grob_property ("accidentals");
- SCM key = gh_int2scm (n);
+ SCM accs = me->get_grob_property ("accidental-grobs");
+ SCM key = scm_int2num (n);
SCM entry = scm_assq (key, accs);
if (entry == SCM_BOOL_F)
{
accs = scm_assq_set_x (accs, key, entry);
- me->set_grob_property ("accidentals", accs);
+ me->set_grob_property ("accidental-grobs", accs);
}
/*
Link_array<Grob> *break_reminder,
Link_array<Grob> *real_acc)
{
- for (SCM acs =accs->get_grob_property ("accidentals"); gh_pair_p (acs);
+ for (SCM acs =accs->get_grob_property ("accidental-grobs"); gh_pair_p (acs);
acs =gh_cdr (acs))
for (SCM s = gh_cdar (acs); gh_pair_p (s); s = gh_cdr (s))
{
}
/*
- Accidentals are special, because they appear and disappear before
- and after ties at will.
+ Accidentals are special, because they appear and disappear after
+ ties at will.
*/
Interval
Accidental_placement::get_relevant_accidental_extent (Grob *me,
/*
- Return: width as SCM interval.
-
This routine computes placements of accidentals. During
add_accidental(), accidentals are already grouped by note, so that
SCM
Accidental_placement::position_accidentals (Grob * me)
{
- SCM accs = me->get_grob_property ("accidentals");
+ if (!me->live ())
+ return SCM_UNSPECIFIED;
+
+ SCM accs = me->get_grob_property ("accidental-grobs");
/*
TODO: there is a bug in this code. If two accs are on the same
for (int i = apes.size(); i--;)
delete apes[i];
- return scm_width;
+ return SCM_UNSPECIFIED;
}
ADD_INTERFACE(Accidental_placement,
"accidental-placement-interface",
"Take care of complex accidental collisions.",
- "left-padding padding right-padding accidentals alignment-done")
+ "left-padding padding right-padding accidental-grobs alignment-done")