Salome HOME
Merge of GUI and Engine functionalities
authormpa <mpa@opencascade.com>
Fri, 20 Jun 2014 10:19:06 +0000 (14:19 +0400)
committermpa <mpa@opencascade.com>
Fri, 20 Jun 2014 10:19:06 +0000 (14:19 +0400)
src/GEOMGUI/GEOM_msg_en.ts
src/GEOMGUI/GEOM_msg_fr.ts
src/GEOMGUI/GEOM_msg_ja.ts
src/GEOMToolsGUI/GEOMToolsGUI_1.cxx
src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.cxx
src/GEOMToolsGUI/GEOMToolsGUI_ReduceStudyDlg.h

index fdd89f8389a1295fdde9b324ab501047365c4e04..31d38cda8109dc37f0e95a35f85e4afa14ae3d05 100644 (file)
@@ -6912,16 +6912,24 @@ Do you want to create new material?</translation>
         <translation>Options</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_UNPUB_INTERMEDIATE</source>
-        <translation>Unpublish intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
+        <translation>Intermediate objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_REMOVE_INTERMEDIATE</source>
-        <translation>Remove intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
+        <translation>Sub-objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_KEEP_SUB_OBJECTS</source>
-        <translation>Keep sub-objects in result</translation>
+        <source>GEOM_REDUCE_STUDY_KEEP</source>
+        <translation>Keep</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
+        <translation>Unpublish</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_REMOVE</source>
+        <translation>Remove</translation>
     </message>
     <message>
         <source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
index 86867a75adbfa798b759bf68053ab0bb03cceb42..9f9c5e595e47c1c76dcfc7c5d9584dd897fb076a 100644 (file)
@@ -6912,16 +6912,24 @@ Voulez-vous en créer un nouveau ?</translation>
         <translation type="unfinished">Options</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_UNPUB_INTERMEDIATE</source>
-        <translation type="unfinished">Unpublish intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
+        <translation type="unfinished">Intermediate objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_REMOVE_INTERMEDIATE</source>
-        <translation type="unfinished">Remove intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
+        <translation type="unfinished">Sub-objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_KEEP_SUB_OBJECTS</source>
-        <translation type="unfinished">Keep sub-objects in result</translation>
+        <source>GEOM_REDUCE_STUDY_KEEP</source>
+        <translation type="unfinished">Keep</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
+        <translation type="unfinished">Unpublish</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_REMOVE</source>
+        <translation type="unfinished">Remove</translation>
     </message>
     <message>
         <source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
index 01014e9f60edc2def6e544cfa87e02b414e4257a..c38b1692244472857dd4a6428fc380afa4ae60ed 100644 (file)
@@ -6721,16 +6721,24 @@ Please specify suitable arguments.</translation>
         <translation type="unfinished">Options</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_UNPUB_INTERMEDIATE</source>
-        <translation type="unfinished">Unpublish intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_INTERMEDIATES</source>
+        <translation type="unfinished">Intermediate objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_REMOVE_INTERMEDIATE</source>
-        <translation type="unfinished">Remove intermediate objects</translation>
+        <source>GEOM_REDUCE_STUDY_SUB_OBJECTS</source>
+        <translation type="unfinished">Sub-objects</translation>
     </message>
     <message>
-        <source>GEOM_REDUCE_STUDY_KEEP_SUB_OBJECTS</source>
-        <translation type="unfinished">Keep sub-objects in result</translation>
+        <source>GEOM_REDUCE_STUDY_KEEP</source>
+        <translation type="unfinished">Keep</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_UNPUBLISH</source>
+        <translation type="unfinished">Unpublish</translation>
+    </message>
+    <message>
+        <source>GEOM_REDUCE_STUDY_REMOVE</source>
+        <translation type="unfinished">Remove</translation>
     </message>
     <message>
         <source>GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER</source>
index bf91fef8df998793550c98be49190fbeb5ad1cbc..f160407ff20bb83610088c24b077584d5ca5f3b3 100644 (file)
@@ -921,6 +921,8 @@ void GEOMToolsGUI::OnReduceStudy()
     QString entry = geomObject->GetEntry();
     objectsEntry[ iter ] = entry.toLatin1().constData();
   }
-  GEOMToolsGUI_ReduceStudyDlg dlg( objectsEntry, SUIT_Session::session()->activeApplication()->desktop() );
-  dlg.exec();
+  QDialog* dlg = new GEOMToolsGUI_ReduceStudyDlg( objectsEntry, SUIT_Session::session()->activeApplication()->desktop() );
+  if ( dlg != NULL )
+    dlg->show();
+
 }
index 621d16ce6dedf136bab1ac80fb4fc74cb3c32e3d..5b5529ff786b51f98076f1072ee0a5db69349bd7 100644 (file)
 #include <QGridLayout>
 #include <QHeaderView>
 #include <QPushButton>
+#include <QRadioButton>
+
 
 // GUI includes
 #include <SUIT_Session.h>
 #include <SUIT_ResourceMgr.h>
+#include <SUIT_DataOwner.h>
 #include <SalomeApp_Application.h>
 #include <SalomeApp_Study.h>
 #include <OCCViewer_ViewManager.h>
+#include <LightApp_DataOwner.h>
+#include <GEOMToolsGUI.h>
 
 // GEOM includes
 #include <SALOMEconfig.h>
 #include CORBA_CLIENT_HEADER(GEOM_Gen)
 #include <GEOMBase_Helper.h>
 
-#include <iostream>
-
-GEOMToolsGUI_TreeWidgetItem::GEOMToolsGUI_TreeWidgetItem( QTreeWidget* view, const QStringList &strings,
-                                                          char* studyEntry, bool visible, int type )
-:QTreeWidgetItem( view, strings, type ),
- myStudyEntry( studyEntry ),
- myVisible( visible )
-{
-
-}
-
-GEOMToolsGUI_TreeWidgetItem::GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem* parent, const QStringList &strings,
-                                                          char* studyEntry, bool visible, int type )
-:QTreeWidgetItem( parent, strings, type ),
- myStudyEntry( studyEntry ),
- myVisible( visible )
-{
-
-}
-
-GEOMToolsGUI_TreeWidgetItem::~GEOMToolsGUI_TreeWidgetItem()
-{
-}
-
-bool GEOMToolsGUI_TreeWidgetItem::isVisible()
-{
-  return myVisible;
-}
+#include <LightApp_SelectionMgr.h>
+#include <SALOME_ListIteratorOfListIO.hxx>
 
-void GEOMToolsGUI_TreeWidgetItem::setVisible( bool theIsVisible, QIcon& theIcon )
-{
-  myVisible = theIsVisible;
-  setIcon( 1, theIcon );
-}
+// GEOM includes
+#include <GEOMBase.h>
 
-char* GEOMToolsGUI_TreeWidgetItem::getStudyEntry() const
-{
-  return myStudyEntry;
-}
+#include <iostream>
 
 GEOMToolsGUI_ReduceStudyDlg::GEOMToolsGUI_ReduceStudyDlg( const GEOM::string_array& theObjectEntries, QWidget* parent )
 :QDialog( parent, Qt::WindowTitleHint | Qt::WindowSystemMenuHint ),
-mySelectAll( false ),
 myDisplayer(NULL)
 {
-  for( int i = 0; i < theObjectEntries.length(); i++ )
-    myMainEntries.insert( theObjectEntries[i].in() );
-
-  myParents.insert( "0:1:21" );
-  myParents.insert( "0:1:17" );
-  myParents.insert( "0:1:20" );
-  myParents.insert( "0:1:13" );
-  myParents.insert( "0:1:12" );
-
-  mySubObjects.insert( "0:1:24" );
-  mySubObjects.insert( "0:1:28" );
-  mySubObjects.insert( "0:1:29" );
-  mySubObjects.insert( "0:1:34" );
-
-  myOthers.insert( "0:1:35" );
-  myOthers.insert( "0:1:36" );
-  myOthers.insert( "0:1:37" );
-  myOthers.insert( "0:1:38" );
-  myOthers.insert( "0:1:39" );
-
-  std::set<std::string>::iterator it;
-  for ( it=myParents.begin(); it!=myParents.end(); ++it)
-    std::cout << ' ' << *it;
-
   SUIT_ResourceMgr* resMgr = SUIT_Session::session()->resourceMgr();
   myVisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_VISIBLE" ) ) );
   myInvisible = QIcon( resMgr->loadPixmap( "SUIT", tr( "ICON_DATAOBJ_INVISIBLE" ) ) );
 
   SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
   if ( !app ) return;
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-  int studyId = GeometryGUI::ClientStudyToStudy( study->studyDS())->StudyId();
-
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  myStudyId = GeometryGUI::ClientStudyToStudy( study->studyDS() )->StudyId();
   myDisplayer = GEOM_Displayer( study );
 
- // setModal( true );
   setWindowTitle( tr( "GEOM_REDUCE_STUDY_TITLE" ) );
-  setSizeGripEnabled( TRUE );
 
   QGridLayout* topLayout = new QGridLayout( this );
   topLayout->setMargin( 11 ); topLayout->setSpacing( 6 );
 
+  /**********************   Objects to be kept    **********************/
   QGroupBox* groupKeptObjects = new QGroupBox( tr( "GEOM_REDUCE_STUDY_KEPT_OBJECTS" ) );
-
-  if(true) {
-  myTreeKeptObjects = new QTreeWidget();
-  myTreeKeptObjects->setColumnCount( 2 );
-  myTreeKeptObjects->setAllColumnsShowFocus(true);
-  QStringList columnNames;
-  columnNames.append(tr( "GEOM_REDUCE_STUDY_NAME" ));
-  columnNames.append("");
-  myTreeKeptObjects->setHeaderLabels( columnNames );
-  QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
-  myTreeKeptObjects->setHeaderItem ( headerItem );
-  myTreeKeptObjects->header()->moveSection( 1, 0 );
-  myTreeKeptObjects->header()->setClickable( true );
-  myTreeKeptObjects->header()->setMovable( false );
-  myTreeKeptObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
-  myTreeKeptObjects->setSelectionMode( QAbstractItemView::ExtendedSelection );
-
-  }
-
-//  myTreeWidget->header()->setSortIndicatorShown( true );
-//  myTreeWidget->header()->moveSection( 2, 0 );
-//  myTreeWidget->setSortingEnabled( true );
-//  myTreeWidget->setColumnWidth( 2, VISIBILITY_COLUMN_WIDTH );
-
-  QLayout* layoutKeptObjects = new QGridLayout( groupKeptObjects );
+  QGridLayout* layoutKeptObjects = new QGridLayout( groupKeptObjects );
+  createTreeWidget( myTreeKeptObjects = new QTreeWidget() );
   layoutKeptObjects->addWidget( myTreeKeptObjects );
 
+  /**********************  Objects to be removed  **********************/
   QGroupBox* groupRemoveObjects = new QGroupBox( tr( "GEOM_REDUCE_STUDY_REMOVE_OBJECTS" ) );
-
-  if(true) {
-  myTreeRemoveObjects = new QTreeWidget();
-  myTreeRemoveObjects->setColumnCount( 2 );
-  myTreeRemoveObjects->setAllColumnsShowFocus(true);
-  QStringList columnNames;
-  columnNames.append(tr( "GEOM_REDUCE_STUDY_NAME" ));
-  columnNames.append("");
-  myTreeRemoveObjects->setHeaderLabels( columnNames );
-  QTreeWidgetItem* headerItem = new QTreeWidgetItem( columnNames );
-  myTreeRemoveObjects->setHeaderItem ( headerItem );
-  myTreeRemoveObjects->header()->moveSection( 1, 0 );
-  myTreeRemoveObjects->header()->setClickable( true );
-  myTreeRemoveObjects->header()->setMovable( false );
-  myTreeRemoveObjects->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
-  myTreeRemoveObjects->setSelectionMode( QAbstractItemView::ExtendedSelection );
-  }
-
   QGridLayout* layoutRemoveObjects = new QGridLayout( groupRemoveObjects );
+  createTreeWidget( myTreeRemoveObjects = new QTreeWidget() );
   layoutRemoveObjects->addWidget( myTreeRemoveObjects );
 
+  /**********************         Options         **********************/
   QGroupBox* groupOptions = new QGroupBox( tr( "GEOM_REDUCE_STUDY_OPTIONS" ) );
+  QVBoxLayout* layoutOptions = new QVBoxLayout( groupOptions );
 
-  QGridLayout* layoutOptions = new QGridLayout( groupOptions );
+  // Intermidiate objects
+  QGroupBox* groupIntermediates = createButtonGroup( myIntermediates = new QButtonGroup() );
+  groupIntermediates->setTitle( tr( "GEOM_REDUCE_STUDY_INTERMEDIATES" ) );
 
-  myCBUnpublishIntermediate = new QCheckBox( tr( "GEOM_REDUCE_STUDY_UNPUB_INTERMEDIATE" ) );
-  myCBRemoveIntermediate = new QCheckBox( tr( "GEOM_REDUCE_STUDY_REMOVE_INTERMEDIATE" ) );
-  myCBKeepSubObjects = new QCheckBox( tr( "GEOM_REDUCE_STUDY_KEEP_SUB_OBJECTS" ) );
+  // Sub-objects
+  QGroupBox* groupSubObjects = createButtonGroup( mySubObjects = new QButtonGroup() );
+  groupSubObjects->setTitle( tr( "GEOM_REDUCE_STUDY_SUB_OBJECTS" ) );
+
+  // Others
   myCBRemoveEmptyFolder = new QCheckBox( tr( "GEOM_REDUCE_STUDY_REMOVE_EMPTY_FOLDER" ) );
   myCBRemoveEmptyFolder->setChecked( true );
   myCBSoftRemoval = new QCheckBox( tr( "GEOM_REDUCE_STUDY_SOFT_REMOVAL" ) );
 
-  layoutOptions->addWidget( myCBUnpublishIntermediate, 0, 0 );
-  layoutOptions->addWidget( myCBRemoveIntermediate, 0, 1 );
-  layoutOptions->addWidget( myCBKeepSubObjects, 1, 0, 1, 2 );
-  layoutOptions->addWidget( myCBRemoveEmptyFolder, 2, 0, 1, 2 );
-  layoutOptions->addWidget( myCBSoftRemoval, 3, 0, 1, 2 );
+  layoutOptions->addWidget( groupIntermediates );
+  layoutOptions->addWidget( groupSubObjects );
+  layoutOptions->addWidget( myCBRemoveEmptyFolder );
+  layoutOptions->addWidget( myCBSoftRemoval );
 
+  /**********************         Buttons         **********************/
   QGroupBox* groupButtons = new QGroupBox();
-
   QHBoxLayout* layoutButtons = new QHBoxLayout( groupButtons );
 
   QPushButton* buttonOk = new QPushButton( tr( "GEOM_BUT_OK" ) );
@@ -210,67 +122,185 @@ myDisplayer(NULL)
   topLayout->addWidget( groupOptions, 1, 0, 1, 2 );
   topLayout->addWidget( groupButtons, 2, 0, 1, 2 );
 
-//  connect( myCBUnpublishIntermediate, SIGNAL( toggled( bool ) ), this, SLOT( onUnpublishIntermediate( bool )  ) );
-//  connect( myCBRemoveIntermediate, SIGNAL( toggled ( bool ) ), this, SLOT( onRemoveIntermediate( bool ) ) );
-//  connect( myCBKeepSubObjects, SIGNAL( toggled ( bool ) ), this, SLOT( onKeepSubObjects( bool ) ) );
-//  connect( myCBRemoveEmptyFolder, SIGNAL( toggled ( bool ) ), this, SLOT( onRemoveEmptyFolder( bool ) ) );
-//  connect( myCBSoftRemoval, SIGNAL( toggled ( bool ) ), this, SLOT( onSoftRemoval( bool ) ) );
+  // Signals and slots connections
+
+  connect( myTreeKeptObjects, SIGNAL( itemClicked( QTreeWidgetItem*, int) ), this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
+  connect( myTreeRemoveObjects, SIGNAL( itemClicked( QTreeWidgetItem*, int) ), this, SLOT( onItemClicked( QTreeWidgetItem*, int ) ) );
+  connect( myTreeKeptObjects->header(), SIGNAL( sectionClicked ( int ) ), this, SLOT( onHeaderClicked( int ) ) );
+  connect( myTreeRemoveObjects->header(), SIGNAL( sectionClicked ( int ) ), this, SLOT( onHeaderClicked( int ) ) );
+
+  connect( myIntermediates, SIGNAL( buttonClicked( int ) ), this, SLOT( update() ) );
+  connect( mySubObjects, SIGNAL( buttonClicked( int ) ), this, SLOT( update() ) );
 
   connect( buttonOk, SIGNAL( clicked() ), this, SLOT( clickOnOk() ) );
   connect( buttonCancel, SIGNAL( clicked() ), this, SLOT( clickOnCancel() ) );
   connect( buttonHelp, SIGNAL( clicked() ), this, SLOT( clickOnHelp() ) );
 
-  connect( myTreeKeptObjects, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(onItemClicked(QTreeWidgetItem*, int)) );
-  connect( myTreeRemoveObjects, SIGNAL(itemClicked(QTreeWidgetItem*, int)), this, SLOT(onItemClicked(QTreeWidgetItem*, int)) );
+  connect( ( (SalomeApp_Application*)( SUIT_Session::session()->activeApplication() ) )->selectionMgr(),
+           SIGNAL( currentSelectionChanged() ), this, SLOT( selectionChanged() ) );
 
-  connect( myTreeKeptObjects->header(), SIGNAL( sectionClicked ( int ) ), this, SLOT( onHeaderClicked( int ) ) );
-  connect( myTreeRemoveObjects->header(), SIGNAL( sectionClicked ( int ) ), this, SLOT( onHeaderClicked( int ) ) );
+  init( theObjectEntries );
+}
+
+GEOMToolsGUI_ReduceStudyDlg::~GEOMToolsGUI_ReduceStudyDlg()
+{
+  // no need to delete child widgets, Qt does it all for us
+}
+
+void GEOMToolsGUI_ReduceStudyDlg::init( const GEOM::string_array& theObjectEntries )
+{
+  for( int i = 0; i < theObjectEntries.length(); i++ )
+    myMainEntries.insert( theObjectEntries[i].in() );
+
+
+  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  if ( !app ) return;
+
+  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+  SALOMEDS::Study_var myStudy = GeometryGUI::ClientStudyToStudy( study->studyDS());
 
-  connect( myCBKeepSubObjects, SIGNAL( toggled(bool)), this, SLOT( update() ) );
-  connect( myCBRemoveIntermediate, SIGNAL( toggled(bool)), this, SLOT( update() ) );
-  connect( myCBUnpublishIntermediate, SIGNAL( toggled(bool) ), this, SLOT( update() ) );
+
+  myKeptObjects.clear();
+  myParents.clear();
+  myListSubObjects.clear();
+  myOthers.clear();
+
+  GEOM::string_array_var selectedObjects = new GEOM::string_array();
+  selectedObjects->length( theObjectEntries.length() );
+  for( int i = 0; i < theObjectEntries.length(); i++ )
+    selectedObjects[ i ] = theObjectEntries[i].in();
+
+  GEOM::string_array_var parentsObjects = new GEOM::string_array();
+//  parentsObjects->length( 5 );
+//  parentsObjects[0] = "0:1:21";
+//  parentsObjects[1] = "0:1:17";
+//  parentsObjects[2] = "0:1:20";
+//  parentsObjects[3] = "0:1:13";
+//  parentsObjects[4] = "0:1:12";
+
+  GEOM::string_array_var subObjects = new GEOM::string_array();
+//  subObjects->length( 4 );
+//  subObjects[0] = "0:1:24";
+//  subObjects[1] = "0:1:28";
+//  subObjects[2] = "0:1:29";
+//  subObjects[3] = "0:1:34";
+
+  GEOM::string_array_var oters = new GEOM::string_array();
+//  oters->length( 5 );
+//  oters[0] = "0:1:35";
+//  oters[1] = "0:1:36";
+//  oters[2] = "0:1:37";
+//  oters[3] = "0:1:38";
+//  oters[4] = "0:1:39";
+
+////// PUT ALGORITHM HERE
+  GeometryGUI::GetGeomGen()->GetEntriesToCleanStudy( myStudy, selectedObjects,
+    parentsObjects, subObjects, oters );
+
+  for ( int i = 0; i < selectedObjects->length(); i++ )
+    myKeptObjects.insert( selectedObjects[i].in() );
+
+  for( int i = 0; i< parentsObjects->length(); i++ )
+    myParents.insert( parentsObjects[i].in() );
+
+  for( int i = 0; i< subObjects->length(); i++ )
+    myListSubObjects.insert( subObjects[i].in() );
+
+  for( int i = 0; i< oters->length(); i++ )
+         myOthers.insert( oters[i].in() );
+
+//  myParents.insert( "0:1:21" );
+//  myParents.insert( "0:1:17" );
+//  myParents.insert( "0:1:20" );
+//  myParents.insert( "0:1:13" );
+//  myParents.insert( "0:1:12" );
+//
+//  myListSubObjects.insert( "0:1:24" );
+//  myListSubObjects.insert( "0:1:28" );
+//  myListSubObjects.insert( "0:1:29" );
+//  myListSubObjects.insert( "0:1:34" );
+//
+//  myOthers.insert( "0:1:35" );
+//  myOthers.insert( "0:1:36" );
+//  myOthers.insert( "0:1:37" );
+//  myOthers.insert( "0:1:38" );
+//  myOthers.insert( "0:1:39" );
 
   update();
 
   checkVisibleIcon( myTreeKeptObjects );
   checkVisibleIcon( myTreeRemoveObjects );
+}
 
-
+void GEOMToolsGUI_ReduceStudyDlg::createTreeWidget( QTreeWidget* theTreeWidget )
+{
+  theTreeWidget->setColumnCount( 2 );
+  QStringList columnNames;
+  columnNames.append(tr( "GEOM_REDUCE_STUDY_NAME" ));
+  columnNames.append("");
+  theTreeWidget->setHeaderLabels( columnNames );
+  QTreeWidgetItem * headerItem = new QTreeWidgetItem( columnNames );
+  theTreeWidget->setHeaderItem ( headerItem );
+  theTreeWidget->header()->moveSection( 1, 0 );
+  theTreeWidget->header()->setClickable( true );
+  theTreeWidget->header()->setMovable( false );
+  theTreeWidget->header()->setResizeMode( 1, QHeaderView::ResizeToContents );
+  theTreeWidget->setSelectionMode( QAbstractItemView::ExtendedSelection );
 }
 
-GEOMToolsGUI_ReduceStudyDlg::~GEOMToolsGUI_ReduceStudyDlg()
+QGroupBox* GEOMToolsGUI_ReduceStudyDlg::createButtonGroup( QButtonGroup* theButtonGroup )
 {
-  // no need to delete child widgets, Qt does it all for us
+  QGroupBox* groupObjects = new QGroupBox();
+  QHBoxLayout* layoutObjects = new QHBoxLayout( groupObjects );
+
+  QRadioButton* buttonKeep = new QRadioButton( tr( "GEOM_REDUCE_STUDY_KEEP") );
+  theButtonGroup->addButton( buttonKeep, 0 );
+  QRadioButton* buttonUnpublish = new QRadioButton( tr( "GEOM_REDUCE_STUDY_UNPUBLISH") );
+  theButtonGroup->addButton( buttonUnpublish, 1 );
+  QRadioButton* buttonRemove = new QRadioButton( tr( "GEOM_REDUCE_STUDY_REMOVE") );
+  theButtonGroup->addButton( buttonRemove, 2 );
+
+  theButtonGroup->button( 0 )->setChecked( true );
+  theButtonGroup->setExclusive( true );
+
+  layoutObjects->addWidget( buttonKeep );
+  layoutObjects->addWidget( buttonUnpublish );
+  layoutObjects->addWidget( buttonRemove );
+
+  return groupObjects;
 }
 
 void GEOMToolsGUI_ReduceStudyDlg::update()
 {
+
   myTreeKeptObjects->clear();
   myTreeRemoveObjects->clear();
 
-  std::set<std::string> keptObjects(myMainEntries);
+  std::set<std::string> keptObjects(myKeptObjects);
   std::set<std::string> removeObjects(myOthers);
 
-  if( myCBUnpublishIntermediate->isChecked() || myCBRemoveIntermediate->isChecked() ) {
+  // Intermediate objects
+  if( myIntermediates->checkedId() == 2 ) { // remove
     std::set<std::string>::iterator iter;
     for( iter=myParents.begin(); iter!=myParents.end(); ++iter)
       removeObjects.insert( *iter );
   }
-  else {
+  else { // keep or unpublish
     std::set<std::string>::iterator iter;
     for( iter=myParents.begin(); iter!=myParents.end(); ++iter)
       keptObjects.insert( *iter );
   }
 
-  if( myCBKeepSubObjects->isChecked() ) {
+  // Sub-objects
+  if( mySubObjects->checkedId() == 2 ) {
     std::set<std::string>::iterator iter;
-    for( iter=mySubObjects.begin(); iter!=mySubObjects.end(); ++iter)
-      keptObjects.insert( *iter );
+    for( iter=myListSubObjects.begin(); iter!=myListSubObjects.end(); ++iter)
+      removeObjects.insert( *iter );
   }
   else {
     std::set<std::string>::iterator iter;
-    for( iter=mySubObjects.begin(); iter!=mySubObjects.end(); ++iter)
-      removeObjects.insert( *iter );
+    for( iter=myListSubObjects.begin(); iter!=myListSubObjects.end(); ++iter)
+      keptObjects.insert( *iter );
   }
 
   std::cout<<"\n\n\n Objects to be kept: ";
@@ -285,39 +315,161 @@ void GEOMToolsGUI_ReduceStudyDlg::update()
     std::cout << ", " << *it_remove;
   std::cout << std::endl;
 
- sortObjects( myTreeKeptObjects, keptObjects );
- sortObjects( myTreeRemoveObjects, removeObjects );
 sortObjects( myTreeKeptObjects, keptObjects );
 sortObjects( myTreeRemoveObjects, removeObjects );
 
-  myTreeKeptObjects->update();
   myTreeKeptObjects->collapseAll();
-  myTreeRemoveObjects->update();
   myTreeRemoveObjects->collapseAll();
 
 }
 
-void GEOMToolsGUI_ReduceStudyDlg::onUnpublishIntermediate( bool )
+void GEOMToolsGUI_ReduceStudyDlg::selectionChanged()
 {
+  myMainEntries.clear();
+  GEOM::string_array_var objectsEntry = new GEOM::string_array();
+  SALOME_ListIO mainObjects;
+  int iter = 0;
 
+  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+  if ( !app ) return;
+  app->selectionMgr()->selectedObjects( mainObjects );
+  // create a list of selected object entry
+  objectsEntry->length( mainObjects.Extent() );
+  for ( SALOME_ListIteratorOfListIO It( mainObjects ); It.More(); It.Next(), iter++ ) {
+         Handle( SALOME_InteractiveObject ) io = It.Value();
+    if( !io->hasEntry() )
+      continue;
+    GEOM::GEOM_Object_var geomObject = GEOM::GEOM_Object::_nil();
+    geomObject = GEOMBase::ConvertIOinGEOMObject( io );
+    QString entry = geomObject->GetEntry();
+    objectsEntry[ iter ] = entry.toLatin1().constData();
+  }
+  init(objectsEntry);
 }
-void GEOMToolsGUI_ReduceStudyDlg::onRemoveIntermediate( bool theIsRemove )
-{
-  myCBUnpublishIntermediate->setEnabled( !theIsRemove );
-}
-void GEOMToolsGUI_ReduceStudyDlg::onKeepSubObjects( bool )
-{
 
-}
-void GEOMToolsGUI_ReduceStudyDlg::onRemoveEmptyFolder( bool )
+void GEOMToolsGUI_ReduceStudyDlg::clickOnOk()
 {
 
-}
-void GEOMToolsGUI_ReduceStudyDlg::onSoftRemoval( bool )
-{
+  std::set<std::string> ObjectsToBeRemove = myOthers;
+  std::set<std::string> ObjectsToBeUnpublish;
+
+  if( myIntermediates->checkedId() == 2 ) {
+    std::set<std::string>::iterator iter;
+    for( iter=myParents.begin(); iter!=myParents.end(); ++iter)
+      ObjectsToBeRemove.insert( *iter );
+  }
+  else if( myIntermediates->checkedId() == 1 ) {
+    std::set<std::string>::iterator iter;
+    for( iter=myParents.begin(); iter!=myParents.end(); ++iter)
+      ObjectsToBeUnpublish.insert( *iter );
+  }
+
+  if( mySubObjects->checkedId() == 2 ) {
+    std::set<std::string>::iterator iter;
+    for( iter=myListSubObjects.begin(); iter!=myListSubObjects.end(); ++iter)
+      ObjectsToBeRemove.insert( *iter );
+  }
+  else if( mySubObjects->checkedId() == 1 ) {
+    std::set<std::string>::iterator iter;
+    for( iter=myListSubObjects.begin(); iter!=myListSubObjects.end(); ++iter)
+      ObjectsToBeUnpublish.insert( *iter );
+  }
+
+  unpublishObjects( ObjectsToBeUnpublish );
+  removeObjects( ObjectsToBeRemove );
+
+
+//  std::cout<< "\n\n REMOVE:" << std::endl;
+//  std::set<std::string>::iterator it;
+//  for( it = ObjectsToBeRemove.begin(); it != ObjectsToBeRemove.end(); ++it )
+//    std::cout <<"  " << (*it) << std::endl;
+//
+//  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
+//  if ( !app ) return;
+//  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
+//  // get currently opened views
+//  QList<SALOME_View*> views;
+//  SALOME_View* view;
+//  ViewManagerList vmans = app->viewManagers();
+//  SUIT_ViewManager* vman;
+//  foreach ( vman, vmans ) {
+//    SUIT_ViewModel* vmod = vman->getViewModel();
+//    view = dynamic_cast<SALOME_View*> ( vmod ); // must work for OCC and VTK views
+//    if ( view )
+//      views.append( view );
+//  }
+//  _PTR(Study) aStudy = study->studyDS();
+
+
+//  _PTR(StudyBuilder) aStudyBuilder (aStudy->NewBuilder());
+//  _PTR(UseCaseBuilder) aUseCaseBuilder = aStudy->GetUseCaseBuilder();
+//
+//  for( it = ObjectsToBeRemove.begin(); it != ObjectsToBeRemove.end(); ++it ) {
+//    std::string objectEntry = *it;
+//    GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( myStudyId, objectEntry.c_str() );
+//    GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject );
+//    _PTR(SObject) obj = aStudy->FindObjectID( objectEntry.c_str() );
+//
+//    //Remove visual properties of the object
+//    study->removeObjectFromAll(objectEntry.c_str());
+//
+//    // remove object from study
+//    aStudyBuilder->RemoveObjectWithChildren( obj );
+////    // remove object from use case tree
+////    aUseCaseBuilder->Remove( obj );
+//
+//    // Erase graphical object
+//    QListIterator<SALOME_View*> it( views );
+//    while ( it.hasNext() )
+//      if ( SALOME_View* view = it.next() )
+//        myDisplayer.Erase( GeomObject, true, true, view);
+//
+//    GeometryGUI::GetGeomGen()->RemoveObject( GeomBaseObject );
+//  }
+//
+//  myDisplayer.UpdateViewer();
+//  GeometryGUI* aGeomGUI = dynamic_cast<GeometryGUI*>( app->module( "Geometry" ) );
+//  aGeomGUI->updateObjBrowser();
+//  app->updateActions(); //SRN: To update a Save button in the toolbar
+
+
+//  _PTR(StudyBuilder) B = aStudy->NewBuilder();
+//  for( it = ObjectsToBeUnpublish.begin(); it != ObjectsToBeUnpublish.end(); ++it ) {
+//    std::string objectEntry = *it;
+//    _PTR(SObject) obj ( aStudy->FindObjectID( objectEntry ) );
+//    _PTR(GenericAttribute) anAttr;
+//    if ( obj ) {
+//      _PTR(AttributeDrawable) aDrw = B->FindOrCreateAttribute( obj, "AttributeDrawable" );
+//      aDrw->SetDrawable( false );
+//      myDisplayer.EraseWithChildren( new SALOME_InteractiveObject( objectEntry.c_str(), "GEOM", "TEMP_IO" ) );
+//    } // if ( obj )
+//  } // iterator
+//
+//  app->updateObjectBrowser( false );
+//  app->updateActions();
+//
+
+//  LightApp_SelectionMgr* aSelMgr = app->selectionMgr();
+//  SALOME_ListIO aSelList;
+//
+//  for( it = ObjectsToBeUnpublish.begin(); it != ObjectsToBeUnpublish.end(); ++it ) {
+//    std::string objectEntry = *it;
+//    GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( myStudyId, objectEntry.c_str() );
+//    GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject );
+//    QString studyEntry = GeomBaseObject->GetStudyEntry();
+//    Handle(SALOME_InteractiveObject) tmpIO =
+//      new SALOME_InteractiveObject( studyEntry.toStdString().c_str(), "GEOM", "TEMP_IO");
+//    aSelList.Append(tmpIO);
+//
+//  }
+//  aSelMgr->clearSelected();
+//  aSelMgr->setSelectedObjects(aSelList);
+//  GEOMToolsGUI::OnUnpublishObject();
+
+  accept();
+
 
-}
 
-void GEOMToolsGUI_ReduceStudyDlg::clickOnOk()
-{
 //  if( myCBRemoveEmptyFolder->isChecked() ) {
 //
 //       SALOME_ListIO selected;
@@ -383,52 +535,26 @@ void GEOMToolsGUI_ReduceStudyDlg::clickOnOk()
 //  }
 //}
 
-void GEOMToolsGUI_ReduceStudyDlg::clickOnCancel()
-{
-  accept();
-}
-void GEOMToolsGUI_ReduceStudyDlg::clickOnHelp()
+
+void GEOMToolsGUI_ReduceStudyDlg::unpublishObjects( std::set<std::string>& theObjects )
 {
 
 }
 
-void GEOMToolsGUI_ReduceStudyDlg::onSelectionChanged()
+void GEOMToolsGUI_ReduceStudyDlg::removeObjects( std::set<std::string>& theObjects )
 {
-  onShowOnlySelected();
+
 }
 
-void GEOMToolsGUI_ReduceStudyDlg::onShowOnlySelected()
+
+void GEOMToolsGUI_ReduceStudyDlg::clickOnCancel()
 {
-//  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-//  if ( !app ) return;
-//
-//  SalomeApp_Study* appStudy = dynamic_cast<SalomeApp_Study*>( app->activeStudy() );
-//  GEOM_Displayer* disp = new GEOM_Displayer( appStudy );
-//
-//  OCCViewer_ViewManager* anOCCVM = (OCCViewer_ViewManager*) app->getViewManager( OCCViewer_Viewer::Type(), /*create=*/ true );
-//
-//  std::cout << "\n\n\n onShowOnlySelected = " << std::endl;
-//  if ( SUIT_ViewModel* viewModel = anOCCVM->getViewModel() )
-//    if ( SALOME_View* viewFrame = dynamic_cast<SALOME_View*>( viewModel ) ) {
-//      disp->EraseAll( true, false, viewFrame );
-//
-//      std::cout << "\n\n\n EraseAll = " << std::endl;
-//
-//      QList<QTreeWidgetItem*> selected = myTreeKeptObjects->selectedItems();
-//      for( int i = 0; i< selected.size(); i++ ) {
-//          const char* entry = myMap[selected[i]].first.c_str();
-//          std::cout << "\n\n\n entry = " << QString( entry ).toStdString() << std::endl;
-//          const char* name = "TEMP_IO";
-//
-//          Handle(SALOME_InteractiveObject) tmpIO =
-//            new SALOME_InteractiveObject( entry, "GEOM", name );
-//
-//          disp->Display( tmpIO, false, viewFrame );
-//      }
-//      viewFrame->Repaint();
-//  }
+  close();
 }
+void GEOMToolsGUI_ReduceStudyDlg::clickOnHelp()
+{
 
+}
 
 //=================================================================================
 // function : onItemClicked()
@@ -459,44 +585,39 @@ void GEOMToolsGUI_ReduceStudyDlg::onHeaderClicked( int theColumn )
 {
   if( theColumn != 1 )
     return;
+
   QTreeWidget* treeData = dynamic_cast<QTreeWidget*>(sender()->parent());
   if( myMapTreeSelectAll[ treeData ] ) {
-         myMapTreeSelectAll[ treeData ] = false;
-         treeData->headerItem()->setIcon( 1, myInvisible );
+    myMapTreeSelectAll[ treeData ] = false;
+    treeData->headerItem()->setIcon( 1, myInvisible );
     QTreeWidgetItemIterator it( treeData );
     while(*it) {
       GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*it);
-      if( item->flags() & Qt::ItemIsSelectable ) {
-      const char* entry = item->getStudyEntry();
-      if( item->isVisible() ) {
+      if( ( item->flags() & Qt::ItemIsSelectable ) && item->isVisible() ) {
+        const char* entry = item->getStudyEntry();
         item->setVisible( false, myInvisible );
         myDisplayer.Erase( new SALOME_InteractiveObject( entry, "GEOM", "TEMP_IO" ) );
       }
-      }
       ++it;
-
     }
   }
   else {
-         myMapTreeSelectAll[ treeData ] = true;
-         treeData->headerItem()->setIcon( 1, myVisible );
-    QTreeWidgetItemIterator it(treeData);
+    myMapTreeSelectAll[ treeData ] = true;
+    treeData->headerItem()->setIcon( 1, myVisible );
+    QTreeWidgetItemIterator it( treeData );
     while(*it) {
-       GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*it);
-       if( item->flags() & Qt::ItemIsSelectable ) {
-      const char* entry = item->getStudyEntry();
-      if( !item->isVisible() ) {
-         item->setVisible( true, myVisible );
+      GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*it);
+      if( ( item->flags() & Qt::ItemIsSelectable ) && !item->isVisible() ) {
+        const char* entry = item->getStudyEntry();
+        item->setVisible( true, myVisible );
         myDisplayer.Display( new SALOME_InteractiveObject( entry, "GEOM", "TEMP_IO" ) );
       }
-       }
       ++it;
     }
   }
   myDisplayer.UpdateViewer();
 }
 
-
 void GEOMToolsGUI_ReduceStudyDlg::checkVisibleIcon( QTreeWidget* theWidget )
 {
   bool isInvisible = false;
@@ -522,17 +643,13 @@ void GEOMToolsGUI_ReduceStudyDlg::checkVisibleIcon( QTreeWidget* theWidget )
 
 void GEOMToolsGUI_ReduceStudyDlg::sortObjects( QTreeWidget* theWidget, std::set<std::string>& theObjects )
 {
-  SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() );
-  if ( !app ) return;
-  SalomeApp_Study* study = dynamic_cast<SalomeApp_Study*>(app->activeStudy());
-  int studyId = GeometryGUI::ClientStudyToStudy( study->studyDS())->StudyId();
-
   std::set<std::string>::iterator it;
   for( it = theObjects.begin(); it != theObjects.end(); ++it ) {
     std::string objectEntry = *it;
-    GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( studyId, objectEntry.c_str() );
+    GEOM::GEOM_BaseObject_var GeomBaseObject = GeometryGUI::GetGeomGen()->GetObject( myStudyId, objectEntry.c_str() );
     GEOM::GEOM_Object_var GeomObject = GEOM::GEOM_Object::_narrow( GeomBaseObject );
-    if( GeomObject->_is_nil() )
+    QString studyEntry = GeomBaseObject->GetStudyEntry();
+    if( GeomObject->_is_nil() || studyEntry.isEmpty() )
       continue;
     addSubObject( theWidget, theObjects, GeomObject );
   }
@@ -540,18 +657,14 @@ void GEOMToolsGUI_ReduceStudyDlg::sortObjects( QTreeWidget* theWidget, std::set<
 
 GEOMToolsGUI_TreeWidgetItem* GEOMToolsGUI_ReduceStudyDlg::addSubObject( QTreeWidget* theWidget, std::set<std::string>& theObjects, GEOM::GEOM_Object_var theObject )
 {
-  std::cout<<"\n\n ----------------- addSubObject ---------------------" << std::endl;
-  std::cout <<"\nObject = " << theObject->GetName() << std::endl;
   GEOMToolsGUI_TreeWidgetItem* item;
   if( !theObject->IsMainShape() ) {
     GEOMToolsGUI_TreeWidgetItem* parentItem = addSubObject( theWidget, theObjects, theObject->GetMainShape() );
-    std::cout <<"\nParentItem = " << parentItem->text(0).toStdString() << std::endl;
     item = findObjectInTree( theWidget, theObject );
     if( !item )
       item = new GEOMToolsGUI_TreeWidgetItem( parentItem, QStringList() << theObject->GetName(), theObject->GetStudyEntry(), false );
   }
   else {
-    std::cout <<"\nParentItem = ROOT" << std::endl;
     item = findObjectInTree( theWidget, theObject );
     if( !item )
       item = new GEOMToolsGUI_TreeWidgetItem( theWidget, QStringList() << theObject->GetName(), theObject->GetStudyEntry(), false );
@@ -559,7 +672,6 @@ GEOMToolsGUI_TreeWidgetItem* GEOMToolsGUI_ReduceStudyDlg::addSubObject( QTreeWid
 
   bool isDisplayed = false;
   if( theObjects.find( theObject->GetEntry() ) != theObjects.end() ) {
-    std::cout << "\n FOUND " << std::endl;
     isDisplayed = myDisplayer.IsDisplayed( theObject->GetStudyEntry() );
     if ( isDisplayed ) {
       item->setVisible( true, myVisible );
@@ -575,26 +687,59 @@ GEOMToolsGUI_TreeWidgetItem* GEOMToolsGUI_ReduceStudyDlg::addSubObject( QTreeWid
 
   }
   else {
-    std::cout << "\n NOT FOUND " << std::endl;
     item->setFlags( item->flags() & ~Qt::ItemIsSelectable );
     item->setTextColor( 0, QColor( 150, 150, 150 ) );
   }
 
-  std::cout<<"\n\n ----------------- FINISH addSubObject ---------------------" << std::endl;
   return item;
 }
 
 GEOMToolsGUI_TreeWidgetItem* GEOMToolsGUI_ReduceStudyDlg::findObjectInTree( QTreeWidget* theWidget, GEOM::GEOM_Object_var theObject )
 {
   QTreeWidgetItemIterator it( theWidget );
-  std::cout <<"\n\n\n theObject->GetStudyEntry() = " << theObject->GetStudyEntry() << std::endl;
   while(*it) {
     GEOMToolsGUI_TreeWidgetItem* item = dynamic_cast<GEOMToolsGUI_TreeWidgetItem*>(*it);
-    std::cout <<"\n\n\n item->getStudyEntry() = " << item->getStudyEntry() << std::endl;
     if( QString( item->getStudyEntry() ) == QString( theObject->GetStudyEntry() ) )
       return item;
     ++it;
   }
-  std::cout <<"\n\n\n RETURN NULL " << std::endl;
   return NULL;
 }
+
+GEOMToolsGUI_TreeWidgetItem::GEOMToolsGUI_TreeWidgetItem( QTreeWidget* view, const QStringList &strings,
+                                                          char* studyEntry, bool visible, int type )
+:QTreeWidgetItem( view, strings, type ),
+ myStudyEntry( studyEntry ),
+ myVisible( visible )
+{
+
+}
+
+GEOMToolsGUI_TreeWidgetItem::GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem* parent, const QStringList &strings,
+                                                          char* studyEntry, bool visible, int type )
+:QTreeWidgetItem( parent, strings, type ),
+ myStudyEntry( studyEntry ),
+ myVisible( visible )
+{
+
+}
+
+GEOMToolsGUI_TreeWidgetItem::~GEOMToolsGUI_TreeWidgetItem()
+{
+}
+
+bool GEOMToolsGUI_TreeWidgetItem::isVisible()
+{
+  return myVisible;
+}
+
+void GEOMToolsGUI_TreeWidgetItem::setVisible( bool theIsVisible, QIcon& theIcon )
+{
+  myVisible = theIsVisible;
+  setIcon( 1, theIcon );
+}
+
+char* GEOMToolsGUI_TreeWidgetItem::getStudyEntry() const
+{
+  return myStudyEntry;
+}
index e477e4605f8abbe6c4502a65ffb7965f4bfe9fa3..6f0c0c85b0e5e9a942e4f8cd67ebd836e37a9d11 100644 (file)
@@ -24,6 +24,8 @@
 #include <QDialog>
 #include <QTreeWidget>
 #include <QCheckBox>
+#include <QButtonGroup>
+#include <QGroupBox>
 
 #include <GEOMUtils.hxx>
 #include <GeometryGUI.h>
@@ -33,6 +35,7 @@
 
 class GEOMToolsGUI_TreeWidgetItem : public QTreeWidgetItem
 {
+
 public:
   GEOMToolsGUI_TreeWidgetItem( QTreeWidget*, const QStringList&, char*, bool, int = Type );
   GEOMToolsGUI_TreeWidgetItem( QTreeWidgetItem*, const QStringList&, char*, bool, int = Type );
@@ -58,36 +61,36 @@ public:
 
 private slots:
 
-  void onUnpublishIntermediate( bool );
-  void onRemoveIntermediate( bool );
-  void onKeepSubObjects( bool );
-  void onRemoveEmptyFolder( bool );
-  void onSoftRemoval( bool );
-
   void clickOnOk();
   void clickOnCancel();
   void clickOnHelp();
 
-  void onSelectionChanged();
   void onItemClicked(QTreeWidgetItem*, int );
   void onHeaderClicked( int );
 
+  void selectionChanged();
+
   void update();
 
 private:
 
-  void onShowOnlySelected();
+  void init( const GEOM::string_array& theObjectEntries );
+  void createTreeWidget( QTreeWidget* );
+  QGroupBox* createButtonGroup( QButtonGroup* );
   void checkVisibleIcon( QTreeWidget* );
   void sortObjects( QTreeWidget*, std::set<std::string>& );
   GEOMToolsGUI_TreeWidgetItem* addSubObject( QTreeWidget*, std::set<std::string>&, GEOM::GEOM_Object_var );
   GEOMToolsGUI_TreeWidgetItem* findObjectInTree( QTreeWidget*, GEOM::GEOM_Object_var );
 
+  void unpublishObjects( std::set<std::string>& );
+  void removeObjects( std::set<std::string>& );
+
   QTreeWidget* myTreeKeptObjects;
   QTreeWidget* myTreeRemoveObjects;
 
-  QCheckBox* myCBUnpublishIntermediate;
-  QCheckBox* myCBRemoveIntermediate;
-  QCheckBox* myCBKeepSubObjects;
+  QButtonGroup* myIntermediates;
+  QButtonGroup* mySubObjects;
+
   QCheckBox* myCBRemoveEmptyFolder;
   QCheckBox* myCBSoftRemoval;
 
@@ -96,12 +99,12 @@ private:
   QIcon myVisible;
   QIcon myInvisible;
 
-  bool mySelectAll;
-
   GEOM_Displayer myDisplayer;
+  int myStudyId;
 
+  std::set<std::string> myKeptObjects;
   std::set<std::string> myParents;
-  std::set<std::string> mySubObjects;
+  std::set<std::string> myListSubObjects;
   std::set<std::string> myOthers;
 
   std::map<QTreeWidget*,bool> myMapTreeSelectAll;