Skip to content

Commit

Permalink
Fix #305555: add cut2 and cut3 time signatures to master palette
Browse files Browse the repository at this point in the history
  • Loading branch information
Jojo-Schmitz committed Feb 5, 2021
1 parent a1b4287 commit e71d36a
Show file tree
Hide file tree
Showing 12 changed files with 94 additions and 13 deletions.
20 changes: 18 additions & 2 deletions share/workspaces/Default.xml
Original file line number Diff line number Diff line change
Expand Up @@ -383,15 +383,15 @@
<sigD>8</sigD>
</TimeSig>
</Cell>
<Cell name="4/4 common time">
<Cell name="Common time">
<staff>1</staff>
<TimeSig>
<subtype>1</subtype>
<sigN>4</sigN>
<sigD>4</sigD>
</TimeSig>
</Cell>
<Cell name="2/2 alla breve">
<Cell name="Cut time">
<staff>1</staff>
<TimeSig>
<subtype>2</subtype>
Expand All @@ -414,6 +414,22 @@
<sigD>2</sigD>
</TimeSig>
</Cell>
<Cell name="Cut time (Bach)">
<staff>1</staff>
<TimeSig>
<subtype>3</subtype>
<sigN>2</sigN>
<sigD>2</sigD>
</TimeSig>
</Cell>
<Cell name="Cut triple time (9/8)">
<staff>1</staff>
<TimeSig>
<subtype>4</subtype>
<sigN>9</sigN>
<sigD>8</sigD>
</TimeSig>
</Cell>
</Palette>
<Palette name="Brackets">
<type>Bracket</type>
Expand Down
14 changes: 9 additions & 5 deletions src/importexport/braille/internal/exportbraille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -859,14 +859,18 @@ QString ExportBraille::brailleTimeSig(TimeSig* timeSig)

QString rez;
QTextStream rezult(&rez);
if (timeSig->timeSigType() == TimeSigType::ALLA_BREVE) {
return QString("_c");
}

if (timeSig->timeSigType() == TimeSigType::FOUR_FOUR) {
return QString(".c");
} else if (timeSig->timeSigType() == TimeSigType::ALLA_BREVE) {
return QString("_c");
}

#if 0 //ToDo
else if (timeSig->timeSigType() == TimeSigType::CUT_BACH) {
return QString("_c"); // this is basically a Cut time, so ALLA_BREVE, but an alternatove glyph for it
} else if (timeSig->timeSigType() == TimeSigType::CUT_TRIPLE) {
return QString("#i8 "); // this is an 9/8 timesig with an alternative glyph so "#i8 "?
}
#endif
QMap<QString, QString> numeratorToBraille;
numeratorToBraille["1"] = 'a';
numeratorToBraille["2"] = 'b';
Expand Down
4 changes: 4 additions & 0 deletions src/importexport/musicxml/internal/musicxml/exportxml.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2001,6 +2001,10 @@ void ExportMusicXml::timesig(TimeSig* tsig)
tagName += " symbol=\"common\"";
} else if (st == TimeSigType::ALLA_BREVE) {
tagName += " symbol=\"cut\"";
} else if (st == TimeSigType::CUT_BACH) {
tagName += " symbol=\"cut2\"";
} else if (st == TimeSigType::CUT_TRIPLE) {
tagName += " symbol=\"cut3\"";
}
if (!tsig->visible()) {
tagName += " print-object=\"no\"";
Expand Down
10 changes: 10 additions & 0 deletions src/importexport/musicxml/internal/musicxml/importmxmlpass1.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2376,6 +2376,16 @@ static bool determineTimeSig(MxmlLogger* logger, const QXmlStreamReader* const x
bts = 4;
btp = 4;
return true;
} else if (beats == "2" && beatType == "2" && timeSymbol == "cut2") {
st = TimeSigType::CUT_BACH;
bts = 2;
btp = 2;
return true;
} else if (beats == "9" && beatType == "8" && timeSymbol == "cut3") {
st = TimeSigType::CUT_TRIPLE;
bts = 9;
btp = 8;
return true;
} else {
if (!timeSymbol.isEmpty() && timeSymbol != "normal") {
logger->logError(QString("time symbol '%1' not recognized with beats=%2 and beat-type=%3")
Expand Down
10 changes: 10 additions & 0 deletions src/importexport/musicxml/internal/musicxml/importmxmlpass2.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3882,6 +3882,16 @@ static bool determineTimeSig(const QString beats, const QString beatType, const
bts = 4;
btp = 4;
return true;
} else if (beats == "2" && beatType == "2" && timeSymbol == "cut2") {
st = TimeSigType::CUT_BACH;
bts = 2;
btp = 2;
return true;
} else if (beats == "9" && beatType == "8" && timeSymbol == "cut3") {
st = TimeSigType::CUT_TRIPLE;
bts = 9;
btp = 8;
return true;
} else {
if (!timeSymbol.isEmpty() && timeSymbol != "normal") {
qDebug("determineTimeSig: time symbol <%s> not recognized with beats=%s and beat-type=%s",
Expand Down
8 changes: 4 additions & 4 deletions src/libmscore/sym.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5798,12 +5798,12 @@ const std::array<const char*, int(SymId::lastSym) + 1> Sym::symUserNames = { {
"Control character for denominator digit",
"Control character for numerator digit",
"Time signature comma",
"Common time",
QT_TRANSLATE_NOOP("symUserNames", "Common time"),
"Reversed common time",
"Turned common time",
"Cut time (Bach)",
"Cut triple time (9/8)",
"Cut time",
QT_TRANSLATE_NOOP("symUserNames", "Cut time (Bach)"),
QT_TRANSLATE_NOOP("symUserNames", "Cut triple time (9/8)"),
QT_TRANSLATE_NOOP("symUserNames", "Cut time"),
"Reversed cut time",
"Turned cut time",
"Time signature equals",
Expand Down
3 changes: 3 additions & 0 deletions src/libmscore/tests/timesig_data/updateReference
Original file line number Diff line number Diff line change
Expand Up @@ -8,3 +8,6 @@ cp ../../../build.debug/mtest/libmscore/timesig/timesig-04.mscx timesig-04-ref.m
cp ../../../build.debug/mtest/libmscore/timesig/timesig-05.mscx timesig-05-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-06.mscx timesig-06-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-07.mscx timesig-07-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-08.mscx timesig-08-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-09.mscx timesig-09-ref.mscx
cp ../../../build.debug/mtest/libmscore/timesig/timesig-10.mscx timesig-10-ref.mscx
18 changes: 18 additions & 0 deletions src/libmscore/timesig.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -309,6 +309,18 @@ void TimeSig::layout()
ns.clear();
ns.push_back(SymId::timeSigCutCommon);
ds.clear();
} else if (sigType == TimeSigType::CUT_BACH) {
pz = QPointF(0.0, yoff);
setbbox(symBbox(SymId::timeSigCut2).translated(pz));
ns.clear();
ns.push_back(SymId::timeSigCut2);
ds.clear();
} else if (sigType == TimeSigType::CUT_TRIPLE) {
pz = QPointF(0.0, yoff);
setbbox(symBbox(SymId::timeSigCut3).translated(pz));
ns.clear();
ns.push_back(SymId::timeSigCut3);
ds.clear();
} else {
if (_numeratorString.isEmpty()) {
ns = toTimeSigString(_numeratorString.isEmpty() ? QString::number(_sig.numerator()) : _numeratorString);
Expand Down Expand Up @@ -574,6 +586,12 @@ QString TimeSig::accessibleInfo() const
case TimeSigType::ALLA_BREVE:
timeSigString = qApp->translate("symUserNames", "Cut time");
break;
case TimeSigType::CUT_BACH:
timeSigString = qApp->translate("symUserNames", "Cut time (Bach)");
break;
case TimeSigType::CUT_TRIPLE:
timeSigString = qApp->translate("symUserNames", "Cut triple time (9/8)");
break;
default:
timeSigString = QObject::tr("%1/%2 time").arg(QString::number(numerator()), QString::number(denominator()));
}
Expand Down
2 changes: 2 additions & 0 deletions src/libmscore/timesig.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,8 @@ enum class TimeSigType : char {
NORMAL, // use sz/sn text
FOUR_FOUR, // common time (4/4)
ALLA_BREVE, // cut time (2/2)
CUT_BACH, // cut time (Bach)
CUT_TRIPLE, // cut triple time (9/8)
};

//---------------------------------------------------------------------------------------
Expand Down
6 changes: 4 additions & 2 deletions src/palette/internal/palette/palettecreator.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1749,11 +1749,13 @@ PalettePanel* PaletteCreator::newTimePalettePanel()
{ 7, 8, TimeSigType::NORMAL, "7/8" },
{ 9, 8, TimeSigType::NORMAL, "9/8" },
{ 12, 8, TimeSigType::NORMAL, "12/8" },
{ 4, 4, TimeSigType::FOUR_FOUR, QT_TRANSLATE_NOOP("palette", "4/4 common time") },
{ 2, 2, TimeSigType::ALLA_BREVE, QT_TRANSLATE_NOOP("palette", "2/2 alla breve") },
{ 4, 4, TimeSigType::FOUR_FOUR, QT_TRANSLATE_NOOP("symUserNames", "Common time") },
{ 2, 2, TimeSigType::ALLA_BREVE, QT_TRANSLATE_NOOP("symUserNames", "Cut time") },
{ 2, 2, TimeSigType::NORMAL, "2/2" },
{ 3, 2, TimeSigType::NORMAL, "3/2" },
{ 4, 2, TimeSigType::NORMAL, "4/2" },
{ 2, 2, TimeSigType::CUT_BACH, QT_TRANSLATE_NOOP("symUserNames", "Cut time (Bach)") },
{ 9, 8, TimeSigType::CUT_TRIPLE, QT_TRANSLATE_NOOP("symUserNames", "Cut triple time (9/8)") },
};

PalettePanel* sp = new PalettePanel(PalettePanel::Type::TimeSig);
Expand Down
8 changes: 8 additions & 0 deletions src/userscores/view/additionalinfomodel.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,8 @@ using namespace mu::ui;

static const mu::notation::Fraction FOUR_FOUR_TIME_SIGNATURE(4, 4);
static const mu::notation::Fraction ALLA_BREVE_TIME_SIGNATURE(2, 2);
static const mu::notation::Fraction CUT_BACH_TIME_SIGNATURE(2, 2);
static const mu::notation::Fraction CUT_TRIPLE_TIME_SIGNATURE(9, 8);
static const mu::notation::Fraction DEFAULT_PICKUP_TIME_SIGNATURE(1, 4);

static const QString VALUE_KEY("value");
Expand Down Expand Up @@ -175,6 +177,12 @@ QVariantMap AdditionalInfoModel::timeSignature() const
return FOUR_FOUR_TIME_SIGNATURE.toMap();
case TimeSigType::ALLA_BREVE:
return ALLA_BREVE_TIME_SIGNATURE.toMap();
case TimeSigType::CUT_BACH:
return CUT_BACH_TIME_SIGNATURE.toMap();
break;
case TimeSigType::CUT_TRIPLE:
return CUT_TRIPLE_TIME_SIGNATURE.toMap();
break;
case TimeSigType::NORMAL:
break;
}
Expand Down
4 changes: 4 additions & 0 deletions tools/fonttools/smufl2sym-in-trans.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,6 +340,10 @@
"systemDivider": null,
"systemDividerExtraLong": null,
"systemDividerLong": null,
"timeSigCommon": null,
"timeSigCut2": null,
"timeSigCut3": null,
"timeSigCutCommon": null,
"wiggleSawtooth": null,
"wiggleSawtoothWide": null,
"wiggleVibratoLargeFaster": null,
Expand Down

0 comments on commit e71d36a

Please sign in to comment.