X-Git-Url: http://git.salome-platform.org/gitweb/?p=modules%2Fsmesh.git;a=blobdiff_plain;f=src%2FSMESHGUI%2FSMESHGUI_TransparencyDlg.cxx;h=6e187231173d3ad10b277a1a993db674c233c028;hp=b121d1113c0ae9a1d2e5f8b4c7ce0c2ec19202c1;hb=c3dcb1d5ce71049bef3434d77e015095d92ff646;hpb=c38c10811a065cf5b13e8807ed71864d92ca7d80 diff --git a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx b/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx index b121d1113..6e1872311 100644 --- a/src/SMESHGUI/SMESHGUI_TransparencyDlg.cxx +++ b/src/SMESHGUI/SMESHGUI_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 // // // @@ -30,17 +30,21 @@ #include "SMESHGUI.h" #include "SMESHGUI_VTKUtils.h" - +#include "SMESHGUI_Utils.h" #include "SMESH_Actor.h" +#include "SUIT_Desktop.h" #include "SUIT_OverrideCursor.h" +#include "SUIT_Session.h" +#include "SUIT_MessageBox.h" #include "SALOME_ListIO.hxx" #include "SALOME_ListIteratorOfListIO.hxx" #include "SALOME_InteractiveObject.hxx" #include "SalomeApp_Study.h" -#include "SalomeApp_SelectionMgr.h" +#include "LightApp_Application.h" +#include "LightApp_SelectionMgr.h" #include "SVTK_ViewWindow.h" @@ -58,12 +62,15 @@ using namespace std; // purpose : // //================================================================================= -SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent, +SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg( SMESHGUI* theModule, const char* name, bool modal, WFlags fl) - : QDialog(parent, name, modal, WStyle_Customize | WStyle_NormalBorder | - WStyle_Title | WStyle_SysMenu | WDestructiveClose) + : QDialog( SMESH::GetDesktop( theModule ), name, modal, WStyle_Customize | WStyle_NormalBorder | + WStyle_Title | WStyle_SysMenu | WDestructiveClose ), + mySMESHGUI( theModule ), + mySelectionMgr( SMESH::GetSelectionMgr( theModule ) ), + myViewWindow( SMESH::GetViewWindow( theModule ) ) { if (!name) setName("SMESHGUI_TransparencyDlg"); @@ -125,29 +132,32 @@ SMESHGUI_TransparencyDlg::SMESHGUI_TransparencyDlg (QWidget* parent, buttonOk->setText(tr("SMESH_BUT_CLOSE")); 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); + buttonHelp = new QPushButton(GroupButtons, "buttonHelp"); + buttonHelp->setText(tr("SMESH_BUT_HELP")); + buttonHelp->setAutoDefault(TRUE); + + //GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 0); + GroupButtonsLayout->addWidget(buttonOk, 0, 0); + GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 1); + GroupButtonsLayout->addWidget(buttonHelp, 0, 2); + //GroupButtonsLayout->addItem(new QSpacerItem(20, 20, QSizePolicy::Expanding, QSizePolicy::Minimum), 0, 2); SMESHGUI_TransparencyDlgLayout->addWidget(GroupC1, 0, 0); SMESHGUI_TransparencyDlgLayout->addWidget(GroupButtons, 1, 0); - mySelectionMgr = SMESHGUI::selectionMgr(); - // Initial state this->onSelectionChanged(); // signals and slots connections : after ValueHasChanged() connect(buttonOk, SIGNAL(clicked()), this, SLOT(ClickOnOk())); + connect(buttonHelp, SIGNAL(clicked()), this, SLOT(ClickOnHelp())); connect(Slider1, SIGNAL(valueChanged(int)), this, SLOT(SetTransparency())); connect(Slider1, SIGNAL(sliderMoved(int)), this, SLOT(ValueHasChanged())); - connect(SMESHGUI::GetSMESHGUI(), SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk())); + connect(mySMESHGUI, SIGNAL (SignalCloseAllDialogs()), this, SLOT(ClickOnOk())); connect(mySelectionMgr, SIGNAL(currentSelectionChanged()), this, SLOT(onSelectionChanged())); - /* Move widget on the botton right corner of main widget */ - int x, y; - SMESHGUI::GetSMESHGUI()->DefineDlgPosition(this, x, y); - this->move(x, y); + myHelpFileName = "transparency.htm"; + this->show(); } @@ -169,6 +179,23 @@ void SMESHGUI_TransparencyDlg::ClickOnOk() close(); } +//================================================================================= +// function : ClickOnHelp() +// purpose : +//================================================================================= +void SMESHGUI_TransparencyDlg::ClickOnHelp() +{ + LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication()); + if (app) + app->onHelpContextModule(mySMESHGUI ? app->moduleName(mySMESHGUI->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 : SetTransparency() // purpose : Called when value of slider change @@ -176,7 +203,7 @@ void SMESHGUI_TransparencyDlg::ClickOnOk() //================================================================================= void SMESHGUI_TransparencyDlg::SetTransparency() { - if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) { + if( myViewWindow ) { SUIT_OverrideCursor wc; float opacity = this->Slider1->value() / 100.; @@ -190,7 +217,7 @@ void SMESHGUI_TransparencyDlg::SetTransparency() if (anActor) anActor->SetOpacity(opacity); } - aVTKViewWindow->Repaint(); + myViewWindow->Repaint(); } ValueHasChanged(); } @@ -210,7 +237,7 @@ void SMESHGUI_TransparencyDlg::ValueHasChanged() //================================================================================= void SMESHGUI_TransparencyDlg::onSelectionChanged() { - if (SVTK_ViewWindow* aVTKViewWindow = SMESH::GetCurrentVtkView()) { + if( myViewWindow ) { int opacity = 100; SALOME_ListIO aList;