Salome HOME
Dialog SetupCurveDlg has been added
[modules/gui.git] / src / OCCViewer / OCCViewer_ViewWindow.cxx
index eae8cda773fc5ec2554955644185a99a8c05d04c..0351deacd668b655e8ee4a9c138daad5e1f24e35 100755 (executable)
@@ -655,12 +655,21 @@ void OCCViewer_ViewWindow::createActions()
   aAction->setStatusTip(tr("DSC_PRESETS_VIEW"));
   connect(aAction, SIGNAL(activated()), this, SLOT(onRestoreView()));
        myActionsMap[ RestoreId ] = aAction;
+
+  if (myModel->trihedronActivated()) {
+    aAction = new QtxAction(tr("MNU_SHOW_TRIHEDRE"), aResMgr->loadPixmap( "OCCViewer", tr( "ICON_OCCVIEWER_VIEW_TRIHEDRON" ) ),
+                             tr( "MNU_SHOW_TRIHEDRE" ), 0, this);
+    aAction->setStatusTip(tr("DSC_SHOW_TRIHEDRE"));
+    connect(aAction, SIGNAL(activated()), this, SLOT(onTrihedronShow()));
+         myActionsMap[ TrihedronShowId ] = aAction;
+  }
 }
 
 //****************************************************************
 void OCCViewer_ViewWindow::createToolBar()
 {
   myActionsMap[DumpId]->addTo(myToolBar);
+  myActionsMap[TrihedronShowId]->addTo(myToolBar);
 
   SUIT_ToolButton* aScaleBtn = new SUIT_ToolButton(myToolBar, "scale");
   aScaleBtn->AddAction(myActionsMap[FitAllId]);
@@ -766,36 +775,6 @@ void OCCViewer_ViewWindow::onFitAll()
   myViewPort->fitAll();
 }
 
-//****************************************************************
-/*
-   Dumps 3d-Viewer contents into image file
-   File format is defined by file's extension; supported formats : PNG, BMP, GIF, JPG
-*/
-void OCCViewer_ViewWindow::onDumpView()
-{
-  QApplication::setOverrideCursor( Qt::waitCursor );
-  QPixmap px = QPixmap::grabWindow(myViewPort->winId());
-  QApplication::restoreOverrideCursor();
-  
-  SUIT_Application* app = getViewManager()->study()->application();
-
-  QString aFileName = app->getFileName( false, QString::null, tr("OCC_IMAGE_FILES"), tr("INF_APP_DUMP_VIEW"), 0 );
-
-  if ( !aFileName.isNull() ) {
-    QApplication::setOverrideCursor( Qt::waitCursor );
-    QString fmt = SUIT_Tools::extension( aFileName ).upper();
-    if (fmt.isEmpty())
-      fmt = QString("BMP"); // default format
-    if (fmt == "JPG")
-      fmt = "JPEG";
-    bool bOk = px.save(aFileName, fmt.latin1());
-    QApplication::restoreOverrideCursor();
-    if (!bOk) {
-      SUIT_MessageBox::error1(this, tr("ERROR"), tr("ERR_DOC_CANT_SAVE_FILE"), tr("BUT_OK"));
-    }
-  }
-}
-
 //****************************************************************
 void OCCViewer_ViewWindow::onCloneView()
 {
@@ -872,3 +851,15 @@ void OCCViewer_ViewWindow::setRestoreFlag()
        myRestoreFlag = 1;
 }
 
+//****************************************************************
+void OCCViewer_ViewWindow::onTrihedronShow()
+{
+  myModel->toggleTrihedron();
+}
+
+//****************************************************************
+QImage OCCViewer_ViewWindow::dumpView()
+{
+  QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
+  return px.convertToImage();
+}