Salome HOME
23599: EDF 17907 - Gnome freezes when suppressing horde of groups
[modules/smesh.git] / src / SMESHGUI / SMESHGUI.cxx
index c1b913cb5b60566268fa264da92c08aae80d1419..1bf93ec85426cdc3d00c208c1c7250d331930b53 100644 (file)
@@ -811,7 +811,7 @@ namespace
 
       bool is_ok = false;
       while (!is_ok) {
-        //MESSAGE("******* Loop on file dialog ***********");
+        MESSAGE("******* Loop on file dialog ***********");
         isOkToWrite =true;
         if ( fd->exec() )
           aFilename = fd->selectedFile();
@@ -820,13 +820,15 @@ namespace
           break;
         }
         aFormat = aFilterMap[fd->selectedNameFilter()];
-        //MESSAGE("selected minor: " << aFormat << " file: " << aFilename.toUtf8().constData());
+        MESSAGE("selected minor: " << aFormat << " file: " << aFilename.toUtf8().constData());
         toOverwrite = fv->isOverwrite(aFilename);
+        MESSAGE("toOverwrite:" << toOverwrite);
         is_ok = true;
         if ( !aFilename.isEmpty() ) {
           if( !toOverwrite ) {
             // can't append to an existing using other format
             bool isVersionOk = SMESHGUI::GetSMESHGen()->CheckWriteCompatibility( aFilename.toUtf8().constData() );
+            MESSAGE("Append check, isVersionOk:" << isVersionOk);
             if ( !isVersionOk ) {
               int aRet = SUIT_MessageBox::warning(SMESHGUI::desktop(),
                                                   QObject::tr("SMESH_WRN_WARNING"),
@@ -866,7 +868,7 @@ namespace
                                                   QObject::tr("SMESH_BUT_YES"),
                                                   QObject::tr("SMESH_BUT_NO"),
                                                   QObject::tr("SMESH_BUT_CANCEL"), 0, 2);
-             //MESSAGE("answer collision name " << aRet);
+             MESSAGE("answer collision name " << aRet);
              if (aRet == 0) {
                 toOverwrite = true;
                 isOkToWrite = true;
@@ -877,7 +879,7 @@ namespace
           }
         }
       }
-      //MESSAGE(" ****** end of file dialog loop")
+      MESSAGE(" ****** end of file dialog loop, toOverwrite:" << toOverwrite << " isOkToWrite:" << isOkToWrite);
       toCreateGroups = fd->IsChecked(0);
       toFindOutDim   = fd->IsChecked(1);
       fieldSelWdg->GetSelectedFields();
@@ -914,7 +916,7 @@ namespace
 //         }
         if ( isMED && isOkToWrite)
         {
-          //MESSAGE("OK to write MED file "<< aFilename.toUtf8().constData());
+          MESSAGE("OK to write MED file "<< aFilename.toUtf8().constData());
           aMeshIter = aMeshList.begin();
           for( int aMeshIndex = 0; aMeshIter != aMeshList.end(); aMeshIter++, aMeshIndex++ )
           {
@@ -1853,6 +1855,7 @@ void SMESHGUI::OnEditDelete()
   _PTR(GenericAttribute) anAttr;
   _PTR(AttributeIOR) anIOR;
 
+  const int objectCountLimit = 30; // PAL23599
   int objectCount = 0;
   QString aNameList;
   QString aParentComponent = QString::null;
@@ -1862,29 +1865,33 @@ void SMESHGUI::OnEditDelete()
     Handle(SALOME_InteractiveObject) anIO = anIt.Value();
     if ( anIO.IsNull() ) continue;
     
-    QString father = "unknown";
+    QString father = "unknown", name;
 
     _PTR(SObject) aSO = aStudy->FindObjectID( anIO->getEntry() );
     if (aSO) {
       father = QString::fromStdString( aSO->GetFatherComponent()->ComponentDataType() );
       // check if object is reference
       _PTR(SObject) aRefSObj;
-      aNameList.append("\n    - ");
       if ( aSO->ReferencedObject( aRefSObj ) ) {
-        QString aRefName = QString::fromStdString ( aRefSObj->GetName() );
-        aNameList.append( aRefName );
+        name = QString::fromStdString ( aRefSObj->GetName() );
         father = QString::fromStdString ( aRefSObj->GetFatherComponent()->ComponentDataType() );
       }
       else
-        aNameList.append(anIO->getName());
+        name = anIO->getName();
       objectCount++;
     }
+    if ( objectCount < objectCountLimit ) { // avoid occupying the whole screen
+      aNameList.append("\n    - ");
+      aNameList.append( name );
+    }
 
     if( aParentComponent.isNull() )
       aParentComponent = father;
     else if( !aParentComponent.isEmpty() && aParentComponent!=father )
       aParentComponent = "";
   }
+  if ( objectCount >= objectCountLimit )
+    aNameList.append("\n    - ...");
 
   if ( objectCount == 0 )
     return; // No Valid Objects Selected
@@ -5098,6 +5105,11 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( doubleNodesTol, "max", 1000000.0 );
   setPreferenceProperty( doubleNodesTol, "step", 0.0000001 );
 
+  /*
+  int cinc = addPreference(tr("PREF_CONTROLS_INCREMENT"), qaGroup, LightApp_Preferences::IntSpin, "SMESH", "controls_increment");
+  setPreferenceProperty( cinc, "min", 0 );
+  setPreferenceProperty( cinc, "max", 5 );
+  */
 
   int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
   setPreferenceProperty( exportgroup, "columns", 2 );
@@ -5331,6 +5343,10 @@ void SMESHGUI::createPreferences()
   addPreference( tr( "PREF_ELEMENTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_element" );
   addPreference( tr( "PREF_OBJECTS" ), precSelGroup, LightApp_Preferences::Double, "SMESH", "selection_precision_object" );
 
+  int sinc = addPreference(tr("PREF_SELECTION_INCREMENT"), selTab, LightApp_Preferences::IntSpin, "SMESH", "selection_increment");
+  setPreferenceProperty( sinc, "min", 0 );
+  setPreferenceProperty( sinc, "max", 5 );
+
   // Scalar Bar tab ------------------------------------------------------------------------
   int sbarTab = addPreference( tr( "SMESH_SCALARBAR" ) );
   int fontGr = addPreference( tr( "SMESH_FONT_SCALARBAR" ), sbarTab );
@@ -5430,7 +5446,8 @@ void SMESHGUI::preferencesChanged( const QString& sect, const QString& name )
          name==        "highlight_color" ||
          name=="selection_precision_node"    ||
          name=="selection_precision_element" ||
-         name=="selection_precision_object"   )
+         name=="selection_precision_object"   ||
+         name=="selection_increment")
     {
       SMESH::UpdateSelectionProp( this );
     }
@@ -7129,7 +7146,7 @@ bool SMESHGUI::renameObject( const QString& entry, const QString& name) {
 
           SMESH::SMESH_GroupBase_var aGroupObject = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>(IObject);
           if( !aGroupObject->_is_nil() ) {
-            aGroupObject->SetName( qPrintable(name) );
+            aGroupObject->SetName( qUtf8Printable(name) );
             if ( SMESH_Actor *anActor = SMESH::FindActorByEntry( qPrintable(entry) ) )
               anActor->setName( qUtf8Printable(name) );
           }