Fixed notification about changing master notation

This commit is contained in:
Eism 2021-03-25 17:35:56 +02:00
parent 08e9866cc6
commit fc2c36bb20
2 changed files with 20 additions and 12 deletions

View file

@ -57,10 +57,12 @@ void GlobalContext::setCurrentMasterNotation(const IMasterNotationPtr& masterNot
}
m_currentMasterNotation = masterNotation;
m_currentMasterNotationChanged.notify();
INotationPtr notation = masterNotation ? masterNotation->notation() : nullptr;
setCurrentNotation(notation);
doSetCurrentNotation(notation);
m_currentMasterNotationChanged.notify();
m_currentNotationChanged.notify();
}
IMasterNotationPtr GlobalContext::currentMasterNotation() const
@ -75,16 +77,7 @@ Notification GlobalContext::currentMasterNotationChanged() const
void GlobalContext::setCurrentNotation(const INotationPtr& notation)
{
if (m_currentNotation == notation) {
return;
}
m_currentNotation = notation;
if (m_currentNotation) {
m_currentNotation->setOpened(true);
}
doSetCurrentNotation(notation);
m_currentNotationChanged.notify();
}
@ -107,3 +100,16 @@ ShortcutContext GlobalContext::currentShortcutContext() const
}
return ShortcutContext::Undefined;
}
void GlobalContext::doSetCurrentNotation(const INotationPtr& notation)
{
if (m_currentNotation == notation) {
return;
}
m_currentNotation = notation;
if (m_currentNotation) {
m_currentNotation->setOpened(true);
}
}

View file

@ -51,6 +51,8 @@ public:
shortcuts::ShortcutContext currentShortcutContext() const override;
private:
void doSetCurrentNotation(const notation::INotationPtr& notation);
std::vector<notation::IMasterNotationPtr> m_masterNotations;
notation::IMasterNotationPtr m_currentMasterNotation;