+void
+Accidental_engraver::create_accidental (Accidental_entry *entry,
+ bool restore_natural,
+ bool cautionary)
+{
+ Stream_event *note = entry->melodic_;
+ Grob *support = entry->head_;
+ Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
+
+ bool as_suggestion = to_boolean (entry->origin_->get_property ("suggestAccidentals"));
+ Grob *a = 0;
+ if (as_suggestion)
+ a = make_suggested_accidental (note, support, entry->origin_engraver_);
+ else
+ a = make_standard_accidental (note, support, entry->origin_engraver_);
+
+ SCM accs = scm_cons (scm_from_int (pitch->get_alteration () * Rational (4)),
+ SCM_EOL);
+ if (restore_natural)
+ {
+ if (to_boolean (get_property ("extraNatural")))
+ accs = scm_cons (scm_from_int (0), accs);
+ }
+
+ /* TODO: add cautionary option in accidental. */
+ if (cautionary)
+ a->set_property ("cautionary", SCM_BOOL_T);
+
+ a->set_property ("accidentals", accs);
+ entry->accidental_ = a;
+}
+
+Grob *
+Accidental_engraver::make_standard_accidental (Stream_event *note,
+ Grob *note_head,
+ Engraver *trans)
+{
+ (void)note;
+
+ /*
+ We construct the accidentals at the originating Voice
+ level, so that we get the property settings for
+ Accidental from the respective Voice.
+ */
+ Grob *a = trans->make_item ("Accidental", note_head->self_scm ());
+
+ /*
+ We add the accidentals to the support of the arpeggio,
+ so it is put left of the accidentals.
+ */
+ for (vsize i = 0; i < left_objects_.size (); i++)
+ {
+ if (left_objects_[i]->get_property ("side-axis") == scm_from_int (X_AXIS))
+ Side_position_interface::add_support (left_objects_[i], a);
+ }
+
+ /*
+ Hmm. Junkme?
+ */
+ for (vsize i = 0; i < right_objects_.size (); i++)
+ Side_position_interface::add_support (a, right_objects_[i]);
+
+ a->set_parent (note_head, Y_AXIS);
+
+ if (!accidental_placement_)
+ accidental_placement_ = make_item ("AccidentalPlacement",
+ a->self_scm ());
+ Accidental_placement::add_accidental (accidental_placement_, a);
+
+ note_head->set_object ("accidental-grob", a->self_scm ());
+
+ return a;
+}
+
+Grob *
+Accidental_engraver::make_suggested_accidental (Stream_event *note,
+ Grob *note_head,
+ Engraver *trans)
+{
+ (void) note;
+
+ Grob *a = trans->make_item ("AccidentalSuggestion", note_head->self_scm ());
+
+ Side_position_interface::add_support (a, note_head);
+ if (Grob *stem = unsmob_grob (a->get_object ("stem")))
+ Side_position_interface::add_support (a, stem);
+
+ a->set_parent (note_head, X_AXIS);
+ return a;
+}
+