13#ifndef __PLUGIN_API_SCORE_H__
14#define __PLUGIN_API_SCORE_H__
16#include "scoreelement.h"
20#include "libmscore/score.h"
24class InstrumentTemplate;
35extern Selection* selectionWrap(Ms::Selection* select);
130 Score(
Ms::
Score* s =
nullptr, Ownership o = Ownership::SCORE)
133 Ms::Score* score() {
return toScore(e); }
134 const Ms::Score* score()
const {
return toScore(e); }
136 QString
composer() {
return score()->metaTag(
"composer"); }
137 int duration() {
return score()->duration(); }
140 bool hasLyrics() {
return score()->hasLyrics(); }
141 int keysig() {
return score()->keysig(); }
142 int lyricCount() {
return score()->lyricCount(); }
143 QString
lyricist() {
return score()->metaTag(
"lyricist"); }
144 QString
title() {
return score()->metaTag(
"workTitle"); }
145 Ms::PluginAPI::Selection*
selection() {
return selectionWrap(&score()->
selection()); }
146 MStyle*
style() {
return wrap(&score()->
style(), score()); }
147 QString
path() {
return score()->importedFilePath(); }
150 void setPageNumberOffset(
int offset) { score()->undoChangePageNumberOffset(offset); }
155 Q_INVOKABLE QString
metaTag(
const QString& tag)
const {
return score()->metaTag(tag); }
157 Q_INVOKABLE
void setMetaTag(
const QString& tag,
const QString& val) { score()->setMetaTag(tag, val); }
167 Q_INVOKABLE
void appendPart(
const QString& instrumentId);
181 Q_INVOKABLE
void addText(
const QString&
type,
const QString& text);
194 QString
name()
const {
return score()->masterScore()->title(); }
195 void setName(
const QString&
name) { score()->masterScore()->setName(
name); }
198 Q_INVOKABLE QString extractLyrics() {
return score()->extractLyrics(); }
204 int nmeasures()
const {
return score()->nmeasures(); }
205 int npages()
const {
return score()->npages(); }
206 int nstaves()
const {
return score()->nstaves(); }
207 int ntracks()
const {
return score()->ntracks(); }
228 Q_INVOKABLE
void endCmd(
bool rollback =
false) { score()->endCmd(rollback); }
243 QQmlListProperty<Part>
parts() {
return wrapContainerProperty<Part>(
this, score()->
parts()); }
244 QQmlListProperty<Excerpt>
excerpts() {
return wrapExcerptsContainerProperty<Excerpt>(
this, score()->
excerpts()); }
245 QQmlListProperty<Staff>
staves();
247 static const Ms::InstrumentTemplate* instrTemplateFromName(
const QString&
name);
Cursor can be used by plugins to manipulate the score.
Definition cursor.h:53
Provides an access to score style settings.
Definition style.h:47
Definition elements.h:781
Main class of the plugins framework. Named as MuseScore in QML.
Definition qmlpluginapi.h:62
Base class for most of object wrappers exposed to QML.
Definition scoreelement.h:42
QString name
Name of this element's type, not localized.
Definition scoreelement.h:54
int type
Type of this element.
Definition scoreelement.h:48
Ms::PluginAPI::Measure * firstMeasureMM
First multimeasure rest measure of the score (read only).
Definition score.h:56
QString scoreName
Name of the score, without path leading to it and extension.
Definition score.h:79
Ms::PluginAPI::Measure * lastMeasureMM
Last multimeasure rest measure of the score (read only).
Definition score.h:73
Q_INVOKABLE Ms::PluginAPI::Cursor * newCursor()
Creates and returns a cursor to be used to navigate in the score.
Definition score.cpp:32
bool hasHarmonies
Whether score has harmonies (chord symbols) (read only).
Definition score.h:60
int lyricCount
Number of lyrics items (syllables) in the score (read only).
Definition score.h:77
int npages
Number of pages (read only).
Definition score.h:83
QString path
Returns the path to the file from which the score was imported, or empty.
Definition score.h:125
Q_INVOKABLE void appendPart(const QString &instrumentId)
Appends a part with the instrument defined by instrumentId to this score.
Definition score.cpp:110
QQmlListProperty< Ms::PluginAPI::Excerpt > excerpts
List of the excerpts (linked parts) (read only).
Definition score.h:48
QString composer
Composer of the score, as taken from the score properties (read only).
Definition score.h:44
Q_INVOKABLE void addText(const QString &type, const QString &text)
Adds a header text to the score.
Definition score.cpp:49
Ms::PluginAPI::Segment * lastSegment
Last score segment (read only).
Definition score.h:75
int ntracks
Number of tracks (nstaves * 4) (read only).
Definition score.h:87
Q_INVOKABLE void setMetaTag(const QString &tag, const QString &val)
Sets the metatag named tag to val.
Definition score.h:157
Q_INVOKABLE void appendMeasures(int n)
Appends a number of measures to this score.
Definition score.h:180
Ms::PluginAPI::Selection * selection
Current selections for the score.
Definition score.h:101
int nmeasures
Number of measures (read only).
Definition score.h:81
Ms::PluginAPI::MStyle * style
Style settings for this score.
Definition score.h:103
QString lyricist
Lyricist of score, as taken from the score properties.
Definition score.h:92
Q_INVOKABLE void createPlayEvents()
Create PlayEvents for all notes based on ornamentation.
Definition score.h:237
Q_INVOKABLE void startCmd()
For "dock" type plugins: to be used before score modifications to make them undoable.
Definition score.cpp:204
Q_INVOKABLE void endCmd(bool rollback=false)
For "dock" type plugins: to be used after score modifications to make them undoable.
Definition score.h:228
Q_INVOKABLE QString metaTag(const QString &tag) const
Returns as a string the metatag named tag.
Definition score.h:155
QQmlListProperty< Ms::PluginAPI::Staff > staves
List of staves in this score.
Definition score.h:118
QString title
Title of score, as taken from the score properties' workTitle (read only).
Definition score.h:95
Ms::PluginAPI::Measure * firstMeasure
First measure of the score (read only).
Definition score.h:50
Ms::PluginAPI::Measure * lastMeasure
Last measure of the score (read only).
Definition score.h:67
QQmlListProperty< Ms::PluginAPI::Part > parts
The list of parts.
Definition score.h:90
int nstaves
Number of staves (read only).
Definition score.h:85
Q_INVOKABLE void appendPartByMusicXmlId(const QString &instrumentMusicXmlId)
Appends a part with the instrument defined by the given MusicXML ID to this score.
Definition score.cpp:126
int duration
Duration of score in seconds (read only).
Definition score.h:46
int harmonyCount
Number of harmony items (chord symbols) in the score (read only).
Definition score.h:58
QString mscoreRevision
MuseScore revision the score has been last saved with (includes autosave) (read only).
Definition score.h:99
int keysig
Key signature at the start of the score, in number of accidentals, negative for flats,...
Definition score.h:65
int pageNumberOffset
Page numbering offset.
Definition score.h:112
QString mscoreVersion
MuseScore version the score has been last saved with (includes autosave) (read only).
Definition score.h:97
bool hasLyrics
Whether score has lyrics (read only).
Definition score.h:62
Definition elements.h:715
Definition selection.h:28
Definition elements.h:873
Contains items exposed to the QML plugins framework.
Definition cursor.cpp:31