Eliminate some redundant executes
- excessive calls to DrawView::execute were slowing data entry in PropertyEditor.
This commit is contained in:
committed by
Yorik van Havre
parent
4594583613
commit
eefaaa58db
@@ -137,17 +137,21 @@ void DrawPage::onChanged(const App::Property* prop)
|
||||
}
|
||||
} else if(prop == &Scale) {
|
||||
// touch all views in the Page as they may be dependent on this scale
|
||||
const std::vector<App::DocumentObject*> &vals = Views.getValues();
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = vals.begin(); it < vals.end(); ++it) {
|
||||
TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(*it);
|
||||
if (view != NULL && view->ScaleType.isValue("Page")) {
|
||||
if(std::abs(view->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
|
||||
view->Scale.setValue(Scale.getValue());
|
||||
// WF: not sure this loop is required. Views figure out their scale as required. but maybe
|
||||
// this is needed just to mark the Views to recompute??
|
||||
if (!isRestoring()) {
|
||||
const std::vector<App::DocumentObject*> &vals = Views.getValues();
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = vals.begin(); it < vals.end(); ++it) {
|
||||
TechDraw::DrawView *view = dynamic_cast<TechDraw::DrawView *>(*it);
|
||||
if (view != NULL && view->ScaleType.isValue("Page")) {
|
||||
if(std::abs(view->Scale.getValue() - Scale.getValue()) > FLT_EPSILON) {
|
||||
view->Scale.setValue(Scale.getValue());
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
} else if (prop == &ProjectionType) {
|
||||
// touch all ortho views in the Page as they may be dependent on Projection Type
|
||||
// touch all ortho views in the Page as they may be dependent on Projection Type //(is this true?)
|
||||
const std::vector<App::DocumentObject*> &vals = Views.getValues();
|
||||
for(std::vector<App::DocumentObject *>::const_iterator it = vals.begin(); it < vals.end(); ++it) {
|
||||
TechDraw::DrawProjGroup *view = dynamic_cast<TechDraw::DrawProjGroup *>(*it);
|
||||
|
||||
@@ -103,6 +103,7 @@ void DrawView::checkScale(void)
|
||||
if (ScaleType.isValue("Page")) {
|
||||
if(std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) {
|
||||
Scale.setValue(page->Scale.getValue());
|
||||
Scale.purgeTouched();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -121,6 +122,7 @@ void DrawView::onChanged(const App::Property* prop)
|
||||
if (page != nullptr) {
|
||||
if(std::abs(page->Scale.getValue() - getScale()) > FLT_EPSILON) {
|
||||
Scale.setValue(page->Scale.getValue());
|
||||
Scale.purgeTouched();
|
||||
}
|
||||
}
|
||||
} else if ( ScaleType.isValue("Custom") ) {
|
||||
@@ -137,6 +139,7 @@ void DrawView::onChanged(const App::Property* prop)
|
||||
double newScale = autoScale(page->getPageWidth(),page->getPageHeight());
|
||||
if(std::abs(newScale - getScale()) > FLT_EPSILON) { //stops onChanged/execute loop
|
||||
Scale.setValue(newScale);
|
||||
Scale.purgeTouched();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -354,6 +357,7 @@ bool DrawView::keepUpdated(void)
|
||||
|
||||
void DrawView::requestPaint(void)
|
||||
{
|
||||
Base::Console().Message("TRACE - DV::requestPaint()\n");
|
||||
signalGuiPaint(this);
|
||||
}
|
||||
|
||||
|
||||
@@ -164,6 +164,9 @@ bool DrawViewSymbol::checkFit(TechDraw::DrawPage* p) const
|
||||
|
||||
short DrawViewSymbol::mustExecute() const
|
||||
{
|
||||
if (Scale.isTouched()) {
|
||||
Base::Console().Message("TRACE - DVS::mustExecute - Scale is touched\n");
|
||||
}
|
||||
short result = 0;
|
||||
if (!isRestoring()) {
|
||||
result = (Scale.isTouched() ||
|
||||
|
||||
Reference in New Issue
Block a user