fix #29241
This commit is contained in:
parent
3a4f0bc10c
commit
0c44719a58
29 changed files with 171 additions and 160 deletions
|
@ -121,16 +121,15 @@ Score* createExcerpt(const QList<Part*>& parts)
|
|||
foreach (Part* part, parts) {
|
||||
Part* p = new Part(score);
|
||||
p->setInstrument(*part->instr());
|
||||
int idx = 0;
|
||||
|
||||
foreach (Staff* staff, *part->staves()) {
|
||||
Staff* s = new Staff(score, p, idx);
|
||||
Staff* s = new Staff(score, p);
|
||||
s->setInitialClef(staff->initialClefTypeList());
|
||||
s->setStaffType(staff->staffType());
|
||||
s->linkTo(staff);
|
||||
p->staves()->append(s);
|
||||
score->staves().append(s);
|
||||
srcStaves.append(oscore->staffIdx(staff));
|
||||
++idx;
|
||||
}
|
||||
score->appendPart(p);
|
||||
}
|
||||
|
|
|
@ -70,7 +70,7 @@ class InputState {
|
|||
int drumNote() const { return _drumNote; }
|
||||
void setDrumNote(int v) { _drumNote = v; }
|
||||
|
||||
int voice() const { return _track % VOICES; }
|
||||
int voice() const { return _track == -1 ? 0 : (_track % VOICES); }
|
||||
int track() const { return _track; }
|
||||
void setTrack(int v) { _track = v; }
|
||||
|
||||
|
|
|
@ -154,7 +154,7 @@ void MCursor::move(int t, int tick)
|
|||
void MCursor::addPart(const QString& instrument)
|
||||
{
|
||||
Part* part = new Part(_score);
|
||||
Staff* staff = new Staff(_score, part, 0);
|
||||
Staff* staff = new Staff(_score, part);
|
||||
InstrumentTemplate* it = searchTemplate(instrument);
|
||||
if (it == 0) {
|
||||
qFatal("Did not find instrument <%s>", qPrintable(instrument));
|
||||
|
|
|
@ -579,67 +579,63 @@ void Measure::layout2()
|
|||
//
|
||||
bool smn = false;
|
||||
|
||||
// if (!_noText || _noText->generated()) {
|
||||
if (_noMode == MeasureNumberMode::SHOW)
|
||||
smn = true;
|
||||
else if (_noMode == MeasureNumberMode::HIDE)
|
||||
smn = false;
|
||||
else {
|
||||
if (score()->styleB(StyleIdx::showMeasureNumber)
|
||||
&& !_irregular
|
||||
&& (_no || score()->styleB(StyleIdx::showMeasureNumberOne))) {
|
||||
if (score()->styleB(StyleIdx::measureNumberSystem))
|
||||
smn = system()->firstMeasure() == this;
|
||||
else {
|
||||
smn = (_no == 0 && score()->styleB(StyleIdx::showMeasureNumberOne)) ||
|
||||
( ((_no+1) % score()->style(StyleIdx::measureNumberInterval).toInt()) == 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
QString s;
|
||||
if (smn)
|
||||
s = QString("%1").arg(_no + 1);
|
||||
int nn = 1;
|
||||
if (!score()->styleB(StyleIdx::measureNumberAllStaffs)) {
|
||||
//find first non invisible staff
|
||||
for (int staffIdx = 0; staffIdx < staves.size(); ++staffIdx) {
|
||||
MStaff* ms = staves.at(staffIdx);
|
||||
SysStaff* s = system()->staff(staffIdx);
|
||||
Staff* staff = score()->staff(staffIdx);
|
||||
if (ms->visible() && staff->show() && s->show()) {
|
||||
nn = staffIdx;
|
||||
break;
|
||||
}
|
||||
if (_noMode == MeasureNumberMode::SHOW)
|
||||
smn = true;
|
||||
else if (_noMode == MeasureNumberMode::HIDE)
|
||||
smn = false;
|
||||
else {
|
||||
if (score()->styleB(StyleIdx::showMeasureNumber)
|
||||
&& !_irregular
|
||||
&& (_no || score()->styleB(StyleIdx::showMeasureNumberOne))) {
|
||||
if (score()->styleB(StyleIdx::measureNumberSystem))
|
||||
smn = system()->firstMeasure() == this;
|
||||
else {
|
||||
smn = (_no == 0 && score()->styleB(StyleIdx::showMeasureNumberOne)) ||
|
||||
( ((_no+1) % score()->style(StyleIdx::measureNumberInterval).toInt()) == 0 );
|
||||
}
|
||||
}
|
||||
}
|
||||
QString s;
|
||||
if (smn)
|
||||
s = QString("%1").arg(_no + 1);
|
||||
int nn = 1;
|
||||
bool nas = score()->styleB(StyleIdx::measureNumberAllStaffs);
|
||||
|
||||
if (!nas) {
|
||||
//find first non invisible staff
|
||||
for (int staffIdx = 0; staffIdx < staves.size(); ++staffIdx) {
|
||||
MStaff* ms = staves.at(staffIdx);
|
||||
Text* t = ms->noText();
|
||||
if (smn) {
|
||||
if ((staffIdx == nn || score()->styleB(StyleIdx::measureNumberAllStaffs))) {
|
||||
if (t == 0) {
|
||||
t = new Text(score());
|
||||
t->setFlag(ElementFlag::ON_STAFF, true);
|
||||
// t->setFlag(ElementFlag::MOVABLE, false); ??
|
||||
t->setTrack(staffIdx * VOICES);
|
||||
t->setGenerated(true);
|
||||
t->setTextStyleType(TextStyleType::MEASURE_NUMBER);
|
||||
t->setParent(this);
|
||||
score()->undoAddElement(t);
|
||||
}
|
||||
if(t) {
|
||||
t->setText(s);
|
||||
t->layout();
|
||||
smn = score()->styleB(StyleIdx::measureNumberAllStaffs);
|
||||
}
|
||||
}
|
||||
}
|
||||
else {
|
||||
if (t)
|
||||
score()->undoRemoveElement(t);
|
||||
SysStaff* s = system()->staff(staffIdx);
|
||||
Staff* staff = score()->staff(staffIdx);
|
||||
if (ms->visible() && staff->show() && s->show()) {
|
||||
nn = staffIdx;
|
||||
break;
|
||||
}
|
||||
}
|
||||
// }
|
||||
}
|
||||
for (int staffIdx = 0; staffIdx < staves.size(); ++staffIdx) {
|
||||
MStaff* ms = staves.at(staffIdx);
|
||||
Text* t = ms->noText();
|
||||
if (t)
|
||||
t->setTrack(staffIdx * VOICES);
|
||||
if (smn && ((staffIdx == nn) || nas)) {
|
||||
if (t == 0) {
|
||||
t = new Text(score());
|
||||
t->setFlag(ElementFlag::ON_STAFF, true);
|
||||
t->setTrack(staffIdx * VOICES);
|
||||
t->setGenerated(true);
|
||||
t->setTextStyleType(TextStyleType::MEASURE_NUMBER);
|
||||
t->setParent(this);
|
||||
score()->undoAddElement(t);
|
||||
}
|
||||
t->setText(s);
|
||||
t->layout();
|
||||
}
|
||||
else {
|
||||
if (t)
|
||||
score()->undoRemoveElement(t);
|
||||
}
|
||||
}
|
||||
|
||||
//
|
||||
// slur layout needs articulation layout first
|
||||
|
|
|
@ -63,15 +63,13 @@ Staff* Part::staff(int idx) const
|
|||
|
||||
void Part::read(XmlReader& e)
|
||||
{
|
||||
int rstaff = 0;
|
||||
while (e.readNextStartElement()) {
|
||||
const QStringRef& tag(e.name());
|
||||
if (tag == "Staff") {
|
||||
Staff* staff = new Staff(_score, this, rstaff);
|
||||
Staff* staff = new Staff(_score, this);
|
||||
_score->staves().push_back(staff);
|
||||
_staves.push_back(staff);
|
||||
staff->read(e);
|
||||
++rstaff;
|
||||
}
|
||||
else if (tag == "Instrument")
|
||||
instr(0)->read(e);
|
||||
|
@ -133,7 +131,7 @@ void Part::setStaves(int n)
|
|||
}
|
||||
int staffIdx = _score->staffIdx(this) + ns;
|
||||
for (int i = ns; i < n; ++i) {
|
||||
Staff* staff = new Staff(_score, this, i);
|
||||
Staff* staff = new Staff(_score, this);
|
||||
_staves.push_back(staff);
|
||||
_score->staves().insert(staffIdx, staff);
|
||||
for (Measure* m = _score->firstMeasure(); m; m = m->nextMeasure()) {
|
||||
|
@ -149,16 +147,12 @@ void Part::setStaves(int n)
|
|||
// insertStaff
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Part::insertStaff(Staff* staff)
|
||||
void Part::insertStaff(Staff* staff, int idx)
|
||||
{
|
||||
int idx = staff->rstaff();
|
||||
if (idx > _staves.size())
|
||||
if (idx < 0 || idx > _staves.size())
|
||||
idx = _staves.size();
|
||||
_staves.insert(idx, staff);
|
||||
staff->setPart(this);
|
||||
idx = 0;
|
||||
foreach(Staff* staff, _staves)
|
||||
staff->setRstaff(idx++);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -171,9 +165,6 @@ void Part::removeStaff(Staff* staff)
|
|||
qDebug("Part::removeStaff: not found %p", staff);
|
||||
return;
|
||||
}
|
||||
int idx = 0;
|
||||
foreach(Staff* staff, _staves)
|
||||
staff->setRstaff(idx++);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
|
@ -204,7 +195,7 @@ bool Part::mute() const
|
|||
{
|
||||
return instr(0)->channel(0).mute;
|
||||
}
|
||||
|
||||
|
||||
void Part::setMute(bool mute)
|
||||
{
|
||||
instr(0)->channel(0).mute = mute;
|
||||
|
|
|
@ -60,6 +60,7 @@ class Part : public QObject {
|
|||
void read(XmlReader&);
|
||||
void read114(XmlReader&);
|
||||
void write(Xml& xml) const;
|
||||
|
||||
int nstaves() const { return _staves.size(); }
|
||||
QList<Staff*>* staves() { return &_staves; }
|
||||
const QList<Staff*>* staves() const { return &_staves; }
|
||||
|
@ -89,7 +90,7 @@ class Part : public QObject {
|
|||
void setVolume(int volume);
|
||||
bool mute() const;
|
||||
void setMute(bool mute);
|
||||
|
||||
|
||||
int reverb() const;
|
||||
int chorus() const;
|
||||
int pan() const;
|
||||
|
@ -100,7 +101,7 @@ class Part : public QObject {
|
|||
int midiChannel() const;
|
||||
void setMidiChannel(int) const;
|
||||
|
||||
void insertStaff(Staff*);
|
||||
void insertStaff(Staff*, int idx);
|
||||
void removeStaff(Staff*);
|
||||
bool show() const { return _show; }
|
||||
void setShow(bool val) { _show = val; }
|
||||
|
|
|
@ -214,15 +214,13 @@ void Staff::read114(XmlReader& e)
|
|||
|
||||
void Part::read114(XmlReader& e)
|
||||
{
|
||||
int rstaff = 0;
|
||||
while (e.readNextStartElement()) {
|
||||
const QStringRef& tag(e.name());
|
||||
if (tag == "Staff") {
|
||||
Staff* staff = new Staff(_score, this, rstaff);
|
||||
Staff* staff = new Staff(_score, this);
|
||||
_score->staves().push_back(staff);
|
||||
_staves.push_back(staff);
|
||||
staff->read114(e);
|
||||
++rstaff;
|
||||
}
|
||||
else if (tag == "Instrument") {
|
||||
Instrument* instrument = instr(0);
|
||||
|
|
|
@ -2155,10 +2155,7 @@ void Score::splitStaff(int staffIdx, int splitPoint)
|
|||
//
|
||||
Staff* s = staff(staffIdx);
|
||||
Part* p = s->part();
|
||||
int rstaff = s->rstaff();
|
||||
Staff* ns = new Staff(this, p, rstaff + 1);
|
||||
ns->setRstaff(rstaff + 1);
|
||||
|
||||
Staff* ns = new Staff(this, p);
|
||||
undoInsertStaff(ns, staffIdx+1);
|
||||
|
||||
for (Measure* m = firstMeasure(); m; m = m->nextMeasure()) {
|
||||
|
@ -2353,10 +2350,17 @@ void Score::removePart(Part* part)
|
|||
// insertStaff
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::insertStaff(Staff* staff, int idx)
|
||||
void Score::insertStaff(Staff* staff, int ridx)
|
||||
{
|
||||
int idx = 0; // new index in _staves
|
||||
for (Part* p : _parts) {
|
||||
if (p == staff->part())
|
||||
break;
|
||||
idx += p->nstaves();
|
||||
}
|
||||
idx += ridx;
|
||||
_staves.insert(idx, staff);
|
||||
staff->part()->insertStaff(staff);
|
||||
staff->part()->insertStaff(staff, ridx);
|
||||
for (auto i = staff->score()->spanner().cbegin(); i != staff->score()->spanner().cend(); ++i) {
|
||||
Spanner* s = i->second;
|
||||
if (s->staffIdx() >= idx) {
|
||||
|
@ -2464,7 +2468,7 @@ void Score::cmdRemoveStaff(int staffIdx)
|
|||
undo(new RemoveElement(i));
|
||||
}
|
||||
|
||||
undoRemoveStaff(s, staffIdx);
|
||||
undoRemoveStaff(s);
|
||||
|
||||
// remove linked staff and measures in linked staves in excerps
|
||||
// should be done earlier for the main staff
|
||||
|
@ -2483,7 +2487,7 @@ void Score::cmdRemoveStaff(int staffIdx)
|
|||
if (m->hasMMRest())
|
||||
m->mmRest()->cmdRemoveStaves(lstaffIdx, lstaffIdx + 1);
|
||||
}
|
||||
undoRemoveStaff(staff, lstaffIdx);
|
||||
undoRemoveStaff(staff);
|
||||
if (staff->part()->nstaves() == 0)
|
||||
undoRemovePart(staff->part(), pIndex);
|
||||
}
|
||||
|
@ -2852,7 +2856,7 @@ void Score::selectRange(Element* e, int staffIdx)
|
|||
_selection.setEndSegment(cr->nextSegmentAfterCR(Segment::Type::ChordRest
|
||||
| Segment::Type::EndBarLine
|
||||
| Segment::Type::Clef));
|
||||
|
||||
|
||||
}
|
||||
else {
|
||||
_selection.setStartSegment(cr->segment());
|
||||
|
@ -3343,7 +3347,7 @@ void Score::appendPart(const QString& name)
|
|||
part->initFromInstrTemplate(t);
|
||||
int n = nstaves();
|
||||
for (int i = 0; i < t->nstaves(); ++i) {
|
||||
Staff* staff = new Staff(this, part, i);
|
||||
Staff* staff = new Staff(this, part);
|
||||
staff->setLines(t->staffLines[i]);
|
||||
staff->setSmall(t->smallStaff[i]);
|
||||
if (i == 0) {
|
||||
|
|
|
@ -520,7 +520,7 @@ class Score : public QObject {
|
|||
void undoExchangeVoice(Measure* measure, int val1, int val2, int staff1, int staff2);
|
||||
void undoRemovePart(Part* part, int idx);
|
||||
void undoInsertPart(Part* part, int idx);
|
||||
void undoRemoveStaff(Staff* staff, int idx);
|
||||
void undoRemoveStaff(Staff* staff);
|
||||
void undoInsertStaff(Staff* staff, int idx);
|
||||
void undoChangeInvisible(Element*, bool);
|
||||
void undoChangeBracketSpan(Staff* staff, int column, int span);
|
||||
|
|
|
@ -160,15 +160,13 @@ QString Staff::partName() const
|
|||
Staff::Staff(Score* s)
|
||||
{
|
||||
_score = s;
|
||||
_rstaff = 0;
|
||||
_part = 0;
|
||||
_barLineTo = (lines()-1)*2;
|
||||
}
|
||||
|
||||
Staff::Staff(Score* s, Part* p, int rs)
|
||||
Staff::Staff(Score* s, Part* p)
|
||||
{
|
||||
_score = s;
|
||||
_rstaff = rs;
|
||||
_part = p;
|
||||
_barLineTo = (lines()-1)*2;
|
||||
}
|
||||
|
@ -671,6 +669,8 @@ void Staff::linkTo(Staff* staff)
|
|||
|
||||
void Staff::unlink(Staff* staff)
|
||||
{
|
||||
if (!_linkedStaves)
|
||||
return;
|
||||
Q_ASSERT(_linkedStaves->staves().contains(staff));
|
||||
_linkedStaves->remove(staff);
|
||||
if (_linkedStaves->staves().size() <= 1) {
|
||||
|
@ -942,5 +942,22 @@ void Staff::setBarLineTo(int val)
|
|||
_barLineTo = val;
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// rstaff
|
||||
//---------------------------------------------------------
|
||||
|
||||
int Staff::rstaff() const
|
||||
{
|
||||
return _part->staves()->indexOf((Staff*)this, 0);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// isTop
|
||||
//---------------------------------------------------------
|
||||
|
||||
bool Staff::isTop() const
|
||||
{
|
||||
return _part->staves()->front() == this;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -89,7 +89,6 @@ class Staff : public QObject {
|
|||
|
||||
Score* _score;
|
||||
Part* _part;
|
||||
int _rstaff; ///< Index in Part.
|
||||
|
||||
ClefList clefs;
|
||||
KeyList _keys;
|
||||
|
@ -117,16 +116,15 @@ class Staff : public QObject {
|
|||
|
||||
public:
|
||||
Staff(Score* = 0);
|
||||
Staff(Score*, Part*, int);
|
||||
Staff(Score*, Part*);
|
||||
~Staff();
|
||||
void init(const InstrumentTemplate*, const StaffType *staffType, int);
|
||||
void initFromStaffType(const StaffType* staffType);
|
||||
|
||||
bool isTop() const { return _rstaff == 0; }
|
||||
bool isTop() const;
|
||||
QString partName() const;
|
||||
int rstaff() const { return _rstaff; }
|
||||
int rstaff() const;
|
||||
int idx() const;
|
||||
void setRstaff(int n) { _rstaff = n; }
|
||||
void read(XmlReader&);
|
||||
void read114(XmlReader&);
|
||||
void write(Xml& xml) const;
|
||||
|
|
|
@ -510,18 +510,17 @@ void System::setInstrumentNames(bool longName)
|
|||
for (int staffIdx = 0; staffIdx < score()->nstaves(); ++staffIdx) {
|
||||
SysStaff* staff = _staves[staffIdx];
|
||||
foreach(InstrumentName* t, staff->instrumentNames)
|
||||
//score()->undoRemoveElement(t);
|
||||
score()->removeElement(t);
|
||||
}
|
||||
return;
|
||||
}
|
||||
|
||||
int tick = ml.isEmpty() ? 0 : ml.front()->tick();
|
||||
for (int staffIdx = 0; staffIdx < score()->nstaves(); ++staffIdx) {
|
||||
SysStaff* staff = _staves[staffIdx];
|
||||
Staff* s = score()->staff(staffIdx);
|
||||
if (!s->isTop()) {
|
||||
foreach(InstrumentName* t, staff->instrumentNames)
|
||||
//score()->undoRemoveElement(t);
|
||||
score()->removeElement(t);
|
||||
continue;
|
||||
}
|
||||
|
@ -539,7 +538,6 @@ void System::setInstrumentNames(bool longName)
|
|||
iname->setParent(this);
|
||||
iname->setTrack(staffIdx * VOICES);
|
||||
iname->setInstrumentNameType(longName ? InstrumentNameType::LONG : InstrumentNameType::SHORT);
|
||||
// score()->undoAddElement(iname);
|
||||
score()->addElement(iname);
|
||||
}
|
||||
iname->setText(sn.name);
|
||||
|
@ -547,7 +545,6 @@ void System::setInstrumentNames(bool longName)
|
|||
++idx;
|
||||
}
|
||||
for (; idx < staff->instrumentNames.size(); ++idx)
|
||||
// score()->undoRemoveElement(staff->instrumentNames[idx]);
|
||||
score()->removeElement(staff->instrumentNames[idx]);
|
||||
}
|
||||
}
|
||||
|
|
|
@ -696,15 +696,17 @@ void Score::undoInsertPart(Part* part, int idx)
|
|||
|
||||
//---------------------------------------------------------
|
||||
// undoRemoveStaff
|
||||
// idx - index of staff in part
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::undoRemoveStaff(Staff* staff, int idx)
|
||||
void Score::undoRemoveStaff(Staff* staff)
|
||||
{
|
||||
undo(new RemoveStaff(staff, idx));
|
||||
undo(new RemoveStaff(staff));
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// undoInsertStaff
|
||||
// idx - index of staff in part
|
||||
//---------------------------------------------------------
|
||||
|
||||
void Score::undoInsertStaff(Staff* staff, int idx)
|
||||
|
@ -1592,7 +1594,7 @@ void RemovePart::redo()
|
|||
InsertStaff::InsertStaff(Staff* p, int i)
|
||||
{
|
||||
staff = p;
|
||||
idx = i;
|
||||
ridx = i;
|
||||
}
|
||||
|
||||
void InsertStaff::undo()
|
||||
|
@ -1602,22 +1604,22 @@ void InsertStaff::undo()
|
|||
|
||||
void InsertStaff::redo()
|
||||
{
|
||||
staff->score()->insertStaff(staff, idx);
|
||||
staff->score()->insertStaff(staff, ridx);
|
||||
}
|
||||
|
||||
//---------------------------------------------------------
|
||||
// RemoveStaff
|
||||
//---------------------------------------------------------
|
||||
|
||||
RemoveStaff::RemoveStaff(Staff* p, int i)
|
||||
RemoveStaff::RemoveStaff(Staff* p)
|
||||
{
|
||||
staff = p;
|
||||
idx = i;
|
||||
ridx = staff->rstaff();
|
||||
}
|
||||
|
||||
void RemoveStaff::undo()
|
||||
{
|
||||
staff->score()->insertStaff(staff, idx);
|
||||
staff->score()->insertStaff(staff, ridx);
|
||||
}
|
||||
|
||||
void RemoveStaff::redo()
|
||||
|
@ -3303,8 +3305,7 @@ void MoveStaff::flip()
|
|||
Part* oldPart = staff->part();
|
||||
int idx = staff->rstaff();
|
||||
oldPart->removeStaff(staff);
|
||||
staff->setRstaff(rstaff);
|
||||
part->insertStaff(staff);
|
||||
part->insertStaff(staff, rstaff);
|
||||
part = oldPart;
|
||||
rstaff = idx;
|
||||
staff->score()->setLayoutAll(true);
|
||||
|
|
|
@ -195,7 +195,7 @@ class RemovePart : public UndoCommand {
|
|||
|
||||
class InsertStaff : public UndoCommand {
|
||||
Staff* staff;
|
||||
int idx;
|
||||
int ridx;
|
||||
|
||||
public:
|
||||
InsertStaff(Staff*, int idx);
|
||||
|
@ -210,10 +210,10 @@ class InsertStaff : public UndoCommand {
|
|||
|
||||
class RemoveStaff : public UndoCommand {
|
||||
Staff* staff;
|
||||
int idx;
|
||||
int ridx;
|
||||
|
||||
public:
|
||||
RemoveStaff(Staff*, int idx);
|
||||
RemoveStaff(Staff*);
|
||||
virtual void undo();
|
||||
virtual void redo();
|
||||
UNDO_NAME("RemoveStaff")
|
||||
|
|
|
@ -393,8 +393,8 @@ Score::FileError importBB(Score* score, const QString& name)
|
|||
ntracks = 1;
|
||||
for (int i = 0; i < ntracks; ++i) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, 0);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().append(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
|
|
@ -855,7 +855,7 @@ void convertCapella(Score* score, Capella* cap, bool capxMode)
|
|||
}
|
||||
midiPatch = cl->sound;
|
||||
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
Staff* s = new Staff(score, part);
|
||||
if (cl->bPercussion)
|
||||
part->setMidiProgram(0, 128);
|
||||
else
|
||||
|
@ -877,7 +877,7 @@ void convertCapella(Score* score, Capella* cap, bool capxMode)
|
|||
bstaff = 0;
|
||||
}
|
||||
s->setSmall(cl->bSmall);
|
||||
part->insertStaff(s);
|
||||
part->insertStaff(s, -1);
|
||||
score->staves().push_back(s);
|
||||
// _parts.push_back(part);
|
||||
}
|
||||
|
|
|
@ -622,6 +622,7 @@ void Debugger::updateElement(Element* el)
|
|||
case Element::Type::TBOX: ew = new BoxView; break;
|
||||
case Element::Type::TRILL: ew = new SpannerView; break;
|
||||
|
||||
case Element::Type::INSTRUMENT_NAME:
|
||||
case Element::Type::FINGERING:
|
||||
case Element::Type::MARKER:
|
||||
case Element::Type::JUMP:
|
||||
|
|
|
@ -512,7 +512,7 @@ void MuseScore::newFile()
|
|||
s = ns;
|
||||
}
|
||||
}
|
||||
foreach(Excerpt* excerpt, score->excerpts()) {
|
||||
foreach (Excerpt* excerpt, score->excerpts()) {
|
||||
Score* exScore = excerpt->score();
|
||||
if (exScore->firstMeasure()) {
|
||||
for (Segment* s = exScore->firstMeasure()->first(); s;) {
|
||||
|
@ -525,7 +525,7 @@ void MuseScore::newFile()
|
|||
}
|
||||
}
|
||||
s->measure()->remove(s);
|
||||
if(s->measure()->segments()->size() == 0){
|
||||
if (s->measure()->segments()->size() == 0){
|
||||
exScore->measures()->remove(s->measure(), s->measure());
|
||||
delete s->measure();
|
||||
}
|
||||
|
|
|
@ -552,7 +552,7 @@ Score::FileError importBww(Score* score, const QString& path)
|
|||
Part* part = new Part(score);
|
||||
part->setId(id);
|
||||
score->appendPart(part);
|
||||
Staff* staff = new Staff(score, part, 0);
|
||||
Staff* staff = new Staff(score, part);
|
||||
part->staves()->push_back(staff);
|
||||
score->staves().push_back(staff);
|
||||
|
||||
|
|
|
@ -517,8 +517,8 @@ void GuitarPro4::read(QFile* fp)
|
|||
//
|
||||
for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
|
|
@ -547,8 +547,8 @@ void GuitarPro5::read(QFile* fp)
|
|||
//
|
||||
for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, -1);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
|
|
@ -372,7 +372,7 @@ void GuitarPro6::readTracks(QDomNode* track)
|
|||
while (!nextTrack.isNull()) {
|
||||
QDomNode currentNode = nextTrack.firstChild();
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, trackCounter);
|
||||
Staff* s = new Staff(score, part);
|
||||
while (!currentNode.isNull()) {
|
||||
QString nodeName = currentNode.nodeName();
|
||||
if (nodeName == "Name")
|
||||
|
@ -467,7 +467,7 @@ void GuitarPro6::readTracks(QDomNode* track)
|
|||
}
|
||||
|
||||
// add in a new part
|
||||
part->insertStaff(s);
|
||||
part->insertStaff(s, -1);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
trackCounter++;
|
||||
|
|
|
@ -637,8 +637,8 @@ void GuitarPro1::read(QFile* fp)
|
|||
//
|
||||
for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
@ -981,8 +981,8 @@ qDebug("BeginRepeat=============================================");
|
|||
//
|
||||
for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
@ -1535,8 +1535,8 @@ void GuitarPro3::read(QFile* fp)
|
|||
//
|
||||
for (int staffIdx = 0; staffIdx < staves; ++staffIdx) {
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, staffIdx);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().push_back(s);
|
||||
score->appendPart(part);
|
||||
}
|
||||
|
@ -2007,7 +2007,7 @@ Score::FileError importGTP(Score* score, const QString& name)
|
|||
|
||||
Staff* staff = part->staves()->front();
|
||||
|
||||
Staff* s = new Staff(pscore, p, 0);
|
||||
Staff* s = new Staff(pscore, p);
|
||||
StaffType* st = staff->staffType();
|
||||
s->setStaffType(st);
|
||||
// int idx = pscore->staffTypeIdx(st);
|
||||
|
|
|
@ -716,8 +716,8 @@ void createInstruments(Score *score, QList<MTrack> &tracks)
|
|||
for (int idx = 0; idx < ntracks; ++idx) {
|
||||
MTrack& track = tracks[idx];
|
||||
Part* part = new Part(score);
|
||||
Staff* s = new Staff(score, part, 0);
|
||||
part->insertStaff(s);
|
||||
Staff* s = new Staff(score, part);
|
||||
part->insertStaff(s, 0);
|
||||
score->staves().push_back(s);
|
||||
track.staff = s;
|
||||
|
||||
|
@ -735,8 +735,8 @@ void createInstruments(Score *score, QList<MTrack> &tracks)
|
|||
s->setBracket(0, BracketType::BRACE);
|
||||
s->setBracketSpan(0, 2);
|
||||
|
||||
Staff* ss = new Staff(score, part, 1);
|
||||
part->insertStaff(ss);
|
||||
Staff* ss = new Staff(score, part);
|
||||
part->insertStaff(ss, 1);
|
||||
score->staves().push_back(ss);
|
||||
++idx;
|
||||
ss->setInitialClef(ClefType::F); // can be reset later
|
||||
|
|
|
@ -283,7 +283,7 @@ void OveToMScore::createStructure() {
|
|||
|
||||
for(int j=0; j<partStaffCount; ++j){
|
||||
//OVE::Track* track = ove_->getTrack(i, j);
|
||||
Staff* staff = new Staff(score_, part, j);
|
||||
Staff* staff = new Staff(score_, part);
|
||||
|
||||
part->staves()->push_back(staff);
|
||||
score_->staves().push_back(staff);
|
||||
|
|
|
@ -1084,7 +1084,7 @@ void MusicXml::scorePartwise(QDomElement ee)
|
|||
Part* part = new Part(score);
|
||||
part->setId(id);
|
||||
score->appendPart(part);
|
||||
Staff* staff = new Staff(score, part, 0);
|
||||
Staff* staff = new Staff(score, part);
|
||||
part->staves()->push_back(staff);
|
||||
score->staves().push_back(staff);
|
||||
tuplets.resize(VOICES); // part now contains one staff, thus VOICES voices
|
||||
|
|
|
@ -1124,9 +1124,8 @@ void MuseScore::editInstrList()
|
|||
QList<Staff*> nonLinked;
|
||||
for (int cidx = 0; (ci = pli->child(cidx)); ++cidx) {
|
||||
StaffListItem* sli = static_cast<StaffListItem*>(ci);
|
||||
Staff* staff = new Staff(rootScore, part, rstaff);
|
||||
Staff* staff = new Staff(rootScore, part);
|
||||
sli->staff = staff;
|
||||
staff->setRstaff(rstaff);
|
||||
|
||||
staff->init(t, sli->staffType(), cidx);
|
||||
staff->setInitialClef(sli->clef());
|
||||
|
@ -1175,11 +1174,10 @@ void MuseScore::editInstrList()
|
|||
rootScore->cmdRemoveStaff(sidx);
|
||||
}
|
||||
else if (sli->op == ListItemOp::ADD) {
|
||||
Staff* staff = new Staff(rootScore, part, rstaff);
|
||||
Staff* staff = new Staff(rootScore, part);
|
||||
sli->staff = staff;
|
||||
staff->setRstaff(rstaff);
|
||||
|
||||
rootScore->undoInsertStaff(staff, staffIdx);
|
||||
rootScore->undoInsertStaff(staff, rstaff);
|
||||
|
||||
for (Measure* m = rootScore->firstMeasure(); m; m = m->nextMeasure()) {
|
||||
// do not create whole measure rests for linked staves
|
||||
|
@ -1194,13 +1192,25 @@ void MuseScore::editInstrList()
|
|||
Key nKey = part->staff(0)->key(0);
|
||||
staff->setKey(0, nKey);
|
||||
|
||||
if (sli->linked() && rstaff > 0) {
|
||||
// link to top staff of same part
|
||||
Staff* linkedStaff = part->staves()->front();
|
||||
cloneStaff(linkedStaff, staff);
|
||||
Staff* linkedStaff = 0;
|
||||
if (sli->linked()) {
|
||||
if (rstaff > 0)
|
||||
linkedStaff = part->staves()->front();
|
||||
else {
|
||||
for (Staff* st : *part->staves()) {
|
||||
if (st != staff) {
|
||||
linkedStaff = st;
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
if (linkedStaff)
|
||||
cloneStaff(linkedStaff, staff);
|
||||
else {
|
||||
if (firstStaff)
|
||||
rootScore->adjustKeySigs(staffIdx, staffIdx+1, tmpKeymap);
|
||||
}
|
||||
if(firstStaff && !sli->linked())
|
||||
rootScore->adjustKeySigs(staffIdx, staffIdx+1, tmpKeymap);
|
||||
++staffIdx;
|
||||
++rstaff;
|
||||
}
|
||||
|
@ -1292,7 +1302,6 @@ void MuseScore::editInstrList()
|
|||
rootScore->cmdUpdateNotes(); // do it before global layout or layout of chords will not
|
||||
rootScore->endCmd(); // find notes in right positions for stems, ledger lines, etc
|
||||
rootScore->rebuildMidiMapping();
|
||||
// rootScore->updateNotes();
|
||||
seq->initInstruments();
|
||||
}
|
||||
|
||||
|
|
|
@ -682,8 +682,8 @@ bool MuseData::read(const QString& name)
|
|||
Part* mpart = new Part(score);
|
||||
int staves = countStaves(part);
|
||||
for (int i = 0; i < staves; ++i) {
|
||||
Staff* staff = new Staff(score, mpart, i);
|
||||
mpart->insertStaff(staff);
|
||||
Staff* staff = new Staff(score, mpart);
|
||||
mpart->insertStaff(staff, i);
|
||||
score->staves().push_back(staff);
|
||||
if ((staves == 2) && (i == 0)) {
|
||||
staff->setBracket(0, BracketType::BRACE);
|
||||
|
|
|
@ -448,12 +448,11 @@ void InstrumentWizard::createInstruments(Score* cs)
|
|||
QTreeWidgetItem* ci = 0;
|
||||
int rstaff = 0;
|
||||
for (int cidx = 0; (ci = pli->child(cidx)); ++cidx) {
|
||||
if(ci->isHidden())
|
||||
if (ci->isHidden())
|
||||
continue;
|
||||
StaffListItem* sli = (StaffListItem*)ci;
|
||||
Staff* staff = new Staff(cs, part, rstaff);
|
||||
Staff* staff = new Staff(cs, part);
|
||||
sli->staff = staff;
|
||||
staff->setRstaff(rstaff);
|
||||
++rstaff;
|
||||
|
||||
staff->init(t, sli->staffType(), cidx);
|
||||
|
@ -467,9 +466,9 @@ void InstrumentWizard::createInstruments(Score* cs)
|
|||
cs->staves().insert(staffIdx + rstaff, staff);
|
||||
}
|
||||
// if a staff was removed from instrument:
|
||||
if (part->staves()->at(0)->barLineSpan() > rstaff) {
|
||||
part->staves()->at(0)->setBarLineSpan(rstaff);
|
||||
part->staves()->at(0)->setBracket(0, BracketType::NO_BRACKET);
|
||||
if (part->staff(0)->barLineSpan() > rstaff) {
|
||||
part->staff(0)->setBarLineSpan(rstaff);
|
||||
part->staff(0)->setBracket(0, BracketType::NO_BRACKET);
|
||||
}
|
||||
|
||||
// insert part
|
||||
|
|
Loading…
Reference in a new issue