static Item* right_column (Grob *me);
static Item* left_column (Grob *me);
static Drul_array<Skyline> skylines (Grob *me, Grob *right_col);
+ static Grob* extremal_break_aligned_grob (Grob *me, Direction, Direction, Interval*);
DECLARE_GROB_INTERFACE();
};
Direction d = LEFT;
bool acc_right = false;
+ Grob *bar = Spacing_interface::extremal_break_aligned_grob (me, RIGHT,
+ rcolumn->break_status_dir (),
+ &bar_xextent);
+ if (bar)
+ bar_yextent = Staff_spacing::bar_y_positions (bar);
+
do
{
vector<Grob*> const &items (ly_scm2link_array (props [d]));
Grob *stem = Note_column::get_stem (it);
if (!stem || !stem->is_live ())
- {
- if (d == RIGHT && Separation_item::has_interface (it))
- {
- if (it->get_column () != rcolumn)
- it = it->find_prebroken_piece (rcolumn->break_status_dir ());
-
- Grob *last = Separation_item::extremal_break_aligned_grob (it, LEFT, &bar_xextent);
-
- if (last)
- bar_yextent = Staff_spacing::bar_y_positions (last);
-
- break;
- }
-
- return;
- }
+ return;
if (Stem::is_invisible (stem))
{
Spacings last_spacings_;
DECLARE_ACKNOWLEDGER (item);
+ DECLARE_ACKNOWLEDGER (break_aligned);
void stop_translation_timestep ();
void start_translation_timestep ();
+
+ vector<Grob*> break_aligned_;
public:
TRANSLATOR_DECLARATIONS (Separating_line_group_engraver);
};
}
}
+void
+Separating_line_group_engraver::acknowledge_break_aligned (Grob_info gi)
+{
+ break_aligned_.push_back (gi.grob ());
+}
+
void
Separating_line_group_engraver::start_translation_timestep ()
{
void
Separating_line_group_engraver::stop_translation_timestep ()
{
+ for (vsize i = 0; i < break_aligned_.size (); i++)
+ {
+ SCM smob = break_aligned_[i]->self_scm ();
+
+ if (Item *sp = current_spacings_.staff_spacing_)
+ Pointer_group_interface::add_grob (sp, ly_symbol2scm ("left-break-aligned"), smob);
+
+ for (vsize j = 0; j < last_spacings_.note_spacings_.size (); j++)
+ Pointer_group_interface::add_grob (last_spacings_.note_spacings_[j],
+ ly_symbol2scm ("right-break-aligned"), smob);
+ }
+
if (!current_spacings_.is_empty ())
last_spacings_ = current_spacings_;
Pointer_group_interface::add_grob (sp, ly_symbol2scm ("right-items"), col);
current_spacings_.clear ();
+ break_aligned_.clear ();
}
ADD_ACKNOWLEDGER (Separating_line_group_engraver, item);
+ADD_ACKNOWLEDGER (Separating_line_group_engraver, break_aligned);
+
ADD_TRANSLATOR (Separating_line_group_engraver,
/* doc */ "Generates objects for computing spacing parameters.",
return out;
}
-/*
- Try to find the break-aligned symbol in SEPARATION_ITEM that is
- sticking out at direction D. The x size is put in LAST_EXT
-*/
-Grob *
-Separation_item::extremal_break_aligned_grob (Grob *me,
- Direction d,
- Interval *last_ext)
-{
- Grob *col = dynamic_cast<Item *> (me)->get_column ();
- last_ext->set_empty ();
- Grob *last_grob = 0;
-
- extract_grob_set (me, "elements", elts);
- for (vsize i = elts.size (); i--;)
- {
- Grob *break_item = elts[i];
- if (!scm_is_symbol (break_item->get_property ("break-align-symbol")))
- continue;
-
- if (!scm_is_pair (break_item->get_property ("space-alist")))
- continue;
-
- Interval ext = break_item->extent (col, X_AXIS);
-
- if (ext.is_empty ())
- continue;
-
- if (!last_grob
- || (last_grob && d * (ext[d]- (*last_ext)[d]) > 0))
- {
- *last_ext = ext;
- last_grob = break_item;
- }
- }
-
- return last_grob;
-}
-
extern bool debug_skylines;
MAKE_SCHEME_CALLBACK (Separation_item, print, 1)
SCM
return get_note_columns (elts);
}
+/*
+ Try to find the break-aligned symbol that belongs on the D-side
+ of ME, sticking out in direction -D. The x size is put in LAST_EXT
+*/
+Grob *
+Spacing_interface::extremal_break_aligned_grob (Grob *me,
+ Direction d,
+ Direction break_dir,
+ Interval *last_ext)
+{
+ Grob *col = 0;
+ last_ext->set_empty ();
+ Grob *last_grob = 0;
+
+ extract_grob_set (me, d == LEFT ? "left-break-aligned" : "right-break-aligned", elts);
+
+ for (vsize i = elts.size (); i--;)
+ {
+ Item *break_item = dynamic_cast<Item*> (elts[i]);
+
+ if (break_item->break_status_dir () != break_dir)
+ break_item = break_item->find_prebroken_piece (break_dir);
+
+ if (!break_item || !scm_is_pair (break_item->get_property ("space-alist")))
+ continue;
+
+ if (!col)
+ col = dynamic_cast<Item*> (elts[0])->get_column ()->find_prebroken_piece (break_dir);
+
+ Interval ext = break_item->extent (col, X_AXIS);
+
+ if (ext.is_empty ())
+ continue;
+
+ if (!last_grob
+ || (last_grob && d * (ext[-d]- (*last_ext)[-d]) < 0))
+ {
+ *last_ext = ext;
+ last_grob = break_item;
+ }
+ }
+
+ return last_grob;
+}
+
+
ADD_INTERFACE (Spacing_interface,
"This object calculates the desired and minimum distances between two columns.",
Grob *left_col = me_item->get_column ();
Interval last_ext;
- Grob *last_grob = Separation_item::extremal_break_aligned_grob (left_col, RIGHT,
- &last_ext);
+ Direction break_dir = me_item->break_status_dir ();
+ Grob *last_grob = Spacing_interface::extremal_break_aligned_grob (me, LEFT,
+ break_dir,
+ &last_ext);
if (!last_grob)
{
/*