source file of the GNU LilyPond music typesetter
- (c) 1998 Han-Wen Nienhuys <hanwen@cs.uu.nl>
+ (c) 1998--1999 Han-Wen Nienhuys <hanwen@cs.uu.nl>
*/
#include "beam-engraver.hh"
#include "musical-request.hh"
#include "beam.hh"
-#include "grouping.hh"
+#include "rhythmic-grouping.hh"
#include "stem.hh"
#include "warn.hh"
#include "time-description.hh"
finished_grouping_p_ = 0;
grouping_p_ =0;
reqs_drul_[LEFT] = reqs_drul_[RIGHT] =0;
+ prev_start_req_ =0;
}
bool
{
if (Beam_req * c = dynamic_cast<Beam_req*>(m))
{
- reqs_drul_[c->spantype_] = c;
+ Direction d =c->spantype_;
+
+ if (d == STOP && !beam_p_)
+ {
+ m->warning (_ ("No Beam to end"));
+ return false;
+ }
+ reqs_drul_[d ] = c;
return true;
}
return false;
if (reqs_drul_[STOP])
{
if (!beam_p_)
- reqs_drul_[STOP]->warning (_("No beam to stop"));
+ reqs_drul_[STOP]->warning (_("No beam to end"));
+ prev_start_req_ =0;
finished_beam_p_ = beam_p_;
finished_grouping_p_ = grouping_p_;
if (reqs_drul_[START])
{
+ if (beam_p_)
+ {
+ reqs_drul_[START]->warning (_ ("Already have a Beam"));
+ return;
+ }
+
+ prev_start_req_ = reqs_drul_[START];
beam_p_ = new Beam;
grouping_p_ = new Rhythmic_grouping;
if (prop.isnum_b ())
beam_p_->quantisation_ = (Beam::Quantisation)(int)prop;
- // silly try at interstaff beam
// must set minVerticalAlign == maxVerticalAlign to get sane results
// see input/test/beam-interstaff.ly
prop = get_property ("minVerticalAlign", 0);
if (prop.isnum_b ())
- beam_p_->vertical_align_f_ = prop;
+ beam_p_->vertical_align_drul_[MIN] = prop;
prop = get_property ("maxVerticalAlign", 0);
if (prop.isnum_b ())
- {
- beam_p_->vertical_align_f_ += (Real)prop;
- beam_p_->vertical_align_f_ /= (Real)2;
- }
+ beam_p_->vertical_align_drul_[MAX] = prop;
announce_element (Score_element_info (beam_p_, reqs_drul_[START]));
}
Beam_engraver::do_removal_processing ()
{
typeset_beam ();
- finished_beam_p_ = beam_p_;
- finished_grouping_p_ = grouping_p_;
- typeset_beam ();
+ if (beam_p_)
+ {
+ prev_start_req_->warning (_ ("Unfinished beam"));
+ finished_beam_p_ = beam_p_;
+ finished_grouping_p_ = grouping_p_;
+ typeset_beam ();
+ }
}
void
Rhythmic_req *rhythmic_req = dynamic_cast <Rhythmic_req *> (info.req_l_);
if (!rhythmic_req)
{
- String s=_("Stem must have Rhythmic structure.");
+ String s = _ ("Stem must have Rhythmic structure.");
if (info.req_l_)
- info.req_l_->warning(s);
+ info.req_l_->warning (s);
else
::warning (s);
if (rhythmic_req->duration_.durlog_i_<= 2)
{
rhythmic_req->warning (_ ("stem doesn't fit in beam"));
- reqs_drul_[LEFT]->warning (_("beam was started here"));
+ prev_start_req_->warning (_ ("beam was started here"));
return;
}
if (!grouping_p_->child_fit_b (start))
{
- String s (_("please fix me") + ": "
- + _f ("stem at %s doesn't fit in beam", now_moment ().str ()));
+ String s (_ ("please fix me") + ": "
+ + _f ("stem at %s doesn't fit in beam", now_mom ().str ()));
if (info.req_l_)
info.req_l_->warning(s);
}
else
{
- grouping_p_->add_child (start, rhythmic_req->duration ());
+ grouping_p_->add_child (start, rhythmic_req->length_mom ());
stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
beam_p_->add_stem (stem_l);
}