X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;ds=inline;f=src%2FMeasureGUI%2FMeasureGUI_Skeleton.cxx;h=bf2fe3391fe4d18776201e632fcfeea3e274e794;hb=ff317e10706f0b135ef4b2c6770296f57d6bab9f;hp=39bcaf04f0112e6043af7059a66d225cf136ab14;hpb=d3dd282390888d7dc091ba2c2ffe7923bd7458e6;p=modules%2Fgeom.git diff --git a/src/MeasureGUI/MeasureGUI_Skeleton.cxx b/src/MeasureGUI/MeasureGUI_Skeleton.cxx index 39bcaf04f..bf2fe3391 100644 --- a/src/MeasureGUI/MeasureGUI_Skeleton.cxx +++ b/src/MeasureGUI/MeasureGUI_Skeleton.cxx @@ -17,7 +17,7 @@ // License along with this library; if not, write to the Free Software // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA // -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org +// See http://www.salome-platform.org/ or email : webmaster.salome@opencascade.com // // // @@ -27,18 +27,24 @@ // $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 "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" +#include "SalomeApp_Application.h" +#include "SalomeApp_Tools.h" +#include "SUIT_MessageBox.h" +#include "SUIT_Session.h" +#include "SUIT_OverrideCursor.h" #include #include #include #include #include +#include //================================================================================= // class : MeasureGUI_Skeleton() @@ -47,21 +53,25 @@ // 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 ), + GEOMBase_Helper( dynamic_cast( parent ) ), + myGeomGUI( GUI ) { mySelBtn = 0; mySelEdit = 0; myDisplayer = 0; + myHelpFileName = ""; if ( !name ) setName( "MeasureGUI_Skeleton" ); buttonClose->setText( tr( "GEOM_BUT_CLOSE" ) ); + buttonHelp->setText(tr("GEOM_BUT_HELP")); buttonClose->setAutoDefault( false ); @@ -85,19 +95,18 @@ MeasureGUI_Skeleton::~MeasureGUI_Skeleton() // 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( buttonClose, SIGNAL( clicked() ), this, SLOT( ClickOnCancel() ) ); + + connect( buttonHelp, SIGNAL( clicked() ), + this, SLOT( ClickOnHelp() ) ); connect( myGeomGUI, SIGNAL( SignalDeactivateActiveDialog() ), this, SLOT ( DeactivateActiveDialog() ) ); @@ -111,9 +120,10 @@ void MeasureGUI_Skeleton::Init( SALOME_Selection* Sel ) connect( mySelBtn, SIGNAL( clicked() ), this, SLOT ( SetEditCurrentArgument() ) ); - if ( mySelection ) - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ); + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; /* displays Dialog */ RadioButton1->setChecked( TRUE ); @@ -133,6 +143,22 @@ void MeasureGUI_Skeleton::ClickOnCancel() close(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void MeasureGUI_Skeleton::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(myGeomGUI ? app->moduleName(myGeomGUI->moduleName()) : QString(""), myHelpFileName); + else { + SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"), + QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE"). + arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(myHelpFileName), + QObject::tr("BUT_OK")); + } +} //================================================================================= // function : LineEditReturnPressed() @@ -147,7 +173,7 @@ void MeasureGUI_Skeleton::LineEditReturnPressed() const QString objectUserName = mySelEdit->text(); QWidget* thisWidget = ( QWidget* )this; - if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, mySelection ) ) + if ( GEOMBase::SelectionByNameInDialogs( thisWidget, objectUserName, selectedIO() ) ) mySelEdit->setText( objectUserName ); } @@ -160,9 +186,10 @@ void MeasureGUI_Skeleton::DeactivateActiveDialog() { setEnabled( false ); - if ( mySelection ) - disconnect( mySelection, 0, this, 0 ); - + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); + myGeomGUI->SetActiveDialogBox( 0 ); globalSelection(); @@ -181,9 +208,10 @@ void MeasureGUI_Skeleton::ActivateThisDialog() myGeomGUI->SetActiveDialogBox( ( QDialog* )this ); - if ( mySelection ) - connect( mySelection, SIGNAL( currentSelectionChanged() ), - this, SLOT ( SelectionIntoArgument() ) ); + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + connect( aSel, SIGNAL( currentSelectionChanged() ), + this, SLOT ( SelectionIntoArgument() ) ) ; redisplayPreview(); activateSelection(); @@ -209,7 +237,7 @@ void MeasureGUI_Skeleton::SelectionIntoArgument() Standard_Boolean testResult = Standard_False; GEOM::GEOM_Object_var aSelectedObject = - GEOMBase::ConvertIOinGEOMObject( mySelection->firstIObject(), testResult ); + GEOMBase::ConvertIOinGEOMObject( firstIObject(), testResult ); if( !testResult || aSelectedObject->_is_nil() ) { @@ -240,7 +268,9 @@ void MeasureGUI_Skeleton::processObject() //================================================================================= void MeasureGUI_Skeleton::closeEvent( QCloseEvent* e ) { - disconnect( mySelection, 0, this, 0 ); + LightApp_SelectionMgr* aSel = ((SalomeApp_Application*)(SUIT_Session::session()->activeApplication()))->selectionMgr(); + if ( aSel ) + disconnect( aSel, 0, this, 0 ); QDialog::closeEvent( e ); } @@ -282,7 +312,7 @@ void MeasureGUI_Skeleton::redisplayPreview() try { - QAD_WaitCursor wc; + SUIT_OverrideCursor(); getDisplayer()->SetColor( Quantity_NOC_VIOLET ); getDisplayer()->SetToActivate( false ); @@ -292,7 +322,7 @@ void MeasureGUI_Skeleton::redisplayPreview() } catch( const SALOME::SALOME_Exception& e ) { - QtCatchCorbaException( e ); + SalomeApp_Tools::QtCatchCorbaException( e ); } } @@ -322,7 +352,7 @@ bool MeasureGUI_Skeleton::isValid( QString& ) GEOM_Displayer* MeasureGUI_Skeleton::getDisplayer() { if ( !myDisplayer ) - myDisplayer = new GEOM_Displayer(); + myDisplayer = new GEOM_Displayer( getStudy() ); return myDisplayer; } @@ -335,26 +365,3 @@ GEOM::GEOM_IOperations_ptr MeasureGUI_Skeleton::createOperation() return getGeomEngine()->GetIMeasureOperations( getStudyId() ); } - - - - - - - - - - - - - - - - - - - - - - -