From 2022134281dd7cd755907ea82c9c01472c72e6ab Mon Sep 17 00:00:00 2001 From: dmv Date: Tue, 28 Oct 2008 07:37:16 +0000 Subject: [PATCH] Modification, Transformation. IDs of elements are missing, if selection with rectange is used. --- src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx | 4 ++- src/SMESHGUI/SMESHGUI_RotationDlg.cxx | 1 + src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx | 1 + src/SMESHGUI/SMESHGUI_TranslationDlg.cxx | 41 +++++++++++++++++------- 4 files changed, 35 insertions(+), 12 deletions(-) diff --git a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx index 70614f504..f889beffa 100644 --- a/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RevolutionDlg.cxx @@ -827,8 +827,10 @@ void SMESHGUI_RevolutionDlg::SelectionIntoArgument() } myBusy = true; - if (myEditCurrentArgument == (QWidget*)LineEditElements) + if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); + LineEditElements->repaint(); + } myBusy = false; // OK diff --git a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx index c41978db4..6ac3770f8 100644 --- a/src/SMESHGUI/SMESHGUI_RotationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_RotationDlg.cxx @@ -721,6 +721,7 @@ void SMESHGUI_RotationDlg::SelectionIntoArgument() myBusy = true; if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); + LineEditElements->repaint(); setNewMeshName(); } myBusy = false; diff --git a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx index 6eab435f8..d733ee9ee 100644 --- a/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_SymmetryDlg.cxx @@ -788,6 +788,7 @@ void SMESHGUI_SymmetryDlg::SelectionIntoArgument() myBusy = true; if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); + LineEditElements->repaint(); setNewMeshName(); } myBusy = false; diff --git a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx index 9ab6ed909..fbee1a0a2 100644 --- a/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_TranslationDlg.cxx @@ -82,6 +82,23 @@ using namespace std; enum { MOVE_ELEMS_BUTTON = 0, COPY_ELEMS_BUTTON, MAKE_MESH_BUTTON }; //!< action type +/*! + \class BusyLocker + \brief Simple 'busy state' flag locker. + \internal +*/ + +class BusyLocker +{ +public: + //! Constructor. Sets passed boolean flag to \c true. + BusyLocker( bool& busy ) : myBusy( busy ) { myBusy = true; } + //! Destructor. Clear external boolean flag passed as parameter to the constructor to \c false. + ~BusyLocker() { myBusy = false; } +private: + bool& myBusy; //! External 'busy state' boolean flag +}; + //================================================================================= // class : SMESHGUI_TranslationDlg() // purpose : @@ -452,8 +469,9 @@ void SMESHGUI_TranslationDlg::ConstructorsClicked (int constructorId) //================================================================================= void SMESHGUI_TranslationDlg::ClickOnApply() { - if (mySMESHGUI->isActiveStudyLocked()) + if (mySMESHGUI->isActiveStudyLocked() || myBusy ) return; + BusyLocker lock( myBusy ); if (myNbOkElements) { QStringList aListElementsId = QStringList::split(" ", myElementsId, false); @@ -568,7 +586,7 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText) QLineEdit* send = (QLineEdit*)sender(); if (myBusy) return; - myBusy = true; + BusyLocker lock( myBusy ); if (send == LineEditElements) myNbOkElements = 0; @@ -607,9 +625,8 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText) if (myNbOkElements) { buttonOk->setEnabled(true); buttonApply->setEnabled(true); - } - myBusy = false; + } } //================================================================================= @@ -618,22 +635,22 @@ void SMESHGUI_TranslationDlg::onTextChange (const QString& theNewText) //================================================================================= void SMESHGUI_TranslationDlg::SelectionIntoArgument() { - if (myBusy) return; + if (myBusy) + return; + BusyLocker lock( myBusy ); // clear myActor = 0; QString aString = ""; - myBusy = true; if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); myNbOkElements = 0; buttonOk->setEnabled(false); buttonApply->setEnabled(false); } - myBusy = false; - if (!GroupButtons->isEnabled()) // inactive + if (!GroupButtons->isEnabled()) // inactive return; // get selected mesh @@ -748,12 +765,11 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() } } - myBusy = true; if (myEditCurrentArgument == (QWidget*)LineEditElements) { LineEditElements->setText(aString); + LineEditElements->repaint(); setNewMeshName(); } - myBusy = false; // OK if (myNbOkElements) { @@ -768,6 +784,9 @@ void SMESHGUI_TranslationDlg::SelectionIntoArgument() //================================================================================= void SMESHGUI_TranslationDlg::SetEditCurrentArgument() { + if (myBusy) return; + BusyLocker lock( myBusy ); + QPushButton* send = (QPushButton*)sender(); disconnect(mySelectionMgr, 0, this, 0); @@ -837,7 +856,7 @@ void SMESHGUI_TranslationDlg::ActivateThisDialog() if ( SVTK_ViewWindow* aViewWindow = SMESH::GetViewWindow( mySMESHGUI )) aViewWindow->SetSelectionMode( CellSelection ); - SelectionIntoArgument(); + // SelectionIntoArgument(); } //================================================================================= -- 2.39.2