/*
-accidental-placement.cc -- implement Accidental_placement
+ accidental-placement.cc -- implement Accidental_placement
-source file of the GNU LilyPond music typesetter
+ source file of the GNU LilyPond music typesetter
-(c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 2002--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
- */
+*/
#include <math.h>
-#include <libc-extension.hh>
-#include "item.hh"
+
+#include "accidental-placement.hh"
+#include "libc-extension.hh" // isinf
#include "skyline.hh"
#include "music.hh"
#include "pitch.hh"
#include "warn.hh"
-#include "accidental-placement.hh"
#include "note-column.hh"
#include "group-interface.hh"
#include "note-collision.hh"
SCM
Accidental_placement::alignment_callback (SCM s, SCM )
{
- Grob * me =unsmob_grob (s);
+ Grob * me = unsmob_grob (s);
Grob * par = me->get_parent (X_AXIS);
if (!to_boolean (par->get_property ("positioning-done")))
a->add_offset_callback (alignment_callback_proc, X_AXIS);
SCM cause = a->get_parent (Y_AXIS)->get_property ("cause");
- Music *mcause =unsmob_music (cause);
+ Music *mcause = unsmob_music (cause);
if (!mcause)
{
programming_error ("Note head has no music cause!");
return;
}
- Pitch *p= unsmob_pitch (mcause->get_property ("pitch"));
+ Pitch *p = unsmob_pitch (mcause->get_property ("pitch"));
int n = p->get_notename ();
entry = SCM_EOL;
}
else
- entry = gh_cdr (entry);
+ entry = scm_cdr (entry);
- entry = gh_cons (a->self_scm (), entry);
+ entry = scm_cons (a->self_scm (), entry);
accs = scm_assq_set_x (accs, key, entry);
Link_array<Grob> *break_reminder,
Link_array<Grob> *real_acc)
{
- for (SCM acs =accs->get_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))
+ for (SCM acs = accs->get_property ("accidental-grobs"); scm_is_pair (acs);
+ acs = scm_cdr (acs))
+ for (SCM s = scm_cdar (acs); scm_is_pair (s); s = scm_cdr (s))
{
- Grob *a = unsmob_grob (gh_car (s));
+ Grob *a = unsmob_grob (scm_car (s));
if (unsmob_grob (a->get_property ("tie")))
break_reminder->push (a);
int notename_;
Accidental_placement_entry ()
{
- offset_ =0.0;
+ offset_ = 0.0;
notename_ = -1;
}
};
apes->clear ();
- int i =0;
+ int i = 0;
int parity = 1;
while (i < asc.size ())
{
SCM
Accidental_placement::position_accidentals (Grob * me)
{
- if (!me->live ())
+ if (!me->is_live ())
return SCM_UNSPECIFIED;
SCM accs = me->get_property ("accidental-grobs");
-
+ if (!scm_is_pair (accs))
+ return SCM_UNSPECIFIED;
+
/*
TODO: there is a bug in this code. If two accs are on the same
Y-position, they share an Ape, and will be printed in overstrike.
*/
Link_array<Accidental_placement_entry> apes;
- for (SCM s = accs; gh_pair_p (s); s =gh_cdr (s))
+ for (SCM s = accs; scm_is_pair (s); s = scm_cdr (s))
{
Accidental_placement_entry *ape = new Accidental_placement_entry;
- ape->notename_ = gh_scm2int (gh_caar (s));
+ ape->notename_ = scm_to_int (scm_caar (s));
- for (SCM t = gh_cdar (s); gh_pair_p (t); t =gh_cdr (t))
- ape->grobs_.push (unsmob_grob (gh_car (t)));
+ for (SCM t = scm_cdar (s); scm_is_pair (t); t = scm_cdr (t))
+ ape->grobs_.push (unsmob_grob (scm_car (t)));
apes.push (ape);
}
-
Grob *common[] = {me, 0};
/*
extents if we're sure that we've found the right common refpoint
*/
Link_array<Grob> note_cols, heads;
- for (int i= apes.size (); i--;)
+ for (int i = apes.size (); i--;)
{
Accidental_placement_entry * ape = apes[i];
for (int j = ape->grobs_.size (); j--;)
common[Y_AXIS] = common_refpoint_of_array (heads, common[Y_AXIS], Y_AXIS);
- for (int i= apes.size (); i--;)
+ for (int i = apes.size (); i--;)
{
Accidental_placement_entry * ape = apes[i];
ape->left_skyline_ = empty_skyline (LEFT);
/*
Add accs entries right-to-left.
*/
- for (int i= apes.size (); i-- > 0;)
+ for (int i = apes.size (); i-- > 0;)
{
Real offset =
-skyline_meshing_distance (apes[i]->right_skyline_, left_skyline);
left_extent[LEFT] -= robust_scm2double (me->get_property ("left-padding"), 0);
-
-
Interval width (left_extent[LEFT], right_extent[RIGHT]);
SCM scm_width = ly_interval2scm (width);