using namespace std;
#include "RepairGUI_GlueDlg.h"
-
#include "DlgRef_1Sel_Ext.h"
+#include "GEOMImpl_Types.hxx"
-#include "QAD_Desktop.h"
-#include "QAD_SpinBoxDbl.h"
-#include "QAD_MessageBox.h"
-#include "QAD_WaitCursor.h"
+#include "QtxDblSpinBox.h"
+#include "SalomeApp_Application.h"
+#include "SalomeApp_SelectionMgr.h"
+#include "SalomeApp_Study.h"
+#include "SalomeApp_Tools.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
-#include "OCCViewer_Viewer3d.h"
#include "SALOME_ListIteratorOfListIO.hxx"
-#include "SALOMEGUI_QtCatchCorbaException.hxx"
-#include "GEOMImpl_Types.hxx"
+#include <TCollection_AsciiString.hxx>
+
+#include <qapplication.h>
+#include <qlabel.h>
#define DEFAULT_TOLERANCE_VALUE 1e-07
+
+
//=================================================================================
// class : RepairGUI_GlueDlg()
// purpose : Constructs a RepairGUI_GlueDlg which is a child of 'parent', with the
// The dialog will by default be modeless, unless you set 'modal' to
// TRUE to construct a modal dialog.
//=================================================================================
-RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, SALOME_Selection* Sel, bool modal, WFlags fl)
- :GEOMBase_Skeleton(parent, name, Sel, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
+RepairGUI_GlueDlg::RepairGUI_GlueDlg(QWidget* parent, const char* name, bool modal, WFlags fl)
+ :GEOMBase_Skeleton(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | WStyle_Title | WStyle_SysMenu)
{
- QPixmap image0(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES")));
- QPixmap image1(QAD_Desktop::getResourceManager()->loadPixmap("GEOM",tr("ICON_SELECT")));
+ QPixmap image0(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_DLG_GLUE_FACES")));
+ QPixmap image1(SUIT_Session::session()->resourceMgr()->loadPixmap("GEOM",tr("ICON_SELECT")));
setCaption(tr("GEOM_GLUE_TITLE"));
QGridLayout* aLay = new QGridLayout( 0, 2, 2, 0, 6, "aLay" );
QLabel* aLbl1 = new QLabel( tr( "GEOM_TOLERANCE" ), GroupPoints->GroupBox1 );
- myTolEdt = new QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 );
+ myTolEdt = new QtxDblSpinBox( 0, 100, 1e-7, GroupPoints->GroupBox1 );//QAD_SpinBoxDbl( GroupPoints->GroupBox1, 0, 100, 1e-7, 10, 1e-10 );
+ myTolEdt->setPrecision( 10 );
myTolEdt->setValue( DEFAULT_TOLERANCE_VALUE );
aLay->addWidget( aLbl1, 0, 0 );
myObject = GEOM::GEOM_Object::_nil();
- myGeomGUI->SetState( 0 );
+ //myGeomGUI->SetState( 0 );
globalSelection( GEOM_COMPOUND );
/* signals and slots connections */
connect(GroupPoints->PushButton1, SIGNAL(clicked()), this, SLOT(SetEditCurrentArgument()));
connect(GroupPoints->LineEdit1, SIGNAL(returnPressed()), this, SLOT(LineEditReturnPressed()));
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
initName( tr( "GLUE_NEW_OBJ_NAME" ) );
}
myEditCurrentArgument->setText("");
myObject = GEOM::GEOM_Object::_nil();
- if ( mySelection->IObjectCount() == 1 ) {
- Handle(SALOME_InteractiveObject) anIO = mySelection->firstIObject();
+ if ( IObjectCount() == 1 ) {
+ Handle(SALOME_InteractiveObject) anIO = firstIObject();
Standard_Boolean aRes;
myObject = GEOMBase::ConvertIOinGEOMObject( anIO, aRes );
if ( aRes )
//=================================================================================
void RepairGUI_GlueDlg::DeactivateActiveDialog()
{
- myGeomGUI->SetState( -1 );
+ //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::DeactivateActiveDialog();
}
void RepairGUI_GlueDlg::ActivateThisDialog()
{
GEOMBase_Skeleton::ActivateThisDialog();
- connect(mySelection, SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
+ connect(((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(),
+ SIGNAL(currentSelectionChanged()), this, SLOT(SelectionIntoArgument()));
GroupPoints->LineEdit1->setText("");
myObject = GEOM::GEOM_Object::_nil();
- myGeomGUI->SetState( 0 );
+ //myGeomGUI->SetState( 0 );
globalSelection( GEOM_COMPOUND );
}
//=================================================================================
void RepairGUI_GlueDlg::closeEvent(QCloseEvent* e)
{
- myGeomGUI->SetState( -1 );
+ //myGeomGUI->SetState( -1 );
GEOMBase_Skeleton::closeEvent( e );
}
if ( CORBA::is_nil( theObj ) )
return;
- string IOR = GeometryGUI::GetORB()->object_to_string( theObj );
+ string IOR = myGeomGUI->getApp()->orb()->object_to_string( theObj );
TCollection_AsciiString asciiIOR( strdup( IOR.c_str() ) );
- GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
- if ( !getStudy() || CORBA::is_nil( getStudy()->getStudyDocument() ) )
+ if ( !getStudy() || !( getStudy()->studyDS() ) )
return;
- SALOMEDS::Study_var aStudy = getStudy()->getStudyDocument();
- SALOMEDS::SObject_var aSObj = aStudy->FindObjectIOR( IOR.c_str() );
- if ( CORBA::is_nil( aSObj ) )
+ _PTR(Study) aStudy = getStudy()->studyDS();
+ _PTR(SObject) aSObj ( aStudy->FindObjectIOR( IOR ) );
+ if ( !aSObj )
return;
- SALOMEDS::ChildIterator_var anIt = aStudy->NewChildIterator( aSObj );
+ _PTR(ChildIterator) anIt ( aStudy->NewChildIterator( aSObj ) );
for ( anIt->InitEx( true ); anIt->More(); anIt->Next() ) {
- SALOMEDS::GenericAttribute_var anAttr;
+ _PTR(GenericAttribute) anAttr;
if ( anIt->Value()->FindAttribute(anAttr, "AttributeIOR") ) {
- SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
- TCollection_AsciiString asciiIOR( anIOR->Value() );
- GeometryGUI::GetGeomGUI()->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
+ _PTR(AttributeIOR) anIOR ( anAttr );
+ TCollection_AsciiString asciiIOR( (char*)anIOR->Value().c_str() );
+ myGeomGUI->GetShapeReader().RemoveShapeFromBuffer( asciiIOR );
}
}
}
//================================================================
bool RepairGUI_GlueDlg::onAcceptLocal( const bool publish, const bool useTransaction )
{
- QAD_Study* aDoc = QAD_Application::getDesktop()->getActiveStudy();
- SALOMEDS::Study_var aStudy = aDoc->getStudyDocument();
+ if ( !getStudy() || !( getStudy()->studyDS() ) )
+ return false;
+
+ _PTR(Study) aStudy = getStudy()->studyDS();
bool aLocked = aStudy->GetProperties()->IsLocked();
if ( aLocked ) {
MESSAGE("GEOMBase_Helper::onAccept - ActiveStudy is locked");
- QAD_MessageBox::warn1 ( (QWidget*)QAD_Application::getDesktop(),
- QObject::tr("WRN_WARNING"),
- QObject::tr("WRN_STUDY_LOCKED"),
- QObject::tr("BUT_OK") );
+ SUIT_MessageBox::warn1 ( (QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
+ QObject::tr("WRN_WARNING"),
+ QObject::tr("WRN_STUDY_LOCKED"),
+ QObject::tr("BUT_OK") );
return false;
}
try {
if ( ( !publish && !useTransaction ) || openCommand() ) {
- QAD_WaitCursor wc;
- QAD_Application::getDesktop()->putInfo( "" );
+ QApplication::setOverrideCursor( Qt::waitCursor );
+ SUIT_Session::session()->activeApplication()->putInfo( "" );
ObjectList objects;
// JFA 28.12.2004 if ( !execute( objects ) || !getOperation()->IsDone() ) {
if ( !execute( objects ) ) { // JFA 28.12.2004 // To enable warnings
- wc.stop();
+ while( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
abortCommand();
showError();
}
if ( nbObjs ) {
commitCommand();
updateObjBrowser();
- QAD_Application::getDesktop()->putInfo( QObject::tr("GEOM_PRP_DONE") );
+ SUIT_Session::session()->activeApplication()->putInfo( QObject::tr("GEOM_PRP_DONE") );
}
else {
abortCommand();
// JFA 28.12.2004 BEGIN // To enable warnings
if ( !getOperation()->_is_nil() ) {
if ( !getOperation()->IsDone() ) {
- wc.stop();
+ while( QApplication::overrideCursor() )
+ QApplication::restoreOverrideCursor();
QString msgw = QObject::tr( getOperation()->GetErrorCode() );
- QAD_MessageBox::warn1(QAD_Application::getDesktop(),
- QObject::tr( "WRN_WARNING" ),
- msgw,
- QObject::tr( "BUT_OK" ));
+ SUIT_MessageBox::warn1((QWidget*)(SUIT_Session::session()->activeApplication()->desktop()),
+ QObject::tr( "WRN_WARNING" ),
+ msgw,
+ QObject::tr( "BUT_OK" ));
}
}
// JFA 28.12.2004 END
}
}
catch( const SALOME::SALOME_Exception& e ) {
- QtCatchCorbaException( e );
+ SalomeApp_Tools::QtCatchCorbaException( e );
abortCommand();
}