+2002-03-28 Han-Wen <hanwen@cs.uu.nl>
+
+ * lily/multi-measure-rest.cc (brew_molecule): variable width molecule.
+
+ * scm/grob-property-description.scm (measure-length):
+ measure-length grob property.
+
+ * lily/spacing-spanner.cc (standard_breakable_column_spacing):
+ better spacing for breakable columns when they're juxtaposed: use
+ measure length if applicable
+
+ * lily/timing-engraver.cc (start_translation_timestep): store
+ measure length in breakable column at start of measure.
+
2002-03-28 Jan Nieuwenhuizen <janneke@gnu.org>
* ROADMAP: Add description for ports dir, to check email upon
2002-03-27 Han-Wen <hanwen@cs.uu.nl>
+ * VERSION: 1.5.48 released
+
* lily/multi-measure-rest.cc (symbol_molecule): split off from
brew_molecule()
(set_spacing_rods): Use symbol_molecule() to determine minimum
r2 r4 g'4^"Solo" |
e'4. () c8 [f (d c )b ]
[b()c] g4 r8 [g-. c-. e-.]
- g2. ( [g16-.( f e ))f]
+ g2. [g16-.( f e )f]
dis4 () e4-- r8 [c8-. c-. c-.]
c4.( [d16 e] f4 ) e
a,( d g,) c
[cis ()d] r4 r2
g,1 ~ g2 ~ [g8 a16 b] [c()d e c]
f4-. d-. b-. g-.
- r1
- \emptyText
+ R1
+
c,2\p e4 g c \cresc e g4. e8 |
d4. [e16 fis] [g () fis e d] [c() b a g]
\endcresc
r2 r8 [g,-. g-. g-.]
e'4.() c8 [f( d c )b]
[b()c] g4 r8 [g c e] |
- g2. ( [g16( f e ))f]
+ g2. [g16( f e )f]
dis4()e r8 [c-. c-. c-.]
c4.( [d16 e] f4 )e
a, ( d g, )c
[e()d] d4 r [d8 d]
d4(~ [d16 e d )e] [g8() f e d] |
c4 r r2
- r1
+ R1
c1 ~
c |
[c8-. c-.] r c-. [cis()d] r d-. |
{ s2. \grace { [c16 d] } } >
) c4 r r2
- r1 |
+ R1 |
\mark "H"
\times 2/3 { [ c8 ()b a ] } \times 2/3 { [ g a b] } \times 2/3 { [ c d e] } \times 2/3 { [ f()e d] } |
\times 2/3 { [ c () b a ] } \times 2/3 { [ g a b] } \times 2/3 { [ c d e] } \times 2/3 { [ f()e d] }|
R1*2
g'4.() f8 [e( d c) bes]
[bes (a d ) c] c4 r
- r1
+ R1
% 25
[c16\mf ( d c )d] [e ( f e )f] [g()e c-. c-.] [f()d b-. b-.]
[c16\p () d c )d] [e ( f e )f] [g()e c-. c-.] [f()d b-. b-.]
[c8( e g )bes] [a( c f ) d]
c r e r f4 r4 % -. ?
- r1
+ R1
c8-. r e-. r f4 r4
% Finish with F if played separately
\rondotheme
R2.*13 |
- r8 r-\fermata d [d e f]
+ r8 r^\fermata d [d e f]
[g ()e c-.] [d()e d-.]
c4 c8 [d e f]
[g()e c-.] [d()e d-.]
DECLARE_SCHEME_CALLBACK (set_spacing_rods, (SCM ));
static Molecule big_rest (Grob*,Real);
- static Molecule symbol_molecule (Grob*);
- static Molecule church_rest (Font_metric*, int,Real, Real);
+ static Molecule symbol_molecule (Grob*,Real);
+ static Molecule church_rest (Grob*, Font_metric*, int,Real);
};
#endif /* MULTI_MEASURE_REST_HH */
Interval sp_iv;
Direction d = LEFT;
+
+ Grob *common = sp->get_bound (LEFT)->common_refpoint (sp->get_bound (RIGHT), X_AXIS);
do
{
Item * col = sp->get_bound (d)->column_l ();
- Interval coldim = col->extent (0, X_AXIS);
+ Interval coldim = col->extent (common, X_AXIS);
sp_iv[d] = coldim[-d] ;
}
while ((flip (&d)) != LEFT);
- Molecule mol;
- Real x_off = 0.0;
+
+ Real space = sp_iv.length();
Real rx = sp->get_bound (LEFT)->relative_coordinate (0, X_AXIS);
/*
we gotta stay clear of sp_iv, so move a bit to the right if
needed.
*/
- x_off += (sp_iv[LEFT] - rx) >? 0;
+ Real x_off = (sp_iv[LEFT] - rx) >? 0;
- /*
- center between stuff.
- */
- x_off += sp_iv.length ()/ 2;
- mol.add_molecule (symbol_molecule (me));
+ Molecule mol;
+ mol.add_molecule (symbol_molecule (me, space));
int measures = 0;
SCM m (me->get_grob_property ("measure-count"));
Molecule s = Text_item::text2molecule (me,
ly_str02scm (to_str (measures).ch_C ()),
alist_chain);
+
+
s.align_to (X_AXIS, CENTER);
s.translate_axis (3.0, Y_AXIS);
+
+ s.translate_axis (mol.extent (X_AXIS).center (), X_AXIS);
mol.add_molecule (s);
}
mol.translate_axis (x_off, X_AXIS);
Molecule
-Multi_measure_rest::symbol_molecule (Grob *me)
+Multi_measure_rest::symbol_molecule (Grob *me, Real space)
{
- SCM alist_chain = Font_interface::font_alist_chain (me);
-
- SCM style_chain =
- Font_interface::add_style (me, ly_symbol2scm ("mmrest-symbol"),
- alist_chain);
-
- Real staff_space = Staff_symbol_referencer::staff_space (me);
- Font_metric *musfont
- = Font_interface::get_font (me,style_chain);
- Molecule s;
-
int measures = 0;
SCM m (me->get_grob_property ("measure-count"));
if (gh_number_p (m))
SCM limit = me->get_grob_property ("expand-limit");
if (measures <= 0)
- return s;
+ return Molecule();
+
+ if (measures > gh_scm2int (limit))
+ {
+ Real padding = 0.15;
+ Molecule s = big_rest (me, (1.0 - 2*padding) * space);
+ s.translate_axis (padding * space, X_AXIS);
+ return s;
+ }
+
+ SCM alist_chain = Font_interface::font_alist_chain (me);
+
+ SCM style_chain =
+ Font_interface::add_style (me, ly_symbol2scm ("mmrest-symbol"),
+ alist_chain);
+
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ Font_metric *musfont
+ = Font_interface::get_font (me,style_chain);
+
if (measures == 1)
{
- s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
+ Molecule s = musfont->find_by_name (Rest::glyph_name (me, 0, ""));
/*
ugh.
*/
if (Staff_symbol_referencer::position_f (me) == 0.0)
s.translate_axis (staff_space, Y_AXIS);
+
+ s.translate_axis ((space - s.extent (X_AXIS).length ())/2, X_AXIS);
+
+ return s ;
}
- else if (measures <= gh_scm2int (limit))
- {
- Real pad = gh_scm2double (me->get_grob_property ("padding")) * staff_space;
- s = church_rest (musfont, measures, staff_space, pad);
- }
- else
+ else
{
- Real w = gh_scm2double (me->get_grob_property ("width"));
- s = big_rest (me, w);
+ return church_rest (me, musfont, measures, space);
}
- return s;
}
+
+
Molecule
Multi_measure_rest::big_rest (Grob *me, Real width)
{
m.add_at_edge (X_AXIS, RIGHT, yb, -ythick);
m.add_at_edge (X_AXIS, LEFT, yb, -ythick);
- m.align_to (X_AXIS, CENTER);
+ m.align_to (X_AXIS, LEFT);
return m;
}
/*
Kirchenpause (?)
-
*/
Molecule
-Multi_measure_rest::church_rest (Font_metric *musfont, int measures,
- Real staff_space, Real padding)
+Multi_measure_rest::church_rest (Grob*me, Font_metric *musfont, int measures,
+ Real space)
{
- Molecule s;
- /*
- Build a rest from smaller parts. Distances inbetween are
- really variable, see Wanske pp. 125 */
-
+ SCM mols = SCM_EOL;
+
+ /*
+ see Wanske pp. 125
+ */
int l = measures;
+ int count = 0;
+ Real symbols_width = 0.0;
while (l)
{
int k;
l --;
}
- Real pad = s.empty_b () ? 0.0 : padding;
-
Molecule r (musfont->find_by_name ("rests-" + to_str (k)));
if (k == 0)
- r.translate_axis (staff_space, Y_AXIS);
-
- s.add_at_edge (X_AXIS, RIGHT, r, pad);
+ {
+ Real staff_space = Staff_symbol_referencer::staff_space (me);
+ r.translate_axis (staff_space, Y_AXIS);
+ }
+ symbols_width += r.extent (X_AXIS).length ();
+ mols = gh_cons (r.smobbed_copy (), mols);
+ count ++;
+ }
+
+
+ Real outer_padding_factor = 1.5; // make outer padding this much bigger.
+ Real inner_padding = (space - symbols_width) / (2 * outer_padding_factor + (count-1));
+
+ Molecule mol;
+ for (SCM s = mols; gh_pair_p (s); s = gh_cdr(s))
+ {
+ mol.add_at_edge (X_AXIS, LEFT, *unsmob_molecule (gh_car (s)), inner_padding);
}
+ mol.align_to (X_AXIS, LEFT);
+ mol.translate_axis (outer_padding_factor * inner_padding, X_AXIS);
- s.align_to (X_AXIS, CENTER);
- return s;
+ return mol;
}
-/*
- UGH. JUNKME elt prop "columns" isn't really needed.
- */
void
Multi_measure_rest::add_column (Grob*me,Item* c)
{
SCM
Multi_measure_rest::set_spacing_rods (SCM smob)
{
+ return SCM_UNSPECIFIED;
+
Grob*me = unsmob_grob (smob);
Spanner*sp = dynamic_cast<Spanner*> (me);
Rod rod;
rod.item_l_drul_[LEFT] = l;
rod.item_l_drul_[RIGHT] = r;
-
- /*
- should do something more advanced.
- */
- Molecule m = symbol_molecule(me);
-
rod.distance_f_ = l->extent (l, X_AXIS)[BIGGER] - r->extent (r, X_AXIS)[SMALLER]
- + m.extent (X_AXIS).length () + 2.5*staff_space;
+ + 4.0; // magic!
rod.add_to_cols ();
}
ADD_INTERFACE (Spaceable,"spaceable-grob-interface",
- "An grob (generally a Paper_column) that takes part in the
+ "An grob (a Paper_column) that takes part in the
spacing problem. ",
- "penalty minimum-distances ideal-distances
+ "measure-length penalty minimum-distances ideal-distances
left-neighbors right-neighbors");
class Spacing_spanner
{
public:
+ static void standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
+ Real * fixed, Real * space, Moment);
+
+
static Real default_bar_spacing (Grob*,Grob*,Grob*,Moment);
static Real note_spacing (Grob*,Grob*,Grob*,Moment, bool*);
static Real get_duration_space (Grob*,Moment dur, Rational shortest, bool*);
static Rational find_shortest (Link_array<Grob> const &);
- static void breakable_column_spacing (Item* l, Item *r);
+ static void breakable_column_spacing (Grob*, Item* l, Item *r, Moment);
static void find_loose_columns () {}
static void prune_loose_colunms (Grob*,Link_array<Grob> *cols, Rational);
static void find_loose_columns (Link_array<Grob> cols);
if (!Paper_column::musical_b (l))
{
- breakable_column_spacing (l, r);
+ breakable_column_spacing (me, l, r, shortest);
/*
Item *rb = r->find_prebroken_piece (LEFT);
if (lb)
- breakable_column_spacing (lb,r);
+ breakable_column_spacing (me, lb,r, shortest);
if (rb)
- breakable_column_spacing (l, rb);
+ breakable_column_spacing (me, l, rb, shortest);
if (lb && rb)
- breakable_column_spacing (lb, rb);
+ breakable_column_spacing (me, lb, rb, shortest);
continue ;
}
Spaceable_grob::add_spring (lc, rc, max_note_space, 1 / (max_note_space -max_fixed_note_space), expand_only);
}
+void
+Spacing_spanner::standard_breakable_column_spacing (Grob * me, Item*l, Item*r,
+ Real * fixed, Real * space,
+ Moment shortest)
+{
+ *fixed = l->extent (l, X_AXIS)[RIGHT] - r->extent (r, X_AXIS)[LEFT];
+
+ if (l->breakable_b (l) && r->breakable_b(r))
+ {
+ Moment *dt = unsmob_moment (l->get_grob_property ("measure-length"));
+ Moment mlen (1);
+ if (dt)
+ mlen = *dt;
+
+ Real incr = gh_scm2double (me->get_grob_property ("spacing-increment"));
+
+ *space = *fixed + incr * double (mlen.main_part_ / shortest.main_part_) * 0.8;
+ }
+ else
+ {
+ Moment dt = Paper_column::when_mom (r) - Paper_column::when_mom (l);
+ bool dummy;
+
+ *space = *fixed + get_duration_space (me, dt, shortest.main_part_, &dummy);
+ }
+
+
+}
+
/*
Read hints from L and generate springs.
*/
void
-Spacing_spanner::breakable_column_spacing (Item* l, Item *r)
+Spacing_spanner::breakable_column_spacing (Grob*me, Item* l, Item *r,Moment shortest)
{
Real max_fixed = -infinity_f;
Real max_space = -infinity_f;
+
+ standard_breakable_column_spacing (me, l, r, &max_fixed, &max_space ,
+ shortest);
for (SCM s = l->get_grob_property ("spacing-wishes");
gh_pair_p (s); s = gh_cdr (s))
}
}
+
+
+
if (isinf (max_space))
{
programming_error ("No pref spacing found");
#include "multi-measure-rest.hh"
#include "timing-translator.hh"
#include "engraver.hh"
+#include "grob.hh"
/**
Do time bookkeeping
which
= (now.main_part_ || now.main_part_ == last_moment_.main_part_)
? SCM_EOL : ly_str02scm ("|");
+
+ Moment mp = measure_position ();
+ bool start_of_measure = (last_moment_.main_part_ != now.main_part_&& !mp.main_part_ );
+
+ if (start_of_measure)
+ {
+ Moment mlen = Moment(measure_length ());
+ unsmob_grob (get_property ("currentCommandColumn"))->set_grob_property ("measure-length", mlen.smobbed_copy());
+ }
if (!gh_string_p (which) && !to_boolean (nonauto))
{
SCM always = get_property ("barAlways");
- Moment mp = measure_position ();
- if ( (last_moment_.main_part_ != now.main_part_
- && !mp.main_part_)
- || (to_boolean (always)))
+
+ if ( start_of_measure || (to_boolean (always)))
{
/* should this work, or be junked? See input/bugs/no-bars.ly */
which = get_property ("defaultBarType");
Timing_translator::stop_translation_timestep ();
daddy_trans_l_->set_property ("whichBar", SCM_EOL);
last_moment_ = now_mom ();
+
}
#include "multi-measure-rest.hh"
-
void
Timing_translator::stop_translation_timestep ()
{
}
}
-
void
Timing_translator::initialize ()
{
penpos2(flare,180+beta+alpha);
z2=z3;
penpos3(flare,0+alpha);
- z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta);
+ z3l=z1r+(1/2+0.43)*flare*dir(alpha+beta) ;
save taille;
taille = 0.0;
z4=z2r- line * dir(alpha);
(SpacingSpanner
. (
(spacing-procedure . ,Spacing_spanner::set_springs)
- (grace-space-factor . 0.8)
+ (grace-space-factor . 0.5)
(shortest-duration-space . 2.0)
(spacing-increment . 1.2)
(grob-property-description 'magnify number? "the magnification factor. FIXME: doesn't work for feta fonts.")
(grob-property-description 'maximum-length number? "don't make Grob longer than this")
(grob-property-description 'maximum-rest-count integer? "kill off rests so we don't more than this number left.")
+(grob-property-description 'measure-length moment? "Length of a
+measure. Used in some spacing situations.")
(grob-property-description 'measure-count integer? "number of measures for a multimeasure rest.")
(grob-property-description 'merge-differently-dotted boolean? " Merge noteheads in collisions, even if they have a different number of dots. This normal notation for some types of polyphonic music. The value of this setting is used by @ref{note-collision-interface} .")
(grob-property-description 'minimum-distance number? "minimum distance between notes and rests.")