Skip to content

Commit

Permalink
Merge pull request #4610 from dmitrio95/plugins
Browse files Browse the repository at this point in the history
[WIP] Plugins support for MuseScore 3
  • Loading branch information
anatoly-os committed Jan 25, 2019
2 parents f494c48 + e506b5e commit 3ea4931
Show file tree
Hide file tree
Showing 77 changed files with 2,525 additions and 1,430 deletions.
6 changes: 5 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -62,8 +62,13 @@ if (MSVC)
set (MINGW false)
endif (MSVC)

set(SCRIPT_INTERFACE TRUE)
# Look for Qt5
if (SCRIPT_INTERFACE)
SET(QT_MIN_VERSION "5.8.0")
else (SCRIPT_INTERFACE)
SET(QT_MIN_VERSION "5.7.0")
endif (SCRIPT_INTERFACE)
# Include modules
set(CMAKE_MODULE_PATH "${CMAKE_CURRENT_SOURCE_DIR}/build" ${CMAKE_MODULE_PATH})
include (FindQt5)
Expand All @@ -81,7 +86,6 @@ set(MSCORE_RELEASE_CHANNEL "devel")
#set(MSCORE_RELEASE_CHANNEL "testing")
#set(MSCORE_RELEASE_CHANNEL "stable")
set(USE_SSE TRUE)
set(SCRIPT_INTERFACE TRUE)

# Disable components not supported on Windows
if (MSVC OR MINGW)
Expand Down
4 changes: 4 additions & 0 deletions build/config.h.in
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@
// Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
//=============================================================================

#ifndef MUSESCORE_CONFIG_H
#define MUSESCORE_CONFIG_H

#cmakedefine USE_ALSA
#cmakedefine USE_JACK
#cmakedefine USE_PORTAUDIO
Expand Down Expand Up @@ -58,3 +61,4 @@
// does not work on windows/mac:
//#define USE_GLYPHS true

#endif /* MUSESCORE_CONFIG_H */
4 changes: 2 additions & 2 deletions libmscore/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ add_library (

types.h accidental.h ambitus.h arpeggio.h articulation.h audio.h bagpembell.h barline.h beam.h bend.h
box.h bracket.h bracketItem.h breath.h bsp.h bsymbol.h chord.h chordline.h chordlist.h chordrest.h clef.h
cleflist.h connector.h cursor.h drumset.h dsp.h duration.h durationtype.h dynamic.h element.h
cleflist.h connector.h drumset.h dsp.h duration.h durationtype.h dynamic.h element.h
elementmap.h excerpt.h fermata.h fifo.h figuredbass.h fingering.h fraction.h fret.h glissando.h groups.h hairpin.h
harmony.h hook.h icon.h image.h imageStore.h iname.h input.h instrchange.h instrtemplate.h instrument.h interval.h
jump.h key.h keylist.h keysig.h lasso.h layout.h layoutbreak.h ledgerline.h letring.h line.h location.h
Expand Down Expand Up @@ -89,7 +89,7 @@ add_library (
figuredbass.cpp rehearsalmark.cpp transpose.cpp
property.cpp range.cpp elementmap.cpp notedot.cpp imageStore.cpp
audio.cpp splitMeasure.cpp joinMeasure.cpp
cursor.cpp paste.cpp
paste.cpp
bsymbol.cpp marker.cpp jump.cpp stemslash.cpp ledgerline.cpp
synthesizerstate.cpp mcursor.cpp groups.cpp mscoreview.cpp
noteline.cpp spannermap.cpp
Expand Down
101 changes: 0 additions & 101 deletions libmscore/accidental.h
Original file line number Diff line number Diff line change
Expand Up @@ -46,107 +46,6 @@ enum class AccidentalBracket : char {
BRACKET
};

//---------------------------------------------------------
// AccidentalType
//---------------------------------------------------------
// NOTE: keep this in sync with with accList array
enum class AccidentalType : char {
NONE,
FLAT,
NATURAL,
SHARP,
SHARP2,
FLAT2,
//SHARP3,
//FLAT3,
NATURAL_FLAT,
NATURAL_SHARP,
SHARP_SHARP,

// Gould arrow quartertone
FLAT_ARROW_UP,
FLAT_ARROW_DOWN,
NATURAL_ARROW_UP,
NATURAL_ARROW_DOWN,
SHARP_ARROW_UP,
SHARP_ARROW_DOWN,
SHARP2_ARROW_UP,
SHARP2_ARROW_DOWN,
FLAT2_ARROW_UP,
FLAT2_ARROW_DOWN,

// Stein-Zimmermann
MIRRORED_FLAT,
MIRRORED_FLAT2,
SHARP_SLASH,
SHARP_SLASH4,

// Arel-Ezgi-Uzdilek (AEU)
FLAT_SLASH2,
FLAT_SLASH,
SHARP_SLASH3,
SHARP_SLASH2,

// Extended Helmholtz-Ellis accidentals (just intonation)
DOUBLE_FLAT_ONE_ARROW_DOWN,
FLAT_ONE_ARROW_DOWN,
NATURAL_ONE_ARROW_DOWN,
SHARP_ONE_ARROW_DOWN,
DOUBLE_SHARP_ONE_ARROW_DOWN,
DOUBLE_FLAT_ONE_ARROW_UP,

FLAT_ONE_ARROW_UP,
NATURAL_ONE_ARROW_UP,
SHARP_ONE_ARROW_UP,
DOUBLE_SHARP_ONE_ARROW_UP,
DOUBLE_FLAT_TWO_ARROWS_DOWN,
FLAT_TWO_ARROWS_DOWN,

NATURAL_TWO_ARROWS_DOWN,
SHARP_TWO_ARROWS_DOWN,
DOUBLE_SHARP_TWO_ARROWS_DOWN,
DOUBLE_FLAT_TWO_ARROWS_UP,
FLAT_TWO_ARROWS_UP,
NATURAL_TWO_ARROWS_UP,

SHARP_TWO_ARROWS_UP,
DOUBLE_SHARP_TWO_ARROWS_UP,
DOUBLE_FLAT_THREE_ARROWS_DOWN,
FLAT_THREE_ARROWS_DOWN,
NATURAL_THREE_ARROWS_DOWN,
SHARP_THREE_ARROWS_DOWN,

DOUBLE_SHARP_THREE_ARROWS_DOWN,
DOUBLE_FLAT_THREE_ARROWS_UP,
FLAT_THREE_ARROWS_UP,
NATURAL_THREE_ARROWS_UP,
SHARP_THREE_ARROWS_UP,
DOUBLE_SHARP_THREE_ARROWS_UP,

LOWER_ONE_SEPTIMAL_COMMA,
RAISE_ONE_SEPTIMAL_COMMA,
LOWER_TWO_SEPTIMAL_COMMAS,
RAISE_TWO_SEPTIMAL_COMMAS,
LOWER_ONE_UNDECIMAL_QUARTERTONE,
RAISE_ONE_UNDECIMAL_QUARTERTONE,

LOWER_ONE_TRIDECIMAL_QUARTERTONE,
RAISE_ONE_TRIDECIMAL_QUARTERTONE,

DOUBLE_FLAT_EQUAL_TEMPERED,
FLAT_EQUAL_TEMPERED,
NATURAL_EQUAL_TEMPERED,
SHARP_EQUAL_TEMPERED,
DOUBLE_SHARP_EQUAL_TEMPERED,
QUARTER_FLAT_EQUAL_TEMPERED,
QUARTER_SHARP_EQUAL_TEMPERED,

// Persian
SORI,
KORON,
END
};

//---------------------------------------------------------
// SymElement
//---------------------------------------------------------
Expand Down
7 changes: 2 additions & 5 deletions libmscore/beam.h
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ struct BeamFragment;
//---------------------------------------------------------

class Beam final : public Element {
Q_GADGET
QVector<ChordRest*> _elements; // must be sorted by tick
QVector<QLineF*> beamSegments;
Direction _direction;
Expand Down Expand Up @@ -71,7 +72,7 @@ class Beam final : public Element {
enum class Mode : signed char {
AUTO, BEGIN, MID, END, NONE, BEGIN32, BEGIN64, INVALID = -1
};
Q_ENUMS(Mode)
Q_ENUM(Mode)

Beam(Score* = 0);
Beam(const Beam&);
Expand Down Expand Up @@ -155,8 +156,4 @@ class Beam final : public Element {


} // namespace Ms

Q_DECLARE_METATYPE(Ms::Beam::Mode);

#endif

10 changes: 5 additions & 5 deletions libmscore/duration.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@ class DurationElement : public Element {
Fraction _duration;
Tuplet* _tuplet;

#ifdef SCRIPT_INTERFACE
void setDurationW(FractionWrapper* f) { _duration = f->fraction(); }
FractionWrapper* durationW() const { return new FractionWrapper(_duration); }
FractionWrapper* globalDurW() const { return new FractionWrapper(globalDuration()); }
#endif
// #ifdef SCRIPT_INTERFACE
// void setDurationW(FractionWrapper* f) { _duration = f->fraction(); }
// FractionWrapper* durationW() const { return new FractionWrapper(_duration); }
// FractionWrapper* globalDurW() const { return new FractionWrapper(globalDuration()); }
// #endif

public:
DurationElement(Score* = 0, ElementFlags = ElementFlag::MOVABLE | ElementFlag::ON_STAFF);
Expand Down
5 changes: 3 additions & 2 deletions libmscore/element.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1060,6 +1060,8 @@ void collectElements(void* data, Element* e)
QVariant Element::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::TICK:
return tick();
case Pid::TRACK:
return track();
case Pid::VOICE:
Expand Down Expand Up @@ -1135,8 +1137,7 @@ bool Element::setProperty(Pid propertyId, const QVariant& v)
setSizeIsSpatiumDependent(v.toBool());
break;
default:
// qFatal("<%s> unknown <%s>(%d), data <%s>", name(), propertyQmlName(propertyId), int(propertyId), qPrintable(v.toString()));
qDebug("%s unknown <%s>(%d), data <%s>", name(), propertyQmlName(propertyId), int(propertyId), qPrintable(v.toString()));
qDebug("%s unknown <%s>(%d), data <%s>", name(), propertyName(propertyId), int(propertyId), qPrintable(v.toString()));
return false;
}
triggerLayout();
Expand Down
36 changes: 0 additions & 36 deletions libmscore/fraction.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,44 +81,8 @@ class Fraction {
inline Fraction operator*(const Fraction& f, int v) { return Fraction(f) *= v; }
inline Fraction operator*(int v, const Fraction& f) { return Fraction(f) *= v; }

#ifdef SCRIPT_INTERFACE

//---------------------------------------------------------
// FractionWrapper
//---------------------------------------------------------

class FractionWrapper : public QObject {
Q_OBJECT
Q_PROPERTY(int numerator READ numerator)
Q_PROPERTY(int denominator READ denominator)
Q_PROPERTY(int ticks READ ticks)

Fraction f;

public slots:
void setFraction(Fraction _f) { f = _f; }

public:
FractionWrapper(const FractionWrapper& w) : QObject() { f = w.f; }
FractionWrapper() {}
FractionWrapper(const Fraction& _f) : f(_f) {}

Fraction fraction() const { return f; }
int numerator() const { return f.numerator(); }
int denominator() const { return f.denominator(); }
int ticks() const { return f.ticks(); }
};


#endif // SCRIPT_INTERFACE

} // namespace Ms

Q_DECLARE_METATYPE(Ms::Fraction);

#ifdef SCRIPT_INTERFACE
Q_DECLARE_METATYPE(Ms::FractionWrapper);
#endif

#endif

10 changes: 0 additions & 10 deletions libmscore/layoutbreak.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -280,15 +280,5 @@ QVariant LayoutBreak::propertyDefault(Pid id) const
return Element::propertyDefault(id);
}
}

//---------------------------------------------------------
// undoLayoutBreakType
//---------------------------------------------------------

void LayoutBreak::undoSetLayoutBreakType(Type t)
{
undoChangeProperty(Pid::LAYOUT_BREAK, int(t));
}

}

6 changes: 1 addition & 5 deletions libmscore/layoutbreak.h
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ class LayoutBreak final : public Element {
PAGE, LINE, SECTION, NOBREAK
};
private:
Q_PROPERTY(Ms::LayoutBreak::Type layoutBreakType READ layoutBreakType WRITE undoSetLayoutBreakType)
Q_ENUMS(Type)
Q_ENUM(Type)

qreal lw;
QPainterPath path;
Expand All @@ -56,7 +55,6 @@ class LayoutBreak final : public Element {

void setLayoutBreakType(Type);
Type layoutBreakType() const { return _layoutBreakType; }
void undoSetLayoutBreakType(Type);

virtual bool acceptDrop(EditData&) const override;
virtual Element* drop(EditData&) override;
Expand Down Expand Up @@ -84,6 +82,4 @@ class LayoutBreak final : public Element {

} // namespace Ms

Q_DECLARE_METATYPE(Ms::LayoutBreak::Type);

#endif
6 changes: 2 additions & 4 deletions libmscore/lyrics.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,10 @@ namespace Ms {
class LyricsLine;

class Lyrics final : public TextBase {
Q_GADGET
public:
enum class Syllabic : char { SINGLE, BEGIN, END, MIDDLE };
Q_ENUM(Syllabic)

// MELISMA FIRST UNDERSCORE:
// used as_ticks value to mark a melisma for which only the first chord has been spanned so far
Expand Down Expand Up @@ -144,8 +146,4 @@ class LyricsLineSegment final : public LineSegment {
};

} // namespace Ms

Q_DECLARE_METATYPE(Ms::Lyrics::Syllabic);

#endif

Loading

0 comments on commit 3ea4931

Please sign in to comment.