X-Git-Url: https://git.donarmstrong.com/?a=blobdiff_plain;f=lily%2Fsimple-spacer.cc;h=d17fa1ed73dca1fc9d3fe8a1a262fbc786028246;hb=47db9a3883d726ca53e2133a3b2298f78dd6a32e;hp=88ebae09d85c4714e318013bbf5d6a5c8541a452;hpb=2f0c6eb19208485a86d3416db3f3640a1d54752a;p=lilypond.git diff --git a/lily/simple-spacer.cc b/lily/simple-spacer.cc index 88ebae09d8..d17fa1ed73 100644 --- a/lily/simple-spacer.cc +++ b/lily/simple-spacer.cc @@ -1,7 +1,7 @@ /* This file is part of LilyPond, the GNU music typesetter. - Copyright (C) 1999--2012 Han-Wen Nienhuys + Copyright (C) 1999--2015 Han-Wen Nienhuys TODO: - add support for different stretch/shrink constants? @@ -193,7 +193,7 @@ Simple_spacer::expand_line () inv_hooke += springs_[i].inverse_stretch_strength (); if (inv_hooke == 0.0) /* avoid division by zero. If springs are infinitely stiff */ - return 0.0; /* anyway, then it makes no difference what the force is */ + inv_hooke = 1e-6; /* then report a very large stretching force */ assert (cur_len <= line_len_); return (line_len_ - cur_len) / inv_hooke + force_; @@ -370,20 +370,26 @@ get_column_description (vector const &cols, vsize col_index, bool line_s if (next_col) description.spring_ = Spaceable_grob::get_spring (col, next_col); - Grob *end_col = dynamic_cast (cols[col_index + 1])->find_prebroken_piece (LEFT); - if (end_col) - description.end_spring_ = Spaceable_grob::get_spring (col, end_col); + if (col_index + 1 < cols.size ()) + { + Grob *end_col = dynamic_cast (cols[col_index + 1])->find_prebroken_piece (LEFT); + if (end_col) + description.end_spring_ = Spaceable_grob::get_spring (col, end_col); + } for (SCM s = Spaceable_grob::get_minimum_distances (col); scm_is_pair (s); s = scm_cdr (s)) { - Grob *other = unsmob_grob (scm_caar (s)); + Grob *other = Grob::unsmob (scm_caar (s)); vsize j = binary_search (cols, other, Paper_column::less_than, col_index); if (j != VPOS) { if (cols[j] == other) description.rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s)))); else /* it must end at the LEFT prebroken_piece */ + /* see Spanner::set_spacing_rods for more comments on how + to deal with situations where we don't know if we're + ending yet on the left prebroken piece */ description.end_rods_.push_back (Rod_description (j, scm_to_double (scm_cdar (s)))); } } @@ -528,22 +534,3 @@ get_line_configuration (vector const &columns, return ret; } - -#include "ly-smobs.icc" - -IMPLEMENT_SIMPLE_SMOBS (Simple_spacer); -IMPLEMENT_DEFAULT_EQUAL_P (Simple_spacer); - -SCM -Simple_spacer::mark_smob (SCM /* x */) -{ - return SCM_EOL; -} - -int -Simple_spacer::print_smob (SCM /* x */, SCM p, scm_print_state *) -{ - scm_puts ("#", p); - return 1; -} -