Back to index

salome-smesh  6.5.0
SMESHGUI_DuplicateNodesDlg.cxx
Go to the documentation of this file.
00001 // Copyright (C) 2007-2012  CEA/DEN, EDF R&D, OPEN CASCADE
00002 //
00003 // Copyright (C) 2003-2007  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
00004 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
00005 //
00006 // This library is free software; you can redistribute it and/or
00007 // modify it under the terms of the GNU Lesser General Public
00008 // License as published by the Free Software Foundation; either
00009 // version 2.1 of the License.
00010 //
00011 // This library is distributed in the hope that it will be useful,
00012 // but WITHOUT ANY WARRANTY; without even the implied warranty of
00013 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
00014 // Lesser General Public License for more details.
00015 //
00016 // You should have received a copy of the GNU Lesser General Public
00017 // License along with this library; if not, write to the Free Software
00018 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA  02111-1307 USA
00019 //
00020 // See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com
00021 //
00022 
00023 // SMESH SMESHGUI : GUI for SMESH component
00024 // File   : SMESHGUI_DuplicateNodesDlg.cxx
00025 // Author : Michael ZORIN, Open CASCADE S.A.S.
00026 
00027 // SMESH includes
00028 #include "SMESHGUI_DuplicateNodesDlg.h"
00029 
00030 #include "SMESHGUI.h"
00031 #include "SMESHGUI_Utils.h"
00032 #include "SMESHGUI_VTKUtils.h"
00033 
00034 #include <SMESH_TypeFilter.hxx>
00035 
00036 // SALOME GUI includes
00037 #include <SUIT_Session.h>
00038 #include <SUIT_ResourceMgr.h>
00039 #include <SUIT_Desktop.h>
00040 #include <SUIT_MessageBox.h>
00041 #include <SUIT_OverrideCursor.h>
00042 
00043 #include <LightApp_Application.h>
00044 #include <LightApp_SelectionMgr.h>
00045 
00046 #include <SalomeApp_Tools.h>
00047 
00048 #include <SVTK_ViewWindow.h>
00049 #include <SALOME_ListIO.hxx>
00050 #include <SALOME_ListIteratorOfListIO.hxx>
00051 
00052 // Qt includes
00053 #include <QApplication>
00054 #include <QButtonGroup>
00055 #include <QGroupBox>
00056 #include <QLabel>
00057 #include <QLineEdit>
00058 #include <QPushButton>
00059 #include <QRadioButton>
00060 #include <QCheckBox>
00061 #include <QHBoxLayout>
00062 #include <QVBoxLayout>
00063 #include <QKeyEvent>
00064 
00065 #include <utilities.h>
00066 
00067 // IDL includes
00068 #include <SALOMEconfig.h>
00069 #include CORBA_SERVER_HEADER(SMESH_MeshEditor)
00070 
00071 #define SPACING 6
00072 #define MARGIN  11
00073 
00080 class BusyLocker
00081 {
00082 public:
00084   BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; }
00086   ~BusyLocker() { myBusy = false; }
00087 private:
00088   bool& myBusy; 
00089 };
00090 
00095 SMESHGUI_DuplicateNodesDlg::SMESHGUI_DuplicateNodesDlg( SMESHGUI* theModule )
00096   : QDialog( SMESH::GetDesktop( theModule ) ),
00097     mySMESHGUI( theModule ),
00098     mySelectionMgr( SMESH::GetSelectionMgr( theModule ) )
00099 {
00100   // Dialog attributes
00101   setModal(false);
00102   setAttribute(Qt::WA_DeleteOnClose, true);
00103   setWindowTitle(tr("SMESH_DUPLICATE_TITLE"));
00104   setSizeGripEnabled(true);
00105 
00106   // Icons for the dialog operation modes and selection button
00107   SUIT_ResourceMgr* aResMgr = SMESH::GetResourceMgr( mySMESHGUI );
00108   QPixmap iconWithoutElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES")));
00109   QPixmap iconWithElem (aResMgr->loadPixmap("SMESH", tr("ICON_SMESH_DUPLICATE_NODES_WITH_ELEM")));
00110   QPixmap iconSelect (aResMgr->loadPixmap("SMESH", tr("ICON_SELECT")));
00111 
00112   // Main layout
00113   QVBoxLayout* aMainLayout = new QVBoxLayout(this);
00114   aMainLayout->setSpacing(SPACING);
00115   aMainLayout->setMargin(MARGIN);
00116 
00117   // Operation modes selector
00118   QGroupBox* aConstructorsBox = new QGroupBox(tr("DUPLICATION_MODE"), this);
00119   myGroupConstructors = new QButtonGroup(this);
00120   QHBoxLayout* aConstructorsBoxLayout = new QHBoxLayout(aConstructorsBox);
00121   aConstructorsBoxLayout->setSpacing(SPACING);
00122   aConstructorsBoxLayout->setMargin(MARGIN);
00123 
00124   QRadioButton* aRadioButton1 = new QRadioButton(aConstructorsBox);
00125   aRadioButton1->setIcon(iconWithoutElem);
00126   QRadioButton* aRadioButton2 = new QRadioButton(aConstructorsBox);
00127   aRadioButton2->setIcon(iconWithElem);
00128   
00129   aConstructorsBoxLayout->addWidget(aRadioButton1);
00130   aConstructorsBoxLayout->addWidget(aRadioButton2);
00131   myGroupConstructors->addButton(aRadioButton1, 0);
00132   myGroupConstructors->addButton(aRadioButton2, 1);
00133 
00134   // Arguments
00135   myGroupArguments = new QGroupBox(this);
00136   QGridLayout* aGroupArgumentsLayout = new QGridLayout(myGroupArguments);
00137   aGroupArgumentsLayout->setSpacing(SPACING);
00138   aGroupArgumentsLayout->setMargin(MARGIN);
00139     
00140   myTextLabel1 = new QLabel(myGroupArguments);
00141   mySelectButton1 = new QPushButton(myGroupArguments);
00142   mySelectButton1->setIcon(iconSelect);
00143   myLineEdit1 = new QLineEdit(myGroupArguments);
00144   myLineEdit1->setReadOnly(true);
00145 
00146   myTextLabel2 = new QLabel(myGroupArguments);
00147   mySelectButton2 = new QPushButton(myGroupArguments);
00148   mySelectButton2->setIcon(iconSelect);
00149   myLineEdit2 = new QLineEdit(myGroupArguments);
00150   myLineEdit2->setReadOnly(true);
00151 
00152   myTextLabel3 = new QLabel(myGroupArguments);
00153   mySelectButton3 = new QPushButton(myGroupArguments);
00154   mySelectButton3->setIcon(iconSelect);
00155   myLineEdit3 = new QLineEdit(myGroupArguments);
00156   myLineEdit3->setReadOnly(true);
00157 
00158   myCheckBoxNewElemGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_ELEMENTS"), myGroupArguments);
00159   myCheckBoxNewNodeGroup = new QCheckBox(tr("CONSTRUCT_NEW_GROUP_NODES"), myGroupArguments);
00160 
00161   aGroupArgumentsLayout->addWidget(myTextLabel1,    0, 0);
00162   aGroupArgumentsLayout->addWidget(mySelectButton1, 0, 1);
00163   aGroupArgumentsLayout->addWidget(myLineEdit1,     0, 2);
00164   aGroupArgumentsLayout->addWidget(myTextLabel2,    1, 0);
00165   aGroupArgumentsLayout->addWidget(mySelectButton2, 1, 1);
00166   aGroupArgumentsLayout->addWidget(myLineEdit2,     1, 2);
00167   aGroupArgumentsLayout->addWidget(myTextLabel3,    2, 0);
00168   aGroupArgumentsLayout->addWidget(mySelectButton3, 2, 1);
00169   aGroupArgumentsLayout->addWidget(myLineEdit3,     2, 2);
00170   aGroupArgumentsLayout->addWidget(myCheckBoxNewElemGroup, 3, 0);
00171   aGroupArgumentsLayout->addWidget(myCheckBoxNewNodeGroup, 4, 0);
00172   aGroupArgumentsLayout->setRowStretch(5, 1);
00173   
00174   // Buttons
00175   QGroupBox* aGroupButtons = new QGroupBox(this);
00176   QHBoxLayout* aGroupButtonsLayout = new QHBoxLayout(aGroupButtons);
00177   aGroupButtonsLayout->setSpacing(SPACING);
00178   aGroupButtonsLayout->setMargin(MARGIN);
00179 
00180   myButtonOk = new QPushButton(tr("SMESH_BUT_APPLY_AND_CLOSE"), aGroupButtons);
00181   myButtonOk->setAutoDefault(true);
00182   myButtonOk->setDefault(true);
00183   myButtonApply = new QPushButton(tr("SMESH_BUT_APPLY"), aGroupButtons);
00184   myButtonApply->setAutoDefault(true);
00185   myButtonClose = new QPushButton(tr("SMESH_BUT_CLOSE"), aGroupButtons);
00186   myButtonClose->setAutoDefault(true);
00187   myButtonHelp = new QPushButton(tr("SMESH_BUT_HELP"), aGroupButtons);
00188   myButtonHelp->setAutoDefault(true);
00189 
00190   aGroupButtonsLayout->addWidget(myButtonOk);
00191   aGroupButtonsLayout->addSpacing(10);
00192   aGroupButtonsLayout->addWidget(myButtonApply);
00193   aGroupButtonsLayout->addSpacing(10);
00194   aGroupButtonsLayout->addStretch();
00195   aGroupButtonsLayout->addWidget(myButtonClose);
00196   aGroupButtonsLayout->addWidget(myButtonHelp);
00197 
00198   // Add mode selector, arguments and buttons to the main layout
00199   aMainLayout->addWidget(aConstructorsBox);
00200   aMainLayout->addWidget(myGroupArguments);
00201   aMainLayout->addWidget(aGroupButtons);
00202   
00203   // Initialize the dialog
00204   Init();
00205 
00206   // Help file name
00207   myHelpFileName = "double_nodes_page.html";
00208 
00209   // Signals and slots connections
00210   connect(myGroupConstructors, SIGNAL(buttonClicked(int)), SLOT(onConstructorsClicked(int)));
00211      
00212   connect(mySelectButton1, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
00213   connect(mySelectButton2, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
00214   connect(mySelectButton3, SIGNAL (clicked()), this, SLOT(onEditCurrentArgument()));
00215 
00216   connect(myButtonOk,     SIGNAL(clicked()), this, SLOT(onOk()));
00217   connect(myButtonClose,  SIGNAL(clicked()), this, SLOT(onClose()));
00218   connect(myButtonApply,  SIGNAL(clicked()), this, SLOT(onApply()));
00219   connect(myButtonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
00220   
00221   connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionChanged()));
00222 
00223   connect(mySMESHGUI, SIGNAL (SignalDeactivateActiveDialog()), this, SLOT(onDeactivate()));
00224   connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(onClose()));
00225 }
00226 
00230 SMESHGUI_DuplicateNodesDlg::~SMESHGUI_DuplicateNodesDlg()
00231 {
00232 }
00233 
00237 void SMESHGUI_DuplicateNodesDlg::Init()
00238 {
00239   mySMESHGUI->SetActiveDialogBox((QDialog*)this);
00240   myCheckBoxNewElemGroup->setChecked(true);
00241   myCheckBoxNewNodeGroup->setChecked(true);
00242 
00243   // Set initial parameters
00244   myBusy = false;
00245   myCurrentLineEdit = myLineEdit1;
00246 
00247   myGroups1.clear();
00248   myGroups2.clear();
00249   myGroups3.clear();
00250   
00251   // Set selection mode
00252   mySelectionMgr->installFilter(new SMESH_TypeFilter(GROUP));
00253   if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00254     aViewWindow->SetSelectionMode(ActorSelection);
00255   
00256   // Set construction mode
00257   int operationMode = myGroupConstructors->checkedId();
00258   if (operationMode < 0) {
00259     // The dialog has been just displayed
00260     operationMode = 0;
00261     myGroupConstructors->button(0)->setChecked(true);
00262   }
00263   onConstructorsClicked(operationMode);
00264 }
00265 
00270 void SMESHGUI_DuplicateNodesDlg::onConstructorsClicked (int constructorId)
00271 {
00272   // Clear all fields
00273   myLineEdit1->clear();
00274   myLineEdit2->clear();
00275   myLineEdit3->clear();
00276 
00277   myGroups1.clear();
00278   myGroups2.clear();
00279   myGroups3.clear();
00280 
00281   // Set the first field as current
00282   myCurrentLineEdit = myLineEdit1;
00283   myCurrentLineEdit->setFocus();
00284 
00285   switch (constructorId) {
00286   case 0:
00287     {
00288       // Set text to the group of arguments and to the first two labels
00289       myGroupArguments->setTitle(tr("DUPLICATION_WITHOUT_ELEMS"));
00290       myTextLabel1->setText(tr("GROUP_NODES_TO_DUPLICATE"));
00291       myTextLabel2->setText(tr("GROUP_NODES_TO_REPLACE"));
00292 
00293       myCheckBoxNewElemGroup->hide();
00294       myCheckBoxNewNodeGroup->show();
00295       
00296       // Hide the third field
00297       myTextLabel3->hide();
00298       mySelectButton3->hide();
00299       myLineEdit3->hide();
00300       
00301       break;
00302     }
00303   case 1:
00304     {
00305       // Set text to the group of arguments and to all the labels
00306       myGroupArguments->setTitle(tr("DUPLICATION_WITH_ELEMS"));
00307       myTextLabel1->setText(tr("GROUP_ELEMS_TO_DUPLICATE"));
00308       myTextLabel2->setText(tr("GROUP_NODES_NOT_DUPLICATE"));
00309       myTextLabel3->setText(tr("GROUP_ELEMS_TO_REPLACE"));
00310       
00311       myCheckBoxNewElemGroup->show();
00312       myCheckBoxNewNodeGroup->show();
00313 
00314       // Show the third field
00315       myTextLabel3->show();
00316       mySelectButton3->show();
00317       myLineEdit3->show();
00318 
00319       break;
00320     }
00321   }
00322   
00323   // Process selection
00324   onSelectionChanged();
00325 }
00326 
00330 bool SMESHGUI_DuplicateNodesDlg::onApply()
00331 {
00332   if ( mySMESHGUI->isActiveStudyLocked() || !isValid() )
00333     return false;
00334 
00335   BusyLocker lock( myBusy );
00336  
00337   bool toCreateElemGroup = myCheckBoxNewElemGroup->isChecked();
00338   bool toCreateNodeGroup = myCheckBoxNewNodeGroup->isChecked();
00339   int operationMode = myGroupConstructors->checkedId();
00340   
00341   // Apply changes
00342   bool result = false;
00343   SUIT_OverrideCursor aWaitCursor;
00344 
00345   try {
00346     SMESH::SMESH_Mesh_var aMesh = myGroups1[0]->GetMesh();
00347     SMESH::SMESH_MeshEditor_var aMeshEditor = aMesh->GetMeshEditor();
00348 
00349     if ( operationMode == 0 ) {
00350       SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
00351       g1->length( myGroups1.count() );
00352       for ( int i = 0; i < myGroups1.count(); i++ )
00353         g1[i] = myGroups1[i];
00354       SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
00355       g2->length( myGroups2.count() );
00356       for ( int i = 0; i < myGroups2.count(); i++ )
00357         g2[i] = myGroups2[i];
00358 
00359       if ( toCreateNodeGroup ) {
00360         SMESH::SMESH_GroupBase_var aNewGroup = 
00361           aMeshEditor->DoubleNodeGroupsNew( g1.in(), g2.in() );
00362         result = !CORBA::is_nil( aNewGroup );
00363       }
00364       else {
00365         result = aMeshEditor->DoubleNodeGroups( g1.in(), g2.in() );
00366       }
00367     }
00368     else {
00369       SMESH::ListOfGroups_var g1 = new SMESH::ListOfGroups();
00370       g1->length( myGroups1.count() );
00371       for ( int i = 0; i < myGroups1.count(); i++ )
00372         g1[i] = myGroups1[i];
00373       SMESH::ListOfGroups_var g2 = new SMESH::ListOfGroups();
00374       g2->length( myGroups2.count() );
00375       for ( int i = 0; i < myGroups2.count(); i++ )
00376         g2[i] = myGroups2[i];
00377       SMESH::ListOfGroups_var g3 = new SMESH::ListOfGroups();
00378       g3->length( myGroups3.count() );
00379 
00380       for ( int i = 0; i < myGroups3.count(); i++ )
00381         g3[i] = myGroups3[i];
00382       if ( toCreateElemGroup || toCreateNodeGroup ) {
00383         SMESH::ListOfGroups_var aNewGroups = 
00384           aMeshEditor->DoubleNodeElemGroups2New( g1.in(), g2.in(), g3.in(),
00385                                                  toCreateElemGroup, toCreateNodeGroup );
00386         result = ( aNewGroups[ !toCreateElemGroup ].in() );
00387       }
00388       else {
00389         result = aMeshEditor->DoubleNodeElemGroups( g1.in(), g2.in(), g3.in() );
00390       }
00391     }
00392   }
00393   catch (const SALOME::SALOME_Exception& S_ex) {
00394     SalomeApp_Tools::QtCatchCorbaException(S_ex);
00395   }
00396   catch ( const std::exception& exc ) {
00397     INFOS( "Follow exception was cought:\n\t" << exc.what() );
00398   } 
00399   catch (...){
00400     INFOS( "Unknown exception was cought !!!" );
00401   }
00402 
00403   if (!result) {
00404     SUIT_MessageBox::warning(this,
00405                              tr("SMESH_WRN_WARNING"),
00406                              tr("SMESH_OPERATION_FAILED"));
00407     return false;
00408   }
00409 
00410   // Update GUI
00411   mySelectionMgr->clearSelected();
00412   SMESH::UpdateView();
00413   SMESHGUI::Modified();
00414   mySMESHGUI->updateObjBrowser(true);
00415 
00416   // Reinitialize the dialog
00417   Init();
00418   
00419   return true;
00420 }
00421 
00425 void SMESHGUI_DuplicateNodesDlg::onOk()
00426 {
00427   if (onApply())
00428     onClose();
00429 }
00430 
00434 void SMESHGUI_DuplicateNodesDlg::onClose()
00435 {
00436   disconnect(mySelectionMgr, 0, this, 0);
00437   disconnect(mySMESHGUI, 0, this, 0);
00438   mySMESHGUI->ResetState();
00439   mySelectionMgr->clearFilters();
00440   reject();
00441 }
00442 
00446 void SMESHGUI_DuplicateNodesDlg::onSelectionChanged()
00447 {
00448   if ( myBusy || !isEnabled() ) return;
00449   
00450   int operationMode = myGroupConstructors->checkedId();
00451 
00452   SALOME_ListIO aList;
00453   mySelectionMgr->selectedObjects( aList );
00454   //int aNbSel = aList.Extent();
00455 
00456   QList<SMESH::SMESH_GroupBase_var> aGroups;
00457 
00458   SALOME_ListIteratorOfListIO anIter ( aList );
00459   bool ok = true;
00460   for ( ; anIter.More() && ok; anIter.Next()) {
00461     SMESH::SMESH_GroupBase_var aGroup = SMESH::IObjectToInterface<SMESH::SMESH_GroupBase>( anIter.Value() );
00462     // check group is selected
00463     ok = !CORBA::is_nil( aGroup );
00464     // check groups of the same mesh are selected
00465     if ( ok ) {
00466       SMESH::SMESH_Mesh_var aMesh1;
00467       if ( !aGroups.isEmpty() ) aMesh1 = aGroups[0]->GetMesh();
00468       SMESH::SMESH_Mesh_var aMesh2 = aGroup->GetMesh();
00469       ok = CORBA::is_nil( aMesh1 ) || aMesh1->_is_equivalent( aMesh2 );
00470     }
00471     // check group of proper type is selected
00472     if ( ok ) {
00473       SMESH::ElementType aGroupType = aGroup->GetType();
00474       if ( operationMode == 0 ) {
00475         ok = ( myCurrentLineEdit == myLineEdit1 && aGroupType == SMESH::NODE ) ||
00476              ( myCurrentLineEdit == myLineEdit2 && aGroupType != SMESH::NODE );
00477       }
00478       else {
00479         ok = ( myCurrentLineEdit == myLineEdit1 && ( aGroupType == SMESH::EDGE ||
00480                                                      aGroupType == SMESH::FACE ) ) ||
00481              ( myCurrentLineEdit == myLineEdit2 && aGroupType == SMESH::NODE )     ||
00482              ( myCurrentLineEdit == myLineEdit3 && aGroupType != SMESH::NODE );
00483       }
00484     }
00485     if ( ok ) aGroups << aGroup;
00486   }
00487 
00488   // Clear current field
00489   myCurrentLineEdit->clear();
00490 
00491   if ( ok && !aGroups.isEmpty() ) {
00492     if      ( myCurrentLineEdit == myLineEdit1 ) myGroups1 = aGroups;
00493     else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2 = aGroups;
00494     else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3 = aGroups;
00495     CORBA::String_var name = aGroups[0]->GetName();
00496     myCurrentLineEdit->setText( aGroups.count() == 1 ? QString(name).trimmed() : 
00497                                 QObject::tr( "SMESH_OBJECTS_SELECTED" ).arg( aGroups.count() ) );
00498   }
00499   else {
00500     if      ( myCurrentLineEdit == myLineEdit1 ) myGroups1.clear();
00501     else if ( myCurrentLineEdit == myLineEdit2 ) myGroups2.clear();
00502     else if ( myCurrentLineEdit == myLineEdit3 ) myGroups3.clear();
00503     myCurrentLineEdit->clear();
00504   }
00505 
00506   // Enable/disable "Apply and Close" and "Apply" buttons
00507   bool isDataValid = isValid();
00508   myButtonOk->setEnabled( isDataValid );
00509   myButtonApply->setEnabled( isDataValid );
00510 }
00511 
00515 void SMESHGUI_DuplicateNodesDlg::onEditCurrentArgument()
00516 {
00517   QPushButton* send = (QPushButton*)sender();
00518   
00519   // Set current field for edition
00520   if (send == mySelectButton1) {
00521     myCurrentLineEdit = myLineEdit1;
00522   } 
00523   else if (send == mySelectButton2) {
00524     myCurrentLineEdit = myLineEdit2;
00525   }
00526   else if (send == mySelectButton3) {
00527     myCurrentLineEdit = myLineEdit3;
00528   }
00529   
00530   myCurrentLineEdit->setFocus();
00531   onSelectionChanged();
00532 }
00533 
00538 bool SMESHGUI_DuplicateNodesDlg::isValid()
00539 {
00540   return myGroupConstructors->checkedId() == 1 ?
00541     ( !myGroups1.isEmpty() && !myGroups3.isEmpty()  ) :
00542     ( !myGroups1.isEmpty() );
00543 }
00544 
00545 
00549 void SMESHGUI_DuplicateNodesDlg::onDeactivate()
00550 {
00551   if (isEnabled()) {
00552     mySelectionMgr->clearFilters();
00553     setEnabled(false);
00554     mySMESHGUI->ResetState();
00555     mySMESHGUI->SetActiveDialogBox(0);
00556   }
00557 }
00558 
00564 void SMESHGUI_DuplicateNodesDlg::enterEvent (QEvent*)
00565 {
00566   if ( !isEnabled() ) {
00567     mySMESHGUI->EmitSignalDeactivateDialog();
00568     setEnabled(true);
00569     mySMESHGUI->SetActiveDialogBox((QDialog*)this);
00570     
00571     // Set selection mode
00572     if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ))
00573       aViewWindow->SetSelectionMode(ActorSelection);
00574     mySelectionMgr->installFilter(new SMESH_TypeFilter (GROUP));
00575   }
00576 }
00577 
00582 void SMESHGUI_DuplicateNodesDlg::closeEvent (QCloseEvent*)
00583 {
00584   onClose();
00585 }
00586 
00591 void SMESHGUI_DuplicateNodesDlg::keyPressEvent( QKeyEvent* e )
00592 {
00593   QDialog::keyPressEvent( e );
00594   if ( e->isAccepted() )
00595     return;
00596 
00597   if ( e->key() == Qt::Key_F1 ) {
00598     e->accept();
00599     onHelp();
00600   }
00601 }
00602 
00606 void SMESHGUI_DuplicateNodesDlg::onHelp()
00607 {
00608   LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
00609   if (app) 
00610     app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->moduleName()) : QString(""), myHelpFileName);
00611   else {
00612     QString platform;
00613 #ifdef WIN32
00614     platform = "winapplication";
00615 #else
00616     platform = "application";
00617 #endif
00618     SUIT_MessageBox::warning(this, tr("WRN_WARNING"),
00619                              tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
00620                              arg(app->resourceMgr()->stringValue("ExternalBrowser", 
00621                                                                  platform)).
00622                              arg(myHelpFileName));
00623   }
00624 }