source file of the GNU LilyPond music typesetter
- (c) 1996--2003 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1996--2004 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "input-smob.hh"
#include "string.hh"
#include "warn.hh"
#include "dimensions.hh"
-#include "molecule.hh"
+#include "stencil.hh"
#include "all-font-metrics.hh"
#include "spacing-interface.hh"
+#include "staff-symbol-referencer.hh"
// todo: use map.
void
if (i && arr[i] == arr[i-1])
continue;
- SCM_SETCAR(s, arr[i]);
- s = SCM_CDR(s);
+ SCM_SETCAR(s, arr[i]);
+
+ if (i < len - 1)
+ s = SCM_CDR(s);
}
SCM_SETCDR(s, SCM_EOL);
+ delete arr;
return l;
}
programming_error ("Adding element twice.");
elem->pscore_ = pscore_;
- Pointer_group_interface::add_grob (this, ly_symbol2scm ("all-elements"),elem);
+ Pointer_group_interface::add_grob (this, ly_symbol2scm ("all-elements"), elem);
scm_gc_unprotect_object (elem->self_scm ());
}
Kill no longer needed grobs.
*/
Item * it = dynamic_cast<Item*> (g);
- if (it && Item::breakable_b(it))
+ if (it && Item::is_breakable (it))
{
it->find_prebroken_piece (LEFT)->suicide();
it->find_prebroken_piece (RIGHT)->suicide();
*/
for (int i=0; i < broken_intos_.size (); i++)
{
- SCM al = broken_intos_[i]->get_grob_property ("all-elements");
-
/*
don't do this: strange side effects.
*/
+ // SCM al = broken_intos_[i]->get_grob_property ("all-elements");
// al = uniquify_list (al);
}
-
-
if (verbose_global_b)
progress_indication (_f ("Element count %d.", count + element_count ()));
if (col->system_)
continue;
-
Item * left = 0;
Item * right = 0;
if (!left && l)
{
left = l->get_column ();
+ if (!left->get_system ())
+ left = left->find_prebroken_piece (RIGHT);
}
divide_over ++;
-
loose = right = r->get_column ();
}
while (1);
+
+ if (!right->get_system ())
+ right = right->find_prebroken_piece (LEFT);
/*
We divide the remaining space of the column over the left and
Grob * common = right->common_refpoint (left, X_AXIS);
Real rx = right->extent(common, X_AXIS)[LEFT];
- Real lx = left->extent(common, X_AXIS)[RIGHT];
+ Real lx = left->extent(common, X_AXIS)[RIGHT];
Real total_dx = rx - lx;
Interval cval =col->extent (col, X_AXIS);
dx *= 0.5;
col->system_ = which;
+ col->translate_axis (- col->relative_coordinate (common, X_AXIS), X_AXIS);
col->translate_axis (lx + dx - cval[LEFT], X_AXIS);
}
}
}
void
-System::output_molecule (SCM expr, Offset o)
+System::output_stencil (SCM expr, Offset o)
{
while (1)
{
pscore_->outputter_->output_scheme (scm_list_n (head, SCM_UNDEFINED));
expr = ly_cadr (expr);
}
- else if (head == ly_symbol2scm ("translate-molecule"))
+ else if (head == ly_symbol2scm ("translate-stencil"))
{
o += ly_scm2offset (ly_cadr (expr));
expr = ly_caddr (expr);
}
- else if (head == ly_symbol2scm ("combine-molecule"))
+ else if (head == ly_symbol2scm ("combine-stencil"))
{
- output_molecule (ly_cadr (expr), o);
+ output_stencil (ly_cadr (expr), o);
expr = ly_caddr (expr);
}
else
}
}
+
+ const int LAYER_COUNT= 3;
+
+
+
void
System::post_processing (bool last_line)
{
}
/*
- generate all molecules to trigger all font loads.
+ generate all stencils to trigger all font loads.
+ */
+ SCM all = get_grob_property ("all-elements") ;
+ all = uniquify_list (all);
- (ugh. This is not very memory efficient.) */
- this->get_molecule();
- for (SCM s = get_grob_property ("all-elements"); gh_pair_p (s); s = ly_cdr (s))
+ /*
+ trigger font loads first.
+
+ This might seem inefficient, but Stencils are cached per grob
+ anyway.
+ */
+ this->get_stencil();
+ for (SCM s = all; gh_pair_p (s); s = ly_cdr (s))
{
- unsmob_grob (ly_car (s))->get_molecule ();
+ Grob * g = unsmob_grob (ly_car (s));
+ g->get_stencil ();
}
+
/*
font defs;
*/
/* Output elements in three layers, 0, 1, 2.
The default layer is 1. */
{
- Molecule *m = this->get_molecule();
+ Stencil *m = this->get_stencil();
if (m)
- output_molecule (m->get_expr (), Offset(0,0));
+ output_stencil (m->get_expr (), Offset(0,0));
}
for (int i = 0; i < 3; i++)
s = ly_cdr (s))
{
Grob *sc = unsmob_grob (ly_car (s));
- Molecule *m = sc->get_molecule ();
+ Stencil *m = sc->get_stencil ();
if (!m)
continue;
SCM e = sc->get_grob_property ("extra-offset");
if (gh_pair_p (e))
{
- o[X_AXIS] += gh_scm2double (ly_car (e));
- o[Y_AXIS] += gh_scm2double (ly_cdr (e));
+ Offset z = ly_scm2offset (e);
+ z *= Staff_symbol_referencer::staff_space (sc);
+
+ o += z;
}
- output_molecule (m->get_expr (), o);
+ output_stencil (m->get_expr (), o);
}
while (gh_pair_p (s) && ly_car (s) != l->self_scm ())
{
Paper_column*c = dynamic_cast<Paper_column*> (unsmob_grob (ly_car (s)));
- if (Item::breakable_b (c) && !c->system_)
+ if (Item::is_breakable (c) && !c->system_)
ret.push (c);
s = ly_cdr (s);
bool bfound = false;
for (int i= acs.size (); i -- ;)
{
- bool brb = Item::breakable_b (acs[i]);
+ bool brb = Item::is_breakable (acs[i]);
bfound = bfound || brb;
/*
seem empty. We need to retain breakable columns, in case
someone forced a breakpoint.
*/
- if (!bfound || !Paper_column::used_b (acs[i]))
+ if (!bfound || !Paper_column::is_used (acs[i]))
acs.del (i);
}
return acs;
ADD_INTERFACE (System,"system-interface",
- "Super grob, parent of all: "
-"\n\n"
-"The columns of a score that form one line. The toplevel grob. Any "
-"grob has a Line_of_score as both X and Y reference point. The "
-"Paper_score contains one grob of this type. Control enters the "
-"Grob dependency calculation from this single Line_of_score "
-"object.",
- "between-system-string all-elements columns");
+ "This is the toplevel object: each object in a score "
+ "ultimately has a System object as its X and Y parent. "
+ ,
+ "between-system-string all-elements columns");