X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FXGUI%2FXGUI_Workshop.cpp;h=c12cce271ca22096c51a5674d840d0bbcb0859b0;hb=57626695d1a88caac8e7940758a8ba93a8bcc9c2;hp=3af0fc6e30b7b9554c69e7a3a722057ca38ef801;hpb=983274afd0b92d3dc977f86b944a023f9a3f6f6b;p=modules%2Fshaper.git diff --git a/src/XGUI/XGUI_Workshop.cpp b/src/XGUI/XGUI_Workshop.cpp old mode 100644 new mode 100755 index 3af0fc6e3..c12cce271 --- a/src/XGUI/XGUI_Workshop.cpp +++ b/src/XGUI/XGUI_Workshop.cpp @@ -310,6 +310,10 @@ void XGUI_Workshop::initMenu() aCommand->connectTo(this, SLOT(onSave())); //aCommand->disable(); + aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"), + QIcon(":pictures/save.png"), QKeySequence()); + aCommand->connectTo(this, SLOT(onSaveAs())); + QString aUndoId = "UNDO_CMD"; aCommand = aGroup->addFeature(aUndoId, tr("Undo"), tr("Undo last command"), QIcon(":pictures/undo.png"), QKeySequence::Undo); @@ -328,13 +332,10 @@ void XGUI_Workshop::initMenu() SIGNAL(updateRedoHistory(const QList&)), SLOT(onRedo(int))); - aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"), - QIcon(":pictures/rebuild.png"), QKeySequence()); - aCommand->connectTo(this, SLOT(onRebuild())); + //aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"), + // QIcon(":pictures/rebuild.png"), QKeySequence()); + //aCommand->connectTo(this, SLOT(onRebuild())); - aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"), - QIcon(":pictures/save.png"), QKeySequence()); - aCommand->connectTo(this, SLOT(onSaveAs())); //aCommand->disable(); aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"), @@ -460,7 +461,8 @@ void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation) } updateCommandStatus(); - myModule->onOperationStarted(aFOperation); + connectToPropertyPanel(true); + myModule->operationStarted(aFOperation); // the objects of the current operation should be deactivated QObjectPtrList anObjects; @@ -488,7 +490,7 @@ void XGUI_Workshop::onOperationResumed(ModuleBase_Operation* theOperation) } updateCommandStatus(); - myModule->onOperationResumed(theOperation); + myModule->operationResumed(theOperation); } @@ -508,7 +510,8 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) hidePropertyPanel(); myPropertyPanel->cleanContent(); - myModule->onOperationStopped(aFOperation); + connectToPropertyPanel(false); + myModule->operationStopped(aFOperation); // the deactivated objects of the current operation should be activated back. // They were deactivated on operation start or an object redisplay @@ -534,12 +537,12 @@ void XGUI_Workshop::onOperationStopped(ModuleBase_Operation* theOperation) void XGUI_Workshop::onOperationCommitted(ModuleBase_Operation* theOperation) { - myModule->onOperationCommitted(theOperation); + myModule->operationCommitted(theOperation); } void XGUI_Workshop::onOperationAborted(ModuleBase_Operation* theOperation) { - myModule->onOperationAborted(theOperation); + myModule->operationAborted(theOperation); } void XGUI_Workshop::setGrantedFeatures(ModuleBase_Operation* theOperation) @@ -607,6 +610,23 @@ void XGUI_Workshop::setPropertyPanel(ModuleBase_Operation* theOperation) myErrorMgr->setPropertyPanel(myPropertyPanel); } +void XGUI_Workshop::connectToPropertyPanel(const bool isToConnect) +{ + XGUI_PropertyPanel* aPropertyPanel = propertyPanel(); + if (aPropertyPanel) { + const QList& aWidgets = aPropertyPanel->modelWidgets(); + foreach (ModuleBase_ModelWidget* aWidget, aWidgets) { + myModule->connectToPropertyPanel(aWidget, isToConnect); + if (isToConnect) { + connect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); + } + else { + disconnect(aWidget, SIGNAL(valueStateChanged(int)), this, SLOT(onWidgetStateChanged(int))); + } + } + } +} + /* * Saves document with given name. */ @@ -843,6 +863,21 @@ void XGUI_Workshop::onRebuild() } //****************************************************** +void XGUI_Workshop::onWidgetStateChanged(int thePreviousState) +{ + ModuleBase_ModelWidget* anActiveWidget = 0; + ModuleBase_Operation* anOperation = myOperationMgr->currentOperation(); + if (anOperation) { + ModuleBase_IPropertyPanel* aPanel = anOperation->propertyPanel(); + if (aPanel) + anActiveWidget = aPanel->activeWidget(); + } + if (anActiveWidget) + operationMgr()->onValidateOperation(); + + myModule->widgetStateChanged(thePreviousState); +} + ModuleBase_IModule* XGUI_Workshop::loadModule(const QString& theModule) { QString libName = QString::fromStdString(library(theModule.toStdString()));