Salome HOME
Join modifications from branch OCC_debug_for_3_2_0b1
[modules/visu.git] / src / VISUGUI / VisuGUI_CutPlanesDlg.cxx
index 486a475d200b47b435f13d0fd01f54d9940c1843..85bc997f66e3ea7378b7585d91da6eebf898b07a 100644 (file)
 
 #include "SVTK_ViewWindow.h"
 
-#include "SalomeApp_Application.h"
+#include "LightApp_Application.h"
 
 #include "SUIT_Application.h"
 #include "SUIT_Desktop.h"
 #include "SUIT_ViewWindow.h"
 #include "SUIT_ViewManager.h"
+#include "SUIT_Session.h"
+#include "SUIT_MessageBox.h"
+#include "SUIT_ResourceMgr.h"
 
 #include <qlayout.h>
 #include <qcheckbox.h>
@@ -417,8 +420,12 @@ void VisuGUI_CutPlanesPane::onValueChanged (int theRow, int theCol)
 void VisuGUI_CutPlanesPane::deletePlanes()
 {
   if (myPreviewActor == 0) return;
-  if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
-    vf->RemoveActor(myPreviewActor);
+  vtkRenderer* aRend       = myPreviewActor->GetRenderer();
+  if(aRend)
+    myPreviewActor->RemoveFromRender(aRend);
+//  Bug IPAL11962: preview is still in the viewer, if viewer not active.
+//   if (SVTK_ViewWindow* vf = VISU::GetActiveViewWindow<SVTK_ViewWindow>())
+//     vf->RemoveActor(myPreviewActor);
   myPreviewActor->Delete();
   myPreviewActor = 0;
 }
@@ -500,10 +507,15 @@ VisuGUI_CutPlanesDlg::VisuGUI_CutPlanesDlg (SalomeApp_Module* theModule)
   buttonCancel->setAutoDefault(TRUE);
   GroupButtonsLayout->addWidget(buttonCancel, 0, 2);
 
+  QPushButton* buttonHelp = new QPushButton(tr("&Help"), GroupButtons, "buttonHelp");
+  buttonHelp->setAutoDefault(TRUE);
+  GroupButtonsLayout->addWidget(buttonHelp, 0, 3);
+
   TopLayout->addWidget(GroupButtons);
 
   connect(buttonOk,     SIGNAL(clicked()), this, SLOT(accept()));
   connect(buttonCancel, SIGNAL(clicked()), this, SLOT(reject()));
+  connect(buttonHelp,   SIGNAL(clicked()), this, SLOT(onHelp()));
   //connect(myMgr, SIGNAL(closeAllViews()), this, SLOT(reject()));
   //connect(VisuGUI::application()->desktop(),
   //        SIGNAL(windowActivated(SUIT_ViewWindow*)),
@@ -541,6 +553,22 @@ void VisuGUI_CutPlanesDlg::reject() {
   QDialog::reject();
 }
 
+void VisuGUI_CutPlanesDlg::onHelp()
+{
+  QString aHelpFileName = "/files/cut_lines_resentation.htm";
+  LightApp_Application* app = (LightApp_Application*)(SUIT_Session::session()->activeApplication());
+  if (app) {
+    VisuGUI* aVisuGUI = dynamic_cast<VisuGUI*>( app->activeModule() );
+    app->onHelpContextModule(aVisuGUI ? app->moduleName(aVisuGUI->moduleName()) : QString(""), aHelpFileName);
+  }
+  else {
+    SUIT_MessageBox::warn1(0, QObject::tr("WRN_WARNING"),
+                          QObject::tr("EXTERNAL_BROWSER_CANNOT_SHOW_PAGE").
+                          arg(app->resourceMgr()->stringValue("ExternalBrowser", "application")).arg(aHelpFileName),
+                          QObject::tr("BUT_OK"));
+  }
+}
+
 //void VisuGUI_CutPlanesDlg::onWindowActivated (SUIT_ViewWindow* theWnd)
 //{
 //  if (theWnd != myStudyWnd)