Salome HOME
Additional fix for the '23049: [CEA 1475] Increase the size of some dialog boxes...
[plugins/ghs3dplugin.git] / src / GUI / GHS3DPluginGUI_HypothesisCreator.cxx
index b368961eab0e55488e999542c2aef3dbb0946269..79de2920567a7cfd0c5567a9805e0003ebe6e042 100644 (file)
@@ -1,4 +1,4 @@
-// Copyright (C) 2004-2014  CEA/DEN, EDF R&D
+// Copyright (C) 2004-2015  CEA/DEN, EDF R&D
 //
 // This library is free software; you can redistribute it and/or
 // modify it under the terms of the GNU Lesser General Public
@@ -76,28 +76,28 @@ namespace {
 #include <sys/sysinfo.h>
 #endif
 
-  int maxAvailableMemory()
+  long maxAvailableMemory()
   {
 #ifdef WIN32
     // See http://msdn.microsoft.com/en-us/library/aa366589.aspx
     MEMORYSTATUSEX statex;
     statex.dwLength = sizeof (statex);
-    int err = GlobalMemoryStatusEx (&statex);
+    long err = GlobalMemoryStatusEx (&statex);
     if (err != 0) {
-      int totMB = 
+      long totMB = 
         statex.ullTotalPhys / 1024 / 1024 +
         statex.ullTotalPageFile / 1024 / 1024 +
         statex.ullTotalVirtual / 1024 / 1024;
-      return (int) ( 0.7 * totMB );
+      return (long) ( 0.7 * totMB );
     }
 #else
     struct sysinfo si;
-    int err = sysinfo( &si );
+    long err = sysinfo( &si );
     if ( err == 0 ) {
-      int totMB =
+      long totMB =
         si.totalram * si.mem_unit / 1024 / 1024 +
         si.totalswap * si.mem_unit / 1024 / 1024 ;
-      return (int) ( 0.7 * totMB );
+      return (long) ( 0.7 * totMB );
     }
 #endif
     return 0;
@@ -416,11 +416,11 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   myAdvWidget->maxMemoryCheck->setText(tr( "MAX_MEMORY_SIZE" ));
   myAdvWidget->initialMemoryCheck->setText(tr( "INIT_MEMORY_SIZE" ));
 
-  myAdvWidget->maxMemorySpin->RangeStepAndValidator(20.0, 1e6, 10.0);
-  myAdvWidget->maxMemorySpin->setValue( 128.0 );
+  myAdvWidget->maxMemorySpin->stepBy(10);
+  myAdvWidget->maxMemorySpin->setValue( 128 );
 
-  myAdvWidget->initialMemorySpin->RangeStepAndValidator(0.0, 1e6, 10.0);
-  myAdvWidget->initialMemorySpin->setValue( 100.0 );
+  myAdvWidget->initialMemorySpin->stepBy(10);
+  myAdvWidget->initialMemorySpin->setValue( 100 );
 
   myAdvWidget->initialMemoryLabel            ->setText (tr( "MEGABYTE" ));
   myAdvWidget->maxMemoryLabel                ->setText (tr( "MEGABYTE" ));
@@ -477,7 +477,7 @@ QFrame* GHS3DPluginGUI_HypothesisCreator::buildFrame()
   shapeTypes.Add( TopAbs_COMPOUND );
 
   SMESH_NumberFilter* vertexFilter = new SMESH_NumberFilter("GEOM", TopAbs_SHAPE, 1, shapeTypes);
-  myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true, /*stretch=*/false);
+  myEnfVertexWdg = new StdMeshersGUI_ObjectReferenceParamWdg( vertexFilter, 0, /*multiSel=*/true);
   myEnfVertexWdg->SetDefaultText(tr("GHS3D_ENF_SELECT_VERTEX"), "QLineEdit { color: grey }");
   
   QLabel* myXCoordLabel = new QLabel( tr( "GHS3D_ENF_VER_X_LABEL" ), myEnfGroup );
@@ -1038,7 +1038,9 @@ void GHS3DPluginGUI_HypothesisCreator::addEnforcedVertex(double x, double y, dou
       break;
 
 
-    if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) || /*( (itemEntry.toStdString() != "") && */ (itemEntry.toStdString() == geomEntry)/*)*/) {
+    if (( !isCompound && ((itemX == x) && (itemY == y) && (itemZ == z))) ||
+        ( !itemEntry.isEmpty() && ( itemEntry == geomEntry.c_str() )))
+    {
       // update size
       if (itemSize != size) {
         MESSAGE("Size is updated from \"" << itemSize << "\" to \"" << size << "\"");
@@ -1261,10 +1263,14 @@ void GHS3DPluginGUI_HypothesisCreator::onAddEnforcedVertex()
     if (selEnfVertex == 1) {
       MESSAGE("1 GEOM object selected");
       myEnfVertex = myEnfVertexWdg->GetObject< GEOM::GEOM_Object >();
-      std::string entry = "";
-      if (myEnfVertex != GEOM::GEOM_Object::_nil())
-        entry = myEnfVertex->GetStudyEntry();
-      addEnforcedVertex(x, y, z, size, myEnfVertex->GetName(),entry, groupName, myEnfVertex->GetShapeType() == GEOM::COMPOUND);
+      std::string entry = "", name = "";
+      bool isCompound = false;
+      if ( !myEnfVertex->_is_nil() ) {
+        entry = SMESH::toStdStr( myEnfVertex->GetStudyEntry() );
+        name  = SMESH::toStdStr( myEnfVertex->GetName() );
+        isCompound = ( myEnfVertex->GetShapeType() == GEOM::COMPOUND );
+      }
+      addEnforcedVertex(x, y, z, size, name, entry, groupName, isCompound);
     }
     else {
       MESSAGE("0 GEOM object selected");
@@ -1416,10 +1422,10 @@ void GHS3DPluginGUI_HypothesisCreator::retrieveParams() const
   myToMakeGroupsOfDomains                     ->setChecked    ( data.myToMakeGroupsOfDomains );
   myOptimizationLevelCombo                    ->setCurrentIndex( data.myOptimizationLevel );
   myAdvWidget->maxMemoryCheck                 ->setChecked    ( data.myMaximumMemory > 0 );
-  myAdvWidget->maxMemorySpin                  ->setValue      ( qMax( data.myMaximumMemory,
+  myAdvWidget->maxMemorySpin                  ->setValue      ( qMax( (int)data.myMaximumMemory,
                                                                       myAdvWidget->maxMemorySpin->minimum() ));
   myAdvWidget->initialMemoryCheck             ->setChecked    ( data.myInitialMemory > 0 );
-  myAdvWidget->initialMemorySpin              ->setValue      ( qMax( data.myInitialMemory,
+  myAdvWidget->initialMemorySpin              ->setValue      ( qMax( (int)data.myInitialMemory,
                                                                       myAdvWidget->initialMemorySpin->minimum() ));
   myAdvWidget->workingDirectoryLineEdit       ->setText       ( data.myWorkingDir );
   myAdvWidget->keepWorkingFilesCheck           ->setChecked    ( data.myKeepFiles );