}
XGUI_Displayer::XGUI_Displayer(XGUI_Workshop* theWorkshop)
- : myWorkshop(theWorkshop), myEnableUpdateViewer(true)
+ : myWorkshop(theWorkshop), myEnableUpdateViewer(true), myNeedUpdate(false)
{
enableUpdateViewer(true);
myCustomPrs = std::shared_ptr<GeomAPI_ICustomPrs>(new XGUI_CustomPrs());
bool aWasEnabled = myEnableUpdateViewer;
myEnableUpdateViewer = isEnabled;
-
+ if (myNeedUpdate && myEnableUpdateViewer) {
+ updateViewer();
+ myNeedUpdate = false;
+ }
return aWasEnabled;
}
if (!aContext.IsNull() && myEnableUpdateViewer) {
myWorkshop->viewer()->Zfitall();
aContext->UpdateCurrentViewer();
+ } else {
+ myNeedUpdate = true;
}
}
/// \param isEnabled a boolean value
bool enableUpdateViewer(const bool isEnabled);
+ bool isUpdateEnabled() const { return myEnableUpdateViewer; }
+
/// Updates the viewer
void updateViewer() const;
QIntList myActiveSelectionModes;
/// the enable update viewer flag
- bool myEnableUpdateViewer;
+ bool myEnableUpdateViewer;
+
+ /// A flag that update was requested but not done
+ mutable bool myNeedUpdate;
};
#endif
// the viewer's update context is unblocked, the viewer's update works
XGUI_Displayer* aDisplayer = workshop()->displayer();
aDisplayer->enableUpdateViewer(true);
- aDisplayer->updateViewer();
} else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_OBJECT_ERROR_CHANGED)) {
std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);