- if (current_cresc_ev_)
- {
- string msg = _ ("already have a decrescendo");
- if (current_cresc_ev_->in_event_class ("crescendo-event"))
- msg = _ ("already have a crescendo");
-
- accepted_spanevents_drul_[START]->origin ()->warning (msg);
- current_cresc_ev_->origin ()->warning (_ ("cresc starts here"));
- }
- else
- {
- current_cresc_ev_ = accepted_spanevents_drul_[START];
-
- if (Direction d = to_dir (current_cresc_ev_->get_property ("direction")))
- set_grob_direction (line_spanner_, d);
-
- /*
- TODO: Use symbols.
- */
-
- SCM start_sym = current_cresc_ev_->get_property ("class");
- string start_type;
-
- if (start_sym == ly_symbol2scm ("decrescendo-event"))
- start_type = "decrescendo";
- else if (start_sym == ly_symbol2scm ("crescendo-event"))
- start_type = "crescendo";
- else
- {
- programming_error ("unknown dynamic spanner type");
- return;
- }
-
- /*
- UGH. TODO: should read from original event, so appearance
- may be altered with \tweak.
- */
- SCM s = get_property ((start_type + "Spanner").c_str ());
- if (!scm_is_symbol (s) || s == ly_symbol2scm ("hairpin"))
- {
- cresc_ = make_spanner ("Hairpin", accepted_spanevents_drul_[START]->self_scm ());
- if (finished_cresc_)
- {
- Pointer_group_interface::add_grob (finished_cresc_,
- ly_symbol2scm ("adjacent-hairpins"),
- cresc_);
-
- Pointer_group_interface::add_grob (cresc_,
- ly_symbol2scm ("adjacent-hairpins"),
- finished_cresc_);
- }
- }
-
- /*
- This is a convenient (and legacy) interface to TextSpanners
- for use in (de)crescendi.
- Hmm.
- */
- else
- {
- cresc_ = make_spanner ("DynamicTextSpanner", accepted_spanevents_drul_[START]->self_scm ());
- cresc_->set_property ("style", s);
- context ()->set_property ((start_type
- + "Spanner").c_str (), SCM_EOL);
- s = get_property ((start_type + "Text").c_str ());
- if (Text_interface::is_markup (s))
- {
- cresc_->set_property ("text", s);
- context ()->set_property ((start_type + "Text").c_str (),
- SCM_EOL);
- }
-
- if (script_)
- {
- set_nested_property (cresc_,
- scm_list_3 (ly_symbol2scm ("bound-details"),
- ly_symbol2scm ("left"),
- ly_symbol2scm ("attach-dir")
- ),
- scm_from_int (RIGHT));
- }
- }
-
- if (script_)
- {
- cresc_->set_bound (LEFT, script_);
- add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
- }
- Axis_group_interface::add_element (line_spanner_, cresc_);
- }