Salome HOME
Merge branch 'Dev_1.2.0' of newgeom:newgeom.git into Dev_1.2.0
authorsbh <sergey.belash@opencascade.com>
Thu, 30 Apr 2015 14:46:23 +0000 (17:46 +0300)
committersbh <sergey.belash@opencascade.com>
Thu, 30 Apr 2015 14:46:23 +0000 (17:46 +0300)
51 files changed:
eclipse_centos.sh [new file with mode: 0755]
eclipse_debian.sh [new file with mode: 0755]
make_centos.sh [new file with mode: 0755]
make_debian.sh [new file with mode: 0755]
src/ModuleBase/CMakeLists.txt
src/ModuleBase/ModuleBase_IDocumentDataModel.h [new file with mode: 0644]
src/ModuleBase/ModuleBase_IModule.h
src/ModuleBase/ModuleBase_Tools.cpp
src/ModuleBase/ModuleBase_Tools.h
src/NewGeom/NewGeom_Module.cpp
src/PartSet/CMakeLists.txt
src/PartSet/PartSet_DataTreeModel.h [new file with mode: 0644]
src/PartSet/PartSet_DocumentDataModel.cpp [new file with mode: 0644]
src/PartSet/PartSet_DocumentDataModel.h [new file with mode: 0644]
src/PartSet/PartSet_MenuMgr.cpp
src/PartSet/PartSet_MenuMgr.h
src/PartSet/PartSet_Module.cpp
src/PartSet/PartSet_Module.h
src/PartSet/PartSet_PartDataModel.cpp [new file with mode: 0644]
src/PartSet/PartSet_PartDataModel.h [new file with mode: 0644]
src/PartSet/PartSet_WidgetPoint2dAngle.cpp [new file with mode: 0644]
src/PartSet/PartSet_WidgetPoint2dAngle.h [new file with mode: 0644]
src/PartSet/PartSet_WidgetPoint2dDistance.cpp
src/PartSet/PartSet_WidgetPoint2dDistance.h
src/PartSet/PartSet_icons.qrc
src/PartSet/icons/activate.png [new file with mode: 0644]
src/PartSet/icons/deactivate.png [new file with mode: 0644]
src/PartSet/icons/edit.png [new file with mode: 0644]
src/PartSet/icons/exec_state_failed.png [new file with mode: 0644]
src/PartSet/icons/exec_state_invalid_parameters.png [new file with mode: 0644]
src/PartSetPlugin/PartSetPlugin_Part.h
src/SketchPlugin/plugin-Sketch.xml
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_ContextMenuMgr.cpp
src/XGUI/XGUI_ContextMenuMgr.h
src/XGUI/XGUI_DataTreeModel.h [deleted file]
src/XGUI/XGUI_DocumentDataModel.cpp [deleted file]
src/XGUI/XGUI_DocumentDataModel.h [deleted file]
src/XGUI/XGUI_ObjectsBrowser.cpp
src/XGUI/XGUI_ObjectsBrowser.h
src/XGUI/XGUI_PartDataModel.cpp [deleted file]
src/XGUI/XGUI_PartDataModel.h [deleted file]
src/XGUI/XGUI_Tools.cpp
src/XGUI/XGUI_Tools.h
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_Workshop.h
src/XGUI/XGUI_pictures.qrc
src/XGUI/pictures/activate.png [deleted file]
src/XGUI/pictures/edit.png [deleted file]
src/XGUI/pictures/exec_state_failed.png [deleted file]
src/XGUI/pictures/exec_state_invalid_parameters.png [deleted file]

diff --git a/eclipse_centos.sh b/eclipse_centos.sh
new file mode 100755 (executable)
index 0000000..ea5e02a
--- /dev/null
@@ -0,0 +1,25 @@
+
+# Find absolute path to ROOT_DIR
+export ROOT_DIR=$(pwd)/..
+export ROOT_DIR=`cd "${ROOT_DIR}";pwd`
+
+SRC_DIR=${ROOT_DIR}/sources
+
+source ${SRC_DIR}/linux_env.sh
+mkdir -p ${ROOT_DIR}/build-centos
+cd ${ROOT_DIR}/build-centos
+
+export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH}
+export LightAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui
+
+CMAKE_ARGS="-D_ECLIPSE_VERSION=4.3"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=ON"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install"
+CMAKE_ARGS="${CMAKE_ARGS} -DPYTHON_EXECUTABLE=${PYTHONHOME}/bin/python"
+CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=OFF"
+CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
+
+cmake -G "Eclipse CDT4 - Unix Makefiles" ${CMAKE_ARGS}
+
+/misc/dn48/newgeom/common/eclipse-4.4.0/eclipse&
diff --git a/eclipse_debian.sh b/eclipse_debian.sh
new file mode 100755 (executable)
index 0000000..f7d456a
--- /dev/null
@@ -0,0 +1,26 @@
+
+# Find absolute path to ROOT_DIR
+export ROOT_DIR=$(pwd)/..
+export ROOT_DIR=`cd "${ROOT_DIR}";pwd`
+
+SRC_DIR=${ROOT_DIR}/sources
+
+export INST_ROOT=/misc/dn48/newgeom/common/SALOME-7.5.1_Debian-6.0
+source ${SRC_DIR}/linux_env.sh
+mkdir -p ${ROOT_DIR}/build-debian
+cd ${ROOT_DIR}/build-debian
+
+export LD_LIBRARY_PATH=${KERNEL_ROOT_DIR}/lib/salome:${LD_LIBRARY_PATH}
+export LightAppConfig=${ROOT_DIR}/install/share/salome/resources/newgeom:${GUI_ROOT_DIR}/share/salome/resources/gui
+
+CMAKE_ARGS="-D_ECLIPSE_VERSION=4.3"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Debug"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_ECLIPSE_GENERATE_SOURCE_PROJECT=ON"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install"
+CMAKE_ARGS="${CMAKE_ARGS} -DPYTHON_EXECUTABLE=${PYTHONHOME}/bin/python"
+CMAKE_ARGS="${CMAKE_ARGS} -DUSE_TEST_COVERAGE=OFF"
+CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
+
+cmake -G "Eclipse CDT4 - Unix Makefiles" ${CMAKE_ARGS}
+
+/misc/dn48/newgeom/common/eclipse-4.4.0/eclipse&
diff --git a/make_centos.sh b/make_centos.sh
new file mode 100755 (executable)
index 0000000..ef61abc
--- /dev/null
@@ -0,0 +1,18 @@
+
+# Find absolute path to ROOT_DIR
+export ROOT_DIR=$(pwd)/..
+export ROOT_DIR=`cd "${ROOT_DIR}";pwd`
+
+SRC_DIR=${ROOT_DIR}/sources
+
+source ${SRC_DIR}/linux_env.sh
+mkdir -p ${ROOT_DIR}/build
+cd ${ROOT_DIR}/build
+
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install"
+CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
+
+cmake -G "Unix Makefiles" ${CMAKE_ARGS}
+make
+make install
diff --git a/make_debian.sh b/make_debian.sh
new file mode 100755 (executable)
index 0000000..e2ce3a0
--- /dev/null
@@ -0,0 +1,19 @@
+
+# Find absolute path to ROOT_DIR
+export ROOT_DIR=$(pwd)/..
+export ROOT_DIR=`cd "${ROOT_DIR}";pwd`
+
+SRC_DIR=${ROOT_DIR}/sources
+
+export INST_ROOT=/misc/dn48/newgeom/common/SALOME-7.5.1_Debian-6.0
+source ${SRC_DIR}/linux_env.sh
+mkdir -p ${ROOT_DIR}/build-debian
+cd ${ROOT_DIR}/build-debian
+
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_BUILD_TYPE=Release"
+CMAKE_ARGS="${CMAKE_ARGS} -DCMAKE_INSTALL_PREFIX:PATH=${ROOT_DIR}/install"
+CMAKE_ARGS="${CMAKE_ARGS} ${SRC_DIR}"
+
+cmake -G "Unix Makefiles" ${CMAKE_ARGS}
+make
+make install
index 140a65d170203e8fc1f1a644a297d1c8fdd2977d..3b2c8a279a9c35e4f126f4239121fbfbc2e3739f 100644 (file)
@@ -47,6 +47,7 @@ SET(PROJECT_HEADERS
        ModuleBase_WidgetExprEditor.h
        ModuleBase_ParamSpinBox.h
        ModuleBase_WidgetIntValue.h
+    ModuleBase_IDocumentDataModel.h
 )
 
 SET(PROJECT_SOURCES
diff --git a/src/ModuleBase/ModuleBase_IDocumentDataModel.h b/src/ModuleBase/ModuleBase_IDocumentDataModel.h
new file mode 100644 (file)
index 0000000..b18866e
--- /dev/null
@@ -0,0 +1,36 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+// File:        ModuleBase_IDocumentDataModel.h
+// Created:     28 Apr 2015
+// Author:      Vitaly SMETANNIKOV
+
+
+#ifndef ModuleBase_IDocumentDataModel_H
+#define ModuleBase_IDocumentDataModel_H
+
+#include "ModuleBase.h"
+#include <QAbstractItemModel>
+#include <ModelAPI_Object.h>
+
+class MODULEBASE_EXPORT ModuleBase_IDocumentDataModel : public QAbstractItemModel
+{
+Q_OBJECT
+public:
+  ModuleBase_IDocumentDataModel(QObject* theParent): QAbstractItemModel(theParent) {}
+
+  //! Returns an object by the given Model index.
+  //! Returns 0 if the given index is not index of an object
+  virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
+
+  //! Returns index of the object
+  //! \param theObject object to find
+  virtual QModelIndex objectIndex(const ObjectPtr theObject) const = 0;
+
+  //! Clear internal data
+  virtual void clear() {}
+
+  //! Rebuild data tree
+  virtual void rebuildDataTree() {}
+};
+
+#endif
\ No newline at end of file
index 65a5c5a5a8b66b5b4541c54693604c673f24e928..ef8daaecdaa9368a6bcce0e3e7a7a3da4759a7a5 100644 (file)
@@ -23,6 +23,7 @@ class Config_WidgetAPI;
 class ModuleBase_ModelWidget;\r
 class ModuleBase_Operation;\r
 class ModuleBase_IWorkshop;\r
+class ModuleBase_IDocumentDataModel;\r
 \r
 /**\r
  * \ingroup GUI\r
@@ -78,11 +79,11 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \param theMenu a popup menu to be shown in the viewer\r
   /// \param theStdActions a map of standard actions\r
   /// \return true if items are added and there is no necessity to provide standard menu\r
-  virtual bool addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const { return false; }\r
+  virtual bool addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const { return false; }\r
 \r
   /// Add menu atems for object browser into the given menu\r
   /// \param theMenu a popup menu to be shown in the object browser\r
-  virtual void addObjectBrowserItems(QMenu* theMenu) const {};\r
+  virtual void addObjectBrowserMenu(QMenu* theMenu) const {};\r
 \r
   /// Called when it is necessary to update a command state (enable or disable it)\r
   //virtual bool isFeatureEnabled(const QString& theCmdId) const = 0;\r
@@ -120,6 +121,9 @@ class MODULEBASE_EXPORT ModuleBase_IModule : public QObject
   /// \returns true if the action is processed\r
   virtual bool deleteObjects() { return false; };\r
 \r
+  /// Returns data model object for representation of data tree in Object browser\r
+  virtual ModuleBase_IDocumentDataModel* dataModel() const = 0;\r
+\r
   /// Returns a list of modes, where the AIS objects should be activated\r
   /// \param theModes a list of modes\r
   virtual void activeSelectionModes(QIntList& theModes) {};\r
index b42db0d7f5f99623b53f37489a58b0758260f511..5fa98fc5db0d58d8552e91a059219f65cfe97a00 100644 (file)
@@ -11,6 +11,7 @@
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_AttributeRefAttr.h>
+#include <ModelAPI_ResultParameter.h>
 
 #include <GeomDataAPI_Point2D.h>
 #include <Events_Error.h>
@@ -187,6 +188,24 @@ TopAbs_ShapeEnum shapeType(const QString& theType)
   return TopAbs_SHAPE;
 }
 
+void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter)
+{
+  hasResult = false;
+  hasFeature = false;
+  hasParameter = false;
+  foreach(ObjectPtr aObj, theObjects) {
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
+    ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
+
+    hasResult = (aResult.get() != NULL);
+    hasFeature = (aFeature.get() != NULL);
+    hasParameter = (aConstruction.get() != NULL);
+    if (hasFeature && hasResult  && hasParameter)
+      break;
+  }
+}
+
 
 }
 
index 7bb5ababfee38a43b06c4a38ec70cd9277fe1787..410f01de2b77459e2df124391b060fbc968ec858 100644 (file)
@@ -8,6 +8,7 @@
 #define ModuleBase_Tools_H
 
 #include "ModuleBase.h"
+#include "ModuleBase_Definitions.h"
 
 #include <ModelAPI_Feature.h>
 #include <TopAbs_ShapeEnum.hxx>
@@ -77,6 +78,14 @@ MODULEBASE_EXPORT QString objectInfo(const ObjectPtr& theObj, const bool isUseAt
 /// \return TopAbs_ShapeEnum value
 MODULEBASE_EXPORT TopAbs_ShapeEnum shapeType(const QString& theType);
 
+/*!
+Check types of objects which are in the given list
+\param theObjects the list of objects
+\param hasResult will be set to true if list contains Result objects
+\param hasFeature will be set to true if list contains Feature objects
+\param hasParameter will be set to true if list contains Parameter objects
+*/
+MODULEBASE_EXPORT void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
 }
 
 #endif
index cddf1a2a0307f1c6850b378cc4d94ee83eedc948..88d61de5bbb4f0f32c2a65d8bc39d4ebfba2445d 100644 (file)
@@ -506,7 +506,7 @@ void NewGeom_Module::selectionChanged()
 //******************************************************
 void NewGeom_Module::contextMenuPopup(const QString& theClient, QMenu* theMenu, QString& theTitle)
 {
-  myWorkshop->contextMenuMgr()->addViewerItems(theMenu);
+  myWorkshop->contextMenuMgr()->addViewerMenu(theMenu);
   LightApp_Module::contextMenuPopup(theClient, theMenu, theTitle);
 }
 
index d254192961fc430f65667c8edfb12bfd195298cd..048fba1e1e803786339f8a21d89e5fe809a51837 100644 (file)
@@ -13,6 +13,7 @@ SET(PROJECT_HEADERS
        PartSet_WidgetSketchLabel.h
        PartSet_Validators.h
        PartSet_WidgetPoint2d.h
+       PartSet_WidgetPoint2dAngle.h
        PartSet_WidgetEditor.h
        PartSet_WidgetMultiSelector.h
        PartSet_WidgetPoint2dDistance.h
@@ -20,6 +21,9 @@ SET(PROJECT_HEADERS
        PartSet_Filters.h
        PartSet_SketcherMgr.h
        PartSet_MenuMgr.h
+    PartSet_DocumentDataModel.h
+    PartSet_PartDataModel.h
+    PartSet_DataTreeModel.h
 )
 
 SET(PROJECT_SOURCES
@@ -31,11 +35,14 @@ SET(PROJECT_SOURCES
        PartSet_WidgetEditor.cpp
        PartSet_WidgetMultiSelector.cpp
        PartSet_WidgetPoint2d.cpp
+       PartSet_WidgetPoint2dAngle.cpp
        PartSet_WidgetPoint2dDistance.cpp
        PartSet_WidgetShapeSelector.cpp
        PartSet_Filters.cpp
        PartSet_SketcherMgr.cpp
        PartSet_MenuMgr.cpp
+    PartSet_DocumentDataModel.cpp
+    PartSet_PartDataModel.cpp
 )
 
 SET(PROJECT_RESOURCES 
@@ -85,6 +92,7 @@ INCLUDE_DIRECTORIES(${CMAKE_SOURCE_DIR}/src/XGUI
                     ${CMAKE_SOURCE_DIR}/src/SketchPlugin
                     ${CMAKE_SOURCE_DIR}/src/SketcherPrs
                     ${CMAKE_SOURCE_DIR}/src/FeaturesPlugin
+                    ${CMAKE_SOURCE_DIR}/src/PartSetPlugin
                     ${CMAKE_SOURCE_DIR}/src/GeomAPI
                     ${CMAKE_SOURCE_DIR}/src/GeomValidators
                     ${CMAKE_SOURCE_DIR}/src/AppElements
diff --git a/src/PartSet/PartSet_DataTreeModel.h b/src/PartSet/PartSet_DataTreeModel.h
new file mode 100644 (file)
index 0000000..cb71be8
--- /dev/null
@@ -0,0 +1,96 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+#ifndef PartSet_DataTreeModel_H
+#define PartSet_DataTreeModel_H
+
+#include "PartSet.h"
+
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_ResultPart.h>
+
+#include <QAbstractItemModel>
+#include <QColor>
+
+/**\class PartSet_FeaturesModel
+ * \ingroup GUI
+ * \brief Abstaract class of model object which operates with features data.
+ */
+class PARTSET_EXPORT PartSet_FeaturesModel : public QAbstractItemModel
+{
+ public:
+   /// Constructor
+   /// \param theParent a parent object
+  PartSet_FeaturesModel(QObject* theParent)
+      : QAbstractItemModel(theParent),
+        myItemsColor(Qt::black)
+  {
+  }
+
+  //! Returns Feature object by the given Model index.
+  //! Returns 0 if the given index is not index of a feature
+  /// \param theIndex a model index
+  virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
+
+  //! Returns QModelIndex which corresponds to the given feature
+  //! If the feature is not found then index is not valid
+  virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
+
+  //! Returns parent index of the given feature
+  virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
+
+  //! Returns index corresponded to the group
+  //! \param theGroup a group name
+  virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
+
+  //! Set color of items
+  void setItemsColor(const QColor& theColor)
+  {
+    myItemsColor = theColor;
+  }
+
+  //! Returns color of items
+  QColor itemsColor() const
+  {
+    return myItemsColor;
+  }
+
+ protected:
+   /// Color of items
+  QColor myItemsColor;
+};
+
+/**\class PartSet_PartModel
+ * \ingroup GUI
+ * \brief Abstaract class of model object which operates with parts data.
+ */
+class PartSet_PartModel : public PartSet_FeaturesModel
+{
+ public:
+   /// Constructor
+   /// \param theParent a parent object
+  PartSet_PartModel(QObject* theParent)
+      : PartSet_FeaturesModel(theParent)
+  {
+  }
+
+  /// Set part id
+  /// \param theId a new id
+  void setPartId(int theId)
+  {
+    myId = theId;
+  }
+
+  //! Returns true if the given document is a sub-document of this tree
+  //! \param theDoc a document to check
+  virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
+
+  //! Return a Part object
+  virtual ResultPartPtr part() const = 0;
+
+ protected:
+  //! Id of the current part object in the document
+  int myId;
+};
+
+#endif
diff --git a/src/PartSet/PartSet_DocumentDataModel.cpp b/src/PartSet/PartSet_DocumentDataModel.cpp
new file mode 100644 (file)
index 0000000..2041d5c
--- /dev/null
@@ -0,0 +1,682 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+#include "PartSet_DocumentDataModel.h"
+#include "PartSet_PartDataModel.h"
+#include "PartSet_Module.h"
+//#include "XGUI_Tools.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Events.h>
+#include <ModelAPI_Object.h>
+
+#include <Events_Loop.h>
+
+#include <Config_FeatureMessage.h>
+#include <ModuleBase_Tools.h>
+#include <ModuleBase_ActionInfo.h>
+
+#include <QIcon>
+#include <QString>
+#include <QBrush>
+
+#include <set>
+
+#define ACTIVE_COLOR QColor(0,72,140)
+#define PASSIVE_COLOR Qt::black
+
+QMap<QString, QString> PartSet_DocumentDataModel::myIcons;
+
+
+PartSet_DocumentDataModel::PartSet_DocumentDataModel(QObject* theParent)
+    : ModuleBase_IDocumentDataModel(theParent),
+      myActivePart(0), myHistoryBackOffset(0)
+{
+  // Create a top part of data tree model
+  myModel = new PartSet_TopDataModel(this);
+  myModel->setItemsColor(ACTIVE_COLOR);
+
+  Events_Loop* aLoop = Events_Loop::loop();
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
+  aLoop->registerListener(this, Events_Loop::eventByName(Config_FeatureMessage::GUI_EVENT()));
+}
+
+PartSet_DocumentDataModel::~PartSet_DocumentDataModel()
+{
+  clearModelIndexes();
+  clearSubModels();
+}
+
+void PartSet_DocumentDataModel::processEvent(const std::shared_ptr<Events_Message>& theMessage)
+{
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+
+  // Created object event *******************
+  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
+    std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
+        std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+    std::set<ObjectPtr> aObjects = aUpdMsg->objects();
+
+    std::set<ObjectPtr>::const_iterator aIt;
+    for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
+      ObjectPtr aObject = (*aIt);
+      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+      if (aFeature && (!aFeature->isInHistory()))
+        continue;
+
+      DocumentPtr aDoc = aObject->document();
+      if (aDoc == aRootDoc) {  // If root objects
+        if (aObject->groupName() == ModelAPI_ResultPart::group()) {  // Update only Parts group
+            // Add a new part
+          int aStart = myPartModels.size();
+          PartSet_PartDataModel* aModel = new PartSet_PartDataModel(this);
+          aModel->setPartId(myPartModels.count());
+          myPartModels.append(aModel);
+          insertRow(aStart, partFolderNode(0));
+        } else {  // Update top groups (other except parts
+          QModelIndex aIndex = myModel->findParent(aObject);
+          int aStart = myModel->rowCount(aIndex) - 1;
+          if (aStart < 0)
+            aStart = 0;
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+          insertRow(aStart, aIndex);
+        }
+      } else {  // if sub-objects of first level nodes
+        PartSet_PartModel* aPartModel = 0;
+        foreach (PartSet_PartModel* aPart, myPartModels) {
+          if (aPart->hasDocument(aDoc)) {
+            aPartModel = aPart;
+            break;
+          }
+        }
+        if (aPartModel) {
+          QModelIndex aIndex = aPartModel->findParent(aObject);
+          int aStart = aPartModel->rowCount(aIndex);  // check this index
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+          insertRow(aStart, aIndex);
+        } else
+          reset();
+      }
+    }
+    // Deleted object event ***********************
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
+    std::shared_ptr<ModelAPI_ObjectDeletedMessage> aUpdMsg =
+        std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
+    DocumentPtr aDoc = aUpdMsg->document();
+    std::set<std::string> aGroups = aUpdMsg->groups();
+
+    std::set<std::string>::const_iterator aIt;
+    for (aIt = aGroups.begin(); aIt != aGroups.end(); ++aIt) {
+      std::string aGroup = (*aIt);
+      if (aDoc == aRootDoc) {  // If root objects
+        if (aGroup == ModelAPI_ResultPart::group()) {  // Update only Parts group
+          int aStart = myPartModels.size() - 1;
+          if (aStart >= 0) {// MPV: this could be reproduced on close
+            removeSubModel(aStart);
+            removeRow(aStart, partFolderNode(0));
+            if (myActivePart && (!isPartSubModel(myActivePart))) {
+              myActivePart = 0;
+              myActivePartIndex = QModelIndex();
+              myModel->setItemsColor(ACTIVE_COLOR);
+            }
+          }
+        } else {  // Update top groups (other except parts
+          QModelIndex aIndex = myModel->findGroup(aGroup);
+          int aStart = myModel->rowCount(aIndex);
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+          removeRow(aStart, aIndex);
+        }
+      } else {
+        PartSet_PartModel* aPartModel = 0;
+        foreach (PartSet_PartModel* aPart, myPartModels) {
+          if (aPart->hasDocument(aDoc)) {
+            aPartModel = aPart;
+            break;
+          }
+        }
+        if (aPartModel) {
+          QModelIndex aIndex = aPartModel->findGroup(aGroup);
+          int aStart = aPartModel->rowCount(aIndex);
+          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
+          removeRow(aStart, aIndex);
+        }
+      }
+    }
+    // Deleted object event ***********************
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
+    //std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg = std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
+    //ObjectPtr aFeature = aUpdMsg->feature();
+    //DocumentPtr aDoc = aFeature->document();
+
+    // TODO: Identify the necessary index by the modified feature
+    QModelIndex aIndex;
+    emit dataChanged(aIndex, aIndex);
+
+    // Reset whole tree **************************
+  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(Config_FeatureMessage::GUI_EVENT())) {
+    std::shared_ptr<Config_FeatureMessage> aFeatureMsg =
+       std::dynamic_pointer_cast<Config_FeatureMessage>(theMessage);
+    if (!aFeatureMsg->isInternal()) {
+      ActionInfo aFeatureInfo;
+      aFeatureInfo.initFrom(aFeatureMsg);
+      // Remember features icons
+      myIcons[QString::fromStdString(aFeatureMsg->id())] = aFeatureInfo.iconFile;
+    }
+  } else {
+    rebuildDataTree();
+  }
+}
+
+void PartSet_DocumentDataModel::rebuildDataTree()
+{
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+
+  beginResetModel();
+  clearModelIndexes();
+
+  int aNbParts = aRootDoc->size(ModelAPI_ResultPart::group());
+  if (myPartModels.size() != aNbParts) {  // resize internal models
+    while (myPartModels.size() > aNbParts) {
+      delete myPartModels.last();
+      myPartModels.removeLast();
+    }
+    while (myPartModels.size() < aNbParts) {
+      myPartModels.append(new PartSet_PartDataModel(this));
+    }
+    for (int i = 0; i < myPartModels.size(); i++)
+      myPartModels.at(i)->setPartId(i);
+  }
+  endResetModel();
+}
+
+QVariant PartSet_DocumentDataModel::data(const QModelIndex& theIndex, int theRole) const
+{
+  if (!theIndex.isValid())
+    return QVariant();
+  QModelIndex aParent = theIndex.parent();
+
+  if ((theIndex.column() == 1) ) {
+    if ((theIndex.internalId() == HistoryNode) && (!aParent.isValid())) {
+      switch (theRole) {
+      case Qt::DecorationRole:
+        if (theIndex.row() == lastHistoryRow())
+          return QIcon(":pictures/arrow.png");
+      }
+    }
+    return QVariant();
+  }
+
+  switch (theIndex.internalId()) {
+    case PartsFolder:
+      switch (theRole) {
+        case Qt::DisplayRole:
+          return tr("Parts") + QString(" (%1)").arg(rowCount(theIndex));
+        case Qt::DecorationRole:
+          return QIcon(":pictures/constr_folder.png");
+        case Qt::ToolTipRole:
+          return tr("Parts folder");
+        case Qt::ForegroundRole:
+          if (myActivePart)
+              return QBrush(PASSIVE_COLOR);
+            else
+              return QBrush(ACTIVE_COLOR);
+        default:
+          return QVariant();
+      }
+      break;
+    case HistoryNode:
+      {
+        int aOffset = historyOffset();
+        DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+        ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
+        FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+        if (!aFeature)
+          return QVariant();
+        switch (theRole) {
+          case Qt::DisplayRole:
+            if (aFeature)
+              return aFeature->data()->name().c_str();
+            else
+              return QVariant();
+          case Qt::DecorationRole:
+            return featureIcon(aFeature);
+          case Qt::ToolTipRole:
+            return tr("Feature object");
+          case Qt::ForegroundRole:
+            if (theIndex.row() > lastHistoryRow())
+              return QBrush(Qt::lightGray);
+            else {
+              if (myActivePart)
+                return QBrush(PASSIVE_COLOR);
+              else
+                return QBrush(ACTIVE_COLOR);
+            }
+          default:
+            return QVariant();
+        }
+      }
+      break;
+  }
+  if (aParent.isValid() && (aParent.internalId() == PartsFolder)) {
+    return myPartModels.at(theIndex.row())->data(QModelIndex(), theRole);
+  }
+  return toSourceModelIndex(theIndex)->data(theRole);
+}
+
+QVariant PartSet_DocumentDataModel::headerData(int theSection, Qt::Orientation theOrient,
+                                            int theRole) const
+{
+  return QVariant();
+}
+
+int PartSet_DocumentDataModel::rowCount(const QModelIndex& theParent) const
+{
+  if (!theParent.isValid()) {
+    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+    // Size of external models
+    int aVal = historyOffset();
+    // Plus history size
+    aVal += aRootDoc->size(ModelAPI_Feature::group());
+    return aVal;
+  }
+  if (theParent.internalId() == PartsFolder) {
+    int aSize = myPartModels.size();
+    return myPartModels.size();
+  }
+  if (theParent.internalId() == HistoryNode) {
+    return 0;
+  }
+  QModelIndex* aParent = toSourceModelIndex(theParent);
+  const QAbstractItemModel* aModel = aParent->model();
+  if (!isSubModel(aModel))
+    return 0;
+
+  /*if (isPartSubModel(aModel)) {
+   if (aModel != myActivePart)
+   return 0;
+   }*/
+  return aModel->rowCount(*aParent);
+}
+
+int PartSet_DocumentDataModel::columnCount(const QModelIndex& theParent) const
+{
+  return 1;
+}
+
+QModelIndex PartSet_DocumentDataModel::index(int theRow, int theColumn,
+                                          const QModelIndex& theParent) const
+{
+  QModelIndex aIndex;
+  if (!theParent.isValid()) {
+    int aOffs = myModel->rowCount();
+    if (theRow < aOffs) {
+      aIndex = myModel->index(theRow, theColumn, theParent);
+      aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
+    } else {
+      if (theRow == aOffs)  // Create Parts node
+        aIndex = partFolderNode(theColumn);
+      else
+        // create history node
+        aIndex = createIndex(theRow, theColumn, HistoryNode);
+    }
+  } else {
+    if (theParent.internalId() == PartsFolder) {
+      aIndex = myPartModels.at(theRow)->index(0, theColumn, QModelIndex());
+    } else {
+      QModelIndex* aParent = (QModelIndex*) theParent.internalPointer();
+      aIndex = aParent->model()->index(theRow, theColumn, (*aParent));
+    }
+    aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
+  }
+  return aIndex;
+}
+
+QModelIndex PartSet_DocumentDataModel::parent(const QModelIndex& theIndex) const
+{
+  if ((theIndex.internalId() == PartsFolder) || (theIndex.internalId() == HistoryNode))
+    return QModelIndex();
+
+  QModelIndex* aIndex = toSourceModelIndex(theIndex);
+  const QAbstractItemModel* aModel = aIndex->model();
+  if (!isSubModel(aModel))
+    return QModelIndex();
+
+  if (isPartSubModel(aModel)) {
+    if (!aModel->parent(*aIndex).isValid()) {
+      return partFolderNode(theIndex.column());
+    }
+  }
+
+  QModelIndex aIndex1 = aModel->parent(*aIndex);
+  if (aIndex1.isValid())
+    return createIndex(aIndex1.row(), aIndex1.column(), (void*) getModelIndex(aIndex1));
+  return aIndex1;
+}
+
+bool PartSet_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
+{
+  if (!theParent.isValid())
+    return true;
+  return rowCount(theParent) > 0;
+}
+
+QModelIndex* PartSet_DocumentDataModel::toSourceModelIndex(const QModelIndex& theProxy) const
+{
+  QModelIndex* aIndexPtr = static_cast<QModelIndex*>(theProxy.internalPointer());
+  return aIndexPtr;
+}
+
+QModelIndex* PartSet_DocumentDataModel::findModelIndex(const QModelIndex& theIndex) const
+{
+  QList<QModelIndex*>::const_iterator aIt;
+  for (aIt = myIndexes.constBegin(); aIt != myIndexes.constEnd(); ++aIt) {
+    QModelIndex* aIndex = (*aIt);
+    if ((*aIndex) == theIndex)
+      return aIndex;
+  }
+  return 0;
+}
+
+QModelIndex* PartSet_DocumentDataModel::getModelIndex(const QModelIndex& theIndex) const
+{
+  QModelIndex* aIndexPtr = findModelIndex(theIndex);
+  if (!aIndexPtr) {
+    aIndexPtr = new QModelIndex(theIndex);
+    PartSet_DocumentDataModel* that = (PartSet_DocumentDataModel*) this;
+    that->myIndexes.append(aIndexPtr);
+  }
+  return aIndexPtr;
+}
+
+void PartSet_DocumentDataModel::clearModelIndexes()
+{
+  foreach (QModelIndex* aIndex, myIndexes) 
+    delete aIndex;
+  myIndexes.clear();
+}
+
+void PartSet_DocumentDataModel::clearSubModels()
+{
+  foreach (PartSet_PartModel* aPart, myPartModels) 
+    delete aPart;
+  myPartModels.clear();
+}
+
+ObjectPtr PartSet_DocumentDataModel::object(const QModelIndex& theIndex) const
+{
+  if (theIndex.internalId() == PartsFolder)
+    return ObjectPtr();
+  if (theIndex.internalId() == HistoryNode) {
+    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+    int aOffset = historyOffset();
+    return aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
+  }
+  QModelIndex* aIndex = toSourceModelIndex(theIndex);
+  if (!isSubModel(aIndex->model()))
+    return ObjectPtr();
+
+  const PartSet_FeaturesModel* aModel = dynamic_cast<const PartSet_FeaturesModel*>(aIndex->model());
+  return aModel->object(*aIndex);
+}
+
+bool PartSet_DocumentDataModel::insertRows(int theRow, int theCount, const QModelIndex& theParent)
+{
+  beginInsertRows(theParent, theRow, theRow + theCount - 1);
+  //endInsertRows();
+
+  // Update history
+  QModelIndex aRoot;
+  int aRow = rowCount(aRoot);
+  beginInsertRows(aRoot, aRow, aRow);
+  endInsertRows();
+
+  return true;
+}
+
+bool PartSet_DocumentDataModel::removeRows(int theRow, int theCount, const QModelIndex& theParent)
+{
+  beginRemoveRows(theParent, theRow, theRow + theCount - 1);
+  endRemoveRows();
+  return true;
+}
+
+void PartSet_DocumentDataModel::removeSubModel(int theModelId)
+{
+  PartSet_PartModel* aModel = myPartModels.at(theModelId);
+  QIntList aToRemove;
+  for (int i = 0; i < myIndexes.size(); i++) {
+    if (myIndexes.at(i)->model() == aModel)
+      aToRemove.append(i);
+  }
+  int aId;
+  while (aToRemove.size() > 0) {
+    aId = aToRemove.last();
+    delete myIndexes.at(aId);
+    myIndexes.removeAt(aId);
+    aToRemove.removeLast();
+  }
+  delete aModel;
+  myPartModels.removeAt(theModelId);
+}
+
+bool PartSet_DocumentDataModel::isSubModel(const QAbstractItemModel* theModel) const
+{
+  if (theModel == myModel)
+    return true;
+  return isPartSubModel(theModel);
+}
+
+bool PartSet_DocumentDataModel::isPartSubModel(const QAbstractItemModel* theModel) const
+{
+  return myPartModels.contains((PartSet_PartModel*) theModel);
+}
+
+QModelIndex PartSet_DocumentDataModel::partFolderNode(int theColumn) const
+{
+  int aPos = myModel->rowCount(QModelIndex());
+  return createIndex(aPos, theColumn, PartsFolder);
+}
+
+int PartSet_DocumentDataModel::historyOffset() const
+{
+  // Nb of rows of top model + Parts folder
+  return myModel->rowCount(QModelIndex()) + 1;
+}
+
+bool PartSet_DocumentDataModel::activatePart(const QModelIndex& theIndex)
+{
+  if ((theIndex.internalId() == PartsFolder) || (theIndex.internalId() == HistoryNode))
+    return false;
+
+  QModelIndex* aIndex = toSourceModelIndex(theIndex);
+  if (!aIndex)
+    return false;
+
+  const QAbstractItemModel* aModel = aIndex->model();
+
+  if (isPartSubModel(aModel)) {
+    // if this is root node (Part item index)
+    if (!aIndex->parent().isValid()) {
+      if (myActivePart)
+        myActivePart->setItemsColor(PASSIVE_COLOR);
+
+        if (myActivePart == aModel) {
+          myActivePart = 0;
+          myActivePartIndex = QModelIndex();
+        } else {
+          myActivePart = (PartSet_PartModel*)aModel;
+          myActivePartIndex = theIndex;
+        }
+
+        if (myActivePart) {
+          myActivePart->setItemsColor(ACTIVE_COLOR);
+          myModel->setItemsColor(PASSIVE_COLOR);
+        } else
+          myModel->setItemsColor(ACTIVE_COLOR);
+        return true;
+      }
+    }
+  return false;
+}
+
+ResultPartPtr PartSet_DocumentDataModel::activePart() const
+{
+  if (myActivePart)
+    return myActivePart->part();
+  return ResultPartPtr();
+}
+
+void PartSet_DocumentDataModel::deactivatePart()
+{
+  if (myActivePart)
+    myActivePart->setItemsColor(PASSIVE_COLOR);
+    myActivePart = 0;
+    myActivePartIndex = QModelIndex();
+    myModel->setItemsColor(ACTIVE_COLOR);
+  }
+
+Qt::ItemFlags PartSet_DocumentDataModel::flags(const QModelIndex& theIndex) const
+{
+  Qt::ItemFlags aFlags = QAbstractItemModel::flags(theIndex); //Qt::ItemIsSelectable; 
+  if (object(theIndex)) {
+    aFlags |= Qt::ItemIsEditable;
+  }
+  // Disable items which are below of last history row
+  // Do not disable second column
+  //if (theIndex.row() <= lastHistoryRow() || theIndex.column() == 1) {
+  //  aFlags |= Qt::ItemIsEnabled;
+  //}
+  return aFlags;
+}
+
+QModelIndex PartSet_DocumentDataModel::partIndex(const ResultPartPtr& theObject) const
+{
+  int aRow = -1;
+  PartSet_PartModel* aModel = 0;
+  foreach (PartSet_PartModel* aPartModel, myPartModels)
+  {
+    aRow++;
+    if (aPartModel->part() == theObject) {
+      aModel = aPartModel;
+      break;
+    }
+  }
+  if (aModel) {
+    return createIndex(aRow, 0, (void*) getModelIndex(aModel->index(0, 0, QModelIndex())));
+  }
+  return QModelIndex();
+}
+
+QModelIndex PartSet_DocumentDataModel::objectIndex(const ObjectPtr theObject) const
+{
+  // Check that this feature belongs to root document
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+  DocumentPtr aDoc = theObject->document();
+  if (aDoc == aRootDoc) {
+    // This feature belongs to histrory or top model
+    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
+    if (aFeature) {
+      int aId;
+      int aNb = aRootDoc->size(ModelAPI_Feature::group());
+      for (aId = 0; aId < aNb; aId++) {
+        if (theObject == aRootDoc->object(ModelAPI_Feature::group(), aId))
+          break;
+      }
+      if (aId < aNb)
+        return index(aId + historyOffset(), 0, QModelIndex());
+    } else {
+      QModelIndex aIndex = myModel->objectIndex(theObject);
+      return
+          aIndex.isValid() ?
+              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
+              QModelIndex();
+    }
+  } else {
+    PartSet_PartModel* aPartModel = 0;
+    foreach(PartSet_PartModel* aModel, myPartModels)
+    {
+      if (aModel->hasDocument(aDoc)) {
+        aPartModel = aModel;
+        break;
+      }
+    }
+    if (aPartModel) {
+      QModelIndex aIndex = aPartModel->objectIndex(theObject);
+      return
+          aIndex.isValid() ?
+              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
+              QModelIndex();
+    }
+  }
+  return QModelIndex();
+}
+
+
+void PartSet_DocumentDataModel::clear()
+{
+  clearModelIndexes();
+  clearSubModels();
+  myActivePart = 0;
+  myActivePartIndex = QModelIndex();
+  myModel->setItemsColor(ACTIVE_COLOR);
+}
+
+int PartSet_DocumentDataModel::lastHistoryRow() const
+{
+  return rowCount() - 1 - myHistoryBackOffset;
+}
+
+void PartSet_DocumentDataModel::setLastHistoryItem(const QModelIndex& theIndex)
+{
+  if (theIndex.internalId() == HistoryNode) {
+    myHistoryBackOffset = rowCount() - 1 - theIndex.row();
+  }
+}
+
+QModelIndex PartSet_DocumentDataModel::lastHistoryItem() const
+{
+  return index(lastHistoryRow(), 1);
+}
+
+
+QIcon PartSet_DocumentDataModel::featureIcon(const FeaturePtr& theFeature)
+{
+  QIcon anIcon;
+
+  std::string aKind = theFeature->getKind();
+  QString aId(aKind.c_str());
+  if (!myIcons.contains(aId))
+    return anIcon;
+
+  QString anIconString = myIcons[aId];
+
+  ModelAPI_ExecState aState = theFeature->data()->execState();
+  switch(aState) {
+    case ModelAPI_StateDone:
+    case ModelAPI_StateNothing: {
+      anIcon = QIcon(anIconString);
+    }
+    break;
+    case ModelAPI_StateMustBeUpdated: {
+      anIcon = ModuleBase_Tools::lighter(anIconString);
+    }
+    break;
+    case ModelAPI_StateExecFailed: {
+      anIcon = ModuleBase_Tools::composite(":icons/exec_state_failed.png", anIconString);
+    }
+    break;
+    case ModelAPI_StateInvalidArgument: {
+      anIcon = ModuleBase_Tools::composite(":icons/exec_state_invalid_parameters.png",
+                                           anIconString);
+    }
+    break;
+    default: break;  
+  }
+  return anIcon;  
+}
+
diff --git a/src/PartSet/PartSet_DocumentDataModel.h b/src/PartSet/PartSet_DocumentDataModel.h
new file mode 100644 (file)
index 0000000..942d157
--- /dev/null
@@ -0,0 +1,196 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+#ifndef PartSet_DocumentDataModel_H
+#define PartSet_DocumentDataModel_H
+
+#include "PartSet.h"
+#include <ModuleBase_Definitions.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_Feature.h>
+#include <ModuleBase_IDocumentDataModel.h>
+
+#include <Events_Listener.h>
+#include <QList>
+
+class ModelAPI_Document;
+class PartSet_PartModel;
+class PartSet_TopDataModel;
+
+/**\class PartSet_DocumentDataModel
+ * \ingroup GUI
+ * \brief This is a proxy data model for Object Browser (QTreeView).
+ * It contains several sub-models for generation of each sub-part of data tree.
+ */
+class PARTSET_EXPORT PartSet_DocumentDataModel : public ModuleBase_IDocumentDataModel, public Events_Listener
+{
+Q_OBJECT
+ public:
+   /// Constructor
+   /// \param theParent a parent object
+  PartSet_DocumentDataModel(QObject* theParent);
+  virtual ~PartSet_DocumentDataModel();
+
+  /// Event Listener method
+  /// \param theMessage an event message
+  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
+
+  /// Returns the data stored under the given role for the item referred to by the index.
+  /// \param theIndex a model index
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+
+  /// Returns the data for the given role and section in the header with the specified orientation.
+  /// \param theSection a section
+  /// \param theOrient an orientation
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
+                                  Qt::DisplayRole) const;
+
+  /// Returns the number of rows under the given parent. When the parent is valid it means that 
+  /// rowCount is returning the number of children of parent.
+  /// \param theParent a parent model index
+  virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
+
+  /// Returns the number of columns for the children of the given parent.
+  /// It has a one column
+  /// \param theParent a parent model index
+  virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
+
+  /// Returns the index of the item in the model specified by the given row, column and parent index.
+  /// \param theRow a row
+  /// \param theColumn a column
+  /// \param theParent a parent model index
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent =
+                                QModelIndex()) const;
+
+  /// Returns the parent of the model item with the given index. 
+  /// If the item has no parent, an invalid QModelIndex is returned.
+  /// \param theIndex a model index
+  virtual QModelIndex parent(const QModelIndex& theIndex) const;
+
+  /// Returns true if parent has any children; otherwise returns false.
+  /// \param theParent a parent model index
+  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+
+  /// Inserts count rows into the model before the given row. 
+  /// Items in the new row will be children of the item represented by the parent model index.
+  /// \param theRow a start row
+  /// \param theCount a nember of rows to insert
+  /// \param theParent a parent model index
+  bool insertRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
+
+  /// Removes count rows starting with the given row under parent parent from the model.
+  /// \param theRow a start row
+  /// \param theCount a nember of rows to remove
+  /// \param theParent a parent model index
+  bool removeRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
+
+  /// Returns the item flags for the given index.
+  /// \param theIndex a model index
+  virtual Qt::ItemFlags flags(const QModelIndex& theIndex) const;
+
+  //! Returns an object by the given Model index.
+  //! Returns 0 if the given index is not index of an object
+  virtual ObjectPtr object(const QModelIndex& theIndex) const;
+
+  //! Returns index of the object
+  //! \param theObject object to find
+  virtual QModelIndex objectIndex(const ObjectPtr theObject) const;
+
+  //! Returns QModelIndex which corresponds to the given part
+  //! If the object is not found then index is not valid
+  //! \param thePart a part for analysis
+  QModelIndex partIndex(const ResultPartPtr& thePart) const;
+
+  //! Activates a part data model if the index is a Part node index. 
+  //! Returns true if active part changed.
+  //! \param theIndex a model index
+  bool activatePart(const QModelIndex& theIndex);
+
+  //! Retrurns active part
+  ResultPartPtr activePart() const;
+
+  //! Retrurns QModelIndex of active part
+  QModelIndex activePartIndex() const
+  {
+    return myActivePartIndex;
+  }
+
+  //! Deactivates a Part
+  void deactivatePart();
+
+  //! Rebuild data tree
+  virtual void rebuildDataTree();
+
+  //! Clear internal data
+  virtual void clear();
+
+  //! Set an Index which will be considered as a last history index
+  //! \param theIndex a last index for history
+  void setLastHistoryItem(const QModelIndex& theIndex);
+
+  QModelIndex lastHistoryItem() const;
+
+  //! Returns icon name according to feature
+  static QIcon featureIcon(const FeaturePtr& theFeature);
+
+ private:
+
+  enum
+  {
+    PartsFolder,
+    HistoryNode
+  };
+
+  //! Converts QModelIndex of this model to QModelIndex of a one of sub-models.
+  QModelIndex* toSourceModelIndex(const QModelIndex& theProxy) const;
+
+  //! Finds a pointer on QModelIndex which is equal to the given one
+  QModelIndex* findModelIndex(const QModelIndex& theIndex) const;
+
+  //! Returns pointer on QModelIndex which is equal to the given one.
+  QModelIndex* getModelIndex(const QModelIndex& theIndex) const;
+
+  //! Deletes all saved pointers on QModelIndex objects.
+  void clearModelIndexes();
+
+  //! Deletes all saved pointers on QModelIndex objects.
+  void clearSubModels();
+
+  //! Removes sub-model on removing a part object. Also it removes QModelIndex-es which refer to this model
+  void removeSubModel(int theModelId);
+
+  //! Returns true if the given model is a one of sub-models (of both types)
+  bool isSubModel(const QAbstractItemModel* theModel) const;
+
+  //! Returns true if the given model is a one of sub-models of Part type
+  bool isPartSubModel(const QAbstractItemModel* theModel) const;
+
+  //! Returns Parts Folder node
+  //! \param theColumn an Id of column
+  QModelIndex partFolderNode(int theColumn) const;
+
+  int lastHistoryRow() const;
+
+  int historyOffset() const;
+
+  //! Data model of top part of data tree (not parts object)
+  PartSet_TopDataModel* myModel;
+
+  //! Data models for Parts data tree representation (one data model per a one part)
+  QList<PartSet_PartModel*> myPartModels;
+
+  //! Active part in part editing mode
+  PartSet_PartModel* myActivePart;
+
+  QModelIndex myActivePartIndex;
+
+  //! List of saved QModelIndexes created by sub-models
+  QList<QModelIndex*> myIndexes;
+
+  int myHistoryBackOffset;
+
+  static QMap<QString, QString> myIcons;
+};
+
+#endif
index 42f95fb3343b62fafbb6941d423923fc77f86768..e453a552554d43bf271df38a0370c5203fbd917c 100644 (file)
@@ -28,6 +28,8 @@
 #include <Events_Loop.h>
 #include <ModelAPI_Events.h>
 #include <ModelAPI_Session.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultParameter.h>
 
 #include <QAction>
 #include <QMenu>
@@ -60,11 +62,28 @@ void PartSet_MenuMgr::addAction(const QString& theId, QAction* theAction)
 
 void PartSet_MenuMgr::createActions()
 {
-  QAction* anAction;
+  QAction* aAction;
 
-  anAction = new QAction(tr("Auxiliary"), this);
-  anAction->setCheckable(true);
-  addAction("AUXILIARY_CMD", anAction);
+  aAction = new QAction(tr("Auxiliary"), this);
+  aAction->setCheckable(true);
+  addAction("AUXILIARY_CMD", aAction);
+
+  aAction = new QAction(QIcon(":icons/activate.png"), tr("Activate"), this);
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePart(bool)));
+  myActions["ACTIVATE_PART_CMD"] = aAction;
+
+  aAction = new QAction(QIcon(":icons/deactivate.png"), tr("Deactivate"), this);
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
+  myActions["DEACTIVATE_PART_CMD"] = aAction;
+
+  // Activate PartSet
+  aAction = new QAction(QIcon(":icons/activate.png"), tr("Activate"), this);
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onActivatePartSet(bool)));
+  myActions["ACTIVATE_PARTSET_CMD"] = aAction;
+
+  aAction = new QAction(QIcon(":icons/edit.png"), tr("Edit..."), this);
+  connect(aAction, SIGNAL(triggered(bool)), this, SLOT(onEdit(bool)));
+  myActions["EDIT_CMD"] = aAction;
 }
 
 
@@ -137,7 +156,7 @@ void findCoincidences(FeaturePtr theStartCoin, QList<FeaturePtr>& theList, std::
 }
 
 
-bool PartSet_MenuMgr::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
+bool PartSet_MenuMgr::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
 {
   ModuleBase_Operation* anOperation = myModule->workshop()->currentOperation();
   if (!PartSet_SketcherMgr::isSketchOperation(anOperation) &&
@@ -446,3 +465,35 @@ bool PartSet_MenuMgr::canSetAuxiliary(bool& theValue) const
   theValue = anObjects.size() && !isNotAuxiliaryFound;
   return anEnabled;
 }
+
+void PartSet_MenuMgr::onActivatePart(bool)
+{
+  QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
+  if (aObjects.size() > 0) {
+    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
+    if (aPart) {
+      aPart->activate();
+    }
+  }
+}
+
+void PartSet_MenuMgr::onActivatePartSet(bool)
+{
+  SessionPtr aMgr = ModelAPI_Session::get();
+  aMgr->setActiveDocument(aMgr->moduleDocument());
+}
+
+void PartSet_MenuMgr::onEdit(bool)
+{
+  QObjectPtrList aObjects = myModule->workshop()->selection()->selectedObjects();
+  FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjects.first());
+  if (aFeature == NULL) {
+    ResultParameterPtr aParam = 
+      std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObjects.first());
+    if (aParam.get() != NULL) {
+      aFeature = ModelAPI_Feature::feature(aParam);
+    }
+  }
+  if (aFeature.get() != NULL)
+    myModule->editFeature(aFeature);
+}
index 117098644fe0f4e76b69d584c7a35bd7554a84c1..93f545360bc5f771b99c94e244ba4d5f4abe41ec 100644 (file)
@@ -40,7 +40,7 @@ public:
   /// \param theMenu a popup menu to be shown in the viewer
   /// \param theStdActions a map of standard actions
   /// \return true if items are added and there is no necessity to provide standard menu
-  bool addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const;
+  bool addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const;
 
 public slots:
   /// Processes the context menu action click
@@ -60,6 +60,15 @@ private slots:
   /// \param theAction an action of the selected item
   void onLineDetach(QAction* theAction);
 
+  /// A slot called on Part activation command
+  void onActivatePart(bool);
+
+  /// A slot called on PartSet activation command
+  void onActivatePartSet(bool);
+
+  /// A slot called on edit of feature
+  void onEdit(bool);
+
 private:
   /// Returns true if the current operation is sketch entity create operation
   /// \param theValue the current auxiliary value
index 662e3d1bcaaf23c675f86a30b026ce7b0f934d3f..8fc18d64cc18c85c42eac208c830abe18196f722 100644 (file)
@@ -1,16 +1,21 @@
 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D
 
 #include "PartSet_Module.h"
-#include <PartSet_WidgetSketchLabel.h>
-#include <PartSet_Validators.h>
-#include <PartSet_Tools.h>
-#include <PartSet_WidgetPoint2d.h>
-#include <PartSet_WidgetPoint2dDistance.h>
-#include <PartSet_WidgetShapeSelector.h>
-#include <PartSet_WidgetMultiSelector.h>
-#include <PartSet_WidgetEditor.h>
+#include "PartSet_WidgetSketchLabel.h"
+#include "PartSet_Validators.h"
+#include "PartSet_Tools.h"
+#include "PartSet_WidgetPoint2d.h"
+#include "PartSet_WidgetPoint2dDistance.h"
+#include "PartSet_WidgetShapeSelector.h"
+#include "PartSet_WidgetPoint2dAngle.h"
+#include "PartSet_WidgetMultiSelector.h"
+#include "PartSet_WidgetEditor.h"
 #include "PartSet_SketcherMgr.h"
 #include "PartSet_MenuMgr.h"
+#include "PartSet_DocumentDataModel.h"
+
+#include <PartSetPlugin_Remove.h>
+#include <PartSetPlugin_Part.h>
 
 #include <ModuleBase_Operation.h>
 #include <ModuleBase_IViewer.h>
@@ -18,7 +23,9 @@
 #include <ModuleBase_IPropertyPanel.h>
 #include <ModuleBase_WidgetEditor.h>
 #include <ModuleBase_FilterFactory.h>
+#include <ModuleBase_Tools.h>
 #include <GeomValidators_ShapeType.h>
+
 #include <GeomValidators_Face.h>
 #include <GeomValidators_ConstructionComposite.h>
 
@@ -41,6 +48,7 @@
 #include <XGUI_ModuleConnector.h>
 #include <XGUI_ContextMenuMgr.h>
 #include <XGUI_Tools.h>
+#include <XGUI_ObjectsBrowser.h>
 
 #include <SketchPlugin_Feature.h>
 #include <SketchPlugin_Sketch.h>
@@ -75,6 +83,7 @@
 #include <QApplication>
 #include <QMessageBox>
 #include <QMainWindow>
+#include <QLineEdit>
 
 #include <GeomAlgoAPI_FaceBuilder.h>
 #include <GeomDataAPI_Dir.h>
@@ -83,6 +92,8 @@
 #include <QDebug>
 #endif
 
+
+
 /*!Create and return new instance of XGUI_Module*/
 extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop* theWshop)
 {
@@ -90,10 +101,11 @@ extern "C" PARTSET_EXPORT ModuleBase_IModule* createModule(ModuleBase_IWorkshop*
 }
 
 PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
-  : ModuleBase_IModule(theWshop), 
+  : ModuleBase_IModule(theWshop),
   myRestartingMode(RM_None), myVisualLayerId(0)
 {
   mySketchMgr = new PartSet_SketcherMgr(this);
+  myDataModel = new PartSet_DocumentDataModel(this);
 
   XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(theWshop);
   XGUI_Workshop* aWorkshop = aConnector->workshop();
@@ -110,6 +122,9 @@ PartSet_Module::PartSet_Module(ModuleBase_IWorkshop* theWshop)
           SLOT(onViewTransformed(int)));
 
   myMenuMgr = new PartSet_MenuMgr(this);
+
+  Events_Loop* aLoop = Events_Loop::loop();
+  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
 }
 
 PartSet_Module::~PartSet_Module()
@@ -280,9 +295,9 @@ bool PartSet_Module::canDisplayObject(const ObjectPtr& theObject) const
 }
 
 
-bool PartSet_Module::addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
+bool PartSet_Module::addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const
 {
-  return myMenuMgr->addViewerItems(theMenu, theStdActions);
+  return myMenuMgr->addViewerMenu(theMenu, theStdActions);
 }
 
 void PartSet_Module::activeSelectionModes(QIntList& theModes)
@@ -462,7 +477,13 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
     aDistanceWgt->setWorkshop(aWorkshop);
     aDistanceWgt->setSketch(mySketchMgr->activeSketch());
     aWgt = aDistanceWgt;
-  } if (theType == "sketch_shape_selector") {
+  } if(theType == "point2dangle") {
+    PartSet_WidgetPoint2dAngle* anAngleWgt = new PartSet_WidgetPoint2dAngle(theParent, theWidgetApi, theParentId);
+    anAngleWgt->setWorkshop(aWorkshop);
+    anAngleWgt->setSketch(mySketchMgr->activeSketch());
+    aWgt = anAngleWgt;
+  }
+  if (theType == "sketch_shape_selector") {
     PartSet_WidgetShapeSelector* aShapeSelectorWgt =
       new PartSet_WidgetShapeSelector(theParent, workshop(), theWidgetApi, theParentId);
     aShapeSelectorWgt->setSketcher(mySketchMgr->activeSketch());
@@ -482,60 +503,73 @@ ModuleBase_ModelWidget* PartSet_Module::createWidgetByType(const std::string& th
 
 bool PartSet_Module::deleteObjects()
 {
+  SessionPtr aMgr = ModelAPI_Session::get();
   // 1. check whether the delete should be processed in the module
   ModuleBase_Operation* anOperation = myWorkshop->currentOperation();
   bool isSketchOp = PartSet_SketcherMgr::isSketchOperation(anOperation),
        isNestedOp = PartSet_SketcherMgr::isNestedSketchOperation(anOperation);
-  if (!isSketchOp && !isNestedOp)
-    return false;
-
-  // 2. find selected presentations
-  // selected objects should be collected before the current operation abort because
-  // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
-  XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
-  XGUI_Workshop* aWorkshop = aConnector->workshop();
-  ModuleBase_ISelection* aSel = workshop()->selection();
-  QObjectPtrList aSelectedObj = aSel->selectedPresentations();
-  // if there are no selected objects in the viewer, that means that the selection in another
-  // place cased this method. It is necessary to return the false value to understande in above
-  // method that delete is not processed
-  if (aSelectedObj.count() == 0)
-    return false;
-
-  // avoid delete of the objects, which are not belong to the current sketch
-  // in order to do not delete results of other sketches
-  QObjectPtrList aSketchObjects;
-  QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
-  for ( ; anIt != aLast; anIt++) {
-    ObjectPtr anObject = *anIt;
-    if (mySketchMgr->isObjectOfSketch(anObject))
-      aSketchObjects.append(anObject);
-  }
-  // if the selection contains only local selected presentations from other sketches,
-  // the Delete operation should not be done at all
-  if (aSketchObjects.size() == 0)
-    return true;
-
-  // the active nested sketch operation should be aborted unconditionally
-  if (isNestedOp)
-    anOperation->abort();
-
-  // 3. start operation
-  QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
-  SessionPtr aMgr = ModelAPI_Session::get();
-  aMgr->startOperation(aDescription.toStdString());
-
-  // 4. delete features
-  // sketch feature should be skipped, only sub-features can be removed
-  // when sketch operation is active
-  std::set<FeaturePtr> anIgnoredFeatures;
-  anIgnoredFeatures.insert(mySketchMgr->activeSketch());
-  aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures);
+  if (isSketchOp && isNestedOp) {
+    // 2. find selected presentations
+    // selected objects should be collected before the current operation abort because
+    // the abort leads to selection lost on constraint objects. It can be corrected after #386 issue
+    XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(workshop());
+    XGUI_Workshop* aWorkshop = aConnector->workshop();
+    ModuleBase_ISelection* aSel = workshop()->selection();
+    QObjectPtrList aSelectedObj = aSel->selectedPresentations();
+    // if there are no selected objects in the viewer, that means that the selection in another
+    // place cased this method. It is necessary to return the false value to understande in above
+    // method that delete is not processed
+    if (aSelectedObj.count() == 0)
+      return false;
+
+    // avoid delete of the objects, which are not belong to the current sketch
+    // in order to do not delete results of other sketches
+    QObjectPtrList aSketchObjects;
+    QObjectPtrList::const_iterator anIt = aSelectedObj.begin(), aLast = aSelectedObj.end();
+    for ( ; anIt != aLast; anIt++) {
+      ObjectPtr anObject = *anIt;
+      if (mySketchMgr->isObjectOfSketch(anObject))
+        aSketchObjects.append(anObject);
+    }
+    // if the selection contains only local selected presentations from other sketches,
+    // the Delete operation should not be done at all
+    if (aSketchObjects.size() == 0)
+      return true;
+
+    // the active nested sketch operation should be aborted unconditionally
+    if (isNestedOp)
+      anOperation->abort();
+
+    // 3. start operation
+    QString aDescription = aWorkshop->contextMenuMgr()->action("DELETE_CMD")->text();
+    aMgr->startOperation(aDescription.toStdString());
+
+    // 4. delete features
+    // sketch feature should be skipped, only sub-features can be removed
+    // when sketch operation is active
+    std::set<FeaturePtr> anIgnoredFeatures;
+    anIgnoredFeatures.insert(mySketchMgr->activeSketch());
+    aWorkshop->deleteFeatures(aSketchObjects, anIgnoredFeatures);
   
-  // 5. stop operation
-  aWorkshop->displayer()->updateViewer();
-  aMgr->finishOperation();
-
+    // 5. stop operation
+    aWorkshop->displayer()->updateViewer();
+    aMgr->finishOperation();
+  } else {
+    // Delete part with help of PartSet plugin
+    // TODO: the deleted objects has to be processed by multiselection
+    QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
+    if (aObjects.size() == 1) {
+      ObjectPtr aObj = aObjects.first();
+      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
+      if (aFeature.get() && (aFeature->getKind() == PartSetPlugin_Part::ID())) {
+        std::shared_ptr<ModelAPI_Document> aDoc = aMgr->activeDocument();
+        aMgr->startOperation(PartSetPlugin_Remove::ID());
+        FeaturePtr aFeature = aDoc->addFeature(PartSetPlugin_Remove::ID());
+        aFeature->execute();
+        aMgr->finishOperation();
+      }
+    }
+  }
   return true;
 }
 
@@ -604,3 +638,79 @@ void PartSet_Module::onViewTransformed(int theTrsfType)
   if (isModified)
     aDisplayer->updateViewer();
 }
+
+ModuleBase_IDocumentDataModel* PartSet_Module::dataModel() const
+{
+  return myDataModel;
+}
+
+
+void PartSet_Module::addObjectBrowserMenu(QMenu* theMenu) const
+{
+  QObjectPtrList aObjects = myWorkshop->selection()->selectedObjects();
+  int aSelected = aObjects.size();
+  if (aSelected == 1) {
+    bool hasResult = false;
+    bool hasFeature = false;
+    bool hasParameter = false;
+    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+
+    SessionPtr aMgr = ModelAPI_Session::get();
+    ObjectPtr aObject = aObjects.first();
+    if (aObject) {
+      ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+      if (aPart) {
+        if (aMgr->activeDocument() == aPart->partDoc())
+          theMenu->addAction(myMenuMgr->action("DEACTIVATE_PART_CMD"));
+        else
+          theMenu->addAction(myMenuMgr->action("ACTIVATE_PART_CMD"));
+      } else if (aObject->document() == aMgr->activeDocument()) {
+        if (hasParameter || hasFeature)
+          theMenu->addAction(myMenuMgr->action("EDIT_CMD"));
+      }
+    } else {  // If feature is 0 the it means that selected root object (document)
+      if (aMgr->activeDocument() != aMgr->moduleDocument())
+        theMenu->addAction(myMenuMgr->action("ACTIVATE_PARTSET_CMD"));
+    }
+  }
+}
+
+void PartSet_Module::processEvent(const std::shared_ptr<Events_Message>& theMessage)
+{
+  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
+    XGUI_ModuleConnector* aConnector = dynamic_cast<XGUI_ModuleConnector*>(myWorkshop);
+    XGUI_Workshop* aWorkshop = aConnector->workshop();
+    XGUI_DataTree* aTreeView = aWorkshop->objectBrowser()->treeView();
+    QLineEdit* aLabel = aWorkshop->objectBrowser()->activeDocLabel();
+    QPalette aPalet = aLabel->palette();
+
+    SessionPtr aMgr = ModelAPI_Session::get();
+    DocumentPtr aActiveDoc = aMgr->activeDocument();
+    DocumentPtr aDoc = aMgr->moduleDocument();
+    QModelIndex aOldIndex = myDataModel->activePartIndex();
+    if (aActiveDoc == aDoc) {
+      if (aOldIndex.isValid())
+        aTreeView->setExpanded(aOldIndex, false);
+      myDataModel->deactivatePart();
+      aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
+    } else {
+      std::string aGrpName = ModelAPI_ResultPart::group();
+      for (int i = 0; i < aDoc->size(aGrpName); i++) {
+        ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
+        if (aPart->partDoc() == aActiveDoc) {
+          QModelIndex aIndex = myDataModel->partIndex(aPart);
+          if ((aOldIndex != aIndex) && aOldIndex.isValid()) {
+            aTreeView->setExpanded(aOldIndex, false);
+          }
+          if (myDataModel->activatePart(aIndex)) {
+            aTreeView->setExpanded(aIndex.parent(), true);
+            aTreeView->setExpanded(aIndex, true);
+            aPalet.setColor(QPalette::Text, Qt::black);
+          }
+          break;
+        }
+      }
+    }
+    aLabel->setPalette(aPalet);
+  }
+}
\ No newline at end of file
index 9ba109a65eb3cf28b060765cdf98c4920f1c9fda..6da7807b23b8982261c2ebf5cbd05906da127edf 100644 (file)
@@ -12,6 +12,8 @@
 #include <ModelAPI_Attribute.h>
 #include <ModelAPI_CompositeFeature.h>
 
+#include <Events_Listener.h>
+
 //#include <StdSelect_FaceFilter.hxx>
 #include <TopoDS_Shape.hxx>
 
@@ -27,6 +29,7 @@ class ModuleBase_Operation;
 class ModuleBase_IViewWindow;
 class PartSet_MenuMgr;
 class PartSet_SketcherMgr;
+class PartSet_DocumentDataModel;
 
 class QAction;
 
@@ -34,7 +37,7 @@ class QAction;
 * \ingroup Modules
 * Implementation of Partset module
 */
-class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule
+class PARTSET_EXPORT PartSet_Module : public ModuleBase_IModule, public Events_Listener
 {
 Q_OBJECT
 
@@ -47,6 +50,7 @@ enum RestartingMode {
 };
 
 public:
+
   /// Constructor
   /// \param theWshop a pointer to a workshop
   PartSet_Module(ModuleBase_IWorkshop* theWshop);
@@ -97,11 +101,15 @@ public:
   /// \param theObject a model object
   virtual bool canDisplayObject(const ObjectPtr& theObject) const;
 
+  /// Add menu atems for object browser into the given menu
+  /// \param theMenu a popup menu to be shown in the object browser
+  virtual void addObjectBrowserMenu(QMenu* theMenu) const;
+
   /// Add menu atems for viewer into the given menu
   /// \param theMenu a popup menu to be shown in the viewer
   /// \param theStdActions a map of standard actions
   /// \return true if items are added and there is no necessity to provide standard menu
-  virtual bool addViewerItems(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const;
+  virtual bool addViewerMenu(QMenu* theMenu, const QMap<QString, QAction*>& theStdActions) const;
 
   /// Returns a list of modes, where the AIS objects should be activated
   /// \param theModes a list of modes
@@ -113,6 +121,13 @@ public:
 
   PartSet_SketcherMgr* sketchMgr() const { return mySketchMgr; }
 
+  /// Returns data model object for representation of data tree in Object browser
+  virtual ModuleBase_IDocumentDataModel* dataModel() const;
+
+  /// Event Listener method
+  /// \param theMessage an event message
+  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
+
 public slots:
   /// SLOT, that is called by no more widget signal emitted by property panel
   /// Set a specific flag to restart the sketcher operation
@@ -154,6 +169,10 @@ protected slots:
   /// \param theOperation the operation
   virtual void sendOperation(ModuleBase_Operation* theOperation);
 
+  //! Activates or deactivates a part
+  //! If PartPtr is Null pointer then PartSet will be activated
+  //void activatePart(std::shared_ptr<ModelAPI_ResultPart> theFeature);
+
  private slots:
    /// Processing of vertex selected
    void onVertexSelected();
@@ -184,6 +203,8 @@ protected slots:
   PartSet_MenuMgr* myMenuMgr;
 
   int myVisualLayerId;
+
+  PartSet_DocumentDataModel* myDataModel;
 };
 
 #endif
diff --git a/src/PartSet/PartSet_PartDataModel.cpp b/src/PartSet/PartSet_PartDataModel.cpp
new file mode 100644 (file)
index 0000000..21896e8
--- /dev/null
@@ -0,0 +1,567 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+#include "PartSet_PartDataModel.h"
+#include "PartSet_Module.h"
+#include "PartSet_DocumentDataModel.h"
+
+#include <ModelAPI_Session.h>
+#include <ModelAPI_Document.h>
+#include <ModelAPI_Feature.h>
+#include <ModelAPI_Result.h>
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDocRef.h>
+#include <ModelAPI_Object.h>
+#include <ModelAPI_ResultPart.h>
+#include <ModelAPI_ResultConstruction.h>
+#include <ModelAPI_ResultParameter.h>
+#include <ModelAPI_ResultBody.h>
+#include <ModelAPI_ResultGroup.h>
+#include <ModelAPI_AttributeDouble.h>
+
+#include <QIcon>
+#include <QBrush>
+
+
+PartSet_TopDataModel::PartSet_TopDataModel(QObject* theParent)
+    : PartSet_FeaturesModel(theParent)
+{
+}
+
+PartSet_TopDataModel::~PartSet_TopDataModel()
+{
+}
+
+QVariant PartSet_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
+{
+  switch (theRole) {
+    case Qt::DisplayRole:
+      // return a name
+      switch (theIndex.internalId()) {
+        case ParamsFolder:
+          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
+        case ParamObject: {
+          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
+          if (aObject) {
+            ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObject);
+            AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
+            QString aVal = QString::number(aValueAttribute->value());
+            QString aTitle = QString(aObject->data()->name().c_str());
+            return aTitle + " = " + aVal;
+          }
+        }
+          break;
+        case ConstructFolder:
+          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
+        case ConstructObject: {
+          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultConstruction::group(),
+                                               theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+          break;
+        //case GroupsFolder:
+        //  return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
+        //case GroupObject: {
+        //  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+        //  ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultGroup::group(),
+        //                                       theIndex.row());
+        //  if (aObject)
+        //    return aObject->data()->name().c_str();
+        //}
+        //  break;
+      }
+      break;
+
+    case Qt::DecorationRole:
+      {
+      // return an Icon
+      switch (theIndex.internalId()) {
+        case ParamsFolder:
+          return QIcon(":pictures/params_folder.png");
+        case ConstructFolder:
+          return QIcon(":pictures/constr_folder.png");
+        case ConstructObject:
+          return QIcon(":pictures/constr_object.png");
+        //case GroupsFolder:
+        //  return QIcon(":pictures/constr_folder.png");
+        }
+      }
+      break;
+
+    case Qt::ToolTipRole:
+      // return Tooltip
+      break;
+    case Qt::ForegroundRole:
+      return QBrush(myItemsColor);
+      break;
+  }
+  return QVariant();
+}
+
+QVariant PartSet_TopDataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+  return QVariant();
+}
+
+int PartSet_TopDataModel::rowCount(const QModelIndex& theParent) const
+{
+  if (!theParent.isValid())
+    return 2;  // In case of groups using it has to be +1
+
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+  if (theParent.internalId() == ParamsFolder)
+    return aRootDoc->size(ModelAPI_ResultParameter::group());
+
+  if (theParent.internalId() == ConstructFolder)
+    return aRootDoc->size(ModelAPI_ResultConstruction::group());
+
+  //if (theParent.internalId() == GroupsFolder)
+  //  return aRootDoc->size(ModelAPI_ResultGroup::group());
+
+  return 0;
+}
+
+int PartSet_TopDataModel::columnCount(const QModelIndex &parent) const
+{
+  return 1;
+}
+
+QModelIndex PartSet_TopDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const
+{
+  if (!theParent.isValid()) {
+    switch (theRow) {
+      case 0:
+        return createIndex(theRow, theColumn, (qint32) ParamsFolder);
+      case 1:
+        return createIndex(theRow, theColumn, (qint32) ConstructFolder);
+      //case 2:
+      //  return createIndex(theRow, theColumn, (qint32) GroupsFolder);
+    }
+  } else {
+    if (theParent.internalId() == ParamsFolder)
+      return createIndex(theRow, theColumn, (qint32) ParamObject);
+
+    if (theParent.internalId() == ConstructFolder)
+      return createIndex(theRow, theColumn, (qint32) ConstructObject);
+
+    //if (theParent.internalId() == GroupsFolder)
+    //  return createIndex(theRow, theColumn, (qint32) GroupObject);
+  }
+  return QModelIndex();
+}
+
+QModelIndex PartSet_TopDataModel::parent(const QModelIndex& theIndex) const
+{
+  int aId = (int) theIndex.internalId();
+  switch (aId) {
+    case ParamsFolder:
+    case ConstructFolder:
+    //case GroupsFolder:
+      return QModelIndex();
+    case ParamObject:
+      return createIndex(0, 0, (qint32) ParamsFolder);
+    case ConstructObject:
+      return createIndex(1, 0, (qint32) ConstructFolder);
+    //case GroupObject:
+    //  return createIndex(2, 0, (qint32) GroupsFolder);
+  }
+  return QModelIndex();
+}
+
+bool PartSet_TopDataModel::hasChildren(const QModelIndex& theParent) const
+{
+  return rowCount(theParent) > 0;
+}
+
+ObjectPtr PartSet_TopDataModel::object(const QModelIndex& theIndex) const
+{
+  switch (theIndex.internalId()) {
+    case ParamsFolder:
+    case ConstructFolder:
+      return ObjectPtr();
+    case ParamObject: {
+      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+      return aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
+    }
+    case ConstructObject: {
+      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+      return aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
+    }
+    //case GroupObject: {
+    //  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+    //  return aRootDoc->object(ModelAPI_ResultGroup::group(), theIndex.row());
+    //}
+  }
+  return ObjectPtr();
+}
+
+QModelIndex PartSet_TopDataModel::findParent(const ObjectPtr& theObject) const
+{
+  return findGroup(theObject->groupName().c_str());
+}
+
+QModelIndex PartSet_TopDataModel::findGroup(const std::string& theGroup) const
+{
+  if (theGroup == ModelAPI_ResultParameter::group())
+    return createIndex(0, 0, (qint32) ParamsFolder);
+  if (theGroup == ModelAPI_ResultConstruction::group())
+    return createIndex(1, 0, (qint32) ConstructFolder);
+  //if (theGroup == ModelAPI_ResultGroup::group())
+  //  return createIndex(2, 0, (qint32) ConstructFolder);
+  return QModelIndex();
+}
+
+QModelIndex PartSet_TopDataModel::objectIndex(const ObjectPtr& theObject) const
+{
+  QModelIndex aIndex;
+  if (theObject) {
+    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+    std::string aGroup = theObject->groupName();
+    int aNb = aRootDoc->size(aGroup);
+    int aRow = -1;
+    for (int i = 0; i < aNb; i++) {
+      if (aRootDoc->object(aGroup, i) == theObject) {
+        aRow = i;
+        break;
+      }
+    }
+    if (aRow != -1) {
+      if (aGroup == ModelAPI_ResultParameter::group())
+        return createIndex(aRow, 0, (qint32) ParamObject);
+      if (aGroup == ModelAPI_ResultConstruction::group())
+        return createIndex(aRow, 0, (qint32) ConstructObject);
+      //if (aGroup == ModelAPI_ResultGroup::group())
+      //  return createIndex(aRow, 0, (qint32) GroupObject);
+    }
+  }
+  return aIndex;
+}
+
+//******************************************************************
+//******************************************************************
+//******************************************************************
+PartSet_PartDataModel::PartSet_PartDataModel(QObject* theParent)
+    : PartSet_PartModel(theParent)
+{
+}
+
+PartSet_PartDataModel::~PartSet_PartDataModel()
+{
+}
+
+QVariant PartSet_PartDataModel::data(const QModelIndex& theIndex, int theRole) const
+{
+  switch (theRole) {
+    case Qt::DisplayRole:
+      // return a name
+      switch (theIndex.internalId()) {
+        case MyRoot: {
+          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
+          if (aObject)
+            return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+        }
+        case ParamsFolder:
+          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
+        case ConstructFolder:
+          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
+        case BodiesFolder:
+          return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
+        case GroupsFolder:
+          return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
+        case ParamObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameter::group(),
+                                                     theIndex.row());
+          if (aObject) {
+            ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObject);
+            AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
+            QString aVal = QString::number(aValueAttribute->value());
+            QString aTitle = QString(aObject->data()->name().c_str());
+            return aTitle + " = " + aVal;
+          }
+        }
+          break;
+        case ConstructObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(),
+                                                     theIndex.row());
+          if (aObject)
+            return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
+        }
+          break;
+        case BodiesObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+          break;
+        case GroupObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+        case HistoryObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
+          if (aObject)
+            return aObject->data()->name().c_str();
+        }
+      }
+      break;
+    case Qt::DecorationRole:
+      // return an Icon
+      switch (theIndex.internalId()) {
+        case MyRoot:
+          return QIcon(":pictures/part_ico.png");
+        case ParamsFolder:
+          return QIcon(":pictures/params_folder.png");
+        case ConstructFolder:
+        case BodiesFolder:
+          return QIcon(":pictures/constr_folder.png");
+        case GroupsFolder:
+          return QIcon(":pictures/constr_folder.png");
+        case ConstructObject:
+        case GroupObject:
+        case BodiesObject: {
+          std::string aGroup = theIndex.internalId() == ConstructObject ?
+            ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group();
+          ObjectPtr anObject = partDocument()->object(aGroup, theIndex.row());
+          if (anObject && anObject->data() && 
+              anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
+            return QIcon(":pictures/constr_object_modified.png");
+          }
+          return QIcon(":pictures/constr_object.png");
+        }
+        case HistoryObject: {
+          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
+          FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
+          if (aFeature)
+            return PartSet_DocumentDataModel::featureIcon(aFeature);
+        }
+      }
+      break;
+    case Qt::ToolTipRole:
+      // return Tooltip
+      break;
+    case Qt::ForegroundRole:
+      return QBrush(myItemsColor);
+      break;
+  }
+  return QVariant();
+}
+
+QVariant PartSet_PartDataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+  return QVariant();
+}
+
+int PartSet_PartDataModel::rowCount(const QModelIndex& parent) const
+{
+  if (!parent.isValid()) {
+    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+    if (aRootDoc->object(ModelAPI_ResultPart::group(), myId))
+      return 1;
+    else
+      return 0;
+  }
+  switch (parent.internalId()) {
+    case MyRoot:
+      {
+        DocumentPtr aDoc = partDocument();
+        if (aDoc) {
+          return getRowsNumber() + aDoc->size(ModelAPI_Feature::group());
+        } else 
+          return 0;
+      }
+    case ParamsFolder:
+      return partDocument()->size(ModelAPI_ResultParameter::group());
+    case ConstructFolder:
+      return partDocument()->size(ModelAPI_ResultConstruction::group());
+    case BodiesFolder:
+      return partDocument()->size(ModelAPI_ResultBody::group());
+    case GroupsFolder:
+      return partDocument()->size(ModelAPI_ResultGroup::group());
+  }
+  return 0;
+}
+
+int PartSet_PartDataModel::columnCount(const QModelIndex &parent) const
+{
+  return 1;
+}
+
+QModelIndex PartSet_PartDataModel::index(int theRow, int theColumn, const QModelIndex &theParent) const
+{
+  if (!theParent.isValid())
+    return createIndex(theRow, 0, (qint32) MyRoot);
+
+  int aId = (int) theParent.internalId();
+  switch (aId) {
+    case MyRoot:
+      switch (theRow) {
+        case 0:
+          return createIndex(theRow, 0, (qint32) ParamsFolder);
+        case 1:
+          return createIndex(theRow, 0, (qint32) ConstructFolder);
+        case 2:
+          return createIndex(theRow, 0, (qint32) BodiesFolder);
+        case 3:
+          {
+          int aSize = partDocument()->size(ModelAPI_ResultGroup::group());
+          if (aSize > 0)
+            return createIndex(theRow, 0, (qint32) GroupsFolder);
+          else
+            return createIndex(theRow, theColumn, (qint32) HistoryObject);
+          }
+        default:
+          return createIndex(theRow, theColumn, (qint32) HistoryObject);
+      }
+    case ParamsFolder:
+      return createIndex(theRow, 0, (qint32) ParamObject);
+    case ConstructFolder:
+      return createIndex(theRow, 0, (qint32) ConstructObject);
+    case BodiesFolder:
+      return createIndex(theRow, 0, (qint32) BodiesObject);
+    case GroupsFolder:
+      return createIndex(theRow, 0, (qint32) GroupObject);
+  }
+  return QModelIndex();
+}
+
+QModelIndex PartSet_PartDataModel::parent(const QModelIndex& theIndex) const
+{
+  switch (theIndex.internalId()) {
+    case MyRoot:
+      return QModelIndex();
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+    case GroupsFolder:
+    case HistoryObject:
+      return createIndex(0, 0, (qint32) MyRoot);
+
+    case ParamObject:
+      return createIndex(0, 0, (qint32) ParamsFolder);
+    case ConstructObject:
+      return createIndex(1, 0, (qint32) ConstructFolder);
+    case BodiesObject:
+      return createIndex(2, 0, (qint32) BodiesFolder);
+    case GroupObject:
+      return createIndex(3, 0, (qint32) GroupsFolder);
+  }
+  return QModelIndex();
+}
+
+bool PartSet_PartDataModel::hasChildren(const QModelIndex& theParent) const
+{
+  return rowCount(theParent) > 0;
+}
+
+DocumentPtr PartSet_PartDataModel::partDocument() const
+{
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+  ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
+  ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
+  if (aPart)
+    return aPart->partDoc();
+  return DocumentPtr(); // null if not found
+}
+
+ObjectPtr PartSet_PartDataModel::object(const QModelIndex& theIndex) const
+{
+  switch (theIndex.internalId()) {
+    case MyRoot: {
+      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+      return aRootDoc->object(ModelAPI_ResultPart::group(), myId);
+    }
+    case ParamsFolder:
+    case ConstructFolder:
+    case BodiesFolder:
+    case GroupsFolder:
+      return ObjectPtr();
+
+    case ParamObject:
+      return partDocument()->object(ModelAPI_ResultParameter::group(), theIndex.row());
+    case ConstructObject:
+      return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
+    case BodiesObject:
+      return partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
+    case GroupObject:
+      return partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
+    case HistoryObject:
+      return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
+  }
+  return ObjectPtr();
+}
+
+bool PartSet_PartDataModel::hasDocument(const DocumentPtr& theDoc) const
+{
+  return (partDocument() == theDoc);
+}
+
+QModelIndex PartSet_PartDataModel::findParent(const ObjectPtr& theObject) const
+{
+  return findGroup(theObject->groupName().c_str());
+}
+
+QModelIndex PartSet_PartDataModel::findGroup(const std::string& theGroup) const
+{
+  if (theGroup == ModelAPI_ResultParameter::group())
+    return createIndex(0, 0, (qint32) ParamsFolder);
+  if (theGroup == ModelAPI_ResultConstruction::group())
+    return createIndex(1, 0, (qint32) ConstructFolder);
+  if (theGroup == ModelAPI_ResultBody::group())
+    return createIndex(2, 0, (qint32) BodiesFolder);
+  if (theGroup == ModelAPI_ResultGroup::group())
+    return createIndex(3, 0, (qint32) GroupsFolder);
+  return QModelIndex();
+}
+
+ResultPartPtr PartSet_PartDataModel::part() const
+{
+  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
+  ObjectPtr aObj = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
+  return std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
+}
+
+QModelIndex PartSet_PartDataModel::objectIndex(const ObjectPtr& theObject) const
+{
+  QModelIndex aIndex;
+  if (theObject) {
+    if (part() == theObject)
+      return aIndex;
+
+    std::string aGroup = theObject->groupName();
+    DocumentPtr aDoc = theObject->document();
+    int aNb = aDoc->size(aGroup);
+    int aRow = -1;
+    for (int i = 0; i < aNb; i++) {
+      if (aDoc->object(aGroup, i) == theObject) {
+        aRow = i;
+        break;
+      }
+    }
+    if (aRow == -1)
+      return aIndex;
+    if (aGroup == ModelAPI_ResultParameter::group())
+      return createIndex(aRow, 0, (qint32) ParamObject);
+    else if (aGroup == ModelAPI_ResultConstruction::group())
+      return createIndex(aRow, 0, (qint32) ConstructObject);
+    else if (aGroup == ModelAPI_ResultBody::group())
+      return createIndex(aRow, 0, (qint32) BodiesObject);
+    else if (aGroup == ModelAPI_ResultGroup::group())
+      return createIndex(aRow, 0, (qint32) GroupObject);
+    else
+      return createIndex(aRow + getRowsNumber(), 0, (qint32) HistoryObject);
+  }
+  return aIndex;
+}
+
+
+int PartSet_PartDataModel::getRowsNumber() const
+{
+  int aSize = partDocument()->size(ModelAPI_ResultGroup::group());
+  if (aSize == 0) // If there are no groups then do not show group folder
+    return 3;
+  return 4;
+}
\ No newline at end of file
diff --git a/src/PartSet/PartSet_PartDataModel.h b/src/PartSet/PartSet_PartDataModel.h
new file mode 100644 (file)
index 0000000..fc61ec1
--- /dev/null
@@ -0,0 +1,191 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
+
+#ifndef PartSet_PartDataModel_H
+#define PartSet_PartDataModel_H
+
+#include "PartSet.h"
+#include "PartSet_DataTreeModel.h"
+
+/**\class PartSet_TopDataModel
+ * \ingroup GUI
+ * \brief This is a data model for Object Browser (QTreeView).
+ * It represents only upper part of data tree (non-parts tree items)
+ */
+class PARTSET_EXPORT PartSet_TopDataModel : public PartSet_FeaturesModel
+{
+Q_OBJECT
+ public:
+   /// Constructor
+   /// \param theParent a parent object
+  PartSet_TopDataModel(QObject* theParent);
+  virtual ~PartSet_TopDataModel();
+
+  // Reimpl from QAbstractItemModel
+
+  /// Returns the data stored under the given role for the item referred to by the index.
+  /// \param theIndex a model index
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+
+  /// Returns the data for the given role and section in the header with the specified orientation.
+  /// \param theSection a section
+  /// \param theOrient an orientation
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
+                              int theRole = Qt::DisplayRole) const;
+
+  /// Returns the number of rows under the given parent. When the parent is valid it means that 
+  /// rowCount is returning the number of children of parent.
+  /// \param theParent a parent model index
+  virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
+
+  /// Returns the number of columns for the children of the given parent.
+  /// It has a one column
+  /// \param theParent a parent model index
+  virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
+
+
+  /// Returns the index of the item in the model specified by the given row, column and parent index.
+  /// \param theRow a row
+  /// \param theColumn a column
+  /// \param theParent a parent model index
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
+                                QModelIndex()) const;
+
+  /// Returns the parent of the model item with the given index. 
+  /// If the item has no parent, an invalid QModelIndex is returned.
+  /// \param theIndex a model index
+  virtual QModelIndex parent(const QModelIndex& theIndex) const;
+
+  /// Returns true if parent has any children; otherwise returns false.
+  /// \param theParent a parent model index
+  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+
+  //! Returns object by the given Model index.
+  //! Returns 0 if the given index is not index of a object
+  virtual ObjectPtr object(const QModelIndex& theIndex) const;
+
+  //! Returns QModelIndex which corresponds to the given object
+  //! If the object is not found then index is not valid
+  virtual QModelIndex objectIndex(const ObjectPtr& theObject) const;
+
+  //! Returns parent index of the given object
+  virtual QModelIndex findParent(const ObjectPtr& theObject) const;
+
+  //! Returns index corresponded to the group
+  virtual QModelIndex findGroup(const std::string& theGroup) const;
+
+ private:
+  //! Types of QModelIndexes
+  enum DataIds
+  {
+    ParamsFolder,
+    ParamObject,
+    ConstructFolder,
+    ConstructObject
+    //GroupsFolder,
+    //GroupObject
+  };
+
+};
+
+/**\class PartSet_PartDataModel
+ * \ingroup GUI
+ * \brief This is a data model for Object Browser (QTreeView).
+ * It represents data tree only of a one part
+ */
+class PartSet_PartDataModel : public PartSet_PartModel
+{
+Q_OBJECT
+ public:
+   /// Constructor
+   /// \param theParent a parent object
+  PartSet_PartDataModel(QObject* theParent);
+  virtual ~PartSet_PartDataModel();
+
+  // Reimpl from QAbstractItemModel
+
+  /// Returns the data stored under the given role for the item referred to by the index.
+  /// \param theIndex a model index
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+
+  /// Returns the data for the given role and section in the header with the specified orientation.
+  /// \param theSection a section
+  /// \param theOrient an orientation
+  /// \param theRole a data role (see Qt::ItemDataRole)
+  virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
+                              int theRole = Qt::DisplayRole) const;
+
+  /// Returns the number of rows under the given parent. When the parent is valid it means that 
+  /// rowCount is returning the number of children of parent.
+  /// \param theParent a parent model index
+  virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
+
+  /// Returns the number of columns for the children of the given parent.
+  /// It has a one column
+  /// \param theParent a parent model index
+  virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
+
+  /// Returns the index of the item in the model specified by the given row, column and parent index.
+  /// \param theRow a row
+  /// \param theColumn a column
+  /// \param theParent a parent model index
+  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
+                                QModelIndex()) const;
+
+  /// Returns the parent of the model item with the given index. 
+  /// If the item has no parent, an invalid QModelIndex is returned.
+  /// \param theIndex a model index
+  virtual QModelIndex parent(const QModelIndex& theIndex) const;
+
+  /// Returns true if parent has any children; otherwise returns false.
+  /// \param theParent a parent model index
+  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+
+  //! Returns object by the given Model index.
+  //! Returns 0 if the given index is not index of a object
+  virtual ObjectPtr object(const QModelIndex& theIndex) const;
+
+  //! Returns QModelIndex which corresponds to the given object
+  //! If the object is not found then index is not valid
+  virtual QModelIndex objectIndex(const ObjectPtr& theObject) const;
+
+  //! Returns true if the given document is a sub-document of this tree
+  virtual bool hasDocument(const DocumentPtr& theDoc) const;
+
+  //! Returns parent index of the given object
+  virtual QModelIndex findParent(const ObjectPtr& theObject) const;
+
+  //! Returns index corresponded to the group
+  virtual QModelIndex findGroup(const std::string& theGroup) const;
+
+  //! Return a Part object
+  virtual ResultPartPtr part() const;
+
+ private:
+
+  //! Returns document of the current part
+  DocumentPtr partDocument() const;
+
+  //! Returns defult number of rows
+  int getRowsNumber() const;
+
+  //! Types of QModelIndexes
+  enum DataIds
+  {
+    MyRoot,
+    ParamsFolder,
+    ParamObject,
+    ConstructFolder,
+    ConstructObject,
+    BodiesFolder,
+    BodiesObject,
+    GroupsFolder,
+    GroupObject,
+    HistoryObject
+  };
+
+};
+
+#endif
diff --git a/src/PartSet/PartSet_WidgetPoint2dAngle.cpp b/src/PartSet/PartSet_WidgetPoint2dAngle.cpp
new file mode 100644 (file)
index 0000000..b014d34
--- /dev/null
@@ -0,0 +1,50 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_WidgetPoint2dAngle.h
+// Created:     23 June 2014
+// Author:      Vitaly Smetannikov
+
+#include "PartSet_WidgetPoint2dAngle.h"
+
+#include <ModuleBase_ParamSpinBox.h>
+
+#include <ModuleBase_Tools.h>
+
+#include <GeomAPI_Pnt2d.h>
+#include <GeomDataAPI_Point2D.h>
+
+#include <ModelAPI_Data.h>
+#include <ModelAPI_AttributeDouble.h>
+
+#include <QMouseEvent>
+
+#include <GeomAPI_Dir2d.h>
+#include <GeomAPI_XY.h>
+
+#define PI 3.1415926535897932
+
+PartSet_WidgetPoint2dAngle::PartSet_WidgetPoint2dAngle(QWidget* theParent,
+                                                       const Config_WidgetAPI* theData,
+                                                       const std::string& theParentId)
+: PartSet_WidgetPoint2dDistance(theParent, theData, theParentId)
+{
+}
+
+PartSet_WidgetPoint2dAngle::~PartSet_WidgetPoint2dAngle()
+{
+}
+
+double PartSet_WidgetPoint2dAngle::computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
+                                                const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
+{
+  std::shared_ptr<GeomAPI_Dir2d> aHorizontalDir(new GeomAPI_Dir2d(1, 0));
+  std::shared_ptr<GeomAPI_XY> aStartPnt = theFirstPnt->xy();
+  std::shared_ptr<GeomAPI_XY> aEndPnt = theCurrentPnt->xy();
+
+  std::shared_ptr<GeomAPI_Dir2d> aLineDir(new GeomAPI_Dir2d(aEndPnt->decreased(aStartPnt)));
+
+  double aValue = aHorizontalDir->angle(aLineDir);
+  aValue *= 180.0 / PI;
+
+  return aValue;
+}
diff --git a/src/PartSet/PartSet_WidgetPoint2dAngle.h b/src/PartSet/PartSet_WidgetPoint2dAngle.h
new file mode 100644 (file)
index 0000000..6dac991
--- /dev/null
@@ -0,0 +1,44 @@
+// Copyright (C) 2014-20xx CEA/DEN, EDF R&D
+
+// File:        PartSet_WidgetPoint2dAngle.h
+// Created:     30 Apr 2015
+// Author:      Natalia Ermolaeva
+
+#ifndef PartSet_WidgetPoint2dAngle_H
+#define PartSet_WidgetPoint2dAngle_H
+
+#include "PartSet.h"
+#include "PartSet_WidgetPoint2dDistance.h"
+
+#include <ModelAPI_Feature.h>
+
+class GeomAPI_Pnt2d;
+
+/**
+* \ingroup Modules
+* Implementation of model widget for widget which provides input of an anble between two points
+* The XML definion is the same as the parent one.
+*/ 
+class PARTSET_EXPORT PartSet_WidgetPoint2dAngle : public PartSet_WidgetPoint2dDistance
+{
+Q_OBJECT
+ public:
+  /// Constructor
+  /// \param theParent the parent object
+  /// \param theData the widget configuation. The attribute of the model widget is obtained from
+  /// \param theParentId is Id of a parent of the current attribute
+  PartSet_WidgetPoint2dAngle(QWidget* theParent, const Config_WidgetAPI* theData,
+                             const std::string& theParentId);
+
+  virtual ~PartSet_WidgetPoint2dAngle();
+
+protected:
+  /// Compute an angle between points
+  /// \param theFirstPnt a point value of the out point attribute
+  /// \param theCurrentPnt a point of the current widget
+  /// \return a double value
+  virtual double computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
+                              const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt);
+};
+
+#endif
index e20186a26a43eb68422d222064f729855b826731..07cf1877b7303c76a175fdc316933b3122bc3d61 100644 (file)
@@ -60,16 +60,22 @@ void PartSet_WidgetPoint2dDistance::setPoint(FeaturePtr theFeature,
   if (!aPoint)
     return;
 
-  double aRadius = thePnt->distance(aPoint->pnt());
+  double aValue = computeValue(aPoint->pnt(), thePnt);
   AttributeDoublePtr aReal = aData->real(attributeID());
-  if (aReal && (aReal->value() != aRadius)) {
-    aReal->setValue(aRadius);
+  if (aReal && (aReal->value() != aValue)) {
+    aReal->setValue(aValue);
     
-    ModuleBase_Tools::setSpinValue(mySpinBox, aRadius);
+    ModuleBase_Tools::setSpinValue(mySpinBox, aValue);
     storeValue();
   }
 }
 
+double PartSet_WidgetPoint2dDistance::computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
+                                                   const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt)
+{
+  return theCurrentPnt->distance(theFirstPnt);
+}
+
 void PartSet_WidgetPoint2dDistance::activateCustom()
 {
   XGUI_ViewerProxy* aViewer = myWorkshop->viewer();
index 95fc0ed19c450222bb2239c8c81d63f33cfcc7e4..c3020e3a97c5208ba601087d7dedc893b6928d7d 100644 (file)
@@ -85,11 +85,18 @@ protected:
   /// Set the second point which defines a value in the widget as a distance with a first point defined by feature
   void setPoint(FeaturePtr theFeature, const std::shared_ptr<GeomAPI_Pnt2d>& thePnt);
 
+  /// Compute the distance between points
+  /// \param theFirstPnt a point value of the out point attribute
+  /// \param theCurrentPnt a point of the current widget
+  /// \return a double value
+  virtual double computeValue(const std::shared_ptr<GeomAPI_Pnt2d>& theFirstPnt,
+                              const std::shared_ptr<GeomAPI_Pnt2d>& theCurrentPnt);
+
 private slots:
   /// Process values changed event
   void onValuesChanged();
 
- private:
+protected:
   XGUI_Workshop* myWorkshop;
   std::string myFirstPntName;
 
index 58ee9fa2f4862a8ab184191c51ecc2913a7ab544..35d20306a26d72979620aae6d1c0f94ebf4f3d19 100644 (file)
      <file>icons/mirror.png</file>
      <file>icons/translate.png</file>
      <file>icons/rotate.png</file>
+     <file>icons/exec_state_failed.png</file>
+     <file>icons/exec_state_invalid_parameters.png</file>
+     <file>icons/activate.png</file>
+     <file>icons/deactivate.png</file>
+     <file>icons/edit.png</file>
  </qresource>
  </RCC>
diff --git a/src/PartSet/icons/activate.png b/src/PartSet/icons/activate.png
new file mode 100644 (file)
index 0000000..f829179
Binary files /dev/null and b/src/PartSet/icons/activate.png differ
diff --git a/src/PartSet/icons/deactivate.png b/src/PartSet/icons/deactivate.png
new file mode 100644 (file)
index 0000000..1b1c71a
Binary files /dev/null and b/src/PartSet/icons/deactivate.png differ
diff --git a/src/PartSet/icons/edit.png b/src/PartSet/icons/edit.png
new file mode 100644 (file)
index 0000000..43a3174
Binary files /dev/null and b/src/PartSet/icons/edit.png differ
diff --git a/src/PartSet/icons/exec_state_failed.png b/src/PartSet/icons/exec_state_failed.png
new file mode 100644 (file)
index 0000000..738f303
Binary files /dev/null and b/src/PartSet/icons/exec_state_failed.png differ
diff --git a/src/PartSet/icons/exec_state_invalid_parameters.png b/src/PartSet/icons/exec_state_invalid_parameters.png
new file mode 100644 (file)
index 0000000..1346f97
Binary files /dev/null and b/src/PartSet/icons/exec_state_invalid_parameters.png differ
index 0a24df58e6fda822b05db56b1cad3ff3b59e7aaf..d679d9ccf62b9586d704309d5b437b0ec3d499ad 100644 (file)
@@ -46,12 +46,6 @@ class PartSetPlugin_Part : public ModelAPI_Feature
   /// Part must be added only to PartSet
   PARTSETPLUGIN_EXPORT virtual const std::string& 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();
 };
index e42c826c89a811a2c2319cca2a2fc908fb77b1ab..97830f944a99f256685bb442bf106db239ecf5f0 100644 (file)
             id="MultiRotationCenter"
             title="Center of rotation"
             tooltip="Center of rotation"/>
-        <doublevalue id="MultiRotationAngle"
-            label="Angle"
-            tooltip="Rotation angle"/>
+        <point2dangle id="MultiRotationAngle"
+                         first_point="MultiRotationCenter"
+                         label="Angle"
+                         icon=":icons/angle.png"
+                         tooltip="Rotation angle"
+                         default="90"/>
         <integervalue id="MultiRotationCopies"
             label="Number of copies"
             tooltip="Number of copies" 
index 060d58af86dd5c143b2484b1d5cad885b2ad10b9..d570650ef03b4c518907c4267795842249020178 100644 (file)
@@ -9,14 +9,11 @@ SET(PROJECT_HEADERS
        XGUI_ColorDialog.h
        XGUI_ContextMenuMgr.h
        XGUI_CustomPrs.h
-       XGUI_DataTreeModel.h
        XGUI_Displayer.h
-       XGUI_DocumentDataModel.h
        XGUI_ErrorDialog.h
        XGUI_ModuleConnector.h
        XGUI_ObjectsBrowser.h
        XGUI_OperationMgr.h
-       XGUI_PartDataModel.h
        XGUI_PropertyPanel.h
        XGUI_QtEvents.h
        XGUI_SalomeConnector.h
@@ -38,12 +35,10 @@ SET(PROJECT_SOURCES
        XGUI_ContextMenuMgr.cpp
        XGUI_CustomPrs.cpp
        XGUI_Displayer.cpp
-       XGUI_DocumentDataModel.cpp
        XGUI_ErrorDialog.cpp
        XGUI_ModuleConnector.cpp
        XGUI_ObjectsBrowser.cpp
        XGUI_OperationMgr.cpp
-       XGUI_PartDataModel.cpp
        XGUI_PropertyPanel.cpp
        XGUI_QtEvents.cpp
        XGUI_Selection.cpp
index 494ecf28d011cf8dcf54d04dae64ac496ebd843e..ff696de22d3e2f713743f9b80a71485d17e02eb8 100644 (file)
@@ -8,7 +8,6 @@
 #include "XGUI_ViewerProxy.h"
 #include "XGUI_Selection.h"
 #include "XGUI_SalomeConnector.h"
-#include "XGUI_Tools.h"
 
 #include <AppElements_MainWindow.h>
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_AttributeDocRef.h>
 #include <ModelAPI_Object.h>
-#include <ModelAPI_ResultPart.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_ResultGroup.h>
 #include <ModelAPI_ResultParameter.h>
 
 #include <ModuleBase_IModule.h>
+#include <ModuleBase_Tools.h>
 
 #include <QAction>
 #include <QContextMenuEvent>
@@ -41,16 +40,7 @@ XGUI_ContextMenuMgr::~XGUI_ContextMenuMgr()
 
 void XGUI_ContextMenuMgr::createActions()
 {
-  QAction* aAction = new QAction(QIcon(":pictures/edit.png"), tr("Edit..."), this);
-  addAction("EDIT_CMD", aAction);
-
-  aAction = new QAction(QIcon(":pictures/activate.png"), tr("Activate"), this);
-  addAction("ACTIVATE_PART_CMD", aAction);
-
-  aAction = new QAction(QIcon(":pictures/assembly.png"), tr("Deactivate"), this);
-  addAction("DEACTIVATE_PART_CMD", aAction);
-
-  aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
+  QAction* aAction = new QAction(QIcon(":pictures/delete.png"), tr("Delete"), this);
   QMainWindow* aDesktop = myWorkshop->mainWindow();
   if (!aDesktop)
     aDesktop = myWorkshop->salomeConnector()->desktop();
@@ -155,21 +145,13 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
     bool hasResult = false;
     bool hasFeature = false;
     bool hasParameter = false;
-    XGUI_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
+    ModuleBase_Tools::checkObjects(aObjects, hasResult, hasFeature, hasParameter);
 
     //Process Feature
     if (aSelected == 1) {
       ObjectPtr aObject = aObjects.first();
       if (aObject) {
-        ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
-        if (aPart) {
-          if (aMgr->activeDocument() == aPart->partDoc())
-            aMenu->addAction(action("DEACTIVATE_PART_CMD"));
-          else
-            aMenu->addAction(action("ACTIVATE_PART_CMD"));
-        } else if (hasFeature && aObject->document() == aMgr->activeDocument()) {
-          aMenu->addAction(action("EDIT_CMD"));
-        } else {
+        if (!hasFeature) {
           if (aDisplayer->isVisible(aObject)) {
             if (aDisplayer->canBeShaded(aObject)) {
               if (aDisplayer->displayMode(aObject) == XGUI_Displayer::Shading)
@@ -179,18 +161,13 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
             }
             aMenu->addSeparator();
             aMenu->addAction(action("HIDE_CMD"));
-          } else if (!hasParameter) {
+          } else if (hasResult && (!hasParameter)) {
             aMenu->addAction(action("SHOW_CMD"));
           }
-          if (hasParameter)
-            aMenu->addAction(action("EDIT_CMD"));
-          else
+          if (!(hasParameter || hasFeature))
             aMenu->addAction(action("SHOW_ONLY_CMD"));
         }
-      } else {  // If feature is 0 the it means that selected root object (document)
-        if (aMgr->activeDocument() != aMgr->moduleDocument())
-          aMenu->addAction(action("ACTIVATE_PART_CMD"));
-      }
+      } 
     } else {
       if (hasResult && (!hasParameter)) {
         aMenu->addAction(action("SHOW_CMD"));
@@ -208,11 +185,13 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
     aMenu->addAction(action("COLOR_CMD"));
 
   aMenu->addSeparator();
+  ModuleBase_IModule* aModule = myWorkshop->module();
+  if (aModule) {
+    aModule->addObjectBrowserMenu(aMenu);
+    aMenu->addSeparator();
+  }
   aMenu->addActions(myWorkshop->objectBrowser()->actions());
 
-  ModuleBase_IModule* aModule = myWorkshop->module();
-  if (aModule)
-    aModule->addObjectBrowserItems(aMenu);
 
   if (aMenu->actions().size() > 0) {
     return aMenu;
@@ -224,7 +203,7 @@ QMenu* XGUI_ContextMenuMgr::objectBrowserMenu() const
 QMenu* XGUI_ContextMenuMgr::viewerMenu() const
 {
   QMenu* aMenu = new QMenu();
-  addViewerItems(aMenu);
+  addViewerMenu(aMenu);
   if (aMenu->actions().size() > 0) {
     return aMenu;
   }
@@ -232,19 +211,17 @@ QMenu* XGUI_ContextMenuMgr::viewerMenu() const
   return 0;
 }
 
-void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
+void XGUI_ContextMenuMgr::addViewerMenu(QMenu* theMenu) const
 {
   bool aIsDone = false;
   ModuleBase_IModule* aModule = myWorkshop->module();
   if (aModule) 
-    aIsDone = aModule->addViewerItems(theMenu, myActions);
+    aIsDone = aModule->addViewerMenu(theMenu, myActions);
 
   if (!aIsDone) {
     XGUI_SelectionMgr* aSelMgr = myWorkshop->selector();
     QObjectPtrList aObjects = aSelMgr->selection()->selectedObjects();
     if (aObjects.size() > 0) {
-      //if (aObjects.size() == 1)
-      //  theMenu->addAction(action("EDIT_CMD"));
       bool isVisible = false;
       bool isShading = false;
       bool canBeShaded = false;
@@ -270,7 +247,6 @@ void XGUI_ContextMenuMgr::addViewerItems(QMenu* theMenu) const
         theMenu->addAction(action("HIDE_CMD"));
       } else
         theMenu->addAction(action("SHOW_CMD"));
-      //theMenu->addAction(action("DELETE_CMD"));
     }
     if (myWorkshop->displayer()->objectsCount() > 0)
       theMenu->addAction(action("HIDEALL_CMD"));
index 5098ca1bbd63116d2066e9260cc0e37f4fb95af8..3f490a59b22d0450ab458c975df741c58b63766f 100644 (file)
@@ -51,7 +51,7 @@ Q_OBJECT
 
   /// Add menu atems for viewer into the given menu (used in SALOME mode)
   /// \param theMenu a popup menu to be shown in the viewer
-  void addViewerItems(QMenu* theMenu) const;
+  void addViewerMenu(QMenu* theMenu) const;
 
 signals:
   /// Signal aabout triggered action
diff --git a/src/XGUI/XGUI_DataTreeModel.h b/src/XGUI/XGUI_DataTreeModel.h
deleted file mode 100644 (file)
index fb28e59..0000000
+++ /dev/null
@@ -1,96 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-#ifndef XGUI_DataTreeModel_H
-#define XGUI_DataTreeModel_H
-
-#include "XGUI.h"
-
-#include <ModelAPI_Document.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_ResultPart.h>
-
-#include <QAbstractItemModel>
-#include <QColor>
-
-/**\class XGUI_FeaturesModel
- * \ingroup GUI
- * \brief Abstaract class of model object which operates with features data.
- */
-class XGUI_EXPORT XGUI_FeaturesModel : public QAbstractItemModel
-{
- public:
-   /// Constructor
-   /// \param theParent a parent object
-  XGUI_FeaturesModel(QObject* theParent)
-      : QAbstractItemModel(theParent),
-        myItemsColor(Qt::black)
-  {
-  }
-
-  //! Returns Feature object by the given Model index.
-  //! Returns 0 if the given index is not index of a feature
-  /// \param theIndex a model index
-  virtual ObjectPtr object(const QModelIndex& theIndex) const = 0;
-
-  //! Returns QModelIndex which corresponds to the given feature
-  //! If the feature is not found then index is not valid
-  virtual QModelIndex objectIndex(const ObjectPtr& theFeature) const = 0;
-
-  //! Returns parent index of the given feature
-  virtual QModelIndex findParent(const ObjectPtr& theObject) const = 0;
-
-  //! Returns index corresponded to the group
-  //! \param theGroup a group name
-  virtual QModelIndex findGroup(const std::string& theGroup) const = 0;
-
-  //! Set color of items
-  void setItemsColor(const QColor& theColor)
-  {
-    myItemsColor = theColor;
-  }
-
-  //! Returns color of items
-  QColor itemsColor() const
-  {
-    return myItemsColor;
-  }
-
- protected:
-   /// Color of items
-  QColor myItemsColor;
-};
-
-/**\class XGUI_PartModel
- * \ingroup GUI
- * \brief Abstaract class of model object which operates with parts data.
- */
-class XGUI_PartModel : public XGUI_FeaturesModel
-{
- public:
-   /// Constructor
-   /// \param theParent a parent object
-  XGUI_PartModel(QObject* theParent)
-      : XGUI_FeaturesModel(theParent)
-  {
-  }
-
-  /// Set part id
-  /// \param theId a new id
-  void setPartId(int theId)
-  {
-    myId = theId;
-  }
-
-  //! Returns true if the given document is a sub-document of this tree
-  //! \param theDoc a document to check
-  virtual bool hasDocument(const DocumentPtr& theDoc) const = 0;
-
-  //! Return a Part object
-  virtual ResultPartPtr part() const = 0;
-
- protected:
-  //! Id of the current part object in the document
-  int myId;
-};
-
-#endif
diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp
deleted file mode 100644 (file)
index 2443426..0000000
+++ /dev/null
@@ -1,592 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-#include "XGUI_DocumentDataModel.h"
-#include "XGUI_PartDataModel.h"
-#include "XGUI_Workshop.h"
-#include "XGUI_Tools.h"
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_Data.h>
-#include <ModelAPI_ResultPart.h>
-#include <ModelAPI_Events.h>
-#include <ModelAPI_Object.h>
-
-#include <Events_Loop.h>
-
-#include <Config_FeatureMessage.h>
-
-#include <QIcon>
-#include <QString>
-#include <QBrush>
-
-#include <set>
-
-#define ACTIVE_COLOR QColor(0,72,140)
-#define PASSIVE_COLOR Qt::black
-
-XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
-    : QAbstractItemModel(theParent),
-      myActivePart(0)
-{
-  // Register in event loop
-  //Events_Loop* aLoop = Events_Loop::loop();
-  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
-  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
-  //aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
-
-  // Create a top part of data tree model
-  myModel = new XGUI_TopDataModel(this);
-  myModel->setItemsColor(ACTIVE_COLOR);
-}
-
-XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
-{
-  clearModelIndexes();
-  clearSubModels();
-}
-
-void XGUI_DocumentDataModel::processEvent(const std::shared_ptr<Events_Message>& theMessage)
-{
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-
-  // Created object event *******************
-  if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_CREATED)) {
-    std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg =
-        std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
-    std::set<ObjectPtr> aObjects = aUpdMsg->objects();
-
-    std::set<ObjectPtr>::const_iterator aIt;
-    for (aIt = aObjects.begin(); aIt != aObjects.end(); ++aIt) {
-      ObjectPtr aObject = (*aIt);
-      FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
-      if (aFeature && (!aFeature->isInHistory()))
-        continue;
-
-      DocumentPtr aDoc = aObject->document();
-      if (aDoc == aRootDoc) {  // If root objects
-        if (aObject->groupName() == ModelAPI_ResultPart::group()) {  // Update only Parts group
-            // Add a new part
-          int aStart = myPartModels.size();
-          XGUI_PartDataModel* aModel = new XGUI_PartDataModel(this);
-          aModel->setPartId(myPartModels.count());
-          myPartModels.append(aModel);
-          insertRow(aStart, partFolderNode());
-        } else {  // Update top groups (other except parts
-          QModelIndex aIndex = myModel->findParent(aObject);
-          int aStart = myModel->rowCount(aIndex) - 1;
-          if (aStart < 0)
-            aStart = 0;
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
-          insertRow(aStart, aIndex);
-        }
-      } else {  // if sub-objects of first level nodes
-        XGUI_PartModel* aPartModel = 0;
-        foreach (XGUI_PartModel* aPart, myPartModels) {
-          if (aPart->hasDocument(aDoc)) {
-            aPartModel = aPart;
-            break;
-          }
-        }
-        if (aPartModel) {
-          QModelIndex aIndex = aPartModel->findParent(aObject);
-          int aStart = aPartModel->rowCount(aIndex);  // check this index
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
-          insertRow(aStart, aIndex);
-        } else
-          reset();
-      }
-    }
-    // Deleted object event ***********************
-  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
-    std::shared_ptr<ModelAPI_ObjectDeletedMessage> aUpdMsg =
-        std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
-    DocumentPtr aDoc = aUpdMsg->document();
-    std::set<std::string> aGroups = aUpdMsg->groups();
-
-    std::set<std::string>::const_iterator aIt;
-    for (aIt = aGroups.begin(); aIt != aGroups.end(); ++aIt) {
-      std::string aGroup = (*aIt);
-      if (aDoc == aRootDoc) {  // If root objects
-        if (aGroup == ModelAPI_ResultPart::group()) {  // Update only Parts group
-          int aStart = myPartModels.size() - 1;
-          if (aStart >= 0) {// MPV: this could be reproduced on close
-            removeSubModel(aStart);
-            removeRow(aStart, partFolderNode());
-            if (myActivePart && (!isPartSubModel(myActivePart))) {
-              myActivePart = 0;
-              myActivePartIndex = QModelIndex();
-              myModel->setItemsColor(ACTIVE_COLOR);
-            }
-          }
-        } else {  // Update top groups (other except parts
-          QModelIndex aIndex = myModel->findGroup(aGroup);
-          int aStart = myModel->rowCount(aIndex);
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
-          removeRow(aStart, aIndex);
-        }
-      } else {
-        XGUI_PartModel* aPartModel = 0;
-        foreach (XGUI_PartModel* aPart, myPartModels) {
-          if (aPart->hasDocument(aDoc)) {
-            aPartModel = aPart;
-            break;
-          }
-        }
-        if (aPartModel) {
-          QModelIndex aIndex = aPartModel->findGroup(aGroup);
-          int aStart = aPartModel->rowCount(aIndex);
-          aIndex = createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex));
-          removeRow(aStart, aIndex);
-        }
-      }
-    }
-    // Deleted object event ***********************
-  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_UPDATED)) {
-    //std::shared_ptr<ModelAPI_ObjectUpdatedMessage> aUpdMsg = std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
-    //ObjectPtr aFeature = aUpdMsg->feature();
-    //DocumentPtr aDoc = aFeature->document();
-
-    // TODO: Identify the necessary index by the modified feature
-    QModelIndex aIndex;
-    emit dataChanged(aIndex, aIndex);
-
-    // Reset whole tree **************************
-  } else {
-    rebuildDataTree();
-  }
-}
-
-void XGUI_DocumentDataModel::rebuildDataTree()
-{
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-
-  beginResetModel();
-  clearModelIndexes();
-
-  int aNbParts = aRootDoc->size(ModelAPI_ResultPart::group());
-  if (myPartModels.size() != aNbParts) {  // resize internal models
-    while (myPartModels.size() > aNbParts) {
-      delete myPartModels.last();
-      myPartModels.removeLast();
-    }
-    while (myPartModels.size() < aNbParts) {
-      myPartModels.append(new XGUI_PartDataModel(this));
-    }
-    for (int i = 0; i < myPartModels.size(); i++)
-      myPartModels.at(i)->setPartId(i);
-  }
-  endResetModel();
-}
-
-QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole) const
-{
-  if (!theIndex.isValid())
-    return QVariant();
-  switch (theIndex.internalId()) {
-    case PartsFolder:
-      switch (theRole) {
-        case Qt::DisplayRole:
-          return tr("Parts") + QString(" (%1)").arg(rowCount(theIndex));
-        case Qt::DecorationRole:
-          return QIcon(":pictures/constr_folder.png");
-        case Qt::ToolTipRole:
-          return tr("Parts folder");
-        case Qt::ForegroundRole:
-          if (myActivePart)
-            return QBrush(PASSIVE_COLOR);
-            else
-            return QBrush(ACTIVE_COLOR);
-            default:
-            return QVariant();
-          }
-          break;
-          case HistoryNode:
-          {
-            int aOffset = historyOffset();
-            DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-            ObjectPtr aObj = aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
-            FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
-            if (!aFeature)
-            return QVariant();
-            switch (theRole) {
-              case Qt::DisplayRole:
-              if (aFeature)
-              return aFeature->data()->name().c_str();
-              else
-              return QVariant();
-              case Qt::DecorationRole:
-              return XGUI_Workshop::featureIcon(aFeature);
-              case Qt::ToolTipRole:
-              return tr("Feature object");
-              case Qt::ForegroundRole:
-              if (myActivePart)
-              return QBrush(PASSIVE_COLOR);
-              else
-              return QBrush(ACTIVE_COLOR);
-              default:
-              return QVariant();
-            }
-          }
-          break;
-        }
-  QModelIndex aParent = theIndex.parent();
-  if (aParent.isValid() && (aParent.internalId() == PartsFolder)) {
-    return myPartModels.at(theIndex.row())->data(QModelIndex(), theRole);
-  }
-  return toSourceModelIndex(theIndex)->data(theRole);
-}
-
-QVariant XGUI_DocumentDataModel::headerData(int theSection, Qt::Orientation theOrient,
-                                            int theRole) const
-{
-  return QVariant();
-}
-
-int XGUI_DocumentDataModel::rowCount(const QModelIndex& theParent) const
-{
-  if (!theParent.isValid()) {
-    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    // Size of external models
-    int aVal = historyOffset();
-    // Plus history size
-    aVal += aRootDoc->size(ModelAPI_Feature::group());
-    return aVal;
-  }
-  if (theParent.internalId() == PartsFolder) {
-    int aSize = myPartModels.size();
-    return myPartModels.size();
-  }
-  if (theParent.internalId() == HistoryNode) {
-    return 0;
-  }
-  QModelIndex* aParent = toSourceModelIndex(theParent);
-  const QAbstractItemModel* aModel = aParent->model();
-  if (!isSubModel(aModel))
-    return 0;
-
-  /*if (isPartSubModel(aModel)) {
-   if (aModel != myActivePart)
-   return 0;
-   }*/
-  return aModel->rowCount(*aParent);
-}
-
-int XGUI_DocumentDataModel::columnCount(const QModelIndex& theParent) const
-{
-  return 1;
-}
-
-QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn,
-                                          const QModelIndex& theParent) const
-{
-  QModelIndex aIndex;
-  if (!theParent.isValid()) {
-    int aOffs = myModel->rowCount();
-    if (theRow < aOffs) {
-      aIndex = myModel->index(theRow, theColumn, theParent);
-      aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
-    } else {
-      if (theRow == aOffs)  // Create Parts node
-        aIndex = partFolderNode();
-      else
-        // create history node
-        aIndex = createIndex(theRow, theColumn, HistoryNode);
-    }
-  } else {
-    if (theParent.internalId() == PartsFolder) {
-      aIndex = myPartModels.at(theRow)->index(0, theColumn, QModelIndex());
-    } else {
-      QModelIndex* aParent = (QModelIndex*) theParent.internalPointer();
-      aIndex = aParent->model()->index(theRow, theColumn, (*aParent));
-    }
-    aIndex = createIndex(theRow, theColumn, (void*) getModelIndex(aIndex));
-  }
-  return aIndex;
-}
-
-QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex& theIndex) const
-{
-  if ((theIndex.internalId() == PartsFolder) || (theIndex.internalId() == HistoryNode))
-    return QModelIndex();
-
-  QModelIndex* aIndex = toSourceModelIndex(theIndex);
-  const QAbstractItemModel* aModel = aIndex->model();
-  if (!isSubModel(aModel))
-    return QModelIndex();
-
-  if (isPartSubModel(aModel)) {
-    if (!aModel->parent(*aIndex).isValid()) {
-      return partFolderNode();
-    }
-  }
-
-  QModelIndex aIndex1 = aModel->parent(*aIndex);
-  if (aIndex1.isValid())
-    return createIndex(aIndex1.row(), aIndex1.column(), (void*) getModelIndex(aIndex1));
-  return aIndex1;
-}
-
-bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
-{
-  if (!theParent.isValid())
-    return true;
-  return rowCount(theParent) > 0;
-}
-
-QModelIndex* XGUI_DocumentDataModel::toSourceModelIndex(const QModelIndex& theProxy) const
-{
-  QModelIndex* aIndexPtr = static_cast<QModelIndex*>(theProxy.internalPointer());
-  return aIndexPtr;
-}
-
-QModelIndex* XGUI_DocumentDataModel::findModelIndex(const QModelIndex& theIndex) const
-{
-  QList<QModelIndex*>::const_iterator aIt;
-  for (aIt = myIndexes.constBegin(); aIt != myIndexes.constEnd(); ++aIt) {
-    QModelIndex* aIndex = (*aIt);
-    if ((*aIndex) == theIndex)
-      return aIndex;
-  }
-  return 0;
-}
-
-QModelIndex* XGUI_DocumentDataModel::getModelIndex(const QModelIndex& theIndex) const
-{
-  QModelIndex* aIndexPtr = findModelIndex(theIndex);
-  if (!aIndexPtr) {
-    aIndexPtr = new QModelIndex(theIndex);
-    XGUI_DocumentDataModel* that = (XGUI_DocumentDataModel*) this;
-    that->myIndexes.append(aIndexPtr);
-  }
-  return aIndexPtr;
-}
-
-void XGUI_DocumentDataModel::clearModelIndexes()
-{
-  foreach (QModelIndex* aIndex, myIndexes) 
-    delete aIndex;
-  myIndexes.clear();
-}
-
-void XGUI_DocumentDataModel::clearSubModels()
-{
-  foreach (XGUI_PartModel* aPart, myPartModels) 
-    delete aPart;
-  myPartModels.clear();
-}
-
-ObjectPtr XGUI_DocumentDataModel::object(const QModelIndex& theIndex) const
-{
-  if (theIndex.internalId() == PartsFolder)
-    return ObjectPtr();
-  if (theIndex.internalId() == HistoryNode) {
-    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    int aOffset = historyOffset();
-    return aRootDoc->object(ModelAPI_Feature::group(), theIndex.row() - aOffset);
-  }
-  QModelIndex* aIndex = toSourceModelIndex(theIndex);
-  if (!isSubModel(aIndex->model()))
-    return ObjectPtr();
-
-  const XGUI_FeaturesModel* aModel = dynamic_cast<const XGUI_FeaturesModel*>(aIndex->model());
-  return aModel->object(*aIndex);
-}
-
-bool XGUI_DocumentDataModel::insertRows(int theRow, int theCount, const QModelIndex& theParent)
-{
-  beginInsertRows(theParent, theRow, theRow + theCount - 1);
-  //endInsertRows();
-
-  // Update history
-  QModelIndex aRoot;
-  int aRow = rowCount(aRoot);
-  beginInsertRows(aRoot, aRow, aRow);
-  endInsertRows();
-
-  return true;
-}
-
-bool XGUI_DocumentDataModel::removeRows(int theRow, int theCount, const QModelIndex& theParent)
-{
-  beginRemoveRows(theParent, theRow, theRow + theCount - 1);
-  endRemoveRows();
-  return true;
-}
-
-void XGUI_DocumentDataModel::removeSubModel(int theModelId)
-{
-  XGUI_PartModel* aModel = myPartModels.at(theModelId);
-  QIntList aToRemove;
-  for (int i = 0; i < myIndexes.size(); i++) {
-    if (myIndexes.at(i)->model() == aModel)
-      aToRemove.append(i);
-  }
-  int aId;
-  while (aToRemove.size() > 0) {
-    aId = aToRemove.last();
-    delete myIndexes.at(aId);
-    myIndexes.removeAt(aId);
-    aToRemove.removeLast();
-  }
-  delete aModel;
-  myPartModels.removeAt(theModelId);
-}
-
-bool XGUI_DocumentDataModel::isSubModel(const QAbstractItemModel* theModel) const
-{
-  if (theModel == myModel)
-    return true;
-  return isPartSubModel(theModel);
-}
-
-bool XGUI_DocumentDataModel::isPartSubModel(const QAbstractItemModel* theModel) const
-{
-  return myPartModels.contains((XGUI_PartModel*) theModel);
-}
-
-QModelIndex XGUI_DocumentDataModel::partFolderNode() const
-{
-  int aPos = myModel->rowCount(QModelIndex());
-  return createIndex(aPos, columnCount() - 1, PartsFolder);
-}
-
-int XGUI_DocumentDataModel::historyOffset() const
-{
-  // Nb of rows of top model + Parts folder
-  return myModel->rowCount(QModelIndex()) + 1;
-}
-
-bool XGUI_DocumentDataModel::activatedIndex(const QModelIndex& theIndex)
-{
-  if ((theIndex.internalId() == PartsFolder) || (theIndex.internalId() == HistoryNode))
-    return false;
-
-  QModelIndex* aIndex = toSourceModelIndex(theIndex);
-  if (!aIndex)
-    return false;
-
-  const QAbstractItemModel* aModel = aIndex->model();
-
-  if (isPartSubModel(aModel)) {
-    // if this is root node (Part item index)
-    if (!aIndex->parent().isValid()) {
-      if (myActivePart)
-        myActivePart->setItemsColor(PASSIVE_COLOR);
-
-        if (myActivePart == aModel) {
-          myActivePart = 0;
-          myActivePartIndex = QModelIndex();
-        } else {
-          myActivePart = (XGUI_PartModel*)aModel;
-          myActivePartIndex = theIndex;
-        }
-
-        if (myActivePart) {
-          myActivePart->setItemsColor(ACTIVE_COLOR);
-          myModel->setItemsColor(PASSIVE_COLOR);
-        } else
-          myModel->setItemsColor(ACTIVE_COLOR);
-        return true;
-      }
-    }
-  return false;
-}
-
-ResultPartPtr XGUI_DocumentDataModel::activePart() const
-{
-  if (myActivePart)
-    return myActivePart->part();
-  return ResultPartPtr();
-}
-
-void XGUI_DocumentDataModel::deactivatePart()
-{
-  if (myActivePart)
-    myActivePart->setItemsColor(PASSIVE_COLOR);
-    myActivePart = 0;
-    myActivePartIndex = QModelIndex();
-    myModel->setItemsColor(ACTIVE_COLOR);
-  }
-
-Qt::ItemFlags XGUI_DocumentDataModel::flags(const QModelIndex& theIndex) const
-{
-  Qt::ItemFlags aFlags = QAbstractItemModel::flags(theIndex);
-  if (object(theIndex)) {
-    aFlags |= Qt::ItemIsEditable;
-  }
-  return aFlags;
-}
-
-QModelIndex XGUI_DocumentDataModel::partIndex(const ResultPartPtr& theObject) const
-{
-  int aRow = -1;
-  XGUI_PartModel* aModel = 0;
-  foreach (XGUI_PartModel* aPartModel, myPartModels)
-  {
-    aRow++;
-    if (aPartModel->part() == theObject) {
-      aModel = aPartModel;
-      break;
-    }
-  }
-  if (aModel) {
-    return createIndex(aRow, 0, (void*) getModelIndex(aModel->index(0, 0, QModelIndex())));
-  }
-  return QModelIndex();
-}
-
-QModelIndex XGUI_DocumentDataModel::objectIndex(const ObjectPtr theObject) const
-{
-  // Check that this feature belongs to root document
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  DocumentPtr aDoc = theObject->document();
-  if (aDoc == aRootDoc) {
-    // This feature belongs to histrory or top model
-    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(theObject);
-    if (aFeature) {
-      int aId;
-      int aNb = aRootDoc->size(ModelAPI_Feature::group());
-      for (aId = 0; aId < aNb; aId++) {
-        if (theObject == aRootDoc->object(ModelAPI_Feature::group(), aId))
-          break;
-      }
-      if (aId < aNb)
-        return index(aId + historyOffset(), 0, QModelIndex());
-    } else {
-      QModelIndex aIndex = myModel->objectIndex(theObject);
-      return
-          aIndex.isValid() ?
-              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
-              QModelIndex();
-    }
-  } else {
-    XGUI_PartModel* aPartModel = 0;
-    foreach(XGUI_PartModel* aModel, myPartModels)
-    {
-      if (aModel->hasDocument(aDoc)) {
-        aPartModel = aModel;
-        break;
-      }
-    }
-    if (aPartModel) {
-      QModelIndex aIndex = aPartModel->objectIndex(theObject);
-      return
-          aIndex.isValid() ?
-              createIndex(aIndex.row(), aIndex.column(), (void*) getModelIndex(aIndex)) :
-              QModelIndex();
-    }
-  }
-  return QModelIndex();
-}
-
-
-void XGUI_DocumentDataModel::clear()
-{
-  clearModelIndexes();
-  clearSubModels();
-  myActivePart = 0;
-  myActivePartIndex = QModelIndex();
-  myModel->setItemsColor(ACTIVE_COLOR);
-}
diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h
deleted file mode 100644 (file)
index 63fa17a..0000000
+++ /dev/null
@@ -1,182 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-#ifndef XGUI_DocumentDataModel_H
-#define XGUI_DocumentDataModel_H
-
-#include "XGUI.h"
-#include <ModuleBase_Definitions.h>
-#include <ModelAPI_ResultPart.h>
-
-#include <Events_Listener.h>
-
-#include <QAbstractItemModel>
-#include <QList>
-
-class ModelAPI_Document;
-class XGUI_PartModel;
-class XGUI_TopDataModel;
-
-/**\class XGUI_DocumentDataModel
- * \ingroup GUI
- * \brief This is a proxy data model for Object Browser (QTreeView).
- * It contains several sub-models for generation of each sub-part of data tree.
- */
-class XGUI_EXPORT XGUI_DocumentDataModel : public QAbstractItemModel, public Events_Listener
-{
-Q_OBJECT
- public:
-   /// Constructor
-   /// \param theParent a parent object
-  XGUI_DocumentDataModel(QObject* theParent);
-  virtual ~XGUI_DocumentDataModel();
-
-  /// Event Listener method
-  /// \param theMessage an event message
-  virtual void processEvent(const std::shared_ptr<Events_Message>& theMessage);
-
-  /// Returns the data stored under the given role for the item referred to by the index.
-  /// \param theIndex a model index
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
-
-  /// Returns the data for the given role and section in the header with the specified orientation.
-  /// \param theSection a section
-  /// \param theOrient an orientation
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant headerData(int theSection, Qt::Orientation theOrient, int theRole =
-                                  Qt::DisplayRole) const;
-
-  /// Returns the number of rows under the given parent. When the parent is valid it means that 
-  /// rowCount is returning the number of children of parent.
-  /// \param theParent a parent model index
-  virtual int rowCount(const QModelIndex& theParent = QModelIndex()) const;
-
-  /// Returns the number of columns for the children of the given parent.
-  /// It has a one column
-  /// \param theParent a parent model index
-  virtual int columnCount(const QModelIndex& theParent = QModelIndex()) const;
-
-  /// Returns the index of the item in the model specified by the given row, column and parent index.
-  /// \param theRow a row
-  /// \param theColumn a column
-  /// \param theParent a parent model index
-  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex &theParent =
-                                QModelIndex()) const;
-
-  /// Returns the parent of the model item with the given index. 
-  /// If the item has no parent, an invalid QModelIndex is returned.
-  /// \param theIndex a model index
-  virtual QModelIndex parent(const QModelIndex& theIndex) const;
-
-  /// Returns true if parent has any children; otherwise returns false.
-  /// \param theParent a parent model index
-  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
-
-  /// Inserts count rows into the model before the given row. 
-  /// Items in the new row will be children of the item represented by the parent model index.
-  /// \param theRow a start row
-  /// \param theCount a nember of rows to insert
-  /// \param theParent a parent model index
-  bool insertRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
-
-  /// Removes count rows starting with the given row under parent parent from the model.
-  /// \param theRow a start row
-  /// \param theCount a nember of rows to remove
-  /// \param theParent a parent model index
-  bool removeRows(int theRow, int theCount, const QModelIndex& theParent = QModelIndex());
-
-  /// Returns the item flags for the given index.
-  /// \param theIndex a model index
-  Qt::ItemFlags flags(const QModelIndex& theIndex) const;
-
-  //! Returns an object by the given Model index.
-  //! Returns 0 if the given index is not index of an object
-  ObjectPtr object(const QModelIndex& theIndex) const;
-
-  //! Returns index of the object
-  //! \param theObject object to find
-  QModelIndex objectIndex(const ObjectPtr theObject) const;
-
-  //! Returns QModelIndex which corresponds to the given part
-  //! If the object is not found then index is not valid
-  //! \param thePart a part for analysis
-  QModelIndex partIndex(const ResultPartPtr& thePart) const;
-
-  //! Activates a part data model if the index is a Part node index. 
-  //! Returns true if active part changed.
-  //! \param theIndex a model index
-  bool activatedIndex(const QModelIndex& theIndex);
-
-  //! Retrurns active part
-  ResultPartPtr activePart() const;
-
-  //! Retrurns QModelIndex of active part
-  QModelIndex activePartIndex() const
-  {
-    return myActivePartIndex;
-  }
-
-  //! Deactivates a Part
-  void deactivatePart();
-
-  //! Rebuild data tree
-  void rebuildDataTree();
-
-  //! Clear internal data
-  void clear();
-
-
- private:
-
-  enum
-  {
-    PartsFolder,
-    HistoryNode
-  };
-
-  //! Converts QModelIndex of this model to QModelIndex of a one of sub-models.
-  QModelIndex* toSourceModelIndex(const QModelIndex& theProxy) const;
-
-  //! Finds a pointer on QModelIndex which is equal to the given one
-  QModelIndex* findModelIndex(const QModelIndex& theIndex) const;
-
-  //! Returns pointer on QModelIndex which is equal to the given one.
-  QModelIndex* getModelIndex(const QModelIndex& theIndex) const;
-
-  //! Deletes all saved pointers on QModelIndex objects.
-  void clearModelIndexes();
-
-  //! Deletes all saved pointers on QModelIndex objects.
-  void clearSubModels();
-
-  //! Removes sub-model on removing a part object. Also it removes QModelIndex-es which refer to this model
-  void removeSubModel(int theModelId);
-
-  //! Returns true if the given model is a one of sub-models (of both types)
-  bool isSubModel(const QAbstractItemModel* theModel) const;
-
-  //! Returns true if the given model is a one of sub-models of Part type
-  bool isPartSubModel(const QAbstractItemModel* theModel) const;
-
-  //! Returns Parts Folder node
-  QModelIndex partFolderNode() const;
-
-  int historyOffset() const;
-
-  //! Data model of top part of data tree (not parts object)
-  XGUI_TopDataModel* myModel;
-
-  //! Data models for Parts data tree representation (one data model per a one part)
-  QList<XGUI_PartModel*> myPartModels;
-
-  //! Active part in part editing mode
-  XGUI_PartModel* myActivePart;
-
-  QModelIndex myActivePartIndex;
-
-  //! List of saved QModelIndexes created by sub-models
-  QList<QModelIndex*> myIndexes;
-
-};
-
-#endif
index 75f6c32a9d86d2f0c27e7bc1fd6793ef5bde89ea..3851b9fbee9fe2cbde17b715993c6bbeef8167ee 100644 (file)
@@ -1,15 +1,14 @@
 // Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
 
 #include "XGUI_ObjectsBrowser.h"
-#include "XGUI_DocumentDataModel.h"
 #include "XGUI_Tools.h"
 
 #include <ModelAPI_Data.h>
 #include <ModelAPI_Session.h>
 #include <ModelAPI_Document.h>
-#include <ModelAPI_Object.h>
 
 #include <ModuleBase_Tools.h>
+#include <ModuleBase_IDocumentDataModel.h>
 
 #include <QLayout>
 #include <QLabel>
 #include <QAction>
 #include <QStyledItemDelegate>
 
+
+/// Width of second column (minimum acceptable = 27)
+#define SECOND_COL_WIDTH 30
+
+
 /**
 * \ingroup GUI
 * Tree item delegate for definition of data in column items editor
@@ -38,7 +42,7 @@ public:
   {
     QLineEdit* aEditor = dynamic_cast<QLineEdit*>(editor);
     if (aEditor) {
-      XGUI_DocumentDataModel* aModel = myTreedView->dataModel();
+      ModuleBase_IDocumentDataModel* aModel = myTreedView->dataModel();
       ObjectPtr aObj = aModel->object(index);
       if (aObj.get() != NULL) {
         aEditor->setText(aObj->data()->name().c_str());
@@ -57,53 +61,20 @@ XGUI_DataTree::XGUI_DataTree(QWidget* theParent)
     : QTreeView(theParent)
 {
   setHeaderHidden(true);
-  setModel(new XGUI_DocumentDataModel(this));
   setEditTriggers(QAbstractItemView::NoEditTriggers);
   setSelectionBehavior(QAbstractItemView::SelectRows);
   setSelectionMode(QAbstractItemView::ExtendedSelection);
 
   setItemDelegateForColumn(0, new XGUI_TreeViewItemDelegate(this));
-
-  connect(selectionModel(), SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
-          this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
 }
 
 XGUI_DataTree::~XGUI_DataTree()
 {
 }
 
-XGUI_DocumentDataModel* XGUI_DataTree::dataModel() const
+ModuleBase_IDocumentDataModel* XGUI_DataTree::dataModel() const
 {
-  return static_cast<XGUI_DocumentDataModel*>(model());
-}
-
-void XGUI_DataTree::onSelectionChanged(const QItemSelection& theSelected,
-                                       const QItemSelection& theDeselected)
-{
-  mySelectedData.clear();
-  QModelIndexList aIndexes = selectionModel()->selectedIndexes();
-  XGUI_DocumentDataModel* aModel = dataModel();
-  QModelIndexList::const_iterator aIt;
-  for (aIt = aIndexes.constBegin(); aIt != aIndexes.constEnd(); ++aIt) {
-    ObjectPtr aObject = aModel->object(*aIt);
-    if (aObject)
-      mySelectedData.append(aObject);
-  }
-  emit selectionChanged();
-}
-
-void XGUI_DataTree::mouseDoubleClickEvent(QMouseEvent* theEvent)
-{
-  if (theEvent->button() == Qt::LeftButton) {
-    QModelIndex aIndex = currentIndex();
-    XGUI_DocumentDataModel* aModel = dataModel();
-    ObjectPtr aObject = aModel->object(aIndex);
-    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
-    if (aPart) {
-      aPart->activate();
-    }
-  } else
-    QTreeView::mouseDoubleClickEvent(theEvent);
+  return static_cast<ModuleBase_IDocumentDataModel*>(model());
 }
 
 void XGUI_DataTree::contextMenuEvent(QContextMenuEvent* theEvent)
@@ -116,27 +87,38 @@ void XGUI_DataTree::commitData(QWidget* theEditor)
   QLineEdit* aEditor = dynamic_cast<QLineEdit*>(theEditor);
   if (aEditor) {
     QString aRes = aEditor->text();
-    ObjectPtr aFeature = mySelectedData.first();
+    QModelIndexList aIndexList = selectionModel()->selectedIndexes();
+    ModuleBase_IDocumentDataModel* aModel = dataModel();
+    ObjectPtr aObj = aModel->object(aIndexList.first());
     SessionPtr aMgr = ModelAPI_Session::get();
     aMgr->startOperation("Rename");
-    aFeature->data()->setName(qPrintable(aRes));
+    aObj->data()->setName(qPrintable(aRes));
     aMgr->finishOperation();
   }
 }
 
 void XGUI_DataTree::clear() 
 {
-  mySelectedData.clear();
-  XGUI_DocumentDataModel* aModel = dataModel();
+  ModuleBase_IDocumentDataModel* aModel = dataModel();
   aModel->clear();
   reset();
 }
 
+void XGUI_DataTree::resizeEvent(QResizeEvent* theEvent)
+{
+  QSize aSize = theEvent->size();
+  if (aSize.isValid()) {
+    setColumnWidth(0, aSize.width() - SECOND_COL_WIDTH);
+    setColumnWidth(1, SECOND_COL_WIDTH);
+  }
+}
+
+
 //********************************************************************
 //********************************************************************
 //********************************************************************
 XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
-    : QWidget(theParent)
+    : QWidget(theParent), myDocModel(0)
 {
   QVBoxLayout* aLayout = new QVBoxLayout(this);
   ModuleBase_Tools::zeroMargins(aLayout);
@@ -179,24 +161,14 @@ XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
   myTreeView = new XGUI_DataTree(this);
   aLayout->addWidget(myTreeView);
 
-  myDocModel = myTreeView->dataModel();
-
   aLabelWgt->setFrameShape(myTreeView->frameShape());
   aLabelWgt->setFrameShadow(myTreeView->frameShadow());
 
-  connect(myTreeView, SIGNAL(selectionChanged()), this, SLOT(onSelectionChanged()));
-  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this,
-          SLOT(onActivePartChanged(ObjectPtr)));
-  connect(myTreeView, SIGNAL(activePartChanged(ObjectPtr)), this,
-          SIGNAL(activePartChanged(ObjectPtr)));
-
   connect(myActiveDocLbl, SIGNAL(customContextMenuRequested(const QPoint&)), this,
           SLOT(onLabelContextMenuRequested(const QPoint&)));
   connect(myTreeView, SIGNAL(contextMenuRequested(QContextMenuEvent*)), this,
           SLOT(onContextMenuRequested(QContextMenuEvent*)));
 
-  onActivePartChanged(ObjectPtr());
-
   // Create internal actions
   QAction* aAction = new QAction(QIcon(":pictures/rename_edit.png"), tr("Rename"), this);
   aAction->setData("RENAME_CMD");
@@ -209,32 +181,11 @@ XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
 {
 }
 
-//***************************************************
-void XGUI_ObjectsBrowser::onActivePartChanged(ObjectPtr thePart)
-{
-  QPalette aPalet = myActiveDocLbl->palette();
-  if (thePart) {
-    aPalet.setColor(QPalette::Text, Qt::black);
-  } else {
-    aPalet.setColor(QPalette::Text, QColor(0, 72, 140));
-  }
-  myActiveDocLbl->setPalette(aPalet);
-}
-
 //***************************************************
 bool XGUI_ObjectsBrowser::eventFilter(QObject* obj, QEvent* theEvent)
 {
   if (obj == myActiveDocLbl) {
-    if (myActiveDocLbl->isReadOnly()) {
-      if (theEvent->type() == QEvent::MouseButtonDblClick) {
-        if (myDocModel->activePartIndex().isValid()) {
-          myTreeView->setExpanded(myDocModel->activePartIndex(), false);
-        }
-        myDocModel->deactivatePart();
-        onActivePartChanged(ObjectPtr());
-        emit activePartChanged(ObjectPtr());
-      }
-    } else {
+    if (!myActiveDocLbl->isReadOnly()) {
       // End of editing by mouse click
       if (theEvent->type() == QEvent::MouseButtonRelease) {
         QMouseEvent* aEvent = (QMouseEvent*) theEvent;
@@ -275,40 +226,10 @@ void XGUI_ObjectsBrowser::closeDocNameEditing(bool toSave)
   }
 }
 
-//***************************************************
-void XGUI_ObjectsBrowser::activatePart(const ResultPartPtr& thePart)
-{
-  if (thePart) {
-    QModelIndex aIndex = myDocModel->partIndex(thePart);
-
-    if ((myDocModel->activePartIndex() != aIndex) && myDocModel->activePartIndex().isValid()) {
-      myTreeView->setExpanded(myDocModel->activePartIndex(), false);
-    }
-    bool isChanged = myDocModel->activatedIndex(aIndex);
-    if (isChanged) {
-      if (myDocModel->activePartIndex().isValid()) {
-        myTreeView->setExpanded(aIndex.parent(), true);
-        myTreeView->setExpanded(aIndex, true);
-        onActivePartChanged(myDocModel->object(aIndex));
-      } else {
-        onActivePartChanged(ObjectPtr());
-      }
-    }
-  } else {
-    QModelIndex aIndex = myDocModel->activePartIndex();
-    if (aIndex.isValid()) {
-      myDocModel->activatedIndex(aIndex);
-      myTreeView->setExpanded(aIndex, false);
-      onActivePartChanged(ObjectPtr());
-    }
-  }
-}
-
 //***************************************************
 void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
 {
-  myObjectsList = myTreeView->selectedObjects();
-  bool toEnable = myObjectsList.size() == 1;
+  bool toEnable = mySelectedData.size() == 1;
   foreach(QAction* aCmd, actions())
   {
     aCmd->setEnabled(toEnable);
@@ -319,9 +240,9 @@ void XGUI_ObjectsBrowser::onContextMenuRequested(QContextMenuEvent* theEvent)
 //***************************************************
 void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt)
 {
-  myObjectsList.clear();
+  mySelectedData.clear();
   //Empty feature pointer means that selected root document
-  myObjectsList.append(ObjectPtr());
+  mySelectedData.append(ObjectPtr());
 
   foreach(QAction* aCmd, actions())
   {
@@ -334,8 +255,8 @@ void XGUI_ObjectsBrowser::onLabelContextMenuRequested(const QPoint& thePnt)
 //***************************************************
 void XGUI_ObjectsBrowser::onEditItem()
 {
-  if (myObjectsList.size() > 0) {
-    ObjectPtr aFeature = myObjectsList.first();
+  if (mySelectedData.size() > 0) {
+    ObjectPtr aFeature = mySelectedData.first();
     if (aFeature) {  // Selection happens in TreeView
       // Find index which corresponds the feature
       QModelIndex aIndex;
@@ -361,13 +282,6 @@ void XGUI_ObjectsBrowser::onEditItem()
   }
 }
 
-//***************************************************
-void XGUI_ObjectsBrowser::onSelectionChanged()
-{
-  myObjectsList = myTreeView->selectedObjects();
-  emit selectionChanged();
-}
-
 //***************************************************
 void XGUI_ObjectsBrowser::rebuildDataTree()
 {
@@ -392,15 +306,34 @@ void XGUI_ObjectsBrowser::setObjectsSelected(const QObjectPtrList& theObjects)
 }
 
 //***************************************************
-void XGUI_ObjectsBrowser::processEvent(const std::shared_ptr<Events_Message>& theMessage)
+void XGUI_ObjectsBrowser::clearContent()  
 { 
-  myDocModel->processEvent(theMessage); 
+  mySelectedData.clear();
+  myTreeView->clear(); 
 }
 
+void XGUI_ObjectsBrowser::setDataModel(ModuleBase_IDocumentDataModel* theModel)
+{
+  myDocModel = theModel;
+  myTreeView->setModel(myDocModel);
+  QItemSelectionModel* aSelMod = myTreeView->selectionModel();
+  connect(aSelMod, SIGNAL(selectionChanged(const QItemSelection&, const QItemSelection&)),
+          this, SLOT(onSelectionChanged(const QItemSelection&, const QItemSelection&)));
+}
 
-//***************************************************
-void XGUI_ObjectsBrowser::clearContent()  
-{ 
-  myObjectsList.clear();
-  myTreeView->clear(); 
+void XGUI_ObjectsBrowser::onSelectionChanged(const QItemSelection& theSelected,
+                                       const QItemSelection& theDeselected)
+{
+  mySelectedData.clear();
+  QModelIndexList aIndexes = myTreeView->selectionModel()->selectedIndexes();
+  ModuleBase_IDocumentDataModel* aModel = dataModel();
+  QModelIndexList::const_iterator aIt;
+  for (aIt = aIndexes.constBegin(); aIt != aIndexes.constEnd(); ++aIt) {
+    if ((*aIt).column() == 0) {
+      ObjectPtr aObject = aModel->object(*aIt);
+      if (aObject)
+        mySelectedData.append(aObject);
+    }
+  }
+  emit selectionChanged();
 }
index 93cc131be4f458eb27428306fca6400e2696549f..169615c3d88c2e4ff3fa9cca619c1686c4346238 100644 (file)
@@ -12,7 +12,7 @@
 #include <QWidget>
 #include <QTreeView>
 
-class XGUI_DocumentDataModel;
+class ModuleBase_IDocumentDataModel;
 class QLineEdit;
 
 /**
@@ -26,24 +26,13 @@ Q_OBJECT
    /// Constructor
    /// \param theParent a parent widget
   XGUI_DataTree(QWidget* theParent);
-  virtual ~XGUI_DataTree();
 
-  //! Returns list of currently selected objects
-  QObjectPtrList selectedObjects() const
-  {
-    return mySelectedData;
-  }
+  virtual ~XGUI_DataTree();
 
   /// Returns current data model
-  XGUI_DocumentDataModel* dataModel() const;
+  ModuleBase_IDocumentDataModel* dataModel() const;
 
 signals:
-  //! Emited when selection is changed
-  void selectionChanged();
-
-  //! Emited when active part changed
-  void activePartChanged(ObjectPtr thePart);
-
   //! Emited on context menu request
   void contextMenuRequested(QContextMenuEvent* theEvent);
 
@@ -52,23 +41,16 @@ public slots:
   virtual void clear();
 
  protected slots:
-   /// Commit modified data (used for renaming of objects)
+  /// Commit modified data (used for renaming of objects)
   virtual void commitData(QWidget* theEditor);
 
  protected:
-   /// Redefinition of virtual method
-  virtual void mouseDoubleClickEvent(QMouseEvent* theEvent);
-
    /// Redefinition of virtual method
   virtual void contextMenuEvent(QContextMenuEvent* theEvent);
 
- private slots:
-  //! Called when selection in Data Tree is changed
-  void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
+   /// Redefinition of virtual method
+  virtual void resizeEvent(QResizeEvent* theEvent);
 
- private:
-  //! List of currently selected data
-  QObjectPtrList mySelectedData;
 };
 
 /**\class XGUI_ObjectsBrowser
@@ -85,7 +67,7 @@ Q_OBJECT
   virtual ~XGUI_ObjectsBrowser();
 
   //! Returns Model which provides access to data objects
-  XGUI_DocumentDataModel* dataModel() const
+  ModuleBase_IDocumentDataModel* dataModel() const
   {
     return myDocModel;
   }
@@ -93,7 +75,7 @@ Q_OBJECT
   //! Returns list of currently selected objects
   QObjectPtrList selectedObjects() const
   {
-    return myObjectsList;
+    return mySelectedData;
   }
 
   /// Set selected list of objects
@@ -112,26 +94,22 @@ Q_OBJECT
     return myTreeView;
   }
 
-  //! Activates currently selected part. Signal activePartChanged will not be sent
-  void activatePart(const ResultPartPtr& thePart);
+  /// Returns active doc label object
+  QLineEdit* activeDocLabel() const { return myActiveDocLbl; }
 
   /// Rebuild data tree
   void rebuildDataTree();
 
-  /// Process application event
-  /// \param theMessage an event message
-  void processEvent(const std::shared_ptr<Events_Message>& theMessage);
-
   /// Resets the object browser into initial state
   void clearContent();
 
+  /// Set Data Model for the Object Browser
+  void setDataModel(ModuleBase_IDocumentDataModel* theModel);
+
 signals:
   //! Emited when selection is changed
   void selectionChanged();
 
-  //! Emited when current active document is changed
-  void activePartChanged(ObjectPtr thePart);
-
   //! Emited on context menu request
   void contextMenuRequested(QContextMenuEvent* theEvent);
 
@@ -140,10 +118,6 @@ signals:
   virtual bool eventFilter(QObject* obj, QEvent* theEvent);
 
  private slots:
-   /// Activate part
-   /// \param thePart a part to activate
-  void onActivePartChanged(ObjectPtr thePart);
-
   /// Show context menu
   /// \param theEvent a context menu event
   void onContextMenuRequested(QContextMenuEvent* theEvent);
@@ -155,19 +129,19 @@ signals:
   //! Called on Edit command request
   void onEditItem();
 
-  /// Process selection changed event
-  void onSelectionChanged();
+  //! Called when selection in Data Tree is changed
+  void onSelectionChanged(const QItemSelection& theSelected, const QItemSelection& theDeselected);
 
  private:
   void closeDocNameEditing(bool toSave);
 
   //! Internal model
-  XGUI_DocumentDataModel* myDocModel;
+  ModuleBase_IDocumentDataModel* myDocModel;
 
   QLineEdit* myActiveDocLbl;
   XGUI_DataTree* myTreeView;
 
-  QObjectPtrList myObjectsList;
+  QObjectPtrList mySelectedData;
 };
 
 #endif
diff --git a/src/XGUI/XGUI_PartDataModel.cpp b/src/XGUI/XGUI_PartDataModel.cpp
deleted file mode 100644 (file)
index bbf0ef9..0000000
+++ /dev/null
@@ -1,573 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-#include "XGUI_PartDataModel.h"
-#include "XGUI_Workshop.h"
-
-#include <ModelAPI_Session.h>
-#include <ModelAPI_Document.h>
-#include <ModelAPI_Feature.h>
-#include <ModelAPI_Result.h>
-#include <ModelAPI_Data.h>
-#include <ModelAPI_AttributeDocRef.h>
-#include <ModelAPI_Object.h>
-#include <ModelAPI_ResultPart.h>
-#include <ModelAPI_ResultConstruction.h>
-#include <ModelAPI_ResultParameter.h>
-#include <ModelAPI_ResultBody.h>
-#include <ModelAPI_ResultGroup.h>
-#include <ModelAPI_AttributeDouble.h>
-
-#include <QIcon>
-#include <QBrush>
-
-//ObjectPtr featureObj(const ObjectPtr& theFeature)
-//{
-//  ObjectPtr aObject = std::dynamic_pointer_cast<ModelAPI_Object>(theFeature);
-//  if (aObject)
-//    return aObject->featureRef();
-//  return theFeature;
-//}
-
-XGUI_TopDataModel::XGUI_TopDataModel(QObject* theParent)
-    : XGUI_FeaturesModel(theParent)
-{
-}
-
-XGUI_TopDataModel::~XGUI_TopDataModel()
-{
-}
-
-QVariant XGUI_TopDataModel::data(const QModelIndex& theIndex, int theRole) const
-{
-  switch (theRole) {
-    case Qt::DisplayRole:
-      // return a name
-      switch (theIndex.internalId()) {
-        case ParamsFolder:
-          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
-        case ParamObject: {
-          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
-          if (aObject) {
-            ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObject);
-            AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
-            QString aVal = QString::number(aValueAttribute->value());
-            QString aTitle = QString(aObject->data()->name().c_str());
-            return aTitle + " = " + aVal;
-          }
-        }
-          break;
-        case ConstructFolder:
-          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
-        case ConstructObject: {
-          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultConstruction::group(),
-                                               theIndex.row());
-          if (aObject)
-            return aObject->data()->name().c_str();
-        }
-          break;
-        //case GroupsFolder:
-        //  return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
-        //case GroupObject: {
-        //  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-        //  ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultGroup::group(),
-        //                                       theIndex.row());
-        //  if (aObject)
-        //    return aObject->data()->name().c_str();
-        //}
-        //  break;
-      }
-      break;
-
-    case Qt::DecorationRole:
-      {
-      // return an Icon
-      switch (theIndex.internalId()) {
-        case ParamsFolder:
-          return QIcon(":pictures/params_folder.png");
-        case ConstructFolder:
-          return QIcon(":pictures/constr_folder.png");
-        case ConstructObject:
-          return QIcon(":pictures/constr_object.png");
-        //case GroupsFolder:
-        //  return QIcon(":pictures/constr_folder.png");
-        }
-      }
-      break;
-
-    case Qt::ToolTipRole:
-      // return Tooltip
-      break;
-    case Qt::ForegroundRole:
-      return QBrush(myItemsColor);
-      break;
-  }
-  return QVariant();
-}
-
-QVariant XGUI_TopDataModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
-  return QVariant();
-}
-
-int XGUI_TopDataModel::rowCount(const QModelIndex& theParent) const
-{
-  if (!theParent.isValid())
-    return 2;  // In case of groups using it has to be +1
-
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  if (theParent.internalId() == ParamsFolder)
-    return aRootDoc->size(ModelAPI_ResultParameter::group());
-
-  if (theParent.internalId() == ConstructFolder)
-    return aRootDoc->size(ModelAPI_ResultConstruction::group());
-
-  //if (theParent.internalId() == GroupsFolder)
-  //  return aRootDoc->size(ModelAPI_ResultGroup::group());
-
-  return 0;
-}
-
-int XGUI_TopDataModel::columnCount(const QModelIndex &parent) const
-{
-  return 1;
-}
-
-QModelIndex XGUI_TopDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const
-{
-  if (!theParent.isValid()) {
-    switch (theRow) {
-      case 0:
-        return createIndex(theRow, theColumn, (qint32) ParamsFolder);
-      case 1:
-        return createIndex(theRow, theColumn, (qint32) ConstructFolder);
-      //case 2:
-      //  return createIndex(theRow, theColumn, (qint32) GroupsFolder);
-    }
-  } else {
-    if (theParent.internalId() == ParamsFolder)
-      return createIndex(theRow, theColumn, (qint32) ParamObject);
-
-    if (theParent.internalId() == ConstructFolder)
-      return createIndex(theRow, theColumn, (qint32) ConstructObject);
-
-    //if (theParent.internalId() == GroupsFolder)
-    //  return createIndex(theRow, theColumn, (qint32) GroupObject);
-  }
-  return QModelIndex();
-}
-
-QModelIndex XGUI_TopDataModel::parent(const QModelIndex& theIndex) const
-{
-  int aId = (int) theIndex.internalId();
-  switch (aId) {
-    case ParamsFolder:
-    case ConstructFolder:
-    //case GroupsFolder:
-      return QModelIndex();
-    case ParamObject:
-      return createIndex(0, 0, (qint32) ParamsFolder);
-    case ConstructObject:
-      return createIndex(1, 0, (qint32) ConstructFolder);
-    //case GroupObject:
-    //  return createIndex(2, 0, (qint32) GroupsFolder);
-  }
-  return QModelIndex();
-}
-
-bool XGUI_TopDataModel::hasChildren(const QModelIndex& theParent) const
-{
-  return rowCount(theParent) > 0;
-}
-
-ObjectPtr XGUI_TopDataModel::object(const QModelIndex& theIndex) const
-{
-  switch (theIndex.internalId()) {
-    case ParamsFolder:
-    case ConstructFolder:
-      return ObjectPtr();
-    case ParamObject: {
-      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-      return aRootDoc->object(ModelAPI_ResultParameter::group(), theIndex.row());
-    }
-    case ConstructObject: {
-      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-      return aRootDoc->object(ModelAPI_ResultConstruction::group(), theIndex.row());
-    }
-    //case GroupObject: {
-    //  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    //  return aRootDoc->object(ModelAPI_ResultGroup::group(), theIndex.row());
-    //}
-  }
-  return ObjectPtr();
-}
-
-QModelIndex XGUI_TopDataModel::findParent(const ObjectPtr& theObject) const
-{
-  return findGroup(theObject->groupName().c_str());
-}
-
-QModelIndex XGUI_TopDataModel::findGroup(const std::string& theGroup) const
-{
-  if (theGroup == ModelAPI_ResultParameter::group())
-    return createIndex(0, 0, (qint32) ParamsFolder);
-  if (theGroup == ModelAPI_ResultConstruction::group())
-    return createIndex(1, 0, (qint32) ConstructFolder);
-  //if (theGroup == ModelAPI_ResultGroup::group())
-  //  return createIndex(2, 0, (qint32) ConstructFolder);
-  return QModelIndex();
-}
-
-QModelIndex XGUI_TopDataModel::objectIndex(const ObjectPtr& theObject) const
-{
-  QModelIndex aIndex;
-  if (theObject) {
-    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    std::string aGroup = theObject->groupName();
-    int aNb = aRootDoc->size(aGroup);
-    int aRow = -1;
-    for (int i = 0; i < aNb; i++) {
-      if (aRootDoc->object(aGroup, i) == theObject) {
-        aRow = i;
-        break;
-      }
-    }
-    if (aRow != -1) {
-      if (aGroup == ModelAPI_ResultParameter::group())
-        return createIndex(aRow, 0, (qint32) ParamObject);
-      if (aGroup == ModelAPI_ResultConstruction::group())
-        return createIndex(aRow, 0, (qint32) ConstructObject);
-      //if (aGroup == ModelAPI_ResultGroup::group())
-      //  return createIndex(aRow, 0, (qint32) GroupObject);
-    }
-  }
-  return aIndex;
-}
-
-//******************************************************************
-//******************************************************************
-//******************************************************************
-XGUI_PartDataModel::XGUI_PartDataModel(QObject* theParent)
-    : XGUI_PartModel(theParent)
-{
-}
-
-XGUI_PartDataModel::~XGUI_PartDataModel()
-{
-}
-
-QVariant XGUI_PartDataModel::data(const QModelIndex& theIndex, int theRole) const
-{
-  switch (theRole) {
-    case Qt::DisplayRole:
-      // return a name
-      switch (theIndex.internalId()) {
-        case MyRoot: {
-          DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-          ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-          if (aObject)
-            return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
-        }
-        case ParamsFolder:
-          return tr("Parameters") + QString(" (%1)").arg(rowCount(theIndex));
-        case ConstructFolder:
-          return tr("Constructions") + QString(" (%1)").arg(rowCount(theIndex));
-        case BodiesFolder:
-          return tr("Bodies") + QString(" (%1)").arg(rowCount(theIndex));
-        case GroupsFolder:
-          return tr("Groups") + QString(" (%1)").arg(rowCount(theIndex));
-        case ParamObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultParameter::group(),
-                                                     theIndex.row());
-          if (aObject) {
-            ResultParameterPtr aParam = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObject);
-            AttributeDoublePtr aValueAttribute = aParam->data()->real(ModelAPI_ResultParameter::VALUE());
-            QString aVal = QString::number(aValueAttribute->value());
-            QString aTitle = QString(aObject->data()->name().c_str());
-            return aTitle + " = " + aVal;
-          }
-        }
-          break;
-        case ConstructObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultConstruction::group(),
-                                                     theIndex.row());
-          if (aObject)
-            return std::dynamic_pointer_cast<ModelAPI_Object>(aObject)->data()->name().c_str();
-        }
-          break;
-        case BodiesObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
-          if (aObject)
-            return aObject->data()->name().c_str();
-        }
-          break;
-        case GroupObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
-          if (aObject)
-            return aObject->data()->name().c_str();
-        }
-        case HistoryObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
-          if (aObject)
-            return aObject->data()->name().c_str();
-        }
-      }
-      break;
-    case Qt::DecorationRole:
-      // return an Icon
-      switch (theIndex.internalId()) {
-        case MyRoot:
-          return QIcon(":pictures/part_ico.png");
-        case ParamsFolder:
-          return QIcon(":pictures/params_folder.png");
-        case ConstructFolder:
-        case BodiesFolder:
-          return QIcon(":pictures/constr_folder.png");
-        case GroupsFolder:
-          return QIcon(":pictures/constr_folder.png");
-        case ConstructObject:
-        case GroupObject:
-        case BodiesObject: {
-          std::string aGroup = theIndex.internalId() == ConstructObject ?
-            ModelAPI_ResultConstruction::group() : ModelAPI_ResultBody::group();
-          ObjectPtr anObject = partDocument()->object(aGroup, theIndex.row());
-          if (anObject && anObject->data() && 
-              anObject->data()->execState() == ModelAPI_StateMustBeUpdated) {
-            return QIcon(":pictures/constr_object_modified.png");
-          }
-          return QIcon(":pictures/constr_object.png");
-        }
-        case HistoryObject: {
-          ObjectPtr aObject = partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
-          FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObject);
-          if (aFeature)
-            return XGUI_Workshop::featureIcon(aFeature);
-        }
-      }
-      break;
-    case Qt::ToolTipRole:
-      // return Tooltip
-      break;
-    case Qt::ForegroundRole:
-      return QBrush(myItemsColor);
-      break;
-  }
-  return QVariant();
-}
-
-QVariant XGUI_PartDataModel::headerData(int section, Qt::Orientation orientation, int role) const
-{
-  return QVariant();
-}
-
-int XGUI_PartDataModel::rowCount(const QModelIndex& parent) const
-{
-  if (!parent.isValid()) {
-    DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-    if (aRootDoc->object(ModelAPI_ResultPart::group(), myId))
-      return 1;
-    else
-      return 0;
-  }
-  switch (parent.internalId()) {
-    case MyRoot:
-      {
-        DocumentPtr aDoc = partDocument();
-        if (aDoc) {
-          return getRowsNumber() + aDoc->size(ModelAPI_Feature::group());
-        } else 
-          return 0;
-      }
-    case ParamsFolder:
-      return partDocument()->size(ModelAPI_ResultParameter::group());
-    case ConstructFolder:
-      return partDocument()->size(ModelAPI_ResultConstruction::group());
-    case BodiesFolder:
-      return partDocument()->size(ModelAPI_ResultBody::group());
-    case GroupsFolder:
-      return partDocument()->size(ModelAPI_ResultGroup::group());
-  }
-  return 0;
-}
-
-int XGUI_PartDataModel::columnCount(const QModelIndex &parent) const
-{
-  return 1;
-}
-
-QModelIndex XGUI_PartDataModel::index(int theRow, int theColumn, const QModelIndex &theParent) const
-{
-  if (!theParent.isValid())
-    return createIndex(theRow, 0, (qint32) MyRoot);
-
-  int aId = (int) theParent.internalId();
-  switch (aId) {
-    case MyRoot:
-      switch (theRow) {
-        case 0:
-          return createIndex(theRow, 0, (qint32) ParamsFolder);
-        case 1:
-          return createIndex(theRow, 0, (qint32) ConstructFolder);
-        case 2:
-          return createIndex(theRow, 0, (qint32) BodiesFolder);
-        case 3:
-          {
-          int aSize = partDocument()->size(ModelAPI_ResultGroup::group());
-          if (aSize > 0)
-            return createIndex(theRow, 0, (qint32) GroupsFolder);
-          else
-            return createIndex(theRow, theColumn, (qint32) HistoryObject);
-          }
-        default:
-          return createIndex(theRow, theColumn, (qint32) HistoryObject);
-      }
-    case ParamsFolder:
-      return createIndex(theRow, 0, (qint32) ParamObject);
-    case ConstructFolder:
-      return createIndex(theRow, 0, (qint32) ConstructObject);
-    case BodiesFolder:
-      return createIndex(theRow, 0, (qint32) BodiesObject);
-    case GroupsFolder:
-      return createIndex(theRow, 0, (qint32) GroupObject);
-  }
-  return QModelIndex();
-}
-
-QModelIndex XGUI_PartDataModel::parent(const QModelIndex& theIndex) const
-{
-  switch (theIndex.internalId()) {
-    case MyRoot:
-      return QModelIndex();
-    case ParamsFolder:
-    case ConstructFolder:
-    case BodiesFolder:
-    case GroupsFolder:
-    case HistoryObject:
-      return createIndex(0, 0, (qint32) MyRoot);
-
-    case ParamObject:
-      return createIndex(0, 0, (qint32) ParamsFolder);
-    case ConstructObject:
-      return createIndex(1, 0, (qint32) ConstructFolder);
-    case BodiesObject:
-      return createIndex(2, 0, (qint32) BodiesFolder);
-    case GroupObject:
-      return createIndex(3, 0, (qint32) GroupsFolder);
-  }
-  return QModelIndex();
-}
-
-bool XGUI_PartDataModel::hasChildren(const QModelIndex& theParent) const
-{
-  return rowCount(theParent) > 0;
-}
-
-DocumentPtr XGUI_PartDataModel::partDocument() const
-{
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  ObjectPtr aObject = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-  ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObject);
-  if (aPart)
-    return aPart->partDoc();
-  return DocumentPtr(); // null if not found
-}
-
-ObjectPtr XGUI_PartDataModel::object(const QModelIndex& theIndex) const
-{
-  switch (theIndex.internalId()) {
-    case MyRoot: {
-      DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-      return aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-    }
-    case ParamsFolder:
-    case ConstructFolder:
-    case BodiesFolder:
-    case GroupsFolder:
-      return ObjectPtr();
-
-    case ParamObject:
-      return partDocument()->object(ModelAPI_ResultParameter::group(), theIndex.row());
-    case ConstructObject:
-      return partDocument()->object(ModelAPI_ResultConstruction::group(), theIndex.row());
-    case BodiesObject:
-      return partDocument()->object(ModelAPI_ResultBody::group(), theIndex.row());
-    case GroupObject:
-      return partDocument()->object(ModelAPI_ResultGroup::group(), theIndex.row());
-    case HistoryObject:
-      return partDocument()->object(ModelAPI_Feature::group(), theIndex.row() - getRowsNumber());
-  }
-  return ObjectPtr();
-}
-
-bool XGUI_PartDataModel::hasDocument(const DocumentPtr& theDoc) const
-{
-  return (partDocument() == theDoc);
-}
-
-QModelIndex XGUI_PartDataModel::findParent(const ObjectPtr& theObject) const
-{
-  return findGroup(theObject->groupName().c_str());
-}
-
-QModelIndex XGUI_PartDataModel::findGroup(const std::string& theGroup) const
-{
-  if (theGroup == ModelAPI_ResultParameter::group())
-    return createIndex(0, 0, (qint32) ParamsFolder);
-  if (theGroup == ModelAPI_ResultConstruction::group())
-    return createIndex(1, 0, (qint32) ConstructFolder);
-  if (theGroup == ModelAPI_ResultBody::group())
-    return createIndex(2, 0, (qint32) BodiesFolder);
-  if (theGroup == ModelAPI_ResultGroup::group())
-    return createIndex(3, 0, (qint32) GroupsFolder);
-  return QModelIndex();
-}
-
-ResultPartPtr XGUI_PartDataModel::part() const
-{
-  DocumentPtr aRootDoc = ModelAPI_Session::get()->moduleDocument();
-  ObjectPtr aObj = aRootDoc->object(ModelAPI_ResultPart::group(), myId);
-  return std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObj);
-}
-
-QModelIndex XGUI_PartDataModel::objectIndex(const ObjectPtr& theObject) const
-{
-  QModelIndex aIndex;
-  if (theObject) {
-    if (part() == theObject)
-      return aIndex;
-
-    std::string aGroup = theObject->groupName();
-    DocumentPtr aDoc = theObject->document();
-    int aNb = aDoc->size(aGroup);
-    int aRow = -1;
-    for (int i = 0; i < aNb; i++) {
-      if (aDoc->object(aGroup, i) == theObject) {
-        aRow = i;
-        break;
-      }
-    }
-    if (aRow == -1)
-      return aIndex;
-    if (aGroup == ModelAPI_ResultParameter::group())
-      return createIndex(aRow, 0, (qint32) ParamObject);
-    else if (aGroup == ModelAPI_ResultConstruction::group())
-      return createIndex(aRow, 0, (qint32) ConstructObject);
-    else if (aGroup == ModelAPI_ResultBody::group())
-      return createIndex(aRow, 0, (qint32) BodiesObject);
-    else if (aGroup == ModelAPI_ResultGroup::group())
-      return createIndex(aRow, 0, (qint32) GroupObject);
-    else
-      return createIndex(aRow + getRowsNumber(), 0, (qint32) HistoryObject);
-  }
-  return aIndex;
-}
-
-
-int XGUI_PartDataModel::getRowsNumber() const
-{
-  int aSize = partDocument()->size(ModelAPI_ResultGroup::group());
-  if (aSize == 0) // If there are no groups then do not show group folder
-    return 3;
-  return 4;
-}
\ No newline at end of file
diff --git a/src/XGUI/XGUI_PartDataModel.h b/src/XGUI/XGUI_PartDataModel.h
deleted file mode 100644 (file)
index 56f28ad..0000000
+++ /dev/null
@@ -1,191 +0,0 @@
-// Copyright (C) 2014-20xx CEA/DEN, EDF R&D -->
-
-#ifndef XGUI_PartDataModel_H
-#define XGUI_PartDataModel_H
-
-#include "XGUI.h"
-#include "XGUI_DataTreeModel.h"
-
-/**\class XGUI_TopDataModel
- * \ingroup GUI
- * \brief This is a data model for Object Browser (QTreeView).
- * It represents only upper part of data tree (non-parts tree items)
- */
-class XGUI_EXPORT XGUI_TopDataModel : public XGUI_FeaturesModel
-{
-Q_OBJECT
- public:
-   /// Constructor
-   /// \param theParent a parent object
-  XGUI_TopDataModel(QObject* theParent);
-  virtual ~XGUI_TopDataModel();
-
-  // Reimpl from QAbstractItemModel
-
-  /// Returns the data stored under the given role for the item referred to by the index.
-  /// \param theIndex a model index
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
-
-  /// Returns the data for the given role and section in the header with the specified orientation.
-  /// \param theSection a section
-  /// \param theOrient an orientation
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
-                              int theRole = Qt::DisplayRole) const;
-
-  /// Returns the number of rows under the given parent. When the parent is valid it means that 
-  /// rowCount is returning the number of children of parent.
-  /// \param theParent a parent model index
-  virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
-
-  /// Returns the number of columns for the children of the given parent.
-  /// It has a one column
-  /// \param theParent a parent model index
-  virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
-
-
-  /// Returns the index of the item in the model specified by the given row, column and parent index.
-  /// \param theRow a row
-  /// \param theColumn a column
-  /// \param theParent a parent model index
-  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
-                                QModelIndex()) const;
-
-  /// Returns the parent of the model item with the given index. 
-  /// If the item has no parent, an invalid QModelIndex is returned.
-  /// \param theIndex a model index
-  virtual QModelIndex parent(const QModelIndex& theIndex) const;
-
-  /// Returns true if parent has any children; otherwise returns false.
-  /// \param theParent a parent model index
-  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
-
-  //! Returns object by the given Model index.
-  //! Returns 0 if the given index is not index of a object
-  virtual ObjectPtr object(const QModelIndex& theIndex) const;
-
-  //! Returns QModelIndex which corresponds to the given object
-  //! If the object is not found then index is not valid
-  virtual QModelIndex objectIndex(const ObjectPtr& theObject) const;
-
-  //! Returns parent index of the given object
-  virtual QModelIndex findParent(const ObjectPtr& theObject) const;
-
-  //! Returns index corresponded to the group
-  virtual QModelIndex findGroup(const std::string& theGroup) const;
-
- private:
-  //! Types of QModelIndexes
-  enum DataIds
-  {
-    ParamsFolder,
-    ParamObject,
-    ConstructFolder,
-    ConstructObject
-    //GroupsFolder,
-    //GroupObject
-  };
-
-};
-
-/**\class XGUI_PartDataModel
- * \ingroup GUI
- * \brief This is a data model for Object Browser (QTreeView).
- * It represents data tree only of a one part
- */
-class XGUI_PartDataModel : public XGUI_PartModel
-{
-Q_OBJECT
- public:
-   /// Constructor
-   /// \param theParent a parent object
-  XGUI_PartDataModel(QObject* theParent);
-  virtual ~XGUI_PartDataModel();
-
-  // Reimpl from QAbstractItemModel
-
-  /// Returns the data stored under the given role for the item referred to by the index.
-  /// \param theIndex a model index
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
-
-  /// Returns the data for the given role and section in the header with the specified orientation.
-  /// \param theSection a section
-  /// \param theOrient an orientation
-  /// \param theRole a data role (see Qt::ItemDataRole)
-  virtual QVariant headerData(int theSection, Qt::Orientation theOrient,
-                              int theRole = Qt::DisplayRole) const;
-
-  /// Returns the number of rows under the given parent. When the parent is valid it means that 
-  /// rowCount is returning the number of children of parent.
-  /// \param theParent a parent model index
-  virtual int rowCount(const QModelIndex &theParent = QModelIndex()) const;
-
-  /// Returns the number of columns for the children of the given parent.
-  /// It has a one column
-  /// \param theParent a parent model index
-  virtual int columnCount(const QModelIndex &theParent = QModelIndex()) const;
-
-  /// Returns the index of the item in the model specified by the given row, column and parent index.
-  /// \param theRow a row
-  /// \param theColumn a column
-  /// \param theParent a parent model index
-  virtual QModelIndex index(int theRow, int theColumn, const QModelIndex& theParent =
-                                QModelIndex()) const;
-
-  /// Returns the parent of the model item with the given index. 
-  /// If the item has no parent, an invalid QModelIndex is returned.
-  /// \param theIndex a model index
-  virtual QModelIndex parent(const QModelIndex& theIndex) const;
-
-  /// Returns true if parent has any children; otherwise returns false.
-  /// \param theParent a parent model index
-  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
-
-  //! Returns object by the given Model index.
-  //! Returns 0 if the given index is not index of a object
-  virtual ObjectPtr object(const QModelIndex& theIndex) const;
-
-  //! Returns QModelIndex which corresponds to the given object
-  //! If the object is not found then index is not valid
-  virtual QModelIndex objectIndex(const ObjectPtr& theObject) const;
-
-  //! Returns true if the given document is a sub-document of this tree
-  virtual bool hasDocument(const DocumentPtr& theDoc) const;
-
-  //! Returns parent index of the given object
-  virtual QModelIndex findParent(const ObjectPtr& theObject) const;
-
-  //! Returns index corresponded to the group
-  virtual QModelIndex findGroup(const std::string& theGroup) const;
-
-  //! Return a Part object
-  virtual ResultPartPtr part() const;
-
- private:
-
-  //! Returns document of the current part
-  DocumentPtr partDocument() const;
-
-  //! Returns defult number of rows
-  int getRowsNumber() const;
-
-  //! Types of QModelIndexes
-  enum DataIds
-  {
-    MyRoot,
-    ParamsFolder,
-    ParamObject,
-    ConstructFolder,
-    ConstructObject,
-    BodiesFolder,
-    BodiesObject,
-    GroupsFolder,
-    GroupObject,
-    HistoryObject
-  };
-
-};
-
-#endif
index 4ffac6dc7ba28294cd40733b3bcc26344f92004d..42ddf7318fdcc02e4f6521763f192386bd5dc4b9 100644 (file)
@@ -75,23 +75,5 @@ std::string featureInfo(FeaturePtr theFeature)
  }*/
 
 
-void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter)
-{
-  hasResult = false;
-  hasFeature = false;
-  hasParameter = false;
-  foreach(ObjectPtr aObj, theObjects) {
-    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObj);
-    ResultPtr aResult = std::dynamic_pointer_cast<ModelAPI_Result>(aObj);
-    ResultParameterPtr aConstruction = std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aResult);
-
-    hasResult = (aResult.get() != NULL);
-    hasFeature = (aFeature.get() != NULL);
-    hasParameter = (aConstruction.get() != NULL);
-    if (hasFeature && hasResult  && hasParameter)
-      break;
-  }
-}
-
 
 }
index e541ba2f0418e8fcef741ece0fd46eb62e0433f8..1a5c7b05f2b2103dc91e33dcc25025ef9a47742f 100644 (file)
@@ -8,7 +8,6 @@
 #include <QRect>
 
 #include <ModelAPI_Feature.h>
-#include <ModuleBase_Definitions.h>
 
 #include <memory>
 
@@ -66,15 +65,6 @@ bool XGUI_EXPORT isModelObject(FeaturePtr theFeature);
 std::string XGUI_EXPORT featureInfo(FeaturePtr theFeature);
 
 
-/*!
-Check types of objects which are in the given list
-\param theObjects the list of objects
-\param hasResult will be set to true if list contains Result objects
-\param hasFeature will be set to true if list contains Feature objects
-\param hasParameter will be set to true if list contains Parameter objects
-*/
-void checkObjects(const QObjectPtrList& theObjects, bool& hasResult, bool& hasFeature, bool& hasParameter);
-
 };
 
 #endif
index 387594ec062f8d5e3c8642b4417c489a2f6a3883..ee91afe7628823881dfc65949ecb442f1443d709 100644 (file)
 //#define DEBUG_FEATURE_CREATED
 //#define DEBUG_FEATURE_REDISPLAY
 
-QMap<QString, QString> XGUI_Workshop::myIcons;
-
-
-QIcon XGUI_Workshop::featureIcon(const FeaturePtr& theFeature)
-{
-  QIcon anIcon;
-
-  std::string aKind = theFeature->getKind();
-  QString aId(aKind.c_str());
-  if (!myIcons.contains(aId))
-    return anIcon;
-
-  QString anIconString = myIcons[aId];
-
-  ModelAPI_ExecState aState = theFeature->data()->execState();
-  switch(aState) {
-    case ModelAPI_StateDone:
-    case ModelAPI_StateNothing: {
-      anIcon = QIcon(anIconString);
-    }
-    break;
-    case ModelAPI_StateMustBeUpdated: {
-      anIcon = ModuleBase_Tools::lighter(anIconString);
-    }
-    break;
-    case ModelAPI_StateExecFailed: {
-      anIcon = ModuleBase_Tools::composite(":pictures/exec_state_failed.png", anIconString);
-    }
-    break;
-    case ModelAPI_StateInvalidArgument: {
-      anIcon = ModuleBase_Tools::composite(":pictures/exec_state_invalid_parameters.png",
-                                           anIconString);
-    }
-    break;
-    default: break;  
-  }
-  return anIcon;  
-}
 
 XGUI_Workshop::XGUI_Workshop(XGUI_SalomeConnector* theConnector)
     : QObject(),
@@ -201,10 +163,8 @@ void XGUI_Workshop::startApplication()
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_UPDATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_CREATED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TO_REDISPLAY));
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_DELETED));
   aLoop->registerListener(this, Events_LongOp::eventID());
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_PLUGIN_LOADED));
-  aLoop->registerListener(this, Events_Loop::eventByName(EVENT_DOCUMENT_CHANGED));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOSHOW));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_OBJECT_TOHIDE));
   aLoop->registerListener(this, Events_Loop::eventByName(EVENT_SELFILTER_LOADED));
@@ -382,10 +342,6 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
     std::shared_ptr<ModelAPI_ObjectUpdatedMessage> anUpdateMsg =
         std::dynamic_pointer_cast<ModelAPI_ObjectUpdatedMessage>(theMessage);
     onFeatureUpdatedMsg(anUpdateMsg);
-  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_OBJECT_DELETED)) {
-    std::shared_ptr<ModelAPI_ObjectDeletedMessage> aDelMsg =
-        std::dynamic_pointer_cast<ModelAPI_ObjectDeletedMessage>(theMessage);
-    onObjectDeletedMsg(aDelMsg);
   } else if (theMessage->eventID() == Events_LongOp::eventID()) {
     if (Events_LongOp::isPerformed()) {
       QApplication::setOverrideCursor(QCursor(Qt::WaitCursor));
@@ -425,30 +381,7 @@ void XGUI_Workshop::processEvent(const std::shared_ptr<Events_Message>& theMessa
           updateCommandStatus();
       }
     }
-  } else if (theMessage->eventID() == Events_Loop::loop()->eventByName(EVENT_DOCUMENT_CHANGED)) {
-    myActionsMgr->update();
-    // Find and Activate active part
-    if (myPartActivating)
-      return;
-    SessionPtr aMgr = ModelAPI_Session::get();
-    DocumentPtr aActiveDoc = aMgr->activeDocument();
-    DocumentPtr aDoc = aMgr->moduleDocument();
-    if (aActiveDoc == aDoc) {
-      activatePart(ResultPartPtr()); 
-      return;
-    }
-    std::string aGrpName = ModelAPI_ResultPart::group();
-    for (int i = 0; i < aDoc->size(aGrpName); i++) {
-      ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aDoc->object(aGrpName, i));
-      if (aPart->partDoc() == aActiveDoc) {
-        activatePart(aPart); // Activate a part which corresponds to active Doc
-        return;
-      }
-    }
-    // If not found then activate global document
-    activatePart(ResultPartPtr()); 
-
-  }
+  } 
   else if (theMessage->eventID() == Events_Loop::eventByName(EVENT_SELFILTER_LOADED)) {
     std::shared_ptr<Config_SelectionFilterMessage> aMsg = 
       std::dynamic_pointer_cast<Config_SelectionFilterMessage>(theMessage);
@@ -510,8 +443,8 @@ void XGUI_Workshop::onFeatureUpdatedMsg(const std::shared_ptr<ModelAPI_ObjectUpd
     }
   }
   myOperationMgr->onValidateOperation();
-  if (myObjectBrowser)
-    myObjectBrowser->processEvent(theMsg);
+  //if (myObjectBrowser)
+  //  myObjectBrowser->processEvent(theMsg);
 }
 
 //******************************************************
@@ -611,8 +544,8 @@ void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpd
     isDisplayed = displayObject(*aIt);
     //}
   }
-  if (myObjectBrowser)
-    myObjectBrowser->processEvent(theMsg);
+  //if (myObjectBrowser)
+  //  myObjectBrowser->processEvent(theMsg);
   if (isDisplayed)
     myDisplayer->updateViewer();
   //if (aHasPart) { // TODO: Avoid activate last part on loading of document
@@ -620,14 +553,6 @@ void XGUI_Workshop::onFeatureCreatedMsg(const std::shared_ptr<ModelAPI_ObjectUpd
   //}
 }
 
-//******************************************************
-void XGUI_Workshop::onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& theMsg)
-{
-  if (myObjectBrowser)
-    myObjectBrowser->processEvent(theMsg);
-  //std::set<ObjectPtr> aFeatures = theMsg->objects();
-}
-
 //******************************************************
 void XGUI_Workshop::onOperationStarted(ModuleBase_Operation* theOperation)
 {
@@ -761,8 +686,6 @@ void XGUI_Workshop::addFeature(const std::shared_ptr<Config_FeatureMessage>& the
   }
   ActionInfo aFeatureInfo;
   aFeatureInfo.initFrom(theMessage);
-  // Remember features icons
-  myIcons[QString::fromStdString(theMessage->id())] = aFeatureInfo.iconFile;
 
   QString aWchName = QString::fromStdString(theMessage->workbenchId());
   QStringList aNestedFeatures =
@@ -1215,8 +1138,9 @@ QDockWidget* XGUI_Workshop::createObjectBrowser(QWidget* theParent)
   aObjDock->setStyleSheet(
       "::title { position: relative; padding-left: 5px; text-align: left center }");
   myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
-  connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
-          SLOT(changeCurrentDocument(ObjectPtr)));
+  myObjectBrowser->setDataModel(myModule->dataModel());
+  //connect(myObjectBrowser, SIGNAL(activePartChanged(ObjectPtr)), this,
+  //        SLOT(changeCurrentDocument(ObjectPtr)));
   aObjDock->setWidget(myObjectBrowser);
 
   myContextMenuMgr->connectObjectBrowser();
@@ -1299,23 +1223,6 @@ void XGUI_Workshop::onFeatureTriggered()
   }
 }
 
-//******************************************************
-void XGUI_Workshop::changeCurrentDocument(ObjectPtr theObj)
-{
-  SessionPtr aMgr = ModelAPI_Session::get();
-  if (theObj) {
-    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(theObj);
-    if (aPart) {
-      DocumentPtr aPartDoc = aPart->partDoc();
-      if (aPartDoc) {
-        aMgr->setActiveDocument(aPartDoc);
-        return;
-      }
-    }
-  }
-  aMgr->setActiveDocument(aMgr->moduleDocument());
-}
-
 //******************************************************
 void XGUI_Workshop::salomeViewerSelectionChanged()
 {
@@ -1332,12 +1239,7 @@ ModuleBase_IViewer* XGUI_Workshop::salomeViewer() const
 void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
 {
   QObjectPtrList aObjects = mySelector->selection()->selectedObjects();
-  if ((theId == "ACTIVATE_PART_CMD") && (aObjects.size() > 0)) {
-    ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aObjects.first());
-    activatePart(aPart);
-  } else if (theId == "DEACTIVATE_PART_CMD")
-    activatePart(ResultPartPtr());
-  else if (theId == "DELETE_CMD")
+  if (theId == "DELETE_CMD")
     deleteObjects();
   else if (theId == "COLOR_CMD")
     changeColor(aObjects);
@@ -1353,47 +1255,8 @@ void XGUI_Workshop::onContextMenuCommand(const QString& theId, bool isChecked)
     setDisplayMode(aObjects, XGUI_Displayer::Wireframe);
   else if (theId == "HIDEALL_CMD")
     myDisplayer->eraseAll();
-  else if (theId == "EDIT_CMD") {
-    FeaturePtr aFeature = std::dynamic_pointer_cast<ModelAPI_Feature>(aObjects.first());
-    if (aFeature == NULL) {
-      ResultParameterPtr aParam = 
-        std::dynamic_pointer_cast<ModelAPI_ResultParameter>(aObjects.first());
-      if (aParam.get() != NULL) {
-        aFeature = ModelAPI_Feature::feature(aParam);
-      }
-    }
-    if (aFeature.get() != NULL)
-      myModule->editFeature(aFeature);
-  }
 }
 
-//**************************************************************
-void XGUI_Workshop::activatePart(ResultPartPtr theFeature)
-{
-  if (!myPartActivating) {
-    myPartActivating = true;
-    if (theFeature)
-      theFeature->activate();
-    changeCurrentDocument(theFeature);
-    myObjectBrowser->activatePart(theFeature);
-    myPartActivating = false;
-  }
-  updateCommandStatus();
-}
-
-//**************************************************************
-//void XGUI_Workshop::activateLastPart()
-//{
-//  SessionPtr aMgr = ModelAPI_Session::get();
-//  DocumentPtr aDoc = aMgr->moduleDocument();
-//  std::string aGrpName = ModelAPI_ResultPart::group();
-//  ObjectPtr aLastPart = aDoc->object(aGrpName, aDoc->size(aGrpName) - 1);
-//  ResultPartPtr aPart = std::dynamic_pointer_cast<ModelAPI_ResultPart>(aLastPart);
-//  if (aPart) {
-//    activatePart(aPart);
-//  }
-//}
-
 //**************************************************************
 void XGUI_Workshop::deleteObjects()
 {
@@ -1410,7 +1273,7 @@ void XGUI_Workshop::deleteObjects()
   bool hasResult = false;
   bool hasFeature = false;
   bool hasParameter = false;
-  XGUI_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter);
+  ModuleBase_Tools::checkObjects(anObjects, hasResult, hasFeature, hasParameter);
   if (!(hasFeature || hasParameter))
     return;
 
index 37c04437fdc18426d5a0527af068e7ae500853ce..d4fd4a3689e68937bed3d2dd26206f59745892c5 100644 (file)
@@ -156,13 +156,6 @@ Q_OBJECT
   /// \return a desktop instance
   QMainWindow* desktop() const;
 
-  //! Returns icon name according to feature
-  static QIcon featureIcon(const FeaturePtr& theFeature);
-
-  //! Activates or deactivates a part
-  //! If PartPtr is Null pointer then PartSet will be activated
-  void activatePart(std::shared_ptr<ModelAPI_ResultPart> theFeature);
-
   //! Delete features
   void deleteObjects();
 
@@ -293,12 +286,6 @@ signals:
   /// Reaction on command call
   void onFeatureTriggered();
 
-  /// Change active document
-  /// \param theObj a part object. If it is NULL then active document is a main document
-  void changeCurrentDocument(ObjectPtr theObj);
-
-  //void activateLastPart();
-
   /// Close document
   void closeDocument();
 
@@ -333,9 +320,6 @@ signals:
   /// Process feature redisplay message
   void onFeatureRedisplayMsg(const std::shared_ptr<ModelAPI_ObjectUpdatedMessage>& );
 
-  /// Process feature delete message
-  void onObjectDeletedMsg(const std::shared_ptr<ModelAPI_ObjectDeletedMessage>& );
-
   /// Display all results
   void displayAllResults();
 
@@ -435,7 +419,6 @@ private:
   XGUI_ModuleConnector* myModuleConnector;
 
   QString myCurrentDir;
-  static QMap<QString, QString> myIcons;
 
   bool myUpdatePrefs;
 
index de9da1ce1ba8cf5d576923b7e23b5f11a71f848f..1f53d95360ab50ac557cc9ed0ae0205426241f9a 100644 (file)
      <file>pictures/button_help.png</file>
      <file>pictures/button_ok.png</file>
    
-     <file>pictures/edit.png</file>
-     <file>pictures/exec_state_failed.png</file>
-     <file>pictures/exec_state_invalid_parameters.png</file>
      <file>pictures/assembly.png</file>
-     <file>pictures/activate.png</file>
      <file>pictures/delete.png</file>
      <file>pictures/rename_edit.png</file>
      <file>pictures/eye_pencil.png</file>
diff --git a/src/XGUI/pictures/activate.png b/src/XGUI/pictures/activate.png
deleted file mode 100644 (file)
index f829179..0000000
Binary files a/src/XGUI/pictures/activate.png and /dev/null differ
diff --git a/src/XGUI/pictures/edit.png b/src/XGUI/pictures/edit.png
deleted file mode 100644 (file)
index 43a3174..0000000
Binary files a/src/XGUI/pictures/edit.png and /dev/null differ
diff --git a/src/XGUI/pictures/exec_state_failed.png b/src/XGUI/pictures/exec_state_failed.png
deleted file mode 100644 (file)
index 738f303..0000000
Binary files a/src/XGUI/pictures/exec_state_failed.png and /dev/null differ
diff --git a/src/XGUI/pictures/exec_state_invalid_parameters.png b/src/XGUI/pictures/exec_state_invalid_parameters.png
deleted file mode 100644 (file)
index 1346f97..0000000
Binary files a/src/XGUI/pictures/exec_state_invalid_parameters.png and /dev/null differ