Merge pull request #10771 from RomanPudashkin/slur_properties

[MU4] Fix #10448: Implement slur properties in Inspector/Properties
This commit is contained in:
RomanPudashkin 2022-03-22 16:35:54 +02:00 committed by GitHub
commit 66095cebde
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
35 changed files with 414 additions and 124 deletions

View file

@ -78,8 +78,8 @@ static constexpr PropertyMetaData propertyList[] = {
{ Pid::Z, false, "z", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "z") },
{ Pid::SMALL, false, "small", P_TYPE::BOOL, DUMMY_QT_TR_NOOP("propertyName", "small") },
{ Pid::SHOW_COURTESY, false, "showCourtesySig", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::KEYSIG_MODE, false, "keysig_mode", P_TYPE::KEY_MODE, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::LINE_TYPE, false, "lineType", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "line type") },
{ Pid::KEYSIG_MODE, false, "keysig_mode", P_TYPE::KEY_MODE, DUMMY_QT_TR_NOOP("propertyName", "show courtesy") },
{ Pid::SLUR_STYLE_TYPE, false, "lineType", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "line type") },
{ Pid::PITCH, true, "pitch", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "pitch") },
{ Pid::TPC1, true, "tpc", P_TYPE::INT, DUMMY_QT_TR_NOOP("propertyName", "tonal pitch class") },

View file

@ -82,7 +82,7 @@ enum class Pid {
SMALL,
SHOW_COURTESY,
KEYSIG_MODE,
LINE_TYPE,
SLUR_STYLE_TYPE,
PITCH,
TPC1,

View file

@ -71,25 +71,25 @@ void SlurSegment::draw(mu::draw::Painter* painter) const
std::vector<double> dashed = { 3.00, 3.00 }; // Compensating for caps. Qt default PenStyle::DashLine is { 4.0, 2.0 }
std::vector<double> wideDashed = { 5.00, 6.00 };
switch (slurTie()->lineType()) {
case 0:
switch (slurTie()->styleType()) {
case SlurStyleType::Solid:
painter->setBrush(Brush(pen.color()));
pen.setCapStyle(PenCapStyle::RoundCap);
pen.setJoinStyle(PenJoinStyle::RoundJoin);
pen.setWidthF(score()->styleMM(Sid::SlurEndWidth) * mag);
break;
case 1:
case SlurStyleType::Dotted:
painter->setBrush(BrushStyle::NoBrush);
pen.setCapStyle(PenCapStyle::RoundCap); // round dots
pen.setDashPattern(dotted);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
break;
case 2:
case SlurStyleType::Dashed:
painter->setBrush(BrushStyle::NoBrush);
pen.setDashPattern(dashed);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
break;
case 3:
case SlurStyleType::WideDashed:
painter->setBrush(BrushStyle::NoBrush);
pen.setDashPattern(wideDashed);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
@ -393,7 +393,7 @@ void SlurSegment::computeBezier(mu::PointF p6o)
path = PainterPath();
path.moveTo(PointF());
path.cubicTo(p3 + p3o - th, p4 + p4o - th, p2);
if (slur()->lineType() == 0) {
if (slur()->styleType() == SlurStyleType::Solid) {
path.cubicTo(p4 + p4o + th, p3 + p3o + th, PointF());
}

View file

@ -235,7 +235,7 @@ void SlurTieSegment::editDrag(EditData& ed)
PropertyValue SlurTieSegment::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::LINE_TYPE:
case Pid::SLUR_STYLE_TYPE:
case Pid::SLUR_DIRECTION:
return slurTie()->getProperty(propertyId);
case Pid::SLUR_UOFF1:
@ -258,7 +258,7 @@ PropertyValue SlurTieSegment::getProperty(Pid propertyId) const
bool SlurTieSegment::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LINE_TYPE:
case Pid::SLUR_STYLE_TYPE:
case Pid::SLUR_DIRECTION:
return slurTie()->setProperty(propertyId, v);
case Pid::SLUR_UOFF1:
@ -287,7 +287,7 @@ bool SlurTieSegment::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue SlurTieSegment::propertyDefault(Pid id) const
{
switch (id) {
case Pid::LINE_TYPE:
case Pid::SLUR_STYLE_TYPE:
case Pid::SLUR_DIRECTION:
return slurTie()->propertyDefault(id);
case Pid::SLUR_UOFF1:
@ -430,7 +430,7 @@ SlurTie::SlurTie(const ElementType& type, EngravingItem* parent)
{
_slurDirection = DirectionV::AUTO;
_up = true;
_lineType = 0; // default is solid
_styleType = SlurStyleType::Solid;
}
SlurTie::SlurTie(const SlurTie& t)
@ -438,7 +438,7 @@ SlurTie::SlurTie(const SlurTie& t)
{
_up = t._up;
_slurDirection = t._slurDirection;
_lineType = t._lineType;
_styleType = t._styleType;
}
//---------------------------------------------------------
@ -461,7 +461,7 @@ void SlurTie::writeProperties(XmlWriter& xml) const
((SlurTieSegment*)ss)->writeSlur(xml, idx++);
}
writeProperty(xml, Pid::SLUR_DIRECTION);
writeProperty(xml, Pid::LINE_TYPE);
writeProperty(xml, Pid::SLUR_STYLE_TYPE);
}
//---------------------------------------------------------
@ -474,7 +474,7 @@ bool SlurTie::readProperties(XmlReader& e)
if (readProperty(tag, e, Pid::SLUR_DIRECTION)) {
} else if (tag == "lineType") {
_lineType = e.readInt();
_styleType = static_cast<SlurStyleType>(e.readInt());
} else if (tag == "SlurSegment" || tag == "TieSegment") {
const int idx = e.intAttribute("no", 0);
const int n = int(spannerSegments().size());
@ -499,15 +499,6 @@ void SlurTie::read(XmlReader& e)
Spanner::read(e);
}
//---------------------------------------------------------
// undoSetLineType
//---------------------------------------------------------
void SlurTie::undoSetLineType(int t)
{
undoChangeProperty(Pid::LINE_TYPE, t);
}
//---------------------------------------------------------
// undoSetSlurDirection
//---------------------------------------------------------
@ -524,8 +515,8 @@ void SlurTie::undoSetSlurDirection(DirectionV d)
PropertyValue SlurTie::getProperty(Pid propertyId) const
{
switch (propertyId) {
case Pid::LINE_TYPE:
return lineType();
case Pid::SLUR_STYLE_TYPE:
return PropertyValue::fromValue<SlurStyleType>(styleType());
case Pid::SLUR_DIRECTION:
return PropertyValue::fromValue<DirectionV>(slurDirection());
default:
@ -540,8 +531,8 @@ PropertyValue SlurTie::getProperty(Pid propertyId) const
bool SlurTie::setProperty(Pid propertyId, const PropertyValue& v)
{
switch (propertyId) {
case Pid::LINE_TYPE:
setLineType(v.toInt());
case Pid::SLUR_STYLE_TYPE:
setStyleType(v.value<SlurStyleType>());
break;
case Pid::SLUR_DIRECTION:
setSlurDirection(v.value<DirectionV>());
@ -560,7 +551,7 @@ bool SlurTie::setProperty(Pid propertyId, const PropertyValue& v)
PropertyValue SlurTie::propertyDefault(Pid id) const
{
switch (id) {
case Pid::LINE_TYPE:
case Pid::SLUR_STYLE_TYPE:
return 0;
case Pid::SLUR_DIRECTION:
return PropertyValue::fromValue<DirectionV>(DirectionV::AUTO);
@ -586,6 +577,6 @@ void SlurTie::reset()
{
EngravingItem::reset();
undoResetProperty(Pid::SLUR_DIRECTION);
undoResetProperty(Pid::LINE_TYPE);
undoResetProperty(Pid::SLUR_STYLE_TYPE);
}
}

View file

@ -145,7 +145,7 @@ public:
class SlurTie : public Spanner
{
int _lineType; // 0 = solid, 1 = dotted, 2 = dashed, 3 = wide dashed
SlurStyleType _styleType = SlurStyleType::Undefined;
protected:
bool _up; // actual direction
@ -174,9 +174,8 @@ public:
void writeProperties(XmlWriter& xml) const override;
bool readProperties(XmlReader&) override;
int lineType() const { return _lineType; }
void setLineType(int val) { _lineType = val; }
void undoSetLineType(int);
SlurStyleType styleType() const { return _styleType; }
void setStyleType(SlurStyleType type) { _styleType = type; }
virtual void slurPos(SlurPos*) = 0;
virtual SlurTieSegment* newSlurTieSegment(System* parent) = 0;

View file

@ -79,25 +79,25 @@ void TieSegment::draw(mu::draw::Painter* painter) const
std::vector<double> dashed = { 3.00, 3.00 }; // Compensating for caps. Qt default PenStyle::DashLine is { 4.0, 2.0 }
std::vector<double> wideDashed = { 5.00, 6.00 };
switch (slurTie()->lineType()) {
case 0:
switch (slurTie()->styleType()) {
case SlurStyleType::Solid:
painter->setBrush(Brush(pen.color()));
pen.setCapStyle(PenCapStyle::RoundCap);
pen.setJoinStyle(PenJoinStyle::RoundJoin);
pen.setWidthF(score()->styleMM(Sid::SlurEndWidth) * mag);
break;
case 1:
case SlurStyleType::Dotted:
painter->setBrush(BrushStyle::NoBrush);
pen.setCapStyle(PenCapStyle::RoundCap); // True dots
pen.setDashPattern(dotted);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
break;
case 2:
case SlurStyleType::Dashed:
painter->setBrush(BrushStyle::NoBrush);
pen.setDashPattern(dashed);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
break;
case 3:
case SlurStyleType::WideDashed:
painter->setBrush(BrushStyle::NoBrush);
pen.setDashPattern(wideDashed);
pen.setWidthF(score()->styleMM(Sid::SlurDottedWidth) * mag);
@ -319,7 +319,7 @@ void TieSegment::computeBezier(PointF shoulderOffset)
path = PainterPath();
path.moveTo(PointF());
path.cubicTo(bezier1 + bezier1Offset - tieThickness, bezier2 + bezier2Offset - tieThickness, tieEndNormalized);
if (tie()->lineType() == 0) {
if (tie()->styleType() == SlurStyleType::Solid) {
path.cubicTo(bezier2 + bezier2Offset + tieThickness, bezier1 + bezier1Offset + tieThickness, PointF());
}

View file

@ -154,6 +154,7 @@ QVariant PropertyValue::toQVariant() const
case P_TYPE::TEXT_STYLE: return static_cast<int>(value<TextStyleType>());
case P_TYPE::PLAYTECH_TYPE: return static_cast<int>(value<PlayingTechniqueType>());
case P_TYPE::TEMPOCHANGE_TYPE: return static_cast<int>(value<TempoTechniqueType>());
case P_TYPE::SLUR_STYLE_TYPE: return static_cast<int>(value<SlurStyleType>());
// Other
case P_TYPE::GROUPS: {
@ -242,6 +243,7 @@ PropertyValue PropertyValue::fromQVariant(const QVariant& v, P_TYPE type)
case P_TYPE::TEXT_STYLE: return PropertyValue(TextStyleType(v.toInt()));
case P_TYPE::PLAYTECH_TYPE: return PropertyValue(PlayingTechniqueType(v.toInt()));
case P_TYPE::TEMPOCHANGE_TYPE: return PropertyValue(TempoTechniqueType(v.toInt()));
case P_TYPE::SLUR_STYLE_TYPE: return PropertyValue(SlurStyleType(v.toInt()));
// Other
case P_TYPE::GROUPS: {

View file

@ -98,6 +98,7 @@ enum class P_TYPE {
TEXT_STYLE,
PLAYTECH_TYPE,
TEMPOCHANGE_TYPE,
SLUR_STYLE_TYPE,
// Other
GROUPS,
@ -242,6 +243,9 @@ public:
PropertyValue(TempoTechniqueType v)
: m_type(P_TYPE::TEMPOCHANGE_TYPE), m_data(make_data<TempoTechniqueType>(v)) {}
PropertyValue(SlurStyleType v)
: m_type(P_TYPE::SLUR_STYLE_TYPE), m_data(make_data<SlurStyleType>(v)) {}
// Other
PropertyValue(const GroupNodes& v)
: m_type(P_TYPE::GROUPS), m_data(make_data<GroupNodes>(v)) {}

View file

@ -2336,7 +2336,7 @@ static bool readSlurTieProperties(XmlReader& e, const ReadContext& ctx, SlurTie*
if (st->readProperty(tag, e, Pid::SLUR_DIRECTION)) {
} else if (tag == "lineType") {
st->setLineType(e.readInt());
st->setStyleType(static_cast<SlurStyleType>(e.readInt()));
} else if (tag == "SlurSegment") {
SlurTieSegment* s = st->newSlurTieSegment(ctx.dummy()->system());
s->read(e);

View file

@ -569,6 +569,14 @@ enum class ChordLineType : char {
PLOP, SCOOP
};
enum class SlurStyleType {
Undefined = -1,
Solid,
Dotted,
Dashed,
WideDashed
};
struct InstrumentTrackId {
ID partId = 0;
std::string instrumentId;
@ -645,6 +653,7 @@ using InstrumentTrackId = mu::engraving::InstrumentTrackId;
using InstrumentTrackIdSet = mu::engraving::InstrumentTrackIdSet;
using FermataType = mu::engraving::FermataType;
using ChordLineType = mu::engraving::ChordLineType;
using SlurStyleType = mu::engraving::SlurStyleType;
}
#endif // MU_ENGRAVING_TYPES_H

View file

@ -167,6 +167,7 @@ public:
SPLIT_VIEW_VERTICAL = 0xEF80,
KEY_SIGNATURE = 0xEF81,
LINE_DASHED = 0xEF82,
LINE_WIDE_DASHED = 0xF434,
LINE_DOTTED = 0xEF83,
LINE_NORMAL = 0xEF84,
LINE_WITH_END_HOOK = 0xEF85,

View file

@ -699,11 +699,11 @@ static QString slurTieLineStyle(const SlurTie* s)
{
QString lineType;
QString rest;
switch (s->lineType()) {
case 1:
switch (s->styleType()) {
case SlurStyleType::Dotted:
lineType = "dotted";
break;
case 2:
case SlurStyleType::Dashed:
lineType = "dashed";
break;
default:

View file

@ -5509,9 +5509,9 @@ static void addSlur(const Notation& notation, SlurStack& slurs, ChordRest* cr, c
newSlur->setAnchor(Spanner::Anchor::CHORD);
}
if (lineType == "dotted") {
newSlur->setLineType(1);
newSlur->setStyleType(SlurStyleType::Dotted);
} else if (lineType == "dashed") {
newSlur->setLineType(2);
newSlur->setStyleType(SlurStyleType::Dashed);
}
newSlur->setTick(Fraction::fromTicks(tick));
newSlur->setStartElement(cr);
@ -5975,9 +5975,9 @@ static void addTie(const Notation& notation, Score* score, Note* note, const int
}
if (lineType == "dotted") {
tie->setLineType(1);
tie->setStyleType(SlurStyleType::Dotted);
} else if (lineType == "dashed") {
tie->setLineType(2);
tie->setStyleType(SlurStyleType::Dashed);
}
tie = nullptr;
} else if (type == "stop") {

View file

@ -114,6 +114,8 @@ set(MODULE_SRC
${CMAKE_CURRENT_LIST_DIR}/models/notation/clefs/clefsettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/hairpinlinesettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/hairpinlinesettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/slurandtiesettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/lines/slurandtiesettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/fermatas/fermatasettingsmodel.cpp
${CMAKE_CURRENT_LIST_DIR}/models/notation/fermatas/fermatasettingsmodel.h
${CMAKE_CURRENT_LIST_DIR}/models/notation/frames/horizontalframesettingsmodel.cpp

View file

@ -96,6 +96,8 @@ QList<Ms::EngravingItem*> ElementRepositoryService::findElementsByType(const Ms:
case Ms::ElementType::LET_RING:
case Ms::ElementType::OTTAVA:
case Ms::ElementType::TEXTLINE:
case Ms::ElementType::SLUR:
case Ms::ElementType::TIE:
case Ms::ElementType::PALM_MUTE: return findLines(elementType);
default:
QList<Ms::EngravingItem*> resultList;
@ -281,7 +283,9 @@ QList<Ms::EngravingItem*> ElementRepositoryService::findLines(Ms::ElementType li
{ Ms::ElementType::LET_RING, Ms::ElementType::LET_RING_SEGMENT },
{ Ms::ElementType::PALM_MUTE, Ms::ElementType::PALM_MUTE_SEGMENT },
{ Ms::ElementType::OTTAVA, Ms::ElementType::OTTAVA_SEGMENT },
{ Ms::ElementType::TEXTLINE, Ms::ElementType::TEXTLINE_SEGMENT }
{ Ms::ElementType::TEXTLINE, Ms::ElementType::TEXTLINE_SEGMENT },
{ Ms::ElementType::SLUR, Ms::ElementType::SLUR_SEGMENT },
{ Ms::ElementType::TIE, Ms::ElementType::TIE_SEGMENT }
};
QList<Ms::EngravingItem*> resultList;
@ -294,8 +298,8 @@ QList<Ms::EngravingItem*> ElementRepositoryService::findLines(Ms::ElementType li
for (Ms::EngravingItem* element : m_exposedElementList) {
if (element->type() == segmentType) {
const Ms::LineSegment* segment = Ms::toLineSegment(element);
Ms::SLine* line = segment ? segment->line() : nullptr;
const Ms::SpannerSegment* segment = Ms::toSpannerSegment(element);
Ms::Spanner* line = segment ? segment->spanner() : nullptr;
if (line) {
resultList << line;

View file

@ -44,6 +44,10 @@ static const QMap<Ms::ElementType, InspectorModelType> NOTATION_ELEMENT_MODEL_TY
{ Ms::ElementType::GLISSANDO_SEGMENT, InspectorModelType::TYPE_GLISSANDO },
{ Ms::ElementType::VIBRATO, InspectorModelType::TYPE_VIBRATO },
{ Ms::ElementType::VIBRATO_SEGMENT, InspectorModelType::TYPE_VIBRATO },
{ Ms::ElementType::SLUR, InspectorModelType::TYPE_SLUR },
{ Ms::ElementType::SLUR_SEGMENT, InspectorModelType::TYPE_SLUR },
{ Ms::ElementType::TIE, InspectorModelType::TYPE_TIE },
{ Ms::ElementType::TIE_SEGMENT, InspectorModelType::TYPE_TIE },
{ Ms::ElementType::TEMPO_TEXT, InspectorModelType::TYPE_TEMPO },
{ Ms::ElementType::FERMATA, InspectorModelType::TYPE_FERMATA },
{ Ms::ElementType::LAYOUT_BREAK, InspectorModelType::TYPE_SECTIONBREAK },
@ -413,6 +417,11 @@ QVariant AbstractInspectorModel::valueFromElementUnits(const Ms::Pid& pid, const
}
}
void AbstractInspectorModel::setElementType(Ms::ElementType type)
{
m_elementType = type;
}
PropertyItem* AbstractInspectorModel::buildPropertyItem(const Ms::Pid& propertyId, std::function<void(const Ms::Pid propertyId,
const QVariant& newValue)> onPropertyChangedCallBack)
{

View file

@ -97,6 +97,8 @@ public:
TYPE_LET_RING,
TYPE_VOLTA,
TYPE_VIBRATO,
TYPE_SLUR,
TYPE_TIE,
TYPE_CRESCENDO,
TYPE_DIMINUENDO,
TYPE_STAFF_TYPE_CHANGES,
@ -159,6 +161,8 @@ signals:
void requestReloadPropertyItems();
protected:
void setElementType(Ms::ElementType type);
PropertyItem* buildPropertyItem(const Ms::Pid& pid, std::function<void(const Ms::Pid propertyId,
const QVariant& newValue)> onPropertyChangedCallBack = nullptr);

View file

@ -47,6 +47,7 @@
#include "notation/lines/letringsettingsmodel.h"
#include "notation/lines/palmmutesettingsmodel.h"
#include "notation/lines/vibratosettingsmodel.h"
#include "notation/lines/slurandtiesettingsmodel.h"
#include "notation/stafftype/stafftypesettingsmodel.h"
#include "notation/frames/textframesettingsmodel.h"
#include "notation/frames/verticalframesettingsmodel.h"
@ -128,6 +129,10 @@ AbstractInspectorModel* InspectorModelCreator::newInspectorModel(InspectorModelT
return new TextLineSettingsModel(parent, repository);
case InspectorModelType::TYPE_VIBRATO:
return new VibratoSettingsModel(parent, repository);
case InspectorModelType::TYPE_SLUR:
return new SlurAndTieSettingsModel(parent, repository, SlurAndTieSettingsModel::Slur);
case InspectorModelType::TYPE_TIE:
return new SlurAndTieSettingsModel(parent, repository, SlurAndTieSettingsModel::Tie);
case InspectorModelType::TYPE_STAFF_TYPE_CHANGES:
return new StaffTypeSettingsModel(parent, repository);
case InspectorModelType::TYPE_TEXT_FRAME:

View file

@ -0,0 +1,93 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include "slurandtiesettingsmodel.h"
#include "inspector/types/linetypes.h"
#include "inspector/types/commontypes.h"
#include "engraving/types/types.h"
#include "translation.h"
using namespace mu::inspector;
using namespace mu::engraving;
using IconCode = mu::ui::IconCode::Code;
SlurAndTieSettingsModel::SlurAndTieSettingsModel(QObject* parent, IElementRepositoryService* repository, ElementType elementType)
: AbstractInspectorModel(parent, repository)
{
if (elementType == ElementType::Slur) {
setModelType(InspectorModelType::TYPE_SLUR);
setElementType(Ms::ElementType::SLUR);
setTitle(qtrc("inspector", "Slur"));
setIcon(IconCode::NOTE_SLUR);
} else {
setModelType(InspectorModelType::TYPE_TIE);
setElementType(Ms::ElementType::TIE);
setTitle(qtrc("inspector", "Tie"));
setIcon(IconCode::NOTE_TIE);
}
createProperties();
}
PropertyItem* SlurAndTieSettingsModel::lineStyle() const
{
return m_lineStyle;
}
PropertyItem* SlurAndTieSettingsModel::direction() const
{
return m_direction;
}
QVariantList SlurAndTieSettingsModel::possibleLineStyles() const
{
QVariantList result {
object(SlurStyleType::Solid, qtrc("inspector", "Normal"), IconCode::LINE_NORMAL),
object(SlurStyleType::WideDashed, qtrc("inspector", "Wide dashed"), IconCode::LINE_WIDE_DASHED),
object(SlurStyleType::Dashed, qtrc("inspector", "Dashed"), IconCode::LINE_DASHED),
object(SlurStyleType::Dotted, qtrc("inspector", "Dotted"), IconCode::LINE_DOTTED)
};
return result;
}
void SlurAndTieSettingsModel::createProperties()
{
m_lineStyle = buildPropertyItem(Ms::Pid::SLUR_STYLE_TYPE);
m_direction = buildPropertyItem(Ms::Pid::SLUR_DIRECTION);
}
void SlurAndTieSettingsModel::loadProperties()
{
loadPropertyItem(m_lineStyle);
loadPropertyItem(m_direction);
}
void SlurAndTieSettingsModel::resetProperties()
{
m_lineStyle->resetToDefault();
m_direction->resetToDefault();
}

View file

@ -0,0 +1,58 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef MU_INSPECTOR_SLURANDTIESETTINGSMODEL_H
#define MU_INSPECTOR_SLURANDTIESETTINGSMODEL_H
#include "models/abstractinspectormodel.h"
namespace mu::inspector {
class SlurAndTieSettingsModel : public AbstractInspectorModel
{
Q_OBJECT
Q_PROPERTY(PropertyItem * lineStyle READ lineStyle CONSTANT)
Q_PROPERTY(PropertyItem * direction READ direction CONSTANT)
public:
enum ElementType {
Slur,
Tie
};
explicit SlurAndTieSettingsModel(QObject* parent, IElementRepositoryService* repository, ElementType elementType);
PropertyItem* lineStyle() const;
PropertyItem* direction() const;
Q_INVOKABLE QVariantList possibleLineStyles() const;
private:
void createProperties() override;
void loadProperties() override;
void resetProperties() override;
PropertyItem* m_lineStyle = nullptr;
PropertyItem* m_direction = nullptr;
};
}
#endif // MU_INSPECTOR_SLURANDTIESETTINGSMODEL_H

View file

@ -22,25 +22,14 @@
#include "tupletsettingsmodel.h"
#include "translation.h"
#include "inspector/types/commontypes.h"
#include "ui/view/iconcodes.h"
#include "translation.h"
using namespace mu::inspector;
using Icon = mu::ui::IconCode::Code;
template<typename T>
static QVariant object(T type, QString title, Icon iconCode = Icon::NONE)
{
QVariantMap obj;
obj["value"] = static_cast<int>(type);
obj["text"] = title;
obj["iconCode"] = static_cast<int>(iconCode);
return obj;
}
TupletSettingsModel::TupletSettingsModel(QObject* parent, IElementRepositoryService* repository)
: AbstractInspectorModel(parent, repository, Ms::ElementType::TUPLET)
{
@ -70,19 +59,6 @@ PropertyItem* TupletSettingsModel::lineThickness() const
return m_lineThickness;
}
QVariantList TupletSettingsModel::possibleDirectionTypes() const
{
using Type = Ms::DirectionV;
QVariantList types {
object(Type::AUTO, qtrc("inspector", "Auto")),
object(Type::DOWN, qtrc("inspector", "Down"), Icon::ARROW_DOWN),
object(Type::UP, qtrc("inspector", "Up"), Icon::ARROW_UP)
};
return types;
}
QVariantList TupletSettingsModel::possibleNumberTypes() const
{
using Type = Ms::TupletNumberType;

View file

@ -42,7 +42,6 @@ public:
PropertyItem* bracketType() const;
PropertyItem* lineThickness() const;
Q_INVOKABLE QVariantList possibleDirectionTypes() const;
Q_INVOKABLE QVariantList possibleNumberTypes() const;
Q_INVOKABLE QVariantList possibleBracketTypes() const;

View file

@ -38,19 +38,12 @@ public:
TYPE_BELOW_CHORD
};
enum class Direction {
AUTO,
DOWN,
UP
};
enum class Style {
STYLE_STANDART = 0,
STYLE_BAROQUE
};
Q_ENUM(Placement)
Q_ENUM(Direction)
Q_ENUM(Style)
};
}

View file

@ -24,7 +24,9 @@
#include "qobjectdefs.h"
#include "ui/view/iconcodes.h"
#include "dataformatter.h"
#include "libmscore/types.h"
namespace mu::inspector {
@ -77,6 +79,17 @@ inline double formatDoubleFunc(const QVariant& elementPropertyValue)
{
return DataFormatter::roundDouble(elementPropertyValue.toDouble());
}
template<typename T>
inline QVariant object(T type, QString title, ui::IconCode::Code iconCode = ui::IconCode::Code::NONE)
{
QVariantMap obj;
obj["value"] = static_cast<int>(type);
obj["text"] = title;
obj["iconCode"] = static_cast<int>(iconCode);
return obj;
}
}
#endif // MU_INSPECTOR_COMMONTYPES_H

View file

@ -66,12 +66,6 @@ public:
TYPE_BREVIS
};
enum class HorizontalDirection {
DIRECTION_H_AUTO = 0,
DIRECTION_H_LEFT,
DIRECTION_H_RIGHT
};
enum class NoteDotPosition {
DOT_POSITION_AUTO,
DOT_POSITION_UP,
@ -92,7 +86,6 @@ public:
};
Q_ENUM(Group)
Q_ENUM(HorizontalDirection)
Q_ENUM(Type)
Q_ENUM(NoteDotPosition)
Q_ENUM(SchemeType)

View file

@ -34,6 +34,7 @@
<file>qml/MuseScore/Inspector/text/TextInspectorView.qml</file>
<file>qml/MuseScore/Inspector/common/InspectorSectionView.qml</file>
<file>qml/MuseScore/Inspector/common/SpinBoxPropertyView.qml</file>
<file>qml/MuseScore/Inspector/common/DirectionSection.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/internal/HairpinStyleSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/internal/VoltaStyleSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/internal/OttavaStyleSettings.qml</file>
@ -63,6 +64,7 @@
<file>qml/MuseScore/Inspector/notation/fermatas/FermataSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/GlissandoSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/VibratoSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/lines/SlurAndTieSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/tempos/TempoSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/sectionbreaks/SectionBreakSettings.qml</file>
<file>qml/MuseScore/Inspector/notation/markers/MarkerSettings.qml</file>

View file

@ -0,0 +1,67 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import QtQuick.Controls 2.15
import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0
import MuseScore.Inspector 1.0
FlatRadioButtonGroupPropertyView {
id: root
property int orientation : Qt.Vertical
titleText: qsTrc("inspector", "Direction")
navigationName: "Direction"
states: [
State {
name: "VERTICAL"
when: root.orientation === Qt.Vertical
PropertyChanges {
target: root
model: [
{ text: qsTrc("inspector", "Auto"), value: DirectionTypes.VERTICAL_AUTO, title: qsTrc("inspector", "Auto") },
{ iconCode: IconCode.ARROW_DOWN, value: DirectionTypes.VERTICAL_DOWN, title: qsTrc("inspector", "Down") },
{ iconCode: IconCode.ARROW_UP, value: DirectionTypes.VERTICAL_UP, title: qsTrc("inspector", "Up") }
]
}
},
State {
name: "HORIZONTAL"
when: root.orientation === Qt.Horizontal
PropertyChanges {
target: root
model: [
{ text: qsTrc("inspector", "Auto"), value: DirectionTypes.HORIZONTAL_AUTO, title: qsTrc("inspector", "Auto") },
{ iconCode: IconCode.ARROW_LEFT, value: DirectionTypes.HORIZONTAL_LEFT, title: qsTrc("inspector", "Left") },
{ iconCode: IconCode.ARROW_RIGHT, value: DirectionTypes.HORIZONTAL_RIGHT, title: qsTrc("inspector", "Right") }
]
}
}
]
}

View file

@ -83,7 +83,9 @@ Loader {
case Inspector.TYPE_HOOK: return noteComp
case Inspector.TYPE_FERMATA: return fermataComp
case Inspector.TYPE_GLISSANDO: return glissandoComp
case Inspector.TYPE_VIBRATO: return vibratoCompo
case Inspector.TYPE_VIBRATO: return vibratoComp
case Inspector.TYPE_SLUR:
case Inspector.TYPE_TIE: return slurAndTieComp
case Inspector.TYPE_TEMPO: return tempoComp
case Inspector.TYPE_BARLINE: return barlineComp
case Inspector.TYPE_SECTIONBREAK: return sectionBreakComp
@ -151,10 +153,15 @@ Loader {
}
Component {
id: vibratoCompo
id: vibratoComp
VibratoSettings { }
}
Component {
id: slurAndTieComp
SlurAndTieSettings { }
}
Component {
id: tempoComp
TempoSettings { }

View file

@ -44,19 +44,13 @@ Column {
directionSection.focusOnFirst()
}
FlatRadioButtonGroupPropertyView {
DirectionSection {
id: directionSection
titleText: qsTrc("inspector", "Direction")
propertyItem: root.model ? root.model.direction : null
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart + 1
model: [
{ text: qsTrc("inspector", "Auto"), value: ArticulationTypes.AUTO, title: qsTrc("inspector", "Auto") },
{ iconCode: IconCode.ARROW_DOWN, value: ArticulationTypes.DOWN, title: qsTrc("inspector", "Down") },
{ iconCode: IconCode.ARROW_UP, value: ArticulationTypes.UP, title: qsTrc("inspector", "Up") }
]
}
DropdownPropertyView {

View file

@ -0,0 +1,72 @@
/*
* SPDX-License-Identifier: GPL-3.0-only
* MuseScore-CLA-applies
*
* MuseScore
* Music Composition & Notation
*
* Copyright (C) 2021 MuseScore BVBA and others
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License version 3 as
* published by the Free Software Foundation.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
import QtQuick 2.15
import MuseScore.Ui 1.0
import MuseScore.UiComponents 1.0
import MuseScore.Inspector 1.0
import "../../common"
import "internal"
Column {
id: root
property QtObject model: null
property NavigationPanel navigationPanel: null
property int navigationRowStart: 1
objectName: "SlurAndTieSettings"
spacing: 12
function focusOnFirst() {
styleSection.focusOnFirst()
}
LineStyleSection {
id: styleSection
lineStyle: root.model ? root.model.lineStyle : null
possibleLineStyles: root.model ? root.model.possibleLineStyles() : []
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart + 1
}
SeparatorLine { anchors.margins: -12 }
PlacementSection {
propertyItem: root.model ? root.model.direction : null
navigationPanel: root.navigationPanel
navigationRowStart: styleSection.navigationRowEnd + 1
//! NOTE: Slur/tie uses the direction property,
// but for convenience we will display it in the placement section
model: [
{ text: qsTrc("inspector", "Above"), value: DirectionTypes.VERTICAL_UP },
{ text: qsTrc("inspector", "Below"), value: DirectionTypes.VERTICAL_DOWN }
]
}
}

View file

@ -33,6 +33,8 @@ Column {
id: root
property PropertyItem lineStyle: null
property alias possibleLineStyles: styleSection.model
property PropertyItem dashLineLength: null
property PropertyItem dashGapLength: null
@ -44,6 +46,10 @@ Column {
spacing: 12
function focusOnFirst() {
styleSection.focusOnFirst()
}
FlatRadioButtonGroupPropertyView {
id: styleSection
titleText: qsTrc("inspector", "Style")

View file

@ -105,20 +105,16 @@ FocusableItem {
navigationRowStart: showItem.navigation.row + 1
}
FlatRadioButtonGroupPropertyView {
DirectionSection {
id: noteDirectionSection
titleText: qsTrc("inspector", "Note direction")
propertyItem: root.model ? root.model.headDirection : null
navigationName: "NoteDirectionSection"
orientation: Qt.Horizontal
navigationPanel: root.navigationPanel
navigationRowStart: noteHeadTypeSection.navigationRowEnd + 1
model: [
{ text: qsTrc("inspector", "Auto"), value: NoteHead.DIRECTION_H_AUTO, title: qsTrc("inspector", "Auto") },
{ iconCode: IconCode.ARROW_LEFT, value: NoteHead.DIRECTION_H_LEFT, title: qsTrc("inspector", "Left") },
{ iconCode: IconCode.ARROW_RIGHT, value: NoteHead.DIRECTION_H_RIGHT, title: qsTrc("inspector", "Right") }
]
}
OffsetSection {

View file

@ -68,21 +68,14 @@ FocusableItem {
}
}
FlatRadioButtonGroupPropertyView {
DirectionSection {
id: stemDirectionGroup
titleText: qsTrc("inspector", "Stem direction")
propertyItem: root.stemModel ? root.stemModel.stemDirection : null
navigationName: "StemDirection"
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart + 2
model: [
{ text: qsTrc("inspector", "Auto"), value: DirectionTypes.VERTICAL_AUTO, title: qsTrc("inspector", "Auto") },
{ iconCode: IconCode.ARROW_DOWN, value: DirectionTypes.VERTICAL_DOWN, title: qsTrc("inspector", "Down") },
{ iconCode: IconCode.ARROW_UP, value: DirectionTypes.VERTICAL_UP, title: qsTrc("inspector", "Up") }
]
}
Column {

View file

@ -44,15 +44,13 @@ Column {
directionSection.focusOnFirst()
}
FlatRadioButtonGroupPropertyView {
DirectionSection {
id: directionSection
titleText: qsTrc("inspector", "Direction")
propertyItem: root.model ? root.model.directionType : null
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart + 1
model: root.model ? root.model.possibleDirectionTypes() : null
}
FlatRadioButtonGroupPropertyView {

View file

@ -170,7 +170,7 @@ class EngravingItem : public Ms::PluginAPI::ScoreElement
API_PROPERTY_T(int, z, Z)
API_PROPERTY(small, SMALL)
API_PROPERTY(showCourtesy, SHOW_COURTESY)
API_PROPERTY(lineType, LINE_TYPE)
API_PROPERTY(lineType, SLUR_STYLE_TYPE)
API_PROPERTY(line, LINE)
API_PROPERTY(fixed, FIXED)
API_PROPERTY(fixedLine, FIXED_LINE)