#include "pitch.hh"
#include "protected-scm.hh"
#include "rhythmic-head.hh"
+#include "separation-item.hh"
#include "side-position-interface.hh"
#include "stream-event.hh"
#include "tie.hh"
class Accidental_engraver : public Engraver
{
- int get_bar_number ();
void update_local_key_signature (SCM new_signature);
void create_accidental (Accidental_entry *entry, bool, bool);
Grob *make_standard_accidental (Stream_event *note, Grob *note_head, Engraver *trans, bool);
void acknowledge_arpeggio (Grob_info);
void acknowledge_rhythmic_head (Grob_info);
void acknowledge_finger (Grob_info);
+ void acknowledge_note_column (Grob_info);
void stop_translation_timestep ();
void process_acknowledged ();
vector<Accidental_entry> accidentals_;
vector<Spanner*> ties_;
+ vector<Grob*> note_columns_;
};
/*
return result;
}
-int
-Accidental_engraver::get_bar_number ()
-{
- SCM barnum = get_property ("internalBarNumber");
- SCM smp = get_property ("measurePosition");
-
- int bn = robust_scm2int (barnum, 0);
-
- Moment mp = robust_scm2moment (smp, Moment (0));
- if (mp.main_part_ < Rational (0))
- bn--;
-
- return bn;
-}
-
void
Accidental_engraver::process_acknowledged ()
{
{
SCM accidental_rules = get_property ("autoAccidentals");
SCM cautionary_rules = get_property ("autoCautionaries");
- int barnum = get_bar_number ();
+ int barnum = measure_number (context());
for (vsize i = 0; i < accidentals_.size (); i++)
{
/* Cannot look for ties: it's not guaranteed that they reach
us before the notes. */
- if (acc.need_acc
- && !note->in_event_class ("trill-span-event"))
- create_accidental (&accidentals_[i], acc.need_restore, cautionary);
+ if (!note->in_event_class ("trill-span-event"))
+ {
+ if (acc.need_acc)
+ create_accidental (&accidentals_[i], acc.need_restore, cautionary);
- if (forced || cautionary)
- accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
+ if (forced || cautionary)
+ accidentals_[i].accidental_->set_property ("forced", SCM_BOOL_T);
+ }
}
}
}
}
for (vsize i = accidentals_.size (); i--;)
- {
- int barnum = get_bar_number ();
-
+ {
Stream_event *note = accidentals_[i].melodic_;
Context *origin = accidentals_[i].origin_;
+ int barnum = measure_number (origin);
+
Pitch *pitch = unsmob_pitch (note->get_property ("pitch"));
if (!pitch)
continue;
&& origin->where_defined (ly_symbol2scm ("localKeySignature"), &localsig))
{
bool change = false;
- if (accidentals_[i].tied_)
+ if (accidentals_[i].tied_
+ && !(to_boolean (accidentals_[i].accidental_->get_property ("forced"))))
{
/*
Remember an alteration that is different both from
}
}
+ if (accidental_placement_)
+ for (vsize i = 0; i < note_columns_.size (); i++)
+ Separation_item::add_conditional_item (note_columns_[i], accidental_placement_);
+
accidental_placement_ = 0;
accidentals_.clear ();
left_objects_.clear ();
ties_.push_back (dynamic_cast<Spanner *> (info.grob ()));
}
+void
+Accidental_engraver::acknowledge_note_column (Grob_info info)
+{
+ note_columns_.push_back (info.grob ());
+}
+
void
Accidental_engraver::acknowledge_arpeggio (Grob_info info)
{
ADD_ACKNOWLEDGER (Accidental_engraver, finger);
ADD_ACKNOWLEDGER (Accidental_engraver, rhythmic_head);
ADD_ACKNOWLEDGER (Accidental_engraver, tie);
+ADD_ACKNOWLEDGER (Accidental_engraver, note_column);
ADD_TRANSLATOR (Accidental_engraver,
-
- "Make accidentals. "
- "Catch note heads, ties and notices key-change events. "
- "This engraver usually lives at Staff level, but "
- "reads the settings for Accidental at @code{Voice} level, "
- "so you can @code{\\override} them at @code{Voice}. ",
-
- /* grobs */
+ /* doc */
+ "Make accidentals."
+ " Catch note heads, ties and notices key-change events."
+ " This engraver usually lives at Staff level, but"
+ " reads the settings for Accidental at @code{Voice} level,"
+ " so you can @code{\\override} them at @code{Voice}.",
+
+ /* create */
"Accidental "
"AccidentalCautionary "
"AccidentalSuggestion ",
- /* props */
+ /* read */
"autoAccidentals "
"autoCautionaries "
"internalBarNumber "
"extraNatural "
"harmonicAccidentals "
"localKeySignature ",
+
+ /* write */
"localKeySignature "
);