Improve TAB fretting algorithm.

An attempt to improve the current implementation to better deal with the case in forum post #29876 and possibly even with less specialized cases.

Changes:
- when a note changes of pitch, its fretting is discarded before any fretting
- each note not yet fretted is sorted for fretting as belonging to the string most convenient for it.
- increasing voices (1, 2, 3, 4) get higher sort keys rather than lower as before.

These changes mostly affect the order in which notes are evaluated during fretting.

Note: the algorithm can still be fooled by casual note entry and by changing note pitches by large intervals (octave), but it seems anyway better than before.