MAJOR_VERSION=1
MINOR_VERSION=5
PATCH_LEVEL=4
-MY_PATCH_LEVEL=jcn4
+MY_PATCH_LEVEL=jcn5
# use the above to send patches: MY_PATCH_LEVEL is always empty for a
# released version.
cis] }
\translator Staff = bass
- \shiftOff
+ \shiftOff \stemUp
[bis gis] cis4 |
dis2 cis4 r8 cis }
\context Voice = one { \stemUp bis2 }
Array<int>
Break_algorithm::find_break_indices () const
{
- Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
+ Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
Array<int> retval;
for (int i=0; i < all.size (); i++)
}
-Link_array<Grob>
+Link_array<Item>
Break_algorithm::find_breaks () const
{
- Link_array<Grob> all = pscore_l_->line_l_->column_l_arr ();
- Link_array<Grob> retval;
+ Link_array<Item> all = pscore_l_->line_l_->column_l_arr ();
+ Link_array<Item> retval;
for (int i=0; i < all.size (); i++)
if (Item::breakable_b (all[i]))
Simple_spacer*
-Break_algorithm::generate_spacing_problem (Link_array<Grob> curline, Interval line) const
+Break_algorithm::generate_spacing_problem (Link_array<Item> curline, Interval line) const
{
Simple_spacer * sp = new Simple_spacer;
sp->line_len_f_ = line.length ();
sp->add_columns (curline);
-
-
return sp;
}
Gourlay_breaking::do_solve () const
{
Array<Break_node> optimal_paths;
- Link_array<Grob> all =
+ Link_array<Item> all =
pscore_l_->line_l_->column_l_arr ();
Array<int> breaks = find_break_indices ();
for (int start_idx = break_idx; start_idx--;)
{
- Link_array<Grob> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
+ Link_array<Item> line = all.slice (breaks[start_idx], breaks[break_idx]+1);
line[0] = dynamic_cast<Item*> (line[0]) ->find_prebroken_piece (RIGHT);
line.top () = dynamic_cast<Item*> (line.top ())->find_prebroken_piece (LEFT);
Real linewidth_f_;
/// search all pcols which are breakable.
- Link_array<Grob> find_breaks () const;
+ Link_array<Item> find_breaks () const;
Array<int> find_break_indices () const;
void solve_line (Column_x_positions*) const;
/// does curline fit on the paper?
- bool feasible (Link_array<Grob>) const;
+ bool feasible (Link_array<Item>) const;
- Simple_spacer* generate_spacing_problem (Link_array<Grob>, Interval) const;
+ Simple_spacer* generate_spacing_problem (Link_array<Item>, Interval) const;
virtual Array<Column_x_positions> do_solve () const=0;
struct Column_x_positions
{
- Link_array<Grob> cols_;
+ Link_array<Item> cols_;
Array<Real> config_;
Real force_f_;
bool satisfies_constraints_b_;
void output_lines ();
Link_array<Item> broken_col_range (Item const*, Item const*) const;
- Link_array<Grob> column_l_arr () const;
+ Link_array<Item> column_l_arr () const;
void add_column (Paper_column*);
void typeset_grob (Grob*);
{
public:
static void set_interface (Grob*);
- static void do_measure (Grob*,Link_array<Grob> const &) ;
- static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+ static void do_measure (Grob*,Link_array<Item> const &) ;
+ static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
static Real stem_dir_correction (Grob*,Grob*,Grob*) ;
static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment) ;
static Real note_spacing (Grob*,Grob*,Grob*,Moment) ;
static Real get_duration_space (Grob*,Moment dur, Moment shortest) ;
+ static void breakable_column_spacing (Item*,Item*);
};
#endif /* SPACING_SPANNER_HH */
struct Simple_spacer
{
Array<Spring_description> springs_;
+ Link_array<Item> spaced_cols_;
+ Link_array<Item> all_cols_;
+
Real force_f_;
Real indent_f_;
Real line_len_f_;
Simple_spacer ();
-
+
+ void do_wide_springs (Column_x_positions*) const;
void solve (Column_x_positions *) const;
- void add_columns (Link_array<Grob>);
+ void add_columns (Link_array<Item>);
void my_solve_linelen ();
void my_solve_natural_len ();
Real active_springs_stiffness () const;
{
public:
static void set_interface (Grob*);
- static void do_measure (Grob*,Link_array<Grob> const &) ;
- static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Grob> const &);
+ static void do_measure (Grob*,Link_array<Item> const &) ;
+ static void stretch_to_regularity (Grob*, Array<Spring> *, Link_array<Item> const &);
DECLARE_SCHEME_CALLBACK (set_springs, (SCM ));
+
static Real stem_dir_correction (Grob*,Grob*,Grob*) ;
static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment) ;
static Real note_spacing (Grob*,Grob*,Grob*,Moment) ;
#include "string.hh"
#include "main.hh"
#include "kpath.hh"
-#include "lily-version.hh"
char *
*/
kpse_set_program_name (av0, NULL);
kpse_maketex_option ("tfm", TRUE);
-
-#if 0
-
-
- /*
-
- Remove the setting for TFMFONTS if we have kpathsea, because
- kpathsea can find TFM fonts anyway.
-
- If we don't lily will want to make tfms for cmr fonts, even if
- there is a :: entry in the TFMFONTS path.
-
- This will fail if a user has special fonts (outside of feta) that
- can not be found by kpath.
-
- If TFMFONTS is unset, TFMs of feta will be generated on the
- fly. The risk is that this will cause checksum mismatch errors,
- but MF is reasonably deterministic (so we hope not).
-
- The advantage is that the PK font will also be generated under
- /var/texmf/fonts, reducing clutter and compilation time.
-
- */
-
-#ifndef __CYGWIN__ /* mktextfm/mktexpk does not work on windows */
- unsetenv ("TFMFONTS");
-#endif
-
-#ifdef DEBIAN
- String my_tfm = "$VARTEXFONTS/tfm/public/lilypond";
-#else
- String my_tfm = "$VARTEXFONTS/tfm/lilypond/";
- my_tfm += version_str () + "/";
-#endif
-
-#ifdef DEBIAN
- char * mypath = strdup ((my_tfm + ":").ch_C());
- kpse_format_info[kpse_tfm_format].client_path = mypath;
-#else
- char * mypath = kpse_expand (my_tfm.ch_C ());
-
- String prog = "mktextfm --destdir ";
- prog += mypath;
-
- kpse_format_info[kpse_tfm_format].program = strdup (prog.ch_C ());
-#endif
#endif
-#endif
-
}
Line_of_score *line_l = dynamic_cast <Line_of_score*> (clone ());
line_l->rank_i_ = i;
// line_l->set_immutable_grob_property ("rank", gh_int2scm (i));
- Link_array<Grob> c (breaking[i].cols_);
+ Link_array<Item> c (breaking[i].cols_);
pscore_l_->typeset_line (line_l);
line_l->set_bound (LEFT,c[0]);
Return all columns, but filter out any unused columns , since they might
disrupt the spacing problem.
*/
-Link_array<Grob>
+Link_array<Item>
Line_of_score::column_l_arr ()const
{
- Link_array<Grob> acs
- = Pointer_group_interface__extract_elements (this, (Grob*) 0, "columns");
+ Link_array<Item> acs
+ = Pointer_group_interface__extract_elements (this, (Item*) 0, "columns");
bool bfound = false;
for (int i= acs.size (); i -- ;)
{
*/
void
-New_spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
+New_spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols)
{
Moment shortest;
Moment mean_shortest;
Array<Spring> springs;
Item * first_col = 0;
- Item * last_col = 0;
-
for (int i= 0; i < cols.size () - 1; i++)
{
Item * l = dynamic_cast<Item*> (cols[i]);
- if (!Paper_column::musical_b (l))
- continue ;
-
- if (!first_col)
+ if (!first_col && Paper_column::musical_b (l))
first_col = l;
+
+ SCM between = cols[i]->get_grob_property ("between-cols");
+ if (gh_pair_p (between)
+ && i > 0
+ && i < cols.size ()-1
+ && (gh_cdr (between) != cols[i+1]->self_scm ()
+ || gh_car (between) != cols[i-1]->self_scm ())
+ )
+ continue ;
- last_col = l;
int j = i+1;
- for (; j < cols.size () -1 ; j++)
- if (Paper_column::musical_b (cols[j]))
- break ;
-
+ for (; j < cols.size () - 1; j++)
+ {
+ if (Paper_column::musical_b (cols[j]))
+ break;
+
+ SCM between = cols[j]->get_grob_property ("between-cols");
+ if (!gh_pair_p (between))
+ continue;
+
+ if (gh_car (between) == cols[i]->self_scm () )
+ break ;
+ }
+
Item * r = dynamic_cast<Item*> (cols[j]);
Paper_column * lc = dynamic_cast<Paper_column*> (l);
Paper_column *rc = dynamic_cast<Paper_column*> (r);
- if (!lc || !rc)
- continue;
+
+ cout << "params for cols " << Paper_column::rank_i (l) << " " << Paper_column::rank_i (r) << endl;
+ cout << " musical: " << Paper_column::musical_b (l) << " " << Paper_column::musical_b (r) << endl;
+ if (!Paper_column::musical_b (l))
+ {
+ breakable_column_spacing (l, r);
+
+ l = l->find_prebroken_piece (RIGHT);
+ if (l)
+ breakable_column_spacing (l,r);
+
+ continue ;
+ }
+
Real note_space = note_spacing (me,lc, rc, shortest <? base_shortest_duration);
Real hinterfleisch = note_space;
Real headwid = gh_scm2double (me->get_grob_property ("arithmetic-multiplier"));
}
}
- Item * l = dynamic_cast<Item*> (cols[0])->find_prebroken_piece (RIGHT);
+}
- /*
- TODO read different spacing hints from break-alignment.
- */
+/*
+ Read hints from L (todo: R) and generate springs.
+ */
+void
+New_spacing_spanner::breakable_column_spacing (Item* l, Item *r)
+{
Spring s;
Real break_dist = 0.0;
s.distance_f_ = break_dist;
s.strength_f_ = 1/break_stretch;
s.item_l_drul_[LEFT] = l;
- s.item_l_drul_[RIGHT] = first_col;
-
- s.add_to_cols ();
+ s.item_l_drul_[RIGHT] = r;
- s.item_l_drul_[LEFT] = dynamic_cast<Item*>(cols[0]);
s.add_to_cols ();
}
void
New_spacing_spanner::stretch_to_regularity (Grob *me,
Array<Spring> * springs,
- Link_array<Grob> const & cols)
+ Link_array<Item> const & cols)
{
/*
Find the starting column of the run. REGULAR-DISTANCE-TO points
for (int i = 0 ; i < cols.size () && !first_regular_spaced_col; i++)
{
SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
- if (cols.find_l (unsmob_grob (rdt)))
+ if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
first_regular_spaced_col = unsmob_grob (rdt);
}
for (int i = springs->size (); i-- ;)
New_spacing_spanner::set_springs (SCM smob)
{
Grob *me = unsmob_grob (smob);
- Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+ Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
int j = 0;
Grob *sc = all[i];
if (Item::breakable_b (sc))
{
- Link_array<Grob> measure (all.slice (j, i+1));
+ Link_array<Item> measure (all.slice (j, i+1));
do_measure (me, measure);
j = i;
}
/*
Be sure to set breakability on first & last column.
*/
- Link_array<Grob> pc (line_l_->column_l_arr ());
+ Link_array<Item> pc (line_l_->column_l_arr ());
pc[0]->set_grob_property ("breakable", SCM_BOOL_T);
pc.top ()->set_grob_property ("breakable", SCM_BOOL_T);
(c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
+#include <iostream.h>
#include "separating-group-spanner.hh"
#include "separation-item.hh"
*/
Item * last_step_musical_malt_p_;
+ Item * last_nonnil_musical_malt_p_;
+ Item * last_nonnil_break_malt_p_;
Spanner * sep_span_p_;
Separating_line_group_engraver::Separating_line_group_engraver ()
{
last_step_musical_malt_p_ = 0;
+ last_nonnil_break_malt_p_ = 0;
+ last_nonnil_musical_malt_p_ = 0;
+
sep_span_p_ = 0;
break_malt_p_ = 0;
musical_malt_p_ =0;
if (break_malt_p_)
{
Separating_group_spanner::add_spacing_unit (sep_span_p_, break_malt_p_);
-
+
typeset_grob (break_malt_p_);
+
+ last_nonnil_break_malt_p_ = break_malt_p_;
break_malt_p_ =0;
}
+
if (musical_malt_p_)
{
Separating_group_spanner::add_spacing_unit (sep_span_p_, musical_malt_p_);
+
+ /* TODO
+
+ move this mucketry into separation-spanner.
+
+ */
+ if (last_nonnil_break_malt_p_ && last_nonnil_musical_malt_p_)
+ {
+ cout << now_mom ().str () <<endl;
+ Item *col = last_nonnil_break_malt_p_->column_l();
+ if (!col)
+ col = dynamic_cast<Item*> (unsmob_grob (get_property ("currentCommandColumn")));
+
+ SCM between = col->get_grob_property ("between-cols");
+
+ SCM left = last_nonnil_musical_malt_p_->column_l()->self_scm ();
+ SCM right = get_property ("currentMusicalColumn"); // musical_malt_p_->column_l()->self_scm ();
+ if (gh_pair_p (between))
+ {
+ /*
+ ugh. set_..._x ()
+ */
+ if (Paper_column::rank_i (unsmob_grob (gh_car (between))) < Paper_column::rank_i (unsmob_grob (left)))
+ gh_set_car_x (between, left);
+ if (Paper_column::rank_i (unsmob_grob (gh_cdr (between))) > Paper_column::rank_i (unsmob_grob (right)))
+ gh_set_cdr_x (between, right);
+ }
+ else
+ {
+ col->set_grob_property ("between-cols", gh_cons (left, right));
+ }
+ }
+
if (last_step_musical_malt_p_)
{
Paper_column *col =
gh_cons (newtup,
col->get_grob_property ("spacing-sequence")));
}
+
+
+ last_nonnil_break_malt_p_ = 0;
+ last_nonnil_musical_malt_p_ = musical_malt_p_;
typeset_grob (musical_malt_p_);
}
last_step_musical_malt_p_ = musical_malt_p_;
#include <math.h>
#include <libc-extension.hh> // isinf
+#include "string-convert.hh"
#include "simple-spacer.hh"
#include "paper-column.hh"
#include "spring.hh"
}
void
-Simple_spacer::add_columns (Link_array<Grob> cols)
+Simple_spacer::add_columns (Link_array<Item> cols)
{
+ for (int i =0; i < cols.size (); i++)
+ all_cols_.push ( dynamic_cast<Item*> (cols[i]));
+
+ Grob *next = 0;
for (int i=0; i < cols.size () - 1; i++)
{
SCM spring_params = SCM_UNDEFINED;
+
+ if (next && cols[i] != next)
+ continue;
+
for (SCM s = cols[i]->get_grob_property ("ideal-distances");
- spring_params == SCM_UNDEFINED && gh_pair_p (s);
+ !gh_pair_p (spring_params) && gh_pair_p (s);
s = gh_cdr (s))
{
Grob *other = unsmob_grob (gh_caar (s));
- if (other != cols[i+1])
+ int j = i+1;
+ for (; j < cols.size (); j++)
+ if (cols[j] == other)
+ break;
+
+ if(j == cols.size ())
continue;
+ next = other;
spring_params = gh_cdar (s);
}
Spring_description desc;
- if (spring_params != SCM_UNDEFINED)
+ desc.ideal_f_ = -1;
+ if (gh_pair_p(spring_params))
{
desc.ideal_f_ = gh_scm2double (gh_car (spring_params));
desc.hooke_f_ = gh_scm2double (gh_cdr (spring_params));
}
- else
+
+ if (gh_pair_p (spring_params) && desc.sane_b ())
{
- programming_error (_f("No spring between column %d and next one",
- Paper_column::rank_i (cols[i])
- ));
- desc.hooke_f_ = 1.0;
- desc.ideal_f_ = default_space_f_;
+ spaced_cols_.push (dynamic_cast<Item*> (cols[i]));
+ desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
+ springs_.push (desc);
}
-
- if (!desc.sane_b ())
+ else if (gh_pair_p (spring_params) && !desc.sane_b ())
{
- programming_error ("Insane spring found. Setting to unit spring.");
- desc.hooke_f_ = 1.0;
- desc.ideal_f_ = 1.0;
+ programming_error (String_convert::form_str ("insane springs at col %d", Paper_column::rank_i (cols[i])));
+ // Generate rods for these cols.
}
-
- desc.block_force_f_ = - desc.hooke_f_ * desc.ideal_f_; // block at distance 0
- springs_.push (desc);
}
+
+ spaced_cols_.push (all_cols_.top ());
- for (int i=0; i < cols.size () - 1; i++)
+ for (int i=0; i < spaced_cols_.size () - 1; i++)
{
- for (SCM s = Spaceable_grob::get_minimum_distances (cols[i]);
+ for (SCM s = Spaceable_grob::get_minimum_distances (spaced_cols_[i]);
gh_pair_p (s); s = gh_cdr (s))
{
- Grob * other = unsmob_grob (gh_caar (s));
- int oi = cols.find_i (other);
+ Item * other = dynamic_cast<Item*> (unsmob_grob (gh_caar (s)));
+ int oi = spaced_cols_.find_i (other);
if (oi >= 0)
{
add_rod (i, oi, gh_scm2double (gh_cdar (s)));
}
positions->satisfies_constraints_b_ = (line_len_f_ < 0) || active_b ();
+ positions->cols_ = spaced_cols_;
+ do_wide_springs (positions);
+}
+
+/*
+ Do the columns whose springs didn't paricipate in the spacing process
+ */
+void
+Simple_spacer::do_wide_springs ( Column_x_positions *positions_)const
+{
+ int i = 0;
+
+
+ Array<Real> all_posns;
+ for (int j = 0; j < all_cols_.size () && i < spaced_cols_.size (); j++)
+ {
+ if (all_cols_[j] == spaced_cols_[i])
+ {
+ all_posns.push (positions_->config_[i] );
+ i++;
+ continue;
+ }
+
+
+ SCM between = all_cols_[j]->get_grob_property ("between-cols");
+ if (!gh_pair_p (between))
+ {
+ programming_error (String_convert::form_str ("loose column rank %d not beween spaced cols", Paper_column::rank_i (all_cols_[j] )));
+ all_posns.push (positions_->config_[i]);
+ continue;
+ }
+
+ Item * prev = dynamic_cast<Item*> (unsmob_grob (gh_car (between)));
+ Item *next = dynamic_cast<Item*> (unsmob_grob (gh_cdr (between)));
+ int ip = i;
+ int in = i;
+ for (; ip--; )
+ if(spaced_cols_[ip] == prev)
+ break;
+
+ for (; in < spaced_cols_.size (); in++)
+ if(spaced_cols_[in] == next)
+ break;
+
+ // TODO: compute iso. 0.5
+ if (ip >= 0 && in < positions_->config_.size ())
+ all_posns.push (0.5 * (positions_->config_[ip] + positions_->config_[in]));
+ else
+ all_posns.push (positions_->config_[i]);
+
+ }
+
+ positions_->config_ = all_posns;
+ positions_->cols_ = all_cols_;
}
*/
void
-Spacing_spanner::do_measure (Grob*me, Link_array<Grob> const & cols)
+Spacing_spanner::do_measure (Grob*me, Link_array<Item> const & cols)
{
Moment shortest;
Moment mean_shortest;
void
Spacing_spanner::stretch_to_regularity (Grob *me,
Array<Spring> * springs,
- Link_array<Grob> const & cols)
+ Link_array<Item> const & cols)
{
/*
Find the starting column of the run. REGULAR-DISTANCE-TO points
for (int i = 0 ; i < cols.size () && !first_regular_spaced_col; i++)
{
SCM rdt = cols[i]->get_grob_property ("regular-distance-to");
- if (cols.find_l (unsmob_grob (rdt)))
+ if (cols.find_l (dynamic_cast<Item*> (unsmob_grob (rdt))))
first_regular_spaced_col = unsmob_grob (rdt);
}
for (int i = springs->size (); i-- ;)
Spacing_spanner::set_springs (SCM smob)
{
Grob *me = unsmob_grob (smob);
- Link_array<Grob> all (me->pscore_l_->line_l_->column_l_arr ()) ;
+ Link_array<Item> all (me->pscore_l_->line_l_->column_l_arr ()) ;
int j = 0;
for (int i = 1; i < all.size (); i++)
{
- Grob *sc = all[i];
+ Item *sc = all[i];
if (Item::breakable_b (sc))
{
- Link_array<Grob> measure (all.slice (j, i+1));
+ Link_array<Item> measure (all.slice (j, i+1));
do_measure (me, measure);
j = i;
}
}
void
-Stanza_number_engraver::acknowledge_grob (Grob_info i)
+Stanza_number_engraver::acknowledge_grob (Grob_info )
{
if (gh_string_p (get_property ("whichBar")))
{
;;;;
;;;; source file of the GNU LilyPond music typesetter
;;;;
-;;;; (c) 1998--2001 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+;;;; (c) 1998--20.301 Han-Wen Nienhuys <hanwen@cs.uu.nl>
;;;; Jan Nieuwenhuizen <janneke@gnu.org>
; distances are given in stafflinethickness (thicknesses) and
(Script . (
;; don't set direction here: it breaks staccato.
(molecule-callback . ,Script::brew_molecule)
- (padding . 0.3)
+ (padding . 0.29)
(X-offset-callbacks . (,Side_position_interface::centered_on_parent))
(before-line-breaking-callback . ,Script::before_line_breaking)
(meta . ,(grob-description "Script" script-interface side-position-interface font-interface))