Merge pull request #12284 from HemantAntony/11852-add_stem_direction_to_tremolo_properties

Fix #11852: Added stem direction to tremolo properties
This commit is contained in:
RomanPudashkin 2022-07-06 13:08:51 +03:00 committed by GitHub
commit cd13ac5d11
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
8 changed files with 30 additions and 11 deletions

View file

@ -129,7 +129,8 @@ void TextLineBaseSegment::draw(mu::draw::Painter* painter) const
const Pen solidPen(color, lineWidth, PenStyle::SolidLine, PenCapStyle::FlatCap, PenJoinStyle::MiterJoin);
Pen pen(solidPen);
double dash, gap;
double dash = 0;
double gap = 0;
switch (tl->lineStyle()) {
case LineType::SOLID:

View file

@ -283,10 +283,10 @@ void Tremolo::layoutOneNoteTremolo(double x, double y, double h, double spatium)
bool up = chord()->up();
int upValue = up ? -1 : 1;
double _mag = chord()->relativeMag();
spatium *= _mag;
double mag = chord()->relativeMag();
spatium *= mag;
double yOffset = h - score()->styleMM(Sid::tremoloOutSidePadding).val() * _mag;
double yOffset = h - score()->styleMM(Sid::tremoloOutSidePadding).val() * mag;
int beams = chord()->beams();
if (chord()->hook()) {
@ -296,7 +296,7 @@ void Tremolo::layoutOneNoteTremolo(double x, double y, double h, double spatium)
yOffset -= (beams * (score()->styleB(Sid::useWideBeams) ? 1.0 : 0.75) - 0.25) * spatium;
}
yOffset -= isBuzzRoll() && up ? 0.5 * spatium : 0.0;
yOffset -= up ? 0.0 : minHeight() * spatium / _mag;
yOffset -= up ? 0.0 : minHeight() * spatium / mag;
yOffset *= upValue;
y += yOffset;

View file

@ -82,7 +82,7 @@ GuitarPro::GPProperties GuitarPro7::readProperties(QByteArray* data)
std::vector<TabImportOption> partsImportOpts = properties.partsImportOptions;
for (size_t i = numInstrOffset + 1; i <= numInstrOffset + numberOfInstruments; i++) {
partsImportOpts.push_back(static_cast<TabImportOption>(data->at(i)));
partsImportOpts.push_back(static_cast<TabImportOption>(data->at(static_cast<int>(i))));
}
return properties;

View file

@ -3013,8 +3013,8 @@ Score::FileError importGTP(MasterScore* score, mu::io::IODevice* io, bool create
for (size_t partNum = 0; partNum < score->parts().size(); partNum++) {
Part* part = score->parts()[partNum];
Fraction fr = Fraction(0, 1);
int lines = part->instrument()->stringData()->strings();
int stavesNum = part->nstaves();
int lines = static_cast<int>(part->instrument()->stringData()->strings());
int stavesNum = static_cast<int>(part->nstaves());
part->setStaves(stavesNum * 2);

View file

@ -39,6 +39,7 @@ TremoloSettingsModel::TremoloSettingsModel(QObject* parent, IElementRepositorySe
void TremoloSettingsModel::createProperties()
{
m_style = buildPropertyItem(mu::engraving::Pid::TREMOLO_STYLE);
m_direction = buildPropertyItem(mu::engraving::Pid::STEM_DIRECTION);
}
void TremoloSettingsModel::requestElements()
@ -49,14 +50,21 @@ void TremoloSettingsModel::requestElements()
void TremoloSettingsModel::loadProperties()
{
loadPropertyItem(m_style);
loadPropertyItem(m_direction);
}
void TremoloSettingsModel::resetProperties()
{
m_style->resetToDefault();
m_direction->resetToDefault();
}
PropertyItem* TremoloSettingsModel::style() const
{
return m_style;
}
PropertyItem* TremoloSettingsModel::direction() const
{
return m_direction;
}

View file

@ -30,6 +30,7 @@ class TremoloSettingsModel : public AbstractInspectorModel
Q_OBJECT
Q_PROPERTY(PropertyItem * style READ style CONSTANT)
Q_PROPERTY(PropertyItem * direction READ direction CONSTANT)
public:
explicit TremoloSettingsModel(QObject* parent, IElementRepositoryService* repository);
@ -40,9 +41,11 @@ public:
void resetProperties() override;
PropertyItem* style() const;
PropertyItem* direction() const;
private:
PropertyItem* m_style = nullptr;
PropertyItem* m_direction = nullptr;
};
}

View file

@ -58,4 +58,14 @@ Column {
{ iconCode: IconCode.TREMOLO_STYLE_TRADITIONAL_ALTERNATE, value: TremoloTypes.STYLE_TRADITIONAL_ALTERNATE, title: qsTrc("inspector", "Traditional alternative") }
]
}
DirectionSection {
id: directionSection
titleText: qsTrc("inspector", "Stem direction")
propertyItem: root.model ? root.model.direction : null
navigationPanel: root.navigationPanel
navigationRowStart: root.navigationRowStart + 2
}
}

View file

@ -83,9 +83,6 @@ RetVal<SaveLocation> SaveProjectScenario::askSaveLocation(INotationProjectPtr pr
}
}
}
UNREACHABLE;
return make_ret(Ret::Code::InternalError);
}
RetVal<io::path_t> SaveProjectScenario::askLocalPath(INotationProjectPtr project, SaveMode saveMode) const