Salome HOME
Fix for bug PAL8377 (ExportToMed TUI vs GUI: how to set the value of the boolean...
authormzn <mzn@opencascade.com>
Fri, 2 Dec 2005 13:04:27 +0000 (13:04 +0000)
committermzn <mzn@opencascade.com>
Fri, 2 Dec 2005 13:04:27 +0000 (13:04 +0000)
src/SMESHGUI/SMESHGUI.cxx
src/SMESHGUI/SMESH_msg_en.po

index 775c9b15398cf6223bfb198ab06298a732c4e7f4..228689dfe14b787251eea4faddb64343cd50cde8 100644 (file)
@@ -81,8 +81,9 @@
 
 #include "SalomeApp_Tools.h"
 #include "SalomeApp_Study.h"
-#include "LightApp_DataOwner.h"
 #include "SalomeApp_Application.h"
+#include "SalomeApp_CheckFileDlg.h"
+#include "LightApp_DataOwner.h"
 #include "LightApp_Preferences.h"
 #include "LightApp_VTKSelector.h"
 #include "LightApp_Operation.h"
@@ -287,7 +288,12 @@ namespace{
 
        QString aFilename;
        SMESH::MED_VERSION aFormat;
-
+       // Init the parameter with the default value
+       bool toCreateGroups = false;
+       SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
+       if ( resMgr )
+         toCreateGroups = resMgr->booleanValue( "SMESH", "auto_groups", false );
+       
        if ( theCommandID != 122 && theCommandID != 125 )
          aFilename = SUIT_FileDlg::getFileName(SMESHGUI::desktop(), "", aFilter, aTitle, false);
        else
@@ -296,10 +302,12 @@ namespace{
            for ( QMap<QString, SMESH::MED_VERSION>::const_iterator it = aFilterMap.begin(); it != aFilterMap.end(); ++it )
              filters.push_back( it.key() );
 
-           SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+           //SUIT_FileDlg* fd = new SUIT_FileDlg( SMESHGUI::desktop(), false, true, true );
+           SalomeApp_CheckFileDlg* fd = new SalomeApp_CheckFileDlg( SMESHGUI::desktop(), false, QObject::tr("SMESH_AUTO_GROUPS") ,true, true );
            fd->setCaption( aTitle );
            fd->setFilters( filters );
            fd->setSelectedFilter( QObject::tr("MED 2.2 (*.med)") );
+           fd->SetChecked(toCreateGroups);
            bool is_ok = false;
            while(!is_ok){
              fd->exec();
@@ -320,6 +328,7 @@ namespace{
                }
              }
            }
+           toCreateGroups = fd->IsChecked();
            delete fd;
          }
        if ( !aFilename.isEmpty() ) {
@@ -331,7 +340,7 @@ namespace{
          switch ( theCommandID ) {
          case 125:
          case 122:
-           aMesh->ExportToMED( aFilename.latin1(), false, aFormat ); // currently, automatic groups are never created
+           aMesh->ExportToMED( aFilename.latin1(), toCreateGroups, aFormat );
            break;
          case 124:
          case 121:
@@ -2886,6 +2895,9 @@ void SMESHGUI::createPreferences()
   setPreferenceProperty( dispmode, "strings", modes );
   setPreferenceProperty( dispmode, "indexes", indices );
 
+  int exportgroup = addPreference( tr( "PREF_GROUP_EXPORT" ), genTab );
+  addPreference( tr( "PREF_AUTO_GROUPS" ), exportgroup, LightApp_Preferences::Bool, "SMESH", "auto_groups" );
+  
   int meshTab = addPreference( tr( "PREF_TAB_MESH" ) );
   int nodeGroup = addPreference( tr( "PREF_GROUP_NODES" ), meshTab );
 
index c97815118678215c72e50fed94e6372be22cd448..572233fd64878604ceb88e96868b360d3fa01087 100644 (file)
@@ -1247,6 +1247,9 @@ msgstr "During export mesh with name - \"%1\" to MED 2.1\n"
 msgid "INF_SELECT_OBJECT"
 msgstr "Select an object"
 
+msgid "SMESH_AUTO_GROUPS"
+msgstr "Automatically create groups"
+
 #----------------------------------------------------
 
 msgid "SMESHGUI_FilterLibraryDlg::ADD_TO_TLT"
@@ -2775,6 +2778,9 @@ msgstr "General"
 msgid "SMESHGUI::PREF_GROUP_UPDATE"
 msgstr "Update"
 
+msgid "SMESHGUI::PREF_GROUP_EXPORT"
+msgstr "Mesh export"
+
 msgid "SMESHGUI::PREF_GROUP_QUALITY"
 msgstr "Quality controls"
 
@@ -2850,6 +2856,12 @@ msgstr "Elements"
 msgid "SMESHGUI::PREF_DISPLAY_MODE"
 msgstr "Display mode"
 
+msgid "SMESHGUI::PREF_GROUP_EXPORT"
+msgstr "Export"
+
+msgid "SMESHGUI::PREF_AUTO_GROUPS"
+msgstr "Automatically create groups for MED export"
+
 #-----------------------------------------------------------
 
 msgid "SMESHGUI_MeshDlg::DIM_1D"