fix #277962 Missing elements in the Time Signature master palette
Expect - no clef - time signature - one line staff
This commit is contained in:
parent
84768fe28e
commit
6887a0c4ee
5 changed files with 36 additions and 15 deletions
|
@ -38,6 +38,10 @@ Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Cho
|
|||
c.move(0, 0);
|
||||
c.addKeySig(Key::C);
|
||||
TimeSig* nts = c.addTimeSig(_sig);
|
||||
if (!_z.isEmpty())
|
||||
nts->setNumeratorString(_z);
|
||||
if (!_n.isEmpty())
|
||||
nts->setDenominatorString(_n);
|
||||
GroupNode node {0, 0};
|
||||
Groups ng;
|
||||
ng.push_back(node);
|
||||
|
@ -62,7 +66,7 @@ Score* NoteGroups::createScore(int n, TDuration::DurationType t, std::vector<Cho
|
|||
StaffType* st = c.score()->staff(0)->staffType(0);
|
||||
st->setLines(1); // single line only
|
||||
st->setGenClef(false); // no clef
|
||||
st->setGenTimesig(false); // don't display time sig since ExampleView is unable to reflect custom time sig text/symbols
|
||||
// st->setGenTimesig(false); // don't display time sig since ExampleView is unable to reflect custom time sig text/symbols
|
||||
|
||||
return c.score();
|
||||
}
|
||||
|
@ -103,20 +107,22 @@ NoteGroups::NoteGroups(QWidget* parent)
|
|||
// setSig
|
||||
//---------------------------------------------------------
|
||||
|
||||
void NoteGroups::setSig(Fraction sig, const Groups& g)
|
||||
void NoteGroups::setSig(Fraction sig, const Groups& g, const QString& z, const QString& n)
|
||||
{
|
||||
_sig = sig;
|
||||
_z = z;
|
||||
_n = n;
|
||||
_groups = g;
|
||||
chords8.clear();
|
||||
chords16.clear();
|
||||
chords32.clear();
|
||||
Fraction f = _sig.reduced();
|
||||
int n = f.numerator() * (8 / f.denominator());
|
||||
view8->setScore(createScore(n, TDuration::DurationType::V_EIGHTH, &chords8));
|
||||
n = f.numerator() * (16 / f.denominator());
|
||||
view16->setScore(createScore(n, TDuration::DurationType::V_16TH, &chords16));
|
||||
n = f.numerator() * (32 / f.denominator());
|
||||
view32->setScore(createScore(n, TDuration::DurationType::V_32ND, &chords32));
|
||||
int nn = f.numerator() * (8 / f.denominator());
|
||||
view8->setScore(createScore(nn, TDuration::DurationType::V_EIGHTH, &chords8));
|
||||
nn = f.numerator() * (16 / f.denominator());
|
||||
view16->setScore(createScore(nn, TDuration::DurationType::V_16TH, &chords16));
|
||||
nn = f.numerator() * (32 / f.denominator());
|
||||
view32->setScore(createScore(nn, TDuration::DurationType::V_32ND, &chords32));
|
||||
view8->resetMatrix();
|
||||
view16->resetMatrix();
|
||||
view32->resetMatrix();
|
||||
|
@ -144,7 +150,7 @@ Groups NoteGroups::groups()
|
|||
|
||||
void NoteGroups::resetClicked()
|
||||
{
|
||||
setSig(_sig, _groups);
|
||||
setSig(_sig, _groups, _z, _n);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
|
|
@ -34,6 +34,7 @@ class NoteGroups : public QGroupBox, Ui::NoteGroups {
|
|||
std::vector<Chord*> chords32;
|
||||
Groups _groups;
|
||||
Fraction _sig;
|
||||
QString _z, _n;
|
||||
|
||||
Score* createScore(int n, TDuration::DurationType t, std::vector<Chord*>* chords);
|
||||
void updateBeams(Chord*, Beam::Mode);
|
||||
|
@ -45,7 +46,7 @@ class NoteGroups : public QGroupBox, Ui::NoteGroups {
|
|||
|
||||
public:
|
||||
NoteGroups(QWidget* parent);
|
||||
void setSig(Fraction sig, const Groups&);
|
||||
void setSig(Fraction sig, const Groups&, const QString& zText, const QString& nText);
|
||||
Groups groups();
|
||||
};
|
||||
|
||||
|
|
|
@ -53,6 +53,8 @@ TimeDialog::TimeDialog(QWidget* parent)
|
|||
connect(sp, SIGNAL(boxClicked(int)), SLOT(paletteChanged(int)));
|
||||
connect(sp, SIGNAL(changed()), SLOT(setDirty()));
|
||||
connect(addButton, SIGNAL(clicked()), SLOT(addClicked()));
|
||||
connect(zText, SIGNAL(textChanged(const QString&)), SLOT(textChanged()));
|
||||
connect(nText, SIGNAL(textChanged(const QString&)), SLOT(textChanged()));
|
||||
|
||||
_timePalette = new PaletteScrollArea(sp);
|
||||
QSizePolicy policy(QSizePolicy::Expanding, QSizePolicy::Expanding);
|
||||
|
@ -65,7 +67,7 @@ TimeDialog::TimeDialog(QWidget* parent)
|
|||
|
||||
if (useFactorySettings || !sp->read(dataPath + "/timesigs")) {
|
||||
Fraction sig(4,4);
|
||||
groups->setSig(sig, Groups::endings(sig));
|
||||
groups->setSig(sig, Groups::endings(sig), zText->text(), nText->text());
|
||||
}
|
||||
for (int i = 0; i < sp->size(); ++i) // cells can be changed
|
||||
sp->setCellReadOnly(i, false);
|
||||
|
@ -117,7 +119,7 @@ void TimeDialog::zChanged(int val)
|
|||
{
|
||||
zText->setText(QString("%1").arg(val));
|
||||
Fraction sig(zNominal->value(), denominator());
|
||||
groups->setSig(sig, Groups::endings(sig));
|
||||
groups->setSig(sig, Groups::endings(sig), zText->text(), nText->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -128,7 +130,7 @@ void TimeDialog::nChanged(int /*val*/)
|
|||
{
|
||||
nText->setText(QString("%1").arg(denominator()));
|
||||
Fraction sig(zNominal->value(), denominator());
|
||||
groups->setSig(sig, Groups::endings(sig));
|
||||
groups->setSig(sig, Groups::endings(sig), zText->text(), nText->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -200,8 +202,19 @@ void TimeDialog::paletteChanged(int idx)
|
|||
nNominal->setCurrentIndex(denominator2Idx(sig.denominator()));
|
||||
zText->setText(e->numeratorString());
|
||||
nText->setText(e->denominatorString());
|
||||
groups->setSig(sig, g);
|
||||
groups->setSig(sig, g, zText->text(), nText->text());
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// textChanged
|
||||
//---------------------------------------------------------
|
||||
|
||||
void TimeDialog::textChanged()
|
||||
{
|
||||
Fraction sig(zNominal->value(), denominator());
|
||||
groups->setSig(sig, Groups::endings(sig), zText->text(), nText->text());
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
|
|
@ -43,6 +43,7 @@ class TimeDialog : public QWidget, Ui::TimeDialogBase {
|
|||
void zChanged(int);
|
||||
void nChanged(int);
|
||||
void paletteChanged(int idx);
|
||||
void textChanged();
|
||||
void setDirty() { _dirty = true; }
|
||||
|
||||
public:
|
||||
|
|
|
@ -123,7 +123,7 @@ TimeSigProperties::TimeSigProperties(TimeSig* t, QWidget* parent)
|
|||
Groups g = t->groups();
|
||||
if (g.empty())
|
||||
g = Groups::endings(timesig->sig()); // initialize with default
|
||||
groups->setSig(timesig->sig(), g);
|
||||
groups->setSig(timesig->sig(), g, timesig->numeratorString(), timesig->denominatorString());
|
||||
|
||||
MuseScore::restoreGeometry(this);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue