Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
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
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
}
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
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
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
1 change: 1 addition & 0 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
9 changes: 9 additions & 0 deletions src/engraving/dom/masterscore.h
Original file line number Diff line number Diff line change
Expand Up @@ -138,6 +138,13 @@ class MasterScore : public Score
bool excerptsChanged() const { return m_cmdState.excerptsChanged; }
bool instrumentsChanged() const { return m_cmdState.instrumentsChanged; }

void startCmd(const TranslatableString& actionName);
void endCmd(bool rollback = false, bool layoutAllParts = false);
void undoRedo(bool undo, EditData* ed);

void update() { update(true); }
void lockUpdates(bool locked);

void setTempomap(TempoMap* tm);

int midiPortCount() const { return m_midiPortCount; }
Expand Down Expand Up @@ -193,6 +200,7 @@ class MasterScore : public Score
double widthOfSegmentCell() const { return m_widthOfSegmentCell; }

private:
void update(bool resetCmdState, bool layoutAllParts = false);

void reorderMidiMapping();
void rebuildExcerptsMidiMapping();
Expand Down Expand Up @@ -230,6 +238,7 @@ class MasterScore : public Score
bool m_readOnly = false;

CmdState m_cmdState; // modified during cmd processing
bool m_updatesLocked = false;

std::array<Fraction, 2> m_loopBoundaries; ///< 0 - LoopIn, 1 - LoopOut

Expand Down
3 changes: 1 addition & 2 deletions src/engraving/dom/playcounttext.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -23,13 +23,12 @@
#include "playcounttext.h"

#include "../editing/textedit.h"
#include "../editing/undo.h"
#include "../editing/transaction/undostack.h"
#include "../types/typesconv.h"

#include "barline.h"
#include "score.h"

using namespace mu;
using namespace mu::engraving;

static ElementStyle playCountStyle {
Expand Down
7 changes: 4 additions & 3 deletions src/engraving/dom/score.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
#include "editing/editstavesharing.h"
#include "editing/mscoreview.h"
#include "editing/splitjoinmeasure.h"
#include "editing/transaction/undostack.h"
#include "editing/transpose.h"

#include "style/style.h"
Expand Down Expand Up @@ -1559,15 +1560,15 @@ void Score::removeElement(EngravingItem* element)
}

muse::remove(m_systems, system);
deleteLater(system);
system->deleteLater();

if (page && page->systems().empty()) {
// Remove this page, since it is now empty.
// This involves renumbering and repositioning all subsequent pages.
PointF pos = page->pos();
auto ii = std::find(pages().begin(), pages().end(), page);
pages().erase(ii);
deleteLater(page);
page->deleteLater();

while (ii != pages().end()) {
page = *ii;
Expand Down Expand Up @@ -4340,7 +4341,7 @@ void Score::cmdSelectSection()
// undo
//---------------------------------------------------------

void Score::undo(UndoCommand* cmd, EditData* ed) const
void Score::undo(UndoableCommand* cmd, EditData* ed) const
{
undoStack()->pushAndPerform(cmd, ed);
}
Expand Down
Loading
Loading