Salome HOME
Unicode support
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index 336363ecbc9e3f52393352a1d2f9df01d8c32f21..493b734bb144759ea436447652610fc438a5af65 100644 (file)
@@ -2012,8 +2012,8 @@ bool SMESHGUI::automaticUpdate(unsigned int requestedSize, bool* limitExceeded)
  *
  */
 //=============================================================================
-bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
-                                int* entities, bool* limitExceeded, int* hidden )
+bool SMESHGUI::automaticUpdate( SMESH::SMESH_IDSource_ptr theMesh,
+                                int* entities, bool* limitExceeded, int* hidden, long* nbElements )
 {
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   if ( !resMgr )
@@ -2023,8 +2023,23 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
   long updateLimit = resMgr->integerValue( "SMESH", "update_limit", 500000 );
   bool incrementalLimit = resMgr->booleanValue( "SMESH", "incremental_limit", false );
 
-  long requestedSize = theMesh->NbElements();
-
+  SMESH::long_array_var info = theMesh->GetMeshInfo();
+  long nbOdElems = info[SMDSEntity_0D];
+  long nbEdges   = info[SMDSEntity_Edge] + info[SMDSEntity_Quad_Edge];
+  long nbFaces   = info[SMDSEntity_Triangle]   + info[SMDSEntity_Quad_Triangle]   + info[SMDSEntity_BiQuad_Triangle] + 
+                   info[SMDSEntity_Quadrangle] + info[SMDSEntity_Quad_Quadrangle] + info[SMDSEntity_BiQuad_Quadrangle] + 
+                   info[SMDSEntity_Polygon];
+  long nbVolumes = info[SMDSEntity_Tetra]   + info[SMDSEntity_Quad_Tetra] + 
+                   info[SMDSEntity_Hexa]    + info[SMDSEntity_Quad_Hexa] + info[SMDSEntity_TriQuad_Hexa] + 
+                   info[SMDSEntity_Pyramid] + info[SMDSEntity_Quad_Pyramid] + 
+                   info[SMDSEntity_Penta]   + info[SMDSEntity_Quad_Penta] + 
+                   info[SMDSEntity_Polyhedra] + 
+                   info[SMDSEntity_Hexagonal_Prism];
+  long nbBalls   = info[SMDSEntity_Ball];
+
+  long requestedSize = nbOdElems + nbBalls + nbEdges + nbFaces + nbVolumes;
+  *nbElements = requestedSize;
+  
   *entities = SMESH_Actor::eAllEntity;
   *hidden   = 0;
 
@@ -2033,11 +2048,6 @@ bool SMESHGUI::automaticUpdate( SMESH::SMESH_Mesh_ptr theMesh,
   if ( limitExceeded ) *limitExceeded = autoUpdate && exceeded;
 
   if ( incrementalLimit ) {
-    long nbOdElems = theMesh->Nb0DElements();
-    long nbEdges   = theMesh->NbEdges();
-    long nbFaces   = theMesh->NbFaces();
-    long nbVolumes = theMesh->NbVolumes();
-    long nbBalls   = theMesh->NbBalls();
     long total     = 0;
 
     if ( nbOdElems > 0 ) {
@@ -4745,7 +4755,7 @@ void SMESHGUI::contextMenuPopup( const QString& client, QMenu* menu, QString& ti
     _PTR(Study) study = appStudy->studyDS();
     _PTR(SObject) obj = study->FindObjectID( io->getEntry() );
     if ( obj ) {
-      QString aName = QString( obj->GetName().c_str() );
+      QString aName = QString( QString::fromUtf8(obj->GetName().c_str()) );
       while ( aName.at( aName.length() - 1 ) == ' ' ) // Remove extraspaces in Name of Popup
           aName.remove( (aName.length() - 1), 1 );
       title = aName;
@@ -4761,6 +4771,7 @@ LightApp_Selection* SMESHGUI::createSelection() const
 void SMESHGUI::windows( QMap<int, int>& aMap ) const
 {
   aMap.insert( SalomeApp_Application::WT_ObjectBrowser, Qt::LeftDockWidgetArea );
+  aMap.insert( SalomeApp_Application::WT_NoteBook, Qt::LeftDockWidgetArea );
   aMap.insert( SalomeApp_Application::WT_PyConsole, Qt::BottomDockWidgetArea );
 }
 
@@ -6724,7 +6735,7 @@ void SMESHGUI::message( const QString& msg )
       _PTR(SObject) obj = study->FindObjectID( entry.toLatin1().constData() );
       QString name;
       if ( obj )
-        name = obj->GetName().c_str();
+        name = QString::fromUtf8(obj->GetName().c_str());
       if ( name.isEmpty() )
         return;