1 // Plot2d_ViewModel.cxx: implementation of the Plot2d_ViewModel class.
3 //////////////////////////////////////////////////////////////////////
5 #include "Plot2d_ViewModel.h"
6 #include "Plot2d_ViewWindow.h"
9 Plot2d_Viewer::Plot2d_Viewer(bool theAutoDel)
13 myAutoDel = theAutoDel;
16 Plot2d_Viewer::~Plot2d_Viewer()
22 //*********************************************************************
23 SUIT_ViewWindow* Plot2d_Viewer::createView(SUIT_Desktop* theDesktop)
25 Plot2d_ViewWindow* aPlot2dView = new Plot2d_ViewWindow(theDesktop, this);
27 aPlot2dView->getViewFrame()->Display(myPrs);
31 //*********************************************************************
32 void Plot2d_Viewer::contextMenuPopup(QPopupMenu* thePopup)
34 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
36 aView->contextMenuPopup(thePopup);
38 if (thePopup->count() > 0) thePopup->insertSeparator();
39 thePopup->insertItem( tr( "MNU_DUMP_VIEW" ), this, SLOT(onDumpView()));
40 thePopup->insertItem( tr( "MEN_PLOT2D_CHANGE_BACKGROUND" ), this, SLOT(onChangeBgColor()));
43 if ( !aView->getToolBar()->isVisible() ) {
44 if (thePopup->count() > 0) thePopup->insertSeparator();
45 thePopup->insertItem("Show toolbar", this, SLOT(onShowToolbar()));
51 //*********************************************************************
52 void Plot2d_Viewer::setPrs(Plot2d_Prs* thePrs)
57 myPrs->setAutoDel(myAutoDel);
60 //*********************************************************************
61 void Plot2d_Viewer::update()
63 SUIT_ViewManager* aMgr = getViewManager();
64 QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
65 unsigned int aSize = aViews.size();
66 for (uint i = 0; i < aSize; i++) {
67 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
69 aView->getViewFrame()->Display(myPrs);
73 //*********************************************************************
74 void Plot2d_Viewer::clearPrs()
76 SUIT_ViewManager* aMgr = getViewManager();
77 QPtrVector<SUIT_ViewWindow> aViews = aMgr->getViews();
78 unsigned int aSize = aViews.size();
79 for (uint i = 0; i < aSize; i++) {
80 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)aViews[i];
82 aView->getViewFrame()->Erase(myPrs);
84 if (myAutoDel && myPrs) {
90 //*********************************************************************
91 void Plot2d_Viewer::setAutoDel(bool theDel)
95 myPrs->setAutoDel(theDel);
98 //*********************************************************************
99 void Plot2d_Viewer::onChangeBgColor()
101 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
104 Plot2d_ViewFrame* aViewFrame = aView->getViewFrame();
105 aViewFrame->onChangeBackground();
108 //*********************************************************************
109 void Plot2d_Viewer::onShowToolbar() {
110 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());
112 aView->getToolBar()->show();
115 //*********************************************************************
116 void Plot2d_Viewer::onDumpView()
118 Plot2d_ViewWindow* aView = (Plot2d_ViewWindow*)(myViewManager->getActiveView());