-// Copyright (C) 2014-2017 CEA/DEN, EDF R&D
+// Copyright (C) 2014-2019 CEA/DEN, EDF R&D
//
// This library is free software; you can redistribute it and/or
// modify it under the terms of the GNU Lesser General Public
//
// You should have received a copy of the GNU Lesser General Public
// License along with this library; if not, write to the Free Software
-// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
//
-// See http://www.salome-platform.org/ or
-// email : webmaster.salome@opencascade.com<mailto:webmaster.salome@opencascade.com>
+// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
//
#include "XGUI_WorkshopListener.h"
#include <ModelAPI_Result.h>
#include <ModelAPI_Feature.h>
#include <ModelAPI_Data.h>
-#include <ModelAPI_ResultCompSolid.h>
#include <ModelAPI_Tools.h>
#include <ModuleBase_Events.h>
const std::string DebugFeatureKind = "";//"Extrusion";
#endif
-XGUI_WorkshopListener::XGUI_WorkshopListener(ModuleBase_IWorkshop* theWorkshop)
+XGUI_WorkshopListener::XGUI_WorkshopListener(XGUI_Workshop* theWorkshop)
: myWorkshop(theWorkshop),
myUpdatePrefs(false)
{
aLoop->registerListener(this, Events_Loop::eventByName("FinishOperation"));
aLoop->registerListener(this, Events_Loop::eventByName("AbortOperation"));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE));
+ aLoop->registerListener(this, Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE));
}
//******************************************************
void XGUI_WorkshopListener::processEvent(const std::shared_ptr<Events_Message>& theMessage)
{
- if (QApplication::instance()->thread() != QThread::currentThread()) {
+ if (QApplication::instance() &&
+ QApplication::instance()->thread() != QThread::currentThread()) {
#ifdef _DEBUG
std::cout << "XGUI_Workshop::processEvent: " << "Working in another thread." << std::endl;
#endif
if (aWidgetSelector)
workshop()->selector()->setSelected(aWidgetSelector->getAttributeSelection());
}
- } else if (theMessage->eventID() == Events_Loop::eventByName("FinishOperation") ||
- theMessage->eventID() == Events_Loop::eventByName("AbortOperation"))
+ } else if (theMessage->eventID() == Events_Loop::eventByName("FinishOperation")/* ||
+ theMessage->eventID() == Events_Loop::eventByName("AbortOperation")*/)
workshop()->facesPanel()->reset(false); // do not flush redisplay, it is flushed after event
//Update property panel on corresponding message. If there is no current operation (no
// the viewer's update context is unblocked, the viewer's update works
XGUI_Displayer* aDisplayer = workshop()->displayer();
aDisplayer->enableUpdateViewer(true);
+ } else if ((theMessage->eventID() ==
+ Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_ENABLE)) ||
+ (theMessage->eventID() ==
+ Events_Loop::eventByName(EVENT_AUTOMATIC_RECOMPUTATION_DISABLE))) {
+ myWorkshop->updateAutoComputeState();
} else {
//Show error dialog if error message received.
std::shared_ptr<Events_InfoMessage> anIngfoMsg =
XGUI_Workshop* XGUI_WorkshopListener::workshop() const
{
- XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
- return aConnector->workshop();
+ return myWorkshop;
}