Added forgotten data into notation changes notifier

This commit is contained in:
vpereverzev 2022-01-19 14:02:18 +02:00 committed by pereverzev+v
parent cec3db203b
commit 0a11435be3
3 changed files with 11 additions and 6 deletions

View file

@ -53,7 +53,8 @@ public:
virtual bool isLocked() const = 0;
virtual async::Notification stackChanged() const = 0;
virtual async::Channel<int /*tickFrom*/, int /*tickTo*/> notationChangesRange() const = 0;
virtual async::Channel<int /*tickFrom*/, int /*tickTo*/,
int /*staffIdxFrom*/, int /*staffIdxTo*/> notationChangesRange() const = 0;
};
using INotationUndoStackPtr = std::shared_ptr<INotationUndoStack>;

View file

@ -156,7 +156,7 @@ mu::async::Notification NotationUndoStack::stackChanged() const
return m_stackStateChanged;
}
Channel<int, int> NotationUndoStack::notationChangesRange() const
Channel<int, int, int, int> NotationUndoStack::notationChangesRange() const
{
return m_notationChangesChannel;
}
@ -188,7 +188,7 @@ void NotationUndoStack::notifyAboutStateChanged(NotationChangesRange&& range)
}
m_stackStateChanged.notify();
m_notationChangesChannel.send(range.tickFrom, range.tickTo);
m_notationChangesChannel.send(range.tickFrom, range.tickTo, range.staffIdxFrom, range.staffIdxTo);
}
void NotationUndoStack::notifyAboutUndo()
@ -213,5 +213,6 @@ bool NotationUndoStack::isStackClean() const
NotationUndoStack::NotationChangesRange NotationUndoStack::changesRange() const
{
const Ms::CmdState& cmdState = score()->cmdState();
return { cmdState.startTick().ticks(), cmdState.endTick().ticks() };
return { cmdState.startTick().ticks(), cmdState.endTick().ticks(),
cmdState.startStaff(), cmdState.endStaff() };
}

View file

@ -56,12 +56,15 @@ public:
bool isLocked() const override;
async::Notification stackChanged() const override;
async::Channel<int /*tickFrom*/, int /*tickTo*/> notationChangesRange() const override;
async::Channel<int /*tickFrom*/, int /*tickTo*/,
int /*staffIdxFrom*/, int /*staffIdxTo*/> notationChangesRange() const override;
private:
struct NotationChangesRange {
int tickFrom = 0;
int tickTo = 0;
int staffIdxFrom = 0;
int staffIdxTo = 0;
};
void notifyAboutNotationChanged();
@ -82,7 +85,7 @@ private:
async::Notification m_stackStateChanged;
async::Notification m_undoNotification;
async::Notification m_redoNotification;
async::Channel<int, int> m_notationChangesChannel;
async::Channel<int /*tickFrom*/, int /*tickTo*/, int /*staffIdxFrom*/, int /*staffIdxTo*/> m_notationChangesChannel;
bool m_isLocked = false;
};