Skip to content

Commit

Permalink
TaskDlgEditSketch: Remove unnecessary recompute
Browse files Browse the repository at this point in the history
===============================================

On Undo/Redo there should not be an unconditional recompute.

The need for this recompute is probably related to the fact that PropertyConstraintList
has invalid geometry keys.
  • Loading branch information
abdullahtahiriyo authored and wwmayer committed Jun 14, 2020
1 parent 7ae2fc7 commit 58e459c
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 24 deletions.
22 changes: 1 addition & 21 deletions src/Mod/Sketcher/Gui/TaskDlgEditSketch.cpp
Expand Up @@ -32,7 +32,6 @@
#include <Gui/Command.h>

using namespace SketcherGui;
namespace bp = boost::placeholders;


//**************************************************************************
Expand Down Expand Up @@ -73,36 +72,17 @@ TaskDlgEditSketch::TaskDlgEditSketch(ViewProviderSketch *sketchView)
Constraints->hideGroupBox();
if (!hGrp->GetBool("ExpandedElementsWidget",true))
Elements->hideGroupBox();

App::Document* document = sketchView->getObject()->getDocument();
connectUndoDocument =
document->signalUndo.connect(boost::bind(&TaskDlgEditSketch::slotUndoDocument, this, bp::_1));
connectRedoDocument =
document->signalRedo.connect(boost::bind(&TaskDlgEditSketch::slotRedoDocument, this, bp::_1));
}

TaskDlgEditSketch::~TaskDlgEditSketch()
{
connectUndoDocument.disconnect();
connectRedoDocument.disconnect();

// to make sure to delete the advanced solver panel
// it must be part to the 'Content' array
std::vector<QWidget*>::iterator it = std::find(Content.begin(), Content.end(), SolverAdvanced);
if (it == Content.end())
Content.push_back(SolverAdvanced);
}

void TaskDlgEditSketch::slotUndoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
}

void TaskDlgEditSketch::slotRedoDocument(const App::Document& doc)
{
const_cast<App::Document&>(doc).recomputeFeature(sketchView->getObject());
}

//==== calls from the TaskView ===============================================================


Expand All @@ -129,7 +109,7 @@ bool TaskDlgEditSketch::reject()
hGrp->SetBool("ExpandedEditControlWidget",General->isGroupVisible());
hGrp->SetBool("ExpandedConstraintsWidget",Constraints->isGroupVisible());
hGrp->SetBool("ExpandedElementsWidget",Elements->isGroupVisible());

std::string document = getDocumentName(); // needed because resetEdit() deletes this instance
Gui::Command::doCommand(Gui::Command::Gui,"Gui.getDocument('%s').resetEdit()", document.c_str());
Gui::Command::doCommand(Gui::Command::Doc,"App.getDocument('%s').recompute()", document.c_str());
Expand Down
4 changes: 1 addition & 3 deletions src/Mod/Sketcher/Gui/TaskDlgEditSketch.h
Expand Up @@ -62,7 +62,7 @@ class SketcherGuiExport TaskDlgEditSketch : public Gui::TaskView::TaskDialog
virtual bool isAllowedAlterDocument(void) const
{ return false; }

/// returns for Close and Help button
/// returns for Close and Help button
virtual QDialogButtonBox::StandardButtons getStandardButtons(void) const
{ return QDialogButtonBox::Close; }

Expand All @@ -77,8 +77,6 @@ class SketcherGuiExport TaskDlgEditSketch : public Gui::TaskView::TaskDialog
TaskSketcherGeneral *General;
TaskSketcherMessages *Messages;
TaskSketcherSolverAdvanced *SolverAdvanced;
Connection connectUndoDocument;
Connection connectRedoDocument;
};


Expand Down

0 comments on commit 58e459c

Please sign in to comment.