source file of the GNU LilyPond music typesetter
- (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--2005 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include "system.hh"
+
#include <math.h>
#include "align-interface.hh"
#include "axis-group-interface.hh"
#include "warn.hh"
-#include "system.hh"
#include "main.hh"
#include "paper-column.hh"
#include "output-def.hh"
-#include "paper-outputter.hh"
#include "paper-score.hh"
-#include "string.hh"
#include "warn.hh"
-#include "stencil.hh"
#include "all-font-metrics.hh"
#include "spacing-interface.hh"
#include "staff-symbol-referencer.hh"
#include "paper-book.hh"
#include "paper-system.hh"
+#include "tweak-registration.hh"
+
+
+System::System (System const &src, int count)
+ : Spanner (src, count)
+{
+ rank_ = 0;
+}
-System::System (SCM s)
- : Spanner (s)
+System::System (SCM s, Object_key const*key)
+ : Spanner (s, key)
{
rank_ = 0;
}
+
+Grob *
+System::clone (int count) const
+{
+ return new System (*this, count);
+}
+
+
int
System::element_count () const
{
fixups must be done in broken line_of_scores, because new elements
are put over there. */
int count = 0;
- for (int i=0; i < broken_intos_.size (); i++)
+ for (int i = 0; i < broken_intos_.size (); i++)
{
Grob *se = broken_intos_[i];
SCM all = se->get_property ("all-elements");
}
#endif
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Element count %d.", count + element_count ()));
int line_count = broken_intos_.size ();
for (int i = 0; i < line_count; i++)
{
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication ("[");
System *system = dynamic_cast<System*> (broken_intos_[i]);
system->post_processing ();
scm_vector_set_x (lines, scm_int2num (i), system->get_line ());
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (to_string (i) + "]");
}
return lines;
Real rx = right->extent (common, X_AXIS)[LEFT];
Real lx = left->extent (common, X_AXIS)[RIGHT];
Real total_dx = rx - lx;
- Interval cval =col->extent (col, X_AXIS);
+ Interval cval = col->extent (col, X_AXIS);
/* Put it in the middle. This is not an ideal solution -- the
break alignment code inserts a fixed space before the clef
{
for (int i = 0; i < breaking.size (); i++)
{
- System *system = dynamic_cast <System*> (clone ());
+ System *system = dynamic_cast <System*> (clone (i));
system->rank_ = i;
Link_array<Grob> c (breaking[i].cols_);
pscore_->typeset_line (system);
- system->set_bound (LEFT,c[0]);
- system->set_bound (RIGHT,c.top ());
+ system->set_bound (LEFT, c[0]);
+ system->set_bound (RIGHT, c.top ());
for (int j = 0; j < c.size (); j++)
{
c[j]->translate_axis (breaking[i].config_[j], X_AXIS);
Axis_group_interface::add_element (me, p);
}
+void
+apply_tweaks (Grob *g, bool broken)
+{
+ if (bool (g->original_) == broken)
+ {
+ SCM tweaks = global_registry_->get_tweaks (g);
+ for (SCM s = tweaks; scm_is_pair (s); s = scm_cdr (s))
+ {
+ SCM proc = scm_caar (s);
+ SCM rest = scm_cdar (s);
+ scm_apply_1 (proc, g->self_scm(), rest);
+ }
+ }
+}
+
void
System::pre_processing ()
{
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
unsmob_grob (scm_car (s))->discretionary_processing ();
- if (verbose_global_b)
+ if (be_verbose_global)
progress_indication (_f ("Grob count %d", element_count ()));
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
unsmob_grob (scm_car (s))->handle_prebroken_dependencies ();
fixup_refpoints (get_property ("all-elements"));
+
+ for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
+ apply_tweaks (unsmob_grob (scm_car (s)), false);
+
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
{
Grob *sc = unsmob_grob (scm_car (s));
for (SCM s = get_property ("all-elements"); scm_is_pair (s); s = scm_cdr (s))
{
Grob *g = unsmob_grob (scm_car (s));
+
+ apply_tweaks (g, true);
+
g->calculate_dependencies (POSTCALCED, POSTCALCING,
ly_symbol2scm ("after-line-breaking-callback"));
}
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. */
+ /* Output stencils in three layers: 0, 1, 2. Default layer: 1. */
SCM all = get_property ("all-elements");
- for (int i = LAYER_COUNT; i--;)
+ for (int i = 0; i < LAYER_COUNT; i++)
for (SCM s = all; scm_is_pair (s); s = scm_cdr (s))
{
Grob *g = unsmob_grob (scm_car (s));
Stencil st = *stil;
st.translate (o + extra);
+
*tail = scm_cons (st.expr (), SCM_EOL);
tail = SCM_CDRLOC(*tail);
}
Interval x (extent (this, X_AXIS));
Interval y (extent (this, Y_AXIS));
- Stencil sys_stencil (Box (x,y),
+ 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_ =
+ Item * break_point = this->get_bound(LEFT);
+ pl->break_before_penalty_ =
robust_scm2double (break_point->get_property ("page-penalty"), 0.0);
return scm_gc_unprotect_object (pl->self_scm ());
return acs;
}
-ADD_INTERFACE (System,"system-interface",
+ADD_INTERFACE (System, "system-interface",
"This is the toplevel object: each object in a score "
"ultimately has a System object as its X and Y parent. ",
"all-elements spaceable-staves columns")