Command: disable auto transaction if triggering editing
Each command will create an App::AutoTransaction to auto create and commit a transaction for proper undo/redo. But if the command starts editing, the current transaction may be required to out live the current command. Note that the command can only detect editing if the code calls Gui::Document::setEdit(). There are objects that starts editing by calling its own ViewProvider::setEdit(), e.g. various TechDraw ViewProviders. In this case, to avoid auto committing, one can call App::Application::setActiveTransaction() with the second argument set to true, or call App::AutoTransaction::setEnable(false).
This commit is contained in:
@@ -938,8 +938,11 @@ int Application::setActiveTransaction(const char *name, bool persist) {
|
||||
FC_LOG("transaction rename to '" << name << "'");
|
||||
for(auto &v : DocMap)
|
||||
v.second->renameTransaction(name,_activeTransactionID);
|
||||
}else
|
||||
} else {
|
||||
if(persist)
|
||||
AutoTransaction::setEnable(false);
|
||||
return 0;
|
||||
}
|
||||
}else{
|
||||
FC_LOG("set active transaction '" << name << "'");
|
||||
_activeTransactionID = 0;
|
||||
|
||||
Reference in New Issue
Block a user