#include <math.h>
+#include "align-interface.hh"
#include "axis-group-interface.hh"
#include "warn.hh"
#include "system.hh"
#include "spacing-interface.hh"
#include "staff-symbol-referencer.hh"
#include "paper-book.hh"
-#include "paper-line.hh"
+#include "paper-system.hh"
System::System (SCM s)
: Spanner (s)
}
g->suicide ();
}
- else if (g->live ())
+ else if (g->is_live ())
g->do_break_processing ();
}
progress_indication (_f ("Element count %d.", count + element_count ()));
int line_count = broken_intos_.size ();
- SCM lines = scm_c_make_vector (line_count, SCM_UNDEFINED);
+ SCM lines = scm_c_make_vector (line_count, SCM_EOL);
- for (int i = 0; i < line_count; i++)
+ for (int i = 0; i < line_count; i++)
{
if (verbose_global_b)
progress_indication ("[");
if (verbose_global_b)
progress_indication (to_string (i) + "]");
}
- return lines;
+ return lines;
}
/* Find the loose columns in POSNS, and drape them around the columns
if (verbose_global_b)
progress_indication (_f ("Grob count %d", element_count ()));
-
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
unsmob_grob (ly_car (s))->handle_prebroken_dependencies ();
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
{
- Grob* sc = unsmob_grob (ly_car (s));
+ Grob *sc = unsmob_grob (ly_car (s));
sc->calculate_dependencies (PRECALCED, PRECALCING, ly_symbol2scm ("before-line-breaking-callback"));
}
- progress_indication ("\n" + _ ("Calculating line breaks...") + " ");
+ progress_indication ("\n");
+ progress_indication (_ ("Calculating line breaks..."));
+ progress_indication (" ");
for (SCM s = get_property ("all-elements"); ly_c_pair_p (s); s = ly_cdr (s))
{
Grob *e = unsmob_grob (ly_car (s));
programming_error ("System with zero extent.");
else
translate_axis (-iv[MAX], Y_AXIS);
-
+
/* Generate all stencils to trigger font loads.
This might seem inefficient, but Stencils are cached per grob
anyway. */
{
static int const LAYER_COUNT = 3;
- SCM stencils = SCM_EOL;
- if (Stencil *me = get_stencil ())
- stencils = scm_cons (me->smobbed_copy (), stencils);
+ SCM exprs = SCM_EOL;
+ SCM *tail = &exprs;
/* Output stencils in three layers: 0, 1, 2. Default layer: 1.
Start with layer 3, since scm_cons prepends to list. */
SCM all = get_property ("all-elements");
-
- Real penalty = 0;
+ Interval staff_refpoints;
+ staff_refpoints.set_empty();
+
for (int i = LAYER_COUNT; i--;)
for (SCM s = all; ly_c_pair_p (s); s = ly_cdr (s))
{
Grob *g = unsmob_grob (ly_car (s));
Stencil *stil = g->get_stencil ();
+ if (i == 0
+ && Axis_group_interface::has_interface (g)
+ && !Align_interface::has_interface (g)
+ && dynamic_cast<Spanner*> (g))
+ {
+ staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
+ }
+
/* Skip empty stencils and grobs that are not in this layer. */
if (!stil
|| robust_scm2int (g->get_property ("layer"), 1) != i)
/* Must copy the stencil, for we cannot change the stencil
cached in G. */
- SCM my_stencil = stil->smobbed_copy ();
- unsmob_stencil (my_stencil)->translate (o + extra);
- stencils = scm_cons (my_stencil, stencils);
- if (g->original_)
- {
- if (Item *it = dynamic_cast <Item*> (g))
- {
- Grob *col = it->get_column ();
- SCM s = col->get_property ("page-penalty");
- // FIXME; page breaking is not discrete at +-10000
- if (ly_c_number_p (s)) // && fabs (ly_scm2double (s)) < 10000)
- penalty += ly_scm2double (s);
- }
- }
+ Stencil st = *stil;
+ st.translate (o + extra);
+ *tail = scm_cons (st.expr (), SCM_EOL);
+ tail = SCM_CDRLOC(*tail);
}
+ if (Stencil *me = get_stencil ())
+ exprs = scm_cons (me->expr (), exprs);
+
Interval x (extent (this, X_AXIS));
Interval y (extent (this, Y_AXIS));
- Paper_line *pl = new Paper_line (Offset (x.length (), y.length ()),
- stencils, (bool) penalty); // FIXME.
-
+ Stencil sys_stencil (Box (x,y),
+ scm_cons (ly_symbol2scm ("combine-stencil"),
+ exprs));
+
+ Paper_system *pl = new Paper_system (sys_stencil, false);
+ pl->staff_refpoints_ = staff_refpoints;
+ Item * break_point =this->get_bound(LEFT);
+ pl->penalty_ =
+ robust_scm2double (break_point->get_property ("page-penalty"), 0.0);
+
return scm_gc_unprotect_object (pl->self_scm ());
}