1 // SALOME SUPERVGraph : build Supervisor viewer into desktop
3 // Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 // CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS
6 // This library is free software; you can redistribute it and/or
7 // modify it under the terms of the GNU Lesser General Public
8 // License as published by the Free Software Foundation; either
9 // version 2.1 of the License.
11 // This library is distributed in the hope that it will be useful,
12 // but WITHOUT ANY WARRANTY; without even the implied warranty of
13 // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
14 // Lesser General Public License for more details.
16 // You should have received a copy of the GNU Lesser General Public
17 // License along with this library; if not, write to the Free Software
18 // Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
20 // See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org
24 // File : SUPERVGraph_ViewFrame.cxx
25 // Author : Nicolas REJNERI
29 #include "SUPERVGraph_ViewFrame.h"
31 #include "utilities.h"
35 #include <qcolordialog.h>
40 SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
45 SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
50 void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
55 void SUPERVGraph_View::init( QWidget* theParent )
57 if ( theParent->inherits( "QMainWindow" ) ) {
58 ( ( QMainWindow* )theParent )->setCentralWidget( this );
61 QBoxLayout* layout = new QVBoxLayout( theParent );
62 layout->addWidget( this );
70 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop )
71 : SUIT_ViewWindow( theDesktop )
75 //myView = new SUPERVGraph_View(this);
76 // Set BackgroundColor
78 int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
79 int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
80 int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
81 setBackgroundColor(QColor(R,G,B));*/
84 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
87 Returns widget containing 3D-Viewer
89 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget()
95 void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
102 Display/hide Trihedron
104 void SUPERVGraph_ViewFrame::onViewTrihedron()
106 MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
110 Provides top projection of the active view
112 void SUPERVGraph_ViewFrame::onViewTop()
114 MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
118 Provides bottom projection of the active view
120 void SUPERVGraph_ViewFrame::onViewBottom()
122 MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
126 Provides left projection of the active view
128 void SUPERVGraph_ViewFrame::onViewLeft()
130 MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
134 Provides right projection of the active view
136 void SUPERVGraph_ViewFrame::onViewRight()
138 MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
142 Provides back projection of the active view
144 void SUPERVGraph_ViewFrame::onViewBack()
146 MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
150 Provides front projection of the active view
152 void SUPERVGraph_ViewFrame::onViewFront()
154 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
158 Reset the active view
160 void SUPERVGraph_ViewFrame::onViewReset()
162 MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
168 Rotates the active view
170 void SUPERVGraph_ViewFrame::onViewRotate()
172 MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
176 Sets a new center of the active view
178 void SUPERVGraph_ViewFrame::onViewGlobalPan()
180 MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
184 Zooms the active view
186 void SUPERVGraph_ViewFrame::onViewZoom()
188 MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
192 Moves the active view
194 void SUPERVGraph_ViewFrame::onViewPan()
196 MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
198 myView->ActivatePanning();
202 Fits all obejcts within a rectangular area of the active view
204 void SUPERVGraph_ViewFrame::onViewFitArea()
206 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
210 Fits all objects in the active view
212 void SUPERVGraph_ViewFrame::onViewFitAll()
214 MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
218 Set background of the viewport
220 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color )
223 myView->setPaletteBackgroundColor(color);
227 Returns background of the viewport
229 QColor SUPERVGraph_ViewFrame::backgroundColor() const
232 return myView->paletteBackgroundColor();
233 return QMainWindow::backgroundColor();
236 void SUPERVGraph_ViewFrame::onAdjustTrihedron()
238 MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )
241 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject,
244 MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
247 void SUPERVGraph_ViewFrame::unHighlightAll()
249 MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
252 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject,
253 bool highlight, bool immediatly )
255 MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
258 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject )
260 MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
264 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject )
266 MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
270 void SUPERVGraph_ViewFrame::undo( const _PTR(Study)& aStudy,
271 const char* StudyFrameEntry )
273 MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
276 void SUPERVGraph_ViewFrame::redo( const _PTR(Study)& aStudy,
277 const char* StudyFrameEntry )
279 MESSAGE ( "SUPERVGraph_ViewFrame::redo" )
282 void SUPERVGraph_ViewFrame::resizeEvent( QResizeEvent* theEvent )
284 QMainWindow::resizeEvent( theEvent );
285 if ( myView ) myView->resizeView( theEvent );