Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
60db2d6
Separate UndoableTransaction (f.k.a. UndoMacro) from UndoCommand
cbjeukendrup May 17, 2026
28c025e
Remove StaffTextBase-specific code from undo logic
cbjeukendrup May 17, 2026
581ba2d
Split UndoStack and UndoableCommand into separate files
cbjeukendrup May 23, 2026
17570e0
Make the `deleteLater` concept MasterScore-wide
cbjeukendrup May 24, 2026
66ddaf6
Move start/endCmd and `Score::update` into MasterScore
cbjeukendrup May 24, 2026
1087252
Introduce sanity checks in MasterScore::undoRedo
cbjeukendrup Jun 12, 2026
c68b69d
Remove unexpected start/endCmd in harpdiagram_tests.cpp
cbjeukendrup Jun 4, 2026
5c1be46
Fix double start/endCmd calls in partialtie_tests.cpp
cbjeukendrup Jun 4, 2026
141dbfd
Disable incorrect undo calls from braille module
cbjeukendrup Jun 5, 2026
4ad5f61
Inline static `changesInfo` method
cbjeukendrup Jun 12, 2026
a35569c
Rename confusing parameter of UndoableCommand::cleanup
cbjeukendrup Jun 12, 2026
506bbf9
Don't leak UndoableCommand in early exit path of `pushWithoutPerforming`
cbjeukendrup Jun 11, 2026
67b5fa1
Don't leak items owned by UndoableCommand deleted in `unwind`
cbjeukendrup Jun 12, 2026
e2dd0ca
Fix off-by-one error in UndoStack::reopen
cbjeukendrup Jun 12, 2026
a6a9d38
Fix theoretical concern about `isHairpinDragCreatedFromDynamic` flag
cbjeukendrup Jun 12, 2026
2345ecc
Remove dead `playlistDirty` methods from Score/MasterScore
cbjeukendrup May 24, 2026
f8ca911
Fix setting up tie jump points
cbjeukendrup Jun 4, 2026
14efa02
Fix repeat list being wrong before layout for cross-staff voltas
cbjeukendrup Jun 6, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions src/braille/internal/braille.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2402,8 +2402,10 @@ QString Braille::brailleMeasure(Measure* measure, int staffCount)
resetOctave(staffCount);

// Undo filling the missing beats with rests, so we don't have an altered score.
/* see FIXME above
m_score->undoRedo(true, nullptr);
m_score->undoRedo(true, nullptr);
*/
m_score->deselectAll();
}
}
Expand Down
11 changes: 0 additions & 11 deletions src/braille/tests/braille_tests.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,16 +40,6 @@ class Braille_Tests : public ::testing::Test
void brailleSaveTest(const char* file);
};

//---------------------------------------------------------
// fixupScore -- do required fixups after reading/importing score
//---------------------------------------------------------

static void fixupScore(MasterScore* score)
{
score->connectTies();
score->masterScore()->rebuildMidiMapping();
}

static bool saveBraille(MasterScore* score, const String& saveName)
{
QFile file(saveName);
Expand All @@ -73,7 +63,6 @@ void Braille_Tests::brailleSaveTest(const char* file)
String fileName = String::fromUtf8(file);
MasterScore* score = ScoreRW::readScore(BRAILLE_DIR + fileName + u".mscx", false);
EXPECT_TRUE(score);
fixupScore(score);
score->doLayout();
EXPECT_TRUE(saveCompareBrailleScore(score, fileName + ".brf", BRAILLE_DIR + fileName + "_ref.brf"));
delete score;
Expand Down
6 changes: 4 additions & 2 deletions src/engraving/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -167,10 +167,12 @@ target_sources(engraving PRIVATE
editing/splitjoinmeasure.h
editing/textedit.cpp
editing/textedit.h
editing/transaction/undoablecommand.cpp
editing/transaction/undoablecommand.h
editing/transaction/undostack.cpp
editing/transaction/undostack.h
editing/transpose.cpp
editing/transpose.h
editing/undo.cpp
editing/undo.h

rw/ireader.h
rw/iwriter.h
Expand Down
1 change: 0 additions & 1 deletion src/engraving/api/v1/elements.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -335,7 +335,6 @@ void Chord::setPlayEventType(mu::engraving::PlayEventType v)
{
// Only create undo operation if the value has changed.
if (v != chord()->playEventType()) {
chord()->score()->setPlaylistDirty();
chord()->score()->undo(new ChangeChordPlayEventType(chord(), v));
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/api/v1/elements.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,8 +54,6 @@
#include "engraving/dom/tie.h"
#include "engraving/dom/accidental.h"

#include "engraving/editing/undo.h"

#include "playevent.h"

// api
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/api/v1/selection.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@

#include "selection.h"

#include "engraving/editing/undo.h"
#include "engraving/editing/transaction/undostack.h"

// api
#include "score.h"
Expand Down Expand Up @@ -83,8 +83,8 @@ bool Selection::select(EngravingItem* elWrapper, bool add)
mu::engraving::EngravingItem* e = elWrapper->element();

// Check whether it's safe to select this element:
// use types list from UndoMacro for now
if (!mu::engraving::UndoMacro::canRecordSelectedElement(e)) {
// use types list from UndoableTransaction for now
if (!mu::engraving::UndoableTransaction::canRecordSelectedElement(e)) {
LOGW("Cannot select element of type %s", e->typeName());
return false;
}
Expand Down Expand Up @@ -136,7 +136,7 @@ bool Selection::selectRange(int startTick, int endTick, int startStaff, int endS
return false;
}

if (segEnd && m_selection->score()->undoStack()->hasActiveCommand()) {
if (segEnd && m_selection->score()->undoStack()->hasActiveTransaction()) {
m_selection->setRangeTicks(segStart->tick(), segEnd->tick(), startStaff, endStaff);
} else {
m_selection->setRange(segStart, segEnd, startStaff, endStaff);
Expand Down
1 change: 0 additions & 1 deletion src/engraving/compat/midi/compatmidirender.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@
#include "dom/trill.h"
#include "dom/utils.h"
#include "dom/volta.h"
#include "editing/undo.h"
#include "types/constants.h"

namespace mu::engraving {
Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/arpeggio.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "../editing/elementeditdata.h"
#include "../editing/mscoreview.h"
#include "../editing/undo.h"
#include "../types/typesconv.h"

#include "accidental.h"
Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/barline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "translation.h"

#include "../editing/undo.h"
#include "../types/symnames.h"

#include "articulation.h"
Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/box.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include <cmath>

#include "../editing/elementeditdata.h"
#include "../editing/undo.h"
#include "../editing/editfretboarddiagram.h"

#include "actionicon.h"
Expand Down
25 changes: 25 additions & 0 deletions src/engraving/dom/capo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@

#include "capo.h"

#include "score.h"

#include "translation.h"

using namespace mu::engraving;
Expand Down Expand Up @@ -109,6 +111,11 @@ bool Capo::setProperty(Pid id, const PropertyValue& val)
}

triggerLayout();

if (Score* s = score()) {
s->updateCapo();
}

return true;
}

Expand Down Expand Up @@ -171,3 +178,21 @@ muse::String Capo::generateText(size_t stringCount) const

return text;
}

void Capo::added()
{
StaffTextBase::added();

if (Score* s = score()) {
s->updateCapo();
}
}

void Capo::removed()
{
StaffTextBase::removed();

if (Score* s = score()) {
s->updateCapo();
}
}
10 changes: 5 additions & 5 deletions src/engraving/dom/capo.h
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/

#ifndef MU_ENGRAVING_CAPO_H
#define MU_ENGRAVING_CAPO_H
#pragma once

#include "stafftextbase.h"

Expand Down Expand Up @@ -49,11 +48,12 @@ class Capo final : public StaffTextBase
bool shouldAutomaticallyGenerateText() const;
String generateText(size_t stringCount) const;

void added() override;
void removed() override;

private:
CapoParams m_params;
bool m_shouldAutomaticallyGenerateText = true;
String m_customText;
};
} // namespace mu::engraving

#endif // MU_ENGRAVING_CAPO_H
}
4 changes: 1 addition & 3 deletions src/engraving/dom/chord.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -658,8 +658,7 @@ void Chord::add(EngravingItem* e)
measure()->setHasVoices(staffIdx(), true);
}
}
score()->setPlaylistDirty();
break;
break;
case ElementType::ARPEGGIO:
m_arpeggio = toArpeggio(e);
break;
Expand Down Expand Up @@ -761,7 +760,6 @@ void Chord::remove(EngravingItem* e)
if (voice() && measure() && note->visible()) {
measure()->checkMultiVoices(staffIdx());
}
score()->setPlaylistDirty();
}
break;

Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/clef.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,6 @@

#include "translation.h"

#include "../editing/undo.h"
#include "../editing/editproperty.h"
#include "../types/typesconv.h"

Expand Down
6 changes: 3 additions & 3 deletions src/engraving/dom/durationelement.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,13 @@

#include "durationelement.h"

#include "../editing/undo.h"

#include "property.h"
#include "score.h"
#include "staff.h"
#include "tuplet.h"

#include "editing/transaction/undostack.h"

using namespace mu;
using namespace mu::engraving;

Expand Down Expand Up @@ -123,7 +123,7 @@ Fraction DurationElement::actualTicks() const
void DurationElement::readAddTuplet(Tuplet* t)
{
setTuplet(t);
if (!score()->undoStack()->hasActiveCommand()) { // HACK, also added in Undo::AddElement()
if (!score()->undoStack()->hasActiveTransaction()) { // HACK, also added in Undo::AddElement()
t->add(this);
}
}
Expand Down
2 changes: 0 additions & 2 deletions src/engraving/dom/dynamichairpingroup.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,6 @@

#include "dynamichairpingroup.h"

#include "../editing/undo.h"

#include "dynamic.h"
#include "expression.h"
#include "hairpin.h"
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/engravingitem.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -362,7 +362,7 @@ void EngravingItem::deleteLater()
if (selected()) {
score()->deselect(this);
}
masterScore()->deleteLater(this);
masterScore()->cmdState().deleteLater(this);
}

//---------------------------------------------------------
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/engravingobject.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@

#include "global/containers.h"

#include "../editing/undo.h"
#include "../editing/addremoveelement.h"
#include "../editing/editproperty.h"
#include "../editing/transaction/undostack.h"
#include "style/textstyle.h"
#include "types/typesconv.h"

Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/excerpt.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ void Excerpt::createExcerpt(Excerpt* excerpt)
}

// second layout of score
score->setPlaylistDirty();
score->invalidateRepeatList();
masterScore->rebuildMidiMapping();
masterScore->updateChannel();
score->remapBracketsAndBarlines();
Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/figuredbass.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,6 @@

#include "io/file.h"

#include "../editing/undo.h"
#include "rw/xmlreader.h"
#include "style/textstyle.h"

Expand Down
4 changes: 0 additions & 4 deletions src/engraving/dom/harmony.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -26,11 +26,7 @@
#include "translation.h"

#include "draw/fontmetrics.h"
#include "draw/types/brush.h"
#include "draw/types/pen.h"

#include "../editing/textedit.h"
#include "../editing/undo.h"
#include "../editing/transpose.h"

#include "chordlist.h"
Expand Down
2 changes: 1 addition & 1 deletion src/engraving/dom/jump.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -157,7 +157,7 @@ bool Jump::setProperty(Pid propertyId, const PropertyValue& v)
break;
}
triggerLayout();
score()->setPlaylistDirty();
score()->invalidateRepeatList();
return true;
}

Expand Down
1 change: 0 additions & 1 deletion src/engraving/dom/lyrics.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,6 @@
#include "types/translatablestring.h"

#include "../editing/textedit.h"
#include "../editing/undo.h"

#include "measure.h"
#include "navigate.h"
Expand Down
8 changes: 4 additions & 4 deletions src/engraving/dom/masterscore.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@

#include "compat/writescorehook.h"
#include "editing/editmeasures.h"
#include "editing/transaction/undostack.h"
#include "rw/mscloader.h"
#include "rw/xmlreader.h"
#include "rw/rwregister.h"
Expand Down Expand Up @@ -151,12 +152,11 @@ IAutomation* MasterScore::automation() const
}

//---------------------------------------------------------
// setPlaylistDirty
// invalidateRepeatLists
//---------------------------------------------------------

void MasterScore::setPlaylistDirty()
void MasterScore::invalidateRepeatList()
{
m_playlistDirty = true;
m_expandedRepeatList->setScoreChanged();
m_nonExpandedRepeatList->setScoreChanged();
}
Expand All @@ -171,7 +171,7 @@ void MasterScore::setExpandRepeats(bool expand)
return;
}
m_expandRepeats = expand;
setPlaylistDirty();
invalidateRepeatList();
}

//---------------------------------------------------------
Expand Down
Loading
Loading