-\version "2.16.0"
+\version "2.17.17"
\header {
texidoc = "Arpeggio stays clear of accidentals and flipped note heads."
\context{
\Staff
connectArpeggios = ##t
+ \consists "Span_arpeggio_engraver"
}
}
<fis'' g d a>\arpeggio
<fis, g d a>\arpeggio
<fis'' g d a>\arpeggio
+ << { <e' a>\arpeggio } \\ { <g cis>\arpeggio } >>
}
#include "engraver.hh"
-#include "pointer-group-interface.hh"
#include "arpeggio.hh"
-#include "stem.hh"
+#include "item.hh"
+#include "note-column.hh"
+#include "pointer-group-interface.hh"
#include "rhythmic-head.hh"
+#include "separation-item.hh"
#include "side-position-interface.hh"
+#include "stem.hh"
#include "stream-event.hh"
-#include "note-column.hh"
-#include "item.hh"
#include "translator.icc"
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_)
+ Separation_item::add_conditional_item (info.grob (), arpeggio_);
+}
+
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 */
static bool shift_less (Grob *const &, Grob *const &);
static Direction dir (Grob *me);
static Grob *accidentals (Grob *me);
- static Grob *arpeggio (Grob *me);
static Slice head_positions_interval (Grob *me);
static Grob *first_head (Grob *me);
static Grob *get_rest (Grob *me);
return 0;
}
-Grob *
-Note_column::arpeggio (Grob *me)
-{
- return unsmob_grob (me->get_object ("arpeggio"));
-}
-
/* If a note-column contains a cross-staff stem then
nc->extent (Y_AXIS, refp) will not consider the extent of the stem.
If you want the extent of the stem to be included (and you are safe
"Stem and noteheads combined.",
/* properties */
- "arpeggio "
"force-hshift "
"horizontal-shift "
"ignore-collision "
#include "international.hh"
#include "accidental-placement.hh"
#include "accidental-interface.hh"
+#include "arpeggio.hh"
#include "axis-group-interface.hh"
#include "context.hh"
#include "note-spacing.hh"
if (!unsmob_grob (elem->get_object ("axis-group-parent-X")))
elem->set_object ("axis-group-parent-X", col->self_scm ());
- if (Accidental_placement::has_interface (elem))
+ if (Accidental_placement::has_interface (elem)
+ || Arpeggio::has_interface (elem))
Separation_item::add_conditional_item (col, elem);
else if (!Accidental_interface::has_interface (elem))
Separation_item::add_item (col, elem);
Grob *stem_;
Grob *flag_;
Grob *note_column_;
- Grob *arpeggio_;
TRANSLATOR_DECLARATIONS (Rhythmic_column_engraver);
protected:
DECLARE_ACKNOWLEDGER (stem);
DECLARE_ACKNOWLEDGER (flag);
DECLARE_ACKNOWLEDGER (rhythmic_head);
- DECLARE_ACKNOWLEDGER (arpeggio);
void process_acknowledged ();
void stop_translation_timestep ();
};
stem_ = 0;
flag_ = 0;
note_column_ = 0;
- arpeggio_ = 0;
}
void
stem_ = 0;
}
- if (arpeggio_)
+ if (flag_)
{
- Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), arpeggio_);
- note_column_->set_object ("arpeggio", arpeggio_->self_scm ());
+ Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), flag_);
+ flag_ = 0;
}
- if (flag_)
- Pointer_group_interface::add_grob (note_column_, ly_symbol2scm ("elements"), flag_);
}
}
rheads_.push_back (i.grob ());
}
-void
-Rhythmic_column_engraver::acknowledge_arpeggio (Grob_info i)
-{
- arpeggio_ = i.grob ();
-}
-
void
Rhythmic_column_engraver::stop_translation_timestep ()
{
note_column_ = 0;
stem_ = 0;
- arpeggio_ = 0;
flag_ = 0;
}
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, stem);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, flag);
ADD_ACKNOWLEDGER (Rhythmic_column_engraver, rhythmic_head);
-ADD_ACKNOWLEDGER (Rhythmic_column_engraver, arpeggio);
ADD_TRANSLATOR (Rhythmic_column_engraver,
/* doc */
return sp.smobbed_copy ();
}
-/* if left is non-NULL, get the boxes corresponding to the
- conditional-elements (conditioned on the grob LEFT). This
- sounds more general than it is: conditional-elements are
- always accidentals attached to a tied note.
+/*
+ If left is non-NULL, get the boxes corresponding to the
+ conditional-elements (conditioned on the grob LEFT).
+ Conditional elements are, for now, arpeggios and accidental
+ placements. Based on the left grob, the accidentals will
+ be printed or not, so we filter using
+ Accidental_placement::get_relevant_accidentals.
*/
vector<Box>
Separation_item::boxes (Grob *me, Grob *left)
vector<Grob *> elts;
if (left)
- elts = Accidental_placement::get_relevant_accidentals (read_only_elts, left);
+ {
+ vector<Grob *> accidental_elts;
+ vector<Grob *> other_elts; // for now only arpeggios
+ for (vsize i = 0; i < read_only_elts.size (); i++)
+ {
+ if (Accidental_placement::has_interface (read_only_elts[i]))
+ accidental_elts.push_back (read_only_elts[i]);
+ else
+ other_elts.push_back (read_only_elts[i]);
+ }
+ elts = Accidental_placement::get_relevant_accidentals (accidental_elts, left);
+ elts.insert (elts.end (), other_elts.begin (), other_elts.end ());
+ }
else
elts = read_only_elts;
#include "engraver.hh"
#include "arpeggio.hh"
+#include "item.hh"
#include "pointer-group-interface.hh"
+#include "separation-item.hh"
#include "side-position-interface.hh"
#include "staff-symbol-referencer.hh"
-#include "item.hh"
/**
Make arpeggios that span multiple staves. Catch arpeggios, and span a
public:
TRANSLATOR_DECLARATIONS (Span_arpeggio_engraver);
DECLARE_ACKNOWLEDGER (arpeggio);
+ DECLARE_ACKNOWLEDGER (note_column);
protected:
void process_acknowledged ();
private:
Item *span_arpeggio_;
vector<Grob *> arpeggios_;
+ vector<Grob *> note_columns_;
};
Span_arpeggio_engraver::Span_arpeggio_engraver ()
arpeggios_.push_back (info.grob ());
}
+void
+Span_arpeggio_engraver::acknowledge_note_column (Grob_info info)
+{
+ note_columns_.push_back (info.grob ());
+}
+
void
Span_arpeggio_engraver::process_acknowledged ()
{
span_arpeggio_ = make_item ("Arpeggio", SCM_EOL);
span_arpeggio_->set_property ("cross-staff", SCM_BOOL_T);
}
+ if (span_arpeggio_)
+ {
+ for (vsize i = 0; i < note_columns_.size (); i++)
+ Separation_item::add_conditional_item (note_columns_[i], span_arpeggio_);
+ note_columns_.clear ();
+ }
}
void
span_arpeggio_ = 0;
}
arpeggios_.clear ();
+ note_columns_.clear ();
}
#include "translator.icc"
ADD_ACKNOWLEDGER (Span_arpeggio_engraver, arpeggio);
+ADD_ACKNOWLEDGER (Span_arpeggio_engraver, note_column);
ADD_TRANSLATOR (Span_arpeggio_engraver,
/* doc */
"Make arpeggios that span multiple staves.",
dynamic spanners.")
(all-elements ,ly:grob-array? "An array of all grobs in this line. Its
function is to protect objects from being garbage collected.")
- (arpeggio ,ly:grob? "A pointer to an @code{Arpeggio} object.")
(axis-group-parent-X ,ly:grob? "Containing X@tie{}axis group.")
(axis-group-parent-Y ,ly:grob? "Containing Y@tie{}axis group.")