source file of the GNU LilyPond music typesetter
- (c) 1997--2005 Han-Wen Nienhuys <hanwen@xs4all.nl>
+ (c) 1997--2006 Han-Wen Nienhuys <hanwen@xs4all.nl>
Jan Nieuwenhuizen <janneke@gnu.org>
*/
*/
#include "beam.hh"
-#include "interval-set.hh"
-#include "directional-element-interface.hh"
+
#include "beaming.hh"
-#include "misc.hh"
+#include "directional-element-interface.hh"
+#include "international.hh"
+#include "interval-set.hh"
+#include "item.hh"
#include "least-squares.hh"
-#include "stem.hh"
-#include "output-def.hh"
#include "lookup.hh"
+#include "misc.hh"
+#include "output-def.hh"
#include "pointer-group-interface.hh"
-#include "staff-symbol-referencer.hh"
-#include "item.hh"
#include "spanner.hh"
+#include "staff-symbol-referencer.hh"
+#include "stem.hh"
#include "warn.hh"
#if DEBUG_QUANTING
int m = 0;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
m = max (m, (Stem::beam_multiplicity (stem).length () + 1));
me->suicide ();
return SCM_UNSPECIFIED;
}
- else
+ else
{
- d = to_dir (stems[0]->get_property ("default-direction"));
+ Grob *stem = first_visible_stem (me);
+
+ /*
+ ugh: stems[0] case happens for chord tremolo.
+ */
+ d = to_dir ((stem ? stem : stems[0])->get_property ("default-direction"));
}
}
-
if (count >= 1)
{
- d = get_default_dir (me);
+ if (!d)
+ d = get_default_dir (me);
+
consider_auto_knees (me);
}
SCM last_beaming = scm_cons (SCM_EOL, scm_list_1 (scm_from_int (0)));
Direction last_dir = CENTER;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *this_stem = stems[i];
SCM this_beaming = this_stem->get_property ("beaming");
else
{
x0 = stems[0]->relative_coordinate (xcommon, X_AXIS);
- dx = stems.top ()->relative_coordinate (xcommon, X_AXIS) - x0;
+ dx = stems.back ()->relative_coordinate (xcommon, X_AXIS) - x0;
}
SCM posns = me->get_property ("quantized-positions");
Stencil the_beam;
Real lt = me->layout ()->get_dimension (ly_symbol2scm ("linethickness"));
- for (int i = 0; i <= stems.size (); i++)
+ for (vsize i = 0; i <= stems.size (); i++)
{
Grob *stem = (i < stems.size ()) ? stems[i] : 0;
SCM left = (i > 0) ? scm_cdr (last_beaming) : SCM_EOL;
SCM right = stem ? scm_car (this_beaming) : SCM_EOL;
- Array<int> full_beams;
- Array<int> lfliebertjes;
- Array<int> rfliebertjes;
+ std::vector<int> full_beams;
+ std::vector<int> lfliebertjes;
+ std::vector<int> rfliebertjes;
for (SCM s = left;
scm_is_pair (s); s = scm_cdr (s))
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), right) != SCM_BOOL_F)
- full_beams.push (b);
+ full_beams.push_back (b);
else
- lfliebertjes.push (b);
+ lfliebertjes.push_back (b);
}
for (SCM s = right;
scm_is_pair (s); s = scm_cdr (s))
{
int b = scm_to_int (scm_car (s));
if (scm_c_memq (scm_car (s), left) == SCM_BOOL_F)
- rfliebertjes.push (b);
+ rfliebertjes.push_back (b);
}
Drul_array<Real> break_overshoot
gap_count = scm_to_int (me->get_property ("gap-count"));
gapped = Lookup::beam (slope, w - 2 * gap_length, thick, blot);
- full_beams.sort (default_compare);
+ vector_sort (full_beams, default_compare);
if (stem_dir == UP)
full_beams.reverse ();
}
int k = 0;
- for (int j = full_beams.size (); j--;)
+ for (vsize j = full_beams.size (); j--;)
{
Stencil b (whole);
Stencil rhalf = Lookup::beam (slope, rw, thick, blot);
Stencil lhalf = Lookup::beam (slope, lw, thick, blot);
- for (int j = lfliebertjes.size (); j--;)
+ for (vsize j = lfliebertjes.size (); j--;)
{
Stencil b (lhalf);
b.translate_axis (last_xposn - x0 - last_stem_width /2,
Y_AXIS);
the_beam.add_stencil (b);
}
- for (int j = rfliebertjes.size (); j--;)
+ for (vsize j = rfliebertjes.size (); j--;)
{
Stencil b (rhalf);
b.translate_axis (xposn - x0 - rw + stem_width / 2, X_AXIS);
should be switchable for those who want to twiddle with the
parameters.
*/
- String str;
+ std::string str;
SCM properties = Font_interface::text_font_alist_chain (me);
Direction stem_dir = stems.size () ? to_dir (stems[0]->get_property ("direction")) : UP;
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Direction stem_dir = CENTER;
}
Direction dir = CENTER;
-
- if (Direction d = (Direction) sign (count[UP] - count[DOWN]))
+ Direction d = CENTER;
+ if ((d = (Direction) sign (count[UP] - count[DOWN])))
dir = d;
- else if (Direction d = (Direction) sign (total[UP] / count[UP] - total[DOWN]/count[DOWN]))
+ else if (count[UP]
+ && count[DOWN]
+ && (d = (Direction) sign (total[UP] / count[UP] - total[DOWN]/count[DOWN])))
dir = d;
- else if (Direction d = (Direction) sign (total[UP] - total[DOWN]))
+ else if ((d = (Direction) sign (total[UP] - total[DOWN])))
dir = d;
else
dir = to_dir (me->get_property ("neutral-direction"));
{
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Grob *common = common_refpoint_of_array (stems, me, Y_AXIS);
Real staff_space = Staff_symbol_referencer::staff_space (me);
- Array<Interval> head_extents_array;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<Interval> head_extents_array;
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
if (Stem::is_invisible (stem))
head_extents[-stemdir] = -stemdir * infinity_f;
}
}
- head_extents_array.push (head_extents);
+ head_extents_array.push_back (head_extents);
gaps.remove_interval (head_extents);
}
Interval max_gap;
Real max_gap_len = 0.0;
- for (int i = gaps.allowed_regions_.size () -1; i >= 0; i--)
+ for (vsize i = gaps.allowed_regions_.size () -1; i != VPOS ;i--)
{
Interval gap = gaps.allowed_regions_[i];
if (max_gap_len > threshold)
{
int j = 0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *stem = stems[i];
if (Stem::is_invisible (stem))
if (count < 1)
return ly_interval2scm (pos);
- Array<Real> x_posns;
+ std::vector<Real> x_posns;
extract_grob_set (me, "stems", stems);
Grob *commonx = common_refpoint_of_array (stems, me, X_AXIS);
Grob *commony = common_refpoint_of_array (stems, me, Y_AXIS);
+ lvs->relative_coordinate (commony, Y_AXIS) - my_y);
Real x0 = first_visible_stem (me)->relative_coordinate (commonx, X_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Real x = s->relative_coordinate (commonx, X_AXIS) - x0;
- x_posns.push (x);
+ x_posns.push_back (x);
}
Real dx = last_visible_stem (me)->relative_coordinate (commonx, X_AXIS) - x0;
}
else
{
- Array<Offset> ideals;
- for (int i = 0; i < stems.size (); i++)
+ std::vector<Offset> ideals;
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
continue;
- ideals.push (Offset (x_posns[i],
+ ideals.push_back (Offset (x_posns[i],
Stem::get_stem_info (s).ideal_y_
+ s->relative_coordinate (commony, Y_AXIS)
- my_y));
/*
Code dup.
*/
- Array<Real> x_posns;
+ std::vector<Real> x_posns;
extract_grob_set (me, "stems", stems);
Grob *commonx = common_refpoint_of_array (stems, me, X_AXIS);
Grob *commony = common_refpoint_of_array (stems, me, Y_AXIS);
return posns;
Real x0 = fvs->relative_coordinate (commonx, X_AXIS);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
Real x = s->relative_coordinate (commonx, X_AXIS) - x0;
- x_posns.push (x);
+ x_posns.push_back (x);
}
Grob *lvs = last_visible_stem (me);
*/
Interval feasible_left_point;
feasible_left_point.set_full ();
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
Real xl = fvs ? fvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
Real xr = lvs ? lvs->relative_coordinate (common[X_AXIS], X_AXIS) : 0.0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
if (Stem::is_invisible (s))
extract_grob_set (me, "stems", stems);
Direction d = LEFT;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
/*
Don't overwrite user settings.
extract_grob_set (me, "stems", stems);
int f = 0;
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
Grob *s = stems[i];
{
extract_grob_set (me, "stems", stems);
int c = 0;
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
if (!Stem::is_invisible (stems[i]))
c++;
{
extract_grob_set (me, "stems", stems);
- for (int i = 0; i < stems.size (); i++)
+ for (vsize i = 0; i < stems.size (); i++)
{
if (!Stem::is_invisible (stems[i]))
return stems[i];
{
extract_grob_set (me, "stems", stems);
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
if (!Stem::is_invisible (stems[i]))
return stems[i];
bool knee = false;
int d = 0;
extract_grob_set (me, "stems", stems);
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
Direction dir = get_grob_direction (stems[i]);
if (d && d != dir)
extract_grob_set (me, "stems", stems);
int bc = 0;
- for (int i = stems.size (); i--;)
+ for (vsize i = stems.size (); i--;)
{
/*
Should we take invisible stems into account?