Spacing_spanner::Spacing_spanner ()
{
- set_elt_property (break_helper_only_scm_sym, SCM_BOOL_T);
- set_elt_property (transparent_scm_sym, SCM_BOOL_T);
-}
-
-int
-Spacing_spanner::col_count () const
-{
- return pscore_l_->line_l_->cols_.size ();
-}
-
-Score_column *
-Spacing_spanner::scol (int i)const
-{
- return dynamic_cast<Score_column*> (pscore_l_->line_l_->cols_[i]);
+ set_empty (X_AXIS);
+ set_empty (Y_AXIS);
+ set_elt_property ("transparent", SCM_BOOL_T);
}
/*
*/
Array<Spring>
-Spacing_spanner::do_measure (int col1, int col2) const
+Spacing_spanner::do_measure (Link_array<Score_column> cols) const
{
- for (int i =col1; i < col2; i++)
+ for (int i =0 ; i < cols.size (); i++)
{
- scol (i)->preprocess ();
- scol (i)->print ();
+ cols[i]->preprocess ();
+ cols[i]->print ();
}
Moment shortest;
shortest.set_infinite (1);
- for (int i =col1; i < col2; i++)
+ for (int i =0 ; i < cols.size (); i++)
{
- if (scol(i)->musical_b ())
+ if (cols[i]->musical_b ())
{
- shortest = shortest <? scol(i)->shortest_starter_mom_;
+ shortest = shortest <? cols[i]->shortest_starter_mom_;
}
}
Array<Spring> meas_springs;
Real non_musical_space_strength = paper_l ()->get_var ("breakable_column_space_strength");
- for (int i= col1; i < col2; i++)
+ for (int i= 0; i < cols.size (); i++)
{
- Item * l = scol(i);
- Item * r = scol(i+1);
+ Item * l = cols[i];
+ Item * r = cols[i+1];
Item * lb = l->find_broken_piece (RIGHT);
Item * rb = r->find_broken_piece (LEFT);
s.item_l_drul_[LEFT] = lc;
s.item_l_drul_[RIGHT] = rc;
- SCM hint = lc->get_elt_property (extra_space_scm_sym);
- SCM next_hint = rc->get_elt_property (extra_space_scm_sym);
- SCM stretch_hint = lc->get_elt_property (stretch_distance_scm_sym);
- SCM next_stretch_hint = rc->get_elt_property (stretch_distance_scm_sym);
+ SCM hint = lc->get_elt_property ("extra-space");
+ SCM next_hint = rc->get_elt_property ("extra-space");
+ SCM stretch_hint = lc->get_elt_property ("stretch-distance");
+ SCM next_stretch_hint = rc->get_elt_property ("stretch-distance");
Real left_distance;
- if (hint != SCM_BOOL_F)
+ if (hint != SCM_UNDEFINED)
{
- hint = SCM_CDDR (hint);
-
- left_distance = gh_scm2double (hint);
+ left_distance = gh_scm2double (gh_cdr (hint));
}
- else if (!lc->musical_b() && i+1 < col_count())
+ // 2nd condition should be (i+1 < col_count()), ie. not the last column in score. FIXME
+ else if (!lc->musical_b() && i+1 < cols.size ())
{
left_distance= default_bar_spacing (lc,rc,shortest);
}
Real right_dist = 0.0;
- if (next_hint != SCM_BOOL_F)
+ if (next_hint != SCM_UNDEFINED)
{
- next_hint = SCM_CADR(next_hint);
- right_dist += - gh_scm2double (next_hint);
+ right_dist += - gh_scm2double (gh_car (next_hint));
}
else
{
*/
if (lc->musical_b () && rc->musical_b ())
{
- if (rc->get_elt_property (contains_grace_scm_sym) == SCM_BOOL_F)
+ if (rc->get_elt_property ("contains-grace") == SCM_UNDEFINED)
right_dist *= paper_l ()->get_var ("musical_to_musical_left_spacing_factor");
}
- if (rc->musical_b () && rc->get_elt_property (contains_grace_scm_sym) != SCM_BOOL_F)
+ if (rc->musical_b () && rc->get_elt_property ("contains-grace") != SCM_UNDEFINED)
right_dist *= paper_l ()->get_var ("before_grace_spacing_factor");
s.distance_f_ = left_distance + right_dist;
Real stretch_dist = 0.;
- if (stretch_hint != SCM_BOOL_F)
- stretch_dist += gh_scm2double (SCM_CDDR (stretch_hint));
+ if (gh_number_p (stretch_hint))
+ stretch_dist += gh_scm2double (stretch_hint);
else
stretch_dist += left_distance;
- if (next_stretch_hint != SCM_BOOL_F)
+ if (next_stretch_hint != SCM_UNDEFINED)
// see regtest spacing-tight
- stretch_dist += - gh_scm2double (SCM_CADR (next_stretch_hint));
+ stretch_dist += - gh_scm2double (SCM_CAR (next_stretch_hint));
else
stretch_dist += right_dist;
Real
Spacing_spanner::stem_dir_correction (Score_column*l, Score_column*r) const
{
- SCM dl = l->get_elt_property (dir_list_scm_sym);
- SCM dr = r->get_elt_property (dir_list_scm_sym);
- if (dl == SCM_BOOL_F || dr == SCM_BOOL_F)
+ SCM dl = l->get_elt_property ("dir-list");
+ SCM dr = r->get_elt_property ("dir-list");
+ if (dl == SCM_UNDEFINED || dr == SCM_UNDEFINED)
return 0.0;
- dl = SCM_CDR (dl);
- dr = SCM_CDR (dr);
if (scm_ilength (dl) != 1 && scm_ilength (dr) != 1)
return 0.;
bool err = false;
Real correction = 0.0;
- Real ssc = paper_l ()->get_realvar(ly_symbol ("stemSpacingCorrection"));
+ Real ssc = paper_l ()->get_var("stemSpacingCorrection");
if (d1 && d2)
Spacing_spanner::get_springs () const
{
Array<Spring> springs;
- int last_break =0;
- for (int i=1; i < col_count (); i++)
+
+ SCM last_col = pscore_l_->line_l_->get_elt_property ("columns");
+ Link_array<Score_column> measure;
+ for (SCM s = last_col; gh_pair_p (s); s = gh_cdr (s))
{
- if (scol (i)->breakable_b ())
+ SCM elt = gh_car (s);
+ Score_column* sc = dynamic_cast<Score_column*> (SMOB_TO_TYPE (Score_column, elt));
+ measure.push (sc);
+ if (sc->breakable_b ())
{
- springs.concat (do_measure (last_break, i));
- last_break = i;
+ measure.reverse ();
+ springs.concat (do_measure (measure));
+ measure.clear ();
+ measure.push (sc);
}
}
return springs;
+