- {
- current_cresc_ev_ = accepted_spanreqs_drul_[START];
-
- if (Direction d = to_dir (current_cresc_ev_->get_property ("direction")))
- set_grob_direction (line_spanner_, d);
-
- /*
- TODO: Use symbols.
- */
-
- String start_type =
- ly_symbol2string (current_cresc_ev_->get_property ("name"));
-
- /*
- ugh. Use push/pop?
- */
- if (start_type == "DecrescendoEvent")
- start_type = "decrescendo";
- else if (start_type == "CrescendoEvent")
- start_type = "crescendo";
-
- SCM s = get_property ((start_type + "Spanner").to_str0 ());
- if (!ly_c_symbol_p (s) || s == ly_symbol2scm ("hairpin"))
- {
- cresc_ = make_spanner ("Hairpin", accepted_spanreqs_drul_[START]->self_scm ());
- cresc_->set_property ("grow-direction",
- scm_int2num ((start_type == "crescendo")
- ? BIGGER : SMALLER));
-
- }
-
-
- /*
- This is a convenient (and legacy) interface to TextSpanners
- for use in (de)crescendi.
- Hmm.
- */
- else
- {
- cresc_ = make_spanner ("DynamicTextSpanner", accepted_spanreqs_drul_[START]->self_scm ());
- cresc_->set_property ("style", s);
- context ()->set_property ((start_type
- + "Spanner").to_str0 (), SCM_EOL);
- s = get_property ((start_type + "Text").to_str0 ());
- /*
- FIXME: use get_markup () to check type.
- */
- if (ly_c_string_p (s) || ly_c_pair_p (s))
- {
- cresc_->set_property ("edge-text",
- scm_cons (s, scm_makfrom0str ("")));
- context ()->set_property ((start_type + "Text").to_str0 (),
- SCM_EOL);
- }
- }
-
- cresc_->set_bound (LEFT, script_
- ? script_
- : unsmob_grob (get_property ("currentMusicalColumn")));
-
- Axis_group_interface::add_element (line_spanner_, cresc_);
-
- add_bound_item (line_spanner_, cresc_->get_bound (LEFT));
- }
+ {
+ 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 = scm_car (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_);
+ }