Eliminate superfluous DPG executes

This commit is contained in:
WandererFan
2017-08-14 19:49:42 -04:00
committed by wmayer
parent 2524053887
commit e35e2f2573
26 changed files with 159 additions and 242 deletions

View File

@@ -59,14 +59,6 @@ using namespace Gui;
using namespace TechDraw;
using namespace TechDrawGui;
//TODO: Look into this, seems we might be able to delete it now? IR
#if 0 // needed for Qt's lupdate utility
qApp->translate("QObject", "Make axonometric...");
qApp->translate("QObject", "Edit axonometric settings...");
qApp->translate("QObject", "Make orthographic");
#endif
TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
ui(new Ui_TaskProjGroup),
multiView(featView),
@@ -78,7 +70,7 @@ TaskProjGroup::TaskProjGroup(TechDraw::DrawProjGroup* featView, bool mode) :
ui->projection->setCurrentIndex(multiView->ProjectionType.getValue());
setFractionalScale(multiView->Scale.getValue());
setFractionalScale(multiView->getScale());
ui->cmbScaleType->setCurrentIndex(multiView->ScaleType.getValue());
// Initially toggle view checkboxes if needed
@@ -129,21 +121,16 @@ void TaskProjGroup::viewToggled(bool toggle)
QString viewName = sender()->objectName();
int index = viewName.mid(7).toInt();
const char *viewNameCStr = viewChkIndexToCStr(index);
App::DocumentObject* newObj;
TechDraw::DrawView* newView;
if ( toggle && !multiView->hasProjection( viewNameCStr ) ) {
newObj = multiView->addProjection( viewNameCStr );
newView = static_cast<TechDraw::DrawView*>(newObj);
m_mdi->redraw1View(newView);
(void) multiView->addProjection( viewNameCStr );
changed = true;
} else if ( !toggle && multiView->hasProjection( viewNameCStr ) ) {
multiView->removeProjection( viewNameCStr );
changed = true;
}
if (changed) {
multiView->recomputeFeature();
if (multiView->ScaleType.isValue("Automatic")) {
double scale = multiView->Scale.getValue();
double scale = multiView->getScale();
setFractionalScale(scale);
}
}
@@ -306,7 +293,7 @@ void TaskProjGroup::updateTask()
ui->cmbScaleType->setCurrentIndex(multiView->ScaleType.getValue());
// Update the scale value
setFractionalScale(multiView->Scale.getValue());
setFractionalScale(multiView->getScale());
blockUpdate = false;
}
@@ -339,7 +326,7 @@ void TaskProjGroup::scaleManuallyChanged(int i)
double scale = (double) a / (double) b;
Gui::Command::doCommand(Gui::Command::Doc, "App.activeDocument().%s.Scale = %f", multiView->getNameInDocument()
, scale);
multiView->recomputeFeature();
multiView->recomputeFeature(); //just a repaint. multiView is already marked for recompute by changed to Scale
Gui::Command::updateActive();
}
@@ -465,8 +452,10 @@ bool TaskProjGroup::accept()
Gui::Document* doc = Gui::Application::Instance->getDocument(multiView->getDocument());
if (!doc) return false;
Gui::Command::commitCommand();
Gui::Command::updateActive();
if (!getCreateMode()) { //this is an edit session, end the transaction
Gui::Command::commitCommand();
}
//Gui::Command::updateActive(); //no chain of updates here
Gui::Command::doCommand(Gui::Command::Gui,"Gui.ActiveDocument.resetEdit()");
return true;