- if (mp.main_part_ == Rational (0))
- {
- SCM bn = get_property ("currentBarNumber");
- SCM proc = get_property ("barNumberVisibility");
- if (scm_is_number (bn) && ly_is_procedure (proc)
- && to_boolean (scm_call_1 (proc, bn)))
- {
- create_items ();
- // guh.
- text_->set_property
- ("text", scm_makfrom0str (to_string (scm_to_int (bn)).to_str0 ()));
- }
- }
+ SCM bn = get_property ("currentBarNumber");
+ SCM proc = get_property ("barNumberVisibility");
+ if (scm_is_number (bn) && ly_is_procedure (proc)
+ && to_boolean (scm_call_2 (proc, bn, mp.smobbed_copy ())))
+ {
+ create_items ();
+ SCM alternative_style = get_property ("alternativeNumberingStyle");
+ string text_tag = "";
+ if (alternative_style == ly_symbol2scm ("numbers-with-letters"))
+ {
+ if (alternative_event_)
+ {
+ Direction alternative_dir = robust_scm2dir (alternative_event_->get_property ("alternative-dir"), RIGHT);
+ switch (alternative_dir)
+ {
+ case LEFT:
+ alternative_number_ = 0;
+ break;
+ case CENTER:
+ break;
+ case RIGHT:
+ alternative_number_ = INT_MIN;
+ break;
+ default:
+ assert (false);
+ }
+ alternative_number_ += alternative_number_increment_;
+
+ alternative_number_increment_ = robust_scm2int (alternative_event_->get_property ("alternative-increment"), 1);
+ }
+ }
+ SCM formatter = get_property ("barNumberFormatter");
+ if (ly_is_procedure (formatter))
+ text_->set_property ("text", scm_call_4 (formatter,
+ bn,
+ mp.smobbed_copy (),
+ scm_from_int (alternative_number_),
+ context ()->self_scm ()));
+ }