X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_SingleEditDlg.cxx;h=2ed7c02719bf82987fb8ede32372bde5956f88ff;hb=7c362c70413927acf6fbd9e7d64edb9ff475ef3f;hp=f93ce95565ca740eaef14420091c6bd91cf8bf83;hpb=bd4e115a78b52e3fbc016e5e30bb0e19b2a9e7d6;p=modules%2Fsmesh.git diff --git a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx index f93ce9556..2ed7c0271 100755 --- a/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SingleEditDlg.cxx @@ -1,4 +1,4 @@ -// Copyright (C) 2007-2012 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 @@ -6,7 +6,7 @@ // 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. +// 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 @@ -215,14 +215,16 @@ void SMESHGUI_SingleEditDlg::Init() // main buttons connect(myOkBtn, SIGNAL(clicked()), SLOT(onOk())); - connect(myCloseBtn, SIGNAL(clicked()), SLOT(onClose())); + connect(myCloseBtn, SIGNAL(clicked()), SLOT(reject())); connect(myApplyBtn, SIGNAL(clicked()), SLOT(onApply())); connect(myHelpBtn, SIGNAL(clicked()), SLOT(onHelp())); // selection and SMESHGUI connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), SLOT(onSelectionDone())); connect(mySMESHGUI, SIGNAL(SignalDeactivateActiveDialog()), SLOT(onDeactivate())); - connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(onClose())); + connect(mySMESHGUI, SIGNAL(SignalCloseAllDialogs()), SLOT(reject())); + connect(mySMESHGUI, SIGNAL(SignalActivatedViewManager()), SLOT(onOpenView())); + connect(mySMESHGUI, SIGNAL(SignalCloseView()), SLOT(onCloseView())); connect(myEdge, SIGNAL(textChanged(const QString&)), SLOT(onTextChange(const QString&))); myOkBtn->setEnabled(false); @@ -244,14 +246,14 @@ void SMESHGUI_SingleEditDlg::Init() void SMESHGUI_SingleEditDlg::onOk() { if (onApply()) - onClose(); + reject(); } //======================================================================= -// name : onClose() +// name : reject() // Purpose : SLOT called when "Close" button pressed. Close dialog //======================================================================= -void SMESHGUI_SingleEditDlg::onClose() +void SMESHGUI_SingleEditDlg::reject() { if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode(ActorSelection); @@ -259,7 +261,7 @@ void SMESHGUI_SingleEditDlg::onClose() disconnect(mySelectionMgr, 0, this, 0); disconnect(mySMESHGUI, 0, this, 0); mySMESHGUI->ResetState(); - reject(); + QDialog::reject(); } //================================================================================= @@ -305,7 +307,7 @@ static bool findTriangles (const SMDS_MeshNode * theNode1, SMDS_ElemIteratorPtr it = theNode1->GetInverseElementIterator(); while (it->more()) { const SMDS_MeshElement* elem = it->next(); - if (elem->GetType() == SMDSAbs_Face && elem->NbNodes() == 3) + if (elem->GetType() == SMDSAbs_Face && elem->NbCornerNodes() == 3) emap.insert(elem); } it = theNode2->GetInverseElementIterator(); @@ -444,37 +446,45 @@ void SMESHGUI_SingleEditDlg::onDeactivate() setEnabled(false); } -//======================================================================= -// name : enterEvent() -// Purpose : Event filter -//======================================================================= -void SMESHGUI_SingleEditDlg::enterEvent (QEvent*) +//================================================================================= +// function : onOpenView() +// purpose : +//================================================================================= +void SMESHGUI_SingleEditDlg::onOpenView() { - if (!isEnabled()) { + if ( !mySelector ) { + mySelector = SMESH::GetViewWindow( mySMESHGUI )->GetSelector(); mySMESHGUI->EmitSignalDeactivateDialog(); - if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) - aViewWindow->SetSelectionMode(EdgeOfCellSelection); setEnabled(true); } } //================================================================================= -// function : closeEvent() +// function : onCloseView() // purpose : //================================================================================= -void SMESHGUI_SingleEditDlg::closeEvent (QCloseEvent*) +void SMESHGUI_SingleEditDlg::onCloseView() { - onClose(); + onDeactivate(); + mySelector = 0; } //======================================================================= -//function : hideEvent() -//purpose : caused by ESC key +// name : enterEvent() +// Purpose : Event filter //======================================================================= -void SMESHGUI_SingleEditDlg::hideEvent (QHideEvent*) +void SMESHGUI_SingleEditDlg::enterEvent (QEvent*) { - if (!isMinimized()) - onClose(); + if (!isEnabled()) { + mySMESHGUI->EmitSignalDeactivateDialog(); + SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI ); + if ( aViewWindow) { + aViewWindow->SetSelectionMode(EdgeOfCellSelection); + if (!mySelector) + mySelector = aViewWindow->GetSelector(); + } + setEnabled(true); + } } //=================================================================================