]> SALOME platform Git repositories - modules/shaper.git/commitdiff
Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorsbh <sergey.belash@opencascade.com>
Fri, 19 Sep 2014 12:20:32 +0000 (16:20 +0400)
committersbh <sergey.belash@opencascade.com>
Fri, 19 Sep 2014 12:20:32 +0000 (16:20 +0400)
1  2 
src/XGUI/XGUI_Workshop.cpp

index 4046ede8fb2408032129fd9c32c6e073c031d126,5ed671cc7018739cd9e70394bd561e7052251773..b5fb72d02de51e651e78dea7d21689137250715a
@@@ -196,6 -196,7 +196,7 @@@ void XGUI_Workshop::initMenu(
  
    aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
                                  QIcon(":pictures/rebuild.png"));
+   aCommand->connectTo(this, SLOT(onRebuild()));
  
    aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
                                  QIcon(":pictures/save.png"));
@@@ -475,7 -476,6 +476,7 @@@ void XGUI_Workshop::onOperationStarted(
      }
  
      myPropertyPanel->setModelWidgets(aWidgets);
 +    myPropertyPanel->onActivateNextWidget(NULL);
      myPropertyPanel->setWindowTitle(aOperation->getDescription()->description());
    }
    updateCommandStatus();
@@@ -575,14 -575,11 +576,14 @@@ void XGUI_Workshop::connectWithOperatio
      aCommand = salomeConnector()->command(theOperation->getDescription()->operationId());
    } else {
      XGUI_MainMenu* aMenu = myMainWindow->menuObject();
 -    aCommand = aMenu->feature(theOperation->getDescription()->operationId());
 +    FeaturePtr aFeature = theOperation->feature();
 +    if(aFeature)
 +      aCommand = aMenu->feature(QString::fromStdString(aFeature->getKind()));
    }
    //Abort operation on uncheck the command
 -  if (aCommand)
 +  if (aCommand) {
      connect(aCommand, SIGNAL(triggered(bool)), theOperation, SLOT(setRunning(bool)));
 +  }
  }
  
  /*
@@@ -754,6 -751,14 +755,14 @@@ void XGUI_Workshop::onRedo(
    updateCommandStatus();
  }
  
+ //******************************************************
+ void XGUI_Workshop::onRebuild()
+ {
+   static const Events_ID aRebuildEvent = Events_Loop::loop()->eventByName("Rebuild");
+   Events_Loop::loop()->send(boost::shared_ptr<Events_Message>(
+     new Events_Message(aRebuildEvent, this)));
+ }
  //******************************************************
  void XGUI_Workshop::onPreferences()
  {
@@@ -862,7 -867,8 +871,7 @@@ void XGUI_Workshop::updateCommandStatus
    if (aMgr->hasModuleDocument()) {
      QAction* aUndoCmd;
      QAction* aRedoCmd;
 -    foreach(QAction* aCmd, aCommands)
 -    {
 +    foreach(QAction* aCmd, aCommands) {
        QString aId = aCmd->data().toString();
        if (aId == "UNDO_CMD")
          aUndoCmd = aCmd;
      aUndoCmd->setEnabled(aMgr->canUndo());
      aRedoCmd->setEnabled(aMgr->canRedo());
    } else {
 -    foreach(QAction* aCmd, aCommands)
 -    {
 +    foreach(QAction* aCmd, aCommands) {
        QString aId = aCmd->data().toString();
        if (aId == "NEW_CMD")
          aCmd->setEnabled(true);
@@@ -942,8 -949,10 +951,8 @@@ void XGUI_Workshop::createDockWidgets(
    connect(aOkBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onCommitOperation()));
    QPushButton* aCancelBtn = myPropertyPanel->findChild<QPushButton*>(XGUI::PROP_PANEL_CANCEL);
    connect(aCancelBtn, SIGNAL(clicked()), myOperationMgr, SLOT(onAbortOperation()));
 -//TODO(sbh): KeyReleasedProblem
    connect(myPropertyPanel, SIGNAL(keyReleased(QKeyEvent*)), myOperationMgr,
            SLOT(onKeyReleased(QKeyEvent*)));
 -
    connect(myPropertyPanel, SIGNAL(widgetActivated(ModuleBase_ModelWidget*)), myOperationMgr,
            SLOT(onWidgetActivated(ModuleBase_ModelWidget*)));
    connect(myOperationMgr, SIGNAL(activateNextWidget(ModuleBase_ModelWidget*)), myPropertyPanel,
@@@ -1149,27 -1158,16 +1158,27 @@@ void XGUI_Workshop::showOnlyObjects(con
  //**************************************************************
  void XGUI_Workshop::updateCommandsOnViewSelection()
  {
 -  SessionPtr aMgr = ModelAPI_Session::get();
 -  ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
    XGUI_Selection* aSelection = mySelector->selection();
    if (aSelection->getSelected().size() == 0)
      return;
  
 +  // Restrict validators to manage only nested (child) features
 +  // of the current feature i.e. if current feature is Sketch -
 +  // Sketch Features & Constraints can be validated.
 +  QStringList aNestedIds;
 +  if(myOperationMgr->hasOperation()) {
 +    FeaturePtr aFeature = myOperationMgr->currentOperation()->feature();
 +    if(aFeature) {
 +      aNestedIds << myActionsMgr->nestedCommands(QString::fromStdString(aFeature->getKind()));
 +    }
 +  }
 +  SessionPtr aMgr = ModelAPI_Session::get();
 +  ModelAPI_ValidatorsFactory* aFactory = aMgr->validators();
    QList<QAction*> aActions = getModuleCommands();
 -  foreach(QAction* aAction, aActions)
 -  {
 +  foreach(QAction* aAction, aActions) {
      QString aId = aAction->data().toString();
 +    if(!aNestedIds.contains(aId))
 +      continue;
      std::list<ModelAPI_Validator*> aValidators;
      std::list<std::list<std::string> > anArguments;
      aFactory->validators(aId.toStdString(), aValidators, anArguments);