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 #301561: Plugin API: restore pagenumber and pagePos properties from MuseScore 2.X #5986

Merged
merged 2 commits into from
Apr 26, 2020

Conversation

dmitrio95
Copy link
Contributor

@dmitrio95 dmitrio95 commented Apr 25, 2020

Restores pagenumber and pagePos properties which were exposed to plugins in MuseScore 2.X, as requested in https://musescore.org/en/node/301561.

Update: also added Score.pageNumberOffset property to allow obtaining (and changing) user-visible page numbers.

@@ -114,6 +115,11 @@ class Element : public Ms::PluginAPI::ScoreElement {
* \since MuseScore 3.3
*/
Q_PROPERTY(qreal posY READ posY)
/**
* Position of this element in page coordinates, in spatium units.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

(read only), right?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actually some "read-only" marker will also be generated by Doxygen so there is no strict necessity in writing that explicitly. Other similar properties in Element class do not have read-only in their description. Maybe it would be better to remove that from pagenumber description then.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK, either way works for me ;-)

/**
* Page number (read only).
* Returns number of this page in the score counting from 0, i.e.
* for the first page its \p pagenumber value will be equal to 0.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Does this make sense? Why not starting with 1?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Here I actually just made the implementation of this property equivalent to the one from MuseScore 2.X. It would be good to have a property for user-visible page numbers, but then is should start not with 1 but with (page numbering offset setting) + 1. Since that setting can have any value it would make it more problematic to obtain an "internal" page number, e.g. to detect the first page in a score. It seems to me it could potentially be useful to have both these kinds of page number property (or to expose a property for page numbering offset for Score objects) but in this pull request I just added the one which had been exposed in 2.X versions.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe it would make sense to rename it to something like pageIndex then?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if it is 'just' reimplementing something from MuseScore 2.x, better keep name and semantic

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

and maybe add pageOffset and let the plugin programmer sort the logic.
Was it really 'pagenumber' rather than `pageNumber'?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, it was named exactly pagenumber, see https://github.com/musescore/MuseScore/blob/2.3.2/libmscore/page.h#L127

I added a commit with pageNumberOffset property here.

@dmitrio95 dmitrio95 force-pushed the plugins-pagenumber-pagepos branch from ad782ca to 15a3051 Compare April 25, 2020 17:42
@anatoly-os anatoly-os merged commit ac5b40e into musescore:master Apr 26, 2020
@dmitrio95 dmitrio95 deleted the plugins-pagenumber-pagepos branch April 26, 2020 22:21
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.

3 participants