// $Header$
#include "MeasureGUI_Skeleton.h"
-#include "QAD_Desktop.h"
-#include "QAD_WaitCursor.h"
#include "GEOMBase.h"
#include "GEOM_Displayer.h"
#include "GeometryGUI.h"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
+
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Tools.h"
+#include "SUIT_Session.h"
#include <qlineedit.h>
#include <qlayout.h>
#include <qpushbutton.h>
#include <qradiobutton.h>
#include <qbuttongroup.h>
+#include <qapplication.h>
//=================================================================================
// class : MeasureGUI_Skeleton()
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-MeasureGUI_Skeleton::MeasureGUI_Skeleton( QWidget* parent,
- const char* name,
- SALOME_Selection* Sel )
+MeasureGUI_Skeleton::MeasureGUI_Skeleton( GeometryGUI* GUI,
+ QWidget* parent,
+ const char* name )
: MeasureGUI_Skeleton_QTD( parent, name, false,
- WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose )
+ WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu | WDestructiveClose ),
+ myGeomGUI( GUI )
{
mySelBtn = 0;
// function : Init()
// purpose :
//=================================================================================
-void MeasureGUI_Skeleton::Init( SALOME_Selection* Sel )
+void MeasureGUI_Skeleton::Init()
{
- myGeomGUI = GeometryGUI::GetGeomGUI();
-
/* init variables */
- mySelection = Sel;
-
myGeomGUI->SetActiveDialogBox((QDialog*)this);
/* signals and slots connections */
connect( mySelBtn, SIGNAL( clicked() ),
this, SLOT ( SetEditCurrentArgument() ) );
- if ( mySelection )
- connect( mySelection, SIGNAL( currentSelectionChanged() ),
- this, SLOT ( SelectionIntoArgument() ) );
+ SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+ if ( aSel )
+ connect( aSel, SIGNAL( currentSelectionChanged() ),
+ this, SLOT ( SelectionIntoArgument() ) ) ;
/* displays Dialog */
RadioButton1->setChecked( TRUE );
const QString objectUserName = mySelEdit->text();
QWidget* thisWidget = ( QWidget* )this;
- if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) )
+ if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, selectedIO() ) )
mySelEdit->setText( objectUserName );
}
{
setEnabled( false );
- if ( mySelection )
- disconnect( mySelection, 0, this, 0 );
-
+ SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+ if ( aSel )
+ disconnect( aSel, 0, this, 0 );
+
myGeomGUI->SetActiveDialogBox( 0 );
globalSelection();
myGeomGUI->SetActiveDialogBox( ( QDialog* )this );
- if ( mySelection )
- connect( mySelection, SIGNAL( currentSelectionChanged() ),
- this, SLOT ( SelectionIntoArgument() ) );
+ SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+ if ( aSel )
+ connect( aSel, SIGNAL( currentSelectionChanged() ),
+ this, SLOT ( SelectionIntoArgument() ) ) ;
redisplayPreview();
activateSelection();
Standard_Boolean testResult = Standard_False;
GEOM::GEOM_Object_var aSelectedObject =
- GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult );
+ GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult );
if( !testResult || aSelectedObject->_is_nil() )
{
//=================================================================================
void MeasureGUI_Skeleton::closeEvent( QCloseEvent* e )
{
- disconnect( mySelection, 0, this, 0 );
+ SalomeApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr();
+ if ( aSel )
+ disconnect( aSel, 0, this, 0 );
QDialog::closeEvent( e );
}
try
{
- QAD_WaitCursor wc;
+ QApplication::setOverrideCursor( Qt::waitCursor );
getDisplayer()->SetColor( Quantity_NOC_VIOLET );
getDisplayer()->SetToActivate( false );
}
catch( const SALOME::SALOME_Exception& e )
{
- QtCatchCorbaException( e );
+ SalomeApp_Tools::QtCatchCorbaException( e );
}
}
GEOM_Displayer* MeasureGUI_Skeleton::getDisplayer()
{
if ( !myDisplayer )
- myDisplayer = new GEOM_Displayer();
+ myDisplayer = new GEOM_Displayer( getStudy() );
return myDisplayer;
}
return getGeomEngine()->GetIMeasureOperations( getStudyId() );
}
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+//=================================================================================
+// function : getDesktop()
+// purpose :
+//=================================================================================
+SUIT_Desktop* MeasureGUI_Skeleton::getDesktop() const
+{
+ return dynamic_cast<SUIT_Desktop*>( parentWidget() );
+}