Salome HOME
Patch for MacOS (from SALOME forum)
[modules/geom.git] / src / GEOMGUI / GeometryGUI.cxx
index 013b9abc0cb63aae65bd5b612ef5a86ac628486a..153d10f01c7d70085923805018f38fd88b6e903b 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2007-2015  CEA/DEN, EDF R&D, OPEN CASCADE
+// Copyright (C) 2007-2016  CEA/DEN, EDF R&D, OPEN CASCADE
 //
 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
@@ -33,6 +33,7 @@
 #include "GEOMGUI_OCCSelector.h"
 #include "GEOMGUI_Selection.h"
 #include "GEOMGUI_CreationInfoWdg.h"
+#include "GEOMGUI_TextTreeWdg.h"
 #include "GEOMGUI_DimensionProperty.h"
 #include "GEOM_Constants.h"
 #include "GEOM_Displayer.h"
@@ -50,8 +51,6 @@
 #include <SUIT_Session.h>
 #include <SUIT_ViewManager.h>
 
-#include <PyInterp_Interp.h>
-
 #include <OCCViewer_ViewWindow.h>
 #include <OCCViewer_ViewPort3d.h>
 #include <OCCViewer_ViewModel.h>
@@ -65,7 +64,9 @@
 #include <SVTK_InteractorStyle.h>
 #include <SVTK_ViewModel.h>
 
+#ifndef DISABLE_GRAPHICSVIEW
 #include <GraphicsView_Viewer.h>
+#endif
 
 #include <SalomeApp_Application.h>
 #include <SalomeApp_DataObject.h>
@@ -86,6 +87,7 @@
 #include <SALOMEDS_SObject.hxx>
 
 #include <Basics_OCCTVersion.hxx>
+#include <QtxFontEdit.h>
 
 // External includes
 #include <QDir>
@@ -97,6 +99,7 @@
 #include <QString>
 #include <QPainter>
 #include <QSignalMapper>
+#include <QFontDatabase>
 
 #include <AIS_ListOfInteractive.hxx>
 #include <AIS_ListIteratorOfListOfInteractive.hxx>
 #include <NCollection_DataMap.hxx>
 
 #include <TColStd_HArray1OfByte.hxx>
+#include <TColStd_SequenceOfHAsciiString.hxx>
 
 #include <utilities.h>
 
 #include <Standard_Failure.hxx>
 #include <Standard_ErrorHandler.hxx>
 
+#include <Font_SystemFont.hxx>
+#include <Font_FontMgr.hxx>
+#include <TCollection_HAsciiString.hxx>
+
 #include "GEOM_version.h"
 #include "GEOMImpl_Types.hxx" // dangerous hxx (defines short-name macros) - include after all
 
@@ -218,6 +226,7 @@ GeometryGUI::GeometryGUI() :
   myLocalSelectionMode = GEOM_ALLOBJECTS;
 
   myCreationInfoWdg = 0;
+  myTextTreeWdg = 0;
 
   connect( Material_ResourceMgr::resourceMgr(), SIGNAL( changed() ), this, SLOT( updateMaterials() ) );
 
@@ -248,13 +257,19 @@ GEOMGUI* GeometryGUI::getLibrary( const QString& libraryName )
 {
   if ( !myGUIMap.contains( libraryName ) ) {
     // try to load library if it is not loaded yet
-#ifndef WIN32
-    QString dirs = getenv( "LD_LIBRARY_PATH" );
-    QString sep  = ":";
-#else
+#if defined(WIN32)
     QString dirs = getenv( "PATH" );
+#elif defined(__APPLE__)
+    QString dirs = getenv( "DYLD_LIBRARY_PATH" );
+#else
+    QString dirs = getenv( "LD_LIBRARY_PATH" );
+#endif
+#if defined(WIN32)
     QString sep  = ";";
+#else
+    QString sep  = ":";
 #endif
+
     if ( !dirs.isEmpty() ) {
       QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
       QListIterator<QString> it( dirList ); it.toBack();
@@ -292,13 +307,20 @@ GEOMPluginGUI* GeometryGUI::getPluginLibrary( const QString& libraryName )
 {
   if ( !myGUIMap.contains( libraryName ) ) {
     // try to load library if it is not loaded yet
-#ifndef WIN32
-    QString dirs = getenv( "LD_LIBRARY_PATH" );
-    QString sep  = ":";
-#else
+
+#if defined(WIN32)
     QString dirs = getenv( "PATH" );
+#elif defined(__APPLE__)
+    QString dirs = getenv( "DYLD_LIBRARY_PATH" );
+#else
+    QString dirs = getenv( "LD_LIBRARY_PATH" );
+#endif
+#if defined(WIN32)
     QString sep  = ";";
+#else
+    QString sep  = ":";
 #endif
+
     if ( !dirs.isEmpty() ) {
       QStringList dirList = dirs.split(sep, QString::SkipEmptyParts ); // skip empty entries
       QListIterator<QString> it( dirList ); it.toBack();
@@ -429,7 +451,11 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   SUIT_ViewWindow* window = desk->activeWindow();
   bool ViewOCC = ( window && window->getViewManager()->getType() == OCCViewer_Viewer::Type() );
   bool ViewVTK = ( window && window->getViewManager()->getType() == SVTK_Viewer::Type() );
+#ifndef DISABLE_GRAPHICSVIEW
   bool ViewDep = ( window && window->getViewManager()->getType() == GraphicsView_Viewer::Type() );
+#else
+  bool ViewDep = 0;
+#endif
   // if current viewframe is not of OCC and not of VTK type - return immediately
   // fix for IPAL8958 - allow some commands to execute even when NO viewer is active (rename for example)
   QList<int> NotViewerDependentCommands;
@@ -470,7 +496,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpSelectCompound:     // POPUP MENU - SELECT ONLY - COMPOUND
   case GEOMOp::OpSelectAll:          // POPUP MENU - SELECT ONLY - SELECT ALL
   case GEOMOp::OpDelete:             // MENU EDIT - DELETE
+#ifndef DISABLE_PYCONSOLE
   case GEOMOp::OpCheckGeom:          // MENU TOOLS - CHECK GEOMETRY
+#endif
   case GEOMOp::OpMaterialsLibrary:   // MENU TOOLS - MATERIALS LIBRARY
   case GEOMOp::OpDeflection:         // POPUP MENU - DEFLECTION COEFFICIENT
   case GEOMOp::OpColor:              // POPUP MENU - COLOR
@@ -497,7 +525,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpClsBringToFront:    //
   case GEOMOp::OpCreateFolder:       // POPUP MENU - CREATE FOLDER
   case GEOMOp::OpSortChildren:       // POPUP MENU - SORT CHILD ITEMS
+#ifndef DISABLE_GRAPHICSVIEW
   case GEOMOp::OpShowDependencyTree: // POPUP MENU - SHOW DEPENDENCY TREE
+#endif
   case GEOMOp::OpReduceStudy:        // POPUP MENU - REDUCE STUDY
     libName = "GEOMToolsGUI";
     break;
@@ -548,6 +578,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpFilling:            // MENU GENERATION - FILLING
   case GEOMOp::OpPipe:               // MENU GENERATION - PIPE
   case GEOMOp::OpPipePath:           // MENU GENERATION - RESTORE PATH
+  case GEOMOp::OpThickness:          // MENU GENERATION - THICKNESS
     libName = "GenerationGUI";
     break;
   case GEOMOp::Op2dSketcher:         // MENU ENTITY - SKETCHER
@@ -586,6 +617,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpScale:              // MENU TRANSFORMATION - SCALE
   case GEOMOp::OpOffset:             // MENU TRANSFORMATION - OFFSET
   case GEOMOp::OpProjection:         // MENU TRANSFORMATION - PROJECTION
+  case GEOMOp::OpProjOnCyl:          // MENU TRANSFORMATION - PROJECTION ON CYLINDER
   case GEOMOp::OpMultiTranslate:     // MENU TRANSFORMATION - MULTI-TRANSLATION
   case GEOMOp::OpMultiRotate:        // MENU TRANSFORMATION - MULTI-ROTATION
   case GEOMOp::OpReimport:           // CONTEXT(POPUP) MENU - RELOAD_IMPORTED
@@ -596,7 +628,6 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpArchimede:          // MENU OPERATION - ARCHIMEDE
   case GEOMOp::OpFillet3d:           // MENU OPERATION - FILLET
   case GEOMOp::OpChamfer:            // MENU OPERATION - CHAMFER
-  case GEOMOp::OpClipping:           // MENU OPERATION - CLIPPING RANGE
   case GEOMOp::OpShapesOnShape:      // MENU OPERATION - GET SHAPES ON SHAPE
   case GEOMOp::OpFillet2d:           // MENU OPERATION - FILLET 2D
   case GEOMOp::OpFillet1d:           // MENU OPERATION - FILLET 1D
@@ -604,6 +635,7 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpExtrudedBoss:       // MENU OPERATION - EXTRUDED BOSS
   case GEOMOp::OpExtrudedCut:        // MENU OPERATION - EXTRUDED CUT
   case GEOMOp::OpTransferData:       // MENU OPERATION - TRANSFER DATA
+  case GEOMOp::OpExtraction:         // MENU OPERATION - EXTRACT AND REBUILD
     libName = "OperationGUI";
     break;
   case GEOMOp::OpSewing:             // MENU REPAIR - SEWING
@@ -642,6 +674,9 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
   case GEOMOp::OpCheckSelfInters:    // MENU MEASURE - CHECK SELF INTERSECTIONS
   case GEOMOp::OpFastCheckInters:    // MENU MEASURE - FAST CHECK INTERSECTIONS
   case GEOMOp::OpManageDimensions:   // MENU MEASURE - MANAGE DIMENSIONS
+#ifndef DISABLE_PLOT2DVIEWER
+  case GEOMOp::OpShapeStatistics:    // MENU MEASURE - SHAPE STATISTICS
+#endif
   case GEOMOp::OpShowAllDimensions:  // POPUP MENU - SHOW ALL DIMENSIONS
   case GEOMOp::OpHideAllDimensions:  // POPUP MENU - HIDE ALL DIMENSIONS
     libName = "MeasureGUI";
@@ -676,10 +711,12 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
 
       GEOMPluginGUI* library = 0;
       if ( !libName.isEmpty() ) {
-#ifndef WIN32
-        libName = QString( "lib" ) + libName + ".so";
-#else
+#if defined(WIN32)
         libName = libName + ".dll";
+#elif defined(__APPLE__)
+        libName = QString( "lib" ) + libName + ".dylib";
+#else
+        libName = QString( "lib" ) + libName + ".so";
 #endif
         library = getPluginLibrary( libName );
       }
@@ -705,10 +742,12 @@ void GeometryGUI::OnGUIEvent( int id, const QVariant& theParam )
 
   GEOMGUI* library = 0;
   if ( !libName.isEmpty() ) {
-#ifndef WIN32
-    libName = QString( "lib" ) + libName + ".so";
-#else
+#if defined(WIN32)
     libName = libName + ".dll";
+#elif defined(__APPLE__)
+    libName = QString( "lib" ) + libName + ".dylib";
+#else
+    libName = QString( "lib" ) + libName + ".so";
 #endif
     library = getLibrary( libName );
   }
@@ -876,6 +915,11 @@ void GeometryGUI::createOriginAndBaseVectors()
         GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOX, "OX" );
         GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOY, "OY" );
         GetGeomGen()->PublishInStudy( aDSStudy, SALOMEDS::SObject::_nil(), anOZ, "OZ" );
+        anOrigin->UnRegister();
+        anOX->UnRegister();
+        anOY->UnRegister();
+        anOZ->UnRegister();
+        aBasicOperations->UnRegister();
 
         getApp()->updateObjectBrowser( true );
       }
@@ -921,6 +965,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpFilling,     "FILLING" );
   createGeomAction( GEOMOp::OpPipe,        "PIPE" );
   createGeomAction( GEOMOp::OpPipePath,    "PIPE_PATH" );
+  createGeomAction( GEOMOp::OpThickness,   "THICKNESS" );
 
   createGeomAction( GEOMOp::OpGroupCreate, "GROUP_CREATE" );
   createGeomAction( GEOMOp::OpGroupEdit,   "GROUP_EDIT" );
@@ -964,6 +1009,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpScale,          "SCALE" );
   createGeomAction( GEOMOp::OpOffset,         "OFFSET" );
   createGeomAction( GEOMOp::OpProjection,     "PROJECTION" );
+  createGeomAction( GEOMOp::OpProjOnCyl,      "PROJ_ON_CYL" );
   createGeomAction( GEOMOp::OpMultiTranslate, "MUL_TRANSLATION" );
   createGeomAction( GEOMOp::OpMultiRotate,    "MUL_ROTATION" );
   createGeomAction( GEOMOp::OpExtension,      "EXTENSION" );
@@ -972,10 +1018,10 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpArchimede,      "ARCHIMEDE" );
   createGeomAction( GEOMOp::OpFillet3d,       "FILLET" );
   createGeomAction( GEOMOp::OpChamfer,        "CHAMFER" );
-  //createGeomAction( GEOMOp::OpClipping,        "CLIPPING" );
   createGeomAction( GEOMOp::OpShapesOnShape,  "GET_SHAPES_ON_SHAPE" );
   createGeomAction( GEOMOp::OpSharedShapes,   "GET_SHARED_SHAPES" );
   createGeomAction( GEOMOp::OpTransferData,   "TRANSFER_DATA" );
+  createGeomAction( GEOMOp::OpExtraction,     "EXTRACTION" );
   createGeomAction( GEOMOp::OpExtrudedCut,    "EXTRUDED_CUT" );
   createGeomAction( GEOMOp::OpExtrudedBoss,   "EXTRUDED_BOSS" );
   createGeomAction( GEOMOp::OpFillet1d,       "FILLET_1D" );
@@ -1021,9 +1067,14 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpGetNonBlocks,     "GET_NON_BLOCKS" );
   createGeomAction( GEOMOp::OpCheckSelfInters,  "CHECK_SELF_INTERSECTIONS" );
   createGeomAction( GEOMOp::OpFastCheckInters,  "FAST_CHECK_INTERSECTIONS" );
+#ifndef DISABLE_PLOT2DVIEWER
+  createGeomAction( GEOMOp::OpShapeStatistics,  "SHAPE_STATISTICS" );
+#endif
 
+#ifndef DISABLE_PYCONSOLE
 #ifdef _DEBUG_ // PAL16821
   createGeomAction( GEOMOp::OpCheckGeom,        "CHECK_GEOMETRY" );
+#endif
 #endif
 
   createGeomAction( GEOMOp::OpMaterialsLibrary,   "MATERIALS_LIBRARY" );
@@ -1078,7 +1129,9 @@ void GeometryGUI::initialize( CAM_Application* app )
   createGeomAction( GEOMOp::OpPredefMaterCustom,    "POP_PREDEF_MATER_CUSTOM" );
   createGeomAction( GEOMOp::OpCreateFolder, "POP_CREATE_FOLDER" );
   createGeomAction( GEOMOp::OpSortChildren, "POP_SORT_CHILD_ITEMS" );
+#ifndef DISABLE_GRAPHICSVIEW
   createGeomAction( GEOMOp::OpShowDependencyTree, "POP_SHOW_DEPENDENCY_TREE" );
+#endif
   createGeomAction( GEOMOp::OpReduceStudy,       "POP_REDUCE_STUDY" );
   createGeomAction( GEOMOp::OpShowAllDimensions, "POP_SHOW_ALL_DIMENSIONS" );
   createGeomAction( GEOMOp::OpHideAllDimensions, "POP_HIDE_ALL_DIMENSIONS" );
@@ -1144,6 +1197,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpFilling,    genId, -1 );
   createMenu( GEOMOp::OpPipe,       genId, -1 );
   createMenu( GEOMOp::OpPipePath,   genId, -1 );
+  createMenu( GEOMOp::OpThickness,  genId, -1 );
 
   //int advId = createMenu( tr( "MEN_ADVANCED" ), newEntId, -1 );
   //createMenu( GEOMOp::OpSmoothingSurface, advId, -1 );
@@ -1208,6 +1262,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpOffset,         transId, -1 );
   createMenu( GEOMOp::OpProjection,     transId, -1 );
   createMenu( GEOMOp::OpExtension,      transId, -1 );
+  createMenu( GEOMOp::OpProjOnCyl,      transId, -1 );
   createMenu( separator(),              transId, -1 );
   createMenu( GEOMOp::OpMultiTranslate, transId, -1 );
   createMenu( GEOMOp::OpMultiRotate,    transId, -1 );
@@ -1224,6 +1279,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpShapesOnShape, operId, -1 );
   createMenu( GEOMOp::OpSharedShapes,  operId, -1 );
   createMenu( GEOMOp::OpTransferData,  operId, -1 );
+  createMenu( GEOMOp::OpExtraction,    operId, -1 );
 
   createMenu( separator(), operId, -1 );
 
@@ -1233,7 +1289,6 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpChamfer,       operId, -1 );
   createMenu( GEOMOp::OpExtrudedBoss,  operId, -1 );
   createMenu( GEOMOp::OpExtrudedCut,   operId, -1 );
-  //createMenu( GEOMOp::OpClipping,      operId, -1 );
 
   int repairId = createMenu( tr( "MEN_REPAIR" ), -1, -1, 10 );
   createMenu( GEOMOp::OpShapeProcess,    repairId, -1 );
@@ -1282,11 +1337,16 @@ void GeometryGUI::initialize( CAM_Application* app )
   createMenu( GEOMOp::OpCheckSelfInters, measurId, -1 );
   createMenu( GEOMOp::OpFastCheckInters, measurId, -1 );
   createMenu( GEOMOp::OpInspectObj,      measurId, -1 );
+#ifndef DISABLE_PLOT2DVIEWER
+  createMenu( GEOMOp::OpShapeStatistics, measurId, -1 );
+#endif
 
   int toolsId = createMenu( tr( "MEN_TOOLS" ), -1, -1, 50 );
+#ifndef DISABLE_PYCONSOLE
 #if defined(_DEBUG_) || defined(_DEBUG) // PAL16821
   createMenu( separator(),         toolsId, -1 );
   createMenu( GEOMOp::OpCheckGeom, toolsId, -1 );
+#endif
 #endif
 
   createMenu( separator(),         toolsId, -1 );
@@ -1372,6 +1432,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpFilling,    genTbId );
   createTool( GEOMOp::OpPipe,       genTbId );
   createTool( GEOMOp::OpPipePath,   genTbId );
+  createTool( GEOMOp::OpThickness,  genTbId );
 
   int transTbId = createTool( tr( "TOOL_TRANSFORMATION" ), QString( "GEOMTransformation" ) );
   createTool( GEOMOp::OpTranslate,      transTbId );
@@ -1382,6 +1443,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpOffset,         transTbId );
   createTool( GEOMOp::OpProjection,     transTbId );
   createTool( GEOMOp::OpExtension,      transTbId );
+  createTool( GEOMOp::OpProjOnCyl,      transTbId );
   createTool( separator(),              transTbId );
   createTool( GEOMOp::OpMultiTranslate, transTbId );
   createTool( GEOMOp::OpMultiRotate,    transTbId );
@@ -1393,6 +1455,7 @@ void GeometryGUI::initialize( CAM_Application* app )
   createTool( GEOMOp::OpShapesOnShape,   operTbId );
   createTool( GEOMOp::OpSharedShapes,    operTbId );
   createTool( GEOMOp::OpTransferData,    operTbId );
+  createTool( GEOMOp::OpExtraction,      operTbId );
 
   int featTbId = createTool( tr( "TOOL_FEATURES" ), QString( "GEOMModification" ) );
   createTool( GEOMOp::OpFillet1d,        featTbId );
@@ -1613,9 +1676,11 @@ void GeometryGUI::initialize( CAM_Application* app )
   mgr->insert( action(  GEOMOp::OpSortChildren ), -1, -1 ); // Sort child items
   mgr->setRule( action( GEOMOp::OpSortChildren ), QString("client='ObjectBrowser' and $component={'GEOM'} and nbChildren>1"), QtxPopupMgr::VisibleRule );
 
+#ifndef DISABLE_GRAPHICSVIEW
   mgr->insert( separator(), -1, -1 );     // -----------
   mgr->insert( action(  GEOMOp::OpShowDependencyTree ), -1, -1 ); // Show dependency tree
   mgr->setRule( action( GEOMOp::OpShowDependencyTree ), clientOCCorVTKorOB + " and selcount>0 and ($component={'GEOM'}) and type='Shape'", QtxPopupMgr::VisibleRule );
+#endif
 
   mgr->insert( separator(), -1, -1 );     // -----------
   mgr->insert( action(  GEOMOp::OpReduceStudy ), -1, -1 ); // Reduce Study
@@ -1666,7 +1731,7 @@ void GeometryGUI::addPluginActions()
       // icon
       QPixmap icon;
       if ( !adata.icon.empty() )
-       icon = resMgr->loadPixmap( pdata.name.c_str(), adata.icon.c_str() );
+        icon = resMgr->loadPixmap( pdata.name.c_str(), adata.icon.c_str() );
       // menu text (path)
       QStringList smenus = QString( adata.menuText.c_str() ).split( "/" );
       QString actionName = smenus.last();
@@ -1683,30 +1748,30 @@ void GeometryGUI::addPluginActions()
       actionStat = actionStat.toUpper().prepend( "STB_" );
 
       createAction( id, // ~ adata.label
-                   tr( actionTool.toLatin1().constData() ),
-                   icon,
-                   tr( actionName.toLatin1().constData() ),
-                   tr( actionStat.toLatin1().constData() ),
-                   QKeySequence( tr( adata.accel.c_str() ) ),
-                   application()->desktop(),
-                   false /*toggle*/,
-                   this, SLOT( OnGUIEvent() ),
-                   QString() /*shortcutAction*/ );
+                    tr( actionTool.toLatin1().constData() ),
+                    icon,
+                    tr( actionName.toLatin1().constData() ),
+                    tr( actionStat.toLatin1().constData() ),
+                    QKeySequence( tr( adata.accel.c_str() ) ),
+                    application()->desktop(),
+                    false /*toggle*/,
+                    this, SLOT( OnGUIEvent() ),
+                    QString() /*shortcutAction*/ );
       
       int menuId = -1;
       foreach ( QString subMenu, smenus ) {
-       QStringList subMenuList = subMenu.split( ":" );
-       QString subMenuName = subMenuList[0].toUpper().prepend( "MEN_" );
-       int subMenuGroup = subMenuList.size() > 1 ? subMenuList[1].toInt() : -1;
-       menuId = createMenu( tr( subMenuName.toLatin1().constData() ), menuId, -1, subMenuGroup );
+        QStringList subMenuList = subMenu.split( ":" );
+        QString subMenuName = subMenuList[0].toUpper().prepend( "MEN_" );
+        int subMenuGroup = subMenuList.size() > 1 ? subMenuList[1].toInt() : -1;
+        menuId = createMenu( tr( subMenuName.toLatin1().constData() ), menuId, -1, subMenuGroup );
       }
       createMenu( id, menuId, -1 );
       
       if ( !stools.isEmpty() ) {
-       QString subTool = stools[0];
-       subTool = subTool.toUpper().prepend( "TOOL_" );
-       int toolId = createTool( tr( subTool.toLatin1().constData() ) );
-       createTool(id, toolId);
+        QString subTool = stools[0];
+        subTool = subTool.toUpper().prepend( "TOOL_" );
+        int toolId = createTool( tr( subTool.toLatin1().constData() ) );
+        createTool(id, toolId);
       }
 
       // add action id to map
@@ -1736,17 +1801,18 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
 
   // import Python module that manages GEOM plugins (need to be here because SalomePyQt API uses active module)
   PyGILState_STATE gstate = PyGILState_Ensure();
-  PyObjWrapper pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
+  PyObject* pluginsmanager = PyImport_ImportModuleNoBlock((char*)"salome_pluginsmanager");
   if ( !pluginsmanager ) {
     PyErr_Print();
   }
   else {
-    PyObjWrapper result =
+    PyObject* result =
       PyObject_CallMethod(pluginsmanager, (char*)"initialize", (char*)"isss", 1, "geom",
-                          tr("MEN_NEW_ENTITY").toStdString().c_str(),
-                          tr("GEOM_PLUGINS_OTHER").toStdString().c_str());
+                          tr("MEN_NEW_ENTITY").toUtf8().data(),
+                          tr("GEOM_PLUGINS_OTHER").toUtf8().data());
     if ( !result )
       PyErr_Print();
+    Py_XDECREF(result);
   }
   PyGILState_Release(gstate);
   // end of GEOM plugins loading
@@ -1772,6 +1838,11 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
   getApp()->insertDockWindow( myCreationInfoWdg->getWinID(), myCreationInfoWdg );
   getApp()->placeDockWindow( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
 
+  if ( !myTextTreeWdg )
+    myTextTreeWdg = new GEOMGUI_TextTreeWdg( getApp() );
+  getApp()->insertDockWindow( myTextTreeWdg->getWinID(), myTextTreeWdg );
+  getApp()->placeDockWindow( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
+
   //NPAL 19674
   SALOME_ListIO selected;
   sm->selectedObjects( selected );
@@ -1810,6 +1881,7 @@ bool GeometryGUI::activateModule( SUIT_Study* study )
     }
   }
 
+  Py_XDECREF(pluginsmanager);
   return true;
 }
 
@@ -1833,8 +1905,15 @@ bool GeometryGUI::deactivateModule( SUIT_Study* study )
 
   disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateCreationInfo() ));
   disconnect( selMrg, SIGNAL( currentSelectionChanged() ), this, SLOT( updateFieldColorScale() ));
-  getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
-  myCreationInfoWdg = 0;
+  if ( myCreationInfoWdg ) {
+    getApp()->removeDockWindow( myCreationInfoWdg->getWinID() );
+    myCreationInfoWdg = 0;
+  }
+  if ( myTextTreeWdg ) {
+    getApp()->removeDockWindow( myTextTreeWdg->getWinID() );
+    disconnect( application(), 0, myTextTreeWdg, 0 );
+    myTextTreeWdg = 0;
+  }
 
   EmitSignalCloseAllDialogs();
 
@@ -1889,9 +1968,13 @@ void GeometryGUI::windows( QMap<int, int>& mappa ) const
 {
   mappa.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
   mappa.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
+#ifndef DISABLE_PYCONSOLE
   mappa.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
+#endif
   if ( myCreationInfoWdg )
     mappa.insert( myCreationInfoWdg->getWinID(), Qt::LeftDockWidgetArea );
+  if ( myTextTreeWdg )
+    mappa.insert( myTextTreeWdg->getWinID(), Qt::LeftDockWidgetArea );
 }
 
 void GeometryGUI::viewManagers( QStringList& lst ) const
@@ -2007,38 +2090,15 @@ void GeometryGUI::updateCreationInfo()
   // pass creation info of geomObj to myCreationInfoWdg
 
   if ( myCreationInfoWdg ) {
-    QPixmap icon;
-    QString operationName;
-    myCreationInfoWdg->setOperation( icon, operationName );
 
+    GEOM::CreationInformationSeq_var info;
     try {
       OCC_CATCH_SIGNALS;
-      GEOM::CreationInformation_var info = geomObj->GetCreationInformation();
-      if ( &info.in() ) {
-        SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
-        QString name = info->operationName.in();
-        if ( !name.isEmpty() ) {
-         
-         QString plugin_name;
-          for ( size_t i = 0; i < info->params.length(); ++i ) {
-            myCreationInfoWdg->addParam( info->params[i].name.in(),
-                                         info->params[i].value.in() );
-            QString value = info->params[i].name.in();
-           if( value == PLUGIN_NAME ) {
-             plugin_name = info->params[i].value.in();
-           }
-         }
-         QString prefix = plugin_name.isEmpty() ? "GEOM" : plugin_name;
-          icon = resMgr->loadPixmap( prefix, tr( ("ICO_"+name).toLatin1().constData() ), false );
-          operationName = tr( ("MEN_"+name).toLatin1().constData() );
-          if ( operationName.startsWith( "MEN_" ))
-            operationName = name; // no translation
-          myCreationInfoWdg->setOperation( icon, operationName );
-        }
-      }
+      info = geomObj->GetCreationInformation();
     }
     catch (...) {
     }
+    myCreationInfoWdg->setInfo( info );
   }
 }
 
@@ -2226,6 +2286,8 @@ void GeometryGUI::OnSetMaterial(const QString& theName)
 
 void GeometryGUI::createPreferences()
 {
+  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+
   int tabId = addPreference( tr( "PREF_TAB_SETTINGS" ) );
 
   int genGroup = addPreference( tr( "PREF_GROUP_GENERAL" ), tabId );
@@ -2256,6 +2318,11 @@ void GeometryGUI::createPreferences()
   addPreference( tr( "PREF_ISOS_COLOR" ), genGroup,
                  LightApp_Preferences::Color, "Geometry", "isos_color" );
 
+  addPreference( tr( "PREF_LABEL_COLOR" ), genGroup,
+                 LightApp_Preferences::Color, "Geometry", "label_color" );
+
+  addPreference( "", genGroup, LightApp_Preferences::Space );
+
   addPreference( tr( "PREF_TOPLEVEL_COLOR" ), genGroup,
                  LightApp_Preferences::Color, "Geometry", "toplevel_color" );
 
@@ -2263,7 +2330,7 @@ void GeometryGUI::createPreferences()
                       LightApp_Preferences::Selector, "Geometry", "toplevel_dm" );
 
   int transparency = addPreference( tr( "PREF_TRANSPARENCY" ), genGroup,
-                                   LightApp_Preferences::IntSpin, "Geometry", "transparency" );
+                                    LightApp_Preferences::IntSpin, "Geometry", "transparency" );
 
   int defl = addPreference( tr( "PREF_DEFLECTION" ), genGroup,
                             LightApp_Preferences::DblSpin, "Geometry", "deflection_coeff" );
@@ -2317,12 +2384,36 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aDimLineWidthId, "min", 1 );
   setPreferenceProperty( aDimLineWidthId, "max", 5 );
 
-  int aDimFontHeightId = addPreference( tr( "PREF_DIMENSIONS_FONT_HEIGHT" ), aDimGroupId,
-                                        LightApp_Preferences::DblSpin, "Geometry", "dimensions_font_height" );
-
-  setPreferenceProperty( aDimFontHeightId, "min", 1e-9 );
-  setPreferenceProperty( aDimFontHeightId, "max", 1e+9 );
-  setPreferenceProperty( aDimFontHeightId, "precision", 9 );
+  int aDimFontId = addPreference( tr( "PREF_DIMENSIONS_FONT" ), aDimGroupId, LightApp_Preferences::Font, "Geometry", "dimensions_font" );
+
+  int f = QtxFontEdit::Family | QtxFontEdit::Size;
+  setPreferenceProperty( aDimFontId, "features", f );
+  setPreferenceProperty( aDimFontId, "mode", QtxFontEdit::Custom );
+
+  Handle(Font_FontMgr) fmgr = Font_FontMgr::GetInstance();
+  QString aFontFile = "";
+  resMgr->value("resources", "GEOM", aFontFile);
+  aFontFile = aFontFile + QDir::separator() + "Y14.5M-2009.ttf";
+  // add enginier font into combobox
+  int fontID = QFontDatabase::addApplicationFont( aFontFile );
+  Handle(Font_SystemFont) sf = new Font_SystemFont( 
+    new TCollection_HAsciiString("Y14.5M-2009"), 
+    Font_FA_Regular, 
+    new TCollection_HAsciiString(aFontFile.toLatin1().data()) );
+  // register font in OCC font manager
+  fmgr->RegisterFont( sf, Standard_False );
+
+  // get list of supported fonts by OCC
+  QStringList anOCCFonts;
+  TColStd_SequenceOfHAsciiString theFontsNames;
+  fmgr->GetAvailableFontsNames( theFontsNames );
+  for(Standard_Integer i=1; i<=theFontsNames.Length(); i++) {
+    Handle(TCollection_HAsciiString) str = theFontsNames(i);
+    anOCCFonts << str->ToCString();
+  }
+  anOCCFonts.removeDuplicates();
+  // set the supported fonts into combobox to use its only
+  setPreferenceProperty( aDimFontId, "fonts", anOCCFonts );
 
   int aDimArrLengthId = addPreference( tr( "PREF_DIMENSIONS_ARROW_LENGTH" ), aDimGroupId,
                                        LightApp_Preferences::DblSpin, "Geometry", "dimensions_arrow_length" );
@@ -2337,9 +2428,6 @@ void GeometryGUI::createPreferences()
   int anAngUnitsId = addPreference( tr( "PREF_DIMENSIONS_ANGLE_UNITS" ), aDimGroupId,
                                    LightApp_Preferences::Selector, "Geometry", "dimensions_angle_units" );
 
-  addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
-                 LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
-
   QStringList aListOfLengthUnits;
   aListOfLengthUnits << "m";
   aListOfLengthUnits << "cm";
@@ -2354,6 +2442,9 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aLengthUnitsId, "strings", aListOfLengthUnits );
   setPreferenceProperty( anAngUnitsId,   "strings", aListOfAngUnits );
 
+  addPreference( tr( "PREF_DIMENSIONS_SHOW_UNITS" ), aDimGroupId,
+                 LightApp_Preferences::Bool, "Geometry", "dimensions_show_units" );
+
   int aDimDefFlyout = addPreference( tr( "PREF_DIMENSIONS_DEFAULT_FLYOUT" ), aDimGroupId,
                                      LightApp_Preferences::DblSpin, "Geometry", "dimensions_default_flyout" );
 
@@ -2361,6 +2452,9 @@ void GeometryGUI::createPreferences()
   setPreferenceProperty( aDimDefFlyout, "max", 1e+9 );
   setPreferenceProperty( aDimDefFlyout, "precision", 9 );
 
+  addPreference( tr( "PREF_DIMENSIONS_USE_TEXT3D" ), aDimGroupId,
+                 LightApp_Preferences::Bool, "Geometry", "dimensions_use_text3d" );
+
   int isoGroup = addPreference( tr( "PREF_ISOS" ), tabId );
   setPreferenceProperty( isoGroup, "columns", 2 );
   int isoU = addPreference( tr( "PREF_ISOS_U" ), isoGroup,
@@ -2467,7 +2561,6 @@ void GeometryGUI::createPreferences()
   QList<QVariant> aMarkerTypeIndicesList;
   QList<QVariant> aMarkerTypeIconsList;
 
-  SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   for ( int i = GEOM::MT_POINT; i < GEOM::MT_USER; i++ ) {
     QString icoFile = QString( "ICON_VERTEX_MARKER_%1" ).arg( i );
     QPixmap pixmap = resMgr->loadPixmap( "GEOM", tr( qPrintable( icoFile ) ) );
@@ -2629,11 +2722,13 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
     }
     else if ( param == QString("dimensions_color")        ||
               param == QString("dimensions_line_width")   ||
-              param == QString("dimensions_font_height")  ||
+              param == QString("dimensions_font")         ||
               param == QString("dimensions_arrow_length") ||
               param == QString("dimensions_show_units")   ||
               param == QString("dimensions_length_units") ||
-              param == QString("dimensions_angle_units") )
+              param == QString("dimensions_angle_units")  ||
+              param == QString("dimensions_use_text3d")  ||
+              param == QString("label_color") )
     {
       SalomeApp_Application* anApp = getApp();
       if ( !anApp )
@@ -2664,7 +2759,22 @@ void GeometryGUI::preferencesChanged( const QString& section, const QString& par
         aViewer->GetVisible( aVisible );
         aDisplayer.Redisplay( aVisible, false, aViewer );
       }
-
+      if ( param == QString( "label_color" ) ) {
+        ViewManagerList aVMsVTK;
+        anApp->viewManagers( SVTK_Viewer::Type(), aVMsVTK );
+        ViewManagerList::Iterator anIt = aVMsVTK.begin();
+        for ( ; anIt != aVMsVTK.end(); ++anIt )
+        {
+            SVTK_Viewer* aViewer = dynamic_cast<SVTK_Viewer*>( (*anIt)->getViewModel() );
+            if ( !aViewer )
+            {
+              continue;
+            }
+            SALOME_ListIO aVisible;
+            aViewer->GetVisible( aVisible );
+            aDisplayer.Redisplay( aVisible, false, aViewer );
+          }
+      }
       aDisplayer.UpdateViewer();
     }
     else if ( param.startsWith( "dependency_tree") )
@@ -3053,8 +3163,11 @@ void UpdateNameMode( SalomeApp_Application* app )
   GEOM_Displayer displayer( aStudy );
   int aMgrId = viewWindow->getViewManager()->getGlobalId();
 
+  SALOME_View* window = displayer.GetActiveView();
+  if ( !window ) return;
+
   SALOME_ListIO anIOlst;
-  displayer.GetActiveView()->GetVisible( anIOlst );
+  window->GetVisible( anIOlst );
 
   for ( SALOME_ListIteratorOfListIO It( anIOlst ); It.More(); It.Next() ) {
     Handle( SALOME_InteractiveObject ) io = It.Value();
@@ -3433,3 +3546,8 @@ void GeometryGUI::dropObjects( const DataObjectList& what, SUIT_DataObject* wher
   // update Object browser
   getApp()->updateObjectBrowser( false );
 }
+
+void GeometryGUI::emitDimensionsUpdated( QString entry )
+{
+  emit DimensionsUpdated( entry );
+}