Salome HOME
Merge branch 'master' of newgeom:newgeom.git
authorsbh <sergey.belash@opencascade.com>
Fri, 4 Apr 2014 08:36:14 +0000 (12:36 +0400)
committersbh <sergey.belash@opencascade.com>
Fri, 4 Apr 2014 08:36:14 +0000 (12:36 +0400)
Conflicts:
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MainWindow.h

31 files changed:
src/Model/CMakeLists.txt
src/Model/Model_Document.cxx
src/Model/Model_Document.h
src/ModelAPI/CMakeLists.txt
src/ModelAPI/ModelAPI_Document.h
src/PyConsole/PyConsole_Console.h
src/PyConsole/PyConsole_Editor.h
src/PyConsole/PyConsole_EnhEditor.h
src/PyConsole/PyConsole_EnhInterp.h
src/PyConsole/PyConsole_Interp.h
src/PyEvent/PyEvent_Event.h
src/PyEvent/PyEvent_EventFilter.h
src/PyInterp/PyInterp_Dispatcher.h
src/PyInterp/PyInterp_Event.h
src/PyInterp/PyInterp_Interp.h
src/PyInterp/PyInterp_Request.h
src/PyInterp/PyInterp_Watcher.h
src/XGUI/CMakeLists.txt
src/XGUI/XGUI_DataModel.cpp [new file with mode: 0644]
src/XGUI/XGUI_DataModel.h [new file with mode: 0644]
src/XGUI/XGUI_DocumentDataModel.cpp [new file with mode: 0644]
src/XGUI/XGUI_DocumentDataModel.h [new file with mode: 0644]
src/XGUI/XGUI_MainMenu.cpp
src/XGUI/XGUI_MainWindow.cpp
src/XGUI/XGUI_MainWindow.h
src/XGUI/XGUI_ObjectsBrowser.cpp [new file with mode: 0644]
src/XGUI/XGUI_ObjectsBrowser.h [new file with mode: 0644]
src/XGUI/XGUI_ViewWindow.cpp
src/XGUI/XGUI_Viewer.cpp
src/XGUI/XGUI_Workshop.cpp
src/XGUI/XGUI_msg_en.ts [deleted file]

index c6dfa0f7e75521f908c48396019004f9c71aab3c..eca79ac1adc5a33e9eed2bdb82dc6c2f7d29af1f 100644 (file)
@@ -34,3 +34,5 @@ INCLUDE_DIRECTORIES(
   ../Config
   ${CAS_INCLUDE_DIRS}
 )
+
+INSTALL(TARGETS Model DESTINATION bin)
index 8a3f0bf45c3419d5cab8f61f03194d6f50dacb87..3aea0ff6ecbba55a254edcc0bab07a5c64e65c7b 100644 (file)
@@ -191,6 +191,14 @@ shared_ptr<ModelAPI_Iterator> Model_Document::featuresIterator(const string theG
   return shared_ptr<ModelAPI_Iterator>(new Model_Iterator(aThis, groupLabel(theGroup)));
 }
 
+shared_ptr<ModelAPI_Feature> Model_Document::feature(const string& theGroupID, const int theIndex)
+{
+  // TODO: optimize this method
+  shared_ptr<ModelAPI_Iterator>  anIter = featuresIterator(theGroupID);
+  for(int a = 0; a != theIndex; anIter->next()) a++;
+  return anIter->current();
+}
+
 Model_Document::Model_Document(const std::string theID)
     : myID(theID), myDoc(new TDocStd_Document("BinOcaf")) // binary OCAF format
 {
index bc7d6db7422b77c2832bdf815ae936999e0c3374..d96aa15dd039747a06d2fb7113adab3947353a7d 100644 (file)
@@ -78,6 +78,10 @@ public:
 
   MODEL_EXPORT virtual const std::string& id() const {return myID;}
 
+  //! Returns the feature in the group by the index (started from zero)
+  MODEL_EXPORT virtual std::shared_ptr<ModelAPI_Feature> 
+    feature(const std::string& theGroupID, const int theIndex);
+
 protected:
 
   //! Returns (creates if needed) the group label
index 017acf05d4d7cff9675407b7347ec0330fad48a5..c9afbc7aba1e478c6ccdab36278c575cfe887e44 100644 (file)
@@ -52,6 +52,7 @@ IF(WIN32)
 ENDIF(WIN32)
 
 INSTALL(TARGETS _ModelAPI DESTINATION swig)
+INSTALL(TARGETS ModelAPI DESTINATION bin)
 #INSTALL(TARGETS ${SWIG_SCRIPTS} DESTINATION swig)
 
 
index 90a6a9184341b7a7c1b0519892ba32aad4c8b39c..e40e9f5b592dd45fe091fe378ad721a45cd160c6 100644 (file)
@@ -78,8 +78,13 @@ public:
   MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Iterator> featuresIterator(
     const std::string theGroup) = 0;
 
+  ///! Returns the id of hte document
   MODELAPI_EXPORT virtual const std::string& id() const = 0;
 
+  //! Returns the feature in the group by the index (started from zero)
+  MODELAPI_EXPORT virtual std::shared_ptr<ModelAPI_Feature> 
+    feature(const std::string& theGroupID, const int theIndex) = 0;
+
 protected:
   /// Only for SWIG wrapping it is here
   MODELAPI_EXPORT ModelAPI_Document()
index 0f2a9be5adce7fe6e0a6f151f6ae038ddefe4ab6..b2ece1f926e7dd80882e9263fdcc3ed98723f16c 100644 (file)
@@ -13,7 +13,8 @@ class PyConsole_Editor;
 class PyConsole_EnhInterp;
 class QMenu;
 
-class PYCONSOLE_EXPORT PyConsole_Console : public QWidget//, public SUIT_PopupClient
+//PYCONSOLE_EXPORT
+class PyConsole_Console : public QWidget//, public SUIT_PopupClient
 {
   Q_OBJECT
 
@@ -76,7 +77,8 @@ protected:
  * Similar to PyConsole_Console except that an enhanced interpreter and enhanced editor
  * are encapsulated.
  */
-class PYCONSOLE_EXPORT PyConsole_EnhConsole: public PyConsole_Console
+//PYCONSOLE_EXPORT
+class PyConsole_EnhConsole: public PyConsole_Console
 {
   Q_OBJECT
 
index f3324dc25df6c6defad4dc04a895be1f582e1233..8c17a5bc7810e7efb9545d837afc0b9ebe760b7a 100644 (file)
@@ -10,7 +10,8 @@ class PyConsole_Interp;
 class PyInterp_Request;
 class QEventLoop;
 
-class PYCONSOLE_EXPORT PyConsole_Editor : public QTextEdit
+//PYCONSOLE_EXPORT
+class PyConsole_Editor : public QTextEdit
 {
   Q_OBJECT;
 
index 03b5e19a1b405d3deb8a19ad2e89efbe669b997b..defa590605a895bc31905f2d2c1fc298c688ff21 100644 (file)
@@ -14,7 +14,8 @@ class PyConsole_EnhInterp;
 /**
  * Enhanced Python editor handling tab completion.
  */
-class PYCONSOLE_EXPORT PyConsole_EnhEditor: public PyConsole_Editor
+//PYCONSOLE_EXPORT
+class PyConsole_EnhEditor: public PyConsole_Editor
 {
   Q_OBJECT;
 
index 1af977cc09f31d060bfcd3d7b735fdec7934a82e..b01f68973c8fcf253acdab4875bb10b66307c738 100644 (file)
@@ -15,7 +15,8 @@
  * Enhanced Python interpreter used for auto-completion.
  * This extends PyConsole_Interp with an API wrapping the Python dir() command nicely.
  */
-class PYCONSOLE_EXPORT PyConsole_EnhInterp: public PyConsole_Interp
+//PYCONSOLE_EXPORT
+class PyConsole_EnhInterp: public PyConsole_Interp
 {
 public:
   PyConsole_EnhInterp()
index d65c9e620054c5ef72f06eeee09569f91c566c5d..5dfa7f78c29b04cb42ae3af9365bc9f699b28667 100644 (file)
@@ -6,7 +6,8 @@
 
 #include <PyInterp_Interp.h>   /// !!! WARNING !!! THIS INCLUDE MUST BE VERY FIRST !!!
 
-class PYCONSOLE_EXPORT PyConsole_Interp : public PyInterp_Interp
+//PYCONSOLE_EXPORT
+class PyConsole_Interp : public PyInterp_Interp
 {
 public:
   PyConsole_Interp();
index ed1ea7b7402c2f6629bcc35791c99b21e24eeb40..76340b94b129fc77f58a8032cbea53e7b99d3158 100644 (file)
@@ -9,7 +9,8 @@
 //! SALOME custom event type
 #define PyEvent_EVENT QEvent::Type( QEvent::User + 10000 )
 
-class PYEVENT_EXPORT PyEvent_CustomEvent : public QEvent
+// PYEVENT_EXPORT
+class PyEvent_CustomEvent : public QEvent
 {
 public:
   PyEvent_CustomEvent( int type );
@@ -24,7 +25,8 @@ private:
 
 class QSemaphore;
 
-class PYEVENT_EXPORT PyEvent_Event
+//PYEVENT_EXPORT
+class PyEvent_Event
 {
 public:
   PyEvent_Event();
index 23132de7e710991d1d54c7dd9bfef94d5e26c885..d115a2802c9f8513b981959fba745a2fc7cb1e77 100644 (file)
@@ -17,7 +17,8 @@ class PyEvent_Event;
   This event filter can be installed by any application that intends to use PyEvent_Event mechanism asynchronously.
   This class replaced SalomeApp_EventFilter.
 */
-class PYEVENT_EXPORT PyEvent_EventFilter: public QObject 
+//PYEVENT_EXPORT
+class PyEvent_EventFilter: public QObject 
 {
 public:
   static void Init();
index fa98d30b0124ab9ef0e55f4eb6e28657c5072dca..cb5da2e8a26ee836d13f986f89a63f22db976176 100644 (file)
@@ -14,7 +14,8 @@
 class QObject;
 class PyInterp_Watcher;
 
-class PYINTERP_EXPORT PyInterp_Dispatcher : protected QThread
+//PYINTERP_EXPORT
+class PyInterp_Dispatcher : protected QThread
 {
   PyInterp_Dispatcher(); // private constructor
 
index 01bab92c11cbb7e7adfcfc56c65f15e8aa01c0a5..b08c34246b1de1f6075f2af56b23fa5ff1fd64a4 100644 (file)
@@ -27,7 +27,8 @@ protected:
  * Events thrown by the interpreter having executed a command and indicating
  * the return status.
  */
-class PYINTERP_EXPORT PyInterp_Event : public QEvent
+//PYINTERP_EXPORT
+class PyInterp_Event : public QEvent
 {
   PyInterp_Event();
   PyInterp_Event( const PyInterp_Event& );
index d92bc4fc9d0b047d21020d17238ce5418eb070bb..b93c6475a4b25424fdcde2b8b18cea41d781bceb 100644 (file)
@@ -7,7 +7,8 @@
 #include <list>
 #include <string>
 
-class PYINTERP_EXPORT PyLockWrapper
+//PYINTERP_EXPORT
+class PyLockWrapper
 {
   PyThreadState* myThreadState;
   PyThreadState* mySaveThreadState;
@@ -19,7 +20,8 @@ public:
 
 typedef void PyOutChanged(void* data,char * c);
 
-class PYINTERP_EXPORT PyInterp_Interp
+//PYINTERP_EXPORT
+class PyInterp_Interp
 {
 public:
   static int _argc;
@@ -62,7 +64,8 @@ protected:
   virtual bool initContext() = 0;  
 };
 
-class PYINTERP_EXPORT PyObjWrapper
+//PYINTERP_EXPORT
+class PyObjWrapper
 {
   PyObject* myObject;
 public:
index 9cc3a68ac4a5f2c299c7c71d1b582b03befff8b5..b96cd1dc25a053c13f4981cd1b2c148d13cbf2fd 100644 (file)
@@ -15,7 +15,8 @@ class PyInterp_Dispatcher;
 class PyInterp_ExecuteEvent;
 class PyConsole_Editor;
 
-class PYINTERP_EXPORT PyInterp_Request
+// PYINTERP_EXPORT
+class PyInterp_Request
 {
   friend class PyInterp_Dispatcher;
   friend class PyInterp_ExecuteEvent;
@@ -61,7 +62,8 @@ private:
   QObject*        myListener;
 };
 
-class PYINTERP_EXPORT PyInterp_LockRequest : public PyInterp_Request
+//PYINTERP_EXPORT
+class PyInterp_LockRequest : public PyInterp_Request
 {
 public:
 
index 91126b7e9c14e57a3cf8fc44145be805d4860adb..3f110c1e2309aa15b8bd826c6fd48e8014415603 100644 (file)
@@ -9,7 +9,8 @@
 #include <QObject>
 
 // Private class that keeps track of destructions of request listeners
-class PYINTERP_EXPORT PyInterp_Watcher : public QObject
+//PYINTERP_EXPORT
+class PyInterp_Watcher : public QObject
 {                                           
   Q_OBJECT
 
index 38deae12299035d6f11d2a10c2d0f7cf3b3e0dd8..713f9b9051c88c731b4c2e11939b3de5963ae311 100644 (file)
@@ -19,6 +19,9 @@ SET(PROJECT_HEADERS
        XGUI_Constants.h
        XGUI_ViewBackground.h
        XGUI_WidgetFactory.h
+       XGUI_DocumentDataModel.h
+       XGUI_DataModel.h
+       XGUI_ObjectsBrowser.h
 )
 
 SET(PROJECT_AUTOMOC 
@@ -40,15 +43,18 @@ SET(PROJECT_SOURCES
        XGUI_RubberBand.cpp
        XGUI_ViewBackground.cpp
        XGUI_WidgetFactory.cpp
+       XGUI_DocumentDataModel.cpp
+       XGUI_DataModel.cpp
+       XGUI_ObjectsBrowser.cpp
 )
 
 SET(PROJECT_RESOURCES 
     XGUI_pictures.qrc
 )
 
-SET(TEXT_RESOURCES
-       XGUI_msg_en.ts
-)
+#SET(TEXT_RESOURCES
+#      XGUI_msg_en.ts
+#)
 
 SET(PROJECT_LIBRARIES
        opengl32
@@ -60,12 +66,14 @@ SET(PROJECT_LIBRARIES
        PyConsole
        PyInterp
        PyEvent
+       ModelAPI
 )
 
 QT5_ADD_RESOURCES(PROJECT_COMPILED_RESOURCES ${PROJECT_RESOURCES})
-QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES})
+#QT5_ADD_TRANSLATION(QM_RESOURCES ${TEXT_RESOURCES})
 
-SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES})
+#SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES} ${QM_RESOURCES})
+SOURCE_GROUP ("Generated Files" FILES ${PROJECT_AUTOMOC} ${PROJECT_COMPILED_RESOURCES})
 SOURCE_GROUP ("Resource Files" FILES ${TEXT_RESOURCES} ${PROJECT_RESOURCES})
 
 ADD_DEFINITIONS(${CAS_DEFINITIONS} )
@@ -74,6 +82,7 @@ INCLUDE_DIRECTORIES (${PROJECT_SOURCE_DIR}/src/Event
                                         ${PROJECT_SOURCE_DIR}/src/Config
                                         ${PROJECT_SOURCE_DIR}/src/PyInterp
                                         ${PROJECT_SOURCE_DIR}/src/PyConsole
+                                        ${PROJECT_SOURCE_DIR}/src/ModelAPI
                                         ${CAS_INCLUDE_DIRS})
 
 LINK_DIRECTORIES($ENV{PYTHON_LIB_DIR})
@@ -83,11 +92,12 @@ ADD_EXECUTABLE(XGUI WIN32
        ${PROJECT_HEADERS} 
        ${PROJECT_COMPILED_RESOURCES} 
        ${TEXT_RESOURCES} 
-       ${QM_RESOURCES}
 )
 
+ADD_DEPENDENCIES(XGUI ModelAPI)
+
 # The Qt5Widgets_LIBRARIES variable also includes QtGui and QtCore
 TARGET_LINK_LIBRARIES(XGUI ${PROJECT_LIBRARIES})
 
 INSTALL(TARGETS XGUI DESTINATION bin)
-INSTALL(FILES ${QM_RESOURCES} DESTINATION bin)
+#INSTALL(FILES ${QM_RESOURCES} DESTINATION bin)
diff --git a/src/XGUI/XGUI_DataModel.cpp b/src/XGUI/XGUI_DataModel.cpp
new file mode 100644 (file)
index 0000000..7dc78aa
--- /dev/null
@@ -0,0 +1,12 @@
+#include "XGUI_DataModel.h"
+
+
+XGUI_DataModel::XGUI_DataModel(QObject* theParent)
+  : QAbstractItemModel(theParent)
+{
+}
+
+
+XGUI_DataModel::~XGUI_DataModel()
+{
+}
diff --git a/src/XGUI/XGUI_DataModel.h b/src/XGUI/XGUI_DataModel.h
new file mode 100644 (file)
index 0000000..106a7f0
--- /dev/null
@@ -0,0 +1,15 @@
+
+#ifndef XGUI_DataModel_H
+#define XGUI_DataModel_H
+
+#include <QAbstractItemModel>
+
+class XGUI_DataModel : public QAbstractItemModel
+{
+  Q_OBJECT
+public:
+  XGUI_DataModel(QObject* theParent);
+  virtual ~XGUI_DataModel();
+};
+
+#endif
\ No newline at end of file
diff --git a/src/XGUI/XGUI_DocumentDataModel.cpp b/src/XGUI/XGUI_DocumentDataModel.cpp
new file mode 100644 (file)
index 0000000..f655451
--- /dev/null
@@ -0,0 +1,102 @@
+#include "XGUI_DocumentDataModel.h"
+
+#include <ModelAPI_PluginManager.h>
+#include <ModelAPI_Iterator.h>
+#include <ModelAPI_Document.h>
+
+
+
+
+XGUI_DocumentDataModel::XGUI_DocumentDataModel(QObject* theParent)
+  : QAbstractItemModel(theParent),
+  myParamsFolder(0),
+  myConstructFolder(0)
+{
+  //std::shared_ptr<ModelAPI_Feature> myRoot = aMgr->createFeature("Point");
+  std::shared_ptr<ModelAPI_PluginManager> aMgr = ModelAPI_PluginManager::get();
+  myDocument = aMgr->currentDocument();
+}
+
+
+XGUI_DocumentDataModel::~XGUI_DocumentDataModel()
+{
+}
+
+
+QVariant XGUI_DocumentDataModel::data(const QModelIndex& theIndex, int theRole) const
+{
+  switch (theRole) {
+  case Qt::DisplayRole:
+    // return a name
+    if (theIndex.internalId() == quintptr(&myParamsFolder))
+      return "Parameters";
+    else if (theIndex.internalId() == quintptr(&myConstructFolder))
+      return "Constructions";
+    else if (theIndex.internalId() == 0) {
+      return "Part";
+    }
+    break;
+  case Qt::DecorationRole:
+    // return an Icon
+    break;
+  case Qt::ToolTipRole:
+    // return Tooltip
+    break;
+  }
+  return QVariant();
+}
+
+
+QVariant XGUI_DocumentDataModel::headerData(int section, Qt::Orientation orientation, int role) const
+{
+  return QVariant();
+}
+
+int XGUI_DocumentDataModel::rowCount(const QModelIndex &parent) const
+{
+  std::shared_ptr<ModelAPI_Iterator> aIt = myDocument->featuresIterator(PARTS_GROUP);
+  return aIt->numIterationsLeft() + 2;
+}
+
+int XGUI_DocumentDataModel::columnCount(const QModelIndex &parent) const
+{
+  return 1;
+}
+
+QModelIndex XGUI_DocumentDataModel::index(int theRow, int theColumn, const QModelIndex& theParent) const
+{
+  switch (theRow) {
+  case 0:
+    return createIndex(theRow, theColumn, (quintptr) &myParamsFolder);
+  case 1:
+    return createIndex(theRow, theColumn, (quintptr) &myConstructFolder);
+  default:
+    {
+      std::shared_ptr<ModelAPI_Iterator> aIt = myDocument->featuresIterator(PARTS_GROUP);
+      if (aIt->numIterationsLeft() <= (theRow - 1)) {
+        return createIndex(theRow, theColumn, (quintptr) 0);
+      }
+    }
+  }
+  return QModelIndex();
+}
+
+
+QModelIndex XGUI_DocumentDataModel::parent(const QModelIndex &index) const
+{
+  return QModelIndex();
+}
+
+bool XGUI_DocumentDataModel::hasChildren(const QModelIndex& theParent) const
+{
+  if (!theParent.isValid())
+    return true;
+
+  if (theParent.internalId() == quintptr(&myParamsFolder)) 
+    return myDocument->featuresIterator(PARAMETERS_GROUP)->more();
+  if (theParent.internalId() == quintptr(&myConstructFolder))
+    return myDocument->featuresIterator(CONSTRUCTIONS_GROUP)->more();
+  if (theParent.internalId() == 0)
+    return false;
+  return false;
+}
\ No newline at end of file
diff --git a/src/XGUI/XGUI_DocumentDataModel.h b/src/XGUI/XGUI_DocumentDataModel.h
new file mode 100644 (file)
index 0000000..e6f8a78
--- /dev/null
@@ -0,0 +1,39 @@
+
+#ifndef XGUI_DocumentDataModel_H
+#define XGUI_DocumentDataModel_H
+
+#include <QAbstractItemModel>
+
+class ModelAPI_Document;
+
+class XGUI_DocumentDataModel : public QAbstractItemModel
+{
+  Q_OBJECT
+public:
+  XGUI_DocumentDataModel(QObject* theParent);
+  virtual ~XGUI_DocumentDataModel();
+
+
+  virtual QVariant data(const QModelIndex& theIndex, int theRole) const;
+  virtual QVariant headerData(int section, Qt::Orientation orientation,
+                              int role = Qt::DisplayRole) const;
+
+  virtual int rowCount(const QModelIndex &parent = QModelIndex()) const;
+  virtual int columnCount(const QModelIndex &parent = QModelIndex()) const;
+
+  virtual QModelIndex index(int theRow, int theColumn, 
+                            const QModelIndex &parent = QModelIndex()) const;
+
+  virtual QModelIndex parent(const QModelIndex &index) const;
+
+  virtual bool hasChildren(const QModelIndex& theParent = QModelIndex()) const;
+
+private:
+  //std::shared_ptr<ModelAPI_Feature> myRoot;
+  short myParamsFolder;
+  short myConstructFolder;
+
+  std::shared_ptr<ModelAPI_Document> myDocument;
+};
+
+#endif
\ No newline at end of file
index bb7bbd582910f650335e9cfd4ce48615353d3ae2..efce9ab2c0bca4aacc50089f752d041dd8094ab4 100644 (file)
@@ -11,7 +11,7 @@ XGUI_MainMenu::XGUI_MainMenu(XGUI_MainWindow *parent)
     : QObject(parent), myDesktop(parent)
 {
   parent->setTabPosition(Qt::TopDockWidgetArea, QTabWidget::North);
-  myGeneralPage = addWorkbench(tr("GEN_MENU_TITLE"));
+  myGeneralPage = addWorkbench(tr("General"));
 }
 
 XGUI_MainMenu::~XGUI_MainMenu(void)
index 40a0d26cfae25c68f665bc88c03f02287c5f8586..c89e0fc0a1224586ceb3059717e6a4ef724db155 100644 (file)
@@ -2,6 +2,7 @@
 #include "XGUI_MainMenu.h"
 #include "XGUI_ViewWindow.h"
 #include "XGUI_Viewer.h"
+#include "XGUI_ObjectsBrowser.h"
 
 #include <PyConsole_Console.h>
 #include <PyConsole_EnhInterp.h>
@@ -29,7 +30,7 @@ XGUI_MainWindow::XGUI_MainWindow(QWidget* parent)
     myObjectBrowser(0), 
     myPythonConsole(0)
 {
-  setWindowTitle(tr("WINDOW_TITLE"));
+  setWindowTitle(tr("New Geom"));
   myMenuBar = new XGUI_MainMenu(this);
 
   QMdiArea* aMdiArea = new QMdiArea(this);
@@ -145,62 +146,11 @@ QDockWidget* XGUI_MainWindow::createObjectBrowser()
 {
   QDockWidget* aObjDock = new QDockWidget(this);
   aObjDock->setAllowedAreas(Qt::LeftDockWidgetArea | Qt::RightDockWidgetArea);
-  aObjDock->setWindowTitle(tr("OBJECT_BROWSER_TITLE"));
-  myObjectBrowser = new QTreeWidget(aObjDock);
-  myObjectBrowser->setColumnCount(1);
-  myObjectBrowser->setHeaderHidden(true);
+  aObjDock->setWindowTitle(tr("Object browser"));
+  myObjectBrowser = new XGUI_ObjectsBrowser(aObjDock);
+  //myObjectBrowser->setColumnCount(1);
+  //myObjectBrowser->setHeaderHidden(true);
   aObjDock->setWidget(myObjectBrowser);
 //  fillObjectBrowser();
   return aObjDock;
 }
-
-//******************************************************
-
-// TEST FUNCTIONS
-
-//******************************************************
-void XGUI_MainWindow::fillObjectBrowser()
-{
-  QStringList aNames;
-  aNames << "Parameters" << "Constructions";
-  aNames << "Part 1" << "Part 2" << "Part 3";
-  aNames << "Properties";
-
-  QStringList aIcons;
-  aIcons << ":pictures/params_folder.png";
-  aIcons << ":pictures/constr_folder.png";
-  aIcons << ":pictures/part_ico.png";
-  aIcons << ":pictures/part_ico.png";
-  aIcons << ":pictures/part_ico.png";
-  aIcons << ":pictures/properties.png";
-
-  QList<QTreeWidgetItem*> aItems;
-  foreach(QString aName, aNames)
-  {
-    QTreeWidgetItem* aItem = new QTreeWidgetItem(myObjectBrowser);
-    aItem->setText(0, aName);
-    aItems.append(aItem);
-  }
-  for(int i = 0; i < aItems.length(); i++) {
-    aItems[i]->setIcon(0, QIcon(aIcons[i]));
-  }
-  myObjectBrowser->addTopLevelItems(aItems);
-
-  for(int i = 2; i < 5; i++) {
-    QTreeWidgetItem* aItem = new QTreeWidgetItem(aItems[i]);
-    aItem->setText(0, "Parameters");
-    aItem->setIcon(0, QIcon(":pictures/params_folder.png"));
-
-    aItem = new QTreeWidgetItem(aItems[i]);
-    aItem->setText(0, "Construction");
-    aItem->setIcon(0, QIcon(":pictures/constr_folder.png"));
-
-    aItem = new QTreeWidgetItem(aItems[i]);
-    aItem->setText(0, "Bodies");
-    aItem->setIcon(0, QIcon(":pictures/part_ico.png"));
-
-    aItem = new QTreeWidgetItem(aItems[i]);
-    aItem->setText(0, "Features");
-    aItem->setIcon(0, QIcon(":pictures/features.png"));
-  }
-}
index 0806b5863a8e791426ab7a22051e32a24dea7fa1..e12614a7380fa6ac38040960acd193fe5f683cbe 100644 (file)
@@ -5,7 +5,7 @@
 
 class XGUI_MainMenu;
 class XGUI_Viewer;
-class QTreeWidget;
+class XGUI_ObjectsBrowser;
 class QMdiArea;
 class PyConsole_EnhConsole;
 
@@ -22,7 +22,7 @@ public:
     return myMenuBar;
   }
 
-  QTreeWidget* objectBrowser() const
+  XGUI_ObjectsBrowser* objectBrowser() const
   {
     return myObjectBrowser;
   }
@@ -44,11 +44,9 @@ private:
   void createDockWidgets();
   QDockWidget* createObjectBrowser();
   QDockWidget* createPropertyPanel();
-  //!! For test purposes only
-  void fillObjectBrowser();
 
   XGUI_MainMenu* myMenuBar;
-  QTreeWidget* myObjectBrowser;
+  XGUI_ObjectsBrowser* myObjectBrowser;
 
   XGUI_Viewer* myViewer;
 
diff --git a/src/XGUI/XGUI_ObjectsBrowser.cpp b/src/XGUI/XGUI_ObjectsBrowser.cpp
new file mode 100644 (file)
index 0000000..9269290
--- /dev/null
@@ -0,0 +1,17 @@
+#include "XGUI_ObjectsBrowser.h"
+#include "XGUI_DocumentDataModel.h"
+
+
+XGUI_ObjectsBrowser::XGUI_ObjectsBrowser(QWidget* theParent)
+  : QTreeView(theParent)
+{
+  setHeaderHidden(true);
+  myDocModel = new XGUI_DocumentDataModel(this);
+  setModel(myDocModel);
+}
+
+
+XGUI_ObjectsBrowser::~XGUI_ObjectsBrowser()
+{
+}
+
diff --git a/src/XGUI/XGUI_ObjectsBrowser.h b/src/XGUI/XGUI_ObjectsBrowser.h
new file mode 100644 (file)
index 0000000..75d12e5
--- /dev/null
@@ -0,0 +1,23 @@
+
+#ifndef XGUI_ObjectsBrowser_H
+#define XGUI_ObjectsBrowser_H
+
+#include <QTreeView>
+
+class XGUI_DocumentDataModel;
+
+class XGUI_ObjectsBrowser : public QTreeView
+{
+  Q_OBJECT
+public:
+  XGUI_ObjectsBrowser(QWidget* theParent);
+  virtual ~XGUI_ObjectsBrowser();
+
+  XGUI_DocumentDataModel* dataModel() const { return myDocModel; }
+
+private:
+
+  XGUI_DocumentDataModel* myDocModel;
+};
+
+#endif
\ No newline at end of file
index c536c7c410d674a2d1db6acadc903ec0fc0c7b07..ef9e5403f79a03ffae3fac7e7fc16cceadae7c8b 100644 (file)
@@ -167,63 +167,63 @@ XGUI_ViewWindow::XGUI_ViewWindow(XGUI_Viewer* theViewer, V3d_TypeOfView theType)
   QAction* aBtn;
 
   // Dump view
-  aBtn = new QAction(QIcon(":pictures/occ_view_camera_dump.png"), tr("DUMP_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_camera_dump.png"), tr("Dump view"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(dumpView()));
   myViewBar->addAction(aBtn);
   // Fit all
-  aBtn = new QAction(QIcon(":pictures/occ_view_fitall.png"), tr("FIT_ALL"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_fitall.png"), tr("Fit all"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(fitAll()));
   myViewBar->addAction(aBtn);
   // Fit area
-  aBtn = new QAction(QIcon(":pictures/occ_view_fitarea.png"), tr("FIT_AREA"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_fitarea.png"), tr("Fit area"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(activateWindowFit()));
   myViewBar->addAction(aBtn);
   // Zoom
-  aBtn = new QAction(QIcon(":pictures/occ_view_zoom.png"), tr("ZOOM_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_zoom.png"), tr("Zoom"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(activateZoom()));
   myViewBar->addAction(aBtn);
   // Pan
-  aBtn = new QAction(QIcon(":pictures/occ_view_pan.png"), tr("PAN_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_pan.png"), tr("Panning"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(activatePanning()));
   myViewBar->addAction(aBtn);
   // Global Panning
-  aBtn = new QAction(QIcon(":pictures/occ_view_glpan.png"), tr("GLOB_PAN_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_glpan.png"), tr("Global panning"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(activateGlobalPanning()));
   myViewBar->addAction(aBtn);
   // Rotation
-  aBtn = new QAction(QIcon(":pictures/occ_view_rotate.png"), tr("ROTATE_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_rotate.png"), tr("Rotate"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(activateRotation()));
   myViewBar->addAction(aBtn);
   // Reset
-  aBtn = new QAction(QIcon(":pictures/occ_view_reset.png"), tr("RESET_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_reset.png"), tr("Reset"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(reset()));
   myViewBar->addAction(aBtn);
   // Front view
-  aBtn = new QAction(QIcon(":pictures/occ_view_front.png"), tr("FRONT_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_front.png"), tr("Front"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(frontView()));
   myViewBar->addAction(aBtn);
   // Back view
-  aBtn = new QAction(QIcon(":pictures/occ_view_back.png"), tr("BACK_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_back.png"), tr("Back"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(backView()));
   myViewBar->addAction(aBtn);
   // Top view
-  aBtn = new QAction(QIcon(":pictures/occ_view_top.png"), tr("TOP_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_top.png"), tr("Top"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(topView()));
   myViewBar->addAction(aBtn);
   // Bottom view
-  aBtn = new QAction(QIcon(":pictures/occ_view_bottom.png"), tr("BOTTOM_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_bottom.png"), tr("Bottom"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(bottomView()));
   myViewBar->addAction(aBtn);
   // Left view
-  aBtn = new QAction(QIcon(":pictures/occ_view_left.png"), tr("LEFT_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_left.png"), tr("Left"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(leftView()));
   myViewBar->addAction(aBtn);
   // Right view
-  aBtn = new QAction(QIcon(":pictures/occ_view_right.png"), tr("RIGHT_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_right.png"), tr("Right"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(rightView()));
   myViewBar->addAction(aBtn);
   // Clone view
-  aBtn = new QAction(QIcon(":pictures/occ_view_clone.png"), tr("CLONE_VIEW"), myViewBar);
+  aBtn = new QAction(QIcon(":pictures/occ_view_clone.png"), tr("Clone"), myViewBar);
   connect(aBtn, SIGNAL(triggered()), SLOT(cloneView()));
   myViewBar->addAction(aBtn);
 
@@ -946,7 +946,7 @@ void XGUI_ViewWindow::cloneView()
 
 void XGUI_ViewWindow::dumpView()
 {
-  QString aFilter(tr("OCC_IMAGE_FILES"));
+  QString aFilter(tr("Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)"));
   QString aSelectedFilter;
   QString aFileName = QFileDialog::getSaveFileName(this, "Save picture", QString(), aFilter, &aSelectedFilter);
   if (!aFileName.isNull()) {
index 881b91f8723f846346cda4dbc7b62535a186059f..6bec77168952fad966741f91e2c8b30c31822bb9 100644 (file)
@@ -61,17 +61,17 @@ Handle(V3d_Viewer) CreateViewer(const Standard_ExtString name, const Standard_CS
  */
 QString XGUI_Viewer::backgroundData(QStringList& gradList, QIntList& idList, QIntList& txtList)
 {
-  gradList << tr("GT_HORIZONTALGRADIENT") << tr("GT_VERTICALGRADIENT")
-      << tr("GT_FIRSTDIAGONALGRADIENT") << tr("GT_SECONDDIAGONALGRADIENT")
-      << tr("GT_FIRSTCORNERGRADIENT") << tr("GT_SECONDCORNERGRADIENT")
-      << tr("GT_THIRDCORNERGRADIENT") << tr("GT_FORTHCORNERGRADIENT");
+  gradList << tr("Horizontal gradient") << tr("Vertical gradient")
+      << tr("First diagonal gradient") << tr("Second diagonal gradient")
+      << tr("First corner gradient") << tr("Second corner gradient")
+      << tr("Third corner gradient") << tr("Fourth corner gradient");
   idList << XGUI::HorizontalGradient << XGUI::VerticalGradient << XGUI::Diagonal1Gradient
       << XGUI::Diagonal2Gradient << XGUI::Corner1Gradient << XGUI::Corner2Gradient
       << XGUI::Corner3Gradient << XGUI::Corner4Gradient;
 #ifdef OCC_ENABLE_TEXTURED_BACKGROUND
   txtList << XGUI::CenterTexture << XGUI::TileTexture << XGUI::StretchTexture;
 #endif
-  return tr("BG_IMAGE_FILES");
+  return tr("Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)");
 }
 
 XGUI_Viewer::XGUI_Viewer(XGUI_MainWindow* theParent, bool DisplayTrihedron)
index 55e16fcf87b21e2ba6806da2ed3e3930df466fe0..ecf8524964668aba6387a308a8393c947c2c479e 100644 (file)
@@ -68,34 +68,34 @@ void XGUI_Workshop::initMenu()
 
   XGUI_Command* aCommand;
 
-  aCommand = aGroup->addFeature("SAVE_CMD", tr("SAVE_MENU"), tr("SAVE_MENU_TIP"),
+  aCommand = aGroup->addFeature("SAVE_CMD", tr("Save..."), tr("Save the document"),
                                 QIcon(":pictures/save.png"), QKeySequence::Save);
   aCommand->connectTo(this, SLOT(onSave()));
   //aCommand->disable();
 
-  aCommand = aGroup->addFeature("UNDO_CMD", tr("UNDO_MENU"), tr("UNDO_MENU_TIP"),
+  aCommand = aGroup->addFeature("UNDO_CMD", tr("Undo"), tr("Undo last command"),
                                 QIcon(":pictures/undo.png"), QKeySequence::Undo);
 
-  aCommand = aGroup->addFeature("REDO_CMD", tr("REDO_MENU"), tr("REDO_MENU_TIP"),
+  aCommand = aGroup->addFeature("REDO_CMD", tr("Redo"), tr("Redo last command"),
                                 QIcon(":pictures/redo.png"), QKeySequence::Redo);
 
-  aCommand = aGroup->addFeature("REBUILD_CMD", tr("REBUILD_MENU"), tr("REBUILD_MENU_TIP"),
+  aCommand = aGroup->addFeature("REBUILD_CMD", tr("Rebuild"), tr("Rebuild data objects"),
                                 QIcon(":pictures/rebuild.png"));
 
-  aCommand = aGroup->addFeature("SAVEAS_CMD", tr("SAVEAS_MENU"), tr("SAVEAS_MENU_TIP"),
+  aCommand = aGroup->addFeature("SAVEAS_CMD", tr("Save as..."), tr("Save the document into a file"),
                                 QIcon(":pictures/save.png"));
   aCommand->connectTo(this, SLOT(onSaveAs()));
   //aCommand->disable();
 
-  aCommand = aGroup->addFeature("OPEN_CMD", tr("OPEN_MENU"), tr("OPEN_MENU_TIP"),
+  aCommand = aGroup->addFeature("OPEN_CMD", tr("Open..."), tr("Open a new document"),
                                 QIcon(":pictures/open.png"), QKeySequence::Open);
   aCommand->connectTo(this, SLOT(onOpen()));
 
-  aCommand = aGroup->addFeature("NEW_CMD", tr("NEW_MENU"), tr("NEW_MENU_TIP"),
+  aCommand = aGroup->addFeature("NEW_CMD", tr("New"), tr("Create a new document"),
                                 QIcon(":pictures/new.png"), QKeySequence::New);
   aCommand->connectTo(this, SLOT(onNew()));
 
-  aCommand = aGroup->addFeature("EXIT_CMD", tr("EXIT_MENU"), tr("EXIT_MENU_TIP"),
+  aCommand = aGroup->addFeature("EXIT_CMD", tr("Exit"), tr("Exit application"),
                                 QIcon(":pictures/close.png"), QKeySequence::Close);
   aCommand->connectTo(this, SLOT(onExit()));
 
diff --git a/src/XGUI/XGUI_msg_en.ts b/src/XGUI/XGUI_msg_en.ts
deleted file mode 100644 (file)
index afe0ddc..0000000
+++ /dev/null
@@ -1,226 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<!DOCTYPE TS>
-<TS version="2.0" language="en_US">
-<context>
-    <name>@default</name>
-</context>
-<context>
-    <name>XGUI_Workshop</name>
-    <message>
-        <source>NEW_MENU</source>
-        <translation>New</translation>
-    </message>
-    <message>
-        <source>NEW_MENU_TIP</source>
-        <translation>Create new document</translation>
-    </message>
-    <message>
-        <source>OPEN_MENU</source>
-        <translation>Open...</translation>
-    </message>
-    <message>
-        <source>OPEN_MENU_TIP</source>
-        <translation>Open document</translation>
-    </message>
-    <message>
-        <source>SAVE_MENU</source>
-        <translation>Save</translation>
-    </message>
-    <message>
-        <source>SAVE_MENU_TIP</source>
-        <translation>Save document</translation>
-    </message>
-    <message>
-        <source>SAVEAS_MENU</source>
-        <translation>Save As...</translation>
-    </message>
-    <message>
-        <source>SAVEAS_MENU_TIP</source>
-        <translation>Save document in another file</translation>
-    </message>
-    <message>
-        <source>EXIT_MENU</source>
-        <translation>Exit</translation>
-    </message>
-    <message>
-        <source>EXIT_MENU_TIP</source>
-        <translation>Exit from application</translation>
-    </message>
-    <message>
-        <source>UNDO_MENU</source>
-        <translation>Undo</translation>
-    </message>
-    <message>
-        <source>UNDO_MENU_TIP</source>
-        <translation>Undo last command</translation>
-    </message>
-    <message>
-        <source>REDO_MENU</source>
-        <translation>Redo</translation>
-    </message>
-    <message>
-        <source>REDO_MENU_TIP</source>
-        <translation>Redo last command</translation>
-    </message>
-    <message>
-        <source>CUT_MENU</source>
-        <translation>Cut</translation>
-    </message>
-    <message>
-        <source>CUT_MENU_TIP</source>
-        <translation>Cut selected object</translation>
-    </message>
-    <message>
-        <source>COPY_MENU</source>
-        <translation>Copy</translation>
-    </message>
-    <message>
-        <source>COPY_MENU_TIP</source>
-        <translation>Copy selected object</translation>
-    </message>
-    <message>
-        <source>PASTE_MENU</source>
-        <translation>Paste</translation>
-    </message>
-    <message>
-        <source>PASTE_MENU_TIP</source>
-        <translation>Paste copied object</translation>
-    </message>
-    <message>
-        <source>REBUILD_MENU</source>
-        <translation>Rebuild</translation>
-    </message>
-    <message>
-        <source>REBUILD_MENU_TIP</source>
-        <translation>Rebuild data objects</translation>
-    </message>
-</context>
-<context>
-    <name>XGUI_MainWindow</name>
-    <message>
-        <source>WINDOW_TITLE</source>
-        <translation>New GEOM</translation>
-    </message>
-    <message>
-        <source>OBJECT_BROWSER_TITLE</source>
-        <translation>Object Browser</translation>
-    </message>
-</context>
-<context>
-    <name>XGUI_MainMenu</name>
-    <message>
-        <source>MENU_TITLE</source>
-        <translation>Menu</translation>
-    </message>
-    <message>
-        <source>GEN_MENU_TITLE</source>
-        <translation>General</translation>
-    </message>
-</context>
-<context>
-    <name>XGUI_Viewer</name>
-    <message>
-        <source>GT_HORIZONTALGRADIENT</source>
-        <translation>Horizontal gradient</translation>
-    </message>
-    <message>
-        <source>GT_VERTICALGRADIENT</source>
-        <translation>Vertical gradient</translation>
-    </message>
-    <message>
-        <source>GT_FIRSTDIAGONALGRADIENT</source>
-        <translation>First diagonal gradient</translation>
-    </message>
-    <message>
-        <source>GT_SECONDDIAGONALGRADIENT</source>
-        <translation>Second diagonal gradient</translation>
-    </message>
-    <message>
-        <source>GT_FIRSTCORNERGRADIENT</source>
-        <translation>First corner gradient</translation>
-    </message>
-    <message>
-        <source>GT_SECONDCORNERGRADIENT</source>
-        <translation>Second corner gradient</translation>
-    </message>
-    <message>
-        <source>GT_THIRDCORNERGRADIENT</source>
-        <translation>Third corner gradient</translation>
-    </message>
-    <message>
-        <source>GT_FORTHCORNERGRADIENT</source>
-        <translation>Fourth corner gradient</translation>
-    </message>
-    <message>
-        <source>BG_IMAGE_FILES</source>
-        <translation>Image files (*.bmp *.gif *.pix *.xwd *.rgb *.rs)</translation>
-    </message>
-</context>
-<context>
-    <name>XGUI_ViewWindow</name>
-    <message>
-        <source>OCC_IMAGE_FILES</source>
-        <translation>Images Files (*.bmp *.png *.jpg *.jpeg *.eps *.ps)</translation>
-    </message>
-    <message>
-        <source>DUMP_VIEW</source>
-        <translation>Dump view</translation>
-    </message>
-    <message>
-        <source>FIT_ALL</source>
-        <translation>Fit all</translation>
-    </message>
-    <message>
-        <source>FIT_AREA</source>
-        <translation>Fit area</translation>
-    </message>
-    <message>
-        <source>CLONE_VIEW</source>
-        <translation>Clone view</translation>
-    </message>
-    <message>
-        <source>ZOOM_VIEW</source>
-        <translation>Zoom</translation>
-    </message>
-    <message>
-        <source>PAN_VIEW</source>
-        <translation>Panning</translation>
-    </message>
-    <message>
-        <source>GLOB_PAN_VIEW</source>
-        <translation>Global panning</translation>
-    </message>
-    <message>
-        <source>ROTATE_VIEW</source>
-        <translation>Rotate</translation>
-    </message>
-    <message>
-        <source>FRONT_VIEW</source>
-        <translation>Front</translation>
-    </message>
-    <message>
-        <source>BACK_VIEW</source>
-        <translation>Back</translation>
-    </message>
-    <message>
-        <source>TOP_VIEW</source>
-        <translation>Top</translation>
-    </message>
-    <message>
-        <source>BOTTOM_VIEW</source>
-        <translation>Bottom</translation>
-    </message>
-    <message>
-        <source>LEFT_VIEW</source>
-        <translation>Left</translation>
-    </message>
-    <message>
-        <source>RIGHT_VIEW</source>
-        <translation>Right</translation>
-    </message>
-    <message>
-        <source>RESET_VIEW</source>
-        <translation>Reset</translation>
-    </message>
-</context>
-</TS>