X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_CreatePatternDlg.cxx;h=da805271a1f7992131c8cdef5908baf98f245ae4;hp=ef7f198ee9966f23ef4d9b82eb4e8875173d3c39;hb=15a2d78f1099665ce262adf619804723220e8139;hpb=0635c9fc80f67d1e5dc0e94ec85f487286a92070 diff --git a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx index ef7f198ee..da805271a 100755 --- a/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_CreatePatternDlg.cxx @@ -1,24 +1,25 @@ -// Copyright (C) 2007-2008 CEA/DEN, EDF R&D, OPEN CASCADE +// Copyright (C) 2007-2015 CEA/DEN, EDF R&D, OPEN CASCADE // -// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS +// Copyright (C) 2003-2007 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, +// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS // -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. +// This library is free software; you can redistribute it and/or +// modify it under the terms of the GNU Lesser General Public +// License as published by the Free Software Foundation; either +// version 2.1 of the License, or (at your option) any later version. // -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. +// This library is distributed in the hope that it will be useful, +// but WITHOUT ANY WARRANTY; without even the implied warranty of +// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU +// Lesser General Public License for more details. // -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA +// You should have received a copy of the GNU Lesser General Public +// License along with this library; if not, write to the Free Software +// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // + // File : SMESHGUI_CreatePatternDlg.cxx // Author : Sergey LITONIN, Open CASCADE S.A.S. // SMESH includes @@ -104,9 +105,6 @@ SMESHGUI_CreatePatternDlg::SMESHGUI_CreatePatternDlg( SMESHGUI* theModule, aDlgLay->setStretchFactor( aMainFrame, 1 ); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - mySelector = aViewWindow->GetSelector(); - myHelpFileName = "pattern_mapping_page.html"; Init( theType ); @@ -193,11 +191,11 @@ QWidget* SMESHGUI_CreatePatternDlg::createMainFrame( QWidget* theParent ) // Connect signals and slots connect( myTypeGrp, SIGNAL( buttonClicked( int ) ), - this, SLOT( onTypeChanged( int ) ) ); + this, SLOT( onTypeChanged( int ) ) ); connect( myProjectChk, SIGNAL( toggled( bool ) ), - this, SLOT( onProject( bool ) ) ); + this, SLOT( onProject( bool ) ) ); connect( aSelBtn, SIGNAL( clicked() ), - this, SLOT( onSelBtnClicked() ) ); + this, SLOT( onSelBtnClicked() ) ); return aMainGrp; } @@ -229,7 +227,7 @@ QWidget* SMESHGUI_CreatePatternDlg::createButtonFrame( QWidget* theParent ) aLay->addWidget( myHelpBtn ); connect( myOkBtn, SIGNAL( clicked() ), this, SLOT( onOk() ) ); - connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( onClose() ) ); + connect( myCloseBtn, SIGNAL( clicked() ), this, SLOT( reject() ) ); connect( mySaveBtn, SIGNAL( clicked() ), this, SLOT( onSave() ) ); connect( myHelpBtn, SIGNAL( clicked() ), this, SLOT( onHelp() ) ); @@ -274,11 +272,11 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) // selection and SMESHGUI connect( mySelectionMgr, SIGNAL( currentSelectionChanged() ), - this, SLOT( onSelectionDone() ) ); + this, SLOT( onSelectionDone() ) ); connect( mySMESHGUI, SIGNAL( SignalDeactivateActiveDialog() ), - this, SLOT( onDeactivate() ) ); + this, SLOT( onDeactivate() ) ); connect( mySMESHGUI, SIGNAL( SignalCloseAllDialogs() ), - this, SLOT( onClose() ) ); + this, SLOT( reject() ) ); mySwitch2d->setEnabled( theType == Type_2d ); mySwitch3d->setEnabled( theType == Type_3d ); @@ -291,7 +289,7 @@ void SMESHGUI_CreatePatternDlg::Init( const int theType ) QApplication::instance()->processEvents(); updateGeometry(); - resize( minimumSize() ); + resize(100,100); activateSelection(); onSelectionDone(); @@ -342,8 +340,8 @@ bool SMESHGUI_CreatePatternDlg::isValid() { if ( myGeomObj->_is_nil() ) { SUIT_MessageBox::information( this, - tr( "SMESH_INSUFFICIENT_DATA" ), - tr( "SMESHGUI_INVALID_PARAMETERS" ) ); + tr( "SMESH_INSUFFICIENT_DATA" ), + tr( "SMESHGUI_INVALID_PARAMETERS" ) ); return false; } return true; @@ -380,7 +378,7 @@ void SMESHGUI_CreatePatternDlg::onSave() SUIT_FileDlg* aDlg = new SUIT_FileDlg( this, false ); aDlg->setWindowTitle( tr( "SAVE_PATTERN" ) ); aDlg->setFileMode( QFileDialog::AnyFile ); - aDlg->setFilter( tr( "PATTERN_FILT" ) ); + aDlg->setNameFilter( tr( "PATTERN_FILT" ) ); if ( myName->text() != "" ) aDlg->selectFile( myName->text() ); @@ -394,7 +392,7 @@ void SMESHGUI_CreatePatternDlg::onSave() if ( QFileInfo( fName ).suffix().isEmpty() ) fName = autoExtension( fName ); - fName = QDir::convertSeparators( fName ); + fName = QDir::toNativeSeparators( fName ); QString aData( myPattern->GetString() ); long aLen = aData.length(); @@ -406,13 +404,13 @@ void SMESHGUI_CreatePatternDlg::onSave() if ( aWritten != aLen ) { SUIT_MessageBox::information( this, - tr( "SMESH_ERROR" ), - tr( "ERROR_OF_SAVING" ) ); + tr( "SMESH_ERROR" ), + tr( "ERROR_OF_SAVING" ) ); } else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - aViewWindow->SetSelectionMode( ActorSelection ); + aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); @@ -465,7 +463,7 @@ void SMESHGUI_CreatePatternDlg::onOk() else { //SUIT_Application::getDesktop()->setSelectionModes(ActorSelection); if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) - aViewWindow->SetSelectionMode( ActorSelection ); + aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); @@ -481,17 +479,17 @@ void SMESHGUI_CreatePatternDlg::onOk() } //======================================================================= -// function : onClose() +// function : reject() // purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_CreatePatternDlg::onClose() +void SMESHGUI_CreatePatternDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ) ) aViewWindow->SetSelectionMode( ActorSelection ); disconnect( mySelectionMgr, 0, this, 0 ); disconnect( mySMESHGUI, 0, this, 0 ); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); emit Close(); } @@ -512,11 +510,11 @@ void SMESHGUI_CreatePatternDlg::onHelp() platform = "application"; #endif SUIT_MessageBox::warning( this, - tr( "WRN_WARNING" ), - tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). - arg( app->resourceMgr()->stringValue( "ExternalBrowser", - platform ) ). - arg( myHelpFileName ) ); + tr( "WRN_WARNING" ), + tr( "EXTERNAL_BROWSER_CANNOT_SHOW_PAGE" ). + arg( app->resourceMgr()->stringValue( "ExternalBrowser", + platform ) ). + arg( myHelpFileName ) ); } } @@ -532,7 +530,7 @@ bool SMESHGUI_CreatePatternDlg::loadFromObject( const bool theMess ) if ( myPattern->_is_nil() ) myPattern = SMESH::GetPattern(); - if ( myMesh->_is_nil() && mySubMesh->_is_nil() || myGeomObj->_is_nil() ) + if ( (myMesh->_is_nil() && mySubMesh->_is_nil()) || myGeomObj->_is_nil() ) return false; SMESH::SMESH_Mesh_ptr aMesh = mySubMesh->_is_nil() ? myMesh.in() : mySubMesh->GetFather(); @@ -571,7 +569,7 @@ void SMESHGUI_CreatePatternDlg::onSelectionDone() { try { SALOME_ListIO aList; - mySelectionMgr->selectedObjects( aList, SVTK_Viewer::Type() ); + mySelectionMgr->selectedObjects( aList ); if ( aList.Extent() != 1 ) return; @@ -647,15 +645,6 @@ void SMESHGUI_CreatePatternDlg::enterEvent( QEvent* ) } } -//================================================================================= -// function : closeEvent() -// purpose : Close dialog box -//================================================================================= -void SMESHGUI_CreatePatternDlg::closeEvent( QCloseEvent* ) -{ - onClose(); -} - //======================================================================= // function : onSelBtnClicked() // purpose : SLOT. Called when -> button clicked. @@ -754,20 +743,20 @@ void SMESHGUI_CreatePatternDlg::activateSelection() if ( myType == Type_2d ) { mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", - TopAbs_SHAPE, - -1, - TopAbs_FACE ) ); + TopAbs_SHAPE, + -1, + TopAbs_FACE ) ); } else { TColStd_MapOfInteger aTypes; aTypes.Add( TopAbs_SHELL ); aTypes.Add( TopAbs_SOLID ); mySelectionMgr->installFilter( new SMESH_NumberFilter( "SMESH", - TopAbs_FACE, - 6, - aTypes, - GEOM::GEOM_Object::_nil(), - true ) ); + TopAbs_FACE, + 6, + aTypes, + GEOM::GEOM_Object::_nil(), + true ) ); } }