fix action history with frames
This commit is contained in:
@@ -19,13 +19,19 @@ void ActionManager::undo()
|
||||
if (I.m_actions.empty())
|
||||
return;
|
||||
|
||||
I.m_redos.emplace(I.m_actions.top()->get_redo());
|
||||
I.m_redos.top()->was_saved = !Canvas::I->m_unsaved;
|
||||
if (auto action = I.m_actions.top()->get_redo())
|
||||
{
|
||||
I.m_redos.emplace(action);
|
||||
I.m_redos.top()->was_saved = !Canvas::I->m_unsaved;
|
||||
}
|
||||
|
||||
I.m_actions.top()->undo();
|
||||
I.m_memory -= I.m_actions.top()->memory();
|
||||
Canvas::I->m_unsaved = !I.m_actions.top()->was_saved;
|
||||
I.m_actions.pop();
|
||||
if (auto action = std::move(I.m_actions.top()))
|
||||
{
|
||||
I.m_actions.pop();
|
||||
action->undo();
|
||||
I.m_memory -= action->memory();
|
||||
Canvas::I->m_unsaved = !action->was_saved;
|
||||
}
|
||||
//LOG("History: %.2f KB", I.m_memory / 1024.f);
|
||||
App::I->update_memory_usage(I.m_memory);
|
||||
App::I->title_update();
|
||||
@@ -36,13 +42,19 @@ void ActionManager::redo()
|
||||
if (I.m_redos.empty())
|
||||
return;
|
||||
|
||||
I.m_actions.emplace(I.m_redos.top()->get_redo());
|
||||
I.m_actions.top()->was_saved = !Canvas::I->m_unsaved;
|
||||
I.m_memory += I.m_actions.top()->memory();
|
||||
if (auto action = I.m_redos.top()->get_redo())
|
||||
{
|
||||
I.m_actions.emplace(action);
|
||||
I.m_actions.top()->was_saved = !Canvas::I->m_unsaved;
|
||||
I.m_memory += I.m_actions.top()->memory();
|
||||
}
|
||||
|
||||
I.m_redos.top()->undo();
|
||||
Canvas::I->m_unsaved = !I.m_redos.top()->was_saved;
|
||||
I.m_redos.pop();
|
||||
if (auto action = std::move(I.m_redos.top()))
|
||||
{
|
||||
I.m_redos.pop();
|
||||
action->undo();
|
||||
Canvas::I->m_unsaved = !action->was_saved;
|
||||
}
|
||||
//LOG("History: %.2f KB", I.m_memory / 1024.f);
|
||||
App::I->update_memory_usage(I.m_memory);
|
||||
App::I->title_update();
|
||||
|
||||
Reference in New Issue
Block a user