//=======================================================================
MeasureGUI::MeasureGUI( GeometryGUI* parent ) : GEOMGUI( parent )
{
+ myManageDimensionDlg = 0;
}
//=======================================================================
dlg = new MeasureGUI_PointDlg( getGeometryGUI(), parent );
break; // POINT COORDINATES
case GEOMOp::OpManageDimensions:
- dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent );
+ if( !myManageDimensionDlg ) {
+ dlg = new MeasureGUI_ManageDimensionsDlg( getGeometryGUI(), parent );
+ myManageDimensionDlg = dlg;
+ connect( dlg, SIGNAL( finished(int) ), this, SLOT( onFinished(int) ) );
+ }
+ myManageDimensionDlg->activateWindow();
break; // MANAGE DIMENSIONS
case GEOMOp::OpShowAllDimensions:
ChangeDimensionsVisibility( true );
GEOM_Displayer( anActiveStudy ).Redisplay( anIObject, true );
}
+//=======================================================================
+// function : onFinished
+// purpose : called then "Manage Dimension" dialog is closed.
+//=======================================================================
+void MeasureGUI::onFinished(int /*theResult*/) {
+ if(sender() == myManageDimensionDlg) {
+ myManageDimensionDlg = 0;
+ }
+}
+
//=====================================================================================
// EXPORTED METHODS
//=====================================================================================
MeasureGUI_ManageDimensionsDlg::MeasureGUI_ManageDimensionsDlg( GeometryGUI* theGUI, QWidget* theParent )
: GEOMBase_Skeleton( theGUI, theParent ),
myOperatedViewer( NULL ),
- myCurrentSelection( Selection_None )
+ myCurrentSelection( Selection_None ),
+ myCreateDialog(0)
{
SUIT_ResourceMgr* aResMgr = SUIT_Session::session()->resourceMgr();
//=================================================================================
void MeasureGUI_ManageDimensionsDlg::OnAdd()
{
- QWidget* aParent = qobject_cast<QWidget*>( this->parent() );
-
- this->Suspend();
-
- MeasureGUI_CreateDimensionDlg* aCreateDlg = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent );
-
- connect( aCreateDlg, SIGNAL( finished( int ) ), this, SLOT( Resume() ) );
-
- // this is necessary as the GEOMBase_Helper switches selection mode on destruction
- connect( aCreateDlg, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) );
-
- aCreateDlg->updateGeometry();
- aCreateDlg->resize( aCreateDlg->minimumSizeHint() );
- aCreateDlg->show();
+ if(!myCreateDialog) {
+ QWidget* aParent = qobject_cast<QWidget*>( this->parent() );
+ this->Suspend();
+ myCreateDialog = new MeasureGUI_CreateDimensionDlg( myEditObject, myGeomGUI, aParent );
+ connect( myCreateDialog, SIGNAL( finished( int ) ), this, SLOT( Resume() ) );
+ // this is necessary as the GEOMBase_Helper switches selection mode on destruction
+ connect( myCreateDialog, SIGNAL( destroyed( QObject* ) ), this, SLOT( Resume() ) );
+ connect( myCreateDialog, SIGNAL( applyClicked() ), this, SLOT( OnDimensionAdded() ) );
+ myCreateDialog->updateGeometry();
+ myCreateDialog->resize( myCreateDialog->minimumSizeHint() );
+ myCreateDialog->show();
+ } else {
+ myCreateDialog->activateWindow();
+ }
+ myObjectSelector->setEnabled(false);
+ myDimensionView->setEnabled(false);
}
//=================================================================================
void MeasureGUI_ManageDimensionsDlg::Suspend()
{
StopSelection();
- hide();
}
//=================================================================================
//=================================================================================
void MeasureGUI_ManageDimensionsDlg::Resume()
{
- this->show();
+ if(myCreateDialog){
+ myCreateDialog = 0;
+ myObjectSelector->setEnabled(true);
+ myDimensionView->setEnabled(true);
+ }
+
if ( !myEditObject.isNull() )
{
PopulateList();
}
}
+//=================================================================================
+// function : Suspend
+// purpose :
+//=================================================================================
+void MeasureGUI_ManageDimensionsDlg::OnDimensionAdded() {
+ if ( !myEditObject.isNull() )
+ {
+ PopulateList();
+ }
+}
+
//=================================================================================
// function : ClickOnOk
// purpose :
{
return;
}
-
+
+ if( myCreateDialog ) {
+ myCreateDialog->close();
+ myCreateDialog = 0;
+ }
+
GEOMBase_Skeleton::ClickOnCancel();
}