Salome HOME
NRI : Add KERNEL_ROOT_DIR in addition to SALOME_[ROOT, SITE]_DIR.
[modules/kernel.git] / src / SUPERVGraph / SUPERVGraph_ViewFrame.cxx
1 using namespace std;
2 //  File      : SUPERVGraph_ViewFrame.cxx
3 //  Created   : Wed Mar 20 14:03:31 2002
4 //  Author    : Nicolas REJNERI
5 //  Project   : SALOME
6 //  Module    : SUPERVGraph
7 //  Copyright : Open CASCADE 2002
8 //  $Header$
9
10
11 #include "SUPERVGraph_ViewFrame.h"
12
13 #include "QAD_Settings.h"
14 #include "QAD_Config.h"
15 #include "QAD_Application.h"
16 #include "QAD_Desktop.h"
17 #include "SALOME_Selection.h"
18
19 #include "utilities.h"
20
21 //QT Include
22 #include <qlayout.h>
23 #include <qcolordialog.h>
24
25 SUPERVGraph_View::SUPERVGraph_View(QWidget* theParent): QWidget(theParent){
26   init(theParent);
27 }
28 SUPERVGraph_View::SUPERVGraph_View(SUPERVGraph_View* theParent): QWidget(theParent){
29   setPopupServer(theParent->getPopupServer());
30   init(theParent);
31 }
32 void SUPERVGraph_View::init(QWidget* theParent){
33   if ( theParent->inherits( "QMainWindow" ) ) {
34     ( ( QMainWindow* )theParent )->setCentralWidget( this );
35   }
36   else {
37     QBoxLayout* layout = new QVBoxLayout( theParent );
38     layout->addWidget( this );
39   }
40
41 }
42 void SUPERVGraph_View::onCreatePopup(){
43   /*
44   if ( myPopup ) {      
45     QAD_Desktop*     Desktop = (QAD_Desktop*) QAD_Application::getDesktop();
46     QAD_Study*   ActiveStudy = Desktop->getActiveStudy();
47     SALOME_Selection*      Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() );
48     
49     QString theContext;
50     QString theParent("Viewer");
51     QString theObject;
52     
53     Desktop->definePopup( theContext, theParent, theObject );
54     Desktop->createPopup( myPopup, theContext, theParent, theObject);
55     Desktop->customPopup( myPopup, theContext, theParent, theObject );
56     if (Sel->IObjectCount() == 0 && myPopup->count()<1) {
57       int id;
58       myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) );    
59       QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) );
60     }
61   }
62   */
63  }
64 /*!
65     Constructor
66 */
67 SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame(QWidget* parent, const char* name) 
68   : QAD_ViewFrame(parent, name)
69 {
70   myView = 0;
71   //myView = new SUPERVGraph_View(this); 
72   // Set BackgroundColor
73   /*
74   int R = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorRed").toInt();
75   int G = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorGreen").toInt();
76   int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt();
77   setBackgroundColor(QColor(R,G,B));*/
78 }
79 SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame(){}
80
81 /*!
82   Returns widget containing 3D-Viewer
83 */
84 SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget(){
85   return myView;
86 }
87
88
89 void SUPERVGraph_ViewFrame::setViewWidget(SUPERVGraph_View* theView) {
90   myView = theView;
91   if (myApp) {
92     myView->setPopupServer(myApp);
93   }
94 }
95
96
97 /*!
98   Display/hide Trihedron
99 */
100 void SUPERVGraph_ViewFrame::onViewTrihedron()
101 {
102   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTrihedron" )
103 }
104
105 /*!
106   Provides top projection of the active view
107 */
108 void SUPERVGraph_ViewFrame::onViewTop()
109 {
110   MESSAGE ( "SUPERVGraph_ViewFrame::onViewTop" )
111 }
112
113 /*!
114   Provides bottom projection of the active view
115 */
116 void SUPERVGraph_ViewFrame::onViewBottom()
117 {
118   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBottom" )
119 }
120
121 /*!
122   Provides left projection of the active view
123 */
124 void SUPERVGraph_ViewFrame::onViewLeft()    
125 {
126   MESSAGE ( "SUPERVGraph_ViewFrame::onViewLeft" )
127 }
128
129 /*!
130   Provides right projection of the active view
131 */
132 void SUPERVGraph_ViewFrame::onViewRight()
133 {
134   MESSAGE ( "SUPERVGraph_ViewFrame::onViewRight" )
135 }
136
137 /*!
138   Provides back projection of the active view
139 */
140 void SUPERVGraph_ViewFrame::onViewBack()
141 {
142   MESSAGE ( "SUPERVGraph_ViewFrame::onViewBack" )
143 }
144
145 /*!
146   Provides front projection of the active view
147 */
148 void SUPERVGraph_ViewFrame::onViewFront()
149 {
150   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFront" )
151 }
152
153 /*!
154   Reset the active view
155 */
156 void SUPERVGraph_ViewFrame::onViewReset()    
157 {
158   MESSAGE ( "SUPERVGraph_ViewFrame::onViewReset" )
159     if (myView)
160       myView->ResetView();
161 }
162
163 /*!
164   Rotates the active view
165 */
166 void SUPERVGraph_ViewFrame::onViewRotate()
167 {
168    MESSAGE ( "SUPERVGraph_ViewFrame::onViewRotate" )
169 }
170
171 /*!
172   Sets a new center of the active view
173 */
174 void SUPERVGraph_ViewFrame::onViewGlobalPan()
175 {
176    MESSAGE ( "SUPERVGraph_ViewFrame::onViewGlobalPan" )
177 }
178
179 /*!
180   Zooms the active view
181 */
182 void SUPERVGraph_ViewFrame::onViewZoom()
183 {
184   MESSAGE ( "SUPERVGraph_ViewFrame::onViewZoom" )
185 }
186
187 /*!
188   Moves the active view
189 */
190 void SUPERVGraph_ViewFrame::onViewPan()
191 {
192   MESSAGE ( "SUPERVGraph_ViewFrame::onViewPan" )
193     if (myView != NULL)
194       myView->ActivatePanning();
195 }
196
197 /*!
198   Fits all obejcts within a rectangular area of the active view
199 */
200 void SUPERVGraph_ViewFrame::onViewFitArea()
201 {
202   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitArea" )
203 }
204
205 /*!
206   Fits all objects in the active view
207 */
208 void SUPERVGraph_ViewFrame::onViewFitAll()
209 {
210   MESSAGE ( "SUPERVGraph_ViewFrame::onViewFitAll" )
211 }
212
213 /*!
214     Set background of the viewport
215 */
216 void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color)
217 {
218     if (myView)
219       myView->setPaletteBackgroundColor(color);
220 }
221
222 /*!
223     Returns background of the viewport
224 */
225 QColor SUPERVGraph_ViewFrame::backgroundColor() const
226 {
227   if (myView)
228     return myView->paletteBackgroundColor();
229   return QMainWindow::backgroundColor();
230 }
231
232
233 void SUPERVGraph_ViewFrame::SetSelectionMode( int mode )
234 {
235   MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" )
236 }
237
238 void SUPERVGraph_ViewFrame::SetTrihedronSize( int dim )
239 {
240   MESSAGE ( "SUPERVGraph_ViewFrame::SetTrihedronSize" )  
241 }
242
243 void SUPERVGraph_ViewFrame::rename( const Handle(SALOME_InteractiveObject)& IObject, 
244                                     QString newName )
245 {
246   MESSAGE ( "SUPERVGraph_ViewFrame::rename" )
247 }
248
249 void SUPERVGraph_ViewFrame::unHighlightAll() 
250 {
251   MESSAGE ( "SUPERVGraph_ViewFrame::unHighlightAll" )
252 }
253
254 void SUPERVGraph_ViewFrame::highlight( const Handle(SALOME_InteractiveObject)& IObject, 
255                                        bool highlight, bool immediatly ) 
256 {
257   MESSAGE ( "SUPERVGraph_ViewFrame::highlight" )
258 }
259
260 bool SUPERVGraph_ViewFrame::isInViewer( const Handle(SALOME_InteractiveObject)& IObject ) 
261 {
262   MESSAGE ( "SUPERVGraph_ViewFrame::isInViewer" )
263   return false;
264 }
265
266 bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& IObject ) 
267 {
268   MESSAGE ( "SUPERVGraph_ViewFrame::isVisible" )
269   return false;
270 }
271
272 void SUPERVGraph_ViewFrame::setPopupServer( QAD_Application* App )
273 {
274   myApp = App;
275   if (myView) {
276     myView->setPopupServer(myApp);
277   }
278 }
279
280 void SUPERVGraph_ViewFrame::undo(SALOMEDS::Study_var aStudy,
281                                  const char* StudyFrameEntry)
282 {
283   MESSAGE ( "SUPERVGraph_ViewFrame::undo" )
284 }
285
286 void SUPERVGraph_ViewFrame::redo(SALOMEDS::Study_var aStudy,
287                                  const char* StudyFrameEntry)
288 {
289   MESSAGE ( "SUPERVGraph_ViewFrame::redo" )
290 }
291