/*
This file is part of LilyPond, the GNU music typesetter.
- Copyright (C) 1996--2012 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ Copyright (C) 1996--2014 Han-Wen Nienhuys <hanwen@xs4all.nl>
LilyPond is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
#include "pointer-group-interface.hh"
#include "skyline-pair.hh"
#include "staff-symbol-referencer.hh"
+#include "system-start-delimiter.hh"
#include "text-interface.hh"
#include "warn.hh"
#include "unpure-pure-container.hh"
scm_vector_set_x (lines, scm_from_int (i),
system->get_paper_system ());
- debug_output (to_string (i) + "]", false);
+ debug_output (::to_string (i) + "]", false);
}
return lines;
}
if (Item *item = dynamic_cast<Item *>(at_bat))
{
+ /*
+ We use this to weed out grobs that fall at the end
+ of the line when we want grobs at the beginning.
+ */
+ end_of_line_visible = item->break_status_dir () == LEFT;
+
if (!Item::break_visible (item))
continue;
// safeguard to bring down the column rank so that end of line footnotes show up on the correct line
continue;
if (!at_bat->is_live ())
continue;
+ /*
+ TODO
+ Sometimes, there are duplicate entries in the all_elements_
+ list. In a separate patch, this practice should be squashed
+ so that the check below can be eliminated.
+ */
+ if (find (out.begin (), out.end (), at_bat) != out.end ())
+ continue;
out.push_back (at_bat);
}
return grobs_scm;
}
+MAKE_SCHEME_CALLBACK (System, vertical_skyline_elements, 1);
+SCM
+System::vertical_skyline_elements (SCM smob)
+{
+ Grob *me_grob = unsmob_grob (smob);
+ vector<Grob *> vertical_skyline_grobs;
+ extract_grob_set (me_grob, "elements", my_elts);
+ for (vsize i = 0; i < my_elts.size (); i++)
+ if (System_start_delimiter::has_interface (my_elts[i]))
+ vertical_skyline_grobs.push_back (my_elts[i]);
+
+ System *me = dynamic_cast<System *> (me_grob);
+ Grob *align = unsmob_grob (me->get_object ("vertical-alignment"));
+ if (!align)
+ {
+ SCM grobs_scm = Grob_array::make_array ();
+ unsmob_grob_array (grobs_scm)->set_array (vertical_skyline_grobs);
+ return grobs_scm;
+ }
+
+ extract_grob_set (align, "elements", elts);
+
+ for (vsize i = 0; i < elts.size (); i++)
+ if (Hara_kiri_group_spanner::has_interface (elts[i]))
+ vertical_skyline_grobs.push_back (elts[i]);
+
+ SCM grobs_scm = Grob_array::make_array ();
+ unsmob_grob_array (grobs_scm)->set_array (vertical_skyline_grobs);
+ return grobs_scm;
+}
+
void
System::break_into_pieces (vector<Column_x_positions> const &breaking)
{
anyway. */
vector<Grob *> all_elts_sorted (all_elements_->array ());
- vector_sort (all_elts_sorted, std::less<Grob *> ());
- uniq (all_elts_sorted);
+ uniquify (all_elts_sorted);
this->get_stencil ();
for (vsize i = all_elts_sorted.size (); i--;)
{
pl->set_property ("last-in-score", SCM_BOOL_T);
Interval staff_refpoints;
- if (Grob *align = get_vertical_alignment ())
+ if (Grob *align = unsmob_grob (get_object ("vertical-alignment")))
{
extract_grob_set (align, "elements", staves);
for (vsize i = 0; i < staves.size (); i++)
return dynamic_cast<System *> (system_grob);
}
-Grob *
-System::get_vertical_alignment ()
+MAKE_SCHEME_CALLBACK (System, get_vertical_alignment, 1);
+SCM
+System::get_vertical_alignment (SCM smob)
{
- extract_grob_set (this, "elements", elts);
+ Grob *me = unsmob_grob (smob);
+ extract_grob_set (me, "elements", elts);
Grob *ret = 0;
for (vsize i = 0; i < elts.size (); i++)
if (Align_interface::has_interface (elts[i]))
{
if (ret)
- programming_error ("found multiple vertical alignments in this system");
+ me->programming_error ("found multiple vertical alignments in this system");
ret = elts[i];
}
if (!ret)
- programming_error ("didn't find a vertical alignment in this system");
- return ret;
+ {
+ me->programming_error ("didn't find a vertical alignment in this system");
+ return SCM_EOL;
+ }
+ return ret->self_scm ();
}
// Finds the furthest staff in the given direction whose x-extent
Grob *
System::get_extremal_staff (Direction dir, Interval const &iv)
{
- Grob *align = get_vertical_alignment ();
+ Grob *align = unsmob_grob (get_object ("vertical-alignment"));
if (!align)
return 0;
Grob *
System::get_neighboring_staff (Direction dir, Grob *vertical_axis_group, Interval_t<int> bounds)
{
- Grob *align = get_vertical_alignment ();
+ Grob *align = unsmob_grob (get_object ("vertical-alignment"));
if (!align)
return 0;
System::pure_refpoint_extent (vsize start, vsize end)
{
Interval ret;
- Grob *alignment = get_vertical_alignment ();
+ Grob *alignment = unsmob_grob (get_object ("vertical-alignment"));
if (!alignment)
return Interval ();
Interval
System::part_of_line_pure_height (vsize start, vsize end, bool begin)
{
- Grob *alignment = get_vertical_alignment ();
+ Grob *alignment = unsmob_grob (get_object ("vertical-alignment"));
if (!alignment)
return Interval ();
extract_grob_set (me, "elements", elts);
vector<Grob *> relevant_grobs;
- SCM pure_relevant_p = ly_lily_module_constant ("pure-relevant?");
for (vsize i = 0; i < elts.size (); ++i)
{
if (!Axis_group_interface::has_interface (elts[i]))
{
- if (to_boolean (scm_apply_1 (pure_relevant_p, elts[i]->self_scm (), SCM_EOL)))
- relevant_grobs.push_back (elts[i]);
+ relevant_grobs.push_back (elts[i]);
if (Item *it = dynamic_cast<Item *> (elts[i]))
{
for (LEFT_and_RIGHT (d))
{
Item *piece = it->find_prebroken_piece (d);
- if (piece && to_boolean (scm_apply_1 (pure_relevant_p, piece->self_scm (), SCM_EOL)))
+ if (piece && piece->is_live ())
relevant_grobs.push_back (piece);
}
}
get_maybe_spaceable_staves (SCM smob, int filter)
{
System *me = dynamic_cast<System *> (unsmob_grob (smob));
- Grob *align = me->get_vertical_alignment ();
+ Grob *align = unsmob_grob (me->get_object ("vertical_alignment"));
SCM ret = SCM_EOL;
if (align)
"in-note-stencil "
"labels "
"pure-Y-extent "
- "skyline-horizontal-padding "
+ "vertical-alignment "
);