summaryrefslogtreecommitdiff
path: root/lily/beam.cc
diff options
context:
space:
mode:
authorHan-Wen Nienhuys <hanwen@xs4all.nl>2006-05-22 15:23:33 +0000
committerHan-Wen Nienhuys <hanwen@xs4all.nl>2006-05-22 15:23:33 +0000
commita4dc474c2c4c6f49a7c2fa5da92303ac496e13fb (patch)
treec000b1966f6a1bcf6dc9a70b90648cf9dd428896 /lily/beam.cc
parentdafef223123bb629eab05e53c443c6e6d20e9481 (diff)
* input/regression/beam-unconnected-beamlets.ly (Module): new file.
* lily/beam.cc (get_beam_segments): generate events for max_connect_ case too. (get_beam_segments): read Stem::max-beam-connect. * lily/beam.cc (set_beaming): read clip-edges property. (calc_direction): don't suicide for single stem.
Diffstat (limited to 'lily/beam.cc')
-rw-r--r--lily/beam.cc18
1 files changed, 11 insertions, 7 deletions
diff --git a/lily/beam.cc b/lily/beam.cc
index 497957b465..cf5e7c296c 100644
--- a/lily/beam.cc
+++ b/lily/beam.cc
@@ -52,6 +52,7 @@
Beam_stem_segment::Beam_stem_segment ()
{
+ max_connect_ = 1000; // infinity
stem_ = 0;
width_ = 0.0;
stem_x_ = 0.0;
@@ -128,10 +129,9 @@ Beam::calc_direction (SCM smob)
/* Beams with less than 2 two stems don't make much sense, but could happen
when you do
- [r8 c8 r8].
+ r8[ c8 r8]
- For a beam that only has one stem, we try to do some disappearance magic:
- we revert the flag, and move on to The Eternal Engraving Fields. */
+ */
Direction dir = CENTER;
@@ -347,6 +347,8 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
seg.width_ = stem_width;
seg.stem_index_ = i;
seg.dir_ = d;
+ seg.max_connect_ = robust_scm2int (stem->get_property ("max-beam-connect"), 1000);
+
Direction stem_dir = get_grob_direction (stem);
seg.gapped_
@@ -369,7 +371,8 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
vector_sort (segs, default_compare);
Beam_segment current;
- current.vertical_count_ = (*i).first;
+
+ int vertical_count = (*i).first;
for (vsize j = 0; j < segs.size (); j++)
{
/*
@@ -382,12 +385,14 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
j == segs.size() - 1 && event_dir==RIGHT);
Drul_array<bool> inside (j > 0, j < segs.size()-1);
bool event = on_bound[event_dir]
- || abs (segs[j].rank_ - segs[j+event_dir].rank_) > 1;
+ || abs (segs[j].rank_ - segs[j+event_dir].rank_) > 1
+ || (abs (vertical_count) >= segs[j].max_connect_
+ || abs (vertical_count) >= segs[j + event_dir].max_connect_);
if (!event)
continue;
- current.vertical_count_ = (*i).first;
+ current.vertical_count_ = vertical_count;
current.horizontal_[event_dir] = segs[j].stem_x_;
if (segs[j].dir_ == event_dir)
{
@@ -422,7 +427,6 @@ Beam::get_beam_segments (Grob *me_grob, Grob **common)
if (event_dir == RIGHT)
{
- current.vertical_count_ = (*i).first;
segments.push_back (current);
current = Beam_segment();
}