Patternview: improve note drawing code, fix bugs (fixes #419)

fixes #419