X-Git-Url: http://git.salome-platform.org/gitweb/?a=blobdiff_plain;f=src%2FGEOMToolsGUI%2FGEOMToolsGUI_TransparencyDlg.cxx;h=d12ccf7a6428282594c1624e214edff2e4880ab2;hb=8d94e7dd809e3c7663fa15591cf79a04968b9f39;hp=eb642a433fbbf481a241151f22d327a2a57ec0ae;hpb=c1745184cb4eb0e72088753b40a23902200aa62a;p=modules%2Fgeom.git diff --git a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx index eb642a433..d12ccf7a6 100644 --- a/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.cxx +++ b/src/GEOMToolsGUI/GEOMToolsGUI_TransparencyDlg.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 // // // @@ -29,13 +29,14 @@ #include "GEOMToolsGUI_TransparencyDlg.h" #include "GEOMBase.h" #include "GEOM_AISShape.hxx" +#include "GeometryGUI.h" -#include -#include +#include "SALOME_ListIO.hxx" +#include "SALOME_ListIteratorOfListIO.hxx" #include #include -#include +#include #include #include @@ -43,12 +44,14 @@ #include #include #include +#include #include #include #include #include -#include +#include +#include #include #include @@ -96,9 +99,15 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) buttonOk->setText( tr( "GEOM_BUT_OK" ) ); buttonOk->setAutoDefault( TRUE ); buttonOk->setDefault( TRUE ); - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0 ); - GroupButtonsLayout->addWidget( buttonOk, 0, 1 ); - GroupButtonsLayout->addItem( new QSpacerItem( 20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2 ); + + QPushButton* buttonHelp = new QPushButton( GroupButtons, "buttonHelp" ); + buttonHelp->setText( tr( "GEOM_BUT_HELP" ) ); + buttonHelp->setAutoDefault( TRUE ); + buttonHelp->setDefault( TRUE ); + + GroupButtonsLayout->addWidget( buttonOk, 0, 0 ); + GroupButtonsLayout->addItem( new QSpacerItem( 0, 0, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1 ); + GroupButtonsLayout->addWidget( buttonHelp, 0, 2 ); /*************************************************************************/ QGroupBox* GroupC1 = new QGroupBox( this, "GroupC1" ); @@ -137,8 +146,11 @@ GEOMToolsGUI_TransparencyDlg::GEOMToolsGUI_TransparencyDlg( QWidget* parent ) // mySlider->setValue( 5 ) ; ValueHasChanged(mySlider->value()); + myHelpFileName = "transparency.htm"; + // signals and slots connections : after ValueHasChanged() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(mySlider, SIGNAL(valueChanged(int)), this, SLOT(ValueHasChanged(int))); } @@ -174,6 +186,24 @@ void GEOMToolsGUI_TransparencyDlg::ClickOnClose() return; } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void GEOMToolsGUI_TransparencyDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) { + GeometryGUI* aGeomGUI = dynamic_cast( app->module( "Geometry" ) ); + app->onHelpContextModule(aGeomGUI ? app->moduleName(aGeomGUI->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 : ValueHasChanged() @@ -185,7 +215,7 @@ void GEOMToolsGUI_TransparencyDlg::ValueHasChanged( int newValue ) SalomeApp_Application* app = dynamic_cast< SalomeApp_Application* >( SUIT_Session::session()->activeApplication() ); if ( !app ) return; - SalomeApp_SelectionMgr* aSelMgr = app->selectionMgr(); + LightApp_SelectionMgr* aSelMgr = app->selectionMgr(); if ( !aSelMgr ) return; SALOME_ListIO selected; @@ -205,19 +235,19 @@ void GEOMToolsGUI_TransparencyDlg::ValueHasChanged( int newValue ) SVTK_ViewWindow* vtkVW = dynamic_cast( window ); if ( !vtkVW ) return; - SVTK_RenderWindowInteractor* rwi = vtkVW->getRWInteractor(); + SVTK_View* aView = vtkVW->getView(); if ( myFirstInit ) { myFirstInit = false; - float transp = (rwi->GetTransparency(FirstIOS))*10.0; + float transp = (aView->GetTransparency(FirstIOS))*10.0; mySlider->setValue(int(transp)); return; } SUIT_OverrideCursor(); for ( SALOME_ListIteratorOfListIO It( selected ); It.More(); It.Next() ) { - rwi->SetTransparency( It.Value(), newValue/10.0 ); + aView->SetTransparency( It.Value(), newValue/10.0 ); } - rwi->Render(); + aView->Repaint(); } // if ( isVTK ) else if ( isOCC ) { @@ -249,3 +279,20 @@ void GEOMToolsGUI_TransparencyDlg::ValueHasChanged( int newValue ) ic->UpdateCurrentViewer(); } // if ( isOCC ) } + +//================================================================================= +// function : keyPressEvent() +// purpose : +//================================================================================= +void GEOMToolsGUI_TransparencyDlg::keyPressEvent( QKeyEvent* e ) +{ + QDialog::keyPressEvent( e ); + if ( e->isAccepted() ) + return; + + if ( e->key() == Key_F1 ) + { + e->accept(); + ClickOnHelp(); + } +}