Salome HOME
Merge from V6_4_BR 05/12/2011
[modules/visu.git] / src / VISUGUI / VisuGUI.cxx
index 64f2fa6fbbd276f3a067a7c5f7f8775a79a9eb7a..e5ea3f837822cc25043b909b3b3f33fc4fcfb10b 100644 (file)
@@ -26,6 +26,9 @@
 //  Module : VISU
 
 #include <Standard_math.hxx>  // E.A. must be included before Python.h to fix compilation on windows
+#ifdef HAVE_FINITE
+#undef HAVE_FINITE            // VSR: avoid compilation warning on Linux : "HAVE_FINITE" redefined
+#endif
 #include "Python.h"
 
 #include "VisuGUI.h"
@@ -507,7 +510,7 @@ VisuGUI
         }
       }
       catch(...) {
-        errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNKNOWN_IMPORT_ERROR" ) ) );
+        errors.append( QString( "%1 :\n\t%2" ).arg( aFileInfo.filePath() ).arg( tr( "UNSUPPORTED_FILE_FORMAT" ) ) );
       }
     }
   }
@@ -4943,6 +4946,11 @@ bool VisuGUI::renameAllowed( const QString& entry) const {
         aType == VISU::TPOINTMAP3D || aType == VISU::TVIEW3D ||
         aType == VISU::TPOINTMAP3D || aType == VISU::TGAUSSPOINTS)
       return true;
+  } else {
+    VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
+    bool anIsExist;
+    QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+    return anIsExist && "VIEW3D" == aVal;
   }
   return false;
 }
@@ -4963,6 +4971,7 @@ bool VisuGUI::renameObject( const QString& entry, const QString& name) {
   _PTR(SObject) aSObject = anObjectInfo.mySObject;
   if (aSObject) {
     VISU::Base_i* aBase = anObjectInfo.myBase;
+    VISU::Storable::TRestoringMap aMap = VISU::Storable::GetStorableMap(anObjectInfo.mySObject);
     if(aBase){
       VISU::VISUType aType = aBase->GetType();
       if( aType == VISU::TCOLOREDPRS3DHOLDER ) {
@@ -5030,6 +5039,19 @@ bool VisuGUI::renameObject( const QString& entry, const QString& name) {
            return true;
          }
        }
+       //Rename visual params
+      }
+    } else {
+      bool anIsExist;
+      QString aVal = VISU::Storable::FindValue(aMap, "myComment", &anIsExist);
+      if(anIsExist && "VIEW3D" == aVal) {
+       _PTR(GenericAttribute) anAttr;
+       if (aSObject->FindAttribute(anAttr, "AttributeName")) {
+         _PTR(AttributeName) aName (anAttr);
+         if (!name.isEmpty()) {
+           aName->SetValue(qPrintable(name));
+         }
+       }
       }
     }
   }