+/*
+ 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 ()
+{
+ /*
+ UGH.
+ */
+ if (!unsmob_grob (staff_))
+ return true;
+
+ if (!to_boolean (get_property ("voltaOnThisStaff")))
+ {
+ /*
+ 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.
+
+ May be this is a bit convoluted, and we should have a single
+ volta engraver in score context or somesuch.
+
+ */
+ if (!ly_c_pair_p (staffs))
+ {
+ programming_error ("Huh? Volta engraver can't find staffs?");
+ return false;
+ }
+ else if (ly_car (scm_last_pair (staffs)) != staff_)
+ {
+ return false;
+ }
+ }
+ return true;
+}
+