#include "SVTK_ViewWindow.h"
#include "SVTK_ViewModel.h"
-#include "SPlot2d_ViewModel.h"
+#include "SVTK_RenderWindow.h"
+#include "SPlot2d_ViewModel.h"
#include "Plot2d_ViewFrame.h"
#include "Plot2d_ViewModel.h"
Update()
{}
+ class TSavePictureEvent: public SALOME_Event
+ {
+ SUIT_ViewWindow * myViewWindow;
+ const char * myFileName;
+ public:
+ typedef CORBA::Boolean TResult;
+ TResult myResult;
+ TSavePictureEvent (SUIT_ViewWindow * theViewWindow, const char * theFileName)
+ : myViewWindow(theViewWindow),
+ myFileName(theFileName),
+ myResult(false)
+ {
+ }
+
+ virtual void Execute()
+ {
+ if (myViewWindow) {
+ QImage img = myViewWindow->dumpView();
+ if (!img.isNull()) {
+ QString fileName (myFileName);
+ if (!fileName.isEmpty()) {
+ QString fmt = SUIT_Tools::extension(fileName).upper();
+ if (fmt.isEmpty()) fmt = QString("BMP"); // default format
+ if (fmt == "JPG" ) fmt = "JPEG";
+ //QApplication::setOverrideCursor(Qt::waitCursor);
+ img.save(fileName, fmt.latin1());
+ //QApplication::restoreOverrideCursor();
+ }
+ }
+ }
+ }
+ };
+
CORBA::Boolean
View_i::SavePicture(const char* theFileName)
{
- return false;
+ return ProcessEvent(new TSavePictureEvent (myViewWindow,theFileName));
}
const char*
// return aStudy;
//}
- class TSavePictureEvent: public SALOME_Event
- {
- QWidget* myWidget;
- const char* myFileName;
- public:
- typedef CORBA::Boolean TResult;
- TResult myResult;
- TSavePictureEvent (QWidget* theWidget, const char* theFileName)
- : myWidget(theWidget),
- myFileName(theFileName),
- myResult(false)
- {
- }
-
- virtual void Execute()
- {
- if (myWidget) {
- QPixmap px = QPixmap::grabWindow(myWidget->winId());
- if (!QString(myFileName).isNull()) {
- QString fmt = SUIT_Tools::extension(myFileName).upper();
- if (fmt.isEmpty())
- fmt = QString("BMP"); // default format
- if (fmt == "JPG")
- fmt = "JPEG";
- myResult = px.save(myFileName, fmt.latin1());
- }
- }
- }
- };
-
-
//===========================================================================
XYPlot_i::XYPlot_i (SalomeApp_Application* theApplication)
: View_i(theApplication, NULL)
ProcessVoidEvent(new TVoidMemFunEvent<Plot2d_ViewFrame> (myView,&Plot2d_ViewFrame::fitAll));
}
- CORBA::Boolean XYPlot_i::SavePicture (const char* theFileName)
- {
- return ProcessEvent(new TSavePictureEvent (myView->getViewWidget(),theFileName));
- }
+ //CORBA::Boolean XYPlot_i::SavePicture (const char* theFileName)
+ //{
+ // return ProcessEvent(new TSavePictureEvent (myView->getViewWidget(),theFileName));
+ //}
//===========================================================================
ProcessVoidEvent(new TEvent(myViewWindow));
}
- CORBA::Boolean View3D_i::SavePicture (const char* theFileName)
- {
- //jfa tmp:return ProcessEvent(new TSavePictureEvent(myView->getViewWidget(), theFileName));
- return false;
- }
+ //CORBA::Boolean View3D_i::SavePicture (const char* theFileName)
+ //{
+ // return ProcessEvent(new TSavePictureEvent(myViewWindow, theFileName));
+ //}
bool View3D_i::SaveViewParams (SUIT_ViewManager* theViewManager, const char* theName)
{