Sort tracks in the port matrix according to editor order. Fixes #2966.