- if (rhythmic_req->duration_.durlog_i_<= 2)
- {
- rhythmic_req->warning (_ ("stem doesn't fit in beam"));
- reqs_drul_[LEFT]->warning (_("beam was started here"));
- return;
- }
-
- /*
- TODO: do something sensible if it doesn't fit in the beam.
- */
- Moment start = get_staff_info().time_C_->whole_in_measure_;
-
- if (!grouping_p_->child_fit_b (start))
- {
- String s (_("please fix me") + ": "
- + _f ("stem at %s doesn't fit in beam", now_moment ().str ()));
-
- if (info.req_l_)
- info.req_l_->warning(s);
- else
- warning (s);
- }
- else
- {
- grouping_p_->add_child (start, rhythmic_req->duration ());
- stem_l->flag_i_ = rhythmic_req->duration_.durlog_i_;
- beam_p_->add_stem (stem_l);
- }
- }
+ Music* m = info.music_cause();
+ if (!m->is_mus_type ("rhythmic-event"))
+ {
+ String s = _ ("stem must have Rhythmic structure");
+ if (info.music_cause ())
+ info.music_cause ()->origin ()->warning (s);
+ else
+ ::warning (s);
+
+ return;
+ }
+
+
+ last_stem_added_at_ = now;
+ int durlog = unsmob_duration (m->get_mus_property ("duration"))-> duration_log ();
+ if (durlog <= 2)
+ {
+ m->origin ()->warning (_ ("stem doesn't fit in beam"));
+ prev_start_ev_->origin ()->warning (_ ("beam was started here"));
+ /*
+ don't return, since
+
+ [r4 c8] can just as well be modern notation.
+ */
+ }
+
+ stem->set_grob_property ("duration-log",
+ scm_int2num (durlog));
+ Moment stem_location = now - beam_start_mom_ + beam_start_location_;
+ beam_info_->add_stem (stem_location,
+ (durlog- 2) >? 0);
+ Beam::add_stem (beam_, stem);
+ }
+ }
+}
+
+
+
+
+
+ENTER_DESCRIPTION(Beam_engraver,
+/* descr */ "Handles Beam events by engraving Beams. If omitted, then notes will be "
+"printed with flags instead of beams.",
+/* creats*/ "Beam",
+/* accepts */ "beam-event new-beam-event abort-event",
+/* acks */ "stem-interface rest-interface",
+/* reads */ "beamMelismaBusy beatLength subdivideBeams",
+/* write */ "");
+
+
+class Grace_beam_engraver : public Beam_engraver
+{
+public:
+ TRANSLATOR_DECLARATIONS(Grace_beam_engraver);
+
+protected:
+ virtual bool valid_start_moment();
+ virtual bool valid_end_moment ();
+};
+
+Grace_beam_engraver::Grace_beam_engraver()
+{
+}
+
+bool
+Grace_beam_engraver::valid_start_moment()
+{
+ Moment n = now_mom ();
+
+ return n.grace_part_ != Rational (0);