--- /dev/null
+\header{
+ texidoc = "Notes that fill a whole measure are preceded by extra space. "
+
+ }
+
+\version "2.11.10"
+
+\layout{
+ ragged-right=##t
+}
+
+\new Staff \relative {
+ \override Score.NonMusicalPaperColumn #'stencil = #ly:paper-column::print
+ \override Score.NonMusicalPaperColumn #'layer = #1
+
+ \time 4/4
+ s1
+ c2. c4
+ \time 3/4
+ c2.
+}
Interval other_lines = line_dimensions_int (pscore_->layout (), 1);
/* do all the rod/spring problems */
breaks_ = pscore_->find_break_indices ();
- all_ = pscore_->root_system ()->columns ();
+ all_ = pscore_->root_system ()->used_columns ();
lines_.resize (breaks_.size (), breaks_.size (), Line_details ());
vector<Real> forces = get_line_forces (all_,
other_lines.length (),
#include "lily-proto.hh"
#include "rational.hh"
+#include "std-vector.hh"
struct Spacing_options
{
Rational global_shortest_;
Real increment_;
Real shortest_duration_space_;
-
+ vector<Grob*> columns_;
+
Spacing_options();
void init_from_grob (Grob *me);
Real get_duration_space (Rational d, bool *) const;
static Real get_duration_space (Moment dur, Spacing_options const *, bool *);
static Rational effective_shortest_duration (Grob *me, vector<Grob*> const &all);
static void breakable_column_spacing (Grob *, Item *l, Item *r, Spacing_options const *);
- static void prune_loose_columns (Grob *, vector<Grob*> *cols, Spacing_options const *);
+ static void prune_loose_columns (Grob *, Spacing_options *);
static void set_explicit_neighbor_columns (vector<Grob*> const &cols);
static void set_implicit_neighbor_columns (vector<Grob*> const &cols);
- static void generate_springs (Grob *me, vector<Grob*> const &cols, Spacing_options const *);
+ static void generate_springs (Grob *me, Spacing_options const *);
static void musical_column_spacing (Grob *, Item *, Item *, Spacing_options const *);
- static vector<Grob*> get_columns (Spanner *me);
-
+ static bool fills_measure (Grob *, Item *, Item *);
public:
+ static vector<Grob*> get_columns (Grob *me);
static Real note_spacing (Grob *, Grob *, Grob *, Spacing_options const *, bool *);
static void standard_breakable_column_spacing (Grob *me, Item *l, Item *r,
Real *fixed, Real *space,
DECLARE_GROB_INTERFACE();
vector<Item*> broken_col_range (Item const *, Item const *) const;
- vector<Grob*> columns () const;
- Grob *column (int i) const;
+ vector<Grob*> used_columns () const;
+ Grob *column (vsize i) const;
void add_column (Paper_column *);
void typeset_grob (Grob *);
{
if (all_[i].pscore_)
{
- vector<Grob*> cols = all_[i].pscore_->root_system ()->columns ();
+ vector<Grob*> cols = all_[i].pscore_->root_system ()->used_columns ();
vector<vsize> line_breaker_columns;
line_breaker_columns.push_back (0);
Stencil l = Lookup::filled_box (Box (Interval (-0.01, 0.01),
Interval (-2, -1)));
- System * my_system = me->get_system ();
SCM small_letters = scm_cons (scm_acons (ly_symbol2scm ("font-size"),
scm_from_int (-6), SCM_EOL),
properties);
vector<vsize>
Paper_score::find_break_indices () const
{
- vector<Grob*> all = root_system ()->columns ();
+ vector<Grob*> all = root_system ()->used_columns ();
vector<vsize> retval;
for (vsize i = 0; i < all.size (); i++)
down the road.
doubly, also done in Score_engraver */
- vector<Grob*> pc (system_->columns ());
+ vector<Grob*> pc (system_->used_columns ());
pc[0]->set_property ("line-break-permission", ly_symbol2scm ("allow"));
pc.back ()->set_property ("line-break-permission", ly_symbol2scm ("allow"));
between.
*/
void
-Spacing_spanner::prune_loose_columns (Grob *me, vector<Grob*> *cols,
- Spacing_options const *options)
-{
+Spacing_spanner::prune_loose_columns (Grob *me, Spacing_options *options)
+ {
+ vector<Grob*> *cols = &options->columns_;
vector<Grob*> newcols;
for (vsize i = 0; i < cols->size (); i++)
*/
#include "spacing-options.hh"
+#include "spacing-spanner.hh"
#include "grob.hh"
#include "misc.hh"
#include "moment.hh"
+#include "spanner.hh"
void
Spacing_options::init_from_grob (Grob *me)
else
global_shortest_ = shortest_dur.grace_part_;
+ columns_ = Spacing_spanner::get_columns (me); // ugh.
}
Spacing_options::Spacing_options ()
#include "warn.hh"
vector<Grob*>
-Spacing_spanner::get_columns (Spanner *me)
+Spacing_spanner::get_columns (Grob *me_grob)
{
- vector<Grob*> all (get_root_system (me)->columns ());
+ Spanner *me = dynamic_cast<Spanner*> (me_grob);
+ vector<Grob*> all (get_root_system (me)->used_columns ());
vsize start = binary_search (all, (Grob*)me->get_bound (LEFT),
&Paper_column::less_than);
vsize end = binary_search (all, (Grob*) me->get_bound (RIGHT),
- &Paper_column::less_than);
-
+ &Paper_column::less_than);
+
all = vector<Grob*>::vector<Grob*> (all.begin () + start,
all.begin () + end + 1);
return all;
/*
can't use get_system() ? --hwn.
*/
- vector<Grob*> all (get_columns (me));
- set_explicit_neighbor_columns (all);
-
Spacing_options options;
options.init_from_grob (me);
- prune_loose_columns (me, &all, &options);
- set_implicit_neighbor_columns (all);
- generate_springs (me, all, &options);
+ set_explicit_neighbor_columns (options.columns_);
+
+ prune_loose_columns (me, &options);
+ set_implicit_neighbor_columns (options.columns_);
+ generate_springs (me, &options);
return SCM_UNSPECIFIED;
}
void
Spacing_spanner::generate_springs (Grob *me,
- vector<Grob*> const &cols,
Spacing_options const *options)
{
Paper_column *prev = 0;
- for (vsize i = 0; i < cols.size (); i++)
+ for (vsize i = 0; i < options->columns_.size (); i++)
{
- Paper_column *col = dynamic_cast<Paper_column *> (cols[i]);
- Paper_column *next = (i < cols.size()-1) ? dynamic_cast<Paper_column *> (cols[i+1]) : 0;
+ Paper_column *col = dynamic_cast<Paper_column *> (options->columns_[i]);
+ Paper_column *next = (i < options->columns_.size()-1) ? dynamic_cast<Paper_column *> (options->columns_[i+1]) : 0;
if (i > 0)
generate_pair_spacing (me, prev, col, next, options);
Spaceable_grob::add_spring (left_col, right_col, distance, inverse_strength);
}
+bool
+Spacing_spanner::fills_measure (Grob *me, Item *l, Item *r)
+{
+ return false;
+ System *sys = get_root_system (me);
+ Grob *next = sys->column (r->get_column()->get_rank () + 1);
+ if (!next)
+ return false;
+
+ Moment dt =
+ Paper_column::when_mom (next) - Paper_column::when_mom (r);
+
+ Moment *len = unsmob_moment (l->get_property ("measure-length"));
+ if (!len)
+ return false;
+
+ if (dt.main_part_ == len->main_part_)
+ return true;
+
+ return false;
+}
/*
Read hints from L and generate springs.
*/
/*
column for the left one settings should be ok due automatic
pointer munging.
-
*/
assert (spacing_grob->get_column () == l);
}
+ if (fills_measure (me, l, r))
+ {
+ compound_space += 1.0;
+ }
+
if (options->stretch_uniformly_ && l->break_status_dir () != RIGHT)
compound_fixed = 0.0;
/** Return all columns, but filter out any unused columns , since they might
disrupt the spacing problem. */
vector<Grob*>
-System::columns () const
+System::used_columns () const
{
extract_grob_set (this, "columns", ro_columns);
}
Grob*
-System::column (int which) const
+System::column (vsize which) const
{
extract_grob_set (this, "columns", columns);
+ if (which >= columns.size ())
+ return 0;
+
return columns[which];
}