You don't need all those buttons, pause, escape etc separately programmed just use your shift key ( by default that is P1 start when the jumper is set to mame ) along with joystick movements for your other commands eg P1 start plus joystick down is pause I think ( could be wrong ).
I-Pac ia fully programable for all keys, you need to shift the jumper from mame to alt and then use the programming utility that came on the disc with the IPac.
You only need 2 mouse buttons however a game like missile command has 3 fire buttons. Wire up the trackball buttons to both your IPac and OptiPac ( I assume you are using one ) so you have 2 sets of wires from each trackball button with one wire going to going both encoders.