#include "SUIT_Tools.h"
#include "SUIT_ResourceMgr.h"
-#include "SUIT_FileDlg.h"
#include "SUIT_MessageBox.h"
#include <qptrlist.h>
#include <qcolor.h>
#include <qpainter.h>
#include <qapplication.h>
-
+#include <qdatetime.h>
const char* imageZoomCursor[] = {
"32 32 3 1",
}
-//****************************************************************
+//****************************************************************/
void OCCViewer_ViewWindow::vpMouseMoveEvent(QMouseEvent* theEvent)
{
myCurrX = theEvent->x();
}
}
-//****************************************************************
+//****************************************************************/
void OCCViewer_ViewWindow::vpMouseReleaseEvent(QMouseEvent* theEvent)
{
switch ( myOperation ) {
}
-//****************************************************************
+//****************************************************************/
void OCCViewer_ViewWindow::drawRect()
{
QPainter aPainter(myViewPort);
myRect = aRect;
}
-//****************************************************************
+//****************************************************************/
void OCCViewer_ViewWindow::createActions()
{
if (!myActionsMap.isEmpty()) return;
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]);
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();
-
- QString fileName = SUIT_FileDlg::getFileName(this,
- QString::null,
- tr("OCC_IMAGE_FILES"),
- tr("INF_APP_DUMP_VIEW"),
- false);
- if (!fileName.isNull()) {
- QApplication::setOverrideCursor( Qt::waitCursor );
- QString fmt = SUIT_Tools::extension(fileName).upper();
- if (fmt.isEmpty())
- fmt = QString("BMP"); // default format
- if (fmt == "JPG")
- fmt = "JPEG";
- bool bOk = px.save(fileName, 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()
{
myRestoreFlag = 1;
}
+//****************************************************************
+void OCCViewer_ViewWindow::onTrihedronShow()
+{
+ myModel->toggleTrihedron();
+}
+
+//****************************************************************
+QImage OCCViewer_ViewWindow::dumpView()
+{
+ QPixmap px = QPixmap::grabWindow( myViewPort->winId() );
+ return px.convertToImage();
+}