PartDesign: fix issues of PR #3108
* in the undo/redo list use an object's label and not the internal name * check by the transaction ID instead of name to open a transaction to make the workbenches independent of implementation details of the core system * when rejecting a task do not call undo() because this is not the same as aborting a pending transaction * this also fixes the warning: <App> Document.cpp(1182): Cannot commit transaction while transacting
This commit is contained in:
@@ -81,19 +81,20 @@ TaskDressUpParameters::~TaskDressUpParameters()
|
||||
Gui::Selection().rmvSelectionGate();
|
||||
}
|
||||
|
||||
void TaskDressUpParameters::setupTransaction() {
|
||||
if(!DressUpView)
|
||||
void TaskDressUpParameters::setupTransaction()
|
||||
{
|
||||
if (!DressUpView)
|
||||
return;
|
||||
|
||||
int tid = 0;
|
||||
const char *name = App::GetApplication().getActiveTransaction(&tid);
|
||||
if(tid && tid == transactionID)
|
||||
App::GetApplication().getActiveTransaction(&tid);
|
||||
if (tid && tid == transactionID)
|
||||
return;
|
||||
|
||||
// open a transaction if none is active
|
||||
std::string n("Edit ");
|
||||
n += DressUpView->getObject()->getNameInDocument();
|
||||
if(!name || n != name)
|
||||
App::GetApplication().setActiveTransaction(n.c_str());
|
||||
n += DressUpView->getObject()->Label.getValue();
|
||||
transactionID = App::GetApplication().setActiveTransaction(n.c_str());
|
||||
}
|
||||
|
||||
bool TaskDressUpParameters::referenceSelected(const Gui::SelectionChanges& msg)
|
||||
@@ -361,11 +362,6 @@ bool TaskDlgDressUpParameters::accept()
|
||||
bool TaskDlgDressUpParameters::reject()
|
||||
{
|
||||
getDressUpView()->highlightReferences(false);
|
||||
|
||||
auto editDoc = Gui::Application::Instance->editDocument();
|
||||
if(editDoc && parameter->getTransactionID())
|
||||
editDoc->getDocument()->undo(parameter->getTransactionID());
|
||||
|
||||
return TaskDlgFeatureParameters::reject();
|
||||
}
|
||||
|
||||
|
||||
@@ -57,7 +57,7 @@ public:
|
||||
void setupTransaction();
|
||||
|
||||
/// Apply the changes made to the object to it
|
||||
virtual void apply() {};
|
||||
virtual void apply() {}
|
||||
|
||||
int getTransactionID() const {
|
||||
return transactionID;
|
||||
|
||||
@@ -170,20 +170,21 @@ bool TaskTransformedParameters::originalSelected(const Gui::SelectionChanges& ms
|
||||
return false;
|
||||
}
|
||||
|
||||
void TaskTransformedParameters::setupTransaction() {
|
||||
void TaskTransformedParameters::setupTransaction()
|
||||
{
|
||||
auto obj = getObject();
|
||||
if(!obj)
|
||||
if (!obj)
|
||||
return;
|
||||
|
||||
int tid = 0;
|
||||
const char *name = App::GetApplication().getActiveTransaction(&tid);
|
||||
if(tid && tid == transactionID)
|
||||
App::GetApplication().getActiveTransaction(&tid);
|
||||
if (tid && tid == transactionID)
|
||||
return;
|
||||
|
||||
// open a transaction if none is active
|
||||
std::string n("Edit ");
|
||||
n += obj->getNameInDocument();
|
||||
if(!name || n != name)
|
||||
App::GetApplication().setActiveTransaction(n.c_str());
|
||||
n += obj->Label.getValue();
|
||||
transactionID = App::GetApplication().setActiveTransaction(n.c_str());
|
||||
}
|
||||
|
||||
void TaskTransformedParameters::onButtonAddFeature(bool checked)
|
||||
@@ -427,11 +428,6 @@ bool TaskDlgTransformedParameters::reject()
|
||||
{
|
||||
// ensure that we are not in selection mode
|
||||
parameter->exitSelectionMode();
|
||||
|
||||
auto editDoc = Gui::Application::Instance->editDocument();
|
||||
if(editDoc && parameter->getTransactionID())
|
||||
editDoc->getDocument()->undo(parameter->getTransactionID());
|
||||
|
||||
return TaskDlgFeatureParameters::reject ();
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user