#include "beam.hh"
#include "musical-request.hh"
#include "grouping.hh"
-#include "text-spanner.hh"
-#include "text-def.hh"
#include "p-col.hh"
Beam_engraver::Beam_engraver()
span_reqs_drul_[LEFT] = span_reqs_drul_[RIGHT] =0;
beam_p_ =0;
current_grouping_p_ =0;
- plet_spanner_p_ =0;
}
bool
void
Beam_engraver::do_process_requests()
{
- if ( !beam_p_ && span_reqs_drul_[LEFT])
- {
- current_grouping_p_ = new Rhythmic_grouping;
- beam_p_ = new Beam;
- if (span_reqs_drul_[LEFT]->nplet)
- {
- plet_spanner_p_ = new Text_spanner;
- Text_def *defp = new Text_def;
- plet_spanner_p_->set_support (beam_p_);
-
- defp->align_i_ = 0;
- defp->text_str_ = span_reqs_drul_[LEFT]->nplet;
- defp->style_str_="italic";
- plet_spanner_p_->spec_p_ = defp;
- announce_element (Score_elem_info(plet_spanner_p_,0));
- }
-
- Scalar prop = get_property ("beamslopedamping");
- if (prop.isnum_b ())
- {
- beam_p_->damping_i_ = prop;
- }
-
- prop = get_property ("beamquantisaton");
- if (prop.isnum_b ())
- {
- beam_p_->quantisation_ = (Beam::Quantise)(int)prop;
- }
-
- announce_element (Score_elem_info (beam_p_, span_reqs_drul_[LEFT]));
- }
+ if (beam_p_ || !span_reqs_drul_[LEFT])
+ return;
+
+ current_grouping_p_ = new Rhythmic_grouping;
+ beam_p_ = new Beam;
+
+ Scalar prop = get_property ("beamslopedamping");
+ if (prop.isnum_b ())
+ beam_p_->damping_i_ = prop;
+
+ prop = get_property ("beamquantisaton");
+ if (prop.isnum_b ())
+ beam_p_->quantisation_ = (Beam::Quantise)(int)prop;
+
+ announce_element (Score_elem_info (beam_p_, span_reqs_drul_[LEFT]));
}
void
Beam_engraver::do_pre_move_processing()
{
- if (beam_p_ && span_reqs_drul_[RIGHT])
- {
- Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
- rg_C->extend (current_grouping_p_->interval());
- beam_p_->set_grouping (*rg_C, *current_grouping_p_);
- typeset_element (beam_p_);
- beam_p_ = 0;
-
- delete current_grouping_p_;
- current_grouping_p_ = 0;
-
- span_reqs_drul_[RIGHT] =
- span_reqs_drul_[LEFT] = 0;
- if (plet_spanner_p_)
- {
- typeset_element (plet_spanner_p_);
- plet_spanner_p_ =0;
- }
- }
+ if (!beam_p_ || !span_reqs_drul_[RIGHT])
+ return;
+
+ Rhythmic_grouping const * rg_C = get_staff_info().rhythmic_C_;
+ rg_C->extend (current_grouping_p_->interval());
+ beam_p_->set_grouping (*rg_C, *current_grouping_p_);
+ typeset_element (beam_p_);
+ beam_p_ = 0;
+
+ delete current_grouping_p_;
+ current_grouping_p_ = 0;
+
+ span_reqs_drul_[RIGHT] = span_reqs_drul_[LEFT] = 0;
}
void
virtual Dynamic_req* dynamic() { return 0; }
virtual Absolute_dynamic_req * absdynamic() { return 0; }
virtual Tie_req * tie() { return 0; }
+ virtual Plet_req* plet() { return 0; }
virtual Span_dynamic_req * span_dynamic() { return 0; }
virtual Abbreviation_req* abbrev() { return 0; }
REQUESTMETHODS(Musical_req, musical);
};
-/** Start / stop a beam at this note. if #nplet# is set, the staff
-will try to put an appropriate number over the beam */
+/** Start / stop a beam at this note */
class Beam_req : public Span_req {
public:
- int nplet;
-
/* *************** */
REQUESTMETHODS(Beam_req,beam);
};
+/// a plet (bracket with) number
+class Plet_req : public Span_req {
+public:
+ int plet_i_;
+
+ REQUESTMETHODS(Plet_req,plet);
+
+ Plet_req ();
+};
+
class Musical_script_req : public Musical_req, public Script_req {
public:
REQUESTMETHODS(Musical_script_req, musicalscript);