Salome HOME
SMH: Add again in binary mode
[modules/gui.git] / src / SUPERVGraph / SUPERVGraph_ViewFrame.cxx
1 //  SALOME SUPERVGraph : build Supervisor viewer into desktop
2 //
3 //  Copyright (C) 2003  OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN,
4 //  CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS 
5 // 
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. 
10 // 
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. 
15 // 
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 
19 // 
20 //  See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org 
21 //
22 //
23 //
24 //  File   : SUPERVGraph_ViewFrame.cxx
25 //  Author : Nicolas REJNERI
26 //  Module : SALOME
27 //  $Header$
28
29 using namespace std;
30 #include "SUPERVGraph_ViewFrame.h"
31
32 #include "utilities.h"
33
34 //QT Include
35 #include <qlayout.h>
36 #include <qcolordialog.h>
37
38
39 SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent )
40 {
41   init(theParent);
42 }
43
44 SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent )
45 {
46   init(theParent);
47 }
48
49 void SUPERVGraph_View::contextMenuPopup( QPopupMenu* )
50 {
51   // to be implemented
52 }
53
54 void SUPERVGraph_View::init( QWidget* theParent )
55 {
56   if ( theParent->inherits( "QMainWindow" ) ) {
57     ( ( QMainWindow* )theParent )->setCentralWidget( this );
58   }
59   else {
60     QBoxLayout* layout = new QVBoxLayout( theParent );
61     layout->addWidget( this );
62   }
63
64 }
65
66 /*!
67     Constructor
68 */
69 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop ) 
70   : SUIT_ViewWindow( theDesktop )
71 {
72   myView = 0;
73
74   //myView = new SUPERVGraph_View(this); 
75   // Set BackgroundColor
76   /*
77   int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
78   int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
79   int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
80   setBackgroundColor(QColor(R,G,B));*/
81 }
82
83 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {}
84
85 /*!
86   Returns widget containing 3D-Viewer
87 */
88 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget()
89 {
90   return myView;
91 }
92
93
94 void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView )
95 {
96   myView = theView;
97 }
98
99
100 /*!
101   Display/hide Trihedron
102 */
103 void SUPERVGraph_ViewFrame::onViewTrihedron()
104 {
105   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
106 }
107
108 /*!
109   Provides top projection of the active view
110 */
111 void SUPERVGraph_ViewFrame::onViewTop()
112 {
113   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
114 }
115
116 /*!
117   Provides bottom projection of the active view
118 */
119 void SUPERVGraph_ViewFrame::onViewBottom()
120 {
121   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
122 }
123
124 /*!
125   Provides left projection of the active view
126 */
127 void SUPERVGraph_ViewFrame::onViewLeft()    
128 {
129   MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
130 }
131
132 /*!
133   Provides right projection of the active view
134 */
135 void SUPERVGraph_ViewFrame::onViewRight()
136 {
137   MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
138 }
139
140 /*!
141   Provides back projection of the active view
142 */
143 void SUPERVGraph_ViewFrame::onViewBack()
144 {
145   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
146 }
147
148 /*!
149   Provides front projection of the active view
150 */
151 void SUPERVGraph_ViewFrame::onViewFront()
152 {
153   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
154 }
155
156 /*!
157   Reset the active view
158 */
159 void SUPERVGraph_ViewFrame::onViewReset()    
160 {
161   MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
162     if (myView)
163       myView->ResetView();
164 }
165
166 /*!
167   Rotates the active view
168 */
169 void SUPERVGraph_ViewFrame::onViewRotate()
170 {
171    MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
172 }
173
174 /*!
175   Sets a new center of the active view
176 */
177 void SUPERVGraph_ViewFrame::onViewGlobalPan()
178 {
179    MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
180 }
181
182 /*!
183   Zooms the active view
184 */
185 void SUPERVGraph_ViewFrame::onViewZoom()
186 {
187   MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
188 }
189
190 /*!
191   Moves the active view
192 */
193 void SUPERVGraph_ViewFrame::onViewPan()
194 {
195   MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
196     if (myView != NULL)
197       myView->ActivatePanning();
198 }
199
200 /*!
201   Fits all obejcts within a rectangular area of the active view
202 */
203 void SUPERVGraph_ViewFrame::onViewFitArea()
204 {
205   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
206 }
207
208 /*!
209   Fits all objects in the active view
210 */
211 void SUPERVGraph_ViewFrame::onViewFitAll()
212 {
213   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
214 }
215
216 /*!
217     Set background of the viewport
218 */
219 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color )
220 {
221     if (myView)
222       myView->setPaletteBackgroundColor(color);
223 }
224
225 /*!
226     Returns background of the viewport
227 */
228 QColor SUPERVGraph_ViewFrame::backgroundColor() const
229 {
230   if (myView)
231     return myView->paletteBackgroundColor();
232   return QMainWindow::backgroundColor();
233 }
234
235 void SUPERVGraph_ViewFrame::onAdjustTrihedron()
236 {
237   MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" )  
238 }
239
240 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, 
241                                     QString newName )
242 {
243   MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
244 }
245
246 void SUPERVGraph_ViewFrame::unHighlightAll() 
247 {
248   MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
249 }
250
251 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject, 
252                                        bool highlight, bool immediatly ) 
253 {
254   MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
255 }
256
257 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) 
258 {
259   MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
260   return false;
261 }
262
263 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject ) 
264 {
265   MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
266   return false;
267 }
268
269 void SUPERVGraph_ViewFrame::undo( const _PTR(Study)& aStudy,
270                                   const char* StudyFrameEntry )
271 {
272   MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
273 }
274
275 void SUPERVGraph_ViewFrame::redo( const _PTR(Study)& aStudy,
276                                   const char* StudyFrameEntry )
277 {
278   MESSAGE ( "SUPERVGraph_ViewFrame::redo" )
279 }
280