Просмотр исходного кода

Merge branch 'develop' into feature/Articulations

# Conflicts:
#	src/MusicalScore/Graphical/MusicSheetCalculator.ts
#	src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts
#	src/MusicalScore/ScoreIO/VoiceGenerator.ts
Matthias Uiberacker 7 лет назад
Родитель
Сommit
64df536c94
100 измененных файлов с 2050 добавлено и 2068 удалено
  1. 17 0
      .appveyor.yml
  2. 5 0
      .eslintignore
  3. 3 0
      .eslintrc.yml
  4. 0 3
      .gitignore
  5. 0 91
      .jshintrc
  6. 1 0
      AUTHORS
  7. 0 192
      Gruntfile.js
  8. 4 3
      README.md
  9. 1 1
      bin/publish_gh_page.sh
  10. 71 53
      demo/index.html
  11. 23 19
      demo/index.js
  12. 44 12
      karma.conf.js
  13. 35 32
      package.json
  14. 9 9
      src/Common/DataObjects/Fraction.ts
  15. 13 13
      src/Common/DataObjects/Pitch.ts
  16. 11 11
      src/Common/FileIO/Mxl.ts
  17. 8 8
      src/Common/FileIO/Xml.ts
  18. 4 4
      src/MusicalScore/Graphical/AccidentalCalculator.ts
  19. 48 31
      src/MusicalScore/Graphical/BoundingBox.ts
  20. 39 1
      src/MusicalScore/Graphical/DrawingEnums.ts
  21. 1 1
      src/MusicalScore/Graphical/EngravingRules.ts
  22. 1 2
      src/MusicalScore/Graphical/GraphicalChordSymbolContainer.ts
  23. 5 5
      src/MusicalScore/Graphical/GraphicalLabel.ts
  24. 97 97
      src/MusicalScore/Graphical/GraphicalMusicSheet.ts
  25. 2 2
      src/MusicalScore/Graphical/GraphicalNote.ts
  26. 28 28
      src/MusicalScore/Graphical/GraphicalStaffEntry.ts
  27. 4 4
      src/MusicalScore/Graphical/GraphicalStaffEntryLink.ts
  28. 200 206
      src/MusicalScore/Graphical/MusicSheetCalculator.ts
  29. 87 58
      src/MusicalScore/Graphical/MusicSheetDrawer.ts
  30. 38 39
      src/MusicalScore/Graphical/MusicSystem.ts
  31. 100 105
      src/MusicalScore/Graphical/MusicSystemBuilder.ts
  32. 10 10
      src/MusicalScore/Graphical/SelectionEndSymbol.ts
  33. 7 7
      src/MusicalScore/Graphical/SelectionStartSymbol.ts
  34. 6 6
      src/MusicalScore/Graphical/StaffLine.ts
  35. 1 1
      src/MusicalScore/Graphical/StaffLineActivitySymbol.ts
  36. 18 20
      src/MusicalScore/Graphical/StaffMeasure.ts
  37. 3 3
      src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts
  38. 5 3
      src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend.ts
  39. 6 1
      src/MusicalScore/Graphical/VexFlow/SvgVexFlowBackend.ts
  40. 9 1
      src/MusicalScore/Graphical/VexFlow/VexFlowBackend.ts
  41. 15 15
      src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts
  42. 1 1
      src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalNote.ts
  43. 17 7
      src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts
  44. 42 0
      src/MusicalScore/Graphical/VexFlow/VexFlowInstrumentBracket.ts
  45. 40 40
      src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts
  46. 42 44
      src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts
  47. 9 5
      src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts
  48. 12 5
      src/MusicalScore/Graphical/VexFlow/VexFlowMusicSystem.ts
  49. 2 2
      src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts
  50. 1 1
      src/MusicalScore/Graphical/VexFlow/VexFlowTextMeasurer.ts
  51. 22 22
      src/MusicalScore/Instrument.ts
  52. 6 0
      src/MusicalScore/Interfaces/IGraphicalSymbolFactory.ts
  53. 4 4
      src/MusicalScore/MusicParts/MusicPartManager.ts
  54. 34 34
      src/MusicalScore/MusicParts/MusicPartManagerIterator.ts
  55. 18 18
      src/MusicalScore/MusicSheet.ts
  56. 9 9
      src/MusicalScore/MusicSource/Repetition.ts
  57. 85 85
      src/MusicalScore/ScoreIO/InstrumentReader.ts
  58. 91 91
      src/MusicalScore/ScoreIO/MusicSheetReader.ts
  59. 10 10
      src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts
  60. 29 29
      src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts
  61. 207 205
      src/MusicalScore/ScoreIO/VoiceGenerator.ts
  62. 4 4
      src/MusicalScore/SubInstrument.ts
  63. 1 1
      src/MusicalScore/VoiceData/Expressions/AbstractExpression.ts
  64. 1 1
      src/MusicalScore/VoiceData/Expressions/AbstractTempoExpression.ts
  65. 3 3
      src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression.ts
  66. 3 3
      src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousTempoExpression.ts
  67. 5 5
      src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/Slur.ts
  68. 2 2
      src/MusicalScore/VoiceData/Expressions/MultiExpression.ts
  69. 1 1
      src/MusicalScore/VoiceData/Expressions/MultiTempoExpression.ts
  70. 3 3
      src/MusicalScore/VoiceData/Instructions/ClefInstruction.ts
  71. 6 6
      src/MusicalScore/VoiceData/Instructions/KeyInstruction.ts
  72. 1 1
      src/MusicalScore/VoiceData/Instructions/RepetitionInstruction.ts
  73. 2 2
      src/MusicalScore/VoiceData/Instructions/RhythmInstruction.ts
  74. 2 2
      src/MusicalScore/VoiceData/Lyrics/LyricsWord.ts
  75. 4 4
      src/MusicalScore/VoiceData/Note.ts
  76. 30 30
      src/MusicalScore/VoiceData/SourceMeasure.ts
  77. 9 9
      src/MusicalScore/VoiceData/SourceStaffEntry.ts
  78. 1 1
      src/MusicalScore/VoiceData/Tie.ts
  79. 43 43
      src/MusicalScore/VoiceData/VoiceEntry.ts
  80. 13 13
      src/OSMD/Cursor.ts
  81. 12 12
      src/OSMD/OSMD.ts
  82. 3 3
      src/Util/CollectionUtil.ts
  83. 1 1
      src/Util/PSMath.ts
  84. 2 2
      test/Common/DataObjects/Fraction_Test.ts
  85. 25 25
      test/Common/DataObjects/Pitch_Test.ts
  86. 3 3
      test/Common/FileIO/Mxl_Test.ts
  87. 10 10
      test/Common/FileIO/Xml_Test.ts
  88. 31 31
      test/Common/OSMD/OSMD_Test.ts
  89. 2 2
      test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts
  90. 16 16
      test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts
  91. 18 18
      test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts
  92. 5 5
      test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts
  93. 39 39
      test/MusicalScore/ScoreIO/Key_Test.ts
  94. 3 3
      test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts
  95. 4 4
      test/Util/TestUtils.ts
  96. BIN
      test/data/Parlez-moi.mxl
  97. 1 0
      tslint.json
  98. 75 0
      webpack.common.js
  99. 0 51
      webpack.config.js
  100. 6 0
      webpack.dev.js

+ 17 - 0
.appveyor.yml

@@ -0,0 +1,17 @@
+image: Visual Studio 2017
+environment:
+  matrix:
+    - nodejs_version: "6"
+    - nodejs_version: "7"
+    - nodejs_version: "8"
+    - nodejs_version: "9"    
+install:
+  - ps: Install-Product node $env:nodejs_version
+  - npm install
+  - node --version
+  - npm --version
+build_script:
+  - npm run lint
+  - npm run build
+test_script:
+  - npm run test

+ 5 - 0
.eslintignore

@@ -0,0 +1,5 @@
+node_modules
+dist
+build
+bin
+demo

+ 3 - 0
.eslintrc.yml

@@ -0,0 +1,3 @@
+extends: standard
+rules:
+  indent: [2, 4]

+ 0 - 3
.gitignore

@@ -23,9 +23,6 @@ lib-cov
 # Coverage directory used by tools like istanbul
 coverage
 
-# Grunt intermediate storage (http://gruntjs.com/creating-plugins#storing-task-files)
-.grunt
-
 # node-waf configuration
 .lock-wscript
 

+ 0 - 91
.jshintrc

@@ -1,91 +0,0 @@
-{
-    // JSHint Default Configuration File (as on JSHint website)
-    // See http://jshint.com/docs/ for more details
-
-    "maxerr"        : 50,       // {int} Maximum error before stopping
-
-    // Enforcing
-    "bitwise"       : true,     // true: Prohibit bitwise operators (&, |, ^, etc.)
-    "camelcase"     : true,     // true: Identifiers must be in camelCase
-    "curly"         : true,     // true: Require {} for every new block or scope
-    "eqeqeq"        : true,     // true: Require triple equals (===) for comparison
-    "forin"         : true,     // true: Require filtering for..in loops with obj.hasOwnProperty()
-    "freeze"        : true,     // true: prohibits overwriting prototypes of native objects such as Array, Date etc.
-    "immed"         : false,    // true: Require immediate invocations to be wrapped in parens e.g. `(function () { } ());`
-    "latedef"       : false,    // true: Require variables/functions to be defined before being used
-    "newcap"        : false,    // true: Require capitalization of all constructor functions e.g. `new F()`
-    "noarg"         : true,     // true: Prohibit use of `arguments.caller` and `arguments.callee`
-    "noempty"       : true,     // true: Prohibit use of empty blocks
-    "nonbsp"        : true,     // true: Prohibit "non-breaking whitespace" characters.
-    "nonew"         : false,    // true: Prohibit use of constructors for side-effects (without assignment)
-    "plusplus"      : false,    // true: Prohibit use of `++` and `--`
-    "quotmark"      : true,     // Quotation mark consistency:
-                                //   false    : do nothing (default)
-                                //   true     : ensure whatever is used is consistent
-                                //   "single" : require single quotes
-                                //   "double" : require double quotes
-    "undef"         : true,     // true: Require all non-global variables to be declared (prevents global leaks)
-    "unused"        : true,     // Unused variables:
-                                //   true     : all variables, last function parameter
-                                //   "vars"   : all variables only
-                                //   "strict" : all variables, all function parameters
-    "strict"        : true,     // true: Requires all functions run in ES5 Strict Mode
-    "maxparams"     : false,    // {int} Max number of formal params allowed per function
-    "maxdepth"      : false,    // {int} Max depth of nested blocks (within functions)
-    "maxstatements" : false,    // {int} Max number statements per function
-    "maxcomplexity" : false,    // {int} Max cyclomatic complexity per function
-    "maxlen"        : false,    // {int} Max number of characters per line
-    "varstmt"       : false,    // true: Disallow any var statements. Only `let` and `const` are allowed.
-
-    // Relaxing
-    "asi"           : false,     // true: Tolerate Automatic Semicolon Insertion (no semicolons)
-    "boss"          : false,     // true: Tolerate assignments where comparisons would be expected
-    "debug"         : false,     // true: Allow debugger statements e.g. browser breakpoints.
-    "eqnull"        : false,     // true: Tolerate use of `== null`
-    "esversion"     : 5,         // {int} Specify the ECMAScript version to which the code must adhere.
-    "moz"           : false,     // true: Allow Mozilla specific syntax (extends and overrides esnext features)
-                                 // (ex: `for each`, multiple try/catch, function expression…)
-    "evil"          : false,     // true: Tolerate use of `eval` and `new Function()`
-    "expr"          : false,     // true: Tolerate `ExpressionStatement` as Programs
-    "funcscope"     : false,     // true: Tolerate defining variables inside control statements
-    "globalstrict"  : false,     // true: Allow global "use strict" (also enables 'strict')
-    "iterator"      : false,     // true: Tolerate using the `__iterator__` property
-    "lastsemic"     : false,     // true: Tolerate omitting a semicolon for the last statement of a 1-line block
-    "laxbreak"      : false,     // true: Tolerate possibly unsafe line breakings
-    "laxcomma"      : false,     // true: Tolerate comma-first style coding
-    "loopfunc"      : false,     // true: Tolerate functions being defined in loops
-    "multistr"      : false,     // true: Tolerate multi-line strings
-    "noyield"       : false,     // true: Tolerate generator functions with no yield statement in them.
-    "notypeof"      : false,     // true: Tolerate invalid typeof operator values
-    "proto"         : false,     // true: Tolerate using the `__proto__` property
-    "scripturl"     : false,     // true: Tolerate script-targeted URLs
-    "shadow"        : false,     // true: Allows re-define variables later in code e.g. `var x=1; x=2;`
-    "sub"           : false,     // true: Tolerate using `[]` notation when it can still be expressed in dot notation
-    "supernew"      : false,     // true: Tolerate `new function () { ... };` and `new Object;`
-    "validthis"     : false,     // true: Tolerate using this in a non-constructor function
-
-    // Environments
-    "browser"       : true,     // Web Browser (window, document, etc)
-    "browserify"    : false,    // Browserify (node.js code in the browser)
-    "couch"         : false,    // CouchDB
-    "devel"         : true,     // Development/debugging (alert, confirm, etc)
-    "dojo"          : false,    // Dojo Toolkit
-    "jasmine"       : false,    // Jasmine
-    "jquery"        : false,    // jQuery
-    "mocha"         : true,     // Mocha
-    "mootools"      : false,    // MooTools
-    "node"          : true,    // Node.js
-    "nonstandard"   : false,    // Widely adopted globals (escape, unescape, etc)
-    "phantom"       : false,    // PhantomJS
-    "prototypejs"   : false,    // Prototype and Scriptaculous
-    "qunit"         : false,    // QUnit
-    "rhino"         : false,    // Rhino
-    "shelljs"       : false,    // ShellJS
-    "typed"         : false,    // Globals for typed array constructions
-    "worker"        : false,    // Web Workers
-    "wsh"           : false,    // Windows Scripting Host
-    "yui"           : false,    // Yahoo User Interface
-
-    // Custom Globals
-    "globals"       : {}        // additional predefined global variables
-}

+ 1 - 0
AUTHORS

@@ -2,3 +2,4 @@ Andrea Condoluci <a.condoluci@phonicscore.com> (http://llliii.ooo)
 Oliver Hörbinger <o.hoerbinger@phonicscore.com> ()
 Matthias Uiberacker <m.uiberacker@phonicscore.com> ()
 Sebastian Haas <s.haas@phonicscore.com> (http://sebastianhaas.at)
+Benjamin Giesinger <benjamin.giesinger@gmail.com> (http://benjamingiesinger.de)

+ 0 - 192
Gruntfile.js

@@ -1,192 +0,0 @@
-/*global module*/
-var webpackCfg = require('./webpack.config.js');
-
-module.exports = function (grunt) {
-    'use strict';
-
-    // The banner on top of the build
-    var banner = '/**\n' +
-        ' * Open Sheet Music Display <%= pkg.version %> built on <%= grunt.template.today("yyyy-mm-dd") %>.\n' +
-        ' * Copyright (c) 2016 PhonicScore\n' +
-        ' *\n' +
-        ' * https://github.com/opensheetmusicdisplay/opensheetmusicdisplay\n' +
-        ' */\n',
-        typings = [
-            'typings/index.d.ts',
-            // Additional manual typings:
-            'external/vexflow/vexflow.d.ts'
-        ];
-
-    // Paths
-    var src = ['src/**/*.ts'];
-    var test = ['test/**/*.ts'];
-
-    // Grunt configuration following:
-    grunt.initConfig({
-        pkg: grunt.file.readJSON('package.json'),
-        banner: '',
-        // Build output directories
-        outputDir: {
-            build: 'build',
-            dist: 'dist'
-        },
-        // Browserify
-        browserify: {
-            dist: {
-                src: ['src/OSMD/OSMD.ts'],
-                dest: '<%= outputDir.build %>/osmd.js',
-                options: {
-                    banner: '<%= banner %>',
-                    browserifyOptions: {
-                        standalone: 'opensheetmusicdisplay'
-                    }
-                }
-            },
-            debug: {
-                src: ['src/OSMD/OSMD.ts'],
-                dest: '<%= outputDir.build %>/osmd-debug.js',
-                options: {
-                    banner: '<%= banner %>',
-                    browserifyOptions: {
-                        debug: true,
-                        standalone: 'opensheetmusicdisplay'
-                    }
-                }
-            },
-            test: {
-                src: [].concat(typings, src, test),
-                dest: '<%= outputDir.build %>/osmd-test.js',
-                options: {
-                    banner: '<%= banner %>',
-                    browserifyOptions: {
-                        debug: true
-                    }
-                }
-            },
-            options: {
-                plugin: ['tsify']
-            }
-        },
-        // Uglify
-        uglify: {
-            options: {
-                compress: {
-                    'drop_console': true
-                },
-                banner: banner,
-                mangle: true,
-                mangleProperties: true
-            },
-            bundle: {
-                files: {
-                    'build/osmd.min.js': ['build/osmd.js']
-                }
-            }
-        },
-        // Webpack
-        webpack: {
-          options: {
-            progress: true,
-          },
-          build: webpackCfg,
-          dev: Object.assign({ watch: true }, webpackCfg)
-        },
-        'webpack-dev-server': {
-          options: {
-              webpack: webpackCfg
-          },
-          start: webpackCfg.devServer,
-        },
-        // Karma setup
-        karma: {
-            // For continuous integration
-            ci: {
-                configFile: 'karma.conf.js',
-                options: {
-                    browsers: ['PhantomJS']
-                }
-            },
-            firefox: {
-                configFile: 'karma.conf.js',
-                options: {
-                    singleRun: false,
-                    browsers: ['Firefox']
-                }
-            },
-            chrome: {
-                configFile: 'karma.conf.js',
-                options: {
-                    singleRun: false,
-                    browsers: ['Chrome']
-                }
-            }
-        },
-        // Typescript compilation for ES6 module (npm package)
-        ts: {
-          default : {
-            tsconfig: true
-          }
-        },
-        // Cleaning task setup
-        clean: {
-            options: {
-                force: true
-            },
-            all: {
-                src: [
-                    '<%= outputDir.build %>',
-                    '<%= outputDir.dist %>',
-                    '.tscache',
-                    'src/**/*.js', 'test/**/*.js' // if something went wrong, delete JS from TypeScript source directories
-                ]
-            }
-        },
-        copy: {
-            demo: {
-                files: [
-                    { src: ['*'], dest: '<%= outputDir.build %>/demo/sheets/', cwd: './test/data/', expand: true },
-                    { src: ['*.js', '*.css', '*.html', '*.ico'], cwd: './demo/', expand: true, dest: '<%= outputDir.build %>/demo/' },
-                    { src: ['osmd-debug.js'], cwd: './build/', expand: true, dest: '<%= outputDir.build %>/demo/' }
-                ]
-            }
-        },
-        // http-server
-        'http-server': {
-            'demo': {
-                root: 'build/demo',
-                port: 8000,
-                host: '0.0.0.0',
-                showDir : true,
-                autoIndex: true,
-                runInBackground: false,
-                openBrowser : true
-            }
-        }
-
-    });
-
-    // Load npm tasks
-    grunt.loadNpmTasks('grunt-browserify');
-    grunt.loadNpmTasks('grunt-contrib-clean');
-    grunt.loadNpmTasks('grunt-contrib-copy');
-    grunt.loadNpmTasks('grunt-contrib-uglify');
-    grunt.loadNpmTasks('grunt-contrib-watch');
-    grunt.loadNpmTasks('grunt-http-server');
-    grunt.loadNpmTasks('grunt-karma');
-    grunt.loadNpmTasks('grunt-ts');
-    grunt.loadNpmTasks('grunt-webpack');
-
-    // Build tasks
-    grunt.registerTask('build:demo',  'Builds the demo.',                            ['browserify:debug', 'copy:demo']);
-    grunt.registerTask('build:test',  'Builds the tests',                            ['browserify:test']);
-    grunt.registerTask('build:dist',  'Builds for distribution on npm and Bower.',   ['browserify:dist', 'uglify', 'ts']);
-    grunt.registerTask('build:pack',  'Builds using webpack',                        ['webpack:build', 'uglify']);
-
-    // Tests
-    grunt.registerTask('test',        'Runs unit, regression and e2e tests.',        ['build:test', 'karma:ci']);
-
-    // Webpack dev server
-    grunt.registerTask('webpack-server', ['webpack-dev-server:start']);
-    // Default task (if grunt is run without any argument, used in contiuous integration)
-    grunt.registerTask('default',     'Default task, running all other tasks. (CI)', ['test', 'build:demo', 'build:dist']);
-};

+ 4 - 3
README.md

@@ -1,15 +1,16 @@
-<img alt="OSMD logo" src="http://opensheetmusicdisplay.org/assets/osmd_logo.svg" width="200"/>
+<img alt="OSMD logo" src="https://opensheetmusicdisplay.org/assets/osmd_logo.svg" width="200"/>
 
 # OpenSheetMusicDisplay
 
 [![Greenkeeper badge](https://badges.greenkeeper.io/opensheetmusicdisplay/opensheetmusicdisplay.svg)](https://greenkeeper.io/)
-[![Build Status](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay.svg?branch=master)](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay)
+[![Travis Build Status](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay.svg?branch=master)](https://travis-ci.org/opensheetmusicdisplay/opensheetmusicdisplay)
+[![Appveyor Build status](https://ci.appveyor.com/api/projects/status/r88lnffso55nq1ko?svg=true)](https://ci.appveyor.com/project/sebastianhaas/opensheetmusicdisplay/branch/master)
 [![Dependency Status](https://david-dm.org/opensheetmusicdisplay/opensheetmusicdisplay.png)](https://david-dm.org/opensheetmusicdisplay/opensheetmusicdisplay)
 [![Gitter](https://badges.gitter.im/Join%20Chat.svg)](https://gitter.im/opensheetmusicdisplay/opensheetmusicdisplay?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
 [![Code Climate](https://codeclimate.com/github/opensheetmusicdisplay/opensheetmusicdisplay/badges/gpa.svg)](https://codeclimate.com/github/opensheetmusicdisplay/opensheetmusicdisplay)
 [![Commitizen friendly](https://img.shields.io/badge/commitizen-friendly-brightgreen.svg)](http://commitizen.github.io/cz-cli/)
 
-http://www.opensheetmusicdisplay.org/
+https://www.opensheetmusicdisplay.org/
 
 OpenSheeMusicDisplay is the missing link between MusicXML and VexFlow. Built upon many years of experience in both sheet music interactivity and engraving, it is the perfect solution for app developers seeking to build digital sheet music services.
 

+ 1 - 1
bin/publish_gh_page.sh

@@ -2,7 +2,7 @@
 
 # Prepare files to be published
 npm run docs
-grunt build:demo
+npm run build
 
 # Clone github page
 git clone git@github.com:opensheetmusicdisplay/opensheetmusicdisplay.github.io.git

+ 71 - 53
demo/index.html

@@ -3,65 +3,83 @@
 <head>
     <meta charset="utf-8">
 
-    <title>OpenSheetMusicDisplay Demo</title>
+    <title><%= htmlWebpackPlugin.options.title %></title>
     <meta name="description" content="A showcase for OpenSheetMusicDisplay.">
     <meta name="author" content="OpenSheetMusicDisplay contributors">
-
-    <!-- Include opensheetmusicdisplay -->
-    <script src="osmd-debug.js"></script>
-
-    <!-- Include code and styles for this demo -->
-    <script src="demo.js"></script>
-    <link href="demo.css" media="all" rel="stylesheet"/>
+    <!-- Demo js file is included automatically by webpack druing build -->
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.3.1/jquery.min.js" type="text/javascript"></script>    
+    <script src="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.0/semantic.min.js" type="text/javascript"></script>    
+    <link href="https://cdnjs.cloudflare.com/ajax/libs/semantic-ui/2.3.0/semantic.css" media="all" rel="stylesheet"/>
     <link rel="icon" href="./favicon.ico?" type="image/x-icon"/>
 </head>
 <body>
+<br>
+<h1 class="ui centered header">
+    <img src="./favicon.ico?" class="ui image">
+    <%= htmlWebpackPlugin.options.title %>
+</h1>
+<div class="ui three column grid container">
+    <div class="column">
+        <h3 class="ui header">Select a sample:</h3>
+        <select class="ui selection dropdown" style="width:100px"  id="select"></select>
+    </div>
+    <div class="column">
+        <h3 class="ui header">Render backend:</h3>
+        <select class="ui dropdown" id="backend-select" value="canvas">
+            <option value="canvas">Canvas</option>>
+            <option value="svg">SVG</option>
+        </select>
+    </div>
+    <div class="column">
+        <h3 class="ui header">Cursor controls:</h3>
+        <div class="ui buttons">
+            <div class="ui animated fade button" id="show-cursor-btn">
+                <div class="visible content">Show</div>
+                <div class="hidden content">
+                    <i class="eye icon"></i>
+                </div>
+            </div>
+            <div class="ui animated fade button" id="hide-cursor-btn">
+                <div class="visible content">Hide</div>
+                <div class="hidden content">
+                    <i class="eye slash icon"></i>
+                </div>
+            </div>
+            <div class="ui animated fade button" id="next-cursor-btn">
+                <div class="visible content">Next</div>
+                <div class="hidden content">
+                    <i class="arrow right icon"></i>
+                </div>
+            </div>
+            <div class="ui animated fade button" id="reset-cursor-btn">
+                <div class="visible content">Reset</div>
+                <div class="hidden content">
+                    <i class="undo icon"></i>
+                </div>
+            </div>
+        </div>
+    </div>         
+    <div class="column">
+        <h3 class="ui header">Zoom controls:</h3>
+        <div class="ui buttons">
+                <div class="ui button" id="zoom-in-btn">
+                    <i class="search plus icon"></i>
+                </div>
+                <div class="ui button" id="zoom-out-btn">
+                    <i class="search minus icon"></i>
+                </div>
+        </div>
+    </div>
+    <div class="column">
+        <h3 class="ui header">Zoom factor:</h3>
+        <h4 class="ui header" id="zoom-str">???</h4>
+    </div>
+    <div class="column">
+            <h3 class="ui header">Current width:</h3>                
+            <h4 class="ui header" id="size-str">???</h4>
+    </div>
+</div>
 <table cellspacing="0" style="max-width:700px;">
-    <tr>
-        <td>
-            <img src="./favicon.ico?" style="width:64px;height:64px;"/>
-        </td>
-        <td>
-            <h1>OpenSheetMusicDisplay Demo</h1>
-        </td>
-    </tr>
-</table>
-<table cellspacing="0" style="max-width:700px;">
-    <tr>
-        <td valign="top">
-            <select id="select"></select>
-            <p> Select a sample from the list ... </p>
-            <p>... or just drop your MusicXML file on this page.</p>
-        </td>
-        <td valign="top" halign="right">
-            <p>Renderer Backend
-                <select id="backend-select" value="canvas">
-                    <option value="canvas">Canvas</option>>
-                    <option value="svg">SVG</option>
-                </select>
-            <p>Cursor controls:
-                <input type="button" value="show" id="show-cursor-btn"/>
-                <input type="button" value="hide" id="hide-cursor-btn"/>
-                <input type="button" value="next" id="next-cursor-btn"/>
-                <input type="button" value="reset" id="reset-cursor-btn"/>
-            </p>
-            <p>
-                Zoom controls:
-                <input type="button" value="zoom in" id="zoom-in-btn"/>
-                <input type="button" value="zoom out" id="zoom-out-btn"/>
-            </p>
-            <table cellspacing="0">
-                <tr>
-                    <td>
-                        <p>Zoom factor: <span id="zoom-str">???</span>%</p>
-                    </td>
-                    <td>
-                        <p>Current width: <span id="size-str">???</span>px</p>
-                    </td>
-                </tr>
-            </table>
-        </td>
-    </tr>
     <tr id="error-tr">
         <td></td>
         <td id="error-td"></td>

+ 23 - 19
demo/demo.js → demo/index.js

@@ -1,11 +1,14 @@
+import { OSMD } from '../src/OSMD/OSMD';
+
 /*jslint browser:true */
 (function () {
     "use strict";
-    var OSMD;
+    var osmdObj;
     // The folder of the demo files
-    var folder = "sheets/",
+    var folder = process.env.STATIC_FILES_SUBFOLDER ? process.env.STATIC_FILES_SUBFOLDER + "/" : "",
     // The available demos
         demos = {
+            "Beethoven - AnDieFerneGeliebte": "Beethoven_AnDieFerneGeliebte.xml",
             "M. Clementi - Sonatina Op.36 No.1 Pt.1": "MuzioClementi_SonatinaOpus36No1_Part1.xml",
             "M. Clementi - Sonatina Op.36 No.1 Pt.2": "MuzioClementi_SonatinaOpus36No1_Part2.xml",
             "M. Clementi - Sonatina Op.36 No.3 Pt.1": "MuzioClementi_SonatinaOpus36No3_Part1.xml",
@@ -19,11 +22,12 @@
             "S. Joplin - The Entertainer": "ScottJoplin_The_Entertainer.xml",
             "ActorPreludeSample": "ActorPreludeSample.xml",
             "an chloe - mozart": "an chloe - mozart.xml",
-            "Beethoven - AnDieFerneGeliebte": "AnDieFerneGeliebte_Beethoven.xml",
             "das veilchen - mozart": "das veilchen - mozart.xml",
             "Dichterliebe01": "Dichterliebe01.xml",
             "mandoline - debussy": "mandoline - debussy.xml",
             "MozartTrio": "MozartTrio.mxl",
+            "Cornelius P. Christbaum Opus 8.1": "Cornelius_P_Christbaum_Opus_8_1_1865.mxl",
+            "France Levasseur - Parlez Mois": "Parlez-moi.mxl",
         },
 
         zoom = 1.0,
@@ -89,8 +93,8 @@
         };
 
         // Create OSMD object and canvas
-        OSMD = new opensheetmusicdisplay.OSMD(canvas, false);
-        OSMD.setLogLevel('info');
+        osmdObj = new OSMD(canvas, false);
+        osmdObj.setLogLevel('info');
         document.body.appendChild(canvas);
 
         // Set resize event handler
@@ -102,7 +106,7 @@
                 var width = document.body.clientWidth;
                 canvas.width = width;
                 try {
-                OSMD.render();
+                osmdObj.render();
                 } catch (e) {}
                 enable();
             }
@@ -111,28 +115,28 @@
         window.addEventListener("keydown", function(e) {
             var event = window.event ? window.event : e;
             if (event.keyCode === 39) {
-                OSMD.cursor.next();
+                osmdObj.cursor.next();
             }
         });
         nextCursorBtn.addEventListener("click", function() {
-            OSMD.cursor.next();
+            osmdObj.cursor.next();
         });
         resetCursorBtn.addEventListener("click", function() {
-            OSMD.cursor.reset();
+            osmdObj.cursor.reset();
         });
         hideCursorBtn.addEventListener("click", function() {
-            OSMD.cursor.hide();
+            osmdObj.cursor.hide();
         });
         showCursorBtn.addEventListener("click", function() {
-            OSMD.cursor.show();
+            osmdObj.cursor.show();
         });
 
         backendSelect.addEventListener("change", function(e) {
             var value = e.target.value;
             // clears the canvas element
             canvas.innerHTML = "";
-            OSMD = new opensheetmusicdisplay.OSMD(canvas, false, value);
-            OSMD.setLogLevel('info');
+            osmdObj = new OSMD(canvas, false, value);
+            osmdObj.setLogLevel('info');
             selectOnChange();
 
         });
@@ -174,9 +178,9 @@
             str = folder + select.value;
         }
         zoom = 1.0;
-        OSMD.load(str).then(
+        osmdObj.load(str).then(
             function() {
-                return OSMD.render();
+                return osmdObj.render();
             },
             function(e) {
                 error("Error reading sheet: " + e);
@@ -201,15 +205,15 @@
     }
 
     function logCanvasSize() {
-        size.innerHTML = canvas.offsetWidth;
-        zoomDiv.innerHTML = Math.floor(zoom * 100.0);
+        size.innerHTML = canvas.offsetWidth + "px";
+        zoomDiv.innerHTML = Math.floor(zoom * 100.0) + "%";
     }
 
     function scale() {
         disable();
         window.setTimeout(function(){
-            OSMD.zoom = zoom;
-            OSMD.render();
+            osmdObj.zoom = zoom;
+            osmdObj.render();
             enable();
         }, 0);
     }

+ 44 - 12
karma.conf.js

@@ -1,8 +1,7 @@
-// Karma configuration
-// Generated on Fri Feb 05 2016 12:36:08 GMT+0100 (CET)
-/*globals module*/
+var common = require('./webpack.common.js')
+
 module.exports = function (config) {
-    'use strict';
+    'use strict'
     config.set({
         // base path that will be used to resolve all patterns (eg. files, exclude)
         basePath: '',
@@ -15,13 +14,11 @@ module.exports = function (config) {
         exclude: [],
 
         files: [{
-            pattern: 'build/osmd-test.js'
-        }, {
             pattern: 'src/**/*.ts',
             included: false
         }, {
             pattern: 'test/**/*.ts',
-            included: false
+            included: true
         }, {
             pattern: 'test/data/*.xml',
             included: true
@@ -39,7 +36,34 @@ module.exports = function (config) {
         // available preprocessors: https://npmjs.org/browse/keyword/karma-preprocessor
         preprocessors: {
             'test/data/*.xml': ['xml2js'],
-            'test/data/*.mxl.base64': ['base64-to-js']
+            'test/data/*.mxl.base64': ['base64-to-js'],
+            // add webpack as preprocessor
+            'src/**/*.ts': ['webpack'],
+            'test/**/*.ts': ['webpack']
+        },
+
+        webpack: {
+            // karma watches the test entry points
+            // (you don't need to specify the entry option)
+            // webpack watches dependencies
+
+            // copy parts of webpack configuration to use minimal effort here
+            devtool: 'cheap-module-eval-source-map',
+            module: {
+                loaders: common.module.loaders
+            },
+            resolve: common.resolve
+        },
+        webpackMiddleware: {
+            // webpack-dev-middleware configuration
+            // i. e.
+            noInfo: true
+        },
+
+        // Required for Firefox and Chorme to work
+        // see https://github.com/webpack-contrib/karma-webpack/issues/188
+        mime: {
+            'text/x-typescript': ['ts', 'tsx']
         },
 
         // test results reporter to use
@@ -65,8 +89,16 @@ module.exports = function (config) {
         autoWatch: false,
 
         // start these browsers
-        // available browser launchers: https://npmjs.org/browse/keyword/karma-launcher
-        browsers: [], // Will be overruled by karma grunt task options
+        browsers: [process.env.CI ? 'ChromeHeadlessNoSandbox' : 'ChromeHeadless'],
+
+        // For security reasons, Google Chrome is unable to provide sandboxing
+        // when it is running in container-based environments (e.g. CI).
+        customLaunchers: {
+            ChromeHeadlessNoSandbox: {
+                base: 'ChromeHeadless',
+                flags: ['--no-sandbox']
+            }
+        },
 
         // Continuous Integration mode
         // if true, Karma captures browsers, runs the tests and exits
@@ -75,5 +107,5 @@ module.exports = function (config) {
         // Concurrency level
         // how many browser should be started simultaneous
         concurrency: Infinity
-    });
-};
+    })
+}

+ 35 - 32
package.json

@@ -5,15 +5,18 @@
   "main": "dist/src/OSMD/OSMD.js",
   "typings": "dist/src/OSMD/OSMD",
   "scripts": {
-    "docs": "typedoc --mode file --out build/docs --module commonjs --target ES5 --name opensheetmusicdisplay ./src",
-    "lint": "npm run jshint && npm run tslint",
-    "jshint": "jshint . --exclude node_modules,dist,build,bin,demo",
-    "test": "npm run lint && grunt test",
+    "docs": "typedoc --out ./build/docs --name OpenSheetMusicDisplay --module commonjs --target ES5 --mode file ./src/**/*.ts",
+    "eslint": "eslint .",
     "tslint": "tslint --project tsconfig.json \"src/**/*.ts\" \"test/**/*.ts\"",
-    "typedoc": "typedoc --out ./build/docs --name OpenSheetMusicDisplay --module commonjs --target ES5 --mode file ./src/**/*.ts",
-    "postinstall": "rimraf typings",
-    "prepublish": "grunt build:dist",
-    "start": "http-server build/demo"
+    "lint": "npm-run-all eslint tslint",
+    "test": "karma start --single-run --no-auto-watch",
+    "test:watch": "karma start --no-single-run --auto-watch --browsers Chrome",
+    "prepare": "npm run build",
+    "build": "npm-run-all lint build:webpack",
+    "build:doc": "cross-env STATIC_FILES_SUBFOLDER=sheets npm run build",
+    "build:webpack": "webpack --progress --colors --config webpack.prod.js",
+    "build:webpack-dev": "webpack --progress --colors --config webpack.dev.js",
+    "start": "webpack-dev-server --progress --colors --config webpack.dev.js"
   },
   "pre-commit": [
     "lint"
@@ -28,8 +31,7 @@
     "external",
     "demo",
     "tsconfig.json",
-    "tslint.json",
-    "Gruntfile.js"
+    "tslint.json"
   ],
   "repository": {
     "type": "git",
@@ -59,43 +61,44 @@
     "@types/chai": "^4.0.3",
     "@types/loglevel": "^1.4.29",
     "@types/mocha": "^2.2.40",
-    "browserify": "^14.0.0",
     "chai": "^4.1.0",
+    "clean-webpack-plugin": "^0.1.18",
+    "cross-env": "^5.1.3",
     "cz-conventional-changelog": "^2.0.0",
-    "grunt": "^1.0.1",
-    "grunt-browserify": "^5.0.0",
-    "grunt-contrib-clean": "^1.0.0",
-    "grunt-contrib-copy": "^1.0.0",
-    "grunt-contrib-uglify": "^3.0.0",
-    "grunt-contrib-watch": "^1.0.0",
-    "grunt-http-server": "",
-    "grunt-karma": "^2.0.0",
-    "grunt-ts": "^6.0.0-beta.3",
-    "grunt-webpack": "^3.0.0",
-    "grunt-webpack-server": "^0.1.0",
-    "http-server": "^0.10.0",
-    "jshint": "^2.9.4",
-    "karma": "^1.1.1",
+    "eslint": "^4.18.1",
+    "eslint-config-standard": "^11.0.0",
+    "eslint-plugin-import": "^2.9.0",
+    "eslint-plugin-node": "^6.0.1",
+    "eslint-plugin-promise": "^3.6.0",
+    "eslint-plugin-standard": "^3.0.1",
+    "file-loader": "^1.1.8",
+    "html-webpack-plugin": "^2.30.1",
+    "http-server": "^0.11.0",
+    "jquery": "^3.2.1",
+    "karma": "^2.0.0",
     "karma-base64-to-js-preprocessor": "^0.0.1",
     "karma-chai": "^0.1.0",
-    "karma-chrome-launcher": "^2.0.0",
+    "karma-chrome-launcher": "^2.2.0",
     "karma-firefox-launcher": "^1.0.0",
     "karma-mocha": "^1.1.1",
     "karma-mocha-reporter": "^2.0.4",
-    "karma-phantomjs-launcher": "^1.0.1",
+    "karma-webpack": "^2.0.9",
     "karma-xml2js-preprocessor": "^0.0.3",
-    "mocha": "^4.0.0",
-    "phantomjs-prebuilt": "^2.1.8",
+    "mocha": "^4.1.0",
+    "npm-run-all": "^4.1.2",
     "pre-commit": "^1.2.2",
-    "rimraf": "^2.6.1",
     "ts-loader": "^3.0.0",
     "tsify": "^3.0.0",
     "tslint": "^5.8.0",
-    "typedoc": "^0.9.0",
+    "tslint-loader": "^3.5.3",
+    "typedoc": "^0.10.0",
     "typescript": "^2.6.1",
     "uglifyjs-webpack-plugin": "^1.0.1",
+    "underscore-template-loader": "^0.8.0",
     "webpack": "^3.5.5",
-    "webpack-dev-server": "^2.9.1"
+    "webpack-dev-server": "2.7.1",
+    "webpack-merge": "^4.1.1",
+    "webpack-visualizer-plugin": "^0.1.11"
   },
   "config": {
     "commitizen": {

+ 9 - 9
src/Common/DataObjects/Fraction.ts

@@ -39,13 +39,13 @@ export class Fraction {
   }
 
   public static plus(f1: Fraction, f2: Fraction): Fraction {
-    let sum: Fraction = f1.clone();
+    const sum: Fraction = f1.clone();
     sum.Add(f2);
     return sum;
   }
 
   public static minus(f1: Fraction, f2: Fraction): Fraction {
-    let sum: Fraction = f1.clone();
+    const sum: Fraction = f1.clone();
     sum.Sub(f2);
     return sum;
   }
@@ -188,14 +188,14 @@ export class Fraction {
       return this;
     }
 
-    let upTestFraction: Fraction = new Fraction(this.numerator + 1, this.denominator, this.wholeValue);
+    const upTestFraction: Fraction = new Fraction(this.numerator + 1, this.denominator, this.wholeValue);
 
     while (upTestFraction.Denominator > maxAllowedDenominator) {
       upTestFraction.Numerator++;
     }
 
     if (this.numerator > this.denominator) {
-      let downTestFraction: Fraction = new Fraction(this.numerator - 1, this.denominator, this.wholeValue);
+      const downTestFraction: Fraction = new Fraction(this.numerator - 1, this.denominator, this.wholeValue);
 
       while (downTestFraction.Denominator > maxAllowedDenominator) {
         downTestFraction.Numerator--;
@@ -213,7 +213,7 @@ export class Fraction {
   }
 
   public CompareTo(obj: Fraction): number {
-    let diff: number = this.realValue - obj.realValue;
+    const diff: number = this.realValue - obj.realValue;
     // Return the sign of diff
     return diff ? diff < 0 ? -1 : 1 : 0;
   }
@@ -244,12 +244,12 @@ export class Fraction {
       return;
     }
 
-    let i: number = Fraction.greatestCommonDenominator(Math.abs(this.numerator), Math.abs(this.denominator));
+    const i: number = Fraction.greatestCommonDenominator(Math.abs(this.numerator), Math.abs(this.denominator));
 
     this.numerator /= i;
     this.denominator /= i;
 
-    let whole: number = Math.floor(this.numerator / this.denominator);
+    const whole: number = Math.floor(this.numerator / this.denominator);
     if (whole !== 0) {
       this.wholeValue += whole;
       this.numerator -= whole * this.denominator;
@@ -258,12 +258,12 @@ export class Fraction {
       }
     }
     if (this.denominator > Fraction.maximumAllowedNumber) {
-      let factor: number = <number>this.denominator / Fraction.maximumAllowedNumber;
+      const factor: number = <number>this.denominator / Fraction.maximumAllowedNumber;
       this.numerator = <number>Math.round(this.numerator / factor);
       this.denominator = <number>Math.round(this.denominator / factor);
     }
     if (this.numerator > Fraction.maximumAllowedNumber) {
-      let factor: number = <number>this.numerator / Fraction.maximumAllowedNumber;
+      const factor: number = <number>this.numerator / Fraction.maximumAllowedNumber;
       this.numerator = <number>Math.round(this.numerator / factor);
       this.denominator = <number>Math.round(this.denominator / factor);
     }

+ 13 - 13
src/Common/DataObjects/Pitch.ts

@@ -65,7 +65,7 @@ export class Pitch {
      * @constructor
      */
     public static CalculateTransposedHalfTone(pitch: Pitch, transpose: number): { value: number; overflow: number; } {
-        let newHalfTone: number = <number>pitch.fundamentalNote + <number>pitch.accidental + transpose;
+        const newHalfTone: number = <number>pitch.fundamentalNote + <number>pitch.accidental + transpose;
         return Pitch.WrapAroundCheck(newHalfTone, 12);
     }
 
@@ -92,12 +92,12 @@ export class Pitch {
         let halftoneSteps: number;
         if (obj instanceof Pitch) {
             // obj is a pitch
-            let pitch: Pitch = obj;
+            const pitch: Pitch = obj;
             octaveSteps = pitch.octave - 1;
             halftoneSteps = <number>pitch.fundamentalNote - <number>NoteEnum.A + <number>pitch.accidental;
         } else if (typeof obj === "number") {
             // obj is a fractional key
-            let fractionalKey: number = obj;
+            const fractionalKey: number = obj;
             halftoneSteps = fractionalKey - 57.0;
         }
         // Return frequency:
@@ -110,9 +110,9 @@ export class Pitch {
     }
 
     public static fromFrequency(frequency: number): Pitch {
-        let key: number = Pitch.calcFractionalKey(frequency) + 0.5;
-        let octave: number = Math.floor(key / 12) - Pitch.octXmlDiff;
-        let halftone: number = Math.floor(key) % 12;
+        const key: number = Pitch.calcFractionalKey(frequency) + 0.5;
+        const octave: number = Math.floor(key / 12) - Pitch.octXmlDiff;
+        const halftone: number = Math.floor(key) % 12;
         let fundamentalNote: NoteEnum = <NoteEnum>halftone;
         let accidental: AccidentalEnum = AccidentalEnum.NONE;
         if (this.pitchEnumValues.indexOf(fundamentalNote) === -1) {
@@ -123,8 +123,8 @@ export class Pitch {
     }
 
     public static fromHalftone(halftone: number): Pitch {
-        let octave: number = <number>Math.floor(<number>halftone / 12) - Pitch.octXmlDiff;
-        let halftoneInOctave: number = halftone % 12;
+        const octave: number = <number>Math.floor(<number>halftone / 12) - Pitch.octXmlDiff;
+        const halftoneInOctave: number = halftone % 12;
         let fundamentalNote: NoteEnum = <NoteEnum>halftoneInOctave;
         let accidental: AccidentalEnum = AccidentalEnum.NONE;
         if (this.pitchEnumValues.indexOf(fundamentalNote) === -1) {
@@ -223,7 +223,7 @@ export class Pitch {
     }
 
     public OperatorEquals(p2: Pitch): boolean {
-        let p1: Pitch = this;
+        const p1: Pitch = this;
         // if (ReferenceEquals(p1, p2)) {
         //     return true;
         // }
@@ -234,13 +234,13 @@ export class Pitch {
     }
 
     public OperatorNotEqual(p2: Pitch): boolean {
-        let p1: Pitch = this;
+        const p1: Pitch = this;
         return !(p1 === p2);
     }
 
     // This method returns a new Pitch factor-Halftones higher than the current Pitch
     private getHigherPitchByTransposeFactor(factor: number): Pitch {
-        let noteEnumIndex: number = Pitch.pitchEnumValues.indexOf(this.fundamentalNote);
+        const noteEnumIndex: number = Pitch.pitchEnumValues.indexOf(this.fundamentalNote);
         let newOctave: number = this.octave;
         let newNoteEnum: NoteEnum;
         if (noteEnumIndex + factor > Pitch.pitchEnumValues.length - 1) {
@@ -253,7 +253,7 @@ export class Pitch {
     }
 
     private getLowerPitchByTransposeFactor(factor: number): Pitch {
-        let noteEnumIndex: number = Pitch.pitchEnumValues.indexOf(this.fundamentalNote);
+        const noteEnumIndex: number = Pitch.pitchEnumValues.indexOf(this.fundamentalNote);
         let newOctave: number = this.octave;
         let newNoteEnum: NoteEnum;
         if (noteEnumIndex - factor < 0) {
@@ -272,7 +272,7 @@ export class Pitch {
     }
 
     private getPreviousFundamentalNote(fundamental: NoteEnum): NoteEnum {
-        let i: number = Pitch.pitchEnumValues.indexOf(fundamental);
+        const i: number = Pitch.pitchEnumValues.indexOf(fundamental);
         if (i > 0) {
             return Pitch.pitchEnumValues[i - 1];
         } else {

+ 11 - 11
src/Common/FileIO/Mxl.ts

@@ -13,7 +13,7 @@ export class MXLHelper {
      * @constructor
      */
     public static MXLtoIXmlElement(data: string): Promise<IXmlElement> {
-        let zip: JSZip.JSZip = new JSZip();
+        const zip: JSZip.JSZip = new JSZip();
         // asynchronously load zip file and process it - with Promises
         return zip.loadAsync(data).then(
             (_: any) => {
@@ -24,9 +24,9 @@ export class MXLHelper {
             }
         ).then(
             (content: string) => {
-                let parser: DOMParser = new DOMParser();
-                let doc: Document = parser.parseFromString(content, "text/xml");
-                let rootFile: string = doc.getElementsByTagName("rootfile")[0].getAttribute("full-path");
+                const parser: DOMParser = new DOMParser();
+                const doc: Document = parser.parseFromString(content, "text/xml");
+                const rootFile: string = doc.getElementsByTagName("rootfile")[0].getAttribute("full-path");
                 return zip.file(rootFile).async("string");
             },
             (err: any) => {
@@ -34,9 +34,9 @@ export class MXLHelper {
             }
         ).then(
             (content: string) => {
-                let parser: DOMParser = new DOMParser();
-                let xml: Document = parser.parseFromString(content, "text/xml");
-                let doc: IXmlElement = new IXmlElement(xml.documentElement);
+                const parser: DOMParser = new DOMParser();
+                const xml: Document = parser.parseFromString(content, "text/xml");
+                const doc: IXmlElement = new IXmlElement(xml.documentElement);
                 return Promise.resolve(doc);
             },
             (err: any) => {
@@ -53,7 +53,7 @@ export class MXLHelper {
     }
 
     public static MXLtoXMLstring(data: string): Promise<string> {
-        let zip:  JSZip.JSZip = new JSZip();
+        const zip:  JSZip.JSZip = new JSZip();
         // asynchronously load zip file and process it - with Promises
         return zip.loadAsync(data).then(
             (_: any) => {
@@ -64,9 +64,9 @@ export class MXLHelper {
             }
         ).then(
             (content: string) => {
-                let parser: DOMParser = new DOMParser();
-                let doc: Document = parser.parseFromString(content, "text/xml");
-                let rootFile: string = doc.getElementsByTagName("rootfile")[0].getAttribute("full-path");
+                const parser: DOMParser = new DOMParser();
+                const doc: Document = parser.parseFromString(content, "text/xml");
+                const rootFile: string = doc.getElementsByTagName("rootfile")[0].getAttribute("full-path");
                 return zip.file(rootFile).async("string");
             },
             (err: any) => {

+ 8 - 8
src/Common/FileIO/Xml.ts

@@ -56,8 +56,8 @@ export class IXmlElement {
      */
     public attributes(): IXmlAttribute[] {
         if (!this.attrs) {
-            let attributes: NamedNodeMap = this.elem.attributes;
-            let attrs: IXmlAttribute[] = [];
+            const attributes: NamedNodeMap = this.elem.attributes;
+            const attrs: IXmlAttribute[] = [];
             for (let i: number = 0; i < attributes.length; i += 1) {
                 attrs.push(attributes[i]);
             }
@@ -72,9 +72,9 @@ export class IXmlElement {
      * @returns {IXmlElement}
      */
     public element(elementName: string): IXmlElement {
-        let nodes: NodeList = this.elem.childNodes;
+        const nodes: NodeList = this.elem.childNodes;
         for (let i: number = 0, length: number = nodes.length; i < length; i += 1) {
-            let node: Node = nodes[i];
+            const node: Node = nodes[i];
             if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === elementName) {
                 return new IXmlElement(node as Element);
             }
@@ -87,14 +87,14 @@ export class IXmlElement {
      * @returns {IXmlElement[]}
      */
     public elements(nodeName?: string): IXmlElement[] {
-        let nodes: NodeList = this.elem.childNodes;
-        let ret: IXmlElement[] = [];
-        let nameUnset: boolean = nodeName === undefined;
+        const nodes: NodeList = this.elem.childNodes;
+        const ret: IXmlElement[] = [];
+        const nameUnset: boolean = nodeName === undefined;
         if (!nameUnset) {
             nodeName = nodeName.toLowerCase();
         }
         for (let i: number = 0; i < nodes.length; i += 1) {
-            let node: Node = nodes[i];
+            const node: Node = nodes[i];
             if (node.nodeType === Node.ELEMENT_NODE &&
                 (nameUnset || node.nodeName.toLowerCase() === nodeName)
             ) {

+ 4 - 4
src/MusicalScore/Graphical/AccidentalCalculator.ts

@@ -34,7 +34,7 @@ export class AccidentalCalculator {
      */
     public doCalculationsAtEndOfMeasure(): void {
         this.currentInMeasureNoteAlterationsDict.clear();
-        for (let key of this.keySignatureNoteAlterationsDict.keys()) {
+        for (const key of this.keySignatureNoteAlterationsDict.keys()) {
             this.currentInMeasureNoteAlterationsDict.setValue(key, this.keySignatureNoteAlterationsDict.getValue(key));
         }
     }
@@ -43,7 +43,7 @@ export class AccidentalCalculator {
         if (pitch === undefined) {
             return;
         }
-        let pitchKey: number = <number>pitch.FundamentalNote + pitch.Octave * 12;
+        const pitchKey: number = <number>pitch.FundamentalNote + pitch.Octave * 12;
         /*let pitchKeyGivenInMeasureDict: boolean = this.currentInMeasureNoteAlterationsDict.containsKey(pitchKey);
         if (
             (pitchKeyGivenInMeasureDict && this.currentInMeasureNoteAlterationsDict.getValue(pitchKey) !== pitch.Accidental)
@@ -64,7 +64,7 @@ export class AccidentalCalculator {
             this.symbolFactory.addGraphicalAccidental(graphicalNote, pitch, grace, graceScalingFactor);
         }*/
 
-        let isInCurrentAlterationsToKeyList: boolean = this.currentAlterationsComparedToKeyInstructionList.indexOf(pitchKey) >= 0;
+        const isInCurrentAlterationsToKeyList: boolean = this.currentAlterationsComparedToKeyInstructionList.indexOf(pitchKey) >= 0;
         if (this.currentInMeasureNoteAlterationsDict.containsKey(pitchKey)) {
             if (isInCurrentAlterationsToKeyList) {
                 this.currentAlterationsComparedToKeyInstructionList.splice(this.currentAlterationsComparedToKeyInstructionList.indexOf(pitchKey), 1);
@@ -96,7 +96,7 @@ export class AccidentalCalculator {
     }
 
     private reactOnKeyInstructionChange(): void {
-        let noteEnums: NoteEnum[] = KeyInstruction.getNoteEnumList(this.activeKeyInstruction);
+        const noteEnums: NoteEnum[] = KeyInstruction.getNoteEnumList(this.activeKeyInstruction);
         let keyAccidentalType: AccidentalEnum;
         if (this.activeKeyInstruction.Key > 0) {
             keyAccidentalType = AccidentalEnum.SHARP;

+ 48 - 31
src/MusicalScore/Graphical/BoundingBox.ts

@@ -5,6 +5,9 @@ import {RectangleF2D} from "../../Common/DataObjects/RectangleF2D";
 
 /**
  * A bounding box delimits an area on the 2D plane.
+ * @param dataObject Graphical object where the bounding box will be attached
+ * @param parent Parent bounding box of an object in a higher hierarchy position
+ * @param connectChildToParent Create a child to parent relationship too. Will be true by default
  */
 export class BoundingBox {
     protected isSymbol: boolean = false;
@@ -30,12 +33,20 @@ export class BoundingBox {
     protected childElements: BoundingBox[] = [];
     protected parent: BoundingBox;
     protected dataObject: Object;
-
+    /**
+     * Create a bounding box
+     * @param dataObject Graphical object where the bounding box will be attached
+     * @param parent Parent bounding box of an object in a higher hierarchy position
+     * @param connectChildToParent Create a child to parent relationship too. Will be true by default
+     */
     constructor(dataObject: Object = undefined, parent: BoundingBox = undefined) {
         this.parent = parent;
         this.dataObject = dataObject;
         this.xBordersHaveBeenSet = false;
         this.yBordersHaveBeenSet = false;
+        if (parent !== undefined) {
+            this.Parent = parent;
+        }
     }
 
     public get RelativePositionHasBeenSet(): boolean {
@@ -189,6 +200,12 @@ export class BoundingBox {
 
     public set Parent(value: BoundingBox) {
         this.parent = value;
+        if (this.parent.ChildElements.indexOf(this) > -1) {
+            console.error("BoundingBox of " + (this.dataObject.constructor as any).name +
+            " already in children list of " + (this.parent.dataObject.constructor as any).name + "'s BoundingBox");
+        } else {
+            this.parent.ChildElements.push(this);
+        }
     }
 
     public get DataObject(): Object {
@@ -225,7 +242,7 @@ export class BoundingBox {
         this.absolutePosition.x = 0.0;
         this.absolutePosition.y = 0.0;
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let child: BoundingBox = this.ChildElements[idx];
+            const child: BoundingBox = this.ChildElements[idx];
             child.calculateAbsolutePositionsRecursive(this.absolutePosition.x, this.absolutePosition.y);
         }
     }
@@ -240,7 +257,7 @@ export class BoundingBox {
         this.absolutePosition.x = this.relativePosition.x + x;
         this.absolutePosition.y = this.relativePosition.y + y;
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let child: BoundingBox = this.ChildElements[idx];
+            const child: BoundingBox = this.ChildElements[idx];
             child.calculateAbsolutePositionsRecursive(this.absolutePosition.x, this.absolutePosition.y);
         }
     }
@@ -250,7 +267,7 @@ export class BoundingBox {
      */
     public calculateAbsolutePositionsOfChildren(): void {
       for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-        let child: BoundingBox = this.ChildElements[idx];
+        const child: BoundingBox = this.ChildElements[idx];
         child.calculateAbsolutePositionsRecursive(this.absolutePosition.x, this.absolutePosition.y);
       }
     }
@@ -263,7 +280,7 @@ export class BoundingBox {
             return;
         }
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             childElement.calculateBoundingBox();
         }
 
@@ -291,7 +308,7 @@ export class BoundingBox {
 
         // ChildElements will have their borders calculated, so calculate current borders
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             minLeft = Math.min(minLeft, childElement.relativePosition.x + childElement.borderLeft);
             maxRight = Math.max(maxRight, childElement.relativePosition.x + childElement.borderRight);
             minTop = Math.min(minTop, childElement.relativePosition.y + childElement.borderTop);
@@ -322,7 +339,7 @@ export class BoundingBox {
             return;
         }
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             childElement.calculateTopBottomBorders();
         }
         let minTop: number = Number.MAX_VALUE;
@@ -336,7 +353,7 @@ export class BoundingBox {
             maxMarginBottom = this.borderMarginBottom;
         }
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             minTop = Math.min(minTop, childElement.relativePosition.y + childElement.borderTop);
             maxBottom = Math.max(maxBottom, childElement.relativePosition.y + childElement.borderBottom);
             minMarginTop = Math.min(minMarginTop, childElement.relativePosition.y + childElement.borderMarginTop);
@@ -388,9 +405,9 @@ export class BoundingBox {
      * @returns {boolean}
      */
     public collisionDetection(psi: BoundingBox): boolean {
-        let overlapWidth: number = Math.min(this.AbsolutePosition.x + this.borderRight, psi.absolutePosition.x + psi.borderRight)
+        const overlapWidth: number = Math.min(this.AbsolutePosition.x + this.borderRight, psi.absolutePosition.x + psi.borderRight)
             - Math.max(this.AbsolutePosition.x + this.borderLeft, psi.absolutePosition.x + psi.borderLeft);
-        let overlapHeight: number = Math.min(this.AbsolutePosition.y + this.borderBottom, psi.absolutePosition.y + psi.borderBottom)
+        const overlapHeight: number = Math.min(this.AbsolutePosition.y + this.borderBottom, psi.absolutePosition.y + psi.borderBottom)
             - Math.max(this.AbsolutePosition.y + this.borderTop, psi.absolutePosition.y + psi.borderTop);
         if (overlapWidth > 0 && overlapHeight > 0) {
             return true;
@@ -404,14 +421,14 @@ export class BoundingBox {
      * @returns {boolean}
      */
     public liesInsideBorders(psi: BoundingBox): boolean {
-        let leftBorderInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= (psi.absolutePosition.x + psi.borderLeft)
+        const leftBorderInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= (psi.absolutePosition.x + psi.borderLeft)
             && (psi.absolutePosition.x + psi.borderLeft) <= (this.AbsolutePosition.x + this.borderRight);
-        let rightBorderInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= (psi.absolutePosition.x + psi.borderRight)
+        const rightBorderInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= (psi.absolutePosition.x + psi.borderRight)
             && (psi.absolutePosition.x + psi.borderRight) <= (this.AbsolutePosition.x + this.borderRight);
         if (leftBorderInside && rightBorderInside) {
-            let topBorderInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= (psi.absolutePosition.y + psi.borderTop)
+            const topBorderInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= (psi.absolutePosition.y + psi.borderTop)
                 && (psi.absolutePosition.y + psi.borderTop) <= (this.AbsolutePosition.y + this.borderBottom);
-            let bottomBorderInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= (psi.absolutePosition.y + psi.borderBottom)
+            const bottomBorderInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= (psi.absolutePosition.y + psi.borderBottom)
                 && (psi.absolutePosition.y + psi.borderBottom) <= (this.AbsolutePosition.y + this.borderBottom);
             if (topBorderInside && bottomBorderInside) {
                 return true;
@@ -421,9 +438,9 @@ export class BoundingBox {
     }
 
     public pointLiesInsideBorders(position: PointF2D): boolean {
-        let xInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= position.x && position.x <= (this.AbsolutePosition.x + this.borderRight);
+        const xInside: boolean = (this.AbsolutePosition.x + this.borderLeft) <= position.x && position.x <= (this.AbsolutePosition.x + this.borderRight);
         if (xInside) {
-            let yInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= position.y && position.y <= (this.AbsolutePosition.y + this.borderBottom);
+            const yInside: boolean = (this.AbsolutePosition.y + this.borderTop) <= position.y && position.y <= (this.AbsolutePosition.y + this.borderBottom);
             if (yInside) {
                 return true;
             }
@@ -437,9 +454,9 @@ export class BoundingBox {
      * @returns {boolean}
      */
     public marginCollisionDetection(psi: BoundingBox): boolean {
-        let overlapWidth: number = Math.min(this.AbsolutePosition.x + this.borderMarginRight, psi.absolutePosition.x + psi.borderMarginRight)
+        const overlapWidth: number = Math.min(this.AbsolutePosition.x + this.borderMarginRight, psi.absolutePosition.x + psi.borderMarginRight)
             - Math.max(this.AbsolutePosition.x + this.borderMarginLeft, psi.absolutePosition.x + psi.borderMarginLeft);
-        let overlapHeight: number = Math.min(this.AbsolutePosition.y + this.borderMarginBottom, psi.absolutePosition.y + psi.borderMarginBottom)
+        const overlapHeight: number = Math.min(this.AbsolutePosition.y + this.borderMarginBottom, psi.absolutePosition.y + psi.borderMarginBottom)
             - Math.max(this.AbsolutePosition.y + this.borderMarginTop, psi.absolutePosition.y + psi.borderMarginTop);
         if (overlapWidth > 0 && overlapHeight > 0) {
             return true;
@@ -453,14 +470,14 @@ export class BoundingBox {
      * @returns {boolean}
      */
     public liesInsideMargins(psi: BoundingBox): boolean {
-        let leftMarginInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= (psi.absolutePosition.x + psi.borderMarginLeft)
+        const leftMarginInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= (psi.absolutePosition.x + psi.borderMarginLeft)
             && (psi.absolutePosition.x + psi.borderMarginLeft) <= (this.AbsolutePosition.x + this.borderMarginRight);
-        let rightMarginInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= (psi.absolutePosition.x + psi.borderMarginRight)
+        const rightMarginInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= (psi.absolutePosition.x + psi.borderMarginRight)
             && (psi.absolutePosition.x + psi.borderMarginRight) <= (this.AbsolutePosition.x + this.borderMarginRight);
         if (leftMarginInside && rightMarginInside) {
-            let topMarginInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= (psi.absolutePosition.y + psi.borderMarginTop)
+            const topMarginInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= (psi.absolutePosition.y + psi.borderMarginTop)
                 && (psi.absolutePosition.y + psi.borderMarginTop) <= (this.AbsolutePosition.y + this.borderMarginBottom);
-            let bottomMarginInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= (psi.absolutePosition.y + psi.borderMarginBottom)
+            const bottomMarginInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= (psi.absolutePosition.y + psi.borderMarginBottom)
                 && (psi.absolutePosition.y + psi.borderMarginBottom) <= (this.AbsolutePosition.y + this.borderMarginBottom);
             if (topMarginInside && bottomMarginInside) {
                 return true;
@@ -470,10 +487,10 @@ export class BoundingBox {
     }
 
     public pointLiesInsideMargins(position: PointF2D): boolean {
-        let xInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= position.x
+        const xInside: boolean = (this.AbsolutePosition.x + this.borderMarginLeft) <= position.x
             && position.x <= (this.AbsolutePosition.x + this.borderMarginRight);
         if (xInside) {
-            let yInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= position.y
+            const yInside: boolean = (this.AbsolutePosition.y + this.borderMarginTop) <= position.y
                 && position.y <= (this.AbsolutePosition.y + this.borderMarginBottom);
             if (yInside) {
                 return true;
@@ -514,13 +531,13 @@ export class BoundingBox {
     }
 
     public getClickedObjectOfType<T>(clickPosition: PointF2D): T {
-        let obj: Object = this.dataObject;
+        const obj: Object = this.dataObject;
         if (this.pointLiesInsideBorders(clickPosition) && (<T>obj !== undefined)) {
             return (obj as T);
         }
         for (let idx: number = 0, len: number = this.childElements.length; idx < len; ++idx) {
-            let psi: BoundingBox = this.childElements[idx];
-            let innerObject: Object = psi.getClickedObjectOfType<T>(clickPosition);
+            const psi: BoundingBox = this.childElements[idx];
+            const innerObject: Object = psi.getClickedObjectOfType<T>(clickPosition);
             if (innerObject !== undefined) {
                 return (innerObject as T);
             }
@@ -541,8 +558,8 @@ export class BoundingBox {
             }
             // FIXME Andrea: add here "return []"?
         }
-        let result: T[] = [];
-        for (let child of this.childElements) {
+        const result: T[] = [];
+        for (const child of this.childElements) {
             result.concat(child.getObjectsInRegion<T>(region, liesInside));
         }
         return result;
@@ -607,7 +624,7 @@ export class BoundingBox {
 
         // perform check for all children iteratively and return border from children symbols
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             childElement.calculateMarginPositionAlongDirection(toBePlaced, direction);
         }
     }
@@ -658,7 +675,7 @@ export class BoundingBox {
 
         // perform check for all children iteratively and return border from children symbols
         for (let idx: number = 0, len: number = this.ChildElements.length; idx < len; ++idx) {
-            let childElement: BoundingBox = this.ChildElements[idx];
+            const childElement: BoundingBox = this.ChildElements[idx];
             childElement.calculatePositionAlongDirection(toBePlaced, direction);
         }
     }

+ 39 - 1
src/MusicalScore/Graphical/DrawingEnums.ts

@@ -1,3 +1,5 @@
+import * as Collections from "typescript-collections";
+
 /**
  * The supported styles to draw a rectangle on the music sheet
  */
@@ -37,13 +39,49 @@ export enum OutlineAndFillStyleEnum {
     Comment10
 }
 
+// tslint:disable-next-line:max-line-length A linebreak would be more confusing here
+export const OUTLINE_AND_FILL_STYLE_DICT: Collections.Dictionary<OutlineAndFillStyleEnum, string> = new Collections.Dictionary<OutlineAndFillStyleEnum, string>();
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.BaseWritingColor, "Thistle");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.FollowingCursor, "Aqua");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.AlternativeFollowingCursor, "Azure");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.PlaybackCursor, "Bisque");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Highlighted, "CadetBlue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.ErrorUnderlay, "DarkBlue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Selected, "DarkGoldenRod");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.SelectionSymbol, "BlanchedAlmond");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.DebugColor1, "Chartreuse");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.DebugColor2, "DarkGreen");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.DebugColor3, "DarkOrange");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.SplitScreenDivision, "FireBrick");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.GreyTransparentOverlay, "DarkSalmon");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea1, "DarkSeaGreen");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea2, "DarkOrchid");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea3, "Aquamarine");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea4, "DarkKhaki");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea5, "ForestGreen");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea6, "AliceBlue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea7, "DeepPink");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea8, "Coral");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea9, "DarkOliveGreen");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.MarkedArea10, "Chocolate");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment1, "DodgerBlue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment2, "Blue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment3, "Beige");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment4, "Crimson");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment5, "Fuchsia");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment6, "Brown");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment7, "BlanchedAlmond");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment8, "CornflowerBlue");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment9, "Cornsilk");
+OUTLINE_AND_FILL_STYLE_DICT.setValue(OutlineAndFillStyleEnum.Comment10, "DarkGrey");
+
 export enum StyleSets {
     MarkedArea,
     Comment
 }
 
 /**
- * The layers which one can draw on (not suppoerted)
+ * The layers which one can draw on (not supported)
  */
 export enum GraphicalLayers {
     Background,

+ 1 - 1
src/MusicalScore/Graphical/EngravingRules.ts

@@ -1165,7 +1165,7 @@ export class EngravingRules {
         this.factorOne = new Array(this.bezierCurveStepSize);
         this.factorTwo = new Array(this.bezierCurveStepSize);
         for (let i: number = 0; i < this.bezierCurveStepSize; i++) {
-            let t: number = i / this.bezierCurveStepSize;
+            const t: number = i / this.bezierCurveStepSize;
             this.tPower3[i] = Math.pow(t, 3);
             this.oneMinusTPower3[i] = Math.pow((1 - t), 3);
             this.factorOne[i] = 3 * Math.pow((1 - t), 2) * t;

+ 1 - 2
src/MusicalScore/Graphical/GraphicalChordSymbolContainer.ts

@@ -22,9 +22,8 @@ export class GraphicalChordSymbolContainer extends GraphicalObject {
         return this.graphicalLabel;
     }
     private calculateLabel(textHeight: number, transposeHalftones: number): void {
-        let text: string = ChordSymbolContainer.calculateChordText(this.chordSymbolContainer, transposeHalftones);
+        const text: string = ChordSymbolContainer.calculateChordText(this.chordSymbolContainer, transposeHalftones);
         this.graphicalLabel = new GraphicalLabel(new Label(text), textHeight, TextAlignment.CenterBottom, this.boundingBox);
         this.graphicalLabel.PositionAndShape.RelativePosition = new PointF2D(0.0, 0.0);
-        this.boundingBox.ChildElements.push(this.graphicalLabel.PositionAndShape);
     }
 }

+ 5 - 5
src/MusicalScore/Graphical/GraphicalLabel.ts

@@ -33,13 +33,13 @@ export class GraphicalLabel extends Clickable {
         if (this.Label.text.trim() === "") {
             return;
         }
-        let labelMarginBorderFactor: number = EngravingRules.Rules.LabelMarginBorderFactor;
+        const labelMarginBorderFactor: number = EngravingRules.Rules.LabelMarginBorderFactor;
 
-        let widthToHeightRatio: number =
+        const widthToHeightRatio: number =
             MusicSheetCalculator.TextMeasurer.computeTextWidthToHeightRatio(this.Label.text, this.Label.font, this.Label.fontStyle);
-        let height: number = this.Label.fontHeight;
-        let width: number = height * widthToHeightRatio;
-        let psi: BoundingBox = this.PositionAndShape;
+        const height: number = this.Label.fontHeight;
+        const width: number = height * widthToHeightRatio;
+        const psi: BoundingBox = this.PositionAndShape;
 
         switch (this.Label.textAlignment) {
             case TextAlignment.CenterBottom:

+ 97 - 97
src/MusicalScore/Graphical/GraphicalMusicSheet.ts

@@ -167,8 +167,8 @@ export class GraphicalMusicSheet {
      */
     public static transformRelativeToAbsolutePosition(graphicalMusicSheet: GraphicalMusicSheet): void {
         for (let i: number = 0; i < graphicalMusicSheet.MusicPages.length; i++) {
-            let pageAbsolute: PointF2D = graphicalMusicSheet.MusicPages[i].setMusicPageAbsolutePosition(i, graphicalMusicSheet.ParentMusicSheet.rules);
-            let page: GraphicalMusicPage = graphicalMusicSheet.MusicPages[i];
+            const pageAbsolute: PointF2D = graphicalMusicSheet.MusicPages[i].setMusicPageAbsolutePosition(i, graphicalMusicSheet.ParentMusicSheet.rules);
+            const page: GraphicalMusicPage = graphicalMusicSheet.MusicPages[i];
             page.PositionAndShape.calculateAbsolutePositionsRecursive(pageAbsolute.x, pageAbsolute.y);
         }
     }
@@ -189,9 +189,9 @@ export class GraphicalMusicSheet {
 
     public EnforceRedrawOfMusicSystems(): void {
         for (let idx: number = 0, len: number = this.musicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.musicPages[idx];
+            const graphicalMusicPage: GraphicalMusicPage = this.musicPages[idx];
             for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
-                let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
+                const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
                 musicSystem.needsToBeRedrawn = true;
             }
         }
@@ -199,7 +199,7 @@ export class GraphicalMusicSheet {
 
     public getClickedObject<T>(positionOnMusicSheet: PointF2D): T {
         for (let idx: number = 0, len: number = this.MusicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
+            const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
             return graphicalMusicPage.PositionAndShape.getClickedObjectOfType<T>(positionOnMusicSheet);
         }
         return undefined;
@@ -215,9 +215,9 @@ export class GraphicalMusicSheet {
      */
     public findGraphicalStaffEntryFromMeasureList(staffIndex: number, measureIndex: number, sourceStaffEntry: SourceStaffEntry): GraphicalStaffEntry {
         for (let i: number = measureIndex; i < this.measureList.length; i++) {
-            let graphicalMeasure: StaffMeasure = this.measureList[i][staffIndex];
+            const graphicalMeasure: StaffMeasure = this.measureList[i][staffIndex];
             for (let idx: number = 0, len: number = graphicalMeasure.staffEntries.length; idx < len; ++idx) {
-                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx];
+                const graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx];
                 if (graphicalStaffEntry.sourceStaffEntry === sourceStaffEntry) {
                     return graphicalStaffEntry;
                 }
@@ -234,12 +234,12 @@ export class GraphicalMusicSheet {
      * @returns {any}
      */
     public findNextGraphicalStaffEntry(staffIndex: number, measureIndex: number, graphicalStaffEntry: GraphicalStaffEntry): GraphicalStaffEntry {
-        let graphicalMeasure: StaffMeasure = graphicalStaffEntry.parentMeasure;
-        let graphicalStaffEntryIndex: number = graphicalMeasure.staffEntries.indexOf(graphicalStaffEntry);
+        const graphicalMeasure: StaffMeasure = graphicalStaffEntry.parentMeasure;
+        const graphicalStaffEntryIndex: number = graphicalMeasure.staffEntries.indexOf(graphicalStaffEntry);
         if (graphicalStaffEntryIndex < graphicalMeasure.staffEntries.length - 1) {
             return graphicalMeasure.staffEntries[graphicalStaffEntryIndex + 1];
         } else if (measureIndex < this.measureList.length - 1) {
-            let nextMeasure: StaffMeasure = this.measureList[measureIndex + 1][staffIndex];
+            const nextMeasure: StaffMeasure = this.measureList[measureIndex + 1][staffIndex];
             if (nextMeasure.staffEntries.length > 0) {
                 return nextMeasure.staffEntries[0];
             }
@@ -248,8 +248,8 @@ export class GraphicalMusicSheet {
     }
 
     public getFirstVisibleMeasuresListFromIndeces(start: number, end: number): StaffMeasure[] {
-        let graphicalMeasures: StaffMeasure[] = [];
-        let numberOfStaves: number = this.measureList[0].length;
+        const graphicalMeasures: StaffMeasure[] = [];
+        const numberOfStaves: number = this.measureList[0].length;
         for (let i: number = start; i <= end; i++) {
             for (let j: number = 0; j < numberOfStaves; j++) {
                 if (this.measureList[i][j].isVisible()) {
@@ -262,7 +262,7 @@ export class GraphicalMusicSheet {
     }
 
     public orderMeasuresByStaffLine(measures: StaffMeasure[]): StaffMeasure[][] {
-        let orderedMeasures: StaffMeasure[][] = [];
+        const orderedMeasures: StaffMeasure[][] = [];
         let mList: StaffMeasure[] = [];
         orderedMeasures.push(mList);
         for (let i: number = 0; i < measures.length; i++) {
@@ -289,14 +289,14 @@ export class GraphicalMusicSheet {
      * @returns {ClefInstruction[]}
      */
     public initializeActiveClefs(): ClefInstruction[] {
-        let activeClefs: ClefInstruction[] = [];
-        let firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
+        const activeClefs: ClefInstruction[] = [];
+        const firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
         if (firstSourceMeasure !== undefined) {
             for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; i++) {
                 let clef: ClefInstruction = new ClefInstruction();
                 if (firstSourceMeasure.FirstInstructionsStaffEntries[i] !== undefined) {
                     for (let idx: number = 0, len: number = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions.length; idx < len; ++idx) {
-                        let abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
+                        const abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
                         if (abstractNotationInstruction instanceof ClefInstruction) {
                             clef = <ClefInstruction>abstractNotationInstruction;
 
@@ -310,11 +310,11 @@ export class GraphicalMusicSheet {
     }
 
     public GetMainKey(): KeyInstruction {
-        let firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
+        const firstSourceMeasure: SourceMeasure = this.musicSheet.getFirstSourceMeasure();
         if (firstSourceMeasure !== undefined) {
             for (let i: number = 0; i < firstSourceMeasure.CompleteNumberOfStaves; i++) {
                 for (let idx: number = 0, len: number = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions.length; idx < len; ++idx) {
-                    let abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
+                    const abstractNotationInstruction: AbstractNotationInstruction = firstSourceMeasure.FirstInstructionsStaffEntries[i].Instructions[idx];
                     if (abstractNotationInstruction instanceof KeyInstruction) {
                         return <KeyInstruction>abstractNotationInstruction;
                     }
@@ -332,14 +332,14 @@ export class GraphicalMusicSheet {
     public getOrCreateVerticalContainer(timestamp: Fraction): VerticalGraphicalStaffEntryContainer {
         if (this.verticalGraphicalStaffEntryContainers.length === 0 ||
             (CollectionUtil.getLastElement(this.verticalGraphicalStaffEntryContainers).AbsoluteTimestamp).lt(timestamp)) {
-            let verticalGraphicalStaffEntryContainer: VerticalGraphicalStaffEntryContainer =
+            const verticalGraphicalStaffEntryContainer: VerticalGraphicalStaffEntryContainer =
                 new VerticalGraphicalStaffEntryContainer(this.numberOfStaves, timestamp);
             this.verticalGraphicalStaffEntryContainers.push(verticalGraphicalStaffEntryContainer);
             return verticalGraphicalStaffEntryContainer;
         }
         for (let i: number = this.verticalGraphicalStaffEntryContainers.length - 1; i >= 0; i--) {
             if (this.verticalGraphicalStaffEntryContainers[i].AbsoluteTimestamp.lt(timestamp)) {
-                let verticalGraphicalStaffEntryContainer: VerticalGraphicalStaffEntryContainer =
+                const verticalGraphicalStaffEntryContainer: VerticalGraphicalStaffEntryContainer =
                     new VerticalGraphicalStaffEntryContainer(this.numberOfStaves, timestamp);
                 this.verticalGraphicalStaffEntryContainers.splice(i + 1, 0, verticalGraphicalStaffEntryContainer);
                 return verticalGraphicalStaffEntryContainer;
@@ -361,10 +361,10 @@ export class GraphicalMusicSheet {
      * @constructor
      */
     public GetVerticalContainerFromTimestamp(timestamp: Fraction, startIndex: number = 0): VerticalGraphicalStaffEntryContainer {
-        let index: number = CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,
-                                                        new VerticalGraphicalStaffEntryContainer(0, timestamp),
-                                                        VerticalGraphicalStaffEntryContainer.compareByTimestamp,
-                                                        startIndex);
+        const index: number = CollectionUtil.binarySearch(this.verticalGraphicalStaffEntryContainers,
+                                                          new VerticalGraphicalStaffEntryContainer(0, timestamp),
+                                                          VerticalGraphicalStaffEntryContainer.compareByTimestamp,
+                                                          startIndex);
         if (index >= 0) {
             return this.verticalGraphicalStaffEntryContainers[index];
         }
@@ -378,7 +378,7 @@ export class GraphicalMusicSheet {
      * @constructor
      */
     public GetInterpolatedIndexInVerticalContainers(musicTimestamp: Fraction): number {
-        let containers: VerticalGraphicalStaffEntryContainer[] = this.verticalGraphicalStaffEntryContainers;
+        const containers: VerticalGraphicalStaffEntryContainer[] = this.verticalGraphicalStaffEntryContainers;
         let leftIndex: number = 0;
         let rightIndex: number = containers.length - 1;
         let foundIndex: number;
@@ -386,7 +386,7 @@ export class GraphicalMusicSheet {
         let rightTS: Fraction = undefined;
         if (musicTimestamp.lte(containers[containers.length - 1].AbsoluteTimestamp)) {
             while (rightIndex - leftIndex > 1) {
-                let middleIndex: number = Math.floor((rightIndex + leftIndex) / 2);
+                const middleIndex: number = Math.floor((rightIndex + leftIndex) / 2);
                 if (containers[leftIndex].AbsoluteTimestamp.Equals(musicTimestamp)) {
                     rightIndex = leftIndex;
                     break;
@@ -413,8 +413,8 @@ export class GraphicalMusicSheet {
             rightTS = Fraction.plus(this.getLongestStaffEntryDuration(containers.length - 1), leftTS);
             rightIndex = containers.length;
         }
-        let diff: number = rightTS.RealValue - leftTS.RealValue;
-        let diffTS: number = rightTS.RealValue - musicTimestamp.RealValue;
+        const diff: number = rightTS.RealValue - leftTS.RealValue;
+        const diffTS: number = rightTS.RealValue - musicTimestamp.RealValue;
 
         // estimate the interpolated index
         foundIndex = rightIndex - (diffTS / diff);
@@ -428,18 +428,18 @@ export class GraphicalMusicSheet {
      * @returns {number[]}
      */
     public getVisibleStavesIndecesFromSourceMeasure(visibleMeasures: StaffMeasure[]): number[] {
-        let visibleInstruments: Instrument[] = [];
-        let visibleStavesIndeces: number[] = [];
+        const visibleInstruments: Instrument[] = [];
+        const visibleStavesIndeces: number[] = [];
         for (let idx: number = 0, len: number = visibleMeasures.length; idx < len; ++idx) {
-            let graphicalMeasure: StaffMeasure = visibleMeasures[idx];
-            let instrument: Instrument = graphicalMeasure.ParentStaff.ParentInstrument;
+            const graphicalMeasure: StaffMeasure = visibleMeasures[idx];
+            const instrument: Instrument = graphicalMeasure.ParentStaff.ParentInstrument;
             if (visibleInstruments.indexOf(instrument) === -1) {
                 visibleInstruments.push(instrument);
             }
         }
         for (let idx: number = 0, len: number = visibleInstruments.length; idx < len; ++idx) {
-            let instrument: Instrument = visibleInstruments[idx];
-            let index: number = this.musicSheet.getGlobalStaffIndexOfFirstStaff(instrument);
+            const instrument: Instrument = visibleInstruments[idx];
+            const index: number = this.musicSheet.getGlobalStaffIndexOfFirstStaff(instrument);
             for (let j: number = 0; j < instrument.Staves.length; j++) {
                 visibleStavesIndeces.push(index + j);
             }
@@ -467,7 +467,7 @@ export class GraphicalMusicSheet {
         inListIndex = 0;
         for (; measureIndex < this.measureList.length; measureIndex++) {
             for (let idx: number = 0, len: number = this.measureList[measureIndex].length; idx < len; ++idx) {
-                let measure: StaffMeasure = this.measureList[measureIndex][idx];
+                const measure: StaffMeasure = this.measureList[measureIndex][idx];
                 if (measure === graphicalMeasure) {
                     return true;
                 }
@@ -477,11 +477,11 @@ export class GraphicalMusicSheet {
     }
 
     public GetNearesNote(clickPosition: PointF2D, maxClickDist: PointF2D): GraphicalNote {
-        let initialSearchArea: number = 10;
-        let foundNotes: GraphicalNote[] = [];
+        const initialSearchArea: number = 10;
+        const foundNotes: GraphicalNote[] = [];
 
         // Prepare search area
-        let region: BoundingBox = new BoundingBox();
+        const region: BoundingBox = new BoundingBox();
         region.BorderLeft = clickPosition.x - initialSearchArea;
         region.BorderTop = clickPosition.y - initialSearchArea;
         region.BorderRight = clickPosition.x + initialSearchArea;
@@ -490,14 +490,14 @@ export class GraphicalMusicSheet {
 
         // Search for StaffEntries in region
         for (let idx: number = 0, len: number = this.MusicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
-            let entries: GraphicalNote[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalNote>(region);
+            const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
+            const entries: GraphicalNote[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalNote>(region);
             //let entriesArr: GraphicalNote[] = __as__<GraphicalNote[]>(entries, GraphicalNote[]) ? ? entries;
             if (entries === undefined) {
                 continue;
             } else {
                 for (let idx2: number = 0, len2: number = entries.length; idx2 < len2; ++idx2) {
-                    let note: GraphicalNote = entries[idx2];
+                    const note: GraphicalNote = entries[idx2];
                     if (Math.abs(note.PositionAndShape.AbsolutePosition.x - clickPosition.x) < maxClickDist.x
                         && Math.abs(note.PositionAndShape.AbsolutePosition.y - clickPosition.y) < maxClickDist.y) {
                         foundNotes.push(note);
@@ -509,15 +509,15 @@ export class GraphicalMusicSheet {
         // Get closest entry
         let closest: GraphicalNote = undefined;
         for (let idx: number = 0, len: number = foundNotes.length; idx < len; ++idx) {
-            let note: GraphicalNote = foundNotes[idx];
+            const note: GraphicalNote = foundNotes[idx];
             if (closest === undefined) {
                 closest = note;
             } else {
                 if (note.parentStaffEntry.relInMeasureTimestamp === undefined) {
                     continue;
                 }
-                let deltaNew: number = this.CalculateDistance(note.PositionAndShape.AbsolutePosition, clickPosition);
-                let deltaOld: number = this.CalculateDistance(closest.PositionAndShape.AbsolutePosition, clickPosition);
+                const deltaNew: number = this.CalculateDistance(note.PositionAndShape.AbsolutePosition, clickPosition);
+                const deltaOld: number = this.CalculateDistance(closest.PositionAndShape.AbsolutePosition, clickPosition);
                 if (deltaNew < deltaOld) {
                     closest = note;
                 }
@@ -532,23 +532,23 @@ export class GraphicalMusicSheet {
     }
 
     public GetClickableLabel(clickPosition: PointF2D): GraphicalLabel {
-        let initialSearchAreaX: number = 4;
-        let initialSearchAreaY: number = 4;
+        const initialSearchAreaX: number = 4;
+        const initialSearchAreaY: number = 4;
         // Prepare search area
-        let region: BoundingBox = new BoundingBox();
+        const region: BoundingBox = new BoundingBox();
         region.BorderLeft = clickPosition.x - initialSearchAreaX;
         region.BorderTop = clickPosition.y - initialSearchAreaY;
         region.BorderRight = clickPosition.x + initialSearchAreaX;
         region.BorderBottom = clickPosition.y + initialSearchAreaY;
         region.AbsolutePosition = new PointF2D(0, 0);
         for (let idx: number = 0, len: number = this.MusicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
-            let entries: GraphicalLabel[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalLabel>(region);
+            const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
+            const entries: GraphicalLabel[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalLabel>(region);
             if (entries.length !== 1) {
                 continue;
             } else {
                 for (let idx2: number = 0, len2: number = entries.length; idx2 < len2; ++idx2) {
-                    let clickedLabel: GraphicalLabel = entries[idx2];
+                    const clickedLabel: GraphicalLabel = entries[idx2];
                     return clickedLabel;
                 }
             }
@@ -557,10 +557,10 @@ export class GraphicalMusicSheet {
     }
 
     public GetNearestStaffEntry(clickPosition: PointF2D): GraphicalStaffEntry {
-        let initialSearchArea: number = 10;
-        let foundEntries: GraphicalStaffEntry[] = [];
+        const initialSearchArea: number = 10;
+        const foundEntries: GraphicalStaffEntry[] = [];
         // Prepare search area
-        let region: BoundingBox = new BoundingBox(undefined);
+        const region: BoundingBox = new BoundingBox(undefined);
         region.BorderLeft = clickPosition.x - initialSearchArea;
         region.BorderTop = clickPosition.y - initialSearchArea;
         region.BorderRight = clickPosition.x + initialSearchArea;
@@ -568,13 +568,13 @@ export class GraphicalMusicSheet {
         region.AbsolutePosition = new PointF2D(0, 0);
         // Search for StaffEntries in region
         for (let idx: number = 0, len: number = this.MusicPages.length; idx < len; ++idx) {
-            let graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
-            let entries: GraphicalStaffEntry[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalStaffEntry>(region, false);
+            const graphicalMusicPage: GraphicalMusicPage = this.MusicPages[idx];
+            const entries: GraphicalStaffEntry[] = graphicalMusicPage.PositionAndShape.getObjectsInRegion<GraphicalStaffEntry>(region, false);
             if (entries === undefined || entries.length === 0) {
                 continue;
             } else {
                 for (let idx2: number = 0, len2: number = entries.length; idx2 < len2; ++idx2) {
-                    let gse: GraphicalStaffEntry = entries[idx2];
+                    const gse: GraphicalStaffEntry = entries[idx2];
                     foundEntries.push(gse);
                 }
             }
@@ -582,15 +582,15 @@ export class GraphicalMusicSheet {
         // Get closest entry
         let closest: GraphicalStaffEntry = undefined;
         for (let idx: number = 0, len: number = foundEntries.length; idx < len; ++idx) {
-            let gse: GraphicalStaffEntry = foundEntries[idx];
+            const gse: GraphicalStaffEntry = foundEntries[idx];
             if (closest === undefined) {
                 closest = gse;
             } else {
                 if (gse.relInMeasureTimestamp === undefined) {
                     continue;
                 }
-                let deltaNew: number = this.CalculateDistance(gse.PositionAndShape.AbsolutePosition, clickPosition);
-                let deltaOld: number = this.CalculateDistance(closest.PositionAndShape.AbsolutePosition, clickPosition);
+                const deltaNew: number = this.CalculateDistance(gse.PositionAndShape.AbsolutePosition, clickPosition);
+                const deltaOld: number = this.CalculateDistance(closest.PositionAndShape.AbsolutePosition, clickPosition);
                 if (deltaNew < deltaOld) {
                     closest = gse;
                 }
@@ -605,7 +605,7 @@ export class GraphicalMusicSheet {
     }
 
     public GetPossibleCommentAnchor(clickPosition: PointF2D): SourceStaffEntry {
-        let entry: GraphicalStaffEntry = this.GetNearestStaffEntry(clickPosition);
+        const entry: GraphicalStaffEntry = this.GetNearestStaffEntry(clickPosition);
         if (entry === undefined) {
             return undefined;
         }
@@ -614,8 +614,8 @@ export class GraphicalMusicSheet {
 
     public getClickedObjectOfType<T>(positionOnMusicSheet: PointF2D): T {
         for (let idx: number = 0, len: number = this.musicPages.length; idx < len; ++idx) {
-            let page: GraphicalMusicPage = this.musicPages[idx];
-            let o: Object = page.PositionAndShape.getClickedObjectOfType<T>(positionOnMusicSheet);
+            const page: GraphicalMusicPage = this.musicPages[idx];
+            const o: Object = page.PositionAndShape.getClickedObjectOfType<T>(positionOnMusicSheet);
             if (o !== undefined) {
                 return (o as T);
             }
@@ -624,7 +624,7 @@ export class GraphicalMusicSheet {
     }
 
     public tryGetTimestampFromPosition(positionOnMusicSheet: PointF2D): Fraction {
-        let entry: GraphicalStaffEntry = this.getClickedObjectOfType<GraphicalStaffEntry>(positionOnMusicSheet);
+        const entry: GraphicalStaffEntry = this.getClickedObjectOfType<GraphicalStaffEntry>(positionOnMusicSheet);
         if (entry === undefined) {
             return undefined;
         }
@@ -643,7 +643,7 @@ export class GraphicalMusicSheet {
 
     public tryGetTimeStampFromPosition(positionOnMusicSheet: PointF2D): Fraction {
         try {
-            let entry: GraphicalStaffEntry = this.GetNearestStaffEntry(positionOnMusicSheet);
+            const entry: GraphicalStaffEntry = this.GetNearestStaffEntry(positionOnMusicSheet);
             if (entry === undefined) {
                 return undefined;
             }
@@ -664,11 +664,11 @@ export class GraphicalMusicSheet {
      * @returns {GraphicalStaffEntry}
      */
     public getStaffEntry(index: number): GraphicalStaffEntry {
-        let container: VerticalGraphicalStaffEntryContainer = this.VerticalGraphicalStaffEntryContainers[index];
+        const container: VerticalGraphicalStaffEntryContainer = this.VerticalGraphicalStaffEntryContainers[index];
         let staffEntry: GraphicalStaffEntry = undefined;
         try {
             for (let idx: number = 0, len: number = container.StaffEntries.length; idx < len; ++idx) {
-                let entry: GraphicalStaffEntry = container.StaffEntries[idx];
+                const entry: GraphicalStaffEntry = container.StaffEntries[idx];
                 if (entry === undefined || !entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     continue;
                 }
@@ -695,9 +695,9 @@ export class GraphicalMusicSheet {
      */
     public GetPreviousVisibleContainerIndex(index: number): number {
         for (let i: number = index - 1; i >= 0; i--) {
-            let entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
+            const entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
-                let entry: GraphicalStaffEntry = entries[idx];
+                const entry: GraphicalStaffEntry = entries[idx];
                 if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
@@ -714,9 +714,9 @@ export class GraphicalMusicSheet {
      */
     public GetNextVisibleContainerIndex(index: number): number {
         for (let i: number = index + 1; i < this.verticalGraphicalStaffEntryContainers.length; ++i) {
-            let entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
+            const entries: GraphicalStaffEntry[] = this.verticalGraphicalStaffEntryContainers[i].StaffEntries;
             for (let idx: number = 0, len: number = entries.length; idx < len; ++idx) {
-                let entry: GraphicalStaffEntry = entries[idx];
+                const entry: GraphicalStaffEntry = entries[idx];
                 if (entry !== undefined && entry.sourceStaffEntry.ParentStaff.ParentInstrument.Visible) {
                     return i;
                 }
@@ -746,7 +746,7 @@ export class GraphicalMusicSheet {
 
     public findClosestRightStaffEntry(fractionalIndex: number, returnOnlyVisibleEntries: boolean): GraphicalStaffEntry {
         let foundEntry: GraphicalStaffEntry = undefined;
-        let rightIndex: number = <number>Math.max(0, Math.ceil(fractionalIndex));
+        const rightIndex: number = <number>Math.max(0, Math.ceil(fractionalIndex));
         for (let i: number = rightIndex; i < this.VerticalGraphicalStaffEntryContainers.length; i++) {
             foundEntry = this.getStaffEntry(i);
             if (foundEntry !== undefined) {
@@ -763,23 +763,23 @@ export class GraphicalMusicSheet {
     }
 
     public calculateCursorLineAtTimestamp(musicTimestamp: Fraction, styleEnum: OutlineAndFillStyleEnum): GraphicalLine {
-        let result: [number, MusicSystem] = this.calculateXPositionFromTimestamp(musicTimestamp);
-        let xPos: number = result[0];
-        let correspondingMusicSystem: MusicSystem = result[1];
+        const result: [number, MusicSystem] = this.calculateXPositionFromTimestamp(musicTimestamp);
+        const xPos: number = result[0];
+        const correspondingMusicSystem: MusicSystem = result[1];
         if (correspondingMusicSystem === undefined || correspondingMusicSystem.StaffLines.length === 0) {
             return undefined;
         }
-        let yCoordinate: number = correspondingMusicSystem.PositionAndShape.AbsolutePosition.y;
-        let height: number = CollectionUtil.last(correspondingMusicSystem.StaffLines).PositionAndShape.RelativePosition.y + 4;
+        const yCoordinate: number = correspondingMusicSystem.PositionAndShape.AbsolutePosition.y;
+        const height: number = CollectionUtil.last(correspondingMusicSystem.StaffLines).PositionAndShape.RelativePosition.y + 4;
         return new GraphicalLine(new PointF2D(xPos, yCoordinate), new PointF2D(xPos, yCoordinate + height), 3, styleEnum);
     }
 
     public calculateXPositionFromTimestamp(timeStamp: Fraction): [number, MusicSystem] {
         let currentMusicSystem: MusicSystem = undefined;
-        let fractionalIndex: number = this.GetInterpolatedIndexInVerticalContainers(timeStamp);
-        let previousStaffEntry: GraphicalStaffEntry = this.findClosestLeftStaffEntry(fractionalIndex, true);
-        let nextStaffEntry: GraphicalStaffEntry = this.findClosestRightStaffEntry(fractionalIndex, true);
-        let currentTimeStamp: number = timeStamp.RealValue;
+        const fractionalIndex: number = this.GetInterpolatedIndexInVerticalContainers(timeStamp);
+        const previousStaffEntry: GraphicalStaffEntry = this.findClosestLeftStaffEntry(fractionalIndex, true);
+        const nextStaffEntry: GraphicalStaffEntry = this.findClosestRightStaffEntry(fractionalIndex, true);
+        const currentTimeStamp: number = timeStamp.RealValue;
         if (previousStaffEntry === undefined && nextStaffEntry === undefined) {
             return [0, undefined];
         }
@@ -806,7 +806,7 @@ export class GraphicalMusicSheet {
             } else if (nextStaffEntry === undefined) {
                 previousStaffEntryPositionX = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
                 nextStaffEntryPositionX = currentMusicSystem.GetRightBorderAbsoluteXPosition();
-                let sm: SourceMeasure = previousStaffEntry.parentMeasure.parentSourceMeasure;
+                const sm: SourceMeasure = previousStaffEntry.parentMeasure.parentSourceMeasure;
                 fraction = (currentTimeStamp - previousStaffEntry.getAbsoluteTimestamp().RealValue) / (
                     Fraction.plus(sm.AbsoluteTimestamp, sm.Duration).RealValue - previousStaffEntry.getAbsoluteTimestamp().RealValue);
             } else {
@@ -820,24 +820,24 @@ export class GraphicalMusicSheet {
                 }
             }
             fraction = Math.min(1, Math.max(0, fraction));
-            let interpolatedXPosition: number = previousStaffEntryPositionX + fraction * (nextStaffEntryPositionX - previousStaffEntryPositionX);
+            const interpolatedXPosition: number = previousStaffEntryPositionX + fraction * (nextStaffEntryPositionX - previousStaffEntryPositionX);
             return [interpolatedXPosition, currentMusicSystem];
         } else {
-            let nextSystemLeftBorderTimeStamp: number = nextStaffEntry.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue;
+            const nextSystemLeftBorderTimeStamp: number = nextStaffEntry.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.RealValue;
             let fraction: number;
             let interpolatedXPosition: number;
             if (currentTimeStamp < nextSystemLeftBorderTimeStamp) {
                 currentMusicSystem = previousStaffEntryMusicSystem;
-                let previousStaffEntryPositionX: number = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
-                let previousSystemRightBorderX: number = currentMusicSystem.GetRightBorderAbsoluteXPosition();
+                const previousStaffEntryPositionX: number = previousStaffEntry.PositionAndShape.AbsolutePosition.x;
+                const previousSystemRightBorderX: number = currentMusicSystem.GetRightBorderAbsoluteXPosition();
                 fraction = (currentTimeStamp - previousStaffEntry.getAbsoluteTimestamp().RealValue) /
                     (nextSystemLeftBorderTimeStamp - previousStaffEntry.getAbsoluteTimestamp().RealValue);
                 fraction = Math.min(1, Math.max(0, fraction));
                 interpolatedXPosition = previousStaffEntryPositionX + fraction * (previousSystemRightBorderX - previousStaffEntryPositionX);
             } else {
                 currentMusicSystem = nextStaffEntryMusicSystem;
-                let nextStaffEntryPositionX: number = nextStaffEntry.PositionAndShape.AbsolutePosition.x;
-                let nextSystemLeftBorderX: number = currentMusicSystem.GetLeftBorderAbsoluteXPosition();
+                const nextStaffEntryPositionX: number = nextStaffEntry.PositionAndShape.AbsolutePosition.x;
+                const nextSystemLeftBorderX: number = currentMusicSystem.GetLeftBorderAbsoluteXPosition();
                 fraction = (currentTimeStamp - nextSystemLeftBorderTimeStamp) /
                     (nextStaffEntry.getAbsoluteTimestamp().RealValue - nextSystemLeftBorderTimeStamp);
                 fraction = Math.min(1, Math.max(0, fraction));
@@ -850,7 +850,7 @@ export class GraphicalMusicSheet {
     public GetNumberOfVisibleInstruments(): number {
         let visibleInstrumentCount: number = 0;
         for (let idx: number = 0, len: number = this.musicSheet.Instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.musicSheet.Instruments[idx];
+            const instrument: Instrument = this.musicSheet.Instruments[idx];
             if (instrument.Visible === true) {
                 visibleInstrumentCount++;
             }
@@ -861,7 +861,7 @@ export class GraphicalMusicSheet {
     public GetNumberOfFollowedInstruments(): number {
         let followedInstrumentCount: number = 0;
         for (let idx: number = 0, len: number = this.musicSheet.Instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.musicSheet.Instruments[idx];
+            const instrument: Instrument = this.musicSheet.Instruments[idx];
             if (instrument.Following === true) {
                 followedInstrumentCount++;
             }
@@ -874,16 +874,16 @@ export class GraphicalMusicSheet {
     }
 
     public GetGraphicalFromSourceStaffEntry(sourceStaffEntry: SourceStaffEntry): GraphicalStaffEntry {
-        let graphicalMeasure: StaffMeasure = this.GetGraphicalFromSourceMeasure(sourceStaffEntry.VerticalContainerParent.ParentMeasure)
+        const graphicalMeasure: StaffMeasure = this.GetGraphicalFromSourceMeasure(sourceStaffEntry.VerticalContainerParent.ParentMeasure)
             [sourceStaffEntry.ParentStaff.idInMusicSheet];
         return graphicalMeasure.findGraphicalStaffEntryFromTimestamp(sourceStaffEntry.Timestamp);
     }
 
     public GetGraphicalNoteFromSourceNote(note: Note, containingGse: GraphicalStaffEntry): GraphicalNote {
         for (let idx: number = 0, len: number = containingGse.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = containingGse.notes[idx];
+            const graphicalNotes: GraphicalNote[] = containingGse.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
                 if (graphicalNote.sourceNote === note) {
                     return graphicalNote;
                 }
@@ -893,8 +893,8 @@ export class GraphicalMusicSheet {
     }
 
     private CalculateDistance(pt1: PointF2D, pt2: PointF2D): number {
-        let deltaX: number = pt1.x - pt2.x;
-        let deltaY: number = pt1.y - pt2.y;
+        const deltaX: number = pt1.x - pt2.x;
+        const deltaY: number = pt1.y - pt2.y;
         return (deltaX * deltaX) + (deltaY * deltaY);
     }
 
@@ -906,14 +906,14 @@ export class GraphicalMusicSheet {
     private getLongestStaffEntryDuration(index: number): Fraction {
         let maxLength: Fraction = new Fraction(0, 1);
         for (let idx: number = 0, len: number = this.verticalGraphicalStaffEntryContainers[index].StaffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.verticalGraphicalStaffEntryContainers[index].StaffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.verticalGraphicalStaffEntryContainers[index].StaffEntries[idx];
             if (graphicalStaffEntry === undefined) {
                 continue;
             }
             for (let idx2: number = 0, len2: number = graphicalStaffEntry.notes.length; idx2 < len2; ++idx2) {
-                let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx2];
+                const graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx2];
                 for (let idx3: number = 0, len3: number = graphicalNotes.length; idx3 < len3; ++idx3) {
-                    let note: GraphicalNote = graphicalNotes[idx3];
+                    const note: GraphicalNote = graphicalNotes[idx3];
                     if (maxLength.lt(note.graphicalNoteLength)) {
                         maxLength = note.graphicalNoteLength;
                     }

+ 2 - 2
src/MusicalScore/Graphical/GraphicalNote.ts

@@ -38,7 +38,7 @@ export class GraphicalNote extends GraphicalObject {
 
     public get ParentList(): GraphicalNote[] {
         for (let idx: number = 0, len: number = this.parentStaffEntry.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.parentStaffEntry.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.parentStaffEntry.notes[idx];
             if (graphicalNotes.indexOf(this) !== -1) {
                 return graphicalNotes;
             }
@@ -62,7 +62,7 @@ export class GraphicalNote extends GraphicalObject {
     private calculateNumberOfNeededDots(fraction: Fraction): number {
       let num: number = 1;
       let product: number = 2;
-      let expandedNumerator: number = fraction.GetExpandedNumerator();
+      const expandedNumerator: number = fraction.GetExpandedNumerator();
       if (this.sourceNote === undefined || this.sourceNote.NoteTuplet === undefined) {
         while (product < expandedNumerator) {
           num++;

+ 28 - 28
src/MusicalScore/Graphical/GraphicalStaffEntry.ts

@@ -74,7 +74,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      * @returns {Fraction}
      */
     public getAbsoluteTimestamp(): Fraction {
-        let result: Fraction = this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();
+        const result: Fraction = this.parentMeasure.parentSourceMeasure.AbsoluteTimestamp.clone();
         if (this.relInMeasureTimestamp !== undefined) {
             result.Add(this.relInMeasureTimestamp);
         }
@@ -88,10 +88,10 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public findEndTieGraphicalNoteFromNote(tieNote: Note): GraphicalNote {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.sourceNote;
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const note: Note = graphicalNote.sourceNote;
                 if (note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote
                     && note.Pitch.Octave === tieNote.Pitch.Octave && note.getAbsoluteTimestamp().Equals(tieNote.getAbsoluteTimestamp())) {
                     return graphicalNote;
@@ -109,10 +109,10 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public findEndTieGraphicalNoteFromNoteWithStartingSlur(tieNote: Note, slur: Slur): GraphicalNote {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.sourceNote;
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const note: Note = graphicalNote.sourceNote;
                 if (note.NoteTie !== undefined && note.NoteSlurs.indexOf(slur) !== -1) {
                     return graphicalNote;
                 }
@@ -128,10 +128,10 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public findEndTieGraphicalNoteFromNoteWithEndingSlur(tieNote: Note): GraphicalNote {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let note: Note = graphicalNote.sourceNote;
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const note: Note = graphicalNote.sourceNote;
                 if (
                     note.Pitch !== undefined && note.Pitch.FundamentalNote === tieNote.Pitch.FundamentalNote
                     && note.Pitch.Octave === tieNote.Pitch.Octave && this.getAbsoluteTimestamp().Equals(tieNote.getAbsoluteTimestamp())
@@ -145,9 +145,9 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
 
     public findGraphicalNoteFromGraceNote(graceNote: Note): GraphicalNote {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
                 if (graphicalNote.sourceNote === graceNote) {
                     return graphicalNote;
                 }
@@ -158,9 +158,9 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
 
     public findGraphicalNoteFromNote(baseNote: Note): GraphicalNote {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
                 if (graphicalNote.sourceNote === baseNote && this.getAbsoluteTimestamp().Equals(baseNote.getAbsoluteTimestamp())) {
                     return graphicalNote;
                 }
@@ -171,7 +171,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
 
     public getGraphicalNoteDurationFromVoice(voice: Voice): Fraction {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             if (graphicalNotes[0].sourceNote.ParentVoiceEntry.ParentVoice === voice) {
                 return graphicalNotes[0].graphicalNoteLength;
             }
@@ -186,9 +186,9 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     public findLinkedNotes(notLinkedNotes: GraphicalNote[]): void {
         if (this.sourceStaffEntry !== undefined && this.sourceStaffEntry.Link !== undefined) {
             for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-                let graphicalNotes: GraphicalNote[] = this.notes[idx];
+                const graphicalNotes: GraphicalNote[] = this.notes[idx];
                 for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                    let graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                    const graphicalNote: GraphicalNote = graphicalNotes[idx2];
                     if (graphicalNote.parentStaffEntry === this) {
                         notLinkedNotes.push(graphicalNote);
                     }
@@ -204,9 +204,9 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public findVoiceEntryGraphicalNotes(voiceEntry: VoiceEntry): GraphicalNote[] {
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
                 if (graphicalNote.sourceNote.ParentVoiceEntry === voiceEntry) {
                     return graphicalNotes;
                 }
@@ -223,7 +223,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     public isVoiceEntryPartOfLinkedVoiceEntry(voiceEntry: VoiceEntry): boolean {
         if (this.sourceStaffEntry.Link !== undefined) {
             for (let idx: number = 0, len: number = this.sourceStaffEntry.Link.LinkStaffEntries.length; idx < len; ++idx) {
-                let sEntry: SourceStaffEntry = this.sourceStaffEntry.Link.LinkStaffEntries[idx];
+                const sEntry: SourceStaffEntry = this.sourceStaffEntry.Link.LinkStaffEntries[idx];
                 if (sEntry.VoiceEntries.indexOf(voiceEntry) !== -1 && sEntry !== this.sourceStaffEntry) {
                     return true;
                 }
@@ -234,7 +234,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
 
     public getMainVoice(): Voice {
         for (let idx: number = 0, len: number = this.sourceStaffEntry.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.sourceStaffEntry.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.sourceStaffEntry.VoiceEntries[idx];
             if (!(voiceEntry.ParentVoice instanceof LinkedVoice)) {
                 return voiceEntry.ParentVoice;
             }
@@ -249,10 +249,10 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     public findStaffEntryMinNoteLength(): Fraction {
         let minLength: Fraction = new Fraction(Number.MAX_VALUE, 1);
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
                 if (calNoteLen.lt(minLength) && calNoteLen.GetExpandedNumerator() > 0) {
                     minLength = calNoteLen;
                 }
@@ -264,10 +264,10 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
     public findStaffEntryMaxNoteLength(): Fraction {
         let maxLength: Fraction = new Fraction(0, 1);
         for (let idx: number = 0, len: number = this.notes.length; idx < len; ++idx) {
-            let graphicalNotes: GraphicalNote[] = this.notes[idx];
+            const graphicalNotes: GraphicalNote[] = this.notes[idx];
             for (let idx2: number = 0, len2: number = graphicalNotes.length; idx2 < len2; ++idx2) {
-                let graphicalNote: GraphicalNote = graphicalNotes[idx2];
-                let calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
+                const graphicalNote: GraphicalNote = graphicalNotes[idx2];
+                const calNoteLen: Fraction = graphicalNote.graphicalNoteLength;
                 if (maxLength.lt(calNoteLen)  && calNoteLen.GetExpandedNumerator() > 0) {
                     maxLength = calNoteLen;
                 }
@@ -305,7 +305,7 @@ export abstract class GraphicalStaffEntry extends GraphicalObject {
      */
     public findOrCreateGraphicalNotesListFromGraphicalNote(graphicalNote: GraphicalNote): GraphicalNote[] {
         let graphicalNotes: GraphicalNote[];
-        let tieStartSourceStaffEntry: SourceStaffEntry = graphicalNote.sourceNote.ParentStaffEntry;
+        const tieStartSourceStaffEntry: SourceStaffEntry = graphicalNote.sourceNote.ParentStaffEntry;
         if (this.sourceStaffEntry !== tieStartSourceStaffEntry) {
             graphicalNotes = this.findOrCreateGraphicalNotesListFromVoiceEntry(graphicalNote.sourceNote.ParentVoiceEntry);
         } else {

+ 4 - 4
src/MusicalScore/Graphical/GraphicalStaffEntryLink.ts

@@ -38,13 +38,13 @@ export class GraphicalStaffEntryLink {
      */
     public getLinkedStaffEntriesGraphicalNotes(graphicalStaffEntry: GraphicalStaffEntry): GraphicalNote[] {
         if (this.graphicalLinkedStaffEntries.indexOf(graphicalStaffEntry) !== -1) {
-            let notes: GraphicalNote[] = [];
+            const notes: GraphicalNote[] = [];
             for (let idx: number = 0, len: number = this.graphicalLinkedStaffEntries.length; idx < len; ++idx) {
-                let graphicalLinkedStaffEntry: GraphicalStaffEntry = this.graphicalLinkedStaffEntries[idx];
+                const graphicalLinkedStaffEntry: GraphicalStaffEntry = this.graphicalLinkedStaffEntries[idx];
                 for (let idx2: number = 0, len2: number = graphicalLinkedStaffEntry.notes.length; idx2 < len2; ++idx2) {
-                    let graphicalNotes: GraphicalNote[] = graphicalLinkedStaffEntry.notes[idx2];
+                    const graphicalNotes: GraphicalNote[] = graphicalLinkedStaffEntry.notes[idx2];
                     for (let idx3: number = 0, len3: number = graphicalNotes.length; idx3 < len3; ++idx3) {
-                        let graphicalNote: GraphicalNote = graphicalNotes[idx3];
+                        const graphicalNote: GraphicalNote = graphicalNotes[idx3];
                         if (graphicalNote.sourceNote.ParentStaffEntry.Link !== undefined
                             && graphicalNote.sourceNote.ParentVoiceEntry === this.staffEntryLink.GetVoiceEntry) {
                             notes.push(graphicalNote);

Разница между файлами не показана из-за своего большого размера
+ 200 - 206
src/MusicalScore/Graphical/MusicSheetCalculator.ts


+ 87 - 58
src/MusicalScore/Graphical/MusicSheetDrawer.ts

@@ -67,8 +67,8 @@ export abstract class MusicSheetDrawer {
         this.rules = graphicalMusicSheet.ParentMusicSheet.Rules;
         this.drawSplitScreenLine();
         if (this.drawingParameters.drawCursors) {
-            for (let line of graphicalMusicSheet.Cursors) {
-                let psi: BoundingBox = new BoundingBox(line);
+            for (const line of graphicalMusicSheet.Cursors) {
+                const psi: BoundingBox = new BoundingBox(line);
                 psi.AbsolutePosition = line.Start;
                 psi.BorderBottom = line.End.y - line.Start.y;
                 psi.BorderRight = line.Width / 2.0;
@@ -83,7 +83,7 @@ export abstract class MusicSheetDrawer {
             this.drawScrollIndicator();
         }
         // Draw all the pages
-        for (let page of this.graphicalMusicSheet.MusicPages) {
+        for (const page of this.graphicalMusicSheet.MusicPages) {
             this.drawPage(page);
         }
     }
@@ -95,33 +95,33 @@ export abstract class MusicSheetDrawer {
     }
 
     public drawLineAsVerticalRectangle(line: GraphicalLine, layer: number): void {
-        let lineStart: PointF2D = line.Start;
-        let lineWidth: number = line.Width;
+        const lineStart: PointF2D = line.Start;
+        const lineWidth: number = line.Width;
         let rectangle: RectangleF2D = new RectangleF2D(lineStart.x - lineWidth / 2, lineStart.y, lineWidth, line.End.y - lineStart.y);
         rectangle = this.applyScreenTransformationForRect(rectangle);
         this.renderRectangle(rectangle, layer, line.styleId);
     }
 
     public drawLineAsHorizontalRectangleWithOffset(line: GraphicalLine, offset: PointF2D, layer: number): void {
-        let start: PointF2D = new PointF2D(line.Start.x + offset.x, line.Start.y + offset.y);
-        let end: PointF2D = new PointF2D(line.End.x + offset.x, line.End.y + offset.y);
-        let width: number = line.Width;
+        const start: PointF2D = new PointF2D(line.Start.x + offset.x, line.Start.y + offset.y);
+        const end: PointF2D = new PointF2D(line.End.x + offset.x, line.End.y + offset.y);
+        const width: number = line.Width;
         let rectangle: RectangleF2D = new RectangleF2D(start.x, end.y - width / 2, end.x - start.x, width);
         rectangle = this.applyScreenTransformationForRect(rectangle);
         this.renderRectangle(rectangle, layer, line.styleId);
     }
 
     public drawLineAsVerticalRectangleWithOffset(line: GraphicalLine, offset: PointF2D, layer: number): void {
-        let start: PointF2D = new PointF2D(line.Start.x + offset.x, line.Start.y + offset.y);
-        let end: PointF2D = new PointF2D(line.End.x + offset.x, line.End.y + offset.y);
-        let width: number = line.Width;
+        const start: PointF2D = new PointF2D(line.Start.x + offset.x, line.Start.y + offset.y);
+        const end: PointF2D = new PointF2D(line.End.x + offset.x, line.End.y + offset.y);
+        const width: number = line.Width;
         let rectangle: RectangleF2D = new RectangleF2D(start.x, start.y, width, end.y - start.y);
         rectangle = this.applyScreenTransformationForRect(rectangle);
         this.renderRectangle(rectangle, layer, line.styleId);
     }
 
     public drawRectangle(rect: GraphicalRectangle, layer: number): void {
-        let psi: BoundingBox = rect.PositionAndShape;
+        const psi: BoundingBox = rect.PositionAndShape;
         let rectangle: RectangleF2D = new RectangleF2D(psi.AbsolutePosition.x, psi.AbsolutePosition.y, psi.BorderRight, psi.BorderBottom);
         rectangle = this.applyScreenTransformationForRect(rectangle);
         this.renderRectangle(rectangle, layer, <number>rect.style);
@@ -135,15 +135,15 @@ export abstract class MusicSheetDrawer {
         if (!this.isVisible(graphicalLabel.PositionAndShape)) {
             return;
         }
-        let label: Label = graphicalLabel.Label;
+        const label: Label = graphicalLabel.Label;
         if (label.text.trim() === "") {
             return;
         }
-        let screenPosition: PointF2D = this.applyScreenTransformation(graphicalLabel.PositionAndShape.AbsolutePosition);
-        let heightInPixel: number = this.calculatePixelDistance(label.fontHeight);
-        let widthInPixel: number = heightInPixel * this.textMeasurer.computeTextWidthToHeightRatio(label.text, label.font, label.fontStyle);
-        let bitmapWidth: number = <number>Math.ceil(widthInPixel);
-        let bitmapHeight: number = <number>Math.ceil(heightInPixel * 1.2);
+        const screenPosition: PointF2D = this.applyScreenTransformation(graphicalLabel.PositionAndShape.AbsolutePosition);
+        const heightInPixel: number = this.calculatePixelDistance(label.fontHeight);
+        const widthInPixel: number = heightInPixel * this.textMeasurer.computeTextWidthToHeightRatio(label.text, label.font, label.fontStyle);
+        const bitmapWidth: number = <number>Math.ceil(widthInPixel);
+        const bitmapHeight: number = <number>Math.ceil(heightInPixel * 1.2);
         switch (label.textAlignment) {
             case TextAlignment.LeftTop:
                 break;
@@ -186,8 +186,8 @@ export abstract class MusicSheetDrawer {
     }
 
     protected applyScreenTransformations(points: PointF2D[]): PointF2D[] {
-        let transformedPoints: PointF2D[] = [];
-        for (let point of points) {
+        const transformedPoints: PointF2D[] = [];
+        for (const point of points) {
             transformedPoints.push(this.applyScreenTransformation(point));
         }
         return transformedPoints;
@@ -201,7 +201,7 @@ export abstract class MusicSheetDrawer {
         // empty
     }
 
-    protected renderRectangle(rectangle: RectangleF2D, layer: number, styleId: number): void {
+    protected renderRectangle(rectangle: RectangleF2D, layer: number, styleId: number, alpha: number = 1): void {
         throw new Error("not implemented");
     }
 
@@ -239,7 +239,7 @@ export abstract class MusicSheetDrawer {
         // empty
     }
 
-    protected drawInstrumentBracket(bracket: GraphicalObject, system: MusicSystem): void {
+    protected drawInstrumentBrace(brace: GraphicalObject, system: MusicSystem): void {
         // empty
     }
 
@@ -252,21 +252,21 @@ export abstract class MusicSheetDrawer {
     }
 
     protected drawMusicSystem(system: MusicSystem): void {
-        let absBoundingRectWithMargin: RectangleF2D = this.getSystemAbsBoundingRect(system);
-        let systemBoundingBoxInPixels: RectangleF2D = this.getSytemBoundingBoxInPixels(absBoundingRectWithMargin);
+        const absBoundingRectWithMargin: RectangleF2D = this.getSystemAbsBoundingRect(system);
+        const systemBoundingBoxInPixels: RectangleF2D = this.getSytemBoundingBoxInPixels(absBoundingRectWithMargin);
         this.drawMusicSystemComponents(system, systemBoundingBoxInPixels, absBoundingRectWithMargin);
     }
 
     protected getSytemBoundingBoxInPixels(absBoundingRectWithMargin: RectangleF2D): RectangleF2D {
-        let systemBoundingBoxInPixels: RectangleF2D = this.applyScreenTransformationForRect(absBoundingRectWithMargin);
+        const systemBoundingBoxInPixels: RectangleF2D = this.applyScreenTransformationForRect(absBoundingRectWithMargin);
         systemBoundingBoxInPixels.x = Math.round(systemBoundingBoxInPixels.x);
         systemBoundingBoxInPixels.y = Math.round(systemBoundingBoxInPixels.y);
         return systemBoundingBoxInPixels;
     }
 
     protected getSystemAbsBoundingRect(system: MusicSystem): RectangleF2D {
-        let relBoundingRect: RectangleF2D = system.PositionAndShape.BoundingRectangle;
-        let absBoundingRectWithMargin: RectangleF2D = new RectangleF2D(
+        const relBoundingRect: RectangleF2D = system.PositionAndShape.BoundingRectangle;
+        const absBoundingRectWithMargin: RectangleF2D = new RectangleF2D(
             system.PositionAndShape.AbsolutePosition.x + system.PositionAndShape.BorderLeft - 1,
             system.PositionAndShape.AbsolutePosition.y + system.PositionAndShape.BorderTop - 1,
             (relBoundingRect.width + 6), (relBoundingRect.height + 2)
@@ -276,8 +276,8 @@ export abstract class MusicSheetDrawer {
 
     protected drawMusicSystemComponents(musicSystem: MusicSystem, systemBoundingBoxInPixels: RectangleF2D,
                                         absBoundingRectWithMargin: RectangleF2D): void {
-        let selectStartSymb: SelectionStartSymbol = this.graphicalMusicSheet.SelectionStartSymbol;
-        let selectEndSymb: SelectionEndSymbol = this.graphicalMusicSheet.SelectionEndSymbol;
+        const selectStartSymb: SelectionStartSymbol = this.graphicalMusicSheet.SelectionStartSymbol;
+        const selectEndSymb: SelectionEndSymbol = this.graphicalMusicSheet.SelectionEndSymbol;
         if (this.drawingParameters.drawSelectionStartSymbol) {
             if (selectStartSymb !== undefined && this.isVisible(selectStartSymb.PositionAndShape)) {
                 this.drawSelectionStartSymbol(selectStartSymb);
@@ -288,29 +288,29 @@ export abstract class MusicSheetDrawer {
                 this.drawSelectionEndSymbol(selectEndSymb);
             }
         }
-        for (let staffLine of musicSystem.StaffLines) {
+        for (const staffLine of musicSystem.StaffLines) {
             this.drawStaffLine(staffLine);
         }
-        for (let systemLine of musicSystem.SystemLines) {
+        for (const systemLine of musicSystem.SystemLines) {
             this.drawSystemLineObject(systemLine);
         }
         if (musicSystem === musicSystem.Parent.MusicSystems[0] && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0]) {
-            for (let label of musicSystem.Labels) {
+            for (const label of musicSystem.Labels) {
                 this.drawLabel(label, <number>GraphicalLayers.Notes);
             }
         }
-        for (let bracket of musicSystem.InstrumentBrackets) {
-            this.drawInstrumentBracket(bracket, musicSystem);
+        for (const bracket of musicSystem.InstrumentBrackets) {
+            this.drawInstrumentBrace(bracket, musicSystem);
         }
-        for (let bracket of musicSystem.GroupBrackets) {
+        for (const bracket of musicSystem.GroupBrackets) {
             this.drawGroupBracket(bracket, musicSystem);
         }
         if (!this.leadSheet) {
-            for (let measureNumberLabel of musicSystem.MeasureNumberLabels) {
+            for (const measureNumberLabel of musicSystem.MeasureNumberLabels) {
                 this.drawLabel(measureNumberLabel, <number>GraphicalLayers.Notes);
             }
         }
-        for (let staffLine of musicSystem.StaffLines) {
+        for (const staffLine of musicSystem.StaffLines) {
             this.drawStaffLineSymbols(staffLine);
         }
         if (this.drawingParameters.drawMarkedAreas) {
@@ -331,7 +331,7 @@ export abstract class MusicSheetDrawer {
     }
 
     protected drawStaffLine(staffLine: StaffLine): void {
-        for (let measure of staffLine.Measures) {
+        for (const measure of staffLine.Measures) {
             this.drawMeasure(measure);
         }
     }
@@ -342,17 +342,17 @@ export abstract class MusicSheetDrawer {
 
     protected drawOctaveShift(staffLine: StaffLine, graphicalOctaveShift: GraphicalOctaveShift): void {
         this.drawSymbol(graphicalOctaveShift.octaveSymbol, MusicSymbolDrawingStyle.Normal, graphicalOctaveShift.PositionAndShape.AbsolutePosition);
-        let absolutePos: PointF2D = staffLine.PositionAndShape.AbsolutePosition;
+        const absolutePos: PointF2D = staffLine.PositionAndShape.AbsolutePosition;
         if (graphicalOctaveShift.dashesStart.x < graphicalOctaveShift.dashesEnd.x) {
-            let horizontalLine: GraphicalLine = new GraphicalLine(graphicalOctaveShift.dashesStart, graphicalOctaveShift.dashesEnd,
-                                                                  this.rules.OctaveShiftLineWidth);
+            const horizontalLine: GraphicalLine = new GraphicalLine(graphicalOctaveShift.dashesStart, graphicalOctaveShift.dashesEnd,
+                                                                    this.rules.OctaveShiftLineWidth);
             this.drawLineAsHorizontalRectangleWithOffset(horizontalLine, absolutePos, <number>GraphicalLayers.Notes);
         }
         if (!graphicalOctaveShift.endsOnDifferentStaffLine || graphicalOctaveShift.isSecondPart) {
             let verticalLine: GraphicalLine;
-            let dashEnd: PointF2D = graphicalOctaveShift.dashesEnd;
-            let octShiftVertLineLength: number = this.rules.OctaveShiftVerticalLineLength;
-            let octShiftLineWidth: number = this.rules.OctaveShiftLineWidth;
+            const dashEnd: PointF2D = graphicalOctaveShift.dashesEnd;
+            const octShiftVertLineLength: number = this.rules.OctaveShiftVerticalLineLength;
+            const octShiftLineWidth: number = this.rules.OctaveShiftLineWidth;
             if (graphicalOctaveShift.octaveSymbol === MusicSymbol.VA8 || graphicalOctaveShift.octaveSymbol === MusicSymbol.MA15) {
                 verticalLine = new GraphicalLine(dashEnd, new PointF2D(dashEnd.x, dashEnd.y + octShiftVertLineLength), octShiftLineWidth);
             } else {
@@ -364,7 +364,7 @@ export abstract class MusicSheetDrawer {
 
     protected drawStaffLines(staffLine: StaffLine): void {
         if (staffLine.StaffLines !== undefined) {
-            let position: PointF2D = staffLine.PositionAndShape.AbsolutePosition;
+            const position: PointF2D = staffLine.PositionAndShape.AbsolutePosition;
             for (let i: number = 0; i < 5; i++) {
                 this.drawLineAsHorizontalRectangleWithOffset(staffLine.StaffLines[i], position, <number>GraphicalLayers.Notes);
             }
@@ -407,20 +407,49 @@ export abstract class MusicSheetDrawer {
         if (!this.isVisible(page.PositionAndShape)) {
             return;
         }
-        for (let system of page.MusicSystems) {
+
+        for (const system of page.MusicSystems) {
             if (this.isVisible(system.PositionAndShape)) {
                 this.drawMusicSystem(system);
             }
         }
         if (page === page.Parent.MusicPages[0]) {
-            for (let label of page.Labels) {
+            for (const label of page.Labels) {
                 this.drawLabel(label, <number>GraphicalLayers.Notes);
             }
         }
+        // Draw bounding boxes for debug purposes. This has to be at the end because only
+        // then all the calculations and recalculations are done
+        if (process.env.DRAW_BOUNDING_BOX_ELEMENT) {
+            this.drawBoundingBoxes(page.PositionAndShape, 0, process.env.DRAW_BOUNDING_BOX_ELEMENT);
+        }
+
+    }
+
+    /**
+     * Draw bounding boxes aroung GraphicalObjects
+     * @param startBox Bounding Box that is used as a staring point to recursively go through all child elements
+     * @param layer Layer to draw to
+     * @param type Type of element to show bounding boxes for as string.
+     */
+    private drawBoundingBoxes(startBox: BoundingBox, layer: number = 0, type: string = "all"): void {
+        const dataObjectString: string = (startBox.DataObject.constructor as any).name;
+        if (startBox.BoundingRectangle !== undefined && (dataObjectString === type || type === "all")) {
+            const relBoundingRect: RectangleF2D = startBox.BoundingRectangle;
+            let tmpRect: RectangleF2D = new RectangleF2D(startBox.AbsolutePosition.x + startBox.BorderLeft,
+                                                         startBox.AbsolutePosition.y + startBox.BorderTop ,
+                                                         (relBoundingRect.width + 0), (relBoundingRect.height + 0));
+            tmpRect = this.applyScreenTransformationForRect(tmpRect);
+            this.renderRectangle(tmpRect, <number>GraphicalLayers.Background, layer, 0.5);
+            this.renderLabel(new GraphicalLabel(new Label(dataObjectString), 1.2, TextAlignment.CenterCenter),
+                             layer, tmpRect.width, tmpRect.height, tmpRect.height, new PointF2D(tmpRect.x, tmpRect.y + 12));
+        }
+        layer++;
+        startBox.ChildElements.forEach(bb => this.drawBoundingBoxes(bb, layer, type));
     }
 
     private drawMarkedAreas(system: MusicSystem): void {
-        for (let markedArea of system.GraphicalMarkedAreas) {
+        for (const markedArea of system.GraphicalMarkedAreas) {
             if (markedArea !== undefined) {
                 if (markedArea.systemRectangle !== undefined) {
                     this.drawRectangle(markedArea.systemRectangle, <number>GraphicalLayers.Background);
@@ -439,7 +468,7 @@ export abstract class MusicSheetDrawer {
     }
 
     private drawComment(system: MusicSystem): void {
-        for (let comment of system.GraphicalComments) {
+        for (const comment of system.GraphicalComments) {
             if (comment !== undefined) {
                 if (comment.settings !== undefined) {
                     this.drawLabel(comment.settings, <number>GraphicalLayers.Comment);
@@ -452,10 +481,10 @@ export abstract class MusicSheetDrawer {
     }
 
     private drawStaffLineSymbols(staffLine: StaffLine): void {
-        let parentInst: Instrument = staffLine.ParentStaff.ParentInstrument;
-        let absX: number = staffLine.PositionAndShape.AbsolutePosition.x;
-        let absY: number = staffLine.PositionAndShape.AbsolutePosition.y + 2;
-        let borderRight: number = staffLine.PositionAndShape.BorderRight;
+        const parentInst: Instrument = staffLine.ParentStaff.ParentInstrument;
+        const absX: number = staffLine.PositionAndShape.AbsolutePosition.x;
+        const absY: number = staffLine.PositionAndShape.AbsolutePosition.y + 2;
+        const borderRight: number = staffLine.PositionAndShape.BorderRight;
         if (parentInst.highlight && this.drawingParameters.drawHighlights) {
             this.drawLineAsHorizontalRectangle(
                 new GraphicalLine(
@@ -488,14 +517,14 @@ export abstract class MusicSheetDrawer {
                 break;
         }
         if (drawSymbols) {
-            let p: PointF2D = new PointF2D(absX + borderRight + 2, absY);
+            const p: PointF2D = new PointF2D(absX + borderRight + 2, absY);
             this.drawSymbol(symbol, style, p);
         }
         if (this.drawingParameters.drawErrors) {
-            for (let measure of staffLine.Measures) {
-                let measurePSI: BoundingBox = measure.PositionAndShape;
-                let absXPSI: number = measurePSI.AbsolutePosition.x;
-                let absYPSI: number = measurePSI.AbsolutePosition.y + 2;
+            for (const measure of staffLine.Measures) {
+                const measurePSI: BoundingBox = measure.PositionAndShape;
+                const absXPSI: number = measurePSI.AbsolutePosition.x;
+                const absYPSI: number = measurePSI.AbsolutePosition.y + 2;
                 if (measure.hasError && this.graphicalMusicSheet.ParentMusicSheet.DrawErroneousMeasures) {
                     this.drawLineAsHorizontalRectangle(
                         new GraphicalLine(

+ 38 - 39
src/MusicalScore/Graphical/MusicSystem.ts

@@ -111,15 +111,14 @@ export abstract class MusicSystem extends GraphicalObject {
         if (this === this.parent.MusicSystems[0] && this.parent === this.parent.Parent.MusicPages[0]) {
             xPosition = this.maxLabelLength + systemLabelsRightMargin - lineWidth / 2;
         }
-        let top: StaffMeasure = this.staffLines[0].Measures[0];
+        const top: StaffMeasure = this.staffLines[0].Measures[0];
         let bottom: StaffMeasure = undefined;
         if (this.staffLines.length > 1) {
             bottom = this.staffLines[this.staffLines.length - 1].Measures[0];
         }
-        let leftSystemLine: SystemLine = this.createSystemLine(xPosition, lineWidth, SystemLinesEnum.SingleThin,
-                                                               SystemLinePosition.MeasureBegin, this, top, bottom);
+        const leftSystemLine: SystemLine = this.createSystemLine(xPosition, lineWidth, SystemLinesEnum.SingleThin,
+                                                                 SystemLinePosition.MeasureBegin, this, top, bottom);
         this.SystemLines.push(leftSystemLine);
-        this.boundingBox.ChildElements.push(leftSystemLine.PositionAndShape);
         leftSystemLine.PositionAndShape.RelativePosition = new PointF2D(xPosition, 0);
         leftSystemLine.PositionAndShape.BorderLeft = 0;
         leftSystemLine.PositionAndShape.BorderRight = lineWidth;
@@ -139,22 +138,22 @@ export abstract class MusicSystem extends GraphicalObject {
      */
     public createVerticalLineForMeasure(xPosition: number, lineWidth: number, lineType: SystemLinesEnum, linePosition: SystemLinePosition,
                                         measureIndex: number, measure: StaffMeasure): void {
-        let staffLine: StaffLine = measure.ParentStaffLine;
-        let staffLineRelative: PointF2D = new PointF2D(staffLine.PositionAndShape.RelativePosition.x,
-                                                       staffLine.PositionAndShape.RelativePosition.y);
-        let staves: Staff[] = staffLine.ParentStaff.ParentInstrument.Staves;
+        const staffLine: StaffLine = measure.ParentStaffLine;
+        const staffLineRelative: PointF2D = new PointF2D(staffLine.PositionAndShape.RelativePosition.x,
+                                                         staffLine.PositionAndShape.RelativePosition.y);
+        const staves: Staff[] = staffLine.ParentStaff.ParentInstrument.Staves;
         if (staffLine.ParentStaff === staves[0]) {
             let bottomMeasure: StaffMeasure = undefined;
             if (staves.length > 1) {
                 bottomMeasure = this.getBottomStaffLine(staffLine).Measures[measureIndex];
             }
-            let singleVerticalLineAfterMeasure: SystemLine = this.createSystemLine(xPosition, lineWidth, lineType, linePosition, this, measure, bottomMeasure);
-            let systemXPosition: number = staffLineRelative.x + xPosition;
+            const singleVerticalLineAfterMeasure: SystemLine = this.createSystemLine(xPosition, lineWidth, lineType,
+                                                                                     linePosition, this, measure, bottomMeasure);
+            const systemXPosition: number = staffLineRelative.x + xPosition;
             singleVerticalLineAfterMeasure.PositionAndShape.RelativePosition = new PointF2D(systemXPosition, 0);
             singleVerticalLineAfterMeasure.PositionAndShape.BorderLeft = 0;
             singleVerticalLineAfterMeasure.PositionAndShape.BorderRight = lineWidth;
             this.SystemLines.push(singleVerticalLineAfterMeasure);
-            this.boundingBox.ChildElements.push(singleVerticalLineAfterMeasure.PositionAndShape);
         }
     }
 
@@ -184,7 +183,7 @@ export abstract class MusicSystem extends GraphicalObject {
 
     public AddStaffMeasures(graphicalMeasures: StaffMeasure[]): void {
         for (let idx: number = 0, len: number = graphicalMeasures.length; idx < len; ++idx) {
-            let graphicalMeasure: StaffMeasure = graphicalMeasures[idx];
+            const graphicalMeasure: StaffMeasure = graphicalMeasures[idx];
             graphicalMeasure.parentMusicSystem = this;
         }
         this.graphicalMeasures.push(graphicalMeasures);
@@ -195,7 +194,7 @@ export abstract class MusicSystem extends GraphicalObject {
     }
 
     public GetSystemsLastTimeStamp(): Fraction {
-        let m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.length - 1][0].parentSourceMeasure;
+        const m: SourceMeasure = this.graphicalMeasures[this.graphicalMeasures.length - 1][0].parentSourceMeasure;
         return Fraction.plus(m.AbsoluteTimestamp, m.Duration);
     }
 
@@ -206,11 +205,11 @@ export abstract class MusicSystem extends GraphicalObject {
      */
     public createInstrumentBrackets(instruments: Instrument[], staffHeight: number): void {
         for (let idx: number = 0, len: number = instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = instruments[idx];
+            const instrument: Instrument = instruments[idx];
             if (instrument.Staves.length > 1) {
                 let firstStaffLine: StaffLine = undefined, lastStaffLine: StaffLine = undefined;
                 for (let idx2: number = 0, len2: number = this.staffLines.length; idx2 < len2; ++idx2) {
-                    let staffLine: StaffLine = this.staffLines[idx2];
+                    const staffLine: StaffLine = this.staffLines[idx2];
                     if (staffLine.ParentStaff === instrument.Staves[0]) {
                         firstStaffLine = staffLine;
                     }
@@ -233,18 +232,18 @@ export abstract class MusicSystem extends GraphicalObject {
      */
     public createGroupBrackets(instrumentGroups: InstrumentalGroup[], staffHeight: number, recursionDepth: number): void {
         for (let idx: number = 0, len: number = instrumentGroups.length; idx < len; ++idx) {
-            let instrumentGroup: InstrumentalGroup = instrumentGroups[idx];
+            const instrumentGroup: InstrumentalGroup = instrumentGroups[idx];
             if (instrumentGroup.InstrumentalGroups.length < 1) {
                 continue;
             }
-            let instrument1: Instrument = this.findFirstVisibleInstrumentInInstrumentalGroup(instrumentGroup);
-            let instrument2: Instrument = this.findLastVisibleInstrumentInInstrumentalGroup(instrumentGroup);
+            const instrument1: Instrument = this.findFirstVisibleInstrumentInInstrumentalGroup(instrumentGroup);
+            const instrument2: Instrument = this.findLastVisibleInstrumentInInstrumentalGroup(instrumentGroup);
             if (instrument1 === undefined || instrument2 === undefined) {
                 continue;
             }
             let firstStaffLine: StaffLine = undefined;
             for (let idx2: number = 0, len2: number = this.staffLines.length; idx2 < len2; ++idx2) {
-                let staffLine: StaffLine = this.staffLines[idx2];
+                const staffLine: StaffLine = this.staffLines[idx2];
                 if (staffLine.ParentStaff === instrument1.Staves[0]) {
                     firstStaffLine = staffLine;
                 }
@@ -267,15 +266,15 @@ export abstract class MusicSystem extends GraphicalObject {
      */
     public createMusicSystemLabel(instrumentLabelTextHeight: number, systemLabelsRightMargin: number, labelMarginBorderFactor: number): void {
         if (this.parent === this.parent.Parent.MusicPages[0] && this === this.parent.MusicSystems[0]) {
-            let instruments: Instrument[] = this.parent.Parent.ParentMusicSheet.getVisibleInstruments();
+            const instruments: Instrument[] = this.parent.Parent.ParentMusicSheet.getVisibleInstruments();
             for (let idx: number = 0, len: number = instruments.length; idx < len; ++idx) {
-                let instrument: Instrument = instruments[idx];
-                let graphicalLabel: GraphicalLabel = new GraphicalLabel(
+                const instrument: Instrument = instruments[idx];
+                const graphicalLabel: GraphicalLabel = new GraphicalLabel(
                     instrument.NameLabel, instrumentLabelTextHeight, TextAlignment.LeftCenter, this.boundingBox
                 );
                 graphicalLabel.setLabelPositionAndShapeBorders();
                 this.labels.setValue(graphicalLabel, instrument);
-                this.boundingBox.ChildElements.push(graphicalLabel.PositionAndShape);
+                //graphicalLabel.PositionAndShape.Parent = this.PositionAndShape;
 
                 // X-Position will be 0 (Label starts at the same PointF_2D with MusicSystem)
                 // Y-Position will be calculated after the y-Spacing
@@ -284,9 +283,9 @@ export abstract class MusicSystem extends GraphicalObject {
 
             // calculate maxLabelLength (needed for X-Spacing)
             this.maxLabelLength = 0.0;
-            let labels: GraphicalLabel[] = this.labels.keys();
+            const labels: GraphicalLabel[] = this.labels.keys();
             for (let idx: number = 0, len: number = labels.length; idx < len; ++idx) {
-                let label: GraphicalLabel = labels[idx];
+                const label: GraphicalLabel = labels[idx];
                 if (label.PositionAndShape.Size.width > this.maxLabelLength) {
                     this.maxLabelLength = label.PositionAndShape.Size.width;
                 }
@@ -306,7 +305,7 @@ export abstract class MusicSystem extends GraphicalObject {
                 for (let i: number = 0; i < this.staffLines.length; i++) {
                     if (this.staffLines[i].ParentStaff.ParentInstrument === value) {
                         for (let j: number = i; j < this.staffLines.length; j++) {
-                            let staffLine: StaffLine = this.staffLines[j];
+                            const staffLine: StaffLine = this.staffLines[j];
                             if (staffLine.ParentStaff.ParentInstrument !== value) {
                                 break;
                             }
@@ -333,18 +332,18 @@ export abstract class MusicSystem extends GraphicalObject {
         let second: boolean = false;
         for (let i: number = 0; i < this.staffLines.length - 1; i++) {
             for (let idx: number = 0, len: number = this.staffLines[i].Measures.length; idx < len; ++idx) {
-                let measure: StaffMeasure = this.staffLines[i].Measures[idx];
+                const measure: StaffMeasure = this.staffLines[i].Measures[idx];
                 for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
-                    let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
+                    const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
                     if (staffEntry.sourceStaffEntry.Link !== undefined) {
                         first = true;
                     }
                 }
             }
             for (let idx: number = 0, len: number = this.staffLines[i + 1].Measures.length; idx < len; ++idx) {
-                let measure: StaffMeasure = this.staffLines[i + 1].Measures[idx];
+                const measure: StaffMeasure = this.staffLines[i + 1].Measures[idx];
                 for (let idx2: number = 0, len2: number = measure.staffEntries.length; idx2 < len2; ++idx2) {
-                    let staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
+                    const staffEntry: GraphicalStaffEntry = measure.staffEntries[idx2];
                     if (staffEntry.sourceStaffEntry.Link !== undefined) {
                         second = true;
                     }
@@ -358,9 +357,9 @@ export abstract class MusicSystem extends GraphicalObject {
     }
 
     public getBottomStaffLine(topStaffLine: StaffLine): StaffLine {
-        let staves: Staff[] = topStaffLine.ParentStaff.ParentInstrument.Staves;
-        let last: Staff = staves[staves.length - 1];
-        for (let line of topStaffLine.ParentMusicSystem.staffLines) {
+        const staves: Staff[] = topStaffLine.ParentStaff.ParentInstrument.Staves;
+        const last: Staff = staves[staves.length - 1];
+        for (const line of topStaffLine.ParentMusicSystem.staffLines) {
             if (line.ParentStaff === last) {
                 return line;
             }
@@ -399,11 +398,11 @@ export abstract class MusicSystem extends GraphicalObject {
     protected calcBracketsWidth(): number {
         let width: number = 0;
         for (let idx: number = 0, len: number = this.GroupBrackets.length; idx < len; ++idx) {
-            let groupBracket: GraphicalObject = this.GroupBrackets[idx];
+            const groupBracket: GraphicalObject = this.GroupBrackets[idx];
             width = Math.max(width, groupBracket.PositionAndShape.Size.width);
         }
         for (let idx2: number = 0, len2: number = this.InstrumentBrackets.length; idx2 < len2; ++idx2) {
-            let instrumentBracket: GraphicalObject = this.InstrumentBrackets[idx2];
+            const instrumentBracket: GraphicalObject = this.InstrumentBrackets[idx2];
             width = Math.max(width, instrumentBracket.PositionAndShape.Size.width);
         }
         return width;
@@ -419,7 +418,7 @@ export abstract class MusicSystem extends GraphicalObject {
 
     private findFirstVisibleInstrumentInInstrumentalGroup(instrumentalGroup: InstrumentalGroup): Instrument {
         for (let idx: number = 0, len: number = instrumentalGroup.InstrumentalGroups.length; idx < len; ++idx) {
-            let groupOrInstrument: InstrumentalGroup = instrumentalGroup.InstrumentalGroups[idx];
+            const groupOrInstrument: InstrumentalGroup = instrumentalGroup.InstrumentalGroups[idx];
             if (groupOrInstrument instanceof Instrument) {
                 if ((<Instrument>groupOrInstrument).Visible === true) {
                     return <Instrument>groupOrInstrument;
@@ -452,13 +451,13 @@ export abstract class MusicSystem extends GraphicalObject {
      */
     private updateMusicSystemStaffLineXPosition(systemLabelsRightMargin: number): void {
         for (let idx: number = 0, len: number = this.StaffLines.length; idx < len; ++idx) {
-            let staffLine: StaffLine = this.StaffLines[idx];
-            let relative: PointF2D = staffLine.PositionAndShape.RelativePosition;
+            const staffLine: StaffLine = this.StaffLines[idx];
+            const relative: PointF2D = staffLine.PositionAndShape.RelativePosition;
             relative.x = this.maxLabelLength + systemLabelsRightMargin;
             staffLine.PositionAndShape.RelativePosition = relative;
             staffLine.PositionAndShape.BorderRight = this.boundingBox.Size.width - this.maxLabelLength - systemLabelsRightMargin;
             for (let i: number = 0; i < staffLine.StaffLines.length; i++) {
-                let lineEnd: PointF2D = new PointF2D(staffLine.PositionAndShape.Size.width, staffLine.StaffLines[i].End.y);
+                const lineEnd: PointF2D = new PointF2D(staffLine.PositionAndShape.Size.width, staffLine.StaffLines[i].End.y);
                 staffLine.StaffLines[i].End = lineEnd;
             }
         }

+ 100 - 105
src/MusicalScore/Graphical/MusicSystemBuilder.ts

@@ -62,7 +62,7 @@ export class MusicSystemBuilder {
 
     public buildMusicSystems(): void {
         let previousMeasureEndsSystem: boolean = false;
-        let systemMaxWidth: number = this.getFullPageSystemWidth();
+        const systemMaxWidth: number = this.getFullPageSystemWidth();
         this.measureListIndex = 0;
         this.currentSystemParams = new SystemBuildParameters();
 
@@ -85,14 +85,14 @@ export class MusicSystemBuilder {
 
         // go through measures and add to system until system gets too long -> finish system and start next system.
         while (this.measureListIndex < numberOfMeasures) {
-            let staffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex];
+            const staffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex];
             for (let idx: number = 0, len: number = staffMeasures.length; idx < len; ++idx) {
                 staffMeasures[idx].resetLayout();
             }
-            let sourceMeasure: SourceMeasure = staffMeasures[0].parentSourceMeasure;
-            let sourceMeasureEndsSystem: boolean = sourceMeasure.BreakSystemAfter;
-            let isSystemStartMeasure: boolean = this.currentSystemParams.IsSystemStartMeasure();
-            let isFirstSourceMeasure: boolean = sourceMeasure === this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
+            const sourceMeasure: SourceMeasure = staffMeasures[0].parentSourceMeasure;
+            const sourceMeasureEndsSystem: boolean = sourceMeasure.BreakSystemAfter;
+            const isSystemStartMeasure: boolean = this.currentSystemParams.IsSystemStartMeasure();
+            const isFirstSourceMeasure: boolean = sourceMeasure === this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
             let currentMeasureBeginInstructionsWidth: number = this.rules.MeasureLeftMargin;
             let currentMeasureEndInstructionsWidth: number = 0;
 
@@ -101,7 +101,7 @@ export class MusicSystemBuilder {
             // 1. the begin instructions (clef, Key, Rhythm),
             // 2. the staff entries (= notes) and
             // 3. the end instructions (actually only clefs)
-            let measureStartLine: SystemLinesEnum = this.getMeasureStartLine();
+            const measureStartLine: SystemLinesEnum = this.getMeasureStartLine();
             currentMeasureBeginInstructionsWidth += this.getLineWidth(staffMeasures[0], measureStartLine, isSystemStartMeasure);
             if (!this.leadSheet) {
                 currentMeasureBeginInstructionsWidth += this.addBeginInstructions(staffMeasures, isSystemStartMeasure, isFirstSourceMeasure);
@@ -113,20 +113,20 @@ export class MusicSystemBuilder {
             }
 
             // take into account the LineWidth after each Measure
-            let measureEndLine: SystemLinesEnum = this.getMeasureEndLine();
+            const measureEndLine: SystemLinesEnum = this.getMeasureEndLine();
             currentMeasureEndInstructionsWidth += this.getLineWidth(staffMeasures[0], measureEndLine, isSystemStartMeasure);
             let nextMeasureBeginInstructionWidth: number = this.rules.MeasureLeftMargin;
 
             // Check if there are key or rhythm change instructions within the next measure:
             if (this.measureListIndex + 1 < this.measureList.length) {
-                let nextStaffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex + 1];
-                let nextSourceMeasure: SourceMeasure = nextStaffMeasures[0].parentSourceMeasure;
+                const nextStaffMeasures: StaffMeasure[] = this.measureList[this.measureListIndex + 1];
+                const nextSourceMeasure: SourceMeasure = nextStaffMeasures[0].parentSourceMeasure;
                 if (nextSourceMeasure.hasBeginInstructions()) {
                     nextMeasureBeginInstructionWidth += this.addBeginInstructions(nextStaffMeasures, false, false);
                 }
             }
-            let totalMeasureWidth: number = currentMeasureBeginInstructionsWidth + currentMeasureEndInstructionsWidth + currentMeasureVarWidth;
-            let measureFitsInSystem: boolean = this.currentSystemParams.currentWidth + totalMeasureWidth + nextMeasureBeginInstructionWidth < systemMaxWidth;
+            const totalMeasureWidth: number = currentMeasureBeginInstructionsWidth + currentMeasureEndInstructionsWidth + currentMeasureVarWidth;
+            const measureFitsInSystem: boolean = this.currentSystemParams.currentWidth + totalMeasureWidth + nextMeasureBeginInstructionWidth < systemMaxWidth;
             if (isSystemStartMeasure || measureFitsInSystem) {
                 this.addMeasureToSystem(
                     staffMeasures, measureStartLine, measureEndLine, totalMeasureWidth,
@@ -153,7 +153,7 @@ export class MusicSystemBuilder {
      */
     private setMeasureWidth(staffMeasures: StaffMeasure[], width: number, beginInstrWidth: number, endInstrWidth: number): void {
         for (let idx: number = 0, len: number = staffMeasures.length; idx < len; ++idx) {
-            let measure: StaffMeasure = staffMeasures[idx];
+            const measure: StaffMeasure = staffMeasures[idx];
             measure.setWidth(width);
             if (beginInstrWidth > 0) {
                 measure.beginInstructionsWidth = beginInstrWidth;
@@ -203,11 +203,11 @@ export class MusicSystemBuilder {
      * (this should be refactored at some point to not use a combined end/start line but always separated lines)
      */
     private adaptRepetitionLineWithIfNeeded(): void {
-        let systemMeasures: MeasureBuildParameters[] = this.currentSystemParams.systemMeasures;
+        const systemMeasures: MeasureBuildParameters[] = this.currentSystemParams.systemMeasures;
         if (systemMeasures.length >= 1) {
-            let measures: StaffMeasure[] =
+            const measures: StaffMeasure[] =
                 this.currentSystemParams.currentSystem.GraphicalMeasures[this.currentSystemParams.currentSystem.GraphicalMeasures.length - 1];
-            let measureParams: MeasureBuildParameters = systemMeasures[systemMeasures.length - 1];
+            const measureParams: MeasureBuildParameters = systemMeasures[systemMeasures.length - 1];
             let diff: number = 0.0;
             if (measureParams.endLine === SystemLinesEnum.DotsBoldBoldDots) {
                 measureParams.endLine = SystemLinesEnum.DotsThinBold;
@@ -215,7 +215,7 @@ export class MusicSystemBuilder {
             }
             this.currentSystemParams.currentSystemFixWidth -= diff;
             for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
-                let measure: StaffMeasure = measures[idx];
+                const measure: StaffMeasure = measures[idx];
                 measure.endInstructionsWidth -= diff;
             }
         }
@@ -242,7 +242,7 @@ export class MusicSystemBuilder {
      * @returns {GraphicalMusicPage}
      */
     private createMusicPage(): GraphicalMusicPage {
-        let page: GraphicalMusicPage = new GraphicalMusicPage(this.graphicalMusicSheet);
+        const page: GraphicalMusicPage = new GraphicalMusicPage(this.graphicalMusicSheet);
         this.graphicalMusicSheet.MusicPages.push(page);
         page.PositionAndShape.BorderLeft = 0.0;
         page.PositionAndShape.BorderRight = this.graphicalMusicSheet.ParentMusicSheet.pageWidth;
@@ -257,10 +257,8 @@ export class MusicSystemBuilder {
      * @returns {MusicSystem}
      */
     private initMusicSystem(): MusicSystem {
-        let musicSystem: MusicSystem = this.symbolFactory.createMusicSystem(this.currentMusicPage, this.globalSystemIndex++);
+        const musicSystem: MusicSystem = this.symbolFactory.createMusicSystem(this.currentMusicPage, this.globalSystemIndex++);
         this.currentMusicPage.MusicSystems.push(musicSystem);
-        let boundingBox: BoundingBox = musicSystem.PositionAndShape;
-        this.currentMusicPage.PositionAndShape.ChildElements.push(boundingBox);
         return musicSystem;
     }
 
@@ -274,28 +272,28 @@ export class MusicSystemBuilder {
     }
 
     private layoutSystemStaves(): void {
-        let systemWidth: number = this.getFullPageSystemWidth();
-        let musicSystem: MusicSystem = this.currentSystemParams.currentSystem;
-        let boundingBox: BoundingBox = musicSystem.PositionAndShape;
+        const systemWidth: number = this.getFullPageSystemWidth();
+        const musicSystem: MusicSystem = this.currentSystemParams.currentSystem;
+        const boundingBox: BoundingBox = musicSystem.PositionAndShape;
         boundingBox.BorderLeft = 0.0;
         boundingBox.BorderRight = systemWidth;
         boundingBox.BorderTop = 0.0;
-        let staffList: Staff[] = [];
-        let instruments: Instrument[] = this.graphicalMusicSheet.ParentMusicSheet.Instruments;
+        const staffList: Staff[] = [];
+        const instruments: Instrument[] = this.graphicalMusicSheet.ParentMusicSheet.Instruments;
         for (let idx: number = 0, len: number = instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = instruments[idx];
+            const instrument: Instrument = instruments[idx];
             if (instrument.Voices.length === 0 || !instrument.Visible) {
                 continue;
             }
             for (let idx2: number = 0, len2: number = instrument.Staves.length; idx2 < len2; ++idx2) {
-                let staff: Staff = instrument.Staves[idx2];
+                const staff: Staff = instrument.Staves[idx2];
                 staffList.push(staff);
             }
         }
         let multiLyrics: boolean = false;
         if (this.leadSheet) {
             for (let idx: number = 0, len: number = staffList.length; idx < len; ++idx) {
-                let staff: Staff = staffList[idx];
+                const staff: Staff = staffList[idx];
                 if (staff.ParentInstrument.LyricVersesNumbers.length > 1) {
                     multiLyrics = true;
                     break;
@@ -331,11 +329,10 @@ export class MusicSystemBuilder {
      */
     private addStaffLineToMusicSystem(musicSystem: MusicSystem, relativeYPosition: number, staff: Staff): void {
         if (musicSystem !== undefined) {
-            let staffLine: StaffLine = this.symbolFactory.createStaffLine(musicSystem, staff);
+            const staffLine: StaffLine = this.symbolFactory.createStaffLine(musicSystem, staff);
             musicSystem.StaffLines.push(staffLine);
-            let boundingBox: BoundingBox = staffLine.PositionAndShape;
-            musicSystem.PositionAndShape.ChildElements.push(boundingBox);
-            let relativePosition: PointF2D = new PointF2D();
+            const boundingBox: BoundingBox = staffLine.PositionAndShape;
+            const relativePosition: PointF2D = new PointF2D();
             if (musicSystem.Parent.MusicSystems[0] === musicSystem && musicSystem.Parent === musicSystem.Parent.Parent.MusicPages[0]) {
                 relativePosition.x = this.rules.FirstSystemMargin;
             } else {
@@ -352,10 +349,10 @@ export class MusicSystemBuilder {
             boundingBox.BorderTop = 0.0;
             boundingBox.BorderBottom = this.rules.StaffHeight;
             for (let i: number = 0; i < 5; i++) {
-                let start: PointF2D = new PointF2D();
+                const start: PointF2D = new PointF2D();
                 start.x = 0.0;
                 start.y = i * this.rules.StaffHeight / 4;
-                let end: PointF2D = new PointF2D();
+                const end: PointF2D = new PointF2D();
                 end.x = staffLine.PositionAndShape.Size.width;
                 end.y = i * this.rules.StaffHeight / 4;
                 if (this.leadSheet) {
@@ -371,12 +368,12 @@ export class MusicSystemBuilder {
      * @param measureList
      */
     private initializeActiveInstructions(measureList: StaffMeasure[]): void {
-        let firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
+        const firstSourceMeasure: SourceMeasure = this.graphicalMusicSheet.ParentMusicSheet.getFirstSourceMeasure();
         if (firstSourceMeasure !== undefined) {
             this.visibleStaffIndices = this.graphicalMusicSheet.getVisibleStavesIndecesFromSourceMeasure(measureList);
             for (let i: number = 0, len: number = this.visibleStaffIndices.length; i < len; i++) {
-                let staffIndex: number = this.visibleStaffIndices[i];
-                let graphicalMeasure: StaffMeasure = this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(firstSourceMeasure, staffIndex);
+                const staffIndex: number = this.visibleStaffIndices[i];
+                const graphicalMeasure: StaffMeasure = this.graphicalMusicSheet.getGraphicalMeasureFromSourceMeasureAndIndex(firstSourceMeasure, staffIndex);
                 this.activeClefs[i] = <ClefInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[0];
                 let keyInstruction: KeyInstruction = KeyInstruction.copy(
                     <KeyInstruction>firstSourceMeasure.FirstInstructionsStaffEntries[staffIndex].Instructions[1]);
@@ -408,17 +405,17 @@ export class MusicSystemBuilder {
      * @returns {number}
      */
     private addBeginInstructions(measures: StaffMeasure[], isSystemFirstMeasure: boolean, isFirstSourceMeasure: boolean): number {
-        let measureCount: number = measures.length;
+        const measureCount: number = measures.length;
         if (measureCount === 0) {
             return 0;
         }
         let totalBeginInstructionLengthX: number = 0.0;
-        let sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
         for (let idx: number = 0; idx < measureCount; ++idx) {
-            let measure: StaffMeasure = measures[idx];
-            let staffIndex: number = this.visibleStaffIndices[idx];
-            let beginInstructionsStaffEntry: SourceStaffEntry = sourceMeasure.FirstInstructionsStaffEntries[staffIndex];
-            let beginInstructionLengthX: number = this.AddInstructionsAtMeasureBegin(
+            const measure: StaffMeasure = measures[idx];
+            const staffIndex: number = this.visibleStaffIndices[idx];
+            const beginInstructionsStaffEntry: SourceStaffEntry = sourceMeasure.FirstInstructionsStaffEntries[staffIndex];
+            const beginInstructionLengthX: number = this.AddInstructionsAtMeasureBegin(
                 beginInstructionsStaffEntry, measure,
                 idx, isFirstSourceMeasure,
                 isSystemFirstMeasure
@@ -434,17 +431,17 @@ export class MusicSystemBuilder {
      * @returns {number}
      */
     private addEndInstructions(measures: StaffMeasure[]): number {
-        let measureCount: number = measures.length;
+        const measureCount: number = measures.length;
         if (measureCount === 0) {
             return 0;
         }
         let totalEndInstructionLengthX: number = 0.5;
-        let sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = measures[0].parentSourceMeasure;
         for (let idx: number = 0; idx < measureCount; idx++) {
-            let measure: StaffMeasure = measures[idx];
-            let staffIndex: number = this.visibleStaffIndices[idx];
-            let endInstructionsStaffEntry: SourceStaffEntry = sourceMeasure.LastInstructionsStaffEntries[staffIndex];
-            let endInstructionLengthX: number = this.addInstructionsAtMeasureEnd(endInstructionsStaffEntry, measure);
+            const measure: StaffMeasure = measures[idx];
+            const staffIndex: number = this.visibleStaffIndices[idx];
+            const endInstructionsStaffEntry: SourceStaffEntry = sourceMeasure.LastInstructionsStaffEntries[staffIndex];
+            const endInstructionLengthX: number = this.addInstructionsAtMeasureEnd(endInstructionsStaffEntry, measure);
             totalEndInstructionLengthX = Math.max(totalEndInstructionLengthX, endInstructionLengthX);
         }
         return totalEndInstructionLengthX;
@@ -458,7 +455,7 @@ export class MusicSystemBuilder {
         let currentRhythm: RhythmInstruction = undefined;
         if (firstEntry !== undefined) {
             for (let idx: number = 0, len: number = firstEntry.Instructions.length; idx < len; ++idx) {
-                let abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
+                const abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
                 if (abstractNotationInstruction instanceof ClefInstruction) {
                     currentClef = <ClefInstruction>abstractNotationInstruction;
                 } else if (abstractNotationInstruction instanceof KeyInstruction) {
@@ -490,7 +487,7 @@ export class MusicSystemBuilder {
         }
         if (currentKey !== undefined) {
             currentKey = this.transposeKeyInstruction(currentKey, measure);
-            let previousKey: KeyInstruction = isSystemStartMeasure ? undefined : this.activeKeys[visibleStaffIdx];
+            const previousKey: KeyInstruction = isSystemStartMeasure ? undefined : this.activeKeys[visibleStaffIdx];
             measure.addKeyAtBegin(currentKey, previousKey, currentClef);
             keyAdded = true;
         }
@@ -512,9 +509,9 @@ export class MusicSystemBuilder {
             return 0;
         }
         for (let idx: number = 0, len: number = lastEntry.Instructions.length; idx < len; ++idx) {
-            let abstractNotationInstruction: AbstractNotationInstruction = lastEntry.Instructions[idx];
+            const abstractNotationInstruction: AbstractNotationInstruction = lastEntry.Instructions[idx];
             if (abstractNotationInstruction instanceof ClefInstruction) {
-                let activeClef: ClefInstruction = <ClefInstruction>abstractNotationInstruction;
+                const activeClef: ClefInstruction = <ClefInstruction>abstractNotationInstruction;
                 measure.addClefAtEnd(activeClef);
             }
         }
@@ -530,11 +527,11 @@ export class MusicSystemBuilder {
      */
     private updateActiveClefs(measure: SourceMeasure, staffMeasures: StaffMeasure[]): void {
         for (let visStaffIdx: number = 0, len: number = staffMeasures.length; visStaffIdx < len; visStaffIdx++) {
-            let staffIndex: number = this.visibleStaffIndices[visStaffIdx];
-            let firstEntry: SourceStaffEntry = measure.FirstInstructionsStaffEntries[staffIndex];
+            const staffIndex: number = this.visibleStaffIndices[visStaffIdx];
+            const firstEntry: SourceStaffEntry = measure.FirstInstructionsStaffEntries[staffIndex];
             if (firstEntry !== undefined) {
                 for (let idx: number = 0, len2: number = firstEntry.Instructions.length; idx < len2; ++idx) {
-                    let abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
+                    const abstractNotationInstruction: AbstractNotationInstruction = firstEntry.Instructions[idx];
                     if (abstractNotationInstruction instanceof ClefInstruction) {
                         this.activeClefs[visStaffIdx] = <ClefInstruction>abstractNotationInstruction;
                     } else if (abstractNotationInstruction instanceof KeyInstruction) {
@@ -544,23 +541,23 @@ export class MusicSystemBuilder {
                     }
                 }
             }
-            let entries: SourceStaffEntry[] = measure.getEntriesPerStaff(staffIndex);
+            const entries: SourceStaffEntry[] = measure.getEntriesPerStaff(staffIndex);
             for (let idx: number = 0, len2: number = entries.length; idx < len2; ++idx) {
-                let staffEntry: SourceStaffEntry = entries[idx];
+                const staffEntry: SourceStaffEntry = entries[idx];
                 if (staffEntry.Instructions !== undefined) {
                     for (let idx2: number = 0, len3: number = staffEntry.Instructions.length; idx2 < len3; ++idx2) {
-                        let abstractNotationInstruction: AbstractNotationInstruction = staffEntry.Instructions[idx2];
+                        const abstractNotationInstruction: AbstractNotationInstruction = staffEntry.Instructions[idx2];
                         if (abstractNotationInstruction instanceof ClefInstruction) {
                             this.activeClefs[visStaffIdx] = <ClefInstruction>abstractNotationInstruction;
                         }
                     }
                 }
             }
-            let lastEntry: SourceStaffEntry = measure.LastInstructionsStaffEntries[staffIndex];
+            const lastEntry: SourceStaffEntry = measure.LastInstructionsStaffEntries[staffIndex];
             if (lastEntry !== undefined) {
-                let instructions: AbstractNotationInstruction[] = lastEntry.Instructions;
+                const instructions: AbstractNotationInstruction[] = lastEntry.Instructions;
                 for (let idx: number = 0, len3: number = instructions.length; idx < len3; ++idx) {
-                    let abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
+                    const abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
                     if (abstractNotationInstruction instanceof ClefInstruction) {
                         this.activeClefs[visStaffIdx] = <ClefInstruction>abstractNotationInstruction;
                     }
@@ -574,23 +571,23 @@ export class MusicSystemBuilder {
      * @param measures
      */
     private checkAndCreateExtraInstructionMeasure(measures: StaffMeasure[]): void {
-        let firstStaffEntries: SourceStaffEntry[] = measures[0].parentSourceMeasure.FirstInstructionsStaffEntries;
-        let visibleInstructionEntries: SourceStaffEntry[] = [];
+        const firstStaffEntries: SourceStaffEntry[] = measures[0].parentSourceMeasure.FirstInstructionsStaffEntries;
+        const visibleInstructionEntries: SourceStaffEntry[] = [];
         for (let idx: number = 0, len: number = measures.length; idx < len; ++idx) {
-            let measure: StaffMeasure = measures[idx];
+            const measure: StaffMeasure = measures[idx];
             visibleInstructionEntries.push(firstStaffEntries[measure.ParentStaff.idInMusicSheet]);
         }
         let maxMeasureWidth: number = 0;
         for (let visStaffIdx: number = 0, len: number = visibleInstructionEntries.length; visStaffIdx < len; ++visStaffIdx) {
-            let sse: SourceStaffEntry = visibleInstructionEntries[visStaffIdx];
+            const sse: SourceStaffEntry = visibleInstructionEntries[visStaffIdx];
             if (sse === undefined) {
                 continue;
             }
-            let instructions: AbstractNotationInstruction[] = sse.Instructions;
+            const instructions: AbstractNotationInstruction[] = sse.Instructions;
             let keyInstruction: KeyInstruction = undefined;
             let rhythmInstruction: RhythmInstruction = undefined;
             for (let idx2: number = 0, len2: number = instructions.length; idx2 < len2; ++idx2) {
-                let instruction: AbstractNotationInstruction = instructions[idx2];
+                const instruction: AbstractNotationInstruction = instructions[idx2];
                 if (instruction instanceof KeyInstruction && (<KeyInstruction>instruction).Key !== this.activeKeys[visStaffIdx].Key) {
                     keyInstruction = <KeyInstruction>instruction;
                 }
@@ -599,7 +596,7 @@ export class MusicSystemBuilder {
                 }
             }
             if (keyInstruction !== undefined || rhythmInstruction !== undefined) {
-                let measureWidth: number = this.addExtraInstructionMeasure(visStaffIdx, keyInstruction, rhythmInstruction);
+                const measureWidth: number = this.addExtraInstructionMeasure(visStaffIdx, keyInstruction, rhythmInstruction);
                 maxMeasureWidth = Math.max(maxMeasureWidth, measureWidth);
             }
         }
@@ -614,9 +611,9 @@ export class MusicSystemBuilder {
     }
 
     private addExtraInstructionMeasure(visStaffIdx: number, keyInstruction: KeyInstruction, rhythmInstruction: RhythmInstruction): number {
-        let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
-        let measures: StaffMeasure[] = [];
-        let measure: StaffMeasure = this.symbolFactory.createExtraStaffMeasure(currentSystem.StaffLines[visStaffIdx]);
+        const currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
+        const measures: StaffMeasure[] = [];
+        const measure: StaffMeasure = this.symbolFactory.createExtraStaffMeasure(currentSystem.StaffLines[visStaffIdx]);
         measures.push(measure);
         if (keyInstruction !== undefined) {
             measure.addKeyAtBegin(keyInstruction, this.activeKeys[visStaffIdx], this.activeClefs[visStaffIdx]);
@@ -627,11 +624,10 @@ export class MusicSystemBuilder {
         measure.PositionAndShape.BorderLeft = 0.0;
         measure.PositionAndShape.BorderTop = 0.0;
         measure.PositionAndShape.BorderBottom = this.rules.StaffHeight;
-        let width: number = this.rules.MeasureLeftMargin + measure.beginInstructionsWidth + this.rules.MeasureRightMargin;
+        const width: number = this.rules.MeasureLeftMargin + measure.beginInstructionsWidth + this.rules.MeasureRightMargin;
         measure.PositionAndShape.BorderRight = width;
         currentSystem.StaffLines[visStaffIdx].Measures.push(measure);
         measure.ParentStaffLine = currentSystem.StaffLines[visStaffIdx];
-        currentSystem.StaffLines[visStaffIdx].PositionAndShape.ChildElements.push(measure.PositionAndShape);
         return width;
     }
 
@@ -641,16 +637,15 @@ export class MusicSystemBuilder {
      */
     private addStaveMeasuresToSystem(staffMeasures: StaffMeasure[]): void {
         if (staffMeasures[0] !== undefined) {
-            let gmeasures: StaffMeasure[] = [];
+            const gmeasures: StaffMeasure[] = [];
             for (let i: number = 0; i < staffMeasures.length; i++) {
                 gmeasures.push(staffMeasures[i]);
             }
-            let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
+            const currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
             for (let visStaffIdx: number = 0; visStaffIdx < this.numberOfVisibleStaffLines; visStaffIdx++) {
-                let measure: StaffMeasure = gmeasures[visStaffIdx];
+                const measure: StaffMeasure = gmeasures[visStaffIdx];
                 currentSystem.StaffLines[visStaffIdx].Measures.push(measure);
                 measure.ParentStaffLine = currentSystem.StaffLines[visStaffIdx];
-                currentSystem.StaffLines[visStaffIdx].PositionAndShape.ChildElements.push(measure.PositionAndShape);
             }
             currentSystem.AddStaffMeasures(gmeasures);
         }
@@ -661,10 +656,10 @@ export class MusicSystemBuilder {
      * @returns {SystemLinesEnum}
      */
     private getMeasureStartLine(): SystemLinesEnum {
-        let thisMeasureBeginsLineRep: boolean = this.thisMeasureBeginsLineRepetition();
+        const thisMeasureBeginsLineRep: boolean = this.thisMeasureBeginsLineRepetition();
         if (thisMeasureBeginsLineRep) {
-            let isSystemStartMeasure: boolean = this.currentSystemParams.IsSystemStartMeasure();
-            let isGlobalFirstMeasure: boolean = this.measureListIndex === 0;
+            const isSystemStartMeasure: boolean = this.currentSystemParams.IsSystemStartMeasure();
+            const isGlobalFirstMeasure: boolean = this.measureListIndex === 0;
             if (this.previousMeasureEndsLineRepetition() && !isSystemStartMeasure) {
                 return SystemLinesEnum.DotsBoldBoldDots;
             }
@@ -714,7 +709,7 @@ export class MusicSystemBuilder {
             return false;
         }
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex - 1].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[this.measureListIndex - 1][idx];
+            const measure: StaffMeasure = this.measureList[this.measureListIndex - 1][idx];
             if (measure.endsWithLineRepetition()) {
                 return true;
             }
@@ -728,7 +723,7 @@ export class MusicSystemBuilder {
      */
     private thisMeasureBeginsLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
+            const measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
             if (measure.beginsWithLineRepetition()) {
                 return true;
             }
@@ -741,12 +736,12 @@ export class MusicSystemBuilder {
      * @returns {boolean}
      */
     private nextMeasureBeginsLineRepetition(): boolean {
-        let nextMeasureIndex: number = this.measureListIndex + 1;
+        const nextMeasureIndex: number = this.measureListIndex + 1;
         if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length) {
             return false;
         }
         for (let idx: number = 0, len: number = this.measureList[nextMeasureIndex].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
+            const measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
             if (measure.beginsWithLineRepetition()) {
                 return true;
             }
@@ -760,7 +755,7 @@ export class MusicSystemBuilder {
      */
     private thisMeasureEndsLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
+            const measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
             if (measure.endsWithLineRepetition()) {
                 return true;
             }
@@ -773,12 +768,12 @@ export class MusicSystemBuilder {
      * @returns {boolean}
      */
     private nextMeasureBeginsWordRepetition(): boolean {
-        let nextMeasureIndex: number = this.measureListIndex + 1;
+        const nextMeasureIndex: number = this.measureListIndex + 1;
         if (nextMeasureIndex >= this.graphicalMusicSheet.ParentMusicSheet.SourceMeasures.length) {
             return false;
         }
         for (let idx: number = 0, len: number = this.measureList[nextMeasureIndex].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
+            const measure: StaffMeasure = this.measureList[nextMeasureIndex][idx];
             if (measure.beginsWithWordRepetition()) {
                 return true;
             }
@@ -792,7 +787,7 @@ export class MusicSystemBuilder {
      */
     private thisMeasureEndsWordRepetition(): boolean {
         for (let idx: number = 0, len: number = this.measureList[this.measureListIndex].length; idx < len; ++idx) {
-            let measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
+            const measure: StaffMeasure = this.measureList[this.measureListIndex][idx];
             if (measure.endsWithWordRepetition()) {
                 return true;
             }
@@ -811,7 +806,7 @@ export class MusicSystemBuilder {
     private getNextMeasureKeyInstruction(): KeyInstruction {
         if (this.measureListIndex < this.measureList.length - 1) {
             for (let visIndex: number = 0; visIndex < this.measureList[this.measureListIndex].length; visIndex++) {
-                let sourceMeasure: SourceMeasure = this.measureList[this.measureListIndex + 1][visIndex].parentSourceMeasure;
+                const sourceMeasure: SourceMeasure = this.measureList[this.measureListIndex + 1][visIndex].parentSourceMeasure;
                 if (sourceMeasure === undefined) {
                     return undefined;
                 }
@@ -832,9 +827,9 @@ export class MusicSystemBuilder {
             return 1.0;
         }
         let systemEndX: number;
-        let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
+        const currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
         systemEndX = currentSystem.StaffLines[0].PositionAndShape.Size.width;
-        let scalingFactor: number = (systemEndX - systemFixWidth) / systemVarWidth;
+        const scalingFactor: number = (systemEndX - systemFixWidth) / systemVarWidth;
         return scalingFactor;
     }
 
@@ -849,17 +844,17 @@ export class MusicSystemBuilder {
         if (isPartEndingSystem) {
             scalingFactor = Math.min(scalingFactor, this.rules.LastSystemMaxScalingFactor);
         }
-        let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
+        const currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
         for (let visStaffIdx: number = 0, len: number = currentSystem.StaffLines.length; visStaffIdx < len; ++visStaffIdx) {
-            let staffLine: StaffLine = currentSystem.StaffLines[visStaffIdx];
+            const staffLine: StaffLine = currentSystem.StaffLines[visStaffIdx];
             let currentXPosition: number = 0.0;
             for (let measureIndex: number = 0; measureIndex < staffLine.Measures.length; measureIndex++) {
-                let measure: StaffMeasure = staffLine.Measures[measureIndex];
+                const measure: StaffMeasure = staffLine.Measures[measureIndex];
                 measure.setPositionInStaffline(currentXPosition);
                 measure.setWidth(measure.beginInstructionsWidth + measure.minimumStaffEntriesWidth * scalingFactor + measure.endInstructionsWidth);
                 if (measureIndex < this.currentSystemParams.systemMeasures.length) {
-                    let startLine: SystemLinesEnum = this.currentSystemParams.systemMeasures[measureIndex].beginLine;
-                    let lineWidth: number = measure.getLineWidth(SystemLinesEnum.BoldThinDots);
+                    const startLine: SystemLinesEnum = this.currentSystemParams.systemMeasures[measureIndex].beginLine;
+                    const lineWidth: number = measure.getLineWidth(SystemLinesEnum.BoldThinDots);
                     switch (startLine) {
                         case SystemLinesEnum.BoldThinDots:
                             let xPosition: number = currentXPosition;
@@ -874,14 +869,14 @@ export class MusicSystemBuilder {
                 }
                 measure.staffEntriesScaleFactor = scalingFactor;
                 measure.layoutSymbols();
-                let nextMeasureHasRepStartLine: boolean = measureIndex + 1 < this.currentSystemParams.systemMeasures.length
+                const nextMeasureHasRepStartLine: boolean = measureIndex + 1 < this.currentSystemParams.systemMeasures.length
                     && this.currentSystemParams.systemMeasures[measureIndex + 1].beginLine === SystemLinesEnum.BoldThinDots;
                 if (!nextMeasureHasRepStartLine) {
                     let endLine: SystemLinesEnum = SystemLinesEnum.SingleThin;
                     if (measureIndex < this.currentSystemParams.systemMeasures.length) {
                         endLine = this.currentSystemParams.systemMeasures[measureIndex].endLine;
                     }
-                    let lineWidth: number = measure.getLineWidth(endLine);
+                    const lineWidth: number = measure.getLineWidth(endLine);
                     let xPos: number = measure.PositionAndShape.RelativePosition.x + measure.PositionAndShape.BorderRight - lineWidth;
                     if (endLine === SystemLinesEnum.DotsBoldBoldDots) {
                         xPos -= lineWidth / 2;
@@ -901,14 +896,14 @@ export class MusicSystemBuilder {
      * the [[StaffLine]]'s Width and the 5 [[StaffLine]]s length.
      */
     private decreaseMusicSystemBorders(): void {
-        let currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
-        let bb: BoundingBox = CollectionUtil.last(currentSystem.StaffLines[0].Measures).PositionAndShape;
-        let width: number = bb.RelativePosition.x + bb.Size.width;
+        const currentSystem: MusicSystem = this.currentSystemParams.currentSystem;
+        const bb: BoundingBox = CollectionUtil.last(currentSystem.StaffLines[0].Measures).PositionAndShape;
+        const width: number = bb.RelativePosition.x + bb.Size.width;
         for (let idx: number = 0, len: number = currentSystem.StaffLines.length; idx < len; ++idx) {
-            let staffLine: StaffLine = currentSystem.StaffLines[idx];
+            const staffLine: StaffLine = currentSystem.StaffLines[idx];
             staffLine.PositionAndShape.BorderRight = width;
             for (let idx2: number = 0, len2: number = staffLine.StaffLines.length; idx2 < len2; ++idx2) {
-                let graphicalLine: GraphicalLine = staffLine.StaffLines[idx2];
+                const graphicalLine: GraphicalLine = staffLine.StaffLines[idx2];
                 graphicalLine.End = new PointF2D(width, graphicalLine.End.y);
             }
         }

+ 10 - 10
src/MusicalScore/Graphical/SelectionEndSymbol.ts

@@ -11,10 +11,10 @@ export class SelectionEndSymbol extends GraphicalObject {
 
     constructor(system: MusicSystem, xPosition: number) {
         super();
-        let xCoordinate: number = xPosition;
-        let yCoordinate: number = system.PositionAndShape.AbsolutePosition.y;
-        let lineThickness: number = 0.4;
-        let height: number = CollectionUtil.last(system.StaffLines).PositionAndShape.RelativePosition.y + 4;
+        const xCoordinate: number = xPosition;
+        const yCoordinate: number = system.PositionAndShape.AbsolutePosition.y;
+        const lineThickness: number = 0.4;
+        const height: number = CollectionUtil.last(system.StaffLines).PositionAndShape.RelativePosition.y + 4;
         this.verticalLine = new GraphicalLine(
             new PointF2D(xCoordinate, yCoordinate),
             new PointF2D(xCoordinate, yCoordinate + height),
@@ -22,9 +22,9 @@ export class SelectionEndSymbol extends GraphicalObject {
             OutlineAndFillStyleEnum.SelectionSymbol
         );
         for (let idx: number = 0, len: number = system.StaffLines.length; idx < len; ++idx) {
-            let staffLine: StaffLine = system.StaffLines[idx];
-            let anchor: PointF2D = new PointF2D(xCoordinate, yCoordinate + staffLine.PositionAndShape.RelativePosition.y);
-            let arrowPoints: PointF2D[] = new Array(3);
+            const staffLine: StaffLine = system.StaffLines[idx];
+            const anchor: PointF2D = new PointF2D(xCoordinate, yCoordinate + staffLine.PositionAndShape.RelativePosition.y);
+            const arrowPoints: PointF2D[] = new Array(3);
             anchor.y -= .2;
             arrowPoints[0].x = anchor.x - 3;
             arrowPoints[0].y = anchor.y + 1.2;
@@ -33,11 +33,11 @@ export class SelectionEndSymbol extends GraphicalObject {
             arrowPoints[2].x = anchor.x - 2;
             arrowPoints[2].y = anchor.y + 2;
             this.arrows.push(arrowPoints);
-            let linePoints: PointF2D[] = new Array(8);
-            let arrowThickness: number = .8;
+            const linePoints: PointF2D[] = new Array(8);
+            const arrowThickness: number = .8;
             anchor.x -= .1;
             anchor.y += .3;
-            let hilfsVar: number = .2;
+            const hilfsVar: number = .2;
             linePoints[0].x = anchor.x - 2;
             linePoints[0].y = anchor.y + 1.5 - hilfsVar;
             linePoints[1].x = anchor.x - 1;

+ 7 - 7
src/MusicalScore/Graphical/SelectionStartSymbol.ts

@@ -11,10 +11,10 @@ export class SelectionStartSymbol extends GraphicalObject {
 
     constructor(system: MusicSystem, xPosition: number) {
         super();
-        let xCoordinate: number = xPosition;
-        let yCoordinate: number = system.PositionAndShape.AbsolutePosition.y;
-        let lineThickness: number = 0.4;
-        let height: number = CollectionUtil.last(system.StaffLines).PositionAndShape.RelativePosition.y + 4;
+        const xCoordinate: number = xPosition;
+        const yCoordinate: number = system.PositionAndShape.AbsolutePosition.y;
+        const lineThickness: number = 0.4;
+        const height: number = CollectionUtil.last(system.StaffLines).PositionAndShape.RelativePosition.y + 4;
         this.verticalLine = new GraphicalLine(
             new PointF2D(xCoordinate, yCoordinate),
             new PointF2D(xCoordinate, yCoordinate + height),
@@ -22,9 +22,9 @@ export class SelectionStartSymbol extends GraphicalObject {
             OutlineAndFillStyleEnum.SelectionSymbol
         );
         for (let idx: number = 0, len: number = system.StaffLines.length; idx < len; ++idx) {
-            let staffLine: StaffLine = system.StaffLines[idx];
-            let anchor: PointF2D = new PointF2D(xCoordinate, yCoordinate + staffLine.PositionAndShape.RelativePosition.y);
-            let arrowPoints: PointF2D[] = new Array(7);
+            const staffLine: StaffLine = system.StaffLines[idx];
+            const anchor: PointF2D = new PointF2D(xCoordinate, yCoordinate + staffLine.PositionAndShape.RelativePosition.y);
+            const arrowPoints: PointF2D[] = new Array(7);
             arrowPoints[0].x = anchor.x + 4;
             arrowPoints[0].y = anchor.y + 2;
             arrowPoints[1].x = anchor.x + 2.5;

+ 6 - 6
src/MusicalScore/Graphical/StaffLine.ts

@@ -77,11 +77,11 @@ export abstract class StaffLine extends GraphicalObject {
     }
 
     public addActivitySymbolClickArea(): void {
-        let activitySymbol: StaffLineActivitySymbol = new StaffLineActivitySymbol(this);
-        let staffLinePsi: BoundingBox = this.PositionAndShape;
+        const activitySymbol: StaffLineActivitySymbol = new StaffLineActivitySymbol(this);
+        const staffLinePsi: BoundingBox = this.PositionAndShape;
         activitySymbol.PositionAndShape.RelativePosition =
             new PointF2D(staffLinePsi.RelativePosition.x + staffLinePsi.BorderRight + 0.5, staffLinePsi.RelativePosition.y + 0.5);
-        this.parentMusicSystem.PositionAndShape.ChildElements.push(activitySymbol.PositionAndShape);
+        activitySymbol.PositionAndShape.Parent = this.parentMusicSystem.PositionAndShape;
     }
 
     /**
@@ -89,7 +89,7 @@ export abstract class StaffLine extends GraphicalObject {
      * @returns {boolean}
      */
     public isPartOfMultiStaffInstrument(): boolean {
-        let instrument: Instrument = this.parentStaff.ParentInstrument;
+        const instrument: Instrument = this.parentStaff.ParentInstrument;
         if (instrument.Staves.length > 1) {
             return true;
         }
@@ -104,9 +104,9 @@ export abstract class StaffLine extends GraphicalObject {
     public findClosestStaffEntry(xPosition: number): GraphicalStaffEntry {
         let closestStaffentry: GraphicalStaffEntry = undefined;
         for (let idx: number = 0, len: number = this.Measures.length; idx < len; ++idx) {
-            let graphicalMeasure: StaffMeasure = this.Measures[idx];
+            const graphicalMeasure: StaffMeasure = this.Measures[idx];
             for (let idx2: number = 0, len2: number = graphicalMeasure.staffEntries.length; idx2 < len2; ++idx2) {
-                let graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx2];
+                const graphicalStaffEntry: GraphicalStaffEntry = graphicalMeasure.staffEntries[idx2];
                 if (
                     Math.abs(graphicalStaffEntry.PositionAndShape.RelativePosition.x - xPosition + graphicalMeasure.PositionAndShape.RelativePosition.x) < 5.0
                 ) {

+ 1 - 1
src/MusicalScore/Graphical/StaffLineActivitySymbol.ts

@@ -7,7 +7,7 @@ export class StaffLineActivitySymbol extends GraphicalObject {
     constructor(staffLine: StaffLine) {
         super();
         this.parentStaffLine = staffLine;
-        let staffLinePsi: BoundingBox = staffLine.PositionAndShape;
+        const staffLinePsi: BoundingBox = staffLine.PositionAndShape;
         this.boundingBox = new BoundingBox(this, staffLinePsi);
         this.boundingBox.BorderRight = 6;
         this.boundingBox.BorderBottom = 4.5;

+ 18 - 20
src/MusicalScore/Graphical/StaffMeasure.ts

@@ -182,7 +182,7 @@ export abstract class StaffMeasure extends GraphicalObject {
 
     public findGraphicalStaffEntryFromTimestamp(relativeTimestamp: Fraction): GraphicalStaffEntry {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             if (graphicalStaffEntry.relInMeasureTimestamp.Equals(relativeTimestamp)) {
                 return graphicalStaffEntry;
             }
@@ -197,7 +197,7 @@ export abstract class StaffMeasure extends GraphicalObject {
      */
     public findGraphicalStaffEntryFromVerticalContainerTimestamp(absoluteTimestamp: Fraction): GraphicalStaffEntry {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             if (graphicalStaffEntry.sourceStaffEntry.VerticalContainerParent.getAbsoluteTimestamp().Equals(absoluteTimestamp)) {
                 return graphicalStaffEntry;
             }
@@ -210,9 +210,9 @@ export abstract class StaffMeasure extends GraphicalObject {
      * @returns {boolean}
      */
     public hasSameDurationWithSourceMeasureParent(): boolean {
-        let duration: Fraction = new Fraction(0, 1);
+        const duration: Fraction = new Fraction(0, 1);
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             duration.Add(graphicalStaffEntry.findStaffEntryMinNoteLength());
         }
         return duration.Equals(this.parentSourceMeasure.Duration);
@@ -226,11 +226,11 @@ export abstract class StaffMeasure extends GraphicalObject {
         if (this.staffEntries.length === 0) {
             return false;
         }
-        let voices: Voice[] = [];
+        const voices: Voice[] = [];
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let staffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const staffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             for (let idx2: number = 0, len2: number = staffEntry.sourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
-                let voiceEntry: VoiceEntry = staffEntry.sourceStaffEntry.VoiceEntries[idx2];
+                const voiceEntry: VoiceEntry = staffEntry.sourceStaffEntry.VoiceEntries[idx2];
                 if (voices.indexOf(voiceEntry.ParentVoice) < 0) {
                     voices.push(voiceEntry.ParentVoice);
                 }
@@ -248,23 +248,23 @@ export abstract class StaffMeasure extends GraphicalObject {
 
     public getGraphicalMeasureDurationFromStaffEntries(): Fraction {
         let duration: Fraction = new Fraction(0, 1);
-        let voices: Voice[] = [];
+        const voices: Voice[] = [];
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             for (let idx2: number = 0, len2: number = graphicalStaffEntry.sourceStaffEntry.VoiceEntries.length; idx2 < len2; ++idx2) {
-                let voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx2];
+                const voiceEntry: VoiceEntry = graphicalStaffEntry.sourceStaffEntry.VoiceEntries[idx2];
                 if (voices.indexOf(voiceEntry.ParentVoice) < 0) {
                     voices.push(voiceEntry.ParentVoice);
                 }
             }
         }
         for (let idx: number = 0, len: number = voices.length; idx < len; ++idx) {
-            let voice: Voice = voices[idx];
-            let voiceDuration: Fraction = new Fraction(0, 1);
+            const voice: Voice = voices[idx];
+            const voiceDuration: Fraction = new Fraction(0, 1);
             for (let idx2: number = 0, len2: number = this.staffEntries.length; idx2 < len2; ++idx2) {
-                let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx2];
+                const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx2];
                 for (let idx3: number = 0, len3: number = graphicalStaffEntry.notes.length; idx3 < len3; ++idx3) {
-                    let graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx3];
+                    const graphicalNotes: GraphicalNote[] = graphicalStaffEntry.notes[idx3];
                     if (graphicalNotes.length > 0 && graphicalNotes[0].sourceNote.ParentVoiceEntry.ParentVoice === voice) {
                         voiceDuration.Add(graphicalNotes[0].graphicalNoteLength);
                     }
@@ -279,7 +279,6 @@ export abstract class StaffMeasure extends GraphicalObject {
 
     public addGraphicalStaffEntry(graphicalStaffEntry: GraphicalStaffEntry): void {
         this.staffEntries.push(graphicalStaffEntry);
-        this.PositionAndShape.ChildElements.push(graphicalStaffEntry.PositionAndShape);
     }
 
     /**
@@ -301,12 +300,11 @@ export abstract class StaffMeasure extends GraphicalObject {
                     }
                 }
             }
-            this.PositionAndShape.ChildElements.push(staffEntry.PositionAndShape);
         }
     }
 
     public beginsWithLineRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
         if (sourceMeasure === undefined) {
             return false;
         }
@@ -318,7 +316,7 @@ export abstract class StaffMeasure extends GraphicalObject {
      * @returns {boolean}
      */
     public endsWithLineRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
         if (sourceMeasure === undefined) {
             return false;
         }
@@ -330,7 +328,7 @@ export abstract class StaffMeasure extends GraphicalObject {
      * @returns {boolean}
      */
     public beginsWithWordRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
         if (sourceMeasure === undefined) {
             return false;
         }
@@ -341,7 +339,7 @@ export abstract class StaffMeasure extends GraphicalObject {
      * Check if this Measure is a Repetition Ending.
      */
     public endsWithWordRepetition(): boolean {
-        let sourceMeasure: SourceMeasure = this.parentSourceMeasure;
+        const sourceMeasure: SourceMeasure = this.parentSourceMeasure;
         if (sourceMeasure === undefined) {
             return false;
         }

+ 3 - 3
src/MusicalScore/Graphical/VerticalGraphicalStaffEntryContainer.ts

@@ -38,8 +38,8 @@ export class VerticalGraphicalStaffEntryContainer {
     }
 
     public static compareByTimestamp(x: VerticalGraphicalStaffEntryContainer, y: VerticalGraphicalStaffEntryContainer): number {
-        let xValue: number = x.absoluteTimestamp.RealValue;
-        let yValue: number = y.absoluteTimestamp.RealValue;
+        const xValue: number = x.absoluteTimestamp.RealValue;
+        const yValue: number = y.absoluteTimestamp.RealValue;
 
         if (xValue < yValue) {
             return -1;
@@ -56,7 +56,7 @@ export class VerticalGraphicalStaffEntryContainer {
      */
     public getFirstNonNullStaffEntry(): GraphicalStaffEntry {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
+            const graphicalStaffEntry: GraphicalStaffEntry = this.staffEntries[idx];
             if (graphicalStaffEntry !== undefined) {
                 return graphicalStaffEntry;
             }

+ 5 - 3
src/MusicalScore/Graphical/VexFlow/CanvasVexFlowBackend.ts

@@ -43,7 +43,7 @@ export class CanvasVexFlowBackend extends VexFlowBackend {
     }
     public renderText(fontHeight: number, fontStyle: FontStyles, font: Fonts, text: string,
                       heightInPixel: number, screenPosition: PointF2D): void  {
-        let old: string = this.canvasRenderingCtx.font;
+        const old: string = this.canvasRenderingCtx.font;
         this.canvasRenderingCtx.font = VexFlowConverter.font(
             fontHeight,
             fontStyle,
@@ -52,11 +52,13 @@ export class CanvasVexFlowBackend extends VexFlowBackend {
         this.canvasRenderingCtx.fillText(text, screenPosition.x, screenPosition.y + heightInPixel);
         this.canvasRenderingCtx.font = old;
     }
-    public renderRectangle(rectangle: RectangleF2D, styleId: number): void {
-        let old: string | CanvasGradient | CanvasPattern = this.canvasRenderingCtx.fillStyle;
+    public renderRectangle(rectangle: RectangleF2D, styleId: number, alpha: number = 1): void {
+        const old: string | CanvasGradient | CanvasPattern = this.canvasRenderingCtx.fillStyle;
         this.canvasRenderingCtx.fillStyle = VexFlowConverter.style(styleId);
+        this.canvasRenderingCtx.globalAlpha = alpha;
         this.ctx.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
         this.canvasRenderingCtx.fillStyle = old;
+        this.canvasRenderingCtx.globalAlpha = 1;
     }
 
     private ctx: Vex.Flow.CanvasContext;

+ 6 - 1
src/MusicalScore/Graphical/VexFlow/SvgVexFlowBackend.ts

@@ -58,8 +58,13 @@ export class SvgVexFlowBackend extends VexFlowBackend {
         this.ctx.fillText(text, screenPosition.x, screenPosition.y + heightInPixel);
         this.ctx.restore();
     }
-    public renderRectangle(rectangle: RectangleF2D, styleId: number): void {
+    public renderRectangle(rectangle: RectangleF2D, styleId: number, alpha: number = 1): void {
+        this.ctx.save();
+        this.ctx.attributes.fill = VexFlowConverter.style(styleId);
+        this.ctx.attributes["fill-opacity"] = alpha;
         this.ctx.fillRect(rectangle.x, rectangle.y, rectangle.width, rectangle.height);
+        this.ctx.restore();
+        this.ctx.attributes["fill-opacity"] = 1;
     }
 
     private ctx: Vex.Flow.SVGContext;

+ 9 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowBackend.ts

@@ -44,7 +44,15 @@ export abstract class VexFlowBackend {
   public abstract translate(x: number, y: number): void;
   public abstract renderText(fontHeight: number, fontStyle: FontStyles, font: Fonts, text: string,
                              heightInPixel: number, screenPosition: PointF2D): void;
-  public abstract renderRectangle(rectangle: RectangleF2D, styleId: number): void;
+  /**
+   * Renders a rectangle with the given style to the screen.
+   * It is given in screen coordinates.
+   * @param rectangle the rect in screen coordinates
+   * @param layer is the current rendering layer. There are many layers on top of each other to which can be rendered. Not needed for now.
+   * @param styleId the style id
+   * @param alpha alpha value between 0 and 1
+   */
+  public abstract renderRectangle(rectangle: RectangleF2D, styleId: number, alpha: number): void;
 
   public abstract getBackendType(): number;
 

+ 15 - 15
src/MusicalScore/Graphical/VexFlow/VexFlowConverter.ts

@@ -14,7 +14,7 @@ import {GraphicalNote} from "../GraphicalNote";
 import {SystemLinesEnum} from "../SystemLinesEnum";
 import {FontStyles} from "../../../Common/Enums/FontStyles";
 import {Fonts} from "../../../Common/Enums/Fonts";
-import {OutlineAndFillStyleEnum} from "../DrawingEnums";
+import {OutlineAndFillStyleEnum, OUTLINE_AND_FILL_STYLE_DICT} from "../DrawingEnums";
 import {Logging} from "../../../Common/Logging";
 
 /**
@@ -45,7 +45,7 @@ export class VexFlowConverter {
      * @returns {string}
      */
     public static duration(fraction: Fraction, isTuplet: boolean): string {
-      let dur: number = fraction.RealValue;
+      const dur: number = fraction.RealValue;
 
       if (dur >= 1) {
           return "w";
@@ -100,10 +100,10 @@ export class VexFlowConverter {
      * @returns {string[]}
      */
     public static pitch(pitch: Pitch, clef: ClefInstruction): [string, string, ClefInstruction] {
-        let fund: string = NoteEnum[pitch.FundamentalNote].toLowerCase();
+        const fund: string = NoteEnum[pitch.FundamentalNote].toLowerCase();
         // The octave seems to need a shift of three FIXME?
-        let octave: number = pitch.Octave - clef.OctaveOffset + 3;
-        let acc: string = VexFlowConverter.accidental(pitch.Accidental);
+        const octave: number = pitch.Octave - clef.OctaveOffset + 3;
+        const acc: string = VexFlowConverter.accidental(pitch.Accidental);
         return [fund + "n/" + octave, acc, clef];
     }
 
@@ -142,14 +142,14 @@ export class VexFlowConverter {
      */
     public static StaveNote(notes: GraphicalNote[]): Vex.Flow.StaveNote {
         let keys: string[] = [];
-        let accidentals: string[] = [];
-        let frac: Fraction = notes[0].graphicalNoteLength;
-        let isTuplet: boolean = notes[0].sourceNote.NoteTuplet !== undefined;
+        const accidentals: string[] = [];
+        const frac: Fraction = notes[0].graphicalNoteLength;
+        const isTuplet: boolean = notes[0].sourceNote.NoteTuplet !== undefined;
         let duration: string = VexFlowConverter.duration(frac, isTuplet);
         let vfClefType: string = undefined;
         let numDots: number = 0;
-        for (let note of notes) {
-            let pitch: [string, string, ClefInstruction] = (note as VexFlowGraphicalNote).vfpitch;
+        for (const note of notes) {
+            const pitch: [string, string, ClefInstruction] = (note as VexFlowGraphicalNote).vfpitch;
             if (pitch === undefined) { // if it is a rest:
               keys = ["b/4"];
               duration += "r";
@@ -158,7 +158,7 @@ export class VexFlowConverter {
             keys.push(pitch[0]);
             accidentals.push(pitch[1]);
             if (!vfClefType) {
-                let vfClef: {type: string, annotation: string} = VexFlowConverter.Clef(pitch[2]);
+                const vfClef: {type: string, annotation: string} = VexFlowConverter.Clef(pitch[2]);
                 vfClefType = vfClef.type;
             }
             if (numDots < note.numberOfDots) {
@@ -169,7 +169,7 @@ export class VexFlowConverter {
             duration += "d";
         }
 
-        let vfnote: Vex.Flow.StaveNote = new Vex.Flow.StaveNote({
+        const vfnote: Vex.Flow.StaveNote = new Vex.Flow.StaveNote({
             auto_stem: true,
             clef: vfClefType,
             duration: duration,
@@ -376,7 +376,7 @@ export class VexFlowConverter {
     public static font(fontSize: number, fontStyle: FontStyles = FontStyles.Regular, font: Fonts = Fonts.TimesNewRoman): string {
         let style: string = "normal";
         let weight: string = "normal";
-        let family: string = "'Times New Roman'";
+        const family: string = "'Times New Roman'";
 
         switch (fontStyle) {
             case FontStyles.Bold:
@@ -430,7 +430,7 @@ export class VexFlowConverter {
      * @returns {string}
      */
     public static style(styleId: OutlineAndFillStyleEnum): string {
-        // TODO To be implemented
-        return "lightgreen";
+        const ret: string = OUTLINE_AND_FILL_STYLE_DICT.getValue(styleId);
+        return ret;
     }
 }

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalNote.ts

@@ -36,7 +36,7 @@ export class VexFlowGraphicalNote extends GraphicalNote {
      */
     public setPitch(pitch: Pitch): void {
         if (this.vfnote) {
-            let acc: string = VexFlowConverter.accidental(pitch.Accidental);
+            const acc: string = VexFlowConverter.accidental(pitch.Accidental);
             if (acc) {
                 alert(acc);
                 this.vfnote[0].addAccidental(this.vfnote[1], new Vex.Flow.Accidental(acc));

+ 17 - 7
src/MusicalScore/Graphical/VexFlow/VexFlowGraphicalSymbolFactory.ts

@@ -21,6 +21,7 @@ import {Fraction} from "../../../Common/DataObjects/Fraction";
 import {GraphicalChordSymbolContainer} from "../GraphicalChordSymbolContainer";
 import {GraphicalLabel} from "../GraphicalLabel";
 import {EngravingRules} from "../EngravingRules";
+import { TechnicalInstruction } from "../../VoiceData/Instructions/TechnicalInstruction";
 
 export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
     /**
@@ -97,11 +98,11 @@ export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
     public createNote(note: Note, graphicalStaffEntry: GraphicalStaffEntry,
                       activeClef: ClefInstruction, octaveShift: OctaveEnum = OctaveEnum.NONE,  graphicalNoteLength: Fraction = undefined): GraphicalNote {
         // Creates the note:
-        let graphicalNote: GraphicalNote = new VexFlowGraphicalNote(note, graphicalStaffEntry, activeClef, octaveShift, graphicalNoteLength);
+        const graphicalNote: GraphicalNote = new VexFlowGraphicalNote(note, graphicalStaffEntry, activeClef, octaveShift, graphicalNoteLength);
         if (note.ParentVoiceEntry !== undefined) {
             // Adds the note to the right (graphical) voice (mynotes)
-            let voiceID: number = note.ParentVoiceEntry.ParentVoice.VoiceId;
-            let mynotes: { [id: number]: GraphicalNote[]; } = (graphicalStaffEntry as VexFlowStaffEntry).graphicalNotes;
+            const voiceID: number = note.ParentVoiceEntry.ParentVoice.VoiceId;
+            const mynotes: { [id: number]: GraphicalNote[]; } = (graphicalStaffEntry as VexFlowStaffEntry).graphicalNotes;
             if (!(voiceID in mynotes)) {
                 mynotes[voiceID] = [];
             }
@@ -134,7 +135,7 @@ export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
      */
     public addGraphicalAccidental(graphicalNote: GraphicalNote, pitch: Pitch, grace: boolean, graceScalingFactor: number): void {
         // ToDo: set accidental here from pitch.Accidental
-        let note: VexFlowGraphicalNote = (graphicalNote as VexFlowGraphicalNote);
+        const note: VexFlowGraphicalNote = (graphicalNote as VexFlowGraphicalNote);
         note.setPitch(pitch);
     }
 
@@ -167,15 +168,24 @@ export class VexFlowGraphicalSymbolFactory implements IGraphicalSymbolFactory {
      * @param transposeHalftones
      */
     public createChordSymbol(sourceStaffEntry: SourceStaffEntry, graphicalStaffEntry: GraphicalStaffEntry, transposeHalftones: number): void {
-      let graphicalChordSymbolContainer: GraphicalChordSymbolContainer =
+      const graphicalChordSymbolContainer: GraphicalChordSymbolContainer =
         new GraphicalChordSymbolContainer(sourceStaffEntry.ChordContainer,
                                           graphicalStaffEntry.PositionAndShape,
                                           EngravingRules.Rules.ChordSymbolTextHeight,
                                           transposeHalftones);
-      let graphicalLabel: GraphicalLabel = graphicalChordSymbolContainer.GetGraphicalLabel;
+      const graphicalLabel: GraphicalLabel = graphicalChordSymbolContainer.GetGraphicalLabel;
       graphicalLabel.setLabelPositionAndShapeBorders();
       graphicalChordSymbolContainer.PositionAndShape.calculateBoundingBox();
       graphicalStaffEntry.graphicalChordContainer = graphicalChordSymbolContainer;
-      graphicalStaffEntry.PositionAndShape.ChildElements.push(graphicalChordSymbolContainer.PositionAndShape);
     }
+
+    /**
+     * Adds a technical instruction at the given staff entry.
+     * @param technicalInstruction
+     * @param graphicalStaffEntry
+     */
+    public createGraphicalTechnicalInstruction(technicalInstruction: TechnicalInstruction, graphicalStaffEntry: GraphicalStaffEntry): void {
+        return;
+    }
+
 }

+ 42 - 0
src/MusicalScore/Graphical/VexFlow/VexFlowInstrumentBracket.ts

@@ -0,0 +1,42 @@
+import Vex = require("vexflow");
+import {GraphicalObject} from "../GraphicalObject";
+import {VexFlowStaffLine} from "./VexFlowStaffLine";
+import { BoundingBox } from "../BoundingBox";
+import { VexFlowMeasure } from "./VexFlowMeasure";
+
+/**
+ * Class that defines a instrument bracket at the beginning of a line.
+ */
+export class VexFlowInstrumentBracket extends GraphicalObject {
+
+    private vexflowConnector: Vex.Flow.StaveConnector;
+
+    constructor(firstVexFlowStaffLine: VexFlowStaffLine, lastVexFlowStaffLine: VexFlowStaffLine) {
+        super();
+        // FIXME: B.Giesinger: Fill in sizes after calculation
+        this.boundingBox = new BoundingBox(this);
+        const firstVexMeasure: VexFlowMeasure = firstVexFlowStaffLine.Measures[0] as VexFlowMeasure;
+        const lastVexMeasure: VexFlowMeasure = lastVexFlowStaffLine.Measures[0] as VexFlowMeasure;
+        this.addConnector(firstVexMeasure.getVFStave(), lastVexMeasure.getVFStave(), Vex.Flow.StaveConnector.type.BRACE);
+    }
+
+    /**
+     * Render the bracket using the given backend
+     * @param ctx Render Vexflow context
+     */
+    public draw(ctx: Vex.Flow.RenderContext): void {
+        this.vexflowConnector.setContext(ctx).draw();
+    }
+
+    /**
+     * Adds a connector between two staves
+     *
+     * @param {Stave} stave1: First stave
+     * @param {Stave} stave2: Second stave
+     * @param {Flow.StaveConnector.type} type: Type of connector
+     */
+    private addConnector(stave1: Vex.Flow.Stave, stave2: Vex.Flow.Stave, type: any): void {
+        this.vexflowConnector = new Vex.Flow.StaveConnector(stave1, stave2)
+        .setType(type);
+    }
+}

+ 40 - 40
src/MusicalScore/Graphical/VexFlow/VexFlowMeasure.ts

@@ -82,7 +82,7 @@ export class VexFlowMeasure extends StaffMeasure {
      */
     public getLineWidth(line: SystemLinesEnum): number {
         // FIXME: See values in VexFlow's stavebarline.js
-        let vfline: any = VexFlowConverter.line(line);
+        const vfline: any = VexFlowConverter.line(line);
         switch (vfline) {
             case Vex.Flow.StaveConnector.type.SINGLE:
                 return 1.0 / unitInPixels;
@@ -100,7 +100,7 @@ export class VexFlowMeasure extends StaffMeasure {
      */
     public addClefAtBegin(clef: ClefInstruction): void {
         this.octaveOffset = clef.OctaveOffset;
-        let vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "default");
+        const vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "default");
         this.stave.addClef(vfclef.type, vfclef.size, vfclef.annotation, Vex.Flow.Modifier.Position.BEGIN);
         this.updateInstructionWidth();
     }
@@ -127,7 +127,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param rhythm
      */
     public addRhythmAtBegin(rhythm: RhythmInstruction): void {
-        let timeSig: Vex.Flow.TimeSignature = VexFlowConverter.TimeSignature(rhythm);
+        const timeSig: Vex.Flow.TimeSignature = VexFlowConverter.TimeSignature(rhythm);
         this.stave.addModifier(
             timeSig,
             Vex.Flow.Modifier.Position.BEGIN
@@ -141,7 +141,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param clef
      */
     public addClefAtEnd(clef: ClefInstruction): void {
-        let vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "small");
+        const vfclef: { type: string, size: string, annotation: string } = VexFlowConverter.Clef(clef, "small");
         this.stave.setEndClef(vfclef.type, vfclef.size, vfclef.annotation);
         this.updateInstructionWidth();
     }
@@ -194,36 +194,36 @@ export class VexFlowMeasure extends StaffMeasure {
         // Draw stave lines
         this.stave.setContext(ctx).draw();
         // Draw all voices
-        for (let voiceID in this.vfVoices) {
+        for (const voiceID in this.vfVoices) {
             if (this.vfVoices.hasOwnProperty(voiceID)) {
                 this.vfVoices[voiceID].draw(ctx, this.stave);
             }
         }
         // Draw beams
-        for (let voiceID in this.vfbeams) {
+        for (const voiceID in this.vfbeams) {
             if (this.vfbeams.hasOwnProperty(voiceID)) {
-                for (let beam of this.vfbeams[voiceID]) {
+                for (const beam of this.vfbeams[voiceID]) {
                     beam.setContext(ctx).draw();
                 }
             }
         }
 
         // Draw tuplets
-        for (let voiceID in this.vftuplets) {
+        for (const voiceID in this.vftuplets) {
             if (this.vftuplets.hasOwnProperty(voiceID)) {
-                for (let tuplet of this.vftuplets[voiceID]) {
+                for (const tuplet of this.vftuplets[voiceID]) {
                     tuplet.setContext(ctx).draw();
                 }
             }
         }
 
         // Draw ties
-        for (let tie of this.vfTies) {
+        for (const tie of this.vfTies) {
             tie.setContext(ctx).draw();
         }
 
         // Draw vertical lines
-        for (let connector of this.connectors) {
+        for (const connector of this.connectors) {
             connector.setContext(ctx).draw();
         }
 
@@ -237,13 +237,13 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param beam
      */
     public handleBeam(graphicalNote: GraphicalNote, beam: Beam): void {
-        let voiceID: number = graphicalNote.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;
+        const voiceID: number = graphicalNote.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;
         let beams: [Beam, VexFlowStaffEntry[]][] = this.beams[voiceID];
         if (beams === undefined) {
             beams = this.beams[voiceID] = [];
         }
         let data: [Beam, VexFlowStaffEntry[]];
-        for (let mybeam of beams) {
+        for (const mybeam of beams) {
             if (mybeam[0] === beam) {
                 data = mybeam;
             }
@@ -252,21 +252,21 @@ export class VexFlowMeasure extends StaffMeasure {
             data = [beam, []];
             beams.push(data);
         }
-        let parent: VexFlowStaffEntry = graphicalNote.parentStaffEntry as VexFlowStaffEntry;
+        const parent: VexFlowStaffEntry = graphicalNote.parentStaffEntry as VexFlowStaffEntry;
         if (data[1].indexOf(parent) < 0) {
             data[1].push(parent);
         }
     }
 
     public handleTuplet(graphicalNote: GraphicalNote, tuplet: Tuplet): void {
-        let voiceID: number = graphicalNote.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;
+        const voiceID: number = graphicalNote.sourceNote.ParentVoiceEntry.ParentVoice.VoiceId;
         tuplet = graphicalNote.sourceNote.NoteTuplet;
         let tuplets: [Tuplet, VexFlowStaffEntry[]][] = this.tuplets[voiceID];
         if (tuplets === undefined) {
             tuplets = this.tuplets[voiceID] = [];
         }
         let currentTupletBuilder: [Tuplet, VexFlowStaffEntry[]];
-        for (let t of tuplets) {
+        for (const t of tuplets) {
             if (t[0] === tuplet) {
                 currentTupletBuilder = t;
             }
@@ -275,7 +275,7 @@ export class VexFlowMeasure extends StaffMeasure {
             currentTupletBuilder = [tuplet, []];
             tuplets.push(currentTupletBuilder);
         }
-        let parent: VexFlowStaffEntry = graphicalNote.parentStaffEntry as VexFlowStaffEntry;
+        const parent: VexFlowStaffEntry = graphicalNote.parentStaffEntry as VexFlowStaffEntry;
         if (currentTupletBuilder[1].indexOf(parent) < 0) {
             currentTupletBuilder[1].push(parent);
         }
@@ -289,16 +289,16 @@ export class VexFlowMeasure extends StaffMeasure {
         // created them brand new. Is this needed? And more importantly,
         // should the old beams be removed manually by the notes?
         this.vfbeams = {};
-        for (let voiceID in this.beams) {
+        for (const voiceID in this.beams) {
             if (this.beams.hasOwnProperty(voiceID)) {
                 let vfbeams: Vex.Flow.Beam[] = this.vfbeams[voiceID];
                 if (vfbeams === undefined) {
                     vfbeams = this.vfbeams[voiceID] = [];
                 }
-                for (let beam of this.beams[voiceID]) {
-                    let notes: Vex.Flow.StaveNote[] = [];
-                    for (let entry of beam[1]) {
-                        let note: Vex.Flow.StaveNote = (<VexFlowStaffEntry>entry).vfNotes[voiceID];
+                for (const beam of this.beams[voiceID]) {
+                    const notes: Vex.Flow.StaveNote[] = [];
+                    for (const entry of beam[1]) {
+                        const note: Vex.Flow.StaveNote = (<VexFlowStaffEntry>entry).vfNotes[voiceID];
                         if (note !== undefined) {
                           notes.push(note);
                         }
@@ -325,20 +325,20 @@ export class VexFlowMeasure extends StaffMeasure {
         // created them brand new. Is this needed? And more importantly,
         // should the old tuplets be removed manually from the notes?
         this.vftuplets = {};
-        for (let voiceID in this.tuplets) {
+        for (const voiceID in this.tuplets) {
             if (this.tuplets.hasOwnProperty(voiceID)) {
                 let vftuplets: Vex.Flow.Tuplet[] = this.vftuplets[voiceID];
                 if (vftuplets === undefined) {
                     vftuplets = this.vftuplets[voiceID] = [];
                 }
-                for (let tupletBuilder of this.tuplets[voiceID]) {
-                    let tupletStaveNotes: Vex.Flow.StaveNote[] = [];
-                    let tupletStaffEntries: VexFlowStaffEntry[] = tupletBuilder[1];
-                    for (let tupletStaffEntry of tupletStaffEntries) {
+                for (const tupletBuilder of this.tuplets[voiceID]) {
+                    const tupletStaveNotes: Vex.Flow.StaveNote[] = [];
+                    const tupletStaffEntries: VexFlowStaffEntry[] = tupletBuilder[1];
+                    for (const tupletStaffEntry of tupletStaffEntries) {
                       tupletStaveNotes.push((tupletStaffEntry).vfNotes[voiceID]);
                     }
                     if (tupletStaveNotes.length > 1) {
-                      let notesOccupied: number = 2;
+                      const notesOccupied: number = 2;
                       vftuplets.push(new Vex.Flow.Tuplet( tupletStaveNotes,
                                                           {
                                                             notes_occupied: notesOccupied,
@@ -358,13 +358,13 @@ export class VexFlowMeasure extends StaffMeasure {
 
     public staffMeasureCreatedCalculations(): void {
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry);
+            const graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry);
 
             // create vex flow Notes:
-            let gnotes: { [voiceID: number]: GraphicalNote[]; } = graphicalStaffEntry.graphicalNotes;
-            for (let voiceID in gnotes) {
+            const gnotes: { [voiceID: number]: GraphicalNote[]; } = graphicalStaffEntry.graphicalNotes;
+            for (const voiceID in gnotes) {
                 if (gnotes.hasOwnProperty(voiceID)) {
-                    let vfnote: StaveNote = VexFlowConverter.StaveNote(gnotes[voiceID]);
+                    const vfnote: StaveNote = VexFlowConverter.StaveNote(gnotes[voiceID]);
                     (graphicalStaffEntry as VexFlowStaffEntry).vfNotes[voiceID] = vfnote;
                 }
             }
@@ -374,11 +374,11 @@ export class VexFlowMeasure extends StaffMeasure {
         this.finalizeTuplets();
 
         for (let idx: number = 0, len: number = this.staffEntries.length; idx < len; ++idx) {
-            let graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry);
-            let gnotes: { [voiceID: number]: GraphicalNote[]; } = graphicalStaffEntry.graphicalNotes;
+            const graphicalStaffEntry: VexFlowStaffEntry = (this.staffEntries[idx] as VexFlowStaffEntry);
+            const gnotes: { [voiceID: number]: GraphicalNote[]; } = graphicalStaffEntry.graphicalNotes;
             // create vex flow voices and add tickables to it:
-            let vfVoices: { [voiceID: number]: Vex.Flow.Voice; } = this.vfVoices;
-            for (let voiceID in gnotes) {
+            const vfVoices: { [voiceID: number]: Vex.Flow.Voice; } = this.vfVoices;
+            for (const voiceID in gnotes) {
                 if (gnotes.hasOwnProperty(voiceID)) {
                     if (!(voiceID in vfVoices)) {
                         vfVoices[voiceID] = new Vex.Flow.Voice({
@@ -400,7 +400,7 @@ export class VexFlowMeasure extends StaffMeasure {
      * @param lineType
      */
     public lineTo(top: VexFlowMeasure, lineType: any): void {
-        let connector: StaveConnector = new Vex.Flow.StaveConnector(top.getVFStave(), this.stave);
+        const connector: StaveConnector = new Vex.Flow.StaveConnector(top.getVFStave(), this.stave);
         connector.setType(lineType);
         this.connectors.push(connector);
     }
@@ -446,9 +446,9 @@ export class VexFlowMeasure extends StaffMeasure {
      */
     private setStaffEntriesXPositions(): void {
         for (let idx3: number = 0, len3: number = this.staffEntries.length; idx3 < len3; ++idx3) {
-            let gse: VexFlowStaffEntry = (<VexFlowStaffEntry> this.staffEntries[idx3]);
-            let measure: StaffMeasure = gse.parentMeasure;
-            let x: number =
+            const gse: VexFlowStaffEntry = (<VexFlowStaffEntry> this.staffEntries[idx3]);
+            const measure: StaffMeasure = gse.parentMeasure;
+            const x: number =
                 gse.getX() -
                 measure.PositionAndShape.RelativePosition.x -
                 measure.ParentStaffLine.PositionAndShape.RelativePosition.x -

+ 42 - 44
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetCalculator.ts

@@ -34,15 +34,13 @@ import {TechnicalInstruction} from "../../VoiceData/Instructions/TechnicalInstru
 export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
   constructor() {
     super(new VexFlowGraphicalSymbolFactory());
-    let a: LyricsEntry = new LyricsEntry(undefined, undefined, undefined);
-    a = a;
     MusicSheetCalculator.TextMeasurer = new VexFlowTextMeasurer();
   }
 
   protected clearRecreatedObjects(): void {
     super.clearRecreatedObjects();
-    for (let staffMeasures of this.graphicalMusicSheet.MeasureList) {
-      for (let staffMeasure of staffMeasures) {
+    for (const staffMeasures of this.graphicalMusicSheet.MeasureList) {
+            for (const staffMeasure of staffMeasures) {
         (<VexFlowMeasure>staffMeasure).clean();
       }
     }
@@ -70,44 +68,44 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
      (measure as VexFlowMeasure).finalizeTuplets();
      }*/
     // Format the voices
-    let allVoices: Vex.Flow.Voice[] = [];
-    let formatter: Vex.Flow.Formatter = new Vex.Flow.Formatter({
+        const allVoices: Vex.Flow.Voice[] = [];
+        const formatter: Vex.Flow.Formatter = new Vex.Flow.Formatter({
       align_rests: true,
     });
 
-    for (let measure of measures) {
-      let mvoices: { [voiceID: number]: Vex.Flow.Voice; } = (measure as VexFlowMeasure).vfVoices;
-      let voices: Vex.Flow.Voice[] = [];
-      for (let voiceID in mvoices) {
+        for (const measure of measures) {
+            const mvoices:  { [voiceID: number]: Vex.Flow.Voice; } = (measure as VexFlowMeasure).vfVoices;
+            const voices: Vex.Flow.Voice[] = [];
+            for (const voiceID in mvoices) {
         if (mvoices.hasOwnProperty(voiceID)) {
           voices.push(mvoices[voiceID]);
           allVoices.push(mvoices[voiceID]);
 
         }
       }
-      if (voices.length === 0) {
+            if (voices.length === 0) {
         Logging.warn("Found a measure with no voices... Continuing anyway.", mvoices);
         continue;
       }
-      formatter.joinVoices(voices);
+            formatter.joinVoices(voices);
     }
 
-    let width: number = 200;
-    if (allVoices.length > 0) {
-      let firstMeasure: VexFlowMeasure = measures[0] as VexFlowMeasure;
+        let width: number = 200;
+        if (allVoices.length > 0) {
+            const firstMeasure: VexFlowMeasure = measures[0] as VexFlowMeasure;
       // FIXME: The following ``+ 5.0'' is temporary: it was added as a workaround for
       // FIXME: a more relaxed formatting of voices
-      width = formatter.preCalculateMinTotalWidth(allVoices) / unitInPixels + 5.0;
-      for (let measure of measures) {
+            width = formatter.preCalculateMinTotalWidth(allVoices) / unitInPixels + 5.0;
+            for (const measure of measures) {
         measure.minimumStaffEntriesWidth = width;
         (measure as VexFlowMeasure).formatVoices = undefined;
       }
-      firstMeasure.formatVoices = (w: number) => {
+            firstMeasure.formatVoices = (w: number) => {
         formatter.format(allVoices, w);
       };
     }
 
-    return width;
+        return width;
   }
 
   protected createGraphicalTie(tie: Tie, startGse: GraphicalStaffEntry, endGse: GraphicalStaffEntry,
@@ -158,23 +156,23 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
    */
   protected calculateSystemYLayout(): void {
     for (let idx: number = 0, len: number = this.graphicalMusicSheet.MusicPages.length; idx < len; ++idx) {
-      let graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
-      if (!this.leadSheet) {
+            const graphicalMusicPage: GraphicalMusicPage = this.graphicalMusicSheet.MusicPages[idx];
+            if (!this.leadSheet) {
         let globalY: number = this.rules.PageTopMargin + this.rules.TitleTopDistance + this.rules.SheetTitleHeight +
           this.rules.TitleBottomDistance;
         for (let idx2: number = 0, len2: number = graphicalMusicPage.MusicSystems.length; idx2 < len2; ++idx2) {
-          let musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
+                    const musicSystem: MusicSystem = graphicalMusicPage.MusicSystems[idx2];
           // calculate y positions of stafflines within system
-          let y: number = 0;
-          for (let line of musicSystem.StaffLines) {
+                    let y: number = 0;
+                    for (const line of musicSystem.StaffLines) {
             line.PositionAndShape.RelativePosition.y = y;
             y += 10;
           }
           // set y positions of systems using the previous system and a fixed distance.
-          musicSystem.PositionAndShape.BorderBottom = y + 0;
-          musicSystem.PositionAndShape.RelativePosition.x = this.rules.PageLeftMargin + this.rules.SystemLeftMargin;
-          musicSystem.PositionAndShape.RelativePosition.y = globalY;
-          globalY += y + 5;
+                    musicSystem.PositionAndShape.BorderBottom = y + 0;
+                    musicSystem.PositionAndShape.RelativePosition.x = this.rules.PageLeftMargin + this.rules.SystemLeftMargin;
+                    musicSystem.PositionAndShape.RelativePosition.y = globalY;
+                    globalY += y + 5;
         }
       }
     }
@@ -201,39 +199,39 @@ export class VexFlowMusicSheetCalculator extends MusicSheetCalculator {
   }
 
   protected layoutGraphicalTie(tie: GraphicalTie, tieIsAtSystemBreak: boolean): void {
-    let startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
-    let vfStartNote: Vex.Flow.StaveNote = undefined;
-    if (startNote !== undefined) {
+        const startNote: VexFlowGraphicalNote = (tie.StartNote as VexFlowGraphicalNote);
+        let vfStartNote: Vex.Flow.StaveNote = undefined;
+        if (startNote !== undefined) {
       vfStartNote = startNote.vfnote[0];
     }
 
-    let endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
-    let vfEndNote: Vex.Flow.StaveNote = undefined;
-    if (endNote !== undefined) {
+        const endNote: VexFlowGraphicalNote = (tie.EndNote as VexFlowGraphicalNote);
+        let vfEndNote: Vex.Flow.StaveNote = undefined;
+        if (endNote !== undefined) {
       vfEndNote = endNote.vfnote[0];
     }
 
 
-    if (tieIsAtSystemBreak) {
+        if (tieIsAtSystemBreak) {
       // split tie into two ties:
-      let vfTie1: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
+            const vfTie1: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
         first_note: vfStartNote,
       });
-      let measure1: VexFlowMeasure = (startNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
-      measure1.vfTies.push(vfTie1);
+            const measure1: VexFlowMeasure = (startNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
+            measure1.vfTies.push(vfTie1);
 
-      let vfTie2: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
+            const vfTie2: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
         last_note: vfEndNote,
       });
-      let measure2: VexFlowMeasure = (endNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
-      measure2.vfTies.push(vfTie2);
+            const measure2: VexFlowMeasure = (endNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
+            measure2.vfTies.push(vfTie2);
     } else {
-      let vfTie: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
+            const vfTie: Vex.Flow.StaveTie = new Vex.Flow.StaveTie({
         first_note: vfStartNote,
         last_note: vfEndNote,
       });
-      let measure: VexFlowMeasure = (endNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
-      measure.vfTies.push(vfTie);
+            const measure: VexFlowMeasure = (endNote.parentStaffEntry.parentMeasure as VexFlowMeasure);
+            measure.vfTies.push(vfTie);
     }
   }
 

+ 9 - 5
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer.ts

@@ -9,6 +9,7 @@ import {GraphicalObject} from "../GraphicalObject";
 import {GraphicalLayers} from "../DrawingEnums";
 import {GraphicalStaffEntry} from "../GraphicalStaffEntry";
 import {VexFlowBackend} from "./VexFlowBackend";
+import { VexFlowInstrumentBracket } from "./VexFlowInstrumentBracket";
 
 /**
  * This is a global constant which denotes the height in pixels of the space between two lines of the stave
@@ -71,7 +72,7 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
         measure.draw(this.backend.getContext());
 
         // Draw the StaffEntries
-        for (let staffEntry of measure.staffEntries) {
+        for (const staffEntry of measure.staffEntries) {
             this.drawStaffEntry(staffEntry);
         }
     }
@@ -83,8 +84,10 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
         }
     }
 
-    protected drawInstrumentBrace(bracket: GraphicalObject, system: MusicSystem): void {
-        // empty
+    protected drawInstrumentBrace(brace: GraphicalObject, system: MusicSystem): void {
+        // Draw InstrumentBrackets at beginning of line
+        const vexBrace: VexFlowInstrumentBracket = (brace as VexFlowInstrumentBracket);
+        vexBrace.draw(this.backend.getContext());
     }
 
     protected drawGroupBracket(bracket: GraphicalObject, system: MusicSystem): void {
@@ -114,9 +117,10 @@ export class VexFlowMusicSheetDrawer extends MusicSheetDrawer {
      * @param rectangle the rect in screen coordinates
      * @param layer is the current rendering layer. There are many layers on top of each other to which can be rendered. Not needed for now.
      * @param styleId the style id
+     * @param alpha alpha value between 0 and 1
      */
-    protected renderRectangle(rectangle: RectangleF2D, layer: number, styleId: number): void {
-       this.backend.renderRectangle(rectangle, styleId);
+    protected renderRectangle(rectangle: RectangleF2D, layer: number, styleId: number, alpha: number): void {
+       this.backend.renderRectangle(rectangle, styleId, alpha);
     }
 
     /**

+ 12 - 5
src/MusicalScore/Graphical/VexFlow/VexFlowMusicSystem.ts

@@ -4,10 +4,12 @@ import {SystemLinesEnum} from "../SystemLinesEnum";
 import {SystemLinePosition} from "../SystemLinePosition";
 import {StaffMeasure} from "../StaffMeasure";
 import {SystemLine} from "../SystemLine";
+import {VexFlowStaffLine} from "./VexFlowStaffLine";
 import {VexFlowMeasure} from "./VexFlowMeasure";
 import {VexFlowConverter} from "./VexFlowConverter";
 import {StaffLine} from "../StaffLine";
 import {EngravingRules} from "../EngravingRules";
+import { VexFlowInstrumentBracket } from "./VexFlowInstrumentBracket";
 
 export class VexFlowMusicSystem extends MusicSystem {
     constructor(parent: GraphicalMusicPage, id: number) {
@@ -19,7 +21,7 @@ export class VexFlowMusicSystem extends MusicSystem {
         if (this.staffLines.length === 0) {
             return;
         }
-        let width: number = this.calcBracketsWidth();
+        const width: number = this.calcBracketsWidth();
         this.boundingBox.BorderLeft = -width;
         this.boundingBox.BorderMarginLeft = -width;
         this.boundingBox.XBordersHaveBeenSet = true;
@@ -46,11 +48,16 @@ export class VexFlowMusicSystem extends MusicSystem {
 
     /**
      * creates an instrument brace for the given dimension.
-     * The height and positioning can be inferred from the given points.
-     * @param firstStaffLine the upper staff line of the bracket to create
-     * @param lastStaffLine the lower staff line of the bracket to create
+     * The height and positioning can be inferred from the given staff lines.
+     * @param firstStaffLine the upper StaffLine (use a cast to get the VexFlowStaffLine) of the brace to create
+     * @param lastStaffLine the lower StaffLine (use a cast to get the VexFlowStaffLine) of the brace to create
      */
-    protected createInstrumentBrace(firstStaffLine: StaffLine, lastStaffLine: StaffLine): void {
+    protected createInstrumentBracket(firstStaffLine: StaffLine, lastStaffLine: StaffLine): void {
+        // You could write this in one line but the linter doesn't let me.
+        const firstVexStaff: VexFlowStaffLine = (firstStaffLine as VexFlowStaffLine);
+        const lastVexStaff: VexFlowStaffLine = (lastStaffLine as VexFlowStaffLine);
+        const vexFlowBracket: VexFlowInstrumentBracket = new VexFlowInstrumentBracket(firstVexStaff, lastVexStaff);
+        this.InstrumentBrackets.push(vexFlowBracket);
         return;
     }
 

+ 2 - 2
src/MusicalScore/Graphical/VexFlow/VexFlowStaffEntry.ts

@@ -21,8 +21,8 @@ export class VexFlowStaffEntry extends GraphicalStaffEntry {
     public getX(): number {
         let x: number = 0;
         let n: number = 0;
-        let vfNotes: { [voiceID: number]: Vex.Flow.StaveNote; } = this.vfNotes;
-        for (let voiceId in vfNotes) {
+        const vfNotes: { [voiceID: number]: Vex.Flow.StaveNote; } = this.vfNotes;
+        for (const voiceId in vfNotes) {
             if (vfNotes.hasOwnProperty(voiceId)) {
                 x += (vfNotes[voiceId].getNoteHeadBeginX() + vfNotes[voiceId].getNoteHeadEndX()) / 2;
                 n += 1;

+ 1 - 1
src/MusicalScore/Graphical/VexFlow/VexFlowTextMeasurer.ts

@@ -8,7 +8,7 @@ import {VexFlowConverter} from "./VexFlowConverter";
 
 export class VexFlowTextMeasurer implements ITextMeasurer {
     constructor() {
-        let canvas: HTMLCanvasElement = document.createElement("canvas");
+        const canvas: HTMLCanvasElement = document.createElement("canvas");
         this.context = canvas.getContext("2d");
     }
     // The context of a canvas used internally to compute font sizes

+ 22 - 22
src/MusicalScore/Instrument.ts

@@ -80,7 +80,7 @@ export class Instrument extends InstrumentalGroup {
     }
     public set Volume(value: number) {
         for (let idx: number = 0, len: number = this.subInstruments.length; idx < len; ++idx) {
-            let subInstrument: SubInstrument = this.subInstruments[idx];
+            const subInstrument: SubInstrument = this.subInstruments[idx];
             subInstrument.volume = value;
         }
     }
@@ -96,7 +96,7 @@ export class Instrument extends InstrumentalGroup {
     }
     public getSubInstrument(subInstrumentIdString: string): SubInstrument {
         for (let idx: number = 0, len: number = this.subInstruments.length; idx < len; ++idx) {
-            let subInstrument: SubInstrument = this.subInstruments[idx];
+            const subInstrument: SubInstrument = this.subInstruments[idx];
             if (subInstrument.idString === subInstrumentIdString) {
                 return subInstrument;
             }
@@ -112,49 +112,49 @@ export class Instrument extends InstrumentalGroup {
     }
     public set Visible(value: boolean) {
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             v.Visible = value;
         }
     }
     public get Audible(): boolean {
         let result: boolean = false;
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             result = result || v.Audible;
         }
         return result;
     }
     public set Audible(value: boolean) {
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             v.Audible = value;
         }
         for (let idx: number = 0, len: number = this.staves.length; idx < len; ++idx) {
-            let staff: Staff = this.staves[idx];
+            const staff: Staff = this.staves[idx];
             staff.audible = value;
         }
     }
     public get Following(): boolean {
         let result: boolean = false;
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             result = result || v.Following;
         }
         return result;
     }
     public set Following(value: boolean) {
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             v.Following = value;
         }
         for (let idx: number = 0, len: number = this.staves.length; idx < len; ++idx) {
-            let staff: Staff = this.staves[idx];
+            const staff: Staff = this.staves[idx];
             staff.following = value;
         }
     }
     public SetVoiceAudible(voiceId: number, audible: boolean): void {
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             if (v.VoiceId === voiceId) {
                 v.Audible = audible;
                 break;
@@ -163,7 +163,7 @@ export class Instrument extends InstrumentalGroup {
     }
     public SetVoiceFollowing(voiceId: number, following: boolean): void {
         for (let idx: number = 0, len: number = this.Voices.length; idx < len; ++idx) {
-            let v: Voice = this.Voices[idx];
+            const v: Voice = this.Voices[idx];
             if (v.VoiceId === voiceId) {
                 v.Following = following;
                 break;
@@ -171,22 +171,22 @@ export class Instrument extends InstrumentalGroup {
         }
     }
     public SetStaffAudible(staffId: number, audible: boolean): void {
-        let staff: Staff = this.staves[staffId - 1];
+        const staff: Staff = this.staves[staffId - 1];
         staff.audible = audible;
         if (audible) {
             for (let idx: number = 0, len: number = staff.Voices.length; idx < len; ++idx) {
-                let v: Voice = staff.Voices[idx];
+                const v: Voice = staff.Voices[idx];
                 v.Audible = true;
             }
         } else {
             for (let idx: number = 0, len: number = staff.Voices.length; idx < len; ++idx) {
-                let voice: Voice = staff.Voices[idx];
+                const voice: Voice = staff.Voices[idx];
                 let isAudibleInOtherStaves: boolean = false;
                 for (let idx2: number = 0, len2: number = this.Staves.length; idx2 < len2; ++idx2) {
-                    let st: Staff = this.Staves[idx2];
+                    const st: Staff = this.Staves[idx2];
                     if (st.Id === staffId || !st.audible) { continue; }
                     for (let idx3: number = 0, len3: number = st.Voices.length; idx3 < len3; ++idx3) {
-                        let v: Voice = st.Voices[idx3];
+                        const v: Voice = st.Voices[idx3];
                         if (v === voice) {
                             isAudibleInOtherStaves = true;
                         }
@@ -199,22 +199,22 @@ export class Instrument extends InstrumentalGroup {
         }
     }
     public SetStaffFollow(staffId: number, follow: boolean): void {
-        let staff: Staff = this.staves[staffId - 1];
+        const staff: Staff = this.staves[staffId - 1];
         staff.following = follow;
         if (follow) {
             for (let idx: number = 0, len: number = staff.Voices.length; idx < len; ++idx) {
-                let v: Voice = staff.Voices[idx];
+                const v: Voice = staff.Voices[idx];
                 v.Following = true;
             }
         } else {
             for (let idx: number = 0, len: number = staff.Voices.length; idx < len; ++idx) {
-                let voice: Voice = staff.Voices[idx];
+                const voice: Voice = staff.Voices[idx];
                 let isFollowingInOtherStaves: boolean = false;
                 for (let idx2: number = 0, len2: number = this.Staves.length; idx2 < len2; ++idx2) {
-                    let st: Staff = this.Staves[idx2];
+                    const st: Staff = this.Staves[idx2];
                     if (st.Id === staffId || !st.following) { continue; }
                     for (let idx3: number = 0, len3: number = st.Voices.length; idx3 < len3; ++idx3) {
-                        let v: Voice = st.Voices[idx3];
+                        const v: Voice = st.Voices[idx3];
                         if (v === voice) {
                             isFollowingInOtherStaves = true;
                         }
@@ -227,7 +227,7 @@ export class Instrument extends InstrumentalGroup {
         }
     }
     public areAllVoiceVisible(): boolean {
-        for (let voice of this.Voices) {
+        for (const voice of this.Voices) {
             if (!voice.Visible) {
                 return false;
             }

+ 6 - 0
src/MusicalScore/Interfaces/IGraphicalSymbolFactory.ts

@@ -12,6 +12,7 @@ import {SourceStaffEntry} from "../VoiceData/SourceStaffEntry";
 import {Staff} from "../VoiceData/Staff";
 import {StaffLine} from "../Graphical/StaffLine";
 import {StaffMeasure} from "../Graphical/StaffMeasure";
+import { TechnicalInstruction } from "../VoiceData/Instructions/TechnicalInstruction";
 
 export interface IGraphicalSymbolFactory {
 
@@ -43,6 +44,11 @@ export interface IGraphicalSymbolFactory {
 
     addFermataAtTiedEndNote(tiedNote: Note, graphicalStaffEntry: GraphicalStaffEntry): void;
 
+    createGraphicalTechnicalInstruction(
+        technicalInstruction: TechnicalInstruction,
+        graphicalStaffEntry: GraphicalStaffEntry): void;
+
+
     createInStaffClef(graphicalStaffEntry: GraphicalStaffEntry, clefInstruction: ClefInstruction): void;
 
     createChordSymbol(

+ 4 - 4
src/MusicalScore/MusicParts/MusicPartManager.ts

@@ -36,7 +36,7 @@ export class MusicPartManager /*implements ISelectionListener*/ {
         if (this.timestamps.length === 0) {
             return timestamp;
         }
-        let transform: TimestampTransform = this.getCurrentRepetitionTimestampTransform(timestamp);
+        const transform: TimestampTransform = this.getCurrentRepetitionTimestampTransform(timestamp);
         return Fraction.plus(timestamp, Fraction.minus(transform.to, transform.$from)); // FIXME
     }
     public get Parts(): PartListEntry[] {
@@ -60,8 +60,8 @@ export class MusicPartManager /*implements ISelectionListener*/ {
         this.musicSheet.SelectionEnd = end === undefined ? this.sheetEnd : end;
     }
     private calcMapping(): void {
-        let timestamps: TimestampTransform[] = [];
-        let iterator: MusicPartManagerIterator = this.getIterator();
+        const timestamps: TimestampTransform[] = [];
+        const iterator: MusicPartManagerIterator = this.getIterator();
         let currentRepetition: Repetition = iterator.CurrentRepetition;
         let curTimestampTransform: TimestampTransform = new TimestampTransform(
             iterator.CurrentEnrolledTimestamp.clone(),
@@ -74,7 +74,7 @@ export class MusicPartManager /*implements ISelectionListener*/ {
             if (iterator.JumpOccurred || currentRepetition !== iterator.CurrentRepetition) {
                 currentRepetition = iterator.CurrentRepetition;
                 if (iterator.backJumpOccurred) {
-                    let jumpRep: Repetition = iterator.JumpResponsibleRepetition;
+                    const jumpRep: Repetition = iterator.JumpResponsibleRepetition;
                     curTimestampTransform.nextBackJump = iterator.CurrentEnrolledTimestamp;
                     curTimestampTransform.curRepetition = jumpRep;
                     curTimestampTransform.curRepetitionIteration = iterator.CurrentJumpResponsibleRepetitionIterationBeforeJump;

+ 34 - 34
src/MusicalScore/MusicParts/MusicPartManagerIterator.ts

@@ -23,7 +23,7 @@ export class MusicPartManagerIterator {
             this.manager = manager;
             this.currentVoiceEntries = undefined;
             this.frontReached = false;
-            for (let rep of manager.MusicSheet.Repetitions) {
+            for (const rep of manager.MusicSheet.Repetitions) {
                 this.setRepetitionIterationCount(rep, 1);
             }
             this.activeDynamicExpressions = new Array(manager.MusicSheet.getCompleteNumberOfStaves());
@@ -35,11 +35,11 @@ export class MusicPartManagerIterator {
             for (let staffIndex: number = 0; staffIndex < this.activeDynamicExpressions.length; staffIndex++) {
                 if (this.activeDynamicExpressions[staffIndex] !== undefined) {
                     if (this.activeDynamicExpressions[staffIndex] instanceof ContinuousDynamicExpression) {
-                        let continuousDynamic: ContinuousDynamicExpression =
+                        const continuousDynamic: ContinuousDynamicExpression =
                             <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
                         this.currentDynamicChangingExpressions.push(new DynamicsContainer(continuousDynamic, staffIndex));
                     } else {
-                        let instantaniousDynamic: InstantaniousDynamicExpression =
+                        const instantaniousDynamic: InstantaniousDynamicExpression =
                             <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
                         this.currentDynamicChangingExpressions.push(new DynamicsContainer(instantaniousDynamic, staffIndex));
                     }
@@ -129,7 +129,7 @@ export class MusicPartManagerIterator {
         return this.jumpResponsibleRepetition;
     }
     public clone(): MusicPartManagerIterator {
-        let ret: MusicPartManagerIterator = new MusicPartManagerIterator(this.manager);
+        const ret: MusicPartManagerIterator = new MusicPartManagerIterator(this.manager);
         ret.currentVoiceEntryIndex = this.currentVoiceEntryIndex;
         ret.currentMappingPart = this.currentMappingPart;
         ret.currentPartIndex = this.currentPartIndex;
@@ -140,19 +140,19 @@ export class MusicPartManagerIterator {
     }
 
     public CurrentVisibleVoiceEntries(instrument?: Instrument): VoiceEntry[] {
-        let voiceEntries: VoiceEntry[] = [];
+        const voiceEntries: VoiceEntry[] = [];
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
         if (instrument !== undefined) {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getVisibleEntries(entry, voiceEntries);
                     return voiceEntries;
                 }
             }
         } else {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 this.getVisibleEntries(entry, voiceEntries);
             }
         }
@@ -160,19 +160,19 @@ export class MusicPartManagerIterator {
     }
 
     public CurrentAudibleVoiceEntries(instrument?: Instrument): VoiceEntry[] {
-        let voiceEntries: VoiceEntry[] = [];
+        const voiceEntries: VoiceEntry[] = [];
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
         if (instrument !== undefined) {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getAudibleEntries(entry, voiceEntries);
                     return voiceEntries;
                 }
             }
         } else {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 this.getAudibleEntries(entry, voiceEntries);
             }
         }
@@ -184,19 +184,19 @@ export class MusicPartManagerIterator {
     }
 
     public CurrentScoreFollowingVoiceEntries(instrument?: Instrument): VoiceEntry[] {
-        let voiceEntries: VoiceEntry[] = [];
+        const voiceEntries: VoiceEntry[] = [];
         if (this.currentVoiceEntries === undefined) {
             return voiceEntries;
         }
         if (instrument !== undefined) {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 if (entry.ParentVoice.Parent.IdString === instrument.IdString) {
                     this.getScoreFollowingEntries(entry, voiceEntries);
                     return voiceEntries;
                 }
             }
         } else {
-            for (let entry of this.currentVoiceEntries) {
+            for (const entry of this.currentVoiceEntries) {
                 this.getScoreFollowingEntries(entry, voiceEntries);
             }
         }
@@ -235,7 +235,7 @@ export class MusicPartManagerIterator {
         }
     }
     private setRepetitionIterationCount(repetition: Repetition, iterationCount: number): number {
-        let i: number = this.repetitionIterationCountDictKeys.indexOf(repetition);
+        const i: number = this.repetitionIterationCountDictKeys.indexOf(repetition);
         if (i === -1) {
             this.repetitionIterationCountDictKeys.push(repetition);
             this.repetitionIterationCountDictValues.push(iterationCount);
@@ -245,7 +245,7 @@ export class MusicPartManagerIterator {
         return iterationCount;
     }
     private getRepetitionIterationCount(rep: Repetition): number {
-        let i: number = this.repetitionIterationCountDictKeys.indexOf(rep);
+        const i: number = this.repetitionIterationCountDictKeys.indexOf(rep);
         if (i !== -1) {
             return this.repetitionIterationCountDictValues[i];
         }
@@ -296,9 +296,9 @@ export class MusicPartManagerIterator {
     */
     private handleRepetitionsAtMeasureBegin(): void {
         for (let idx: number = 0, len: number = this.currentMeasure.FirstRepetitionInstructions.length; idx < len; ++idx) {
-            let repetitionInstruction: RepetitionInstruction = this.currentMeasure.FirstRepetitionInstructions[idx];
+            const repetitionInstruction: RepetitionInstruction = this.currentMeasure.FirstRepetitionInstructions[idx];
             if (repetitionInstruction.parentRepetition === undefined) { continue; }
-            let currentRepetition: Repetition = repetitionInstruction.parentRepetition;
+            const currentRepetition: Repetition = repetitionInstruction.parentRepetition;
             this.currentRepetition = currentRepetition;
             if (currentRepetition.StartIndex === this.currentMeasureIndex) {
                 if (
@@ -315,8 +315,8 @@ export class MusicPartManagerIterator {
 
     private handleRepetitionsAtMeasureEnd(): void {
         for (let idx: number = 0, len: number = this.currentMeasure.LastRepetitionInstructions.length; idx < len; ++idx) {
-            let repetitionInstruction: RepetitionInstruction = this.currentMeasure.LastRepetitionInstructions[idx];
-            let currentRepetition: Repetition = repetitionInstruction.parentRepetition;
+            const repetitionInstruction: RepetitionInstruction = this.currentMeasure.LastRepetitionInstructions[idx];
+            const currentRepetition: Repetition = repetitionInstruction.parentRepetition;
             if (currentRepetition === undefined) { continue; }
             if (currentRepetition.BackwardJumpInstructions.indexOf(repetitionInstruction) > -1) {
                 if (this.getRepetitionIterationCount(currentRepetition) < currentRepetition.UserNumberOfRepetitions) {
@@ -335,7 +335,7 @@ export class MusicPartManagerIterator {
                     this.resetRepetitionIterationCount(currentRepetition);
                 }
 
-                let forwardJumpTargetMeasureIndex: number = currentRepetition.getForwardJumpTargetForIteration(
+                const forwardJumpTargetMeasureIndex: number = currentRepetition.getForwardJumpTargetForIteration(
                   this.getRepetitionIterationCount(currentRepetition)
                 );
                 if (forwardJumpTargetMeasureIndex >= 0) {
@@ -369,9 +369,9 @@ export class MusicPartManagerIterator {
           this.currentMeasure.FirstInstructionsStaffEntries.length > 0 &&
           this.currentMeasure.FirstInstructionsStaffEntries[0] !== undefined
         ) {
-            let instructions: AbstractNotationInstruction[] = this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;
+            const instructions: AbstractNotationInstruction[] = this.currentMeasure.FirstInstructionsStaffEntries[0].Instructions;
             for (let idx: number = 0, len: number = instructions.length; idx < len; ++idx) {
-                let abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
+                const abstractNotationInstruction: AbstractNotationInstruction = instructions[idx];
                 if (abstractNotationInstruction instanceof RhythmInstruction) {
                     this.manager.MusicSheet.SheetPlaybackSetting.rhythm = (<RhythmInstruction>abstractNotationInstruction).Rhythm;
                 }
@@ -379,7 +379,7 @@ export class MusicPartManagerIterator {
         }
     }
     private activateCurrentDynamicOrTempoInstructions(): void {
-        let timeSortedDynamics: DynamicsContainer[] = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
+        const timeSortedDynamics: DynamicsContainer[] = this.manager.MusicSheet.TimestampSortedDynamicExpressionsList;
         while (
           this.currentDynamicEntryIndex > 0 && (
             this.currentDynamicEntryIndex >= timeSortedDynamics.length ||
@@ -398,8 +398,8 @@ export class MusicPartManagerIterator {
           this.currentDynamicEntryIndex < timeSortedDynamics.length
           && timeSortedDynamics[this.currentDynamicEntryIndex].parMultiExpression().AbsoluteTimestamp.Equals(this.CurrentSourceTimestamp)
         ) {
-            let dynamicsContainer: DynamicsContainer = timeSortedDynamics[this.currentDynamicEntryIndex];
-            let staffIndex: number = dynamicsContainer.staffNumber;
+            const dynamicsContainer: DynamicsContainer = timeSortedDynamics[this.currentDynamicEntryIndex];
+            const staffIndex: number = dynamicsContainer.staffNumber;
             if (this.CurrentSourceTimestamp.Equals(dynamicsContainer.parMultiExpression().AbsoluteTimestamp)) {
                 if (dynamicsContainer.continuousDynamicExpression !== undefined) {
                     this.activeDynamicExpressions[staffIndex] = dynamicsContainer.continuousDynamicExpression;
@@ -415,21 +415,21 @@ export class MusicPartManagerIterator {
                 let startTime: Fraction;
                 let endTime: Fraction;
                 if (this.activeDynamicExpressions[staffIndex] instanceof ContinuousDynamicExpression) {
-                    let continuousDynamic: ContinuousDynamicExpression = <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
+                    const continuousDynamic: ContinuousDynamicExpression = <ContinuousDynamicExpression>this.activeDynamicExpressions[staffIndex];
                     startTime = continuousDynamic.StartMultiExpression.AbsoluteTimestamp;
                     endTime = continuousDynamic.EndMultiExpression.AbsoluteTimestamp;
                     if (startTime.lte(this.CurrentSourceTimestamp) && this.CurrentSourceTimestamp.lte(endTime)) {
                         this.currentDynamicChangingExpressions.push(new DynamicsContainer(continuousDynamic, staffIndex));
                     }
                 } else {
-                    let instantaniousDynamic: InstantaniousDynamicExpression = <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
+                    const instantaniousDynamic: InstantaniousDynamicExpression = <InstantaniousDynamicExpression>this.activeDynamicExpressions[staffIndex];
                     if (this.CurrentSourceTimestamp.Equals(instantaniousDynamic.ParentMultiExpression.AbsoluteTimestamp)) {
                         this.currentDynamicChangingExpressions.push(new DynamicsContainer(instantaniousDynamic, staffIndex));
                     }
                 }
             }
         }
-        let timeSortedTempoExpressions: MultiTempoExpression[] = this.manager.MusicSheet.TimestampSortedTempoExpressionsList;
+        const timeSortedTempoExpressions: MultiTempoExpression[] = this.manager.MusicSheet.TimestampSortedTempoExpressionsList;
 
         while (this.currentTempoEntryIndex > 0 && (
           this.currentTempoEntryIndex >= timeSortedTempoExpressions.length
@@ -472,7 +472,7 @@ export class MusicPartManagerIterator {
             this.activateCurrentRhythmInstructions();
         }
         if (this.currentVoiceEntryIndex >= 0 && this.currentVoiceEntryIndex < this.currentMeasure.VerticalSourceStaffEntryContainers.length) {
-            let currentContainer: VerticalSourceStaffEntryContainer = this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];
+            const currentContainer: VerticalSourceStaffEntryContainer = this.currentMeasure.VerticalSourceStaffEntryContainers[this.currentVoiceEntryIndex];
             this.currentVoiceEntries = this.getVoiceEntries(currentContainer);
             this.currentVerticalContainerInMeasureTimestamp = currentContainer.Timestamp;
             this.currentTimeStamp = Fraction.plus(this.currentMeasure.AbsoluteTimestamp, this.currentVerticalContainerInMeasureTimestamp);
@@ -497,11 +497,11 @@ export class MusicPartManagerIterator {
         this.endReached = true;
     }
     private checkEntries(notesOnly: boolean): boolean {
-        let tlist: VoiceEntry[] = this.CurrentVisibleVoiceEntries();
+        const tlist: VoiceEntry[] = this.CurrentVisibleVoiceEntries();
         if (tlist.length > 0) {
             if (!notesOnly) { return true; }
             for (let idx: number = 0, len: number = tlist.length; idx < len; ++idx) {
-                let entry: VoiceEntry = tlist[idx];
+                const entry: VoiceEntry = tlist[idx];
                 if (entry.Notes[0].Pitch !== undefined) { return true; }
             }
         }
@@ -523,10 +523,10 @@ export class MusicPartManagerIterator {
         }
     }
     private getVoiceEntries(container: VerticalSourceStaffEntryContainer): VoiceEntry[] {
-        let entries: VoiceEntry[] = [];
-        for (let sourceStaffEntry of container.StaffEntries) {
+        const entries: VoiceEntry[] = [];
+        for (const sourceStaffEntry of container.StaffEntries) {
             if (sourceStaffEntry === undefined) { continue; }
-            for (let voiceEntry of sourceStaffEntry.VoiceEntries) {
+            for (const voiceEntry of sourceStaffEntry.VoiceEntries) {
                 entries.push(voiceEntry);
             }
         }

+ 18 - 18
src/MusicalScore/MusicSheet.ts

@@ -235,9 +235,9 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     }
     public checkForInstrumentWithNoVoice(): void {
         for (let idx: number = 0, len: number = this.instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.instruments[idx];
+            const instrument: Instrument = this.instruments[idx];
             if (instrument.Voices.length === 0) {
-                let voice: Voice = new Voice(instrument, 1);
+                const voice: Voice = new Voice(instrument, 1);
                 instrument.Voices.push(voice);
             }
         }
@@ -254,9 +254,9 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     public fillStaffList(): void {
         let i: number = 0;
         for (let idx: number = 0, len: number = this.instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.instruments[idx];
+            const instrument: Instrument = this.instruments[idx];
             for (let idx2: number = 0, len2: number = instrument.Staves.length; idx2 < len2; ++idx2) {
-                let staff: Staff = instrument.Staves[idx2];
+                const staff: Staff = instrument.Staves[idx2];
                 staff.idInMusicSheet = i;
                 this.staves.push(staff);
                 i++;
@@ -272,7 +272,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     public getCompleteNumberOfStaves(): number {
         let num: number = 0;
         for (let idx: number = 0, len: number = this.instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.instruments[idx];
+            const instrument: Instrument = this.instruments[idx];
             num += instrument.Staves.length;
         }
         return num;
@@ -285,14 +285,14 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
      * @returns {SourceMeasure[]}
      */
     public getListOfMeasuresFromIndeces(start: number, end: number): SourceMeasure[] {
-        let measures: SourceMeasure[] = [];
+        const measures: SourceMeasure[] = [];
         for (let i: number = start; i <= end; i++) {
             measures.push(this.sourceMeasures[i]);
         }
         return measures;
     }
     public getNextSourceMeasure(measure: SourceMeasure): SourceMeasure {
-        let index: number = this.sourceMeasures.indexOf(measure);
+        const index: number = this.sourceMeasures.indexOf(measure);
         if (index === this.sourceMeasures.length - 1) {
             return measure;
         }
@@ -305,12 +305,12 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         return this.sourceMeasures[this.sourceMeasures.length - 1];
     }
     public resetAllNoteStates(): void {
-       let iterator: MusicPartManagerIterator = this.MusicPartManager.getIterator();
+       const iterator: MusicPartManagerIterator = this.MusicPartManager.getIterator();
        while (!iterator.EndReached && iterator.CurrentVoiceEntries !== undefined) {
            for (let idx: number = 0, len: number = iterator.CurrentVoiceEntries.length; idx < len; ++idx) {
-               let voiceEntry: VoiceEntry = iterator.CurrentVoiceEntries[idx];
+               const voiceEntry: VoiceEntry = iterator.CurrentVoiceEntries[idx];
                for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
-                   let note: Note = voiceEntry.Notes[idx2];
+                   const note: Note = voiceEntry.Notes[idx2];
                    note.state = NoteState.Normal;
                }
            }
@@ -321,7 +321,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         return this.Instruments.indexOf(instrument);
     }
     public getGlobalStaffIndexOfFirstStaff(instrument: Instrument): number {
-        let instrumentIndex: number = this.getMusicSheetInstrumentIndex(instrument);
+        const instrumentIndex: number = this.getMusicSheetInstrumentIndex(instrument);
         let staffLineIndex: number = 0;
         for (let i: number = 0; i < instrumentIndex; i++) {
             staffLineIndex += this.Instruments[i].Staves.length;
@@ -481,11 +481,11 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     //    }
     // }
     public getEnrolledSelectionStartTimeStampWorkaround(): Fraction {
-        let iter: MusicPartManagerIterator = this.MusicPartManager.getIterator(this.SelectionStart);
+        const iter: MusicPartManagerIterator = this.MusicPartManager.getIterator(this.SelectionStart);
         return Fraction.createFromFraction(iter.CurrentEnrolledTimestamp);
     }
     public get SheetEndTimestamp(): Fraction {
-        let lastMeasure: SourceMeasure = this.getLastSourceMeasure();
+        const lastMeasure: SourceMeasure = this.getLastSourceMeasure();
         return Fraction.plus(lastMeasure.AbsoluteTimestamp, lastMeasure.Duration);
     }
 
@@ -496,9 +496,9 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
      */
     public getSourceMeasureFromTimeStamp(timeStamp: Fraction): SourceMeasure {
         for (let idx: number = 0, len: number = this.sourceMeasures.length; idx < len; ++idx) {
-            let sm: SourceMeasure = this.sourceMeasures[idx];
+            const sm: SourceMeasure = this.sourceMeasures[idx];
             for (let idx2: number = 0, len2: number = sm.VerticalSourceStaffEntryContainers.length; idx2 < len2; ++idx2) {
-                let vssec: VerticalSourceStaffEntryContainer = sm.VerticalSourceStaffEntryContainers[idx2];
+                const vssec: VerticalSourceStaffEntryContainer = sm.VerticalSourceStaffEntryContainers[idx2];
                 if (timeStamp.Equals(vssec.getAbsoluteTimestamp())) {
                     return sm;
                 }
@@ -507,7 +507,7 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
         return this.findSourceMeasureFromTimeStamp(timeStamp);
     }
     public findSourceMeasureFromTimeStamp(timestamp: Fraction): SourceMeasure {
-        for (let sm of this.sourceMeasures) {
+        for (const sm of this.sourceMeasures) {
             if (sm.AbsoluteTimestamp.lte(timestamp) && timestamp.lt(Fraction.plus(sm.AbsoluteTimestamp, sm.Duration))) {
                 return sm;
             }
@@ -515,9 +515,9 @@ export class MusicSheet /*implements ISettableMusicSheet, IComparable<MusicSheet
     }
 
     public getVisibleInstruments(): Instrument[] {
-        let visInstruments: Instrument[] = [];
+        const visInstruments: Instrument[] = [];
         for (let idx: number = 0, len: number = this.Instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.Instruments[idx];
+            const instrument: Instrument = this.Instruments[idx];
             if (instrument.Voices.length > 0 && instrument.Voices[0].Visible) {
                 visInstruments.push(instrument);
             }

+ 9 - 9
src/MusicalScore/MusicSource/Repetition.ts

@@ -54,7 +54,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
     public set UserNumberOfRepetitions(value: number) {
         this.userNumberOfRepetitions = value;
         this.repetitonIterationOrder = [];
-        let endingsDiff: number = this.userNumberOfRepetitions - this.NumberOfEndings;
+        const endingsDiff: number = this.userNumberOfRepetitions - this.NumberOfEndings;
         for (let i: number = 1; i <= this.userNumberOfRepetitions; i++) {
             if (i <= endingsDiff) {
                 this.repetitonIterationOrder.push(1);
@@ -64,7 +64,7 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
         }
     }
     public getForwardJumpTargetForIteration(iteration: number): number {
-        let endingIndex: number = this.repetitonIterationOrder[iteration - 1];
+        const endingIndex: number = this.repetitonIterationOrder[iteration - 1];
         if (this.endingIndexDict[endingIndex] !== undefined) {
             return this.endingIndexDict[endingIndex].part.StartIndex;
         }
@@ -74,9 +74,9 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
         return this.startMarker.measureIndex;
     }
     public SetEndingStartIndex(endingNumbers: number[], startIndex: number): void {
-        let part: RepetitionEndingPart = new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2, startIndex, startIndex));
+        const part: RepetitionEndingPart = new RepetitionEndingPart(new SourceMusicPart(this.musicSheet2, startIndex, startIndex));
         this.endingParts.push(part);
-        for (let endingNumber of endingNumbers) {
+        for (const endingNumber of endingNumbers) {
             try {
                 this.endingIndexDict[endingNumber] = part;
                 part.endingIndices.push(endingNumber);
@@ -130,15 +130,15 @@ export class Repetition extends PartListEntry /*implements IRepetition*/ {
     }
     private checkRepetitionForMultipleLyricVerses(): number {
         let lyricVerses: number = 0;
-        let start: number = this.StartIndex;
-        let end: number = this.EndIndex;
+        const start: number = this.StartIndex;
+        const end: number = this.EndIndex;
         for (let measureIndex: number = start; measureIndex <= end; measureIndex++) {
-            let sourceMeasure: SourceMeasure = this.musicSheet2.SourceMeasures[measureIndex];
+            const sourceMeasure: SourceMeasure = this.musicSheet2.SourceMeasures[measureIndex];
             for (let i: number = 0; i < sourceMeasure.CompleteNumberOfStaves; i++) {
-                for (let sourceStaffEntry of sourceMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries) {
+                for (const sourceStaffEntry of sourceMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries) {
                     if (sourceStaffEntry !== undefined) {
                         let verses: number = 0;
-                        for (let voiceEntry of sourceStaffEntry.VoiceEntries) {
+                        for (const voiceEntry of sourceStaffEntry.VoiceEntries) {
                             verses += Object.keys(voiceEntry.LyricsEntries).length;
                         }
                         lyricVerses = Math.max(lyricVerses, verses);

+ 85 - 85
src/MusicalScore/ScoreIO/InstrumentReader.ts

@@ -133,8 +133,8 @@ export class InstrumentReader {
     this.maxTieNoteFraction = new Fraction(0, 1);
     let lastNoteWasGrace: boolean = false;
     try {
-      let xmlMeasureListArr: IXmlElement[] = this.xmlMeasureList[this.currentXmlMeasureIndex].elements();
-      for (let xmlNode of xmlMeasureListArr) {
+      const xmlMeasureListArr: IXmlElement[] = this.xmlMeasureList[this.currentXmlMeasureIndex].elements();
+      for (const xmlNode of xmlMeasureListArr) {
         if (xmlNode.name === "note") {
           if (xmlNode.hasAttributes && xmlNode.attribute("print-object") && xmlNode.attribute("print-spacing")) {
             continue;
@@ -151,9 +151,9 @@ export class InstrumentReader {
           }
 
           this.currentStaff = this.instrument.Staves[noteStaff - 1];
-          let isChord: boolean = xmlNode.element("chord") !== undefined;
+          const isChord: boolean = xmlNode.element("chord") !== undefined;
           if (xmlNode.element("voice") !== undefined) {
-            let noteVoice: number = parseInt(xmlNode.element("voice").value, 10);
+            const noteVoice: number = parseInt(xmlNode.element("voice").value, 10);
             this.currentVoiceGenerator = this.getOrCreateVoiceGenerator(noteVoice, noteStaff - 1);
           } else {
             if (!isChord || this.currentVoiceGenerator === undefined) {
@@ -175,16 +175,16 @@ export class InstrumentReader {
                 isTuplet = true;
               }
             } else {
-              let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid Note Duration.");
+              const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid Note Duration.");
               this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
               Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               continue;
             }
           }
 
-          let restNote: boolean = xmlNode.element("rest") !== undefined;
+          const restNote: boolean = xmlNode.element("rest") !== undefined;
           //Logging.log("New note found!", noteDivisions, noteDuration.toString(), restNote);
-          let isGraceNote: boolean = xmlNode.element("grace") !== undefined || noteDivisions === 0 || isChord && lastNoteWasGrace;
+          const isGraceNote: boolean = xmlNode.element("grace") !== undefined || noteDivisions === 0 || isChord && lastNoteWasGrace;
           let musicTimestamp: Fraction = currentFraction.clone();
           if (isChord) {
             musicTimestamp = previousFraction.clone();
@@ -212,7 +212,7 @@ export class InstrumentReader {
               this.inSourceMeasureInstrumentIndex + noteStaff - 1, this.currentStaff, this.currentStaffEntry, this.currentMeasure
             );
           }
-          let beginOfMeasure: boolean = (
+          const beginOfMeasure: boolean = (
             this.currentStaffEntry !== undefined &&
             this.currentStaffEntry.Timestamp !== undefined &&
             this.currentStaffEntry.Timestamp.Equals(new Fraction(0, 1)) && !this.currentStaffEntry.hasNotes()
@@ -240,7 +240,7 @@ export class InstrumentReader {
               this.maxTieNoteFraction, isChord, guitarPro
             );
           }
-          let notationsNode: IXmlElement = xmlNode.element("notations");
+          const notationsNode: IXmlElement = xmlNode.element("notations");
           if (notationsNode !== undefined && notationsNode.element("dynamics") !== undefined) {
             // (*) let expressionReader: ExpressionReader = this.expressionReaders[this.readExpressionStaffNumber(xmlNode) - 1];
             //if (expressionReader !== undefined) {
@@ -254,12 +254,12 @@ export class InstrumentReader {
           }
           lastNoteWasGrace = isGraceNote;
         } else if (xmlNode.name === "attributes") {
-          let divisionsNode: IXmlElement = xmlNode.element("divisions");
+          const divisionsNode: IXmlElement = xmlNode.element("divisions");
           if (divisionsNode !== undefined) {
             this.divisions = parseInt(divisionsNode.value, 10);
             if (isNaN(this.divisions)) {
-              let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError",
-                                                                    "Invalid divisions value at Instrument: ");
+              const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError",
+                                                                      "Invalid divisions value at Instrument: ");
               Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg);
               this.divisions = this.readDivisionsFromNotes();
               if (this.divisions > 0) {
@@ -276,7 +276,7 @@ export class InstrumentReader {
             this.divisions === 0 &&
             this.currentXmlMeasureIndex === 0
           ) {
-            let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError", "Invalid divisions value at Instrument: ");
+            const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/DivisionError", "Invalid divisions value at Instrument: ");
             this.divisions = this.readDivisionsFromNotes();
             if (this.divisions > 0) {
               this.musicSheet.SheetErrors.push(errorMsg + this.instrument.Name);
@@ -294,10 +294,10 @@ export class InstrumentReader {
             this.saveClefInstructionAtEndOfMeasure();
           }
         } else if (xmlNode.name === "forward") {
-          let forFraction: number = parseInt(xmlNode.element("duration").value, 10);
+          const forFraction: number = parseInt(xmlNode.element("duration").value, 10);
           currentFraction.Add(new Fraction(forFraction, 4 * this.divisions));
         } else if (xmlNode.name === "backup") {
-          let backFraction: number = parseInt(xmlNode.element("duration").value, 10);
+          const backFraction: number = parseInt(xmlNode.element("duration").value, 10);
           currentFraction.Sub(new Fraction(backFraction, 4 * this.divisions));
           if (currentFraction.IsNegative()) {
             currentFraction = new Fraction(0, 1);
@@ -354,9 +354,9 @@ export class InstrumentReader {
                     this.openChordSymbolContainer = ChordSymbolReader.readChordSymbol(xmlNode, this.musicSheet, this.activeKey);
         }
       }
-      for (let j in this.voiceGeneratorsDict) {
+      for (const j in this.voiceGeneratorsDict) {
         if (this.voiceGeneratorsDict.hasOwnProperty(j)) {
-          let voiceGenerator: VoiceGenerator = this.voiceGeneratorsDict[j];
+          const voiceGenerator: VoiceGenerator = this.voiceGeneratorsDict[j];
           voiceGenerator.checkForOpenBeam();
           voiceGenerator.checkForOpenGraceNotes();
         }
@@ -382,7 +382,7 @@ export class InstrumentReader {
       if (divisionsException) {
         throw new MusicSheetReadingException(e.Message);
       }
-      let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/MeasureError", "Error while reading Measure.");
+      const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/MeasureError", "Error while reading Measure.");
       this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
       Logging.debug("InstrumentReader.readNextXmlMeasure", errorMsg, e);
     }
@@ -393,7 +393,7 @@ export class InstrumentReader {
   }
 
   public doCalculationsAfterDurationHasBeenSet(): void {
-    for (let j in this.voiceGeneratorsDict) {
+    for (const j in this.voiceGeneratorsDict) {
       if (this.voiceGeneratorsDict.hasOwnProperty(j)) {
         this.voiceGeneratorsDict[j].checkOpenTies();
       }
@@ -407,14 +407,14 @@ export class InstrumentReader {
    * @returns {VoiceGenerator}
    */
   private getOrCreateVoiceGenerator(voiceId: number, staffId: number): VoiceGenerator {
-    let staff: Staff = this.instrument.Staves[staffId];
+    const staff: Staff = this.instrument.Staves[staffId];
     let voiceGenerator: VoiceGenerator = this.voiceGeneratorsDict[voiceId];
     if (voiceGenerator !== undefined) {
       if (staff.Voices.indexOf(voiceGenerator.GetVoice) === -1) {
         staff.Voices.push(voiceGenerator.GetVoice);
       }
     } else {
-      let mainVoiceGenerator: VoiceGenerator = this.staffMainVoiceGeneratorDict[staffId];
+      const mainVoiceGenerator: VoiceGenerator = this.staffMainVoiceGeneratorDict[staffId];
       if (mainVoiceGenerator !== undefined) {
         voiceGenerator = new VoiceGenerator(this.instrument, voiceId, this.slurReader, mainVoiceGenerator.GetVoice);
         staff.Voices.push(voiceGenerator.GetVoice);
@@ -449,7 +449,7 @@ export class InstrumentReader {
     } else {
       first = this.currentMeasure;
     }
-    let clefInstruction: ClefInstruction = new ClefInstruction(ClefEnum.G, 0, 2);
+    const clefInstruction: ClefInstruction = new ClefInstruction(ClefEnum.G, 0, 2);
     let firstStaffEntry: SourceStaffEntry;
     if (first.FirstInstructionsStaffEntries[staffIndex] === undefined) {
       firstStaffEntry = new SourceStaffEntry(undefined, undefined);
@@ -472,15 +472,15 @@ export class InstrumentReader {
     } else {
       first = this.currentMeasure;
     }
-    let keyInstruction: KeyInstruction = new KeyInstruction(undefined, 0, KeyEnum.major);
+    const keyInstruction: KeyInstruction = new KeyInstruction(undefined, 0, KeyEnum.major);
     for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + this.instrument.Staves.length; j++) {
       if (first.FirstInstructionsStaffEntries[j] === undefined) {
-        let firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
+        const firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
         first.FirstInstructionsStaffEntries[j] = firstStaffEntry;
         keyInstruction.Parent = firstStaffEntry;
         firstStaffEntry.Instructions.push(keyInstruction);
       } else {
-        let firstStaffEntry: SourceStaffEntry = first.FirstInstructionsStaffEntries[j];
+        const firstStaffEntry: SourceStaffEntry = first.FirstInstructionsStaffEntries[j];
         keyInstruction.Parent = firstStaffEntry;
         firstStaffEntry.removeFirstInstructionOfTypeKeyInstruction();
         if (firstStaffEntry.Instructions[0] instanceof ClefInstruction) {
@@ -499,8 +499,8 @@ export class InstrumentReader {
    * @returns {boolean}
    */
   private isAttributesNodeAtBeginOfMeasure(parentNode: IXmlElement, attributesNode: IXmlElement): boolean {
-    let children: IXmlElement[] = parentNode.elements();
-    let attributesNodeIndex: number = children.indexOf(attributesNode); // FIXME | 0
+    const children: IXmlElement[] = parentNode.elements();
+    const attributesNodeIndex: number = children.indexOf(attributesNode); // FIXME | 0
     if (attributesNodeIndex > 0 && children[attributesNodeIndex - 1].name === "backup") {
       return true;
     }
@@ -521,7 +521,7 @@ export class InstrumentReader {
    * @returns {boolean}
    */
   private isAttributesNodeAtEndOfMeasure(parentNode: IXmlElement, attributesNode: IXmlElement): boolean {
-    let childs: IXmlElement[] = parentNode.elements().slice();
+    const childs: IXmlElement[] = parentNode.elements().slice();
     let attributesNodeIndex: number = 0;
     for (let i: number = 0; i < childs.length; i++) {
       if (childs[i] === attributesNode) {
@@ -546,9 +546,9 @@ export class InstrumentReader {
    */
   private getNoteDurationFromTypeNode(xmlNode: IXmlElement): Fraction {
     if (xmlNode.element("type") !== undefined) {
-      let typeNode: IXmlElement = xmlNode.element("type");
+      const typeNode: IXmlElement = xmlNode.element("type");
       if (typeNode !== undefined) {
-        let type: string = typeNode.value;
+        const type: string = typeNode.value;
         return this.currentVoiceGenerator.getNoteDurationFromType(type);
       }
     }
@@ -566,23 +566,23 @@ export class InstrumentReader {
         return;
       }
     }
-    let transposeNode: IXmlElement = node.element("transpose");
+    const transposeNode: IXmlElement = node.element("transpose");
     if (transposeNode !== undefined) {
-      let chromaticNode: IXmlElement = transposeNode.element("chromatic");
+      const chromaticNode: IXmlElement = transposeNode.element("chromatic");
       if (chromaticNode !== undefined) {
         this.instrument.PlaybackTranspose = parseInt(chromaticNode.value, 10);
       }
     }
-    let clefList: IXmlElement[] = node.elements("clef");
+    const clefList: IXmlElement[] = node.elements("clef");
     let errorMsg: string;
     if (clefList.length > 0) {
       for (let idx: number = 0, len: number = clefList.length; idx < len; ++idx) {
-        let nodeList: IXmlElement = clefList[idx];
+        const nodeList: IXmlElement = clefList[idx];
         let clefEnum: ClefEnum = ClefEnum.G;
         let line: number = 2;
         let staffNumber: number = 1;
         let clefOctaveOffset: number = 0;
-        let lineNode: IXmlElement = nodeList.element("line");
+        const lineNode: IXmlElement = nodeList.element("line");
         if (lineNode !== undefined) {
           try {
             line = parseInt(lineNode.value, 10);
@@ -597,7 +597,7 @@ export class InstrumentReader {
           }
 
         }
-        let signNode: IXmlElement = nodeList.element("sign");
+        const signNode: IXmlElement = nodeList.element("sign");
         if (signNode !== undefined) {
           try {
             clefEnum = ClefEnum[signNode.value];
@@ -625,7 +625,7 @@ export class InstrumentReader {
           }
 
         }
-        let clefOctaveNode: IXmlElement = nodeList.element("clef-octave-change");
+        const clefOctaveNode: IXmlElement = nodeList.element("clef-octave-change");
         if (clefOctaveNode !== undefined) {
           try {
             clefOctaveOffset = parseInt(clefOctaveNode.value, 10);
@@ -652,13 +652,13 @@ export class InstrumentReader {
           }
         }
 
-        let clefInstruction: ClefInstruction = new ClefInstruction(clefEnum, clefOctaveOffset, line);
+        const clefInstruction: ClefInstruction = new ClefInstruction(clefEnum, clefOctaveOffset, line);
         this.abstractInstructions.push([staffNumber, clefInstruction]);
       }
     }
     if (node.element("key") !== undefined && this.instrument.MidiInstrumentId !== MidiInstrument.Percussion) {
       let key: number = 0;
-      let keyNode: IXmlElement = node.element("key").element("fifths");
+      const keyNode: IXmlElement = node.element("key").element("fifths");
       if (keyNode !== undefined) {
         try {
           key = parseInt(keyNode.value, 10);
@@ -692,14 +692,14 @@ export class InstrumentReader {
         }
 
       }
-      let keyInstruction: KeyInstruction = new KeyInstruction(undefined, key, keyEnum);
+      const keyInstruction: KeyInstruction = new KeyInstruction(undefined, key, keyEnum);
       this.abstractInstructions.push([1, keyInstruction]);
     }
     if (node.element("time") !== undefined) {
       let symbolEnum: RhythmSymbolEnum = RhythmSymbolEnum.NONE;
-      let timeNode: IXmlElement = node.element("time");
+      const timeNode: IXmlElement = node.element("time");
       if (timeNode !== undefined && timeNode.hasAttributes) {
-        let firstAttr: IXmlAttribute = timeNode.firstAttribute;
+        const firstAttr: IXmlAttribute = timeNode.firstAttribute;
         if (firstAttr.name === "symbol") {
           if (firstAttr.value === "common") {
             symbolEnum = RhythmSymbolEnum.COMMON;
@@ -710,27 +710,27 @@ export class InstrumentReader {
       }
       let num: number = 0;
       let denom: number = 0;
-      let senzaMisura: boolean = (timeNode !== undefined && timeNode.element("senza-misura") !== undefined);
-      let timeList: IXmlElement[] = node.elements("time");
-      let beatsList: IXmlElement[] = [];
-      let typeList: IXmlElement[] = [];
+      const senzaMisura: boolean = (timeNode !== undefined && timeNode.element("senza-misura") !== undefined);
+      const timeList: IXmlElement[] = node.elements("time");
+      const beatsList: IXmlElement[] = [];
+      const typeList: IXmlElement[] = [];
       for (let idx: number = 0, len: number = timeList.length; idx < len; ++idx) {
-        let xmlNode: IXmlElement = timeList[idx];
+        const xmlNode: IXmlElement = timeList[idx];
         beatsList.push.apply(beatsList, xmlNode.elements("beats"));
         typeList.push.apply(typeList, xmlNode.elements("beat-type"));
       }
       if (!senzaMisura) {
         try {
           if (beatsList !== undefined && beatsList.length > 0 && typeList !== undefined && beatsList.length === typeList.length) {
-            let length: number = beatsList.length;
-            let fractions: Fraction[] = new Array(length);
+            const length: number = beatsList.length;
+            const fractions: Fraction[] = new Array(length);
             let maxDenom: number = 0;
             for (let i: number = 0; i < length; i++) {
-              let s: string = beatsList[i].value;
+              const s: string = beatsList[i].value;
               let n: number = 0;
               let d: number = 0;
               if (s.indexOf("+") !== -1) {
-                let numbers: string[] = s.split("+");
+                const numbers: string[] = s.split("+");
                 for (let idx: number = 0, len: number = numbers.length; idx < len; ++idx) {
                   n += parseInt(numbers[idx], 10);
                 }
@@ -780,15 +780,15 @@ export class InstrumentReader {
    */
   private saveAbstractInstructionList(numberOfStaves: number, beginOfMeasure: boolean): void {
     for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
-      let pair: [number, AbstractNotationInstruction] = this.abstractInstructions[i];
-      let key: number = pair[0];
-      let value: AbstractNotationInstruction = pair[1];
+      const pair: [number, AbstractNotationInstruction] = this.abstractInstructions[i];
+      const key: number = pair[0];
+      const value: AbstractNotationInstruction = pair[1];
       if (value instanceof ClefInstruction) {
-        let clefInstruction: ClefInstruction = <ClefInstruction>value;
+        const clefInstruction: ClefInstruction = <ClefInstruction>value;
         if (this.currentXmlMeasureIndex === 0 || (key <= this.activeClefs.length && clefInstruction !== this.activeClefs[key - 1])) {
           if (!beginOfMeasure && this.currentStaffEntry !== undefined && !this.currentStaffEntry.hasNotes() && key - 1
             === this.instrument.Staves.indexOf(this.currentStaffEntry.ParentStaff)) {
-            let newClefInstruction: ClefInstruction = clefInstruction;
+            const newClefInstruction: ClefInstruction = clefInstruction;
             newClefInstruction.Parent = this.currentStaffEntry;
             this.currentStaffEntry.removeFirstInstructionOfTypeClefInstruction();
             this.currentStaffEntry.Instructions.push(newClefInstruction);
@@ -797,9 +797,9 @@ export class InstrumentReader {
           } else if (beginOfMeasure) {
             let firstStaffEntry: SourceStaffEntry;
             if (this.currentMeasure !== undefined) {
-              let newClefInstruction: ClefInstruction = clefInstruction;
-              let sseIndex: number = this.inSourceMeasureInstrumentIndex + key - 1;
-              let firstSse: SourceStaffEntry = this.currentMeasure.FirstInstructionsStaffEntries[sseIndex];
+              const newClefInstruction: ClefInstruction = clefInstruction;
+              const sseIndex: number = this.inSourceMeasureInstrumentIndex + key - 1;
+              const firstSse: SourceStaffEntry = this.currentMeasure.FirstInstructionsStaffEntries[sseIndex];
               if (this.currentXmlMeasureIndex === 0) {
                 if (firstSse === undefined) {
                   firstStaffEntry = new SourceStaffEntry(undefined, undefined);
@@ -816,13 +816,13 @@ export class InstrumentReader {
                   firstStaffEntry.Instructions.splice(0, 0, newClefInstruction);
                   this.activeClefsHaveBeenInitialized[key - 1] = true;
                 } else {
-                  let lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
+                  const lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
                   this.currentMeasure.LastInstructionsStaffEntries[sseIndex] = lastStaffEntry;
                   newClefInstruction.Parent = lastStaffEntry;
                   lastStaffEntry.Instructions.push(newClefInstruction);
                 }
               } else if (!this.activeClefsHaveBeenInitialized[key - 1]) {
-                let first: SourceMeasure = this.musicSheet.SourceMeasures[0];
+                const first: SourceMeasure = this.musicSheet.SourceMeasures[0];
                 if (first.FirstInstructionsStaffEntries[sseIndex] === undefined) {
                   firstStaffEntry = new SourceStaffEntry(undefined, undefined);
                 } else {
@@ -833,7 +833,7 @@ export class InstrumentReader {
                 firstStaffEntry.Instructions.splice(0, 0, newClefInstruction);
                 this.activeClefsHaveBeenInitialized[key - 1] = true;
               } else {
-                let lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
+                const lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
                 this.previousMeasure.LastInstructionsStaffEntries[sseIndex] = lastStaffEntry;
                 newClefInstruction.Parent = lastStaffEntry;
                 lastStaffEntry.Instructions.push(newClefInstruction);
@@ -847,7 +847,7 @@ export class InstrumentReader {
         }
       }
       if (value instanceof KeyInstruction) {
-        let keyInstruction: KeyInstruction = <KeyInstruction>value;
+        const keyInstruction: KeyInstruction = <KeyInstruction>value;
         if (this.activeKey === undefined || this.activeKey.Key !== keyInstruction.Key) {
           this.activeKey = keyInstruction;
           this.abstractInstructions.splice(i, 1);
@@ -864,14 +864,14 @@ export class InstrumentReader {
           }
           if (sourceMeasure !== undefined) {
             for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
-              let newKeyInstruction: KeyInstruction = keyInstruction;
+              const newKeyInstruction: KeyInstruction = keyInstruction;
               if (sourceMeasure.FirstInstructionsStaffEntries[j] === undefined) {
-                let firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
+                const firstStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
                 sourceMeasure.FirstInstructionsStaffEntries[j] = firstStaffEntry;
                 newKeyInstruction.Parent = firstStaffEntry;
                 firstStaffEntry.Instructions.push(newKeyInstruction);
               } else {
-                let firstStaffEntry: SourceStaffEntry = sourceMeasure.FirstInstructionsStaffEntries[j];
+                const firstStaffEntry: SourceStaffEntry = sourceMeasure.FirstInstructionsStaffEntries[j];
                 newKeyInstruction.Parent = firstStaffEntry;
                 firstStaffEntry.removeFirstInstructionOfTypeKeyInstruction();
                 if (firstStaffEntry.Instructions.length === 0) {
@@ -891,13 +891,13 @@ export class InstrumentReader {
         }
       }
       if (value instanceof RhythmInstruction) {
-        let rhythmInstruction: RhythmInstruction = <RhythmInstruction>value;
+        const rhythmInstruction: RhythmInstruction = <RhythmInstruction>value;
         if (this.activeRhythm === undefined || this.activeRhythm !== rhythmInstruction) {
           this.activeRhythm = rhythmInstruction;
           this.abstractInstructions.splice(i, 1);
           if (this.currentMeasure !== undefined) {
             for (let j: number = this.inSourceMeasureInstrumentIndex; j < this.inSourceMeasureInstrumentIndex + numberOfStaves; j++) {
-              let newRhythmInstruction: RhythmInstruction = rhythmInstruction;
+              const newRhythmInstruction: RhythmInstruction = rhythmInstruction;
               let firstStaffEntry: SourceStaffEntry;
               if (this.currentMeasure.FirstInstructionsStaffEntries[j] === undefined) {
                 firstStaffEntry = new SourceStaffEntry(undefined, undefined);
@@ -922,19 +922,19 @@ export class InstrumentReader {
    */
   private saveClefInstructionAtEndOfMeasure(): void {
     for (let i: number = this.abstractInstructions.length - 1; i >= 0; i--) {
-      let key: number = this.abstractInstructions[i][0];
-      let value: AbstractNotationInstruction = this.abstractInstructions[i][1];
+      const key: number = this.abstractInstructions[i][0];
+      const value: AbstractNotationInstruction = this.abstractInstructions[i][1];
       if (value instanceof ClefInstruction) {
-        let clefInstruction: ClefInstruction = <ClefInstruction>value;
+        const clefInstruction: ClefInstruction = <ClefInstruction>value;
         if (
           (this.activeClefs[key - 1] === undefined) ||
           (clefInstruction.ClefType !== this.activeClefs[key - 1].ClefType || (
             clefInstruction.ClefType === this.activeClefs[key - 1].ClefType &&
             clefInstruction.Line !== this.activeClefs[key - 1].Line
           ))) {
-          let lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
+          const lastStaffEntry: SourceStaffEntry = new SourceStaffEntry(undefined, undefined);
           this.currentMeasure.LastInstructionsStaffEntries[this.inSourceMeasureInstrumentIndex + key - 1] = lastStaffEntry;
-          let newClefInstruction: ClefInstruction = clefInstruction;
+          const newClefInstruction: ClefInstruction = clefInstruction;
           newClefInstruction.Parent = lastStaffEntry;
           lastStaffEntry.Instructions.push(newClefInstruction);
           this.activeClefs[key - 1] = clefInstruction;
@@ -951,16 +951,16 @@ export class InstrumentReader {
    */
   private getNoteDurationForTuplet(xmlNode: IXmlElement): Fraction {
     let duration: Fraction = new Fraction(0, 1);
-    let typeDuration: Fraction = this.getNoteDurationFromTypeNode(xmlNode);
+    const typeDuration: Fraction = this.getNoteDurationFromTypeNode(xmlNode);
     if (xmlNode.element("time-modification") !== undefined) {
-      let time: IXmlElement = xmlNode.element("time-modification");
+      const time: IXmlElement = xmlNode.element("time-modification");
       if (time !== undefined) {
         if (time.element("actual-notes") !== undefined && time.element("normal-notes") !== undefined) {
-          let actualNotes: IXmlElement = time.element("actual-notes");
-          let normalNotes: IXmlElement = time.element("normal-notes");
+          const actualNotes: IXmlElement = time.element("actual-notes");
+          const normalNotes: IXmlElement = time.element("normal-notes");
           if (actualNotes !== undefined && normalNotes !== undefined) {
-            let actual: number = parseInt(actualNotes.value, 10);
-            let normal: number = parseInt(normalNotes.value, 10);
+            const actual: number = parseInt(actualNotes.value, 10);
+            const normal: number = parseInt(normalNotes.value, 10);
             duration = new Fraction(normal * typeDuration.Numerator, actual * typeDuration.Denominator);
           }
         }
@@ -1003,15 +1003,15 @@ export class InstrumentReader {
     let xmlMeasureIndex: number = this.currentXmlMeasureIndex;
     let read: boolean = false;
     while (!read) {
-      let xmlMeasureListArr: IXmlElement[] = this.xmlMeasureList[xmlMeasureIndex].elements();
+      const xmlMeasureListArr: IXmlElement[] = this.xmlMeasureList[xmlMeasureIndex].elements();
       for (let idx: number = 0, len: number = xmlMeasureListArr.length; idx < len; ++idx) {
-        let xmlNode: IXmlElement = xmlMeasureListArr[idx];
+        const xmlNode: IXmlElement = xmlMeasureListArr[idx];
         if (xmlNode.name === "note" && xmlNode.element("time-modification") === undefined) {
           if (xmlNode.element("duration") !== undefined && xmlNode.element("type") !== undefined) {
-            let durationNode: IXmlElement = xmlNode.element("duration");
-            let typeNode: IXmlElement = xmlNode.element("type");
+            const durationNode: IXmlElement = xmlNode.element("duration");
+            const typeNode: IXmlElement = xmlNode.element("type");
             if (durationNode !== undefined && typeNode !== undefined) {
-              let type: string = typeNode.value;
+              const type: string = typeNode.value;
               let noteDuration: number = 0;
               try {
                 noteDuration = parseInt(durationNode.value, 10);
@@ -1077,7 +1077,7 @@ export class InstrumentReader {
       if (divisionsFromNote === 0) {
         xmlMeasureIndex++;
         if (xmlMeasureIndex === this.xmlMeasureList.length) {
-          let errorMsg: string = ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError", "Invalid divisions value at Instrument: ");
+          const errorMsg: string = ITextTranslation.translateText("ReaderErrorMEssages/DivisionsError", "Invalid divisions value at Instrument: ");
           throw new MusicSheetReadingException(errorMsg + this.instrument.Name);
         }
       }

+ 91 - 91
src/MusicalScore/ScoreIO/MusicSheetReader.ts

@@ -53,7 +53,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private static doCalculationsAfterDurationHasBeenSet(instrumentReaders: InstrumentReader[]): void {
-        for (let instrumentReader of instrumentReaders) {
+        for (const instrumentReader of instrumentReaders) {
             instrumentReader.doCalculationsAfterDurationHasBeenSet();
         }
     }
@@ -73,7 +73,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private _removeFromArray(list: any[], elem: any): void {
-        let i: number = list.indexOf(elem);
+        const i: number = list.indexOf(elem);
         if (i !== -1) {
             list.splice(i, 1);
         }
@@ -116,7 +116,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     //}
 
     private _createMusicSheet(root: IXmlElement, path: string): MusicSheet {
-        let instrumentReaders: InstrumentReader[] = [];
+        const instrumentReaders: InstrumentReader[] = [];
         let sourceMeasureCounter: number = 0;
         this.musicSheet = new MusicSheet();
         this.musicSheet.Path = path;
@@ -124,13 +124,13 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             throw new MusicSheetReadingException("Undefined root element");
         }
         this.pushSheetLabels(root, path);
-        let partlistNode: IXmlElement = root.element("part-list");
+        const partlistNode: IXmlElement = root.element("part-list");
         if (partlistNode === undefined) {
             throw new MusicSheetReadingException("Undefined partListNode");
         }
 
-        let partInst: IXmlElement[] = root.elements("part");
-        let partList: IXmlElement[] = partlistNode.elements();
+        const partInst: IXmlElement[] = root.elements("part");
+        const partList: IXmlElement[] = partlistNode.elements();
         this.initializeReading(partList, partInst, instrumentReaders);
         let couldReadMeasure: boolean = true;
         this.currentFraction = new Fraction(0, 1);
@@ -151,11 +151,11 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 sourceMeasureCounter = 0;
             }
             this.currentMeasure = new SourceMeasure(this.completeNumberOfStaves);
-            for (let instrumentReader of instrumentReaders) {
+            for (const instrumentReader of instrumentReaders) {
                 try {
                     couldReadMeasure = couldReadMeasure && instrumentReader.readNextXmlMeasure(this.currentMeasure, this.currentFraction, guitarPro);
                 } catch (e) {
-                    let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/InstrumentError", "Error while reading instruments.");
+                    const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/InstrumentError", "Error while reading instruments.");
                     throw new MusicSheetReadingException(errorMsg, e);
                 }
 
@@ -191,7 +191,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private initializeReading(partList: IXmlElement[], partInst: IXmlElement[], instrumentReaders: InstrumentReader[]): void {
-        let instrumentDict: { [_: string]: Instrument; } = this.createInstrumentGroups(partList);
+        const instrumentDict: { [_: string]: Instrument; } = this.createInstrumentGroups(partList);
         this.completeNumberOfStaves = this.getCompleteNumberOfStavesFromXml(partInst);
         if (partInst.length !== 0) {
             // (*) this.repetitionInstructionReader.MusicSheet = this.musicSheet;
@@ -200,16 +200,16 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             this.previousMeasure = undefined;
         }
         let counter: number = 0;
-        for (let node of partInst) {
-            let idNode: IXmlAttribute = node.attribute("id");
+        for (const node of partInst) {
+            const idNode: IXmlAttribute = node.attribute("id");
             if (idNode) {
-                let currentInstrument: Instrument = instrumentDict[idNode.value];
-                let xmlMeasureList: IXmlElement[] = node.elements("measure");
+                const currentInstrument: Instrument = instrumentDict[idNode.value];
+                const xmlMeasureList: IXmlElement[] = node.elements("measure");
                 let instrumentNumberOfStaves: number = 1;
                 try {
                     instrumentNumberOfStaves = this.getInstrumentNumberOfStavesFromXml(node);
                 } catch (err) {
-                    let errorMsg: string = ITextTranslation.translateText(
+                    const errorMsg: string = ITextTranslation.translateText(
                         "ReaderErrorMessages/InstrumentStavesNumberError",
                         "Invalid number of staves at instrument: "
                     );
@@ -235,10 +235,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      * @param instrumentReaders
      */
     private checkIfRhythmInstructionsAreSetAndEqual(instrumentReaders: InstrumentReader[]): void {
-        let rhythmInstructions: RhythmInstruction[] = [];
+        const rhythmInstructions: RhythmInstruction[] = [];
         for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
             if (this.currentMeasure.FirstInstructionsStaffEntries[i] !== undefined) {
-                let last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
+                const last: AbstractNotationInstruction = this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions[
                 this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions.length - 1
                     ];
                 if (last instanceof RhythmInstruction) {
@@ -249,7 +249,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         let maxRhythmValue: number = 0.0;
         let index: number = -1;
         for (let idx: number = 0, len: number = rhythmInstructions.length; idx < len; ++idx) {
-            let rhythmInstruction: RhythmInstruction = rhythmInstructions[idx];
+            const rhythmInstruction: RhythmInstruction = rhythmInstructions[idx];
             if (rhythmInstruction.Rhythm.RealValue > maxRhythmValue) {
                 if (this.areRhythmInstructionsMixed(rhythmInstructions) && rhythmInstruction.SymbolEnum !== RhythmSymbolEnum.NONE) {
                     continue;
@@ -259,7 +259,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
         if (rhythmInstructions.length > 0 && rhythmInstructions.length < this.completeNumberOfStaves) {
-            let rhythmInstruction: RhythmInstruction = rhythmInstructions[index].clone();
+            const rhythmInstruction: RhythmInstruction = rhythmInstructions[index].clone();
             for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
                 if (
                     this.currentMeasure.FirstInstructionsStaffEntries[i] !== undefined &&
@@ -274,12 +274,12 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 }
             }
             for (let idx: number = 0, len: number = instrumentReaders.length; idx < len; ++idx) {
-                let instrumentReader: InstrumentReader = instrumentReaders[idx];
+                const instrumentReader: InstrumentReader = instrumentReaders[idx];
                 instrumentReader.ActiveRhythm = rhythmInstruction;
             }
         }
         if (rhythmInstructions.length === 0 && this.currentMeasure === this.musicSheet.SourceMeasures[0]) {
-            let rhythmInstruction: RhythmInstruction = new RhythmInstruction(new Fraction(4, 4, 0, false), RhythmSymbolEnum.NONE);
+            const rhythmInstruction: RhythmInstruction = new RhythmInstruction(new Fraction(4, 4, 0, false), RhythmSymbolEnum.NONE);
             for (let i: number = 0; i < this.completeNumberOfStaves; i++) {
                 if (this.currentMeasure.FirstInstructionsStaffEntries[i] === undefined) {
                     this.currentMeasure.FirstInstructionsStaffEntries[i] = new SourceStaffEntry(undefined, undefined);
@@ -289,18 +289,18 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 this.currentMeasure.FirstInstructionsStaffEntries[i].Instructions.push(rhythmInstruction);
             }
             for (let idx: number = 0, len: number = instrumentReaders.length; idx < len; ++idx) {
-                let instrumentReader: InstrumentReader = instrumentReaders[idx];
+                const instrumentReader: InstrumentReader = instrumentReaders[idx];
                 instrumentReader.ActiveRhythm = rhythmInstruction;
             }
         }
         for (let idx: number = 0, len: number = rhythmInstructions.length; idx < len; ++idx) {
-            let rhythmInstruction: RhythmInstruction = rhythmInstructions[idx];
+            const rhythmInstruction: RhythmInstruction = rhythmInstructions[idx];
             if (rhythmInstruction.Rhythm.RealValue < maxRhythmValue) {
                 if (this._lastElement(
                         this.currentMeasure.FirstInstructionsStaffEntries[rhythmInstructions.indexOf(rhythmInstruction)].Instructions
                     ) instanceof RhythmInstruction) {
                     // TODO Test correctness
-                    let instrs: AbstractNotationInstruction[] =
+                    const instrs: AbstractNotationInstruction[] =
                         this.currentMeasure.FirstInstructionsStaffEntries[rhythmInstructions.indexOf(rhythmInstruction)].Instructions;
                     instrs[instrs.length - 1] = rhythmInstructions[index].clone();
                 }
@@ -340,17 +340,17 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      */
     private setSourceMeasureDuration(instrumentReaders: InstrumentReader[], sourceMeasureCounter: number): number {
         let activeRhythm: Fraction = new Fraction(0, 1);
-        let instrumentsMaxTieNoteFractions: Fraction[] = [];
-        for (let instrumentReader of instrumentReaders) {
+        const instrumentsMaxTieNoteFractions: Fraction[] = [];
+        for (const instrumentReader of instrumentReaders) {
             instrumentsMaxTieNoteFractions.push(instrumentReader.MaxTieNoteFraction);
-            let activeRythmMeasure: Fraction = instrumentReader.ActiveRhythm.Rhythm;
+            const activeRythmMeasure: Fraction = instrumentReader.ActiveRhythm.Rhythm;
             if (activeRhythm.lt(activeRythmMeasure)) {
                 activeRhythm = new Fraction(activeRythmMeasure.Numerator, activeRythmMeasure.Denominator, 0, false);
             }
         }
-        let instrumentsDurations: Fraction[] = this.currentMeasure.calculateInstrumentsDuration(this.musicSheet, instrumentsMaxTieNoteFractions);
+        const instrumentsDurations: Fraction[] = this.currentMeasure.calculateInstrumentsDuration(this.musicSheet, instrumentsMaxTieNoteFractions);
         let maxInstrumentDuration: Fraction = new Fraction(0, 1);
-        for (let instrumentsDuration of instrumentsDurations) {
+        for (const instrumentsDuration of instrumentsDurations) {
             if (maxInstrumentDuration.lt(instrumentsDuration)) {
                 maxInstrumentDuration = instrumentsDuration;
             }
@@ -370,18 +370,18 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         this.currentMeasure.Duration = maxInstrumentDuration;
         this.currentMeasure.MeasureNumber = sourceMeasureCounter;
         for (let i: number = 0; i < instrumentsDurations.length; i++) {
-            let instrumentsDuration: Fraction = instrumentsDurations[i];
+            const instrumentsDuration: Fraction = instrumentsDurations[i];
             if (
                 (this.currentMeasure.ImplicitMeasure && instrumentsDuration !== maxInstrumentDuration) ||
                 !Fraction.Equal(instrumentsDuration, activeRhythm) &&
                 !this.allInstrumentsHaveSameDuration(instrumentsDurations, maxInstrumentDuration)
             ) {
-                let firstStaffIndexOfInstrument: number = this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.musicSheet.Instruments[i]);
+                const firstStaffIndexOfInstrument: number = this.musicSheet.getGlobalStaffIndexOfFirstStaff(this.musicSheet.Instruments[i]);
                 for (let staffIndex: number = 0; staffIndex < this.musicSheet.Instruments[i].Staves.length; staffIndex++) {
                     if (!this.staffMeasureIsEmpty(firstStaffIndexOfInstrument + staffIndex)) {
                         this.currentMeasure.setErrorInStaffMeasure(firstStaffIndexOfInstrument + staffIndex, true);
-                        let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/MissingNotesError",
-                                                                              "Given Notes don't correspond to measure duration.");
+                        const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/MissingNotesError",
+                                                                                "Given Notes don't correspond to measure duration.");
                         this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
                     }
                 }
@@ -399,7 +399,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      */
     private checkFractionsForEquivalence(maxInstrumentDuration: Fraction, activeRhythm: Fraction): void {
         if (activeRhythm.Denominator > maxInstrumentDuration.Denominator) {
-            let factor: number = activeRhythm.Denominator / maxInstrumentDuration.Denominator;
+            const factor: number = activeRhythm.Denominator / maxInstrumentDuration.Denominator;
             maxInstrumentDuration.expand(factor);
         }
     }
@@ -429,7 +429,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     private allInstrumentsHaveSameDuration(instrumentsDurations: Fraction[], maxInstrumentDuration: Fraction): boolean {
         let counter: number = 0;
         for (let idx: number = 0, len: number = instrumentsDurations.length; idx < len; ++idx) {
-            let instrumentsDuration: Fraction = instrumentsDurations[idx];
+            const instrumentsDuration: Fraction = instrumentsDurations[idx];
             if (instrumentsDuration.Equals(maxInstrumentDuration)) {
                 counter++;
             }
@@ -454,10 +454,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     private checkSourceMeasureForNullEntries(): void {
         for (let i: number = this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
             for (let j: number = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries.length - 1; j >= 0; j--) {
-                let sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[j];
+                const sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[j];
                 if (sourceStaffEntry !== undefined) {
                     for (let k: number = sourceStaffEntry.VoiceEntries.length - 1; k >= 0; k--) {
-                        let voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[k];
+                        const voiceEntry: VoiceEntry = sourceStaffEntry.VoiceEntries[k];
                         if (voiceEntry.Notes.length === 0) {
                             this._removeFromArray(voiceEntry.ParentVoice.VoiceEntries, voiceEntry);
                             this._removeFromArray(sourceStaffEntry.VoiceEntries, voiceEntry);
@@ -472,7 +472,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         for (let i: number = this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1; i >= 0; i--) {
             let counter: number = 0;
             for (let idx: number = 0, len: number = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries.length; idx < len; ++idx) {
-                let sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[idx];
+                const sourceStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[i].StaffEntries[idx];
                 if (sourceStaffEntry === undefined) {
                     counter++;
                 }
@@ -496,11 +496,11 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         }
         if (this.musicSheet.Title === undefined) {
             try {
-                let barI: number = Math.max(
+                const barI: number = Math.max(
                     0, filePath.lastIndexOf("/"), filePath.lastIndexOf("\\")
                 );
-                let filename: string = filePath.substr(barI);
-                let filenameSplits: string[] = filename.split(".", 1);
+                const filename: string = filePath.substr(barI);
+                const filenameSplits: string[] = filename.split(".", 1);
                 this.musicSheet.Title = new Label(filenameSplits[0]);
             } catch (ex) {
                 Logging.log("MusicSheetReader.pushSheetLabels: ", ex);
@@ -511,7 +511,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
 
     // Checks whether _elem_ has an attribute with value _val_.
     private presentAttrsWithValue(elem: IXmlElement, val: string): boolean {
-        for (let attr of elem.attributes()) {
+        for (const attr of elem.attributes()) {
             if (attr.value === val) {
                 return true;
             }
@@ -520,11 +520,11 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private readComposer(root: IXmlElement): void {
-        let identificationNode: IXmlElement = root.element("identification");
+        const identificationNode: IXmlElement = root.element("identification");
         if (identificationNode !== undefined) {
-            let creators: IXmlElement[] = identificationNode.elements("creator");
+            const creators: IXmlElement[] = identificationNode.elements("creator");
             for (let idx: number = 0, len: number = creators.length; idx < len; ++idx) {
-                let creator: IXmlElement = creators[idx];
+                const creator: IXmlElement = creators[idx];
                 if (creator.hasAttributes) {
                     if (this.presentAttrsWithValue(creator, "composer")) {
                         this.musicSheet.Composer = new Label(this.trimString(creator.value));
@@ -539,7 +539,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private readTitleAndComposerFromCredits(root: IXmlElement): void {
-        let systemYCoordinates: number = this.computeSystemYCoordinates(root);
+        const systemYCoordinates: number = this.computeSystemYCoordinates(root);
         if (systemYCoordinates === 0) {
             return;
         }
@@ -548,9 +548,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         let largestCreditYInfo: number = 0;
         let finalSubtitle: string = undefined;
         let possibleTitle: string = undefined;
-        let creditElements: IXmlElement[] = root.elements("credit");
+        const creditElements: IXmlElement[] = root.elements("credit");
         for (let idx: number = 0, len: number = creditElements.length; idx < len; ++idx) {
-            let credit: IXmlElement = creditElements[idx];
+            const credit: IXmlElement = creditElements[idx];
             if (!credit.attribute("page")) {
                 return;
             }
@@ -561,13 +561,13 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                     if (!creditChild.attribute("justify")) {
                         break;
                     }
-                    let creditJustify: string = creditChild.attribute("justify").value;
-                    let creditY: string = creditChild.attribute("default-y").value;
-                    let creditYInfo: number = parseFloat(creditY);
+                    const creditJustify: string = creditChild.attribute("justify").value;
+                    const creditY: string = creditChild.attribute("default-y").value;
+                    const creditYInfo: number = parseFloat(creditY);
                     if (creditYInfo > systemYCoordinates) {
                         if (this.musicSheet.Title === undefined) {
-                            let creditSize: string = creditChild.attribute("font-size").value;
-                            let titleCreditSizeInt: number = parseFloat(creditSize);
+                            const creditSize: string = creditChild.attribute("font-size").value;
+                            const titleCreditSizeInt: number = parseFloat(creditSize);
                             if (largestTitleCreditSize < titleCreditSizeInt) {
                                 largestTitleCreditSize = titleCreditSizeInt;
                                 finalTitle = creditChild.value;
@@ -616,20 +616,20 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
         }
         let paperHeight: number = 0;
         let topSystemDistance: number = 0;
-        let defi: string = root.element("defaults").element("page-layout").element("page-height").value;
+        const defi: string = root.element("defaults").element("page-layout").element("page-height").value;
         paperHeight = parseFloat(defi);
         let found: boolean = false;
-        let parts: IXmlElement[] = root.elements("part");
+        const parts: IXmlElement[] = root.elements("part");
         for (let idx: number = 0, len: number = parts.length; idx < len; ++idx) {
-            let measures: IXmlElement[] = parts[idx].elements("measure");
+            const measures: IXmlElement[] = parts[idx].elements("measure");
             for (let idx2: number = 0, len2: number = measures.length; idx2 < len2; ++idx2) {
-                let measure: IXmlElement = measures[idx2];
+                const measure: IXmlElement = measures[idx2];
                 if (measure.element("print") !== undefined) {
-                    let systemLayouts: IXmlElement[] = measure.element("print").elements("system-layout");
+                    const systemLayouts: IXmlElement[] = measure.element("print").elements("system-layout");
                     for (let idx3: number = 0, len3: number = systemLayouts.length; idx3 < len3; ++idx3) {
-                        let syslab: IXmlElement = systemLayouts[idx3];
+                        const syslab: IXmlElement = systemLayouts[idx3];
                         if (syslab.element("top-system-distance") !== undefined) {
-                            let topSystemDistanceString: string = syslab.element("top-system-distance").value;
+                            const topSystemDistanceString: string = syslab.element("top-system-distance").value;
                             topSystemDistance = parseFloat(topSystemDistanceString);
                             found = true;
                             break;
@@ -643,9 +643,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
         if (root.element("defaults").element("system-layout") !== undefined) {
-            let syslay: IXmlElement = root.element("defaults").element("system-layout");
+            const syslay: IXmlElement = root.element("defaults").element("system-layout");
             if (syslay.element("top-system-distance") !== undefined) {
-                let topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
+                const topSystemDistanceString: string = root.element("defaults").element("system-layout").element("top-system-distance").value;
                 topSystemDistance = parseFloat(topSystemDistanceString);
             }
         }
@@ -656,7 +656,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
     }
 
     private readTitle(root: IXmlElement): void {
-        let titleNode: IXmlElement = root.element("work");
+        const titleNode: IXmlElement = root.element("work");
         let titleNodeChild: IXmlElement = undefined;
         if (titleNode !== undefined) {
             titleNodeChild = titleNode.element("work-title");
@@ -664,7 +664,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 this.musicSheet.Title = new Label(this.trimString(titleNodeChild.value));
             }
         }
-        let movementNode: IXmlElement = root.element("movement-title");
+        const movementNode: IXmlElement = root.element("movement-title");
         let finalSubTitle: string = "";
         if (movementNode !== undefined) {
             if (this.musicSheet.Title === undefined) {
@@ -674,9 +674,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
         if (titleNode !== undefined) {
-            let subtitleNodeChild: IXmlElement = titleNode.element("work-number");
+            const subtitleNodeChild: IXmlElement = titleNode.element("work-number");
             if (subtitleNodeChild !== undefined) {
-                let workNumber: string = subtitleNodeChild.value;
+                const workNumber: string = subtitleNodeChild.value;
                 if (workNumber) {
                     if (finalSubTitle) {
                         finalSubTitle = workNumber;
@@ -699,27 +699,27 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      */
     private createInstrumentGroups(entryList: IXmlElement[]): { [_: string]: Instrument; } {
         let instrumentId: number = 0;
-        let instrumentDict: { [_: string]: Instrument; } = {};
+        const instrumentDict: { [_: string]: Instrument; } = {};
         let currentGroup: InstrumentalGroup;
         try {
-            let entryArray: IXmlElement[] = entryList;
+            const entryArray: IXmlElement[] = entryList;
             for (let idx: number = 0, len: number = entryArray.length; idx < len; ++idx) {
-                let node: IXmlElement = entryArray[idx];
+                const node: IXmlElement = entryArray[idx];
                 if (node.name === "score-part") {
-                    let instrIdString: string = node.attribute("id").value;
-                    let instrument: Instrument = new Instrument(instrumentId, instrIdString, this.musicSheet, currentGroup);
+                    const instrIdString: string = node.attribute("id").value;
+                    const instrument: Instrument = new Instrument(instrumentId, instrIdString, this.musicSheet, currentGroup);
                     instrumentId++;
-                    let partElements: IXmlElement[] = node.elements();
+                    const partElements: IXmlElement[] = node.elements();
                     for (let idx2: number = 0, len2: number = partElements.length; idx2 < len2; ++idx2) {
-                        let partElement: IXmlElement = partElements[idx2];
+                        const partElement: IXmlElement = partElements[idx2];
                         try {
                             if (partElement.name === "part-name") {
                                 instrument.Name = partElement.value;
                             } else if (partElement.name === "score-instrument") {
-                                let subInstrument: SubInstrument = new SubInstrument(instrument);
+                                const subInstrument: SubInstrument = new SubInstrument(instrument);
                                 subInstrument.idString = partElement.firstAttribute.value;
                                 instrument.SubInstruments.push(subInstrument);
-                                let subElement: IXmlElement = partElement.element("instrument-name");
+                                const subElement: IXmlElement = partElement.element("instrument-name");
                                 if (subElement !== undefined) {
                                     subInstrument.name = subElement.value;
                                     subInstrument.setMidiInstrument(subElement.value);
@@ -727,15 +727,15 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                             } else if (partElement.name === "midi-instrument") {
                                 let subInstrument: SubInstrument = instrument.getSubInstrument(partElement.firstAttribute.value);
                                 for (let idx3: number = 0, len3: number = instrument.SubInstruments.length; idx3 < len3; ++idx3) {
-                                    let subInstr: SubInstrument = instrument.SubInstruments[idx3];
+                                    const subInstr: SubInstrument = instrument.SubInstruments[idx3];
                                     if (subInstr.idString === partElement.value) {
                                         subInstrument = subInstr;
                                         break;
                                     }
                                 }
-                                let instrumentElements: IXmlElement[] = partElement.elements();
+                                const instrumentElements: IXmlElement[] = partElement.elements();
                                 for (let idx3: number = 0, len3: number = instrumentElements.length; idx3 < len3; ++idx3) {
-                                    let instrumentElement: IXmlElement = instrumentElements[idx3];
+                                    const instrumentElement: IXmlElement = instrumentElements[idx3];
                                     try {
                                         if (instrumentElement.name === "midi-channel") {
                                             if (parseInt(instrumentElement.value, 10) === 10) {
@@ -749,7 +749,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                                             subInstrument.fixedKey = Math.max(0, parseInt(instrumentElement.value, 10));
                                         } else if (instrumentElement.name === "volume") {
                                             try {
-                                                let result: number = <number>parseFloat(instrumentElement.value);
+                                                const result: number = <number>parseFloat(instrumentElement.value);
                                                 subInstrument.volume = result / 127.0;
                                             } catch (ex) {
                                                 Logging.debug("ExpressionReader.readExpressionParameters", "read volume", ex);
@@ -757,7 +757,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
 
                                         } else if (instrumentElement.name === "pan") {
                                             try {
-                                                let result: number = <number>parseFloat(instrumentElement.value);
+                                                const result: number = <number>parseFloat(instrumentElement.value);
                                                 subInstrument.pan = result / 64.0;
                                             } catch (ex) {
                                                 Logging.debug("ExpressionReader.readExpressionParameters", "read pan", ex);
@@ -776,7 +776,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
 
                     }
                     if (instrument.SubInstruments.length === 0) {
-                        let subInstrument: SubInstrument = new SubInstrument(instrument);
+                        const subInstrument: SubInstrument = new SubInstrument(instrument);
                         instrument.SubInstruments.push(subInstrument);
                     }
                     instrumentDict[instrIdString] = instrument;
@@ -789,7 +789,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                     }
                 } else {
                     if ((node.name === "part-group") && (node.attribute("type").value === "start")) {
-                        let iG: InstrumentalGroup = new InstrumentalGroup("group", this.musicSheet, currentGroup);
+                        const iG: InstrumentalGroup = new InstrumentalGroup("group", this.musicSheet, currentGroup);
                         if (currentGroup !== undefined) {
                             currentGroup.InstrumentalGroups.push(iG);
                         } else {
@@ -800,7 +800,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                         if ((node.name === "part-group") && (node.attribute("type").value === "stop")) {
                             if (currentGroup !== undefined) {
                                 if (currentGroup.InstrumentalGroups.length === 1) {
-                                    let instr: InstrumentalGroup = currentGroup.InstrumentalGroups[0];
+                                    const instr: InstrumentalGroup = currentGroup.InstrumentalGroups[0];
                                     if (currentGroup.Parent !== undefined) {
                                         currentGroup.Parent.InstrumentalGroups.push(instr);
                                         this._removeFromArray(currentGroup.Parent.InstrumentalGroups, currentGroup);
@@ -816,14 +816,14 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
                 }
             }
         } catch (e) {
-            let errorMsg: string = ITextTranslation.translateText(
+            const errorMsg: string = ITextTranslation.translateText(
                 "ReaderErrorMessages/InstrumentError", "Error while reading Instruments"
             );
             throw new MusicSheetReadingException(errorMsg, e);
         }
 
         for (let idx: number = 0, len: number = this.musicSheet.Instruments.length; idx < len; ++idx) {
-            let instrument: Instrument = this.musicSheet.Instruments[idx];
+            const instrument: Instrument = this.musicSheet.Instruments[idx];
             if (!instrument.Name) {
                 instrument.Name = "Instr. " + instrument.IdString;
             }
@@ -838,10 +838,10 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      */
     private getCompleteNumberOfStavesFromXml(partInst: IXmlElement[]): number {
         let num: number = 0;
-        for (let partNode of partInst) {
-            let xmlMeasureList: IXmlElement[] = partNode.elements("measure");
+        for (const partNode of partInst) {
+            const xmlMeasureList: IXmlElement[] = partNode.elements("measure");
             if (xmlMeasureList.length > 0) {
-                let xmlMeasure: IXmlElement = xmlMeasureList[0];
+                const xmlMeasure: IXmlElement = xmlMeasureList[0];
                 if (xmlMeasure !== undefined) {
                     let stavesNode: IXmlElement = xmlMeasure.element("attributes");
                     if (stavesNode !== undefined) {
@@ -856,7 +856,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
         if (isNaN(num) || num <= 0) {
-            let errorMsg: string = ITextTranslation.translateText(
+            const errorMsg: string = ITextTranslation.translateText(
                 "ReaderErrorMessages/StaffError", "Invalid number of staves."
             );
             throw new MusicSheetReadingException(errorMsg);
@@ -871,9 +871,9 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
      */
     private getInstrumentNumberOfStavesFromXml(partNode: IXmlElement): number {
         let num: number = 0;
-        let xmlMeasure: IXmlElement = partNode.element("measure");
+        const xmlMeasure: IXmlElement = partNode.element("measure");
         if (xmlMeasure !== undefined) {
-            let attributes: IXmlElement = xmlMeasure.element("attributes");
+            const attributes: IXmlElement = xmlMeasure.element("attributes");
             let staves: IXmlElement = undefined;
             if (attributes !== undefined) {
                 staves = attributes.element("staves");
@@ -885,7 +885,7 @@ export class MusicSheetReader /*implements IMusicSheetReader*/ {
             }
         }
         if (isNaN(num) || num <= 0) {
-            let errorMsg: string = ITextTranslation.translateText(
+            const errorMsg: string = ITextTranslation.translateText(
                 "ReaderErrorMessages/StaffError", "Invalid number of Staves."
             );
             throw new MusicSheetReadingException(errorMsg);

+ 10 - 10
src/MusicalScore/ScoreIO/MusicSymbolModules/ArticulationReader.ts

@@ -32,14 +32,14 @@ export class ArticulationReader {
    */
   public addArticulationExpression(node: IXmlElement, currentVoiceEntry: VoiceEntry): void {
     if (node !== undefined && node.elements().length > 0) {
-      let childNotes: IXmlElement[] = node.elements();
+      const childNotes: IXmlElement[] = node.elements();
       for (let idx: number = 0, len: number = childNotes.length; idx < len; ++idx) {
-        let childNote: IXmlElement = childNotes[idx];
-        let name: string = childNote.name;
+        const childNote: IXmlElement = childNotes[idx];
+        const name: string = childNote.name;
         try {
           // some Articulations appear in Xml separated with a "-" (eg strong-accent), we remove it for enum parsing
           name.replace("-", "");
-          let articulationEnum: ArticulationEnum = ArticulationEnum[name];
+          const articulationEnum: ArticulationEnum = ArticulationEnum[name];
           if (VoiceEntry.isSupportedArticulation(articulationEnum)) {
             // staccato should be first
             if (name === "staccato") {
@@ -55,7 +55,7 @@ export class ArticulationReader {
             }
           }
         } catch (ex) {
-          let errorMsg: string = "Invalid note articulation.";
+          const errorMsg: string = "Invalid note articulation.";
           log.debug("addArticulationExpression", errorMsg, ex);
           return;
         }
@@ -118,7 +118,7 @@ export class ArticulationReader {
     }
     node = xmlNode.element("fingering");
     if (node !== undefined) {
-      let currentTechnicalInstruction: TechnicalInstruction = new TechnicalInstruction();
+      const currentTechnicalInstruction: TechnicalInstruction = new TechnicalInstruction();
       currentTechnicalInstruction.type = TechnicalInstructionType.Fingering;
       currentTechnicalInstruction.value = node.value;
       currentVoiceEntry.TechnicalInstructions.push(currentTechnicalInstruction);
@@ -162,16 +162,16 @@ export class ArticulationReader {
         ornament = new OrnamentContainer(OrnamentEnum.InvertedMordent);
       }
       if (ornament !== undefined) {
-        let accidentalsList: IXmlElement[] = ornamentsNode.elements("accidental-mark");
+        const accidentalsList: IXmlElement[] = ornamentsNode.elements("accidental-mark");
         if (accidentalsList !== undefined) {
           let placement: PlacementEnum = PlacementEnum.Below;
           let accidental: AccidentalEnum = AccidentalEnum.NONE;
-          let accidentalsListArr: IXmlElement[] = accidentalsList;
+          const accidentalsListArr: IXmlElement[] = accidentalsList;
           for (let idx: number = 0, len: number = accidentalsListArr.length; idx < len; ++idx) {
-            let accidentalNode: IXmlElement = accidentalsListArr[idx];
+            const accidentalNode: IXmlElement = accidentalsListArr[idx];
             let text: string = accidentalNode.value;
             accidental = this.getAccEnumFromString(text);
-            let placementAttr: IXmlAttribute = accidentalNode.attribute("placement");
+            const placementAttr: IXmlAttribute = accidentalNode.attribute("placement");
             if (accidentalNode.hasAttributes && placementAttr !== undefined) {
               text = placementAttr.value;
               if (text === "above") {

+ 29 - 29
src/MusicalScore/ScoreIO/MusicSymbolModules/ChordSymbolReader.ts

@@ -8,16 +8,16 @@ import * as log from "loglevel";
 
 export class ChordSymbolReader {
     public static readChordSymbol(xmlNode: IXmlElement, musicSheet: MusicSheet, activeKey: KeyInstruction): ChordSymbolContainer {
-        let root: IXmlElement = xmlNode.element("root");
-        let kind: IXmlElement = xmlNode.element("kind");
+        const root: IXmlElement = xmlNode.element("root");
+        const kind: IXmlElement = xmlNode.element("kind");
 
         // must be always present
         if (root === undefined || kind === undefined) {
           return undefined;
         }
 
-        let rootStep: IXmlElement = root.element("root-step");
-        let rootAlter: IXmlElement = root.element("root-alter");
+        const rootStep: IXmlElement = root.element("root-step");
+        const rootAlter: IXmlElement = root.element("root-alter");
 
         // a valid NoteEnum value should be present
         if (rootStep === undefined) {
@@ -27,8 +27,8 @@ export class ChordSymbolReader {
         try {
             rootNote = NoteEnum[rootStep.value.trim()];
         } catch (ex) {
-            let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                  "Invalid chord symbol");
+            const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                    "Invalid chord symbol");
             musicSheet.SheetErrors.pushMeasureError(errorMsg);
             log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
             return undefined;
@@ -40,22 +40,22 @@ export class ChordSymbolReader {
             try {
                 rootAlteration = <AccidentalEnum>parseInt(rootAlter.value, undefined);
             } catch (ex) {
-                let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                      "Invalid chord symbol");
+                const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                        "Invalid chord symbol");
                 musicSheet.SheetErrors.pushMeasureError(errorMsg);
                 log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
             }
 
         }
         // using default octave value, to be changed later
-        let rootPitch: Pitch = new Pitch(rootNote, 1, rootAlteration);
-        let kindValue: string = kind.value.trim().replace("-", "");
+        const rootPitch: Pitch = new Pitch(rootNote, 1, rootAlteration);
+        const kindValue: string = kind.value.trim().replace("-", "");
         let chordKind: ChordSymbolEnum;
         try {
             chordKind = ChordSymbolEnum[kindValue];
         } catch (ex) {
-            let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                  "Invalid chord symbol");
+            const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                    "Invalid chord symbol");
             musicSheet.SheetErrors.pushMeasureError(errorMsg);
             log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
             return undefined;
@@ -63,17 +63,17 @@ export class ChordSymbolReader {
 
         // bass is optional
         let bassPitch: Pitch = undefined;
-        let bass: IXmlElement = xmlNode.element("bass");
+        const bass: IXmlElement = xmlNode.element("bass");
         if (bass !== undefined) {
-            let bassStep: IXmlElement = bass.element("bass-step");
-            let bassAlter: IXmlElement = bass.element("bass-alter");
+            const bassStep: IXmlElement = bass.element("bass-step");
+            const bassAlter: IXmlElement = bass.element("bass-alter");
             let bassNote: NoteEnum = NoteEnum.C;
             if (bassStep !== undefined) {
                 try {
                     bassNote = NoteEnum[bassStep.value.trim()];
                 } catch (ex) {
-                    let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                          "Invalid chord symbol");
+                    const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                            "Invalid chord symbol");
                     musicSheet.SheetErrors.pushMeasureError(errorMsg);
                     log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
                     return undefined;
@@ -84,8 +84,8 @@ export class ChordSymbolReader {
                 try {
                     bassAlteration = <AccidentalEnum>parseInt(bassAlter.value, undefined);
                 } catch (ex) {
-                    let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                          "Invalid chord symbol");
+                    const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                            "Invalid chord symbol");
                     musicSheet.SheetErrors.pushMeasureError(errorMsg);
                     log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
                 }
@@ -95,11 +95,11 @@ export class ChordSymbolReader {
 
         // degree is optional
         let degree: Degree = undefined;
-        let degreeNode: IXmlElement = xmlNode.element("degree");
+        const degreeNode: IXmlElement = xmlNode.element("degree");
         if (degreeNode !== undefined) {
-            let degreeValue: IXmlElement = degreeNode.element("degree-value");
-            let degreeAlter: IXmlElement = degreeNode.element("degree-alter");
-            let degreeType: IXmlElement = degreeNode.element("degree-type");
+            const degreeValue: IXmlElement = degreeNode.element("degree-value");
+            const degreeAlter: IXmlElement = degreeNode.element("degree-alter");
+            const degreeType: IXmlElement = degreeNode.element("degree-type");
             if (degreeValue === undefined || degreeAlter === undefined || degreeType === undefined) {
               return undefined;
             }
@@ -108,8 +108,8 @@ export class ChordSymbolReader {
             try {
                 value = parseInt(degreeValue.value.trim(), undefined);
             } catch (ex) {
-                let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                      "Invalid chord symbol");
+                const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                        "Invalid chord symbol");
                 musicSheet.SheetErrors.pushMeasureError(errorMsg);
                 log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
                 return undefined;
@@ -119,8 +119,8 @@ export class ChordSymbolReader {
             try {
                 alter = <AccidentalEnum>parseInt(degreeAlter.value, undefined);
             } catch (ex) {
-                let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                      "Invalid chord symbol");
+                const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                        "Invalid chord symbol");
                 musicSheet.SheetErrors.pushMeasureError(errorMsg);
                 log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
                 return undefined;
@@ -130,8 +130,8 @@ export class ChordSymbolReader {
             try {
                 text = ChordDegreeText[degreeType.value.trim().toLowerCase()];
             } catch (ex) {
-                let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
-                                                                      "Invalid chord symbol");
+                const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/ChordSymbolError",
+                                                                        "Invalid chord symbol");
                 musicSheet.SheetErrors.pushMeasureError(errorMsg);
                 log.debug("InstrumentReader.readChordSymbol", errorMsg, ex);
                 return undefined;

+ 207 - 205
src/MusicalScore/ScoreIO/VoiceGenerator.ts

@@ -124,7 +124,7 @@ export class VoiceGenerator {
       //    this.voice.Parent.HasLyrics = true;
       //}
       let hasTupletCommand: boolean = false;
-      let notationNode: IXmlElement = noteNode.element("notations");
+      const notationNode: IXmlElement = noteNode.element("notations");
       if (notationNode !== undefined) {
         // let articNode: IXmlElement = undefined;
         // (*)
@@ -136,7 +136,7 @@ export class VoiceGenerator {
         //if (this.slurReader !== undefined && (slurNodes = notationNode.elements("slur")))
         //    this.slurReader.addSlur(slurNodes, this.currentNote);
         // check for Tuplets
-        let tupletNodeList: IXmlElement[] = notationNode.elements("tuplet");
+        const tupletNodeList: IXmlElement[] = notationNode.elements("tuplet");
         if (tupletNodeList.length > 0) {
           this.openTupletNumber = this.addTuplet(noteNode, tupletNodeList);
           hasTupletCommand = true;
@@ -146,17 +146,17 @@ export class VoiceGenerator {
           this.currentVoiceEntry.ArpeggiosNotesIndices.push(this.currentVoiceEntry.Notes.indexOf(this.currentNote));
         }
         // check for Ties - must be the last check
-        let tiedNodeList: IXmlElement[] = notationNode.elements("tied");
+        const tiedNodeList: IXmlElement[] = notationNode.elements("tied");
         if (tiedNodeList.length > 0) {
           this.addTie(tiedNodeList, measureStartAbsoluteTimestamp, maxTieNoteFraction);
         }
 
         // remove open ties, if there is already a gap between the last tie note and now.
-        let openTieDict: { [_: number]: Tie; } = this.openTieDict;
-        for (let key in openTieDict) {
+        const openTieDict: { [_: number]: Tie; } = this.openTieDict;
+        for (const key in openTieDict) {
           if (openTieDict.hasOwnProperty(key)) {
-            let tie: Tie = openTieDict[key];
-            if (Fraction.plus(tie.Start.ParentStaffEntry.Timestamp, tie.Start.Length).lt(this.currentStaffEntry.Timestamp)) {
+                        const tie: Tie = openTieDict[key];
+                        if (Fraction.plus(tie.Start.ParentStaffEntry.Timestamp, tie.Start.Length).lt(this.currentStaffEntry.Timestamp)) {
               delete openTieDict[key];
             }
           }
@@ -168,10 +168,10 @@ export class VoiceGenerator {
         this.handleTimeModificationNode(noteNode);
       }
     } catch (err) {
-      let errorMsg: string = ITextTranslation.translateText(
+            const errorMsg: string = ITextTranslation.translateText(
         "ReaderErrorMessages/NoteError", "Ignored erroneous Note."
       );
-      this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+            this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
     }
 
     return this.currentNote;
@@ -188,19 +188,19 @@ export class VoiceGenerator {
       && this.currentVoiceEntry.graceVoiceEntriesBefore !== undefined
       && this.currentVoiceEntry.graceVoiceEntriesBefore.length > 0
     ) {
-      let voice: Voice = this.currentVoiceEntry.ParentVoice;
-      let horizontalIndex: number = this.currentMeasure.VerticalSourceStaffEntryContainers.indexOf(this.currentStaffEntry.VerticalContainerParent);
-      let verticalIndex: number = this.currentStaffEntry.VerticalContainerParent.StaffEntries.indexOf(this.currentStaffEntry);
-      let previousStaffEntry: SourceStaffEntry = this.currentMeasure.getPreviousSourceStaffEntryFromIndex(verticalIndex, horizontalIndex);
-      if (previousStaffEntry !== undefined) {
+        const voice: Voice = this.currentVoiceEntry.ParentVoice;
+        const horizontalIndex: number = this.currentMeasure.VerticalSourceStaffEntryContainers.indexOf(this.currentStaffEntry.VerticalContainerParent);
+        const verticalIndex: number = this.currentStaffEntry.VerticalContainerParent.StaffEntries.indexOf(this.currentStaffEntry);
+        const previousStaffEntry: SourceStaffEntry = this.currentMeasure.getPreviousSourceStaffEntryFromIndex(verticalIndex, horizontalIndex);
+        if (previousStaffEntry !== undefined) {
         let previousVoiceEntry: VoiceEntry = undefined;
         for (let idx: number = 0, len: number = previousStaffEntry.VoiceEntries.length; idx < len; ++idx) {
-          let voiceEntry: VoiceEntry = previousStaffEntry.VoiceEntries[idx];
+          const voiceEntry: VoiceEntry = previousStaffEntry.VoiceEntries[idx];
           if (voiceEntry.ParentVoice === voice) {
             previousVoiceEntry = voiceEntry;
             previousVoiceEntry.graceVoiceEntriesAfter = [];
             for (let idx2: number = 0, len2: number = this.currentVoiceEntry.graceVoiceEntriesBefore.length; idx2 < len2; ++idx2) {
-              let graceVoiceEntry: VoiceEntry = this.currentVoiceEntry.graceVoiceEntriesBefore[idx2];
+              const graceVoiceEntry: VoiceEntry = this.currentVoiceEntry.graceVoiceEntriesBefore[idx2];
               previousVoiceEntry.graceVoiceEntriesAfter.push(graceVoiceEntry);
             }
             this.currentVoiceEntry.graceVoiceEntriesBefore = [];
@@ -221,11 +221,11 @@ export class VoiceGenerator {
    * @returns {SourceStaffEntry}
    */
   public checkForStaffEntryLink(index: number, currentStaff: Staff, currentStaffEntry: SourceStaffEntry, currentMeasure: SourceMeasure): SourceStaffEntry {
-    let staffEntryLink: StaffEntryLink = new StaffEntryLink(this.currentVoiceEntry);
+    const staffEntryLink: StaffEntryLink = new StaffEntryLink(this.currentVoiceEntry);
     staffEntryLink.LinkStaffEntries.push(currentStaffEntry);
     currentStaffEntry.Link = staffEntryLink;
-    let linkMusicTimestamp: Fraction = this.currentVoiceEntry.Timestamp.clone();
-    let verticalSourceStaffEntryContainer: VerticalSourceStaffEntryContainer = currentMeasure.getVerticalContainerByTimestamp(linkMusicTimestamp);
+    const linkMusicTimestamp: Fraction = this.currentVoiceEntry.Timestamp.clone();
+    const verticalSourceStaffEntryContainer: VerticalSourceStaffEntryContainer = currentMeasure.getVerticalContainerByTimestamp(linkMusicTimestamp);
     currentStaffEntry = verticalSourceStaffEntryContainer.StaffEntries[index];
     if (currentStaffEntry === undefined) {
       currentStaffEntry = new SourceStaffEntry(verticalSourceStaffEntryContainer, currentStaff);
@@ -244,11 +244,11 @@ export class VoiceGenerator {
   }
 
   public checkOpenTies(): void {
-    let openTieDict: { [key: number]: Tie } = this.openTieDict;
-    for (let key in openTieDict) {
+    const openTieDict: {[key: number]: Tie} = this.openTieDict;
+    for (const key in openTieDict) {
       if (openTieDict.hasOwnProperty(key)) {
-        let tie: Tie = openTieDict[key];
-        if (Fraction.plus(tie.Start.ParentStaffEntry.Timestamp, tie.Start.Length)
+                const tie: Tie = openTieDict[key];
+                if (Fraction.plus(tie.Start.ParentStaffEntry.Timestamp, tie.Start.Length)
             .lt(tie.Start.ParentStaffEntry.VerticalContainerParent.ParentMeasure.Duration)) {
           delete openTieDict[key];
         }
@@ -297,28 +297,28 @@ export class VoiceGenerator {
       case "maxima":
         return new Fraction(8, 1);
       default: {
-        let errorMsg: string = ITextTranslation.translateText(
+                const errorMsg: string = ITextTranslation.translateText(
           "ReaderErrorMessages/NoteDurationError", "Invalid note duration."
         );
-        throw new MusicSheetReadingException(errorMsg);
+                throw new MusicSheetReadingException(errorMsg);
       }
     }
   }
 
   private readArticulations(notationNode: IXmlElement, currentVoiceEntry: VoiceEntry): void {
-    let articNode: IXmlElement = notationNode.element("articulations");
+    const articNode: IXmlElement = notationNode.element("articulations");
     if (articNode !== undefined) {
       this.articulationReader.addArticulationExpression(articNode, currentVoiceEntry);
     }
-    let fermaNode: IXmlElement = notationNode.element("fermata");
+    const fermaNode: IXmlElement = notationNode.element("fermata");
     if (fermaNode !== undefined) {
       this.articulationReader.addFermata(fermaNode, currentVoiceEntry);
     }
-    let tecNode: IXmlElement = notationNode.element("technical");
+    const tecNode: IXmlElement = notationNode.element("technical");
     if (tecNode !== undefined) {
       this.articulationReader.addTechnicalArticulations(tecNode, currentVoiceEntry);
     }
-    let ornaNode: IXmlElement = notationNode.element("ornaments");
+    const ornaNode: IXmlElement = notationNode.element("ornaments");
     if (ornaNode !== undefined) {
       this.articulationReader.addOrnament(ornaNode, currentVoiceEntry);
     }
@@ -340,39 +340,39 @@ export class VoiceGenerator {
     let noteStep: NoteEnum = NoteEnum.C;
     let noteOctave: number = 0;
     let playbackInstrumentId: string = undefined;
-    let xmlnodeElementsArr: IXmlElement[] = node.elements();
+    const xmlnodeElementsArr: IXmlElement[] = node.elements();
     for (let idx: number = 0, len: number = xmlnodeElementsArr.length; idx < len; ++idx) {
-      let noteElement: IXmlElement = xmlnodeElementsArr[idx];
+      const noteElement: IXmlElement = xmlnodeElementsArr[idx];
       try {
         if (noteElement.name === "pitch") {
-          let noteElementsArr: IXmlElement[] = noteElement.elements();
+          const noteElementsArr: IXmlElement[] = noteElement.elements();
           for (let idx2: number = 0, len2: number = noteElementsArr.length; idx2 < len2; ++idx2) {
-            let pitchElement: IXmlElement = noteElementsArr[idx2];
+            const pitchElement: IXmlElement = noteElementsArr[idx2];
             try {
               if (pitchElement.name === "step") {
                 noteStep = NoteEnum[pitchElement.value];
                 if (noteStep === undefined) {
-                  let errorMsg: string = ITextTranslation.translateText(
+                    const errorMsg: string = ITextTranslation.translateText(
                     "ReaderErrorMessages/NotePitchError",
                     "Invalid pitch while reading note."
                   );
-                  this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-                  throw new MusicSheetReadingException(errorMsg, undefined);
+                    this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                    throw new MusicSheetReadingException(errorMsg, undefined);
                 }
               } else if (pitchElement.name === "alter") {
                 noteAlter = parseInt(pitchElement.value, 10);
                 if (isNaN(noteAlter)) {
-                  let errorMsg: string = ITextTranslation.translateText(
+                                    const errorMsg: string = ITextTranslation.translateText(
                     "ReaderErrorMessages/NoteAlterationError", "Invalid alteration while reading note."
                   );
-                  this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-                  throw new MusicSheetReadingException(errorMsg, undefined);
+                                    this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                                    throw new MusicSheetReadingException(errorMsg, undefined);
                 }
 
               } else if (pitchElement.name === "octave") {
                 noteOctave = parseInt(pitchElement.value, 10);
                 if (isNaN(noteOctave)) {
-                  let errorMsg: string = ITextTranslation.translateText(
+                  const errorMsg: string = ITextTranslation.translateText(
                     "ReaderErrorMessages/NoteOctaveError", "Invalid octave value while reading note."
                   );
                   this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
@@ -385,11 +385,11 @@ export class VoiceGenerator {
 
           }
         } else if (noteElement.name === "unpitched") {
-          let displayStep: IXmlElement = noteElement.element("display-step");
+          const displayStep: IXmlElement = noteElement.element("display-step");
           if (displayStep !== undefined) {
             noteStep = NoteEnum[displayStep.value.toUpperCase()];
           }
-          let octave: IXmlElement = noteElement.element("display-octave");
+          const octave: IXmlElement = noteElement.element("display-octave");
           if (octave !== undefined) {
             noteOctave = parseInt(octave.value, 10);
             if (guitarPro) {
@@ -407,9 +407,9 @@ export class VoiceGenerator {
     }
 
     noteOctave -= Pitch.OctaveXmlDifference;
-    let pitch: Pitch = new Pitch(noteStep, noteOctave, noteAlter);
-    let noteLength: Fraction = Fraction.createFromFraction(noteDuration);
-    let note: Note = new Note(this.currentVoiceEntry, this.currentStaffEntry, noteLength, pitch);
+    const pitch: Pitch = new Pitch(noteStep, noteOctave, noteAlter);
+    const noteLength: Fraction = Fraction.createFromFraction(noteDuration);
+    const note: Note = new Note(this.currentVoiceEntry, this.currentStaffEntry, noteLength, pitch);
     note.PlaybackInstrumentId = playbackInstrumentId;
     if (!graceNote) {
       this.currentVoiceEntry.Notes.push(note);
@@ -429,8 +429,8 @@ export class VoiceGenerator {
    * @returns {Note}
    */
   private addRestNote(noteDuration: Fraction): Note {
-    let restFraction: Fraction = Fraction.createFromFraction(noteDuration);
-    let restNote: Note = new Note(this.currentVoiceEntry, this.currentStaffEntry, restFraction, undefined);
+    const restFraction: Fraction = Fraction.createFromFraction(noteDuration);
+    const restNote: Note = new Note(this.currentVoiceEntry, this.currentStaffEntry, restFraction, undefined);
     this.currentVoiceEntry.Notes.push(restNote);
     if (this.openBeam !== undefined) {
       this.openBeam.ExtendedNoteList.push(restNote);
@@ -446,15 +446,15 @@ export class VoiceGenerator {
    */
   private createBeam(node: IXmlElement, note: Note, grace: boolean): void {
     try {
-      let beamNode: IXmlElement = node.element("beam");
+      const beamNode: IXmlElement = node.element("beam");
       let beamAttr: IXmlAttribute = undefined;
       if (beamNode !== undefined && beamNode.hasAttributes) {
         beamAttr = beamNode.attribute("number");
       }
       if (beamAttr !== undefined) {
-        let beamNumber: number = parseInt(beamAttr.value, 10);
-        let mainBeamNode: IXmlElement[] = node.elements("beam");
-        let currentBeamTag: string = mainBeamNode[0].value;
+        const beamNumber: number = parseInt(beamAttr.value, 10);
+        const mainBeamNode: IXmlElement[] = node.elements("beam");
+        const currentBeamTag: string = mainBeamNode[0].value;
         if (beamNumber === 1 && mainBeamNode !== undefined) {
           if (currentBeamTag === "begin" && this.lastBeamTag !== currentBeamTag) {
             if (grace) {
@@ -477,7 +477,7 @@ export class VoiceGenerator {
             return;
           }
           for (let idx: number = 0, len: number = this.openGraceBeam.Notes.length; idx < len; ++idx) {
-            let beamNote: Note = this.openGraceBeam.Notes[idx];
+            const beamNote: Note = this.openGraceBeam.Notes[idx];
             if (this.currentVoiceEntry === beamNote.ParentVoiceEntry) {
               sameVoiceEntry = true;
             }
@@ -493,7 +493,7 @@ export class VoiceGenerator {
             return;
           }
           for (let idx: number = 0, len: number = this.openBeam.Notes.length; idx < len; ++idx) {
-            let beamNote: Note = this.openBeam.Notes[idx];
+            const beamNote: Note = this.openBeam.Notes[idx];
             if (this.currentVoiceEntry === beamNote.ParentVoiceEntry) {
               sameVoiceEntry = true;
             }
@@ -507,7 +507,7 @@ export class VoiceGenerator {
         }
       }
     } catch (e) {
-      let errorMsg: string = ITextTranslation.translateText(
+      const errorMsg: string = ITextTranslation.translateText(
         "ReaderErrorMessages/BeamError", "Error while reading beam."
       );
       this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
@@ -521,7 +521,7 @@ export class VoiceGenerator {
    */
   private handleOpenBeam(): void {
     if (this.openBeam.Notes.length === 1) {
-      let beamNote: Note = this.openBeam.Notes[0];
+      const beamNote: Note = this.openBeam.Notes[0];
       beamNote.NoteBeam = undefined;
       this.openBeam = undefined;
       return;
@@ -529,17 +529,19 @@ export class VoiceGenerator {
     if (this.currentNote === CollectionUtil.last(this.openBeam.Notes)) {
       this.openBeam = undefined;
     } else {
-      let beamLastNote: Note = CollectionUtil.last(this.openBeam.Notes);
-      let beamLastNoteStaffEntry: SourceStaffEntry = beamLastNote.ParentStaffEntry;
-      let horizontalIndex: number = this.currentMeasure.getVerticalContainerIndexByTimestamp(beamLastNoteStaffEntry.Timestamp);
-      let verticalIndex: number = beamLastNoteStaffEntry.VerticalContainerParent.StaffEntries.indexOf(beamLastNoteStaffEntry);
+      const beamLastNote: Note = CollectionUtil.last(this.openBeam.Notes);
+      const beamLastNoteStaffEntry: SourceStaffEntry = beamLastNote.ParentStaffEntry;
+      const horizontalIndex: number = this.currentMeasure.getVerticalContainerIndexByTimestamp(beamLastNoteStaffEntry.Timestamp);
+      const verticalIndex: number = beamLastNoteStaffEntry.VerticalContainerParent.StaffEntries.indexOf(beamLastNoteStaffEntry);
       if (horizontalIndex < this.currentMeasure.VerticalSourceStaffEntryContainers.length - 1) {
-        let nextStaffEntry: SourceStaffEntry = this.currentMeasure.VerticalSourceStaffEntryContainers[horizontalIndex + 1].StaffEntries[verticalIndex];
+        const nextStaffEntry: SourceStaffEntry = this.currentMeasure
+                                                             .VerticalSourceStaffEntryContainers[horizontalIndex + 1]
+                                                             .StaffEntries[verticalIndex];
         if (nextStaffEntry !== undefined) {
           for (let idx: number = 0, len: number = nextStaffEntry.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = nextStaffEntry.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = nextStaffEntry.VoiceEntries[idx];
             if (voiceEntry.ParentVoice === this.voice) {
-              let candidateNote: Note = voiceEntry.Notes[0];
+              const candidateNote: Note = voiceEntry.Notes[0];
               if (candidateNote.Length.lte(new Fraction(1, 8))) {
                 this.openBeam.addNoteToBeam(candidateNote);
                 this.openBeam = undefined;
@@ -559,27 +561,27 @@ export class VoiceGenerator {
     let graceChord: boolean = false;
     let type: string = "";
     if (node.elements("type")) {
-      let typeNode: IXmlElement[] = node.elements("type");
+      const typeNode: IXmlElement[] = node.elements("type");
       if (typeNode) {
         type = typeNode[0].value;
         try {
           note.Length = this.getNoteDurationFromType(type);
           note.Length.Numerator = 1;
         } catch (e) {
-          let errorMsg: string = ITextTranslation.translateText(
+                    const errorMsg: string = ITextTranslation.translateText(
             "ReaderErrorMessages/NoteDurationError", "Invalid note duration."
           );
-          this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-          throw new MusicSheetReadingException(errorMsg, e);
+                    this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                    throw new MusicSheetReadingException(errorMsg, e);
         }
 
       }
     }
-    let graceNode: IXmlElement = node.element("grace");
+    const graceNode: IXmlElement = node.element("grace");
     if (graceNode !== undefined && graceNode.attributes()) {
       if (graceNode.attribute("slash")) {
-        let slash: string = graceNode.attribute("slash").value;
-        if (slash === "yes") {
+                const slash: string = graceNode.attribute("slash").value;
+                if (slash === "yes") {
           note.GraceNoteSlash = true;
         }
       }
@@ -622,12 +624,12 @@ export class VoiceGenerator {
       if (timeModNode !== undefined) {
         timeModNode = timeModNode.element("actual-notes");
       }
-      let tupletNodeListArr: IXmlElement[] = tupletNodeList;
+      const tupletNodeListArr: IXmlElement[] = tupletNodeList;
       for (let idx: number = 0, len: number = tupletNodeListArr.length; idx < len; ++idx) {
-        let tupletNode: IXmlElement = tupletNodeListArr[idx];
-        if (tupletNode !== undefined && tupletNode.attributes()) {
-          let type: string = tupletNode.attribute("type").value;
-          if (type === "start") {
+                const tupletNode: IXmlElement = tupletNodeListArr[idx];
+                if (tupletNode !== undefined && tupletNode.attributes()) {
+                    const type: string = tupletNode.attribute("type").value;
+                    if (type === "start") {
             let tupletNumber: number = 1;
             if (tupletNode.attribute("number")) {
               tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
@@ -636,15 +638,15 @@ export class VoiceGenerator {
             if (timeModNode !== undefined) {
               tupletLabelNumber = parseInt(timeModNode.value, 10);
               if (isNaN(tupletLabelNumber)) {
-                let errorMsg: string = ITextTranslation.translateText(
+                                const errorMsg: string = ITextTranslation.translateText(
                   "ReaderErrorMessages/TupletNoteDurationError", "Invalid tuplet note duration."
                 );
-                this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-                throw new MusicSheetReadingException(errorMsg, undefined);
+                                this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                                throw new MusicSheetReadingException(errorMsg, undefined);
               }
 
             }
-            let tuplet: Tuplet = new Tuplet(tupletLabelNumber);
+            const tuplet: Tuplet = new Tuplet(tupletLabelNumber);
             if (this.tupletDict[tupletNumber] !== undefined) {
               delete this.tupletDict[tupletNumber];
               if (Object.keys(this.tupletDict).length === 0) {
@@ -654,7 +656,7 @@ export class VoiceGenerator {
               }
             }
             this.tupletDict[tupletNumber] = tuplet;
-            let subnotelist: Note[] = [];
+            const subnotelist: Note[] = [];
             subnotelist.push(this.currentNote);
             tuplet.Notes.push(subnotelist);
             tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
@@ -665,15 +667,15 @@ export class VoiceGenerator {
             if (tupletNode.attribute("number")) {
               tupletNumber = parseInt(tupletNode.attribute("number").value, 10);
             }
-            let tuplet: Tuplet = this.tupletDict[tupletNumber];
+            const tuplet: Tuplet = this.tupletDict[tupletNumber];
             if (tuplet !== undefined) {
-              let subnotelist: Note[] = [];
-              subnotelist.push(this.currentNote);
-              tuplet.Notes.push(subnotelist);
-              tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
-              this.currentNote.NoteTuplet = tuplet;
-              delete this.tupletDict[tupletNumber];
-              if (Object.keys(this.tupletDict).length === 0) {
+                            const subnotelist: Note[] = [];
+                            subnotelist.push(this.currentNote);
+                            tuplet.Notes.push(subnotelist);
+                            tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
+                            this.currentNote.NoteTuplet = tuplet;
+                            delete this.tupletDict[tupletNumber];
+                            if (Object.keys(this.tupletDict).length === 0) {
                 this.openTupletNumber = 0;
               } else if (Object.keys(this.tupletDict).length > 1) {
                 this.openTupletNumber--;
@@ -683,16 +685,16 @@ export class VoiceGenerator {
         }
       }
     } else if (tupletNodeList[0] !== undefined) {
-      let n: IXmlElement = tupletNodeList[0];
-      if (n.hasAttributes) {
-        let type: string = n.attribute("type").value;
-        let tupletnumber: number = 1;
-        if (n.attribute("number")) {
+            const n: IXmlElement = tupletNodeList[0];
+            if (n.hasAttributes) {
+                const type: string = n.attribute("type").value;
+                let tupletnumber: number = 1;
+                if (n.attribute("number")) {
           tupletnumber = parseInt(n.attribute("number").value, 10);
         }
-        let noTupletNumbering: boolean = isNaN(tupletnumber);
+                const noTupletNumbering: boolean = isNaN(tupletnumber);
 
-        if (type === "start") {
+                if (type === "start") {
           let tupletLabelNumber: number = 0;
           let timeModNode: IXmlElement = node.element("time-modification");
           if (timeModNode !== undefined) {
@@ -701,11 +703,11 @@ export class VoiceGenerator {
           if (timeModNode !== undefined) {
             tupletLabelNumber = parseInt(timeModNode.value, 10);
             if (isNaN(tupletLabelNumber)) {
-              let errorMsg: string = ITextTranslation.translateText(
+                            const errorMsg: string = ITextTranslation.translateText(
                 "ReaderErrorMessages/TupletNoteDurationError", "Invalid tuplet note duration."
               );
-              this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-              throw new MusicSheetReadingException(errorMsg);
+                            this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                            throw new MusicSheetReadingException(errorMsg);
             }
 
           }
@@ -717,7 +719,7 @@ export class VoiceGenerator {
           if (tuplet === undefined) {
             tuplet = this.tupletDict[tupletnumber] = new Tuplet(tupletLabelNumber);
           }
-          let subnotelist: Note[] = [];
+          const subnotelist: Note[] = [];
           subnotelist.push(this.currentNote);
           tuplet.Notes.push(subnotelist);
           tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
@@ -727,19 +729,19 @@ export class VoiceGenerator {
           if (noTupletNumbering) {
             tupletnumber = this.openTupletNumber;
           }
-          let tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
+          const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
           if (tuplet !== undefined) {
-            let subnotelist: Note[] = [];
-            subnotelist.push(this.currentNote);
-            tuplet.Notes.push(subnotelist);
-            tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
-            this.currentNote.NoteTuplet = tuplet;
-            if (Object.keys(this.tupletDict).length === 0) {
+                        const subnotelist: Note[] = [];
+                        subnotelist.push(this.currentNote);
+                        tuplet.Notes.push(subnotelist);
+                        tuplet.Fractions.push(this.getTupletNoteDurationFromType(node));
+                        this.currentNote.NoteTuplet = tuplet;
+                        if (Object.keys(this.tupletDict).length === 0) {
               this.openTupletNumber = 0;
             } else if (Object.keys(this.tupletDict).length > 1) {
               this.openTupletNumber--;
             }
-            delete this.tupletDict[tupletnumber];
+                        delete this.tupletDict[tupletnumber];
           }
         }
       }
@@ -755,34 +757,34 @@ export class VoiceGenerator {
     if (this.tupletDict[this.openTupletNumber] !== undefined) {
       try {
         // Tuplet should already be created
-        let tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
-        let notes: Note[] = CollectionUtil.last(tuplet.Notes);
-        let lastTupletVoiceEntry: VoiceEntry = notes[0].ParentVoiceEntry;
-        let noteList: Note[];
-        if (lastTupletVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)) {
+                const tuplet: Tuplet = this.tupletDict[this.openTupletNumber];
+                const notes: Note[] = CollectionUtil.last(tuplet.Notes);
+                const lastTupletVoiceEntry: VoiceEntry = notes[0].ParentVoiceEntry;
+                let noteList: Note[];
+                if (lastTupletVoiceEntry.Timestamp.Equals(this.currentVoiceEntry.Timestamp)) {
           noteList = notes;
         } else {
           noteList = [];
           tuplet.Notes.push(noteList);
           tuplet.Fractions.push(this.getTupletNoteDurationFromType(noteNode));
         }
-        noteList.push(this.currentNote);
-        this.currentNote.NoteTuplet = tuplet;
+                noteList.push(this.currentNote);
+                this.currentNote.NoteTuplet = tuplet;
       } catch (ex) {
-        let errorMsg: string = ITextTranslation.translateText(
+                const errorMsg: string = ITextTranslation.translateText(
           "ReaderErrorMessages/TupletNumberError", "Invalid tuplet number."
         );
-        this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-        throw ex;
+                this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                throw ex;
       }
 
     } else if (this.currentVoiceEntry.Notes.length > 0) {
-      let firstNote: Note = this.currentVoiceEntry.Notes[0];
-      if (firstNote.NoteTuplet !== undefined) {
-        let tuplet: Tuplet = firstNote.NoteTuplet;
-        let notes: Note[] = CollectionUtil.last(tuplet.Notes);
-        notes.push(this.currentNote);
-        this.currentNote.NoteTuplet = tuplet;
+            const firstNote: Note = this.currentVoiceEntry.Notes[0];
+            if (firstNote.NoteTuplet !== undefined) {
+                const tuplet: Tuplet = firstNote.NoteTuplet;
+                const notes: Note[] = CollectionUtil.last(tuplet.Notes);
+                notes.push(this.currentNote);
+                this.currentNote.NoteTuplet = tuplet;
       }
     }
   }
@@ -790,25 +792,25 @@ export class VoiceGenerator {
   private addTie(tieNodeList: IXmlElement[], measureStartAbsoluteTimestamp: Fraction, maxTieNoteFraction: Fraction): void {
     if (tieNodeList !== undefined) {
       if (tieNodeList.length === 1) {
-        let tieNode: IXmlElement = tieNodeList[0];
-        if (tieNode !== undefined && tieNode.attributes()) {
-          let type: string = tieNode.attribute("type").value;
-          try {
+                const tieNode: IXmlElement = tieNodeList[0];
+                if (tieNode !== undefined && tieNode.attributes()) {
+                    const type: string = tieNode.attribute("type").value;
+                    try {
             if (type === "start") {
-              let num: number = this.findCurrentNoteInTieDict(this.currentNote);
-              if (num < 0) {
+                            const num: number = this.findCurrentNoteInTieDict(this.currentNote);
+                            if (num < 0) {
                 delete this.openTieDict[num];
               }
-              let newTieNumber: number = this.getNextAvailableNumberForTie();
-              let tie: Tie = new Tie(this.currentNote);
-              this.openTieDict[newTieNumber] = tie;
-              if (this.currentNote.NoteBeam !== undefined) {
+                            const newTieNumber: number = this.getNextAvailableNumberForTie();
+                            const tie: Tie = new Tie(this.currentNote);
+                            this.openTieDict[newTieNumber] = tie;
+                            if (this.currentNote.NoteBeam !== undefined) {
                 if (this.currentNote.NoteBeam.Notes[0] === this.currentNote) {
                   tie.BeamStartTimestamp = Fraction.plus(measureStartAbsoluteTimestamp, this.currentVoiceEntry.Timestamp);
                 } else {
                   for (let idx: number = 0, len: number = this.currentNote.NoteBeam.Notes.length; idx < len; ++idx) {
-                    let note: Note = this.currentNote.NoteBeam.Notes[idx];
-                    if (note.NoteTie !== undefined && note.NoteTie !== tie && note.NoteTie.BeamStartTimestamp !== undefined) {
+                                        const note: Note = this.currentNote.NoteBeam.Notes[idx];
+                                        if (note.NoteTie !== undefined && note.NoteTie !== tie && note.NoteTie.BeamStartTimestamp !== undefined) {
                       tie.BeamStartTimestamp = note.NoteTie.BeamStartTimestamp;
                       break;
                     }
@@ -819,113 +821,113 @@ export class VoiceGenerator {
                 }
               }
             } else if (type === "stop") {
-              let tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
-              let tie: Tie = this.openTieDict[tieNumber];
-              if (tie !== undefined) {
-                let tieStartNote: Note = tie.Start;
-                tieStartNote.NoteTie = tie;
-                tieStartNote.Length.Add(this.currentNote.Length);
-                tie.Fractions.push(this.currentNote.Length);
-                if (maxTieNoteFraction.lt(Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length))) {
+                            const tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
+                            const tie: Tie = this.openTieDict[tieNumber];
+                            if (tie !== undefined) {
+                                const tieStartNote: Note = tie.Start;
+                                tieStartNote.NoteTie = tie;
+                                tieStartNote.Length.Add(this.currentNote.Length);
+                                tie.Fractions.push(this.currentNote.Length);
+                                if (maxTieNoteFraction.lt(Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length))) {
                   maxTieNoteFraction = Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length);
                 }
-                let i: number = this.currentVoiceEntry.Notes.indexOf(this.currentNote);
-                if (i !== -1) {
+                                const i: number = this.currentVoiceEntry.Notes.indexOf(this.currentNote);
+                                if (i !== -1) {
                   this.currentVoiceEntry.Notes.splice(i, 1);
                 }
-                if (
+                                if (
                   this.currentVoiceEntry.Articulations.length === 1
                   && this.currentVoiceEntry.Articulations[0] === ArticulationEnum.fermata
                   && tieStartNote.ParentVoiceEntry.Articulations[ArticulationEnum.fermata] === undefined
                 ) {
                   tieStartNote.ParentVoiceEntry.Articulations.push(ArticulationEnum.fermata);
                 }
-                if (this.currentNote.NoteBeam !== undefined) {
-                  let noteBeamIndex: number = this.currentNote.NoteBeam.Notes.indexOf(this.currentNote);
-                  if (noteBeamIndex === 0 && tie.BeamStartTimestamp === undefined) {
+                                if (this.currentNote.NoteBeam !== undefined) {
+                                    const noteBeamIndex: number = this.currentNote.NoteBeam.Notes.indexOf(this.currentNote);
+                                    if (noteBeamIndex === 0 && tie.BeamStartTimestamp === undefined) {
                     tie.BeamStartTimestamp = Fraction.plus(measureStartAbsoluteTimestamp, this.currentVoiceEntry.Timestamp);
                   }
-                  let noteBeam: Beam = this.currentNote.NoteBeam;
-                  noteBeam.Notes[noteBeamIndex] = tieStartNote;
-                  tie.TieBeam = noteBeam;
+                                    const noteBeam: Beam = this.currentNote.NoteBeam;
+                                    noteBeam.Notes[noteBeamIndex] = tieStartNote;
+                                    tie.TieBeam = noteBeam;
                 }
-                if (this.currentNote.NoteTuplet !== undefined) {
-                  let noteTupletIndex: number = this.currentNote.NoteTuplet.getNoteIndex(this.currentNote);
-                  let index: number = this.currentNote.NoteTuplet.Notes[noteTupletIndex].indexOf(this.currentNote);
-                  let noteTuplet: Tuplet = this.currentNote.NoteTuplet;
-                  noteTuplet.Notes[noteTupletIndex][index] = tieStartNote;
-                  tie.TieTuplet = noteTuplet;
+                                if (this.currentNote.NoteTuplet !== undefined) {
+                                    const noteTupletIndex: number = this.currentNote.NoteTuplet.getNoteIndex(this.currentNote);
+                                    const index: number = this.currentNote.NoteTuplet.Notes[noteTupletIndex].indexOf(this.currentNote);
+                                    const noteTuplet: Tuplet = this.currentNote.NoteTuplet;
+                                    noteTuplet.Notes[noteTupletIndex][index] = tieStartNote;
+                                    tie.TieTuplet = noteTuplet;
                 }
-                for (let idx: number = 0, len: number = this.currentNote.NoteSlurs.length; idx < len; ++idx) {
-                  let slur: Slur = this.currentNote.NoteSlurs[idx];
-                  if (slur.StartNote === this.currentNote) {
+                                for (let idx: number = 0, len: number = this.currentNote.NoteSlurs.length; idx < len; ++idx) {
+                                    const slur: Slur = this.currentNote.NoteSlurs[idx];
+                                    if (slur.StartNote === this.currentNote) {
                     slur.StartNote = tie.Start;
                     slur.StartNote.NoteSlurs.push(slur);
                   }
-                  if (slur.EndNote === this.currentNote) {
+                                    if (slur.EndNote === this.currentNote) {
                     slur.EndNote = tie.Start;
                     slur.EndNote.NoteSlurs.push(slur);
                   }
                 }
-                let lyricsEntries: Dictionary<number, LyricsEntry> = this.currentVoiceEntry.LyricsEntries;
-                for (let lyricsEntry in lyricsEntries) {
+                                const lyricsEntries: Dictionary<number, LyricsEntry> = this.currentVoiceEntry.LyricsEntries;
+                                for (const lyricsEntry in lyricsEntries) {
                   if (lyricsEntries.hasOwnProperty(lyricsEntry)) {
-                    let val: LyricsEntry = this.currentVoiceEntry.LyricsEntries[lyricsEntry];
-                    if (!tieStartNote.ParentVoiceEntry.LyricsEntries.hasOwnProperty(lyricsEntry)) {
+                                        const val: LyricsEntry = this.currentVoiceEntry.LyricsEntries[lyricsEntry];
+                                        if (!tieStartNote.ParentVoiceEntry.LyricsEntries.hasOwnProperty(lyricsEntry)) {
                       tieStartNote.ParentVoiceEntry.LyricsEntries[lyricsEntry] = val;
                       val.Parent = tieStartNote.ParentVoiceEntry;
                     }
                   }
                 }
-                delete this.openTieDict[tieNumber];
+                                delete this.openTieDict[tieNumber];
               }
             }
           } catch (err) {
-            let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/TieError", "Error while reading tie.");
-            this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                        const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/TieError", "Error while reading tie.");
+                        this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
           }
 
         }
       } else if (tieNodeList.length === 2) {
-        let tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
-        if (tieNumber >= 0) {
-          let tie: Tie = this.openTieDict[tieNumber];
-          let tieStartNote: Note = tie.Start;
-          tieStartNote.Length.Add(this.currentNote.Length);
-          tie.Fractions.push(this.currentNote.Length);
-          if (this.currentNote.NoteBeam !== undefined) {
-            let noteBeamIndex: number = this.currentNote.NoteBeam.Notes.indexOf(this.currentNote);
-            if (noteBeamIndex === 0 && tie.BeamStartTimestamp === undefined) {
+                const tieNumber: number = this.findCurrentNoteInTieDict(this.currentNote);
+                if (tieNumber >= 0) {
+                    const tie: Tie = this.openTieDict[tieNumber];
+                    const tieStartNote: Note = tie.Start;
+                    tieStartNote.Length.Add(this.currentNote.Length);
+                    tie.Fractions.push(this.currentNote.Length);
+                    if (this.currentNote.NoteBeam !== undefined) {
+                        const noteBeamIndex: number = this.currentNote.NoteBeam.Notes.indexOf(this.currentNote);
+                        if (noteBeamIndex === 0 && tie.BeamStartTimestamp === undefined) {
               tie.BeamStartTimestamp = Fraction.plus(measureStartAbsoluteTimestamp, this.currentVoiceEntry.Timestamp);
             }
-            let noteBeam: Beam = this.currentNote.NoteBeam;
-            noteBeam.Notes[noteBeamIndex] = tieStartNote;
-            tie.TieBeam = noteBeam;
+                        const noteBeam: Beam = this.currentNote.NoteBeam;
+                        noteBeam.Notes[noteBeamIndex] = tieStartNote;
+                        tie.TieBeam = noteBeam;
           }
-          for (let idx: number = 0, len: number = this.currentNote.NoteSlurs.length; idx < len; ++idx) {
-            let slur: Slur = this.currentNote.NoteSlurs[idx];
-            if (slur.StartNote === this.currentNote) {
+                    for (let idx: number = 0, len: number = this.currentNote.NoteSlurs.length; idx < len; ++idx) {
+                        const slur: Slur = this.currentNote.NoteSlurs[idx];
+                        if (slur.StartNote === this.currentNote) {
               slur.StartNote = tie.Start;
               slur.StartNote.NoteSlurs.push(slur);
             }
-            if (slur.EndNote === this.currentNote) {
+                        if (slur.EndNote === this.currentNote) {
               slur.EndNote = tie.Start;
               slur.EndNote.NoteSlurs.push(slur);
             }
           }
 
-          this.currentVoiceEntry.LyricsEntries.forEach((key: number, value: LyricsEntry): void => {
+                    this.currentVoiceEntry.LyricsEntries.forEach((key: number, value: LyricsEntry): void => {
             if (!tieStartNote.ParentVoiceEntry.LyricsEntries.containsKey(key)) {
               tieStartNote.ParentVoiceEntry.LyricsEntries.setValue(key, value);
               value.Parent = tieStartNote.ParentVoiceEntry;
             }
           });
-          if (maxTieNoteFraction.lt(Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length))) {
+                    if (maxTieNoteFraction.lt(Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length))) {
             maxTieNoteFraction = Fraction.plus(this.currentStaffEntry.Timestamp, this.currentNote.Length);
           }
           // delete currentNote from Notes:
-          let i: number = this.currentVoiceEntry.Notes.indexOf(this.currentNote);
-          if (i !== -1) {
+                    const i: number = this.currentVoiceEntry.Notes.indexOf(this.currentNote);
+                    if (i !== -1) {
             this.currentVoiceEntry.Notes.splice(i, 1);
           }
         }
@@ -938,17 +940,17 @@ export class VoiceGenerator {
    * @returns {number}
    */
   private getNextAvailableNumberForTie(): number {
-    let keys: string[] = Object.keys(this.openTieDict);
-    if (keys.length === 0) {
+        const keys: string[] = Object.keys(this.openTieDict);
+        if (keys.length === 0) {
       return 1;
     }
-    keys.sort((a, b) => (+a - +b)); // FIXME Andrea: test
-    for (let i: number = 0; i < keys.length; i++) {
+        keys.sort((a, b) => (+a - +b)); // FIXME Andrea: test
+        for (let i: number = 0; i < keys.length; i++) {
       if ("" + (i + 1) !== keys[i]) {
         return i + 1;
       }
     }
-    return +(keys[keys.length - 1]) + 1;
+        return +(keys[keys.length - 1]) + 1;
   }
 
   /**
@@ -957,16 +959,16 @@ export class VoiceGenerator {
    * @returns {number}
    */
   private findCurrentNoteInTieDict(candidateNote: Note): number {
-    let openTieDict: { [_: number]: Tie; } = this.openTieDict;
-    for (let key in openTieDict) {
+        const openTieDict: { [_: number]: Tie; } = this.openTieDict;
+        for (const key in openTieDict) {
       if (openTieDict.hasOwnProperty(key)) {
-        let tie: Tie = openTieDict[key];
-        if (tie.Start.Pitch.FundamentalNote === candidateNote.Pitch.FundamentalNote && tie.Start.Pitch.Octave === candidateNote.Pitch.Octave) {
+                const tie: Tie = openTieDict[key];
+                if (tie.Start.Pitch.FundamentalNote === candidateNote.Pitch.FundamentalNote && tie.Start.Pitch.Octave === candidateNote.Pitch.Octave) {
           return +key;
         }
       }
     }
-    return -1;
+        return -1;
   }
 
   /**
@@ -976,15 +978,15 @@ export class VoiceGenerator {
    */
   private getTupletNoteDurationFromType(xmlNode: IXmlElement): Fraction {
     if (xmlNode.element("type") !== undefined) {
-      let typeNode: IXmlElement = xmlNode.element("type");
-      if (typeNode !== undefined) {
-        let type: string = typeNode.value;
-        try {
+            const typeNode: IXmlElement = xmlNode.element("type");
+            if (typeNode !== undefined) {
+                const type: string = typeNode.value;
+                try {
           return this.getNoteDurationFromType(type);
         } catch (e) {
-          let errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid note duration.");
-          this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
-          throw new MusicSheetReadingException("", e);
+                    const errorMsg: string = ITextTranslation.translateText("ReaderErrorMessages/NoteDurationError", "Invalid note duration.");
+                    this.musicSheet.SheetErrors.pushMeasureError(errorMsg);
+                    throw new MusicSheetReadingException("", e);
         }
 
       }

+ 4 - 4
src/MusicalScore/SubInstrument.ts

@@ -94,16 +94,16 @@ export class SubInstrument {
         // FIXME: test this function
         try {
             if (instrumentType) {
-                let tmpName: string = instrumentType.toLowerCase().trim();
-                for (let key in SubInstrument.midiInstrument) {
+                const tmpName: string = instrumentType.toLowerCase().trim();
+                for (const key in SubInstrument.midiInstrument) {
                     if (tmpName.indexOf(key) !== -1) {
                         return key;
                     }
                 }
             }
             if (this.parentInstrument.Name) {
-                let tmpName: string = this.parentInstrument.Name.toLowerCase().trim();
-                for (let key in SubInstrument.midiInstrument) {
+                const tmpName: string = this.parentInstrument.Name.toLowerCase().trim();
+                for (const key in SubInstrument.midiInstrument) {
                     if (tmpName.indexOf(key) !== -1) {
                         return key;
                     }

+ 1 - 1
src/MusicalScore/VoiceData/Expressions/AbstractExpression.ts

@@ -4,7 +4,7 @@ export class AbstractExpression {
     //}
     protected static isStringInStringList(stringList: Array<string>, inputString: string): boolean {
         for (let idx: number = 0, len: number = stringList.length; idx < len; ++idx) {
-            let s: string = stringList[idx];
+            const s: string = stringList[idx];
             if (inputString.toLowerCase() === s.toLowerCase().trim()) {
                 return true;
             }

+ 1 - 1
src/MusicalScore/VoiceData/Expressions/AbstractTempoExpression.ts

@@ -38,7 +38,7 @@ export abstract class AbstractTempoExpression {
     }
 
     protected static isStringInStringList(wordsToFind: string[], inputString: string): boolean {
-        for (let wordToFind of wordsToFind) {
+        for (const wordToFind of wordsToFind) {
             if (AbstractTempoExpression.stringContainsSeparatedWord(inputString.toLowerCase().trim(), wordToFind.toLowerCase().trim())) {
                 return true;
             }

+ 3 - 3
src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousDynamicExpression.ts

@@ -91,7 +91,7 @@ export class ContinuousDynamicExpression extends AbstractExpression {
         );
     }
     public getInterpolatedDynamic(currentAbsoluteTimestamp: Fraction): number {
-        let continuousAbsoluteStartTimestamp: Fraction = this.StartMultiExpression.AbsoluteTimestamp;
+        const continuousAbsoluteStartTimestamp: Fraction = this.StartMultiExpression.AbsoluteTimestamp;
         let continuousAbsoluteEndTimestamp: Fraction;
         if (this.EndMultiExpression !== undefined) {
             continuousAbsoluteEndTimestamp = this.EndMultiExpression.AbsoluteTimestamp;
@@ -102,10 +102,10 @@ export class ContinuousDynamicExpression extends AbstractExpression {
         }
         if (currentAbsoluteTimestamp.lt(continuousAbsoluteStartTimestamp)) { return -1; }
         if (continuousAbsoluteEndTimestamp.lt(currentAbsoluteTimestamp)) { return -2; }
-        let interpolationRatio: number =
+        const interpolationRatio: number =
             Fraction.minus(currentAbsoluteTimestamp, continuousAbsoluteStartTimestamp).RealValue
             / Fraction.minus(continuousAbsoluteEndTimestamp, continuousAbsoluteStartTimestamp).RealValue;
-        let interpolatedVolume: number = Math.max(0.0, Math.min(99.9, this.startVolume + (this.endVolume - this.startVolume) * interpolationRatio));
+        const interpolatedVolume: number = Math.max(0.0, Math.min(99.9, this.startVolume + (this.endVolume - this.startVolume) * interpolationRatio));
         return interpolatedVolume;
     }
     public isWedge(): boolean {

+ 3 - 3
src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/ContinuousTempoExpression.ts

@@ -68,15 +68,15 @@ export class ContinuousTempoExpression extends AbstractTempoExpression {
         return this.ParentMultiTempoExpression.AbsoluteTimestamp.RealValue;
     }
     public getInterpolatedTempo(currentAbsoluteTimestamp: Fraction): number {
-        let continuousAbsoluteStartTimestamp: Fraction = Fraction.plus(
+        const continuousAbsoluteStartTimestamp: Fraction = Fraction.plus(
             this.parentMultiTempoExpression.SourceMeasureParent.AbsoluteTimestamp, this.parentMultiTempoExpression.Timestamp
         );
         if (currentAbsoluteTimestamp.lt(continuousAbsoluteStartTimestamp)) { return -1; }
         if (this.absoluteEndTimestamp.lt(currentAbsoluteTimestamp)) { return -2; }
-        let interpolationRatio: number =
+        const interpolationRatio: number =
             Fraction.minus(currentAbsoluteTimestamp, continuousAbsoluteStartTimestamp).RealValue
             / Fraction.minus(this.absoluteEndTimestamp, continuousAbsoluteStartTimestamp).RealValue;
-        let interpolatedTempo: number = Math.max(0.0, Math.min(250.0, this.startTempo + (this.endTempo - this.startTempo) * interpolationRatio));
+        const interpolatedTempo: number = Math.max(0.0, Math.min(250.0, this.startTempo + (this.endTempo - this.startTempo) * interpolationRatio));
         return interpolatedTempo;
     }
 

+ 5 - 5
src/MusicalScore/VoiceData/Expressions/ContinuousExpressions/Slur.ts

@@ -24,7 +24,7 @@ export class Slur {
     public startNoteHasMoreStartingSlurs(): boolean {
         if (this.startNote === undefined) { return false; }
         for (let idx: number = 0, len: number = this.startNote.NoteSlurs.length; idx < len; ++idx) {
-            let slur: Slur = this.startNote.NoteSlurs[idx];
+            const slur: Slur = this.startNote.NoteSlurs[idx];
             if (slur !== this && slur.StartNote === this.startNote) {
                 return true;
             }
@@ -34,7 +34,7 @@ export class Slur {
     public endNoteHasMoreEndingSlurs(): boolean {
         if (this.endNote === undefined) { return false; }
         for (let idx: number = 0, len: number = this.endNote.NoteSlurs.length; idx < len; ++idx) {
-            let slur: Slur = this.endNote.NoteSlurs[idx];
+            const slur: Slur = this.endNote.NoteSlurs[idx];
             if (slur !== this && slur.EndNote === this.endNote) {
                 return true;
             }
@@ -48,9 +48,9 @@ export class Slur {
         if (this.endNote === undefined || this.startNote === undefined) {
             return false;
         }
-        let length: Fraction = Fraction.minus(this.endNote.getAbsoluteTimestamp(), this.startNote.getAbsoluteTimestamp());
+        const length: Fraction = Fraction.minus(this.endNote.getAbsoluteTimestamp(), this.startNote.getAbsoluteTimestamp());
         for (let idx: number = 0, len: number = this.startNote.NoteSlurs.length; idx < len; ++idx) {
-            let slur: Slur = this.startNote.NoteSlurs[idx];
+            const slur: Slur = this.startNote.NoteSlurs[idx];
             if (
                 slur !== this
                 && slur.EndNote !== undefined
@@ -61,7 +61,7 @@ export class Slur {
             }
         }
         for (let idx: number = 0, len: number = this.endNote.NoteSlurs.length; idx < len; ++idx) {
-            let slur: Slur = this.endNote.NoteSlurs[idx];
+            const slur: Slur = this.endNote.NoteSlurs[idx];
             if (
                 slur !== this
                 && slur.EndNote !== undefined

+ 2 - 2
src/MusicalScore/VoiceData/Expressions/MultiExpression.ts

@@ -170,7 +170,7 @@ export class MultiExpression /*implements IComparable<MultiExpression>*/ {
         }
     }
     private addExpressionToEntryList(expression: AbstractExpression, prefix: string): void {
-        let multiExpressionEntry: MultiExpressionEntry = new MultiExpressionEntry();
+        const multiExpressionEntry: MultiExpressionEntry = new MultiExpressionEntry();
         multiExpressionEntry.prefix = prefix;
         multiExpressionEntry.expression = expression;
         if (expression instanceof ContinuousDynamicExpression) {
@@ -186,7 +186,7 @@ export class MultiExpression /*implements IComparable<MultiExpression>*/ {
     }
     private removeExpressionFromEntryList(expression: AbstractExpression): void {
         for (let idx: number = 0, len: number = this.expressions.length; idx < len; ++idx) {
-            let entry: MultiExpressionEntry = this.expressions[idx];
+            const entry: MultiExpressionEntry = this.expressions[idx];
             if (entry.expression === expression) {
                 this.expressions.splice(idx, 1);
                 break;

+ 1 - 1
src/MusicalScore/VoiceData/Expressions/MultiTempoExpression.ts

@@ -86,7 +86,7 @@ export class MultiTempoExpression /*implements IComparable<MultiTempoExpression>
         } else if (abstractTempoExpression instanceof ContinuousTempoExpression) {
             this.continuousTempo = <ContinuousTempoExpression>abstractTempoExpression;
         }
-        let tempoExpressionEntry: TempoExpressionEntry = new TempoExpressionEntry();
+        const tempoExpressionEntry: TempoExpressionEntry = new TempoExpressionEntry();
         tempoExpressionEntry.prefix = prefix;
         tempoExpressionEntry.expression = abstractTempoExpression;
         tempoExpressionEntry.label = abstractTempoExpression.Label;

+ 3 - 3
src/MusicalScore/VoiceData/Instructions/ClefInstruction.ts

@@ -48,13 +48,13 @@ export class ClefInstruction extends AbstractNotationInstruction {
     }
 
     public static getAllPossibleClefs(): ClefInstruction[] {
-        let clefList: ClefInstruction[] = [];
+        const clefList: ClefInstruction[] = [];
         for (let i: number = 0; i <= 2; i++) {
-            let clefInstructionG: ClefInstruction = new ClefInstruction(ClefEnum.G, i, 2);
+            const clefInstructionG: ClefInstruction = new ClefInstruction(ClefEnum.G, i, 2);
             clefList.push(clefInstructionG);
         }
         for (let j: number = -2; j <= 0; j++) {
-            let clefInstructionF: ClefInstruction = new ClefInstruction(ClefEnum.F, j, 4);
+            const clefInstructionF: ClefInstruction = new ClefInstruction(ClefEnum.F, j, 4);
             clefList.push(clefInstructionF);
         }
         return clefList;

+ 6 - 6
src/MusicalScore/VoiceData/Instructions/KeyInstruction.ts

@@ -21,12 +21,12 @@ export class KeyInstruction extends AbstractNotationInstruction {
     private mode: KeyEnum;
 
     public static copy(keyInstruction: KeyInstruction): KeyInstruction {
-        let newKeyInstruction: KeyInstruction = new KeyInstruction(keyInstruction.parent, keyInstruction.Key, keyInstruction.Mode);
+        const newKeyInstruction: KeyInstruction = new KeyInstruction(keyInstruction.parent, keyInstruction.Key, keyInstruction.Mode);
         return newKeyInstruction;
     }
 
     public static getNoteEnumList(instruction: KeyInstruction): NoteEnum[] {
-        let enums: NoteEnum[] = [];
+        const enums: NoteEnum[] = [];
         if (instruction.keyType > 0) {
             for (let i: number = 0; i < instruction.keyType; i++) {
                 enums.push(KeyInstruction.sharpPositionList[i]);
@@ -41,9 +41,9 @@ export class KeyInstruction extends AbstractNotationInstruction {
     }
 
     public static getAllPossibleMajorKeyInstructions(): KeyInstruction[] {
-        let keyInstructionList: KeyInstruction[] = [];
+        const keyInstructionList: KeyInstruction[] = [];
         for (let keyType: number = -7; keyType < 7; keyType++) {
-            let currentKeyInstruction: KeyInstruction = new KeyInstruction(undefined, keyType, KeyEnum.major);
+            const currentKeyInstruction: KeyInstruction = new KeyInstruction(undefined, keyType, KeyEnum.major);
             keyInstructionList.push(currentKeyInstruction);
         }
         return keyInstructionList;
@@ -66,7 +66,7 @@ export class KeyInstruction extends AbstractNotationInstruction {
     }
 
     public getFundamentalNotesOfAccidentals(): NoteEnum[] {
-        let noteList: NoteEnum[] = [];
+        const noteList: NoteEnum[] = [];
         if (this.keyType > 0) {
             for (let i: number = 0; i < this.keyType; i++) {
                 noteList.push(KeyInstruction.sharpPositionList[i]);
@@ -93,7 +93,7 @@ export class KeyInstruction extends AbstractNotationInstruction {
     }
 
     public OperatorEquals(key2: KeyInstruction): boolean {
-        let key1: KeyInstruction = this;
+        const key1: KeyInstruction = this;
         if (key1 === key2) {
             return true;
         }

+ 1 - 1
src/MusicalScore/VoiceData/Instructions/RepetitionInstruction.ts

@@ -56,7 +56,7 @@ export class RepetitionInstruction /*implements IComparable*/ {
     public parentRepetition: Repetition;
 
     public CompareTo(obj: Object): number {
-        let other: RepetitionInstruction = <RepetitionInstruction>obj;
+        const other: RepetitionInstruction = <RepetitionInstruction>obj;
         if (this.measureIndex > other.measureIndex) {
             return 1;
         } else if (this.measureIndex < other.measureIndex) {

+ 2 - 2
src/MusicalScore/VoiceData/Instructions/RhythmInstruction.ts

@@ -39,7 +39,7 @@ export class RhythmInstruction extends AbstractNotationInstruction {
     }
 
     public OperatorEquals(rhythm2: RhythmInstruction): boolean {
-        let rhythm1: RhythmInstruction = this;
+        const rhythm1: RhythmInstruction = this;
         if (rhythm1 === rhythm2) {
             return true;
         }
@@ -50,7 +50,7 @@ export class RhythmInstruction extends AbstractNotationInstruction {
     }
 
     public OperatorNotEqual(rhythm2: RhythmInstruction): boolean {
-        let rhythm1: RhythmInstruction = this;
+        const rhythm1: RhythmInstruction = this;
         return !(rhythm1 === rhythm2);
     }
 

+ 2 - 2
src/MusicalScore/VoiceData/Lyrics/LyricsWord.ts

@@ -9,7 +9,7 @@ export class LyricWord {
     }
     public containsVoiceEntry(voiceEntry: VoiceEntry): boolean {
         for (let idx: number = 0, len: number = this.Syllables.length; idx < len; ++idx) {
-            let lyricsEntry: LyricsEntry = this.Syllables[idx];
+            const lyricsEntry: LyricsEntry = this.Syllables[idx];
             if (lyricsEntry.Parent === voiceEntry) {
                 return true;
             }
@@ -18,7 +18,7 @@ export class LyricWord {
     }
     public findLyricEntryInVoiceEntry(voiceEntry: VoiceEntry): LyricsEntry {
         for (let idx: number = 0, len: number = this.Syllables.length; idx < len; ++idx) {
-            let lyricsEntry: LyricsEntry = this.Syllables[idx];
+            const lyricsEntry: LyricsEntry = this.Syllables[idx];
             if (lyricsEntry.Parent === voiceEntry) {
                 return lyricsEntry;
             }

+ 4 - 4
src/MusicalScore/VoiceData/Note.ts

@@ -104,9 +104,9 @@ export class Note {
     }
 
     public calculateNoteLengthWithoutTie(): Fraction {
-        let withoutTieLength: Fraction = this.length.clone();
+        const withoutTieLength: Fraction = this.length.clone();
         if (this.tie !== undefined) {
-            for (let fraction of this.tie.Fractions) {
+            for (const fraction of this.tie.Fractions) {
                 withoutTieLength.Sub(fraction);
             }
         }
@@ -120,7 +120,7 @@ export class Note {
             return this.length;
         }
         if (originalLength.Numerator > 1) {
-            let exp: number = Math.floor(Math.log(originalLength.Denominator) / Math.LN2) - this.calculateNumberOfNeededDots(originalLength);
+            const exp: number = Math.floor(Math.log(originalLength.Denominator) / Math.LN2) - this.calculateNumberOfNeededDots(originalLength);
             originalLength.Denominator = Math.pow(2, exp);
             originalLength.Numerator = 1;
         }
@@ -141,7 +141,7 @@ export class Note {
     }
     public checkForDoubleSlur(slur: Slur): boolean {
         for (let idx: number = 0, len: number = this.slurs.length; idx < len; ++idx) {
-            let noteSlur: Slur = this.slurs[idx];
+            const noteSlur: Slur = this.slurs[idx];
             if (
               noteSlur.StartNote !== undefined &&
               noteSlur.EndNote !== undefined &&

+ 30 - 30
src/MusicalScore/VoiceData/SourceMeasure.ts

@@ -166,7 +166,7 @@ export class SourceMeasure extends BaseIdClass {
         let staffEntry: SourceStaffEntry = undefined;
         // Find:
         let existingVerticalSourceStaffEntryContainer: VerticalSourceStaffEntryContainer;
-        for (let container of this.verticalSourceStaffEntryContainers) {
+        for (const container of this.verticalSourceStaffEntryContainers) {
             if (container.Timestamp.Equals(inMeasureTimestamp)) {
                 existingVerticalSourceStaffEntryContainer = container;
                 break;
@@ -181,9 +181,9 @@ export class SourceMeasure extends BaseIdClass {
             }
             return {createdNewContainer: false, staffEntry: staffEntry};
         }
-        let last: VerticalSourceStaffEntryContainer = this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length - 1];
+        const last: VerticalSourceStaffEntryContainer = this.verticalSourceStaffEntryContainers[this.verticalSourceStaffEntryContainers.length - 1];
         if (this.verticalSourceStaffEntryContainers.length === 0 || last.Timestamp.lt(inMeasureTimestamp)) {
-            let container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
+            const container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
                 this, inMeasureTimestamp.clone(), this.completeNumberOfStaves
             );
             this.verticalSourceStaffEntryContainers.push(container);
@@ -195,7 +195,7 @@ export class SourceMeasure extends BaseIdClass {
                 i >= 0; i--
             ) {
                 if (this.verticalSourceStaffEntryContainers[i].Timestamp.lt(inMeasureTimestamp)) {
-                    let container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
+                    const container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
                         this, inMeasureTimestamp.clone(), this.completeNumberOfStaves
                     );
                     this.verticalSourceStaffEntryContainers.splice(i + 1, 0, container);
@@ -204,7 +204,7 @@ export class SourceMeasure extends BaseIdClass {
                     break;
                 }
                 if (i === 0) {
-                    let container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
+                    const container: VerticalSourceStaffEntryContainer = new VerticalSourceStaffEntryContainer(
                         this, inMeasureTimestamp.clone(), this.completeNumberOfStaves
                     );
                     this.verticalSourceStaffEntryContainers.splice(i, 0, container);
@@ -228,7 +228,7 @@ export class SourceMeasure extends BaseIdClass {
     public findOrCreateVoiceEntry(sse: SourceStaffEntry, voice: Voice): { createdVoiceEntry: boolean, voiceEntry: VoiceEntry } {
         let ve: VoiceEntry = undefined;
         let createdNewVoiceEntry: boolean = false;
-        for (let voiceEntry of sse.VoiceEntries) {
+        for (const voiceEntry of sse.VoiceEntries) {
             if (voiceEntry.ParentVoice === voice) {
                 ve = voiceEntry;
                 break;
@@ -279,7 +279,7 @@ export class SourceMeasure extends BaseIdClass {
      */
     public getVerticalContainerByTimestamp(musicTimestamp: Fraction): VerticalSourceStaffEntryContainer {
         for (let idx: number = 0, len: number = this.VerticalSourceStaffEntryContainers.length; idx < len; ++idx) {
-            let verticalSourceStaffEntryContainer: VerticalSourceStaffEntryContainer = this.VerticalSourceStaffEntryContainers[idx];
+            const verticalSourceStaffEntryContainer: VerticalSourceStaffEntryContainer = this.VerticalSourceStaffEntryContainers[idx];
             if (verticalSourceStaffEntryContainer.Timestamp.Equals(musicTimestamp)) {
                 return verticalSourceStaffEntryContainer;
             }
@@ -314,16 +314,16 @@ export class SourceMeasure extends BaseIdClass {
      */
     public reverseCheck(musicSheet: MusicSheet, maxInstDuration: Fraction): Fraction {
         let maxDuration: Fraction = new Fraction(0, 1);
-        let instrumentsDurations: Fraction[] = [];
+        const instrumentsDurations: Fraction[] = [];
         for (let i: number = 0; i < musicSheet.Instruments.length; i++) {
             let instrumentDuration: Fraction = new Fraction(0, 1);
-            let inSourceMeasureInstrumentIndex: number = musicSheet.getGlobalStaffIndexOfFirstStaff(musicSheet.Instruments[i]);
+            const inSourceMeasureInstrumentIndex: number = musicSheet.getGlobalStaffIndexOfFirstStaff(musicSheet.Instruments[i]);
             for (let j: number = 0; j < musicSheet.Instruments[i].Staves.length; j++) {
-                let lastStaffEntry: SourceStaffEntry = this.getLastSourceStaffEntryForInstrument(inSourceMeasureInstrumentIndex + j);
+                const lastStaffEntry: SourceStaffEntry = this.getLastSourceStaffEntryForInstrument(inSourceMeasureInstrumentIndex + j);
                 if (lastStaffEntry !== undefined && !lastStaffEntry.hasTie()) {
-                    let verticalContainerIndex: number = this.verticalSourceStaffEntryContainers.indexOf(lastStaffEntry.VerticalContainerParent);
+                    const verticalContainerIndex: number = this.verticalSourceStaffEntryContainers.indexOf(lastStaffEntry.VerticalContainerParent);
                     for (let m: number = verticalContainerIndex - 1; m >= 0; m--) {
-                        let previousStaffEntry: SourceStaffEntry = this.verticalSourceStaffEntryContainers[m][inSourceMeasureInstrumentIndex + j];
+                        const previousStaffEntry: SourceStaffEntry = this.verticalSourceStaffEntryContainers[m][inSourceMeasureInstrumentIndex + j];
                         if (previousStaffEntry !== undefined && previousStaffEntry.hasTie()) {
                             if (instrumentDuration.lt(Fraction.plus(previousStaffEntry.Timestamp, previousStaffEntry.calculateMaxNoteLength()))) {
                                 instrumentDuration = Fraction.plus(previousStaffEntry.Timestamp, previousStaffEntry.calculateMaxNoteLength());
@@ -336,7 +336,7 @@ export class SourceMeasure extends BaseIdClass {
             instrumentsDurations.push(instrumentDuration);
         }
         for (let idx: number = 0, len: number = instrumentsDurations.length; idx < len; ++idx) {
-            let instrumentsDuration: Fraction = instrumentsDurations[idx];
+            const instrumentsDuration: Fraction = instrumentsDurations[idx];
             if (maxDuration.lt(instrumentsDuration)) {
                 maxDuration = instrumentsDuration;
             }
@@ -352,12 +352,12 @@ export class SourceMeasure extends BaseIdClass {
      * @returns {Fraction[]}
      */
     public calculateInstrumentsDuration(musicSheet: MusicSheet, instrumentMaxTieNoteFractions: Fraction[]): Fraction[] {
-        let instrumentsDurations: Fraction[] = [];
+        const instrumentsDurations: Fraction[] = [];
         for (let i: number = 0; i < musicSheet.Instruments.length; i++) {
             let instrumentDuration: Fraction = new Fraction(0, 1);
-            let inSourceMeasureInstrumentIndex: number = musicSheet.getGlobalStaffIndexOfFirstStaff(musicSheet.Instruments[i]);
+            const inSourceMeasureInstrumentIndex: number = musicSheet.getGlobalStaffIndexOfFirstStaff(musicSheet.Instruments[i]);
             for (let j: number = 0; j < musicSheet.Instruments[i].Staves.length; j++) {
-                let lastStaffEntry: SourceStaffEntry = this.getLastSourceStaffEntryForInstrument(inSourceMeasureInstrumentIndex + j);
+                const lastStaffEntry: SourceStaffEntry = this.getLastSourceStaffEntryForInstrument(inSourceMeasureInstrumentIndex + j);
                 if (lastStaffEntry !== undefined && lastStaffEntry.Timestamp !== undefined) {
                     if (instrumentDuration.lt(Fraction.plus(lastStaffEntry.Timestamp, lastStaffEntry.calculateMaxNoteLength()))) {
                         instrumentDuration = Fraction.plus(lastStaffEntry.Timestamp, lastStaffEntry.calculateMaxNoteLength());
@@ -373,9 +373,9 @@ export class SourceMeasure extends BaseIdClass {
     }
 
     public getEntriesPerStaff(staffIndex: number): SourceStaffEntry[] {
-        let sourceStaffEntries: SourceStaffEntry[] = [];
-        for (let container of this.VerticalSourceStaffEntryContainers) {
-            let sse: SourceStaffEntry = container.StaffEntries[staffIndex];
+        const sourceStaffEntries: SourceStaffEntry[] = [];
+        for (const container of this.VerticalSourceStaffEntryContainers) {
+            const sse: SourceStaffEntry = container.StaffEntries[staffIndex];
             if (sse !== undefined) {
                 sourceStaffEntries.push(sse);
             }
@@ -389,7 +389,7 @@ export class SourceMeasure extends BaseIdClass {
      */
     public hasBeginInstructions(): boolean {
         for (let staffIndex: number = 0, len: number = this.FirstInstructionsStaffEntries.length; staffIndex < len; staffIndex++) {
-            let beginInstructionsStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
+            const beginInstructionsStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
             if (beginInstructionsStaffEntry !== undefined && beginInstructionsStaffEntry.Instructions.length > 0) {
                 return true;
             }
@@ -399,7 +399,7 @@ export class SourceMeasure extends BaseIdClass {
 
     public beginsWithLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.FirstRepetitionInstructions.length; idx < len; ++idx) {
-            let instr: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
+            const instr: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
             if (instr.parentRepetition !== undefined && instr === instr.parentRepetition.startMarker && !instr.parentRepetition.FromWords) {
                 return true;
             }
@@ -413,8 +413,8 @@ export class SourceMeasure extends BaseIdClass {
      */
     public endsWithLineRepetition(): boolean {
         for (let idx: number = 0, len: number = this.LastRepetitionInstructions.length; idx < len; ++idx) {
-            let instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
-            let rep: Repetition = instruction.parentRepetition;
+            const instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
+            const rep: Repetition = instruction.parentRepetition;
             if (rep === undefined) {
                 continue;
             }
@@ -422,7 +422,7 @@ export class SourceMeasure extends BaseIdClass {
                 continue;
             }
             for (let idx2: number = 0, len2: number = rep.BackwardJumpInstructions.length; idx2 < len2; ++idx2) {
-                let backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
+                const backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
                 if (instruction === backJumpInstruction) {
                     return true;
                 }
@@ -437,7 +437,7 @@ export class SourceMeasure extends BaseIdClass {
      */
     public beginsWithWordRepetition(): boolean {
         for (let idx: number = 0, len: number = this.FirstRepetitionInstructions.length; idx < len; ++idx) {
-            let instruction: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
+            const instruction: RepetitionInstruction = this.FirstRepetitionInstructions[idx];
             if (instruction.parentRepetition !== undefined &&
                 instruction === instruction.parentRepetition.startMarker && instruction.parentRepetition.FromWords) {
                 return true;
@@ -452,8 +452,8 @@ export class SourceMeasure extends BaseIdClass {
      */
     public endsWithWordRepetition(): boolean {
         for (let idx: number = 0, len: number = this.LastRepetitionInstructions.length; idx < len; ++idx) {
-            let instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
-            let rep: Repetition = instruction.parentRepetition;
+            const instruction: RepetitionInstruction = this.LastRepetitionInstructions[idx];
+            const rep: Repetition = instruction.parentRepetition;
             if (rep === undefined) {
                 continue;
             }
@@ -461,7 +461,7 @@ export class SourceMeasure extends BaseIdClass {
                 continue;
             }
             for (let idx2: number = 0, len2: number = rep.BackwardJumpInstructions.length; idx2 < len2; ++idx2) {
-                let backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
+                const backJumpInstruction: RepetitionInstruction = rep.BackwardJumpInstructions[idx2];
                 if (instruction === backJumpInstruction) {
                     return true;
                 }
@@ -475,9 +475,9 @@ export class SourceMeasure extends BaseIdClass {
 
     public getKeyInstruction(staffIndex: number): KeyInstruction {
         if (this.FirstInstructionsStaffEntries[staffIndex] !== undefined) {
-            let sourceStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
+            const sourceStaffEntry: SourceStaffEntry = this.FirstInstructionsStaffEntries[staffIndex];
             for (let idx: number = 0, len: number = sourceStaffEntry.Instructions.length; idx < len; ++idx) {
-                let abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];
+                const abstractNotationInstruction: AbstractNotationInstruction = sourceStaffEntry.Instructions[idx];
                 if (abstractNotationInstruction instanceof KeyInstruction) {
                     return <KeyInstruction>abstractNotationInstruction;
                 }

+ 9 - 9
src/MusicalScore/VoiceData/SourceStaffEntry.ts

@@ -194,9 +194,9 @@ export class SourceStaffEntry {
     public calculateMinNoteLength(): Fraction {
         let duration: Fraction = new Fraction(Number.MAX_VALUE, 1);
         for (let idx: number = 0, len: number = this.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.VoiceEntries[idx];
             for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
-                let note: Note = voiceEntry.Notes[idx2];
+                const note: Note = voiceEntry.Notes[idx2];
                 if (note.NoteTie !== undefined) {
                     if (note.calculateNoteLengthWithoutTie().lt(duration)) {
                         duration = note.calculateNoteLengthWithoutTie();
@@ -212,14 +212,14 @@ export class SourceStaffEntry {
     public calculateMaxNoteLength(): Fraction {
         let duration: Fraction = new Fraction(0, 1);
         for (let idx: number = 0, len: number = this.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.VoiceEntries[idx];
             for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
-                let note: Note = voiceEntry.Notes[idx2];
+                const note: Note = voiceEntry.Notes[idx2];
                 if (note.NoteTie !== undefined) {
                     if (duration < note.calculateNoteLengthWithoutTie()) {
                         duration = note.calculateNoteLengthWithoutTie();
                         for (let idx3: number = 0, len3: number = note.NoteTie.Fractions.length; idx3 < len3; ++idx3) {
-                            let fraction: Fraction = note.NoteTie.Fractions[idx3];
+                            const fraction: Fraction = note.NoteTie.Fractions[idx3];
                             duration.Add(fraction);
                         }
                     }
@@ -233,7 +233,7 @@ export class SourceStaffEntry {
 
     public hasNotes(): boolean {
         for (let idx: number = 0, len: number = this.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.VoiceEntries[idx];
             if (voiceEntry.Notes.length > 0) {
                 return true;
             }
@@ -243,7 +243,7 @@ export class SourceStaffEntry {
 
     public hasTie(): boolean {
         for (let idx: number = 0, len: number = this.VoiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.VoiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.VoiceEntries[idx];
             if (voiceEntry.hasTie()) {
                 return true;
             }
@@ -253,9 +253,9 @@ export class SourceStaffEntry {
 
     public findLinkedNotes(linkedNotes: Note[]): void {
         for (let idx: number = 0, len: number = this.voiceEntries.length; idx < len; ++idx) {
-            let voiceEntry: VoiceEntry = this.voiceEntries[idx];
+            const voiceEntry: VoiceEntry = this.voiceEntries[idx];
             for (let idx2: number = 0, len2: number = voiceEntry.Notes.length; idx2 < len2; ++idx2) {
-                let note: Note = voiceEntry.Notes[idx2];
+                const note: Note = voiceEntry.Notes[idx2];
                 if (note.ParentStaffEntry === this) {
                     linkedNotes.push(note);
                 }

+ 1 - 1
src/MusicalScore/VoiceData/Tie.ts

@@ -68,7 +68,7 @@ export class Tie extends BaseIdClass {
         this.noteHasBeenCreated = new Array(this.fractions.length);
     }
     public allGraphicalNotesHaveBeenCreated(): boolean {
-        for (let b of this.noteHasBeenCreated) {
+        for (const b of this.noteHasBeenCreated) {
             if (!b) {
                 return false;
             }

+ 43 - 43
src/MusicalScore/VoiceData/VoiceEntry.ts

@@ -102,28 +102,28 @@ export class VoiceEntry {
     }
     public hasTie(): boolean {
         for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let note: Note = this.Notes[idx];
+            const note: Note = this.Notes[idx];
             if (note.NoteTie !== undefined) { return true; }
         }
         return false;
     }
     public hasSlur(): boolean {
         for (let idx: number = 0, len: number = this.Notes.length; idx < len; ++idx) {
-            let note: Note = this.Notes[idx];
+            const note: Note = this.Notes[idx];
             if (note.NoteSlurs.length > 0) { return true; }
         }
         return false;
     }
     public isStaccato(): boolean {
         for (let idx: number = 0, len: number = this.Articulations.length; idx < len; ++idx) {
-            let articulation: ArticulationEnum = this.Articulations[idx];
+            const articulation: ArticulationEnum = this.Articulations[idx];
             if (articulation === ArticulationEnum.staccato) { return true; }
         }
         return false;
     }
     public isAccent(): boolean {
         for (let idx: number = 0, len: number = this.Articulations.length; idx < len; ++idx) {
-            let articulation: ArticulationEnum = this.Articulations[idx];
+            const articulation: ArticulationEnum = this.Articulations[idx];
             if (articulation === ArticulationEnum.accent || articulation === ArticulationEnum.strongaccent) {
                 return true;
             }
@@ -146,20 +146,20 @@ export class VoiceEntry {
         if (voiceEntryWithOrnament === undefined) {
             voiceEntryWithOrnament = this;
         }
-        let voiceEntries: VoiceEntry[] = [];
+        const voiceEntries: VoiceEntry[] = [];
         if (voiceEntryWithOrnament.ornamentContainer === undefined) {
             return;
         }
-        let baseNote: Note = this.notes[0];
-        let baselength: Fraction = baseNote.calculateNoteLengthWithoutTie();
-        let baseVoice: Voice = voiceEntryWithOrnament.ParentVoice;
-        let baseTimestamp: Fraction = voiceEntryWithOrnament.Timestamp;
+        const baseNote: Note = this.notes[0];
+        const baselength: Fraction = baseNote.calculateNoteLengthWithoutTie();
+        const baseVoice: Voice = voiceEntryWithOrnament.ParentVoice;
+        const baseTimestamp: Fraction = voiceEntryWithOrnament.Timestamp;
         let currentTimestamp: Fraction = Fraction.createFromFraction(baseTimestamp);
         //let length: Fraction;
         switch (voiceEntryWithOrnament.ornamentContainer.GetOrnament) {
             case OrnamentEnum.Trill: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 8);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 8);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
                 let alteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 if (voiceEntryWithOrnament.OrnamentContainer.AccidentalAbove !== AccidentalEnum.NONE) {
                     alteration = <AccidentalEnum><number>voiceEntryWithOrnament.ornamentContainer.AccidentalAbove;
@@ -175,11 +175,11 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.Turn: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
-                let lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
-                let lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
-                let higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
+                const lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
+                const lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 this.createAlteratedVoiceEntry(
                     currentTimestamp, length, baseVoice, higherPitch, higherAlteration, voiceEntries
                 );
@@ -194,11 +194,11 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.InvertedTurn: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
-                let lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
-                let lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
-                let higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
+                const lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
+                const lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 this.createAlteratedVoiceEntry(
                     currentTimestamp, length, baseVoice, lowerPitch, lowerAlteration, voiceEntries
                 );
@@ -213,11 +213,11 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.DelayedTurn: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 2);
-                let lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
-                let lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
-                let higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 2);
+                const lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
+                const lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
                 currentTimestamp = Fraction.plus(baseTimestamp, length);
                 length.Denominator = baselength.Denominator * 8;
@@ -231,11 +231,11 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.DelayedInvertedTurn: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 2);
-                let lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
-                let lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
-                let higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 2);
+                const lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
+                const lowerAlteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const higherAlteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
                 currentTimestamp = Fraction.plus(baseTimestamp, length);
                 length.Denominator = baselength.Denominator * 8;
@@ -249,9 +249,9 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.Mordent: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
-                let higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
-                let alteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
+                const higherPitch: Pitch = baseNote.Pitch.getTransposedPitch(1);
+                const alteration: AccidentalEnum = activeKey.getAlterationForPitch(higherPitch);
                 this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
                 currentTimestamp.Add(length);
                 this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, higherPitch, alteration, voiceEntries);
@@ -261,9 +261,9 @@ export class VoiceEntry {
                 break;
             }
             case OrnamentEnum.InvertedMordent: {
-                let length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
-                let lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
-                let alteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
+                const length: Fraction = new Fraction(baselength.Numerator, baselength.Denominator * 4);
+                const lowerPitch: Pitch = baseNote.Pitch.getTransposedPitch(-1);
+                const alteration: AccidentalEnum = activeKey.getAlterationForPitch(lowerPitch);
                 this.createBaseVoiceEntry(currentTimestamp, length, baseVoice, baseNote, voiceEntries);
                 currentTimestamp.Add(length);
                 this.createAlteratedVoiceEntry(currentTimestamp, length, baseVoice, lowerPitch, alteration, voiceEntries);
@@ -280,9 +280,9 @@ export class VoiceEntry {
     private createBaseVoiceEntry(
         currentTimestamp: Fraction, length: Fraction, baseVoice: Voice, baseNote: Note, voiceEntries: VoiceEntry[]
     ): void {
-        let voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, baseNote.ParentStaffEntry);
-        let pitch: Pitch = new Pitch(baseNote.Pitch.FundamentalNote, baseNote.Pitch.Octave, baseNote.Pitch.Accidental);
-        let note: Note = new Note(voiceEntry, undefined, length, pitch);
+        const voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, baseNote.ParentStaffEntry);
+        const pitch: Pitch = new Pitch(baseNote.Pitch.FundamentalNote, baseNote.Pitch.Octave, baseNote.Pitch.Accidental);
+        const note: Note = new Note(voiceEntry, undefined, length, pitch);
         voiceEntry.Notes.push(note);
         voiceEntries.push(voiceEntry);
     }
@@ -290,9 +290,9 @@ export class VoiceEntry {
         currentTimestamp: Fraction, length: Fraction, baseVoice: Voice, higherPitch: Pitch,
         alteration: AccidentalEnum, voiceEntries: VoiceEntry[]
     ): void {
-        let voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, undefined);
-        let pitch: Pitch = new Pitch(higherPitch.FundamentalNote, higherPitch.Octave, alteration);
-        let note: Note = new Note(voiceEntry, undefined, length, pitch);
+        const voiceEntry: VoiceEntry = new VoiceEntry(currentTimestamp, baseVoice, undefined);
+        const pitch: Pitch = new Pitch(higherPitch.FundamentalNote, higherPitch.Octave, alteration);
+        const note: Note = new Note(voiceEntry, undefined, length, pitch);
         voiceEntry.Notes.push(note);
         voiceEntries.push(voiceEntry);
     }

+ 13 - 13
src/OSMD/Cursor.ts

@@ -13,7 +13,7 @@ export class Cursor {
   constructor(container: HTMLElement, osmd: OSMD) {
     this.container = container;
     this.osmd = osmd;
-    let curs: HTMLElement = document.createElement("img");
+    const curs: HTMLElement = document.createElement("img");
     curs.style.position = "absolute";
     curs.style.zIndex = "-1";
     this.cursorElement = <HTMLImageElement>curs;
@@ -53,22 +53,22 @@ export class Cursor {
       return;
     }
     this.graphic.Cursors.length = 0;
-    let iterator: MusicPartManagerIterator = this.iterator;
+    const iterator: MusicPartManagerIterator = this.iterator;
     if (iterator.EndReached || iterator.CurrentVoiceEntries === undefined || iterator.CurrentVoiceEntries.length === 0) {
       return;
     }
     let x: number = 0, y: number = 0, height: number = 0;
 
-    let voiceEntry: VoiceEntry = iterator.CurrentVoiceEntries[0];
-    let measureIndex: number = voiceEntry.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex;
-    let staffIndex: number = voiceEntry.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;
-    let gse: VexFlowStaffEntry =
+    const voiceEntry: VoiceEntry = iterator.CurrentVoiceEntries[0];
+    const measureIndex: number = voiceEntry.ParentSourceStaffEntry.VerticalContainerParent.ParentMeasure.measureListIndex;
+    const staffIndex: number = voiceEntry.ParentSourceStaffEntry.ParentStaff.idInMusicSheet;
+    const gse: VexFlowStaffEntry =
       <VexFlowStaffEntry>this.graphic.findGraphicalStaffEntryFromMeasureList(staffIndex, measureIndex, voiceEntry.ParentSourceStaffEntry);
 
     x = gse.PositionAndShape.AbsolutePosition.x;
-    let musicSystem: MusicSystem = gse.parentMeasure.parentMusicSystem;
+    const musicSystem: MusicSystem = gse.parentMeasure.parentMusicSystem;
     y = musicSystem.PositionAndShape.AbsolutePosition.y + musicSystem.StaffLines[0].PositionAndShape.RelativePosition.y;
-    let endY: number = musicSystem.PositionAndShape.AbsolutePosition.y +
+    const endY: number = musicSystem.PositionAndShape.AbsolutePosition.y +
       musicSystem.StaffLines[musicSystem.StaffLines.length - 1].PositionAndShape.RelativePosition.y + 4.0;
     height = endY - y;
 
@@ -89,11 +89,11 @@ export class Cursor {
     // // let cursor: GraphicalLine = new GraphicalLine(new PointF2D(x, y), new PointF2D(x, y + height), 3, OutlineAndFillStyleEnum.PlaybackCursor);
 
     // This the current HTML Cursor:
-    let cursorElement: HTMLImageElement = this.cursorElement;
+    const cursorElement: HTMLImageElement = this.cursorElement;
     cursorElement.style.top = (y * 10.0 * this.osmd.zoom) + "px";
     cursorElement.style.left = ((x - 1.5) * 10.0 * this.osmd.zoom) + "px";
     cursorElement.height = (height * 10.0 * this.osmd.zoom);
-    let newWidth: number = 3 * 10.0 * this.osmd.zoom;
+    const newWidth: number = 3 * 10.0 * this.osmd.zoom;
     if (newWidth !== cursorElement.width) {
       cursorElement.width = newWidth;
       this.updateStyle(newWidth);
@@ -140,13 +140,13 @@ export class Cursor {
   private updateStyle(width: number, color: string = "#33e02f"): void {
     // Create a dummy canvas to generate the gradient for the cursor
     // FIXME This approach needs to be improved
-    let c: HTMLCanvasElement = document.createElement("canvas");
+    const c: HTMLCanvasElement = document.createElement("canvas");
     c.width = this.cursorElement.width;
     c.height = 1;
-    let ctx: CanvasRenderingContext2D = c.getContext("2d");
+    const ctx: CanvasRenderingContext2D = c.getContext("2d");
     ctx.globalAlpha = 0.5;
     // Generate the gradient
-    let gradient: CanvasGradient = ctx.createLinearGradient(0, 0, this.cursorElement.width, 0);
+    const gradient: CanvasGradient = ctx.createLinearGradient(0, 0, this.cursorElement.width, 0);
     gradient.addColorStop(0, "white"); // it was: "transparent"
     gradient.addColorStop(0.2, color);
     gradient.addColorStop(0.8, color);

+ 12 - 12
src/OSMD/OSMD.ts

@@ -71,8 +71,8 @@ export class OSMD {
         // Warning! This function is asynchronous! No error handling is done here.
         this.reset();
         if (typeof content === "string") {
-            let str: string = <string>content;
-            let self: OSMD = this;
+            const str: string = <string>content;
+            const self: OSMD = this;
             if (str.substr(0, 4) === "\x50\x4b\x03\x04") {
                 // This is a zip file, unpack it first
                 return MXLHelper.MXLtoXMLstring(str).then(
@@ -87,7 +87,7 @@ export class OSMD {
             }
             if (str.substr(0, 5) === "<?xml") {
                 // Parse the string representing an xml file
-                let parser: DOMParser = new DOMParser();
+                const parser: DOMParser = new DOMParser();
                 content = parser.parseFromString(str, "text/xml");
             } else if (str.length < 2083) {
                 // Assume now "str" is a URL
@@ -102,10 +102,10 @@ export class OSMD {
         if (!content || !(<any>content).nodeName) {
             return Promise.reject(new Error("OSMD: The document which was provided is invalid"));
         }
-        let children: NodeList = (<Document>content).childNodes;
+        const children: NodeList = (<Document>content).childNodes;
         let elem: Element;
         for (let i: number = 0, length: number = children.length; i < length; i += 1) {
-            let node: Node = children[i];
+            const node: Node = children[i];
             if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === "score-partwise") {
                 elem = <Element>node;
                 break;
@@ -114,9 +114,9 @@ export class OSMD {
         if (!elem) {
             return Promise.reject(new Error("OSMD: Document is not a valid 'partwise' MusicXML"));
         }
-        let score: IXmlElement = new IXmlElement(elem);
-        let calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
-        let reader: MusicSheetReader = new MusicSheetReader();
+        const score: IXmlElement = new IXmlElement(elem);
+        const calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
+        const reader: MusicSheetReader = new MusicSheetReader();
         this.sheet = reader.createMusicSheet(score, "Unknown path");
         this.graphic = new GraphicalMusicSheet(this.sheet, calc);
         this.cursor.init(this.sheet.MusicPartManager, this.graphic);
@@ -131,7 +131,7 @@ export class OSMD {
         if (!this.graphic) {
             throw new Error("OSMD: Before rendering a music sheet, please load a MusicXML file");
         }
-        let width: number = this.container.offsetWidth;
+        const width: number = this.container.offsetWidth;
         // Before introducing the following optimization (maybe irrelevant), tests
         // have to be modified to ensure that width is > 0 when executed
         //if (isNaN(width) || width === 0) {
@@ -152,7 +152,7 @@ export class OSMD {
         this.graphic.Cursors.push(this.graphic.calculateCursorLineAtTimestamp(new Fraction(6, 4), OutlineAndFillStyleEnum.PlaybackCursor));
         this.graphic.Cursors.push(this.graphic.calculateCursorLineAtTimestamp(new Fraction(7, 4), OutlineAndFillStyleEnum.PlaybackCursor));*/
         // Update Sheet Page
-        let height: number = this.graphic.MusicPages[0].PositionAndShape.BorderBottom * 10.0 * this.zoom;
+        const height: number = this.graphic.MusicPages[0].PositionAndShape.BorderBottom * 10.0 * this.zoom;
         this.drawer.clear();
         this.drawer.resize(width, height);
         this.drawer.scale(this.zoom);
@@ -208,7 +208,7 @@ export class OSMD {
      * Attach the appropriate handler to the window.onResize event
      */
     private autoResize(): void {
-        let self: OSMD = this;
+        const self: OSMD = this;
         this.handleResize(
             () => {
                 // empty
@@ -237,7 +237,7 @@ export class OSMD {
     private handleResize(startCallback: () => void, endCallback: () => void): void {
         let rtime: number;
         let timeout: number = undefined;
-        let delta: number = 200;
+        const delta: number = 200;
 
         function resizeEnd(): void {
             timeout = undefined;

+ 3 - 3
src/Util/CollectionUtil.ts

@@ -28,9 +28,9 @@ export class CollectionUtil {
      */
     public static removeDictElementIfTrue<S, T, V>(thisPointer: S, dict: Dictionary<T, V>,
                                                    iterationFunction: (thisPointer: S, key: T, value: V) => boolean): void {
-        let toDeleteEntries: T[] = [];
+        const toDeleteEntries: T[] = [];
         dict.forEach(function (key: T, value: V): void {
-            let shallDelete: boolean = iterationFunction(thisPointer, key, value);
+            const shallDelete: boolean = iterationFunction(thisPointer, key, value);
             if (shallDelete) {
                 toDeleteEntries.push(key);
             }
@@ -53,7 +53,7 @@ export class CollectionUtil {
         let mid: number = 1;
         while (startIndex < endIndex) {
             mid = Math.floor((startIndex + endIndex) / 2);
-            let c: number = cmp(array[mid], element);
+            const c: number = cmp(array[mid], element);
             if (c === 0) {
                 return mid;
             }

+ 1 - 1
src/Util/PSMath.ts

@@ -26,7 +26,7 @@ export class PSMath {
         let sumWeigtedValues: number = 0;
         let sumWeights: number = 0;
         for (let i: number = 0; i < values.length; i++) {
-            let weight: number = weights[i];
+            const weight: number = weights[i];
             sumWeigtedValues += values[i] * weight;
             sumWeights += weight;
         }

+ 2 - 2
test/Common/DataObjects/Fraction_Test.ts

@@ -5,7 +5,7 @@ import { Fraction } from "../../../src/Common/DataObjects/Fraction";
 
 describe("Fraction Unit Tests:", () => {
     describe("Construct Fraction, check properties", () => {
-        let f1: Fraction = new Fraction(2, 6);
+        const f1: Fraction = new Fraction(2, 6);
 
         it("Numerator and Denominator", (done: MochaDone) => {
             chai.expect(f1.Numerator).to.equal(1);
@@ -21,7 +21,7 @@ describe("Fraction Unit Tests:", () => {
     describe("Compare fractions", () => {
       let f1: Fraction;
       let f2: Fraction;
-      let rand: () => number = function(): number {
+      const rand: () => number = function(): number {
         return Math.floor(Math.random() * 500) + 1;
       };
       it("lt attribute", (done: MochaDone) => {

+ 25 - 25
test/Common/DataObjects/Pitch_Test.ts

@@ -2,10 +2,10 @@ import { Pitch, NoteEnum, AccidentalEnum } from "../../../src/Common/DataObjects
 
 describe("Pitch Unit Tests:", () => {
     describe("transpose Pitch", () => {
-        let pitch: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);
-        let transposedFundamentalAndOctave: {value: number; overflow: number; } =
+        const pitch: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);
+        const transposedFundamentalAndOctave: {value: number; overflow: number; } =
           Pitch.CalculateTransposedHalfTone(pitch, 12);
-        let higherTransposedFundamentalAndOctave: {value: number; overflow: number; } =
+        const higherTransposedFundamentalAndOctave: {value: number; overflow: number; } =
           Pitch.CalculateTransposedHalfTone(pitch, 26);
 
         it("should be 1 octave higher and same fundamental", (done: MochaDone) => {
@@ -18,13 +18,13 @@ describe("Pitch Unit Tests:", () => {
     });
 
     describe("calculate Frequency from Pitch", () => {
-        let pitch1: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);
-        let pitch2: Pitch = new Pitch(NoteEnum.B, 1, AccidentalEnum.DOUBLEFLAT);
-        let pitch3: Pitch = new Pitch(NoteEnum.G, 1, AccidentalEnum.DOUBLESHARP);
+        const pitch1: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);
+        const pitch2: Pitch = new Pitch(NoteEnum.B, 1, AccidentalEnum.DOUBLEFLAT);
+        const pitch3: Pitch = new Pitch(NoteEnum.G, 1, AccidentalEnum.DOUBLESHARP);
 
-        let frequency1: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch1.Frequency));
-        let frequency2: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch2.Frequency));
-        let frequency3: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch3.Frequency));
+        const frequency1: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch1.Frequency));
+        const frequency2: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch2.Frequency));
+        const frequency3: number = Pitch.calcFrequency(Pitch.calcFractionalKey(pitch3.Frequency));
 
         it("should be 440Hz", (done: MochaDone) => {
             chai.expect(pitch1.Frequency).to.equal(440);
@@ -39,17 +39,17 @@ describe("Pitch Unit Tests:", () => {
 
     describe("calculate fractional key", () => {
         // the values are validated against the C# output. TODO: ask mauz about the shift
-        let pitch1: Pitch = new Pitch(NoteEnum.C, 6, AccidentalEnum.SHARP);   // C#6 -> 109
-        let pitch2: Pitch = new Pitch(NoteEnum.B, 1, AccidentalEnum.NONE);    // B1 -> 59
-        let pitch3: Pitch = new Pitch(NoteEnum.F, 4, AccidentalEnum.DOUBLEFLAT);  // Fbb4 -> 87
-        let pitch4: Pitch = new Pitch(NoteEnum.E, -1, AccidentalEnum.DOUBLESHARP);    // E##-1 -> 30
-        let pitch5: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);    // A1 -> 57
-
-        let key1: number = Pitch.calcFractionalKey(pitch1.Frequency);
-        let key2: number = Pitch.calcFractionalKey(pitch2.Frequency);
-        let key3: number = Pitch.calcFractionalKey(pitch3.Frequency);
-        let key4: number = Pitch.calcFractionalKey(pitch4.Frequency);
-        let key5: number = Pitch.calcFractionalKey(pitch5.Frequency);
+        const pitch1: Pitch = new Pitch(NoteEnum.C, 6, AccidentalEnum.SHARP);   // C#6 -> 109
+        const pitch2: Pitch = new Pitch(NoteEnum.B, 1, AccidentalEnum.NONE);    // B1 -> 59
+        const pitch3: Pitch = new Pitch(NoteEnum.F, 4, AccidentalEnum.DOUBLEFLAT);  // Fbb4 -> 87
+        const pitch4: Pitch = new Pitch(NoteEnum.E, -1, AccidentalEnum.DOUBLESHARP);    // E##-1 -> 30
+        const pitch5: Pitch = new Pitch(NoteEnum.A, 1, AccidentalEnum.NONE);    // A1 -> 57
+
+        const key1: number = Pitch.calcFractionalKey(pitch1.Frequency);
+        const key2: number = Pitch.calcFractionalKey(pitch2.Frequency);
+        const key3: number = Pitch.calcFractionalKey(pitch3.Frequency);
+        const key4: number = Pitch.calcFractionalKey(pitch4.Frequency);
+        const key5: number = Pitch.calcFractionalKey(pitch5.Frequency);
 
         it("pitch key should equal midi key", (done: MochaDone) => {
             chai.expect(key1).to.equal(109);
@@ -62,8 +62,8 @@ describe("Pitch Unit Tests:", () => {
     });
 
     describe("calculate Pitch from Frequency", () => {
-        let octave: number = 1;
-        let accidentals: number[] = [AccidentalEnum.DOUBLEFLAT,
+        const octave: number = 1;
+        const accidentals: number[] = [AccidentalEnum.DOUBLEFLAT,
             AccidentalEnum.FLAT,
             AccidentalEnum.NONE,
             AccidentalEnum.SHARP,
@@ -90,8 +90,8 @@ describe("Pitch Unit Tests:", () => {
     });
 
     describe("get Pitch from fractional key", () => {
-        let octave: number = 5;
-        let accidentals: number[] = [AccidentalEnum.DOUBLEFLAT,
+        const octave: number = 5;
+        const accidentals: number[] = [AccidentalEnum.DOUBLEFLAT,
             AccidentalEnum.FLAT,
             AccidentalEnum.NONE,
             AccidentalEnum.SHARP,
@@ -104,7 +104,7 @@ describe("Pitch Unit Tests:", () => {
         for (let i: number = 0; i < Pitch.pitchEnumValues.length; i++) {
             for (let j: number = 0; j < accidentals.length; j++) {
                 pitch = new Pitch(Pitch.pitchEnumValues[i], octave, accidentals[j]);
-                let halftone: number = pitch.getHalfTone();
+                const halftone: number = pitch.getHalfTone();
                 calcedPitch = Pitch.fromHalftone(halftone);
 
                 it( "calcedPitch equals original, " +

+ 3 - 3
test/Common/FileIO/Mxl_Test.ts

@@ -8,7 +8,7 @@ describe("MXL Tests", () => {
   function testFile(scoreName: string): void {
     it(`reads ${scoreName}`, (done: MochaDone) => {
       // Load the xml file content
-      let mxl: string = TestUtils.getMXL(scoreName);
+      const mxl: string = TestUtils.getMXL(scoreName);
       chai.expect(mxl).to.not.be.undefined;
       // Extract XML from MXL
       // Warning: the sheet is loaded asynchronously,
@@ -27,10 +27,10 @@ describe("MXL Tests", () => {
   }
 
   // Test all the following mxl files:
-  let scores: string[] = [
+  const scores: string[] = [
     "MozartTrio.mxl",
   ];
-  for (let score of scores) {
+  for (const score of scores) {
     testFile(score);
   }
 

+ 10 - 10
test/Common/FileIO/Xml_Test.ts

@@ -3,7 +3,7 @@ import {TestUtils} from "../../Util/TestUtils";
 import {OSMD} from "../../../src/OSMD/OSMD";
 
 // Test XML simple document
-let xmlTestData: string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
+const xmlTestData: string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
 <!DOCTYPE score-partwise PUBLIC \"-//Recordare//DTD MusicXML 2.0 Partwise//EN\" \"http://www.musicxml.org/dtds/partwise.dtd\">\
 <score-partwise>  <identification>    <encoding>      <software>Example Software name</software>      \
 <encoding-date>2016-04-04</encoding-date>      </encoding>    </identification>   <credit page=\"1\"> \
@@ -11,13 +11,13 @@ let xmlTestData: string = "<?xml version=\"1.0\" encoding=\"UTF-8\"?>\
 
 
 describe("XML interface", () => {
-    let parser: DOMParser = new DOMParser();
-    let doc: Document = parser.parseFromString(xmlTestData, "text/xml");
-    let documentElement: IXmlElement = new IXmlElement(doc.documentElement);
+    const parser: DOMParser = new DOMParser();
+    const doc: Document = parser.parseFromString(xmlTestData, "text/xml");
+    const documentElement: IXmlElement = new IXmlElement(doc.documentElement);
 
 
     // Test all the following xml files:
-    let xmlTestset: string[] = [
+    const xmlTestset: string[] = [
         "ActorPreludeSample.xml",
         "Beethoven_AnDieFerneGeliebte.xml",
         "CharlesGounod_Meditation.xml",
@@ -38,7 +38,7 @@ describe("XML interface", () => {
         "TelemannWV40.102_Sonate-Nr.1.1-Dolce.xml",
         "TelemannWV40.102_Sonate-Nr.1.2-Allegro-F-Dur.xml",
     ];
-    for (let score of xmlTestset) {
+    for (const score of xmlTestset) {
         testFile(score);
     }
 
@@ -46,9 +46,9 @@ describe("XML interface", () => {
     function testFile(scoreName: string): void {
         it(scoreName, (done: MochaDone) => {
             // Load the xml file content
-            let score: Document = TestUtils.getScore(scoreName);
-            let div: HTMLElement = document.createElement("div");
-            let osmd: OSMD = new OSMD(div);
+            const score: Document = TestUtils.getScore(scoreName);
+            const div: HTMLElement = document.createElement("div");
+            const osmd: OSMD = new OSMD(div);
             osmd.load(score);
             done();
         }).timeout(3000);
@@ -73,7 +73,7 @@ describe("XML interface", () => {
             documentElement.element("credit").attributes()[0].name
         ).to.equal("page");
 
-        let creditWords: IXmlElement =
+        const creditWords: IXmlElement =
             documentElement.element("credit").element("credit-words");
         // Test attributes method
         chai.expect(creditWords.attributes().length).to.equal(2);

+ 31 - 31
test/Common/OSMD/OSMD_Test.ts

@@ -14,7 +14,7 @@ describe("OSMD Main Export", () => {
     });
 
     it("container", (done: MochaDone) => {
-        let div: HTMLElement = document.createElement("div");
+        const div: HTMLElement = document.createElement("div");
         chai.expect(() => {
             return new OSMD(div);
         }).to.not.throw(Error);
@@ -22,9 +22,9 @@ describe("OSMD Main Export", () => {
     });
 
     it("load MXL from string", (done: MochaDone) => {
-        let mxl: string = TestUtils.getMXL("MozartTrio.mxl");
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const mxl: string = TestUtils.getMXL("MozartTrio.mxl");
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(mxl).then(
             (_: {}) => {
                 osmd.render();
@@ -35,9 +35,9 @@ describe("OSMD Main Export", () => {
     });
 
     it("load invalid MXL from string", (done: MochaDone) => {
-        let mxl: string = "\x50\x4b\x03\x04";
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const mxl: string = "\x50\x4b\x03\x04";
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(mxl).then(
             (_: {}) => {
                 done(new Error("Corrupted MXL appears to be loaded correctly"));
@@ -53,10 +53,10 @@ describe("OSMD Main Export", () => {
     });
 
     it("load XML string", (done: MochaDone) => {
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
-        let xml: string = new XMLSerializer().serializeToString(score);
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const xml: string = new XMLSerializer().serializeToString(score);
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(xml).then(
             (_: {}) => {
                 osmd.render();
@@ -67,9 +67,9 @@ describe("OSMD Main Export", () => {
     });
 
     it("load XML Document", (done: MochaDone) => {
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(score).then(
             (_: {}) => {
                 osmd.render();
@@ -80,9 +80,9 @@ describe("OSMD Main Export", () => {
     });
 
     it("load MXL Document by URL", (done: MochaDone) => {
-        let url: string = "base/test/data/MozartTrio.mxl";
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const url: string = "base/test/data/MozartTrio.mxl";
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(url).then(
             (_: {}) => {
                 osmd.render();
@@ -93,9 +93,9 @@ describe("OSMD Main Export", () => {
     });
 
     it("load MXL Document by invalid URL", (done: MochaDone) => {
-        let url: string = "https://www.google.com";
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const url: string = "https://www.google.com";
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(url).then(
             (_: {}) => {
                 done(new Error("Invalid URL appears to be loaded correctly"));
@@ -111,9 +111,9 @@ describe("OSMD Main Export", () => {
     }).timeout(5000);
 
     it("load invalid XML string", (done: MochaDone) => {
-        let xml: string = "<?xml";
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const xml: string = "<?xml";
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         osmd.load(xml).then(
             (_: {}) => {
                 done(new Error("Corrupted XML appears to be loaded correctly"));
@@ -129,8 +129,8 @@ describe("OSMD Main Export", () => {
     });
 
     it("render without loading", (done: MochaDone) => {
-        let div: HTMLElement = document.createElement("div");
-        let osmd: OSMD = new OSMD(div);
+        const div: HTMLElement = document.createElement("div");
+        const osmd: OSMD = new OSMD(div);
         chai.expect(() => {
             return osmd.render();
         }).to.throw(/load/);
@@ -148,10 +148,10 @@ describe("OSMD Main Export", () => {
     });
 
     it("test width 500", (done: MochaDone) => {
-        let div: HTMLElement = container1;
+        const div: HTMLElement = container1;
         div.style.width = "500px";
-        let osmd: OSMD = new OSMD(div);
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const osmd: OSMD = new OSMD(div);
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
         osmd.load(score).then(
             (_: {}) => {
                 osmd.render();
@@ -163,10 +163,10 @@ describe("OSMD Main Export", () => {
     });
 
     it("test width 200", (done: MochaDone) => {
-        let div: HTMLElement = container1;
+        const div: HTMLElement = container1;
         div.style.width = "200px";
-        let osmd: OSMD = new OSMD(div);
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const osmd: OSMD = new OSMD(div);
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
         osmd.load(score).then(
             (_: {}) => {
                 osmd.render();

+ 2 - 2
test/MusicalScore/Graphical/VexFlow/VexFlowConverter_Clef_Test.ts

@@ -24,9 +24,9 @@ describe("Clef Converter MusicXML to VexFlow", () => {
      * @see https://usermanuals.musicxml.com/MusicXML/Content/EL-MusicXML-clef.htm
      */
     function getMusicSheetWithClef(sign: string, line?: number, clefOcatveChange?: number, additional?: string, size?: string): MusicSheet {
-      let doc: Document = parser.parseFromString(getMusicXmlWithClef(sign, line, clefOcatveChange, additional, size), "text/xml");
+      const doc: Document = parser.parseFromString(getMusicXmlWithClef(sign, line, clefOcatveChange, additional, size), "text/xml");
       chai.expect(doc).to.not.be.undefined;
-      let score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
+      const score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
       chai.expect(score).to.not.be.undefined;
       return reader.createMusicSheet(score, "template.xml");
     }

+ 16 - 16
test/MusicalScore/Graphical/VexFlow/VexFlowMeasure_Test.ts

@@ -13,39 +13,39 @@ import {MusicSheetCalculator} from "../../../../src/MusicalScore/Graphical/Music
 describe("VexFlow Measure", () => {
 
    it.skip("GraphicalMusicSheet", (done: MochaDone) => {
-      let path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
-      let score: Document = TestUtils.getScore(path);
+      const path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
+      const score: Document = TestUtils.getScore(path);
       chai.expect(score).to.not.be.undefined;
-      let partwise: Element = TestUtils.getPartWiseElement(score);
+      const partwise: Element = TestUtils.getPartWiseElement(score);
       chai.expect(partwise).to.not.be.undefined;
-      let calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
-      let reader: MusicSheetReader = new MusicSheetReader();
-      let sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), path);
-      let gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
+      const calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
+      const reader: MusicSheetReader = new MusicSheetReader();
+      const sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), path);
+      const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
       console.log(gms);
       done();
    });
 
    it.skip("Simple Measure", (done: MochaDone) => {
-      let sheet: MusicSheet = new MusicSheet();
-      let measure: SourceMeasure = new SourceMeasure(1);
+      const sheet: MusicSheet = new MusicSheet();
+      const measure: SourceMeasure = new SourceMeasure(1);
       sheet.addMeasure(measure);
-      let calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
-      let gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
+      const calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
+      const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
       chai.expect(gms.MeasureList.length).to.equal(1);
       chai.expect(gms.MeasureList[0].length).to.equal(1);
-      let gm: StaffMeasure = gms.MeasureList[0][0];
+      const gm: StaffMeasure = gms.MeasureList[0][0];
       console.log(gm);
       done();
    });
 
    it.skip("Empty Measure", (done: MochaDone) => {
-      let sheet: MusicSheet = new MusicSheet();
-      let measure: SourceMeasure = new SourceMeasure(1);
+      const sheet: MusicSheet = new MusicSheet();
+      const measure: SourceMeasure = new SourceMeasure(1);
       measure.FirstInstructionsStaffEntries[0] = new SourceStaffEntry(undefined, undefined);
       sheet.addMeasure(measure);
-      let calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
-      let gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
+      const calc: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
+      const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
       chai.expect(gms.MeasureList.length).to.equal(1);
       chai.expect(gms.MeasureList[0].length).to.equal(0);
       done();

+ 18 - 18
test/MusicalScore/Graphical/VexFlow/VexFlowMusicSheetDrawer_Test.ts

@@ -14,40 +14,40 @@ import {CanvasVexFlowBackend} from "../../../../src/MusicalScore/Graphical/VexFl
 describe("VexFlow Music Sheet Drawer", () => {
 
     it("draws sheet \"Clementi pt. 1\"", (done: MochaDone) => {
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
         chai.expect(score).to.not.be.undefined;
-        let partwise: Element = TestUtils.getPartWiseElement(score);
+        const partwise: Element = TestUtils.getPartWiseElement(score);
         chai.expect(partwise).to.not.be.undefined;
-        let calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
-        let reader: MusicSheetReader = new MusicSheetReader();
-        let sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), "** missing path **");
-        let gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
+        const calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
+        const reader: MusicSheetReader = new MusicSheetReader();
+        const sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), "** missing path **");
+        const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
 
         // Create the canvas in the document:
-        let canvas: HTMLCanvasElement = document.createElement("canvas");
-        let backend: VexFlowBackend = new CanvasVexFlowBackend();
+        const canvas: HTMLCanvasElement = document.createElement("canvas");
+        const backend: VexFlowBackend = new CanvasVexFlowBackend();
         backend.initialize(canvas);
-        let drawer: VexFlowMusicSheetDrawer = new VexFlowMusicSheetDrawer(canvas, backend);
+        const drawer: VexFlowMusicSheetDrawer = new VexFlowMusicSheetDrawer(canvas, backend);
         drawer.drawSheet(gms);
         done();
     });
 
     it.skip("draws cursor (as rectangle)", (done: MochaDone) => {
-        let score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
+        const score: Document = TestUtils.getScore("MuzioClementi_SonatinaOpus36No1_Part1.xml");
         chai.expect(score).to.not.be.undefined;
-        let partwise: Element = TestUtils.getPartWiseElement(score);
+        const partwise: Element = TestUtils.getPartWiseElement(score);
         chai.expect(partwise).to.not.be.undefined;
-        let calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
-        let reader: MusicSheetReader = new MusicSheetReader();
-        let sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), "** missing path **");
-        let gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
+        const calc: VexFlowMusicSheetCalculator = new VexFlowMusicSheetCalculator();
+        const reader: MusicSheetReader = new MusicSheetReader();
+        const sheet: MusicSheet = reader.createMusicSheet(new IXmlElement(partwise), "** missing path **");
+        const gms: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calc);
         gms.Cursors.push(gms.calculateCursorLineAtTimestamp(new Fraction(0, 4), OutlineAndFillStyleEnum.PlaybackCursor));
 
         // Create the canvas in the document:
-        let canvas: HTMLCanvasElement = document.createElement("canvas");
-        let backend: VexFlowBackend = new CanvasVexFlowBackend();
+        const canvas: HTMLCanvasElement = document.createElement("canvas");
+        const backend: VexFlowBackend = new CanvasVexFlowBackend();
         backend.initialize(canvas);
-        let drawer: VexFlowMusicSheetDrawer = new VexFlowMusicSheetDrawer(canvas, backend);
+        const drawer: VexFlowMusicSheetDrawer = new VexFlowMusicSheetDrawer(canvas, backend);
         drawer.drawSheet(gms);
         done();
     });

+ 5 - 5
test/MusicalScore/ScoreCalculation/MusicSheetCalculator_Test.ts

@@ -9,9 +9,9 @@ import {TestUtils} from "../../Util/TestUtils";
 
 /* tslint:disable:no-unused-expression */
 describe("Music Sheet Calculator", () => {
-    let filename: string = "MuzioClementi_SonatinaOpus36No1_Part1.xml";
-    let reader: MusicSheetReader = new MusicSheetReader();
-    let calculator: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
+    const filename: string = "MuzioClementi_SonatinaOpus36No1_Part1.xml";
+    const reader: MusicSheetReader = new MusicSheetReader();
+    const calculator: MusicSheetCalculator = new VexFlowMusicSheetCalculator();
     let score: IXmlElement;
     let sheet: MusicSheet;
 
@@ -19,13 +19,13 @@ describe("Music Sheet Calculator", () => {
         this.timeout = 10000;
         MusicSheetCalculator.TextMeasurer = new VexFlowTextMeasurer();
         // Load the XML file
-        let xml: Document = TestUtils.getScore(filename);
+        const xml: Document = TestUtils.getScore(filename);
         chai.expect(xml).to.not.be.undefined;
         score = new IXmlElement(TestUtils.getPartWiseElement(xml));
         chai.expect(score).to.not.be.undefined;
         sheet = reader.createMusicSheet(score, "path-of-" + filename);
 
-        let graphicalSheet: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calculator);
+        const graphicalSheet: GraphicalMusicSheet = new GraphicalMusicSheet(sheet, calculator);
         graphicalSheet.reCalculate();
         done();
     });

+ 39 - 39
test/MusicalScore/ScoreIO/Key_Test.ts

@@ -19,14 +19,14 @@ describe("MusicXML parser for element 'key'", () => {
   describe("for group traditional keys", () => {
 
     xit("enforces single occurrence of element 'fifths'", (done: MochaDone) => {
-      let keyInstruction: KeyInstruction = getIllegalMusicXmlWithTwoFifthsElements().getFirstSourceMeasure().getKeyInstruction(0);
+      const keyInstruction: KeyInstruction = getIllegalMusicXmlWithTwoFifthsElements().getFirstSourceMeasure().getKeyInstruction(0);
       // TODO Make sure we detect the multiple fifths and react properly
       chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.none);
       done();
     });
 
     it("reads key signature with no optional 'mode' element present", (done: MochaDone) => {
-      let keyInstruction: KeyInstruction = getMusicSheetWithKey(0, undefined).getFirstSourceMeasure().getKeyInstruction(0);
+      const keyInstruction: KeyInstruction = getMusicSheetWithKey(0, undefined).getFirstSourceMeasure().getKeyInstruction(0);
       chai.expect(keyInstruction.Key).to.equal(0);
       chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.none);
       done();
@@ -35,112 +35,112 @@ describe("MusicXML parser for element 'key'", () => {
     describe("major keys", () => {
 
       it("reads key signature C-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(0, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(0, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(0);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature G-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(1, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(1, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(1);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature D-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(2, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(2, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(2);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature A-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(3, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(3, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(3);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature E-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(4, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(4, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(4);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature B-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(5, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(5, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(5);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Fis-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(6, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(6, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(6);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Cis-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(7, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(7, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(7);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Gis-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(8, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(8, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(8);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature F-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-1, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-1, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-1);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature B-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-2, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-2, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-2);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Es-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-3, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-3, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-3);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature As-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-4, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-4, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-4);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Des-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-5, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-5, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-5);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Ges-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-6, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-6, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-6);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
       });
 
       it("reads key signature Fes-major", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-8, "major").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-8, "major").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-8);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.major);
         done();
@@ -150,105 +150,105 @@ describe("MusicXML parser for element 'key'", () => {
     describe("minor keys", () => {
 
       it("reads key signature a-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(0, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(0, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(0);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature e-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(1, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(1, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(1);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature b-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(2, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(2, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(2);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature fis-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(3, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(3, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(3);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature cis-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(4, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(4, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(4);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature gis-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(5, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(5, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(5);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature dis-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(6, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(6, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(6);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature ais-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(7, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(7, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(7);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature d-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-1, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-1, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-1);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature g-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-2, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-2, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-2);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature c-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-3, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-3, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-3);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature f-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-4, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-4, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-4);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature bb-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-5, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-5, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-5);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature es-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-6, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-6, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-6);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
       });
 
       it("reads key signature as-minor", (done: MochaDone) => {
-        let keyInstruction: KeyInstruction = getMusicSheetWithKey(-7, "minor").getFirstSourceMeasure().getKeyInstruction(0);
+        const keyInstruction: KeyInstruction = getMusicSheetWithKey(-7, "minor").getFirstSourceMeasure().getKeyInstruction(0);
         chai.expect(keyInstruction.Key).to.equal(-7);
         chai.expect(keyInstruction.Mode).to.equal(KeyModeEnum.minor);
         done();
@@ -258,16 +258,16 @@ describe("MusicXML parser for element 'key'", () => {
 });
 
 function getMusicSheetWithKey(fifths: number = undefined, mode: string = undefined): MusicSheet {
-  let doc: Document = parser.parseFromString(getMusicXmlWithKey(fifths, mode), "text/xml");
+  const doc: Document = parser.parseFromString(getMusicXmlWithKey(fifths, mode), "text/xml");
   chai.expect(doc).to.not.be.undefined;
-  let score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
+  const score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
   chai.expect(score).to.not.be.undefined;
   return reader.createMusicSheet(score, "template.xml");
 }
 
 function getMusicXmlWithKey(fifths: number = undefined, mode: string = undefined): string {
-  let modeElement: string = mode ? `<mode>${mode}</mode>` : "";
-  let fifthsElement: string = fifths ? `<fifths>${fifths}</fifths>` : "";
+  const modeElement: string = mode ? `<mode>${mode}</mode>` : "";
+  const fifthsElement: string = fifths ? `<fifths>${fifths}</fifths>` : "";
   return `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
           <!DOCTYPE score-partwise PUBLIC
               "-//Recordare//DTD MusicXML 3.0 Partwise//EN"
@@ -309,7 +309,7 @@ function getMusicXmlWithKey(fifths: number = undefined, mode: string = undefined
 }
 
 function getIllegalMusicXmlWithTwoFifthsElements(): MusicSheet {
-  let doc: Document = parser.parseFromString(
+  const doc: Document = parser.parseFromString(
     `<?xml version="1.0" encoding="UTF-8" standalone="no"?>
       <!DOCTYPE score-partwise PUBLIC
           "-//Recordare//DTD MusicXML 3.0 Partwise//EN"
@@ -352,7 +352,7 @@ function getIllegalMusicXmlWithTwoFifthsElements(): MusicSheet {
     "text/xml"
   );
   chai.expect(doc).to.not.be.undefined;
-  let score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
+  const score: IXmlElement = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
   chai.expect(score).to.not.be.undefined;
   return reader.createMusicSheet(score, "template.xml");
 }

+ 3 - 3
test/MusicalScore/ScoreIO/MusicSheetReader_Test.ts

@@ -4,8 +4,8 @@ import {IXmlElement} from "../../../src/Common/FileIO/Xml";
 
 /* tslint:disable:no-unused-expression */
 describe("Music Sheet Reader", () => {
-    let path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
-    let reader: MusicSheetReader = new MusicSheetReader();
+    const path: string = "test/data/MuzioClementi_SonatinaOpus36No1_Part1.xml";
+    const reader: MusicSheetReader = new MusicSheetReader();
     let score: IXmlElement;
     let sheet: MusicSheet;
 
@@ -15,7 +15,7 @@ describe("Music Sheet Reader", () => {
 
     before((): void => {
         // Load the xml file
-        let doc: Document = getSheet(path);
+        const doc: Document = getSheet(path);
         chai.expect(doc).to.not.be.undefined;
         score = new IXmlElement(doc.getElementsByTagName("score-partwise")[0]);
         // chai.expect(score).to.not.be.undefined;

+ 4 - 4
test/Util/TestUtils.ts

@@ -6,12 +6,12 @@
 export class TestUtils {
 
     public static getScore(name: string): Document {
-        let path: string = "test/data/" + name;
+        const path: string = "test/data/" + name;
         return ((window as any).__xml__)[path];
     }
 
     public static getMXL(scoreName: string): string {
-        let path: string = "test/data/" + scoreName;
+        const path: string = "test/data/" + scoreName;
         return ((window as any).__raw__)[path];
     }
 
@@ -21,9 +21,9 @@ export class TestUtils {
      * @returns {Element}
      */
     public static getPartWiseElement(doc: Document): Element {
-        let nodes: NodeList = doc.childNodes;
+        const nodes: NodeList = doc.childNodes;
         for (let i: number = 0, length: number = nodes.length; i < length; i += 1) {
-            let node: Node = nodes[i];
+            const node: Node = nodes[i];
             if (node.nodeType === Node.ELEMENT_NODE && node.nodeName.toLowerCase() === "score-partwise") {
                 return <Element>node;
             }

BIN
test/data/Parlez-moi.mxl


+ 1 - 0
tslint.json

@@ -60,6 +60,7 @@
     "no-var-keyword": true,
     "no-var-requires": true,
     "object-literal-sort-keys": true,
+    "prefer-const": true,
     "one-line": [
       true,
       "check-open-brace",

+ 75 - 0
webpack.common.js

@@ -0,0 +1,75 @@
+var path = require('path')
+var HtmlWebpackPlugin = require('html-webpack-plugin')
+var webpack = require('webpack')
+
+module.exports = {
+    entry: {
+        'osmd': './src/OSMD/OSMD.ts', // Main library
+        'demo': './demo/index.js' // Demo index
+    },
+    output: {
+        path: path.resolve(__dirname, 'build'),
+        filename: '[name].js'
+    },
+    resolve: {
+        // Add '.ts' and '.tsx' as a resolvable extension.
+        extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
+    },
+    module: {
+        loaders: [
+            // all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
+            {
+                test: /\.ts$/,
+                loader: 'ts-loader',
+                exclude: /(node_modules|bower_components)/
+            },
+            // FIXME: TSLint loader is horribly slow therefore check only at beginning
+            // https://github.com/wbuchwalter/tslint-loader/issues/76
+            // // ts lint loader. will pre-lint the ts files
+            // {
+            //     test: /\.ts$/,
+            //     enforce: 'pre',
+            //     loader: 'tslint-loader',
+            //     options: {
+            //         typeCheck: true
+            //     }
+            // },
+            // For html loader generation
+            {
+                test: /\.html$/,
+                loader: 'underscore-template-loader'
+            },
+            {
+                test: /\.(jpg|jpeg|gif|png|ico)$/,
+                exclude: /node_modules/,
+                loader: 'file-loader?name=img/[path][name].[ext]&context=./app/images'
+            }
+        ]
+    },
+    plugins: [
+        new webpack.ProvidePlugin({
+            $: 'jquery',
+            jQuery: 'jquery'
+        }),
+        new webpack.EnvironmentPlugin({
+            STATIC_FILES_SUBFOLDER: false, // Set to other directory if NOT using webpack-dev-server
+            NODE_ENV: 'development', // use 'development' unless process.env.NODE_ENV is defined
+            DEBUG: false,
+            DRAW_BOUNDING_BOX_ELEMENT: false //  Specifies the element to draw bounding boxes for (e.g. 'GraphicalLabels'). If 'all', bounding boxes are drawn for all elements.
+        }),
+        // add a demo page to the build folder
+        new HtmlWebpackPlugin({
+            template: 'demo/index.html',
+            title: 'OpenSheetMusicDisplay Demo'
+        })
+    ],
+    devServer: {
+        contentBase: [
+            path.join(__dirname, 'test/data'),
+            path.join(__dirname, 'build'),
+            path.join(__dirname, 'demo')
+        ],
+        port: 8000,
+        compress: false
+    }
+}

+ 0 - 51
webpack.config.js

@@ -1,51 +0,0 @@
-var path = require('path');
-var webpack = require('webpack');
-
-module.exports = {
-  // entry: [
-  //   './src/OSMD/OSMD.ts'
-  //   // TODO: Add demo.js where the webdev server is implemented
-  //   //
-  // ],
-  entry: {
-    'osmd': './src/OSMD/OSMD.ts',
-    'demo': './demo/demo.js'
-  },
-  output: {
-      path: path.resolve(__dirname, 'build'),
-      filename: '[name].js',
-   },
-   resolve: {
-       // Add '.ts' and '.tsx' as a resolvable extension.
-       extensions: ['.webpack.js', '.web.js', '.ts', '.tsx', '.js']
-   },
-   module: {
-       loaders: [
-           // all files with a '.ts' or '.tsx' extension will be handled by 'ts-loader'
-           { test: /\.tsx?$/, loader: 'ts-loader' }
-       ]
-   },
-   plugins: [
-     // build optimization plugins
-     new webpack.LoaderOptionsPlugin({
-      minimize: true,
-      debug: false
-    }),
-    new webpack.optimize.UglifyJsPlugin({
-        warnings: false,
-        beautify: false,
-        compress: true,
-        comments: false,
-        sourceMap: true
-      })
-  ],
-  devServer: {
-    contentBase: [
-      path.join(__dirname, 'test/data'),
-      path.join(__dirname, 'demo')
-      // TODO: fill in paths for demo data
-    ],
-    port: 8000,
-    compress: false,
-  },
-};

+ 6 - 0
webpack.dev.js

@@ -0,0 +1,6 @@
+var merge = require('webpack-merge')
+var common = require('./webpack.common.js')
+
+module.exports = merge(common, {
+    devtool: process.env.DEBUG ? false : 'source-map'
+})

Некоторые файлы не были показаны из-за большого количества измененных файлов