Refactor X-Y scrolling handlers

Hopefully this is considered a bit less messy. There is common ground
between ListBox/PatternEditor both axes and SampleEditor/EnvelopeEditor
horizontal, but I’m not sure of a good place to put the code so that
the different classes can share it.