Skip to content

Commit 7c55023

Browse files
Merge pull request #27094 from RomanPudashkin/450_port_fixes
Porting some PRs to 4.5.0
2 parents 396375c + c79dea1 commit 7c55023

File tree

8 files changed

+60
-49
lines changed

8 files changed

+60
-49
lines changed

src/engraving/dom/edit.cpp

+15-9
Original file line numberDiff line numberDiff line change
@@ -4598,15 +4598,21 @@ void Score::cmdTimeDelete()
45984598
}
45994599

46004600
if (!isMaster() && masterScore()) {
4601-
Measure* masterStartMeas = masterScore()->tick2measure(startSegment->tick());
4602-
Measure* masterEndMeas = masterScore()->tick2measure(endSegment->tick());
4603-
if (endSegment->isEndBarLineType()) {
4604-
Measure* prevEndMeasure = masterEndMeas->prevMeasure();
4605-
masterEndMeas = prevEndMeasure ? prevEndMeasure : masterEndMeas;
4606-
}
4607-
Segment* masterStartSeg
4608-
= masterStartMeas ? masterStartMeas->findSegment(startSegment->segmentType(), startSegment->tick()) : startSegment;
4609-
Segment* masterEndSeg = masterEndMeas ? masterEndMeas->findSegment(endSegment->segmentType(), endSegment->tick()) : endSegment;
4601+
Fraction startTick = startSegment->tick();
4602+
Measure* masterStartMeas = masterScore()->tick2measure(startTick);
4603+
Segment* masterStartSeg = masterStartMeas->findSegment(startSegment->segmentType(), startSegment->tick());
4604+
Segment* masterEndSeg = nullptr;
4605+
4606+
if (endSegment) {
4607+
Fraction endTick = endSegment->tick();
4608+
Measure* masterEndMeas = masterScore()->tick2measure(endTick);
4609+
if (endSegment->isEndBarLineType()) {
4610+
Measure* prevMasterEndMeasure = masterEndMeas->prevMeasure();
4611+
masterEndMeas = prevMasterEndMeasure ? prevMasterEndMeasure : masterEndMeas;
4612+
}
4613+
masterEndSeg = masterEndMeas->findSegment(endSegment->segmentType(), endSegment->tick());
4614+
}
4615+
46104616
masterScore()->doTimeDelete(masterStartSeg, masterEndSeg);
46114617
} else {
46124618
doTimeDelete(startSegment, endSegment);

src/engraving/dom/segment.cpp

+19
Original file line numberDiff line numberDiff line change
@@ -1095,6 +1095,25 @@ void Segment::setXPosInSystemCoords(double x)
10951095
mutldata()->setPosX(x - measure()->x());
10961096
}
10971097

1098+
bool Segment::isInsideTuplet() const
1099+
{
1100+
if (!isChordRestType()) {
1101+
return false;
1102+
}
1103+
1104+
for (EngravingItem* item : m_elist) {
1105+
if (!item) {
1106+
continue;
1107+
}
1108+
ChordRest* chordRest = toChordRest(item);
1109+
if (chordRest->tuplet() && chordRest->tick() != chordRest->topTuplet()->tick()) {
1110+
return true;
1111+
}
1112+
}
1113+
1114+
return false;
1115+
}
1116+
10981117
//---------------------------------------------------------
10991118
// swapElements
11001119
//---------------------------------------------------------

src/engraving/dom/segment.h

+2
Original file line numberDiff line numberDiff line change
@@ -320,6 +320,8 @@ class Segment final : public EngravingItem
320320
double xPosInSystemCoords() const;
321321
void setXPosInSystemCoords(double x);
322322

323+
bool isInsideTuplet() const;
324+
323325
private:
324326

325327
friend class Factory;

src/framework/vst/internal/synth/vstsequencer.cpp

+4-4
Original file line numberDiff line numberDiff line change
@@ -106,8 +106,8 @@ void VstSequencer::updatePlaybackEvents(EventSequenceMap& destination, const mpe
106106
{
107107
SostenutoTimeAndDurations sostenutoTimeAndDurations;
108108

109-
for (const auto& pair : events) {
110-
for (const mpe::PlaybackEvent& event : pair.second) {
109+
for (const auto& evPair : events) {
110+
for (const mpe::PlaybackEvent& event : evPair.second) {
111111
if (!std::holds_alternative<mpe::NoteEvent>(event)) {
112112
continue;
113113
}
@@ -124,8 +124,8 @@ void VstSequencer::updatePlaybackEvents(EventSequenceMap& destination, const mpe
124124
destination[timestampFrom].emplace(buildEvent(VstEvent::kNoteOnEvent, noteId, velocityFraction, tuning));
125125
destination[timestampTo].emplace(buildEvent(VstEvent::kNoteOffEvent, noteId, velocityFraction, tuning));
126126

127-
for (const auto& pair : noteEvent.expressionCtx().articulations) {
128-
const mpe::ArticulationMeta& meta = pair.second.meta;
127+
for (const auto& articPair : noteEvent.expressionCtx().articulations) {
128+
const mpe::ArticulationMeta& meta = articPair.second.meta;
129129

130130
if (muse::contains(BEND_SUPPORTED_TYPES, meta.type)) {
131131
appendPitchBend(destination, noteEvent, meta);

src/notation/internal/excerptnotation.cpp

-32
Original file line numberDiff line numberDiff line change
@@ -50,10 +50,6 @@ void ExcerptNotation::init()
5050

5151
setScore(m_excerpt->excerptScore());
5252

53-
if (isEmpty()) {
54-
fillWithDefaultInfo();
55-
}
56-
5753
m_inited = true;
5854
}
5955

@@ -82,34 +78,6 @@ bool ExcerptNotation::isEmpty() const
8278
return m_excerpt->parts().empty();
8379
}
8480

85-
void ExcerptNotation::fillWithDefaultInfo()
86-
{
87-
TRACEFUNC;
88-
89-
IF_ASSERT_FAILED(m_excerpt || m_excerpt->excerptScore()) {
90-
return;
91-
}
92-
93-
mu::engraving::Score* score = m_excerpt->excerptScore();
94-
mu::engraving::MeasureBase* topVerticalFrame = score->first();
95-
96-
if (topVerticalFrame && topVerticalFrame->isVBox()) {
97-
topVerticalFrame->undoUnlink();
98-
}
99-
100-
auto unlinkText = [&score](TextStyleType textType) {
101-
engraving::Text* textItem = score->getText(textType);
102-
if (textItem) {
103-
textItem->undoUnlink();
104-
}
105-
};
106-
107-
unlinkText(TextStyleType::TITLE);
108-
unlinkText(TextStyleType::SUBTITLE);
109-
unlinkText(TextStyleType::COMPOSER);
110-
unlinkText(TextStyleType::LYRICIST);
111-
}
112-
11381
mu::engraving::Excerpt* ExcerptNotation::excerpt() const
11482
{
11583
return m_excerpt;

src/notation/internal/excerptnotation.h

-1
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,6 @@ class ExcerptNotation : public IExcerptNotation, public Notation, public std::en
5555
IExcerptNotationPtr clone() const override;
5656

5757
private:
58-
void fillWithDefaultInfo();
5958

6059
mu::engraving::Excerpt* m_excerpt = nullptr;
6160
bool m_inited = false;

src/notation/internal/notationinteraction.cpp

+13-2
Original file line numberDiff line numberDiff line change
@@ -1971,6 +1971,16 @@ bool NotationInteraction::dropRange(const QByteArray& data, const PointF& pos, b
19711971
return false;
19721972
}
19731973

1974+
if (segment->isInsideTuplet()) {
1975+
endDrop();
1976+
notifyAboutDropChanged();
1977+
//MScore::setError(MsError::DEST_TUPLET);
1978+
//MScoreErrorsController(iocContext()).checkAndShowMScoreError();
1979+
// NOTE: if we show the error popup here it seems that the mouse-release event is missed
1980+
// so the dragged region stays sticked to the mouse and move around. Don't know how to fix it. [M.S.]
1981+
return false;
1982+
}
1983+
19741984
rdd.targetSegment = segment;
19751985
rdd.targetStaffIdx = staffIdx;
19761986

@@ -2005,8 +2015,8 @@ bool NotationInteraction::dropRange(const QByteArray& data, const PointF& pos, b
20052015
XmlReader e(data);
20062016
score()->pasteStaff(e, segment, staffIdx);
20072017

2008-
apply();
20092018
endDrop();
2019+
apply();
20102020

20112021
MScoreErrorsController(iocContext()).checkAndShowMScoreError();
20122022

@@ -7289,7 +7299,8 @@ void NotationInteraction::addMelisma()
72897299

72907300
score()->undoAddElement(melisma);
72917301
} else if (prevPartialLyricsLine) {
7292-
const Fraction tickDiff = nextCR->tick() - prevPartialLyricsLine->tick2();
7302+
const Fraction segEndTick = segment->tick() + segment->ticks();
7303+
const Fraction tickDiff = segEndTick - prevPartialLyricsLine->tick2();
72937304
prevPartialLyricsLine->undoMoveEnd(tickDiff);
72947305
prevPartialLyricsLine->triggerLayout();
72957306
}

src/notation/internal/notationparts.cpp

+7-1
Original file line numberDiff line numberDiff line change
@@ -824,8 +824,14 @@ void NotationParts::moveSystemObjects(const ID& sourceStaffId, const ID& destina
824824
item->triggerLayout();
825825
continue;
826826
}
827+
827828
if (item->staff() == srcStaff) {
828-
item->undoChangeProperty(Pid::TRACK, staff2track(dstStaffIdx, item->voice()));
829+
const track_idx_t trackIdx = staff2track(dstStaffIdx, item->voice());
830+
831+
item->undoChangeProperty(Pid::TRACK, trackIdx);
832+
if (item->isSpanner()) {
833+
item->undoChangeProperty(Pid::SPANNER_TRACK2, trackIdx);
834+
}
829835
} else {
830836
item->undoUnlink();
831837
score()->undoRemoveElement(item, false /*removeLinked*/);

0 commit comments

Comments
 (0)