Salome HOME
Merge branch 'master' of newgeom:newgeom
authorvsv <vitaly.smetannikov@opencascade.com>
Thu, 15 May 2014 13:49:30 +0000 (17:49 +0400)
committervsv <vitaly.smetannikov@opencascade.com>
Thu, 15 May 2014 13:49:30 +0000 (17:49 +0400)
1  2 
src/PartSetPlugin/PartSetPlugin_Part.h
src/XGUI/XGUI_Workshop.cpp

index 25dc0e0ce7b3ac015483a4106a09ce2a557c3fc0,eaae463ad2831260dc75a595e9c8a761f645e09c..dc6a80a49bc76163f7cf230849336b874568d534
@@@ -34,11 -34,11 +34,14 @@@ public
  
    PARTSETPLUGIN_EXPORT virtual boost::shared_ptr<ModelAPI_Document> documentToAdd();
  
+   /// Returns true if this feature must be displayed in the history (top level of Part tree)
+   PARTSETPLUGIN_EXPORT virtual bool isInHistory() {return false;}
    /// Use plugin manager for features creation
    PartSetPlugin_Part();
 +
 +  /// Returns true if this feature must be displayed in the history (top level of Part tree)
 +  PARTSETPLUGIN_EXPORT virtual bool isInHistory() {return false;}
  };
  
  #endif
index 5b3c5616b5108684154eb253f0542ca9d77115f9,aa2318703d9da9311e7c5c0cc869d861dc718571..f3ac95d98e222d23cba387e0a7cfba64caca25e7
@@@ -19,7 -19,6 +19,7 @@@
  #include "XGUI_ErrorDialog.h"
  #include "XGUI_ViewerProxy.h"
  #include "XGUI_PropertyPanel.h"
 +#include "XGUI_ContextMenuMgr.h"
  
  #include <Model_Events.h>
  #include <ModelAPI_PluginManager.h>
@@@ -84,7 -83,6 +84,7 @@@ XGUI_Workshop::XGUI_Workshop(XGUI_Salom
    myOperationMgr = new XGUI_OperationMgr(this);
    myActionsMgr = new XGUI_ActionsMgr(this);
    myErrorDlg = new XGUI_ErrorDialog(myMainWindow);
 +  myContextMenuMgr = new XGUI_ContextMenuMgr(this);
  
    myViewerProxy = new XGUI_ViewerProxy(this);
  
@@@ -179,7 -177,6 +179,7 @@@ void XGUI_Workshop::initMenu(
                                  QIcon(":pictures/close.png"), QKeySequence::Close);
    aCommand->connectTo(this, SLOT(onExit()));
  
 +  myContextMenuMgr->createActions();
  }
  
  //******************************************************
@@@ -424,7 -421,7 +424,7 @@@ void XGUI_Workshop::onOpen(
    }
  
    //show file dialog, check if readable and open
-   myCurrentFile = QFileDialog::getOpenFileName(mainWindow());
+   myCurrentFile = QFileDialog::getExistingDirectory(mainWindow());
    if(myCurrentFile.isEmpty())
      return;
    QFileInfo aFileInfo(myCurrentFile);
@@@ -473,6 -470,8 +473,8 @@@ void XGUI_Workshop::onUndo(
    objectBrowser()->setCurrentIndex(QModelIndex());
    boost::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
    boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
+   if (!operationMgr()->abortOperation())
+     return;
    aDoc->undo();
    updateCommandStatus();
  }
@@@ -574,25 -573,25 +576,25 @@@ void XGUI_Workshop::updateCommandStatus
    if (aMgr->hasRootDocument()) {
      XGUI_Command* aUndoCmd;
      XGUI_Command* aRedoCmd;
 -    for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
 -      if ((*aIt)->id() == "UNDO_CMD")
 -        aUndoCmd = (*aIt);
 -      else if ((*aIt)->id() == "REDO_CMD")
 -        aRedoCmd = (*aIt);
 +    foreach(XGUI_Command* aCmd, aCommands) {
 +      if (aCmd->id() == "UNDO_CMD")
 +        aUndoCmd = aCmd;
 +      else if (aCmd->id() == "REDO_CMD")
 +        aRedoCmd = aCmd;
        else // Enable all commands
 -        (*aIt)->enable();
 +        aCmd->enable();
      }
      boost::shared_ptr<ModelAPI_Document> aDoc = aMgr->rootDocument();
      aUndoCmd->setEnabled(aDoc->canUndo());
      aRedoCmd->setEnabled(aDoc->canRedo());
    } else {
 -    for (aIt = aCommands.constBegin(); aIt != aCommands.constEnd(); ++aIt) {
 -      if ((*aIt)->id() == "NEW_CMD")
 -        (*aIt)->enable();
 -      else if ((*aIt)->id() == "EXIT_CMD")
 -        (*aIt)->enable();
 +    foreach(XGUI_Command* aCmd, aCommands) {
 +      if (aCmd->id() == "NEW_CMD")
 +        aCmd->enable();
 +      else if (aCmd->id() == "EXIT_CMD")
 +        aCmd->enable();
        else 
 -        (*aIt)->disable();
 +        aCmd->disable();
      }
    }
  }
@@@ -606,8 -605,6 +608,8 @@@ QDockWidget* XGUI_Workshop::createObjec
    myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
    connect(myObjectBrowser, SIGNAL(activePartChanged(FeaturePtr)), this, SLOT(changeCurrentDocument(FeaturePtr)));
    aObjDock->setWidget(myObjectBrowser);
 +
 +  myContextMenuMgr->connectObjectBrowser();
    return aObjDock;
  }