#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"
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_;
};
/*
}
}
+ 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,
}
vector<Grob*>
-Accidental_placement::get_break_reminder_accidentals (vector<Grob*> const &elts, Grob *left)
+Accidental_placement::get_relevant_accidentals (vector<Grob*> const &elts, Grob *left)
{
vector<Grob*> br;
vector<Grob*> ra;
vector<Grob*> ret;
-
- if (dynamic_cast<Item *> (left)->break_status_dir () != RIGHT)
- return vector<Grob*> ();
+ bool right = dynamic_cast<Item *> (left)->break_status_dir () == RIGHT;
for (vsize i = 0; i < elts.size (); i++)
{
split_accidentals (elts[i], &br, &ra);
- ret.insert (ret.end (), br.begin (), br.end ());
- }
- return ret;
-}
-
-/*
- Accidentals are special, because they appear and disappear after
- ties at will.
-*/
-Interval
-Accidental_placement::get_relevant_accidental_extent (Grob *me,
- Item *item_col,
- Grob *left_object)
-{
- vector<Grob*> br, ra;
- vector<Grob*> *which = 0;
-
- Accidental_placement::split_accidentals (me, &br, &ra);
- concat (br, ra);
-
- if (dynamic_cast<Item *> (left_object)->break_status_dir () == RIGHT)
- which = &br;
- else
- which = &ra;
-
- Interval extent;
- for (vsize i = 0; i < which->size (); i++)
- extent.unite (which->at (i)->extent (item_col, X_AXIS));
+
+ ret.insert (ret.end (), ra.begin (), ra.end ());
- if (!extent.is_empty ())
- {
- Real p = robust_scm2double (me->get_property ("left-padding"), 0.2);
- extent[LEFT] -= p;
+ if (right)
+ ret.insert (ret.end (), br.begin (), br.end ());
}
-
- return extent;
+ return ret;
}
struct Accidental_placement_entry
void acknowledge_stem (Grob_info);
void acknowledge_rhythmic_head (Grob_info);
- void acknowledge_note_column (Grob_info);
protected:
void process_music ();
void stop_translation_timestep ();
Side_position_interface::add_support (arpeggio_, info.grob ());
}
-void
-Arpeggio_engraver::acknowledge_note_column (Grob_info info)
-{
- if (arpeggio_)
- info.grob ()->set_object ("arpeggio", arpeggio_->self_scm ());
-}
-
void
Arpeggio_engraver::process_music ()
{
ADD_ACKNOWLEDGER (Arpeggio_engraver, stem);
ADD_ACKNOWLEDGER (Arpeggio_engraver, rhythmic_head);
-ADD_ACKNOWLEDGER (Arpeggio_engraver, note_column);
ADD_TRANSLATOR (Arpeggio_engraver,
/* doc */ "Generate an Arpeggio symbol",
DECLARE_SCHEME_CALLBACK (alignment_callback, (SCM element));
static void add_accidental (Grob *, Grob *);
- static vector<Grob*> get_break_reminder_accidentals (vector<Grob*> const &elts,
- Grob *left);
- static Interval get_relevant_accidental_extent (Grob *me,
- Item *item_col,
- Grob *acc);
+ static vector<Grob*> get_relevant_accidentals (vector<Grob*> const &elts, Grob *left);
static void split_accidentals (Grob *accs,
vector<Grob*> *break_reminder,
vector<Grob*> *real_acc);
*/
Real min_dist = Spacing_interface::minimum_distance (me);
- *fixed = max (min_dist, left_head_end + min_dist/2);
+ *fixed = max (left_head_end + (min_dist - left_head_end) / 2,
+ min_dist - (base_space - increment) / 2);
/*
We don't do complicated stuff: (base_space - increment) is the
up-stem + down-stem should get extra space, the combination
down-stem + up-stem less.
- TODO: have to check wether the stems are in the same staff.
+ TODO: have to check whether the stems are in the same staff.
*/
void
Note_spacing::stem_dir_correction (Grob *me, Item *rcolumn,
Grob *stem_;
Grob *note_column_;
Grob *dotcol_;
+ Grob *arpeggio_;
TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
protected:
DECLARE_ACKNOWLEDGER (dot_column);
DECLARE_ACKNOWLEDGER (stem);
DECLARE_ACKNOWLEDGER (rhythmic_head);
+ DECLARE_ACKNOWLEDGER (arpeggio);
void process_acknowledged ();
void stop_translation_timestep ();
};
stem_ = 0;
note_column_ = 0;
dotcol_ = 0;
+ arpeggio_ = 0;
}
Note_column::set_stem (note_column_, stem_);
stem_ = 0;
}
+
+ if (arpeggio_)
+ {
+ Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), arpeggio_);
+ note_column_->set_object ("arpeggio", arpeggio_->self_scm ());
+ }
}
}
dotcol_ = i.grob ();
}
+void
+Rhythmic_column_engraver::acknowledge_arpeggio (Grob_info i)
+{
+ arpeggio_ = i.grob ();
+}
+
void
Rhythmic_column_engraver::stop_translation_timestep ()
{
note_column_ = 0;
dotcol_ = 0;
stem_ = 0;
+ arpeggio_ = 0;
}
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, dot_column);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head);
+ADD_ACKNOWLEDGER (Rhythmic_column_engraver, arpeggio);
ADD_TRANSLATOR (Rhythmic_column_engraver,
/* doc */ "Generates NoteColumn, an objects that groups stems, noteheads and rests.",
vector<Grob*> elts;
if (left)
- elts = Accidental_placement::get_break_reminder_accidentals (read_only_elts, left);
+ elts = Accidental_placement::get_relevant_accidentals (read_only_elts, left);
else
elts = read_only_elts;