//
#include "GEOMToolsGUI.h"
+#include "GEOMToolsGUI_DeleteDlg.h"
#include <GeometryGUI.h>
#include <GEOMBase.h>
static QString getFileName( QWidget* parent,
const QString& initial,
const FilterMap& filterMap,
+ const QStringList& filters,
const QString& caption,
bool open,
QString& format )
{
static QString lastUsedFilter;
- QStringList filters;
- for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it )
- filters.push_back( it.key() );
+ //QStringList filters;
+ QString aBrepFilter;
+ for ( FilterMap::const_iterator it = filterMap.begin(); it != filterMap.end(); ++it ) {
+ //filters.push_back( it.key() );
+ if ( it.key().contains( "BREP", Qt::CaseInsensitive ) )
+ aBrepFilter = it.key();
+ }
SUIT_FileDlg* fd = new SUIT_FileDlg( parent, open, true, true );
if ( !caption.isEmpty() )
if ( !initial.isEmpty() )
fd->selectFile( initial );
- if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) )
+ fd->setFilters( filters );
+
+ if ( !lastUsedFilter.isEmpty() && filterMap.contains( lastUsedFilter ) ) {
fd->selectFilter( lastUsedFilter );
+ }
+ else if ( !aBrepFilter.isEmpty() ) {
+ fd->selectFilter( aBrepFilter );
+ }
- fd->setFilters( filters );
+ QString filename;
+ if ( fd->exec() == QDialog::Accepted ) {
+ filename = fd->selectedFile();
+ format = filterMap[fd->selectedFilter()];
+ lastUsedFilter = fd->selectedFilter();
+ }
- fd->exec();
- QString filename = fd->selectedFile();
- format = filterMap[fd->selectedFilter()];
- lastUsedFilter = fd->selectedFilter();
delete fd;
qApp->processEvents();
return filename;
OnNbIsos();
break;
}
+ case 8035: // AUTO COLOR - POPUP VIEWER
+ {
+ OnAutoColor();
+ break;
+ }
+ case 8036: // DISABLE AUTO COLOR - POPUP VIEWER
+ {
+ OnDisableAutoColor();
+ break;
+ }
case 9024 : // OPEN - OBJBROSER POPUP
{
OnOpen();
// VSR 17/11/04: check if all objects selected belong to GEOM component --> start
// modifications of ASV 01.06.05
QString parentComp = getParentComponent( aStudy, selected );
- CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
+ CORBA::String_var geomIOR = app->orb()->object_to_string( GeometryGUI::GetGeomGen() );
QString geomComp = getParentComponent( aStudy->FindObjectIOR( geomIOR.in() ) );
if ( parentComp != geomComp ) {
}
// VSR 17/11/04: check if all objects selected belong to GEOM component <-- finish
- if ( SUIT_MessageBox::warning( app->desktop(),
- QObject::tr( "GEOM_WRN_WARNING" ),
- QObject::tr( "GEOM_REALLY_DELETE" ),
- QObject::tr( "GEOM_BUT_YES" ),
- QObject::tr( "GEOM_BUT_NO" ), 1 ) != 0 )
+ QStringList aNameList;
+ for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) {
+ Handle(SALOME_InteractiveObject) anIObject = It.Value();
+ QString aName = anIObject->getName();
+ if ( aName != "" && aName[ 0 ] != '*' ) {
+ aNameList.append( aName );
+
+ _PTR(SObject) obj ( aStudy->FindObjectID( anIObject->getEntry() ) );
+ _PTR(ChildIterator) it ( aStudy->NewChildIterator( obj ) );
+ for ( it->InitEx( true ); it->More(); it->Next() ) {
+ _PTR(SObject) child( it->Value() );
+ QString aName = child->GetName().c_str();
+ if ( aName != "" && aName[ 0 ] != '*' ) {
+ aNameList.append( aName );
+ }
+ }
+ }
+ }
+
+ GEOMToolsGUI_DeleteDlg dlg( app->desktop(), aNameList );
+ if ( !dlg.exec() )
return;
// QAD_Operation* op = new SALOMEGUI_ImportOperation(.....);
RemoveObjectWithChildren(obj, aStudy, views, disp);
// Remove objects from Study
- aStudyBuilder->RemoveObject( obj );
+ aStudyBuilder->RemoveObjectWithChildren( obj );
//deleted = true;
} // MAIN LOOP of selected
// Obtain a list of available import formats
FilterMap aMap;
+ QStringList filters;
GEOM::string_array_var aFormats, aPatterns;
aInsOp->ImportTranslators( aFormats, aPatterns );
- for ( int i = 0, n = aFormats->length(); i < n; i++ )
+ for ( int i = 0, n = aFormats->length(); i < n; i++ ) {
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
+ filters.push_back( (char*)aPatterns[i] );
+ }
QString fileType;
- QString fileName = getFileName(app->desktop(), "", aMap,
+ QString fileName = getFileName(app->desktop(), "", aMap, filters,
tr("GEOM_MEN_IMPORT"), true, fileType);
+ if (fileName.isEmpty())
+ return false;
+
if (fileType.isEmpty() )
{
// Trying to detect file type
fileType = aPossibleType;
}
- if (fileName.isEmpty() || fileType.isEmpty())
+ if (fileType.isEmpty())
return false;
GEOM_Operation* anOp = new GEOM_Operation (app, aInsOp.in());
anOp->start();
- CORBA::String_var fileN = fileName.toLatin1().data();
- CORBA::String_var fileT = fileType.toLatin1().data();
+ CORBA::String_var fileN = CORBA::string_dup(fileName.toLatin1().data());
+ CORBA::String_var fileT = CORBA::string_dup(fileType.toLatin1().data());
anObj = aInsOp->Import(fileN, fileT);
if ( !anObj->_is_nil() && aInsOp->IsDone() ) {
// Obtain a list of available export formats
FilterMap aMap;
+ QStringList filters;
GEOM::string_array_var aFormats, aPatterns;
aInsOp->ExportTranslators( aFormats, aPatterns );
- for ( int i = 0, n = aFormats->length(); i < n; i++ )
+ for ( int i = 0, n = aFormats->length(); i < n; i++ ) {
aMap.insert( (char*)aPatterns[i], (char*)aFormats[i] );
+ filters.push_back( (char*)aPatterns[i] );
+ }
// Get selected objects
LightApp_SelectionMgr* sm = app->selectionMgr();
continue;
QString fileType;
- QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap,
+ QString file = getFileName(app->desktop(), QString( IObject->getName() ), aMap, filters,
tr("GEOM_MEN_EXPORT"), false, fileType);
// User has pressed "Cancel" --> stop the operation