+/*
+ TODO: this logic should be rewritten, it is buggy.
+
+ One of the problems is that we can't determine wether or not to
+ print the volta bracket during the first step, since that requires
+ acknowledging the staff.
+*/
+bool
+Volta_engraver::staff_eligible ()
+{
+ SCM doit = get_property ("voltaOnThisStaff");
+ if (scm_is_bool (doit))
+ return to_boolean (doit);
+
+ if (!unsmob_grob (staff_))
+ return false;
+
+ /*
+ TODO: this does weird things when you open a piece with a
+ volta spanner.
+ */
+ SCM staffs = get_property ("stavesFound");
+
+ /* Only put a volta on the top staff.
+ Maybe this is a bit convoluted, and we should have a single
+ volta engraver in score context or somesuch. */
+ if (!scm_is_pair (staffs))
+ {
+ programming_error ("volta engraver can't find staves");
+ return false;
+ }
+ else if (scm_car (scm_last_pair (staffs)) != staff_)
+ return false;
+ return true;
+}