Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix #306551: make symbols accessible to plugins #6205

Merged
merged 2 commits into from
Jun 22, 2020

Conversation

dmitrio95
Copy link
Contributor

Resolves: https://musescore.org/en/node/306551

Exposes SymId enumeration to plugins thus making possible handling symbols in plugins depending on their type. As mentioned in the issue, Symbol elements can already be accessed (and even be added to a score) by plugins.

This PR employs the same technique as #6065 to expose enumeration to plugins while avoiding copying it between files. However BEGIN_QT_REGISTERED_ENUM and END_QT_REGISTERED_ENUM macro definitions needed to be duplicated in style.h and sym.h as moc tool doesn't handle macros from included files (not sure whether it handles #include statements at all). Also, since SymId enumerators begin from lower case letters, in order to expose their values to QML adding a wrapper for this enumeration was also necessary.

Since SymId contains a lot of elements (about 2600) creating a wrapper caused a significant delay on MuseScore startup. In order to avoid this in the second commit I implemented lazy initialization of enumerations exposed to QML plugins framework. Now enumeration wrappers are created when they are actually used for the first time. Therefore first access within a session to SymId enumeration still causes a significant delay, but it doesn't happen after that, and it doesn't cause any issues for anyone not using plugins accessing SymId enumeration. This trade-off seems to be the best solution we can afford at the moment if exposing SymId enumeration in the same way as other enumerations.

To avoid slow MuseScore start caused by creating enumeration wrappers
on startup, This is mainly the issue for SymId enumeration because
of a large number of its items.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants