(c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
-#include <math.h>
+#include "system.hh"
+
+#include <cmath>
#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 (SCM s)
- : Spanner (s)
+
+System::System (System const &src, int count)
+ : Spanner (src, count)
{
rank_ = 0;
}
+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
{
{
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_);
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 ()
{
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"));
}
Start with layer 3, since scm_cons prepends to list. */
SCM all = get_property ("all-elements");
- Interval staff_refpoints;
- staff_refpoints.set_empty();
for (int i = LAYER_COUNT; i--;)
for (SCM s = all; scm_is_pair (s); s = scm_cdr (s))
Grob *g = unsmob_grob (scm_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)
- /*
- UGH.
- */
- && !g->internal_has_interface (ly_symbol2scm ("dynamic-interface"))
- && !g->internal_has_interface (ly_symbol2scm ("piano-pedal-interface"))
- )
- {
- 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)
Stencil sys_stencil (Box (x,y),
scm_cons (ly_symbol2scm ("combine-stencil"),
exprs));
+
+ Interval staff_refpoints;
+ staff_refpoints.set_empty();
+ for (SCM s = get_property ("spaceable-staves");
+ scm_is_pair (s); s = scm_cdr (s))
+ {
+ Grob *g = unsmob_grob (scm_car (s));
+ staff_refpoints.add_point (g->relative_coordinate (this, Y_AXIS));
+ }
+
Paper_system *pl = new Paper_system (sys_stencil, false);
pl->staff_refpoints_ = staff_refpoints;
Item * break_point =this->get_bound(LEFT);
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 columns")
+ "all-elements spaceable-staves columns")