Salome HOME
ecc765b86fbebba0cee52d457fe705c6561724ee
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI.cxx
1 using namespace std;
2 //  File      : SUPERVGUI.cxx
3 //  Created   : 31 octobre 2001
4 //  Author    : Francis KLOSS
5 //  Project   : SALOME
6 //  Module    : SUPERVGUI
7 //  Copyright : CEA
8
9 #include "SUPERVGUI.h"
10
11 #include "QAD_Resource.h"
12 #include "QAD_FileDlg.h"
13 #include "QAD_Application.h"
14 #include "QAD_StudyFrame.h"
15 #include "QAD_RightFrame.h"
16 #include "QAD_LeftFrame.h"
17 #include "QAD_ViewFrame.h"
18 #include "QAD_ObjectBrowser.h"
19 #include "QAD_ObjectBrowserItem.h"
20 #include "SALOME_Selection.h"
21 #include "SALOMEGUI_NameDlg.h"            
22 #include "Utils_ORB_INIT.hxx"
23 #include "SALOME_ListIteratorOfListIO.hxx"
24 #include "SALOME_InteractiveObject.hxx"
25 #include <qapplication.h>
26 #include "SALOMEGUI_ImportOperation.h"
27
28 #include CORBA_SERVER_HEADER(SALOMEDS_Attributes)
29
30
31 int SUPERVGUI::factory = 0;
32 SUPERVGUI Supervision;
33
34
35 SUPERVGUI::SUPERVGUI(): QObject(),
36     desktop(0),
37     study(0),
38     engine(0),
39     browser(0)
40                         //info(0)
41 {
42     Trace("SUPERVGUI::SUPERVGUI")
43     if (factory==0) {
44         factory = 1;
45         MESSAGE("SUPERVGUI Info : factory build");
46     } else {
47         MESSAGE("SUPERVGUI Error : another call to factory constructor");
48     };
49 }
50
51 SUPERVGUI::~SUPERVGUI() {
52     Trace("SUPERVGUI::~SUPERVGUI")
53     if (factory==1) {
54         factory = 0;
55         //info->close();
56         browser->close();
57         MESSAGE("SUPERVGUI Info : factory destroy");
58     } else {
59         MESSAGE("SUPERVGUI Error : another call to factory destructor");
60     };
61 }
62
63 void SUPERVGUI::init(QAD_Desktop* parent) {
64     Trace("SUPERVGUI::init")
65     if (desktop==0) {
66         desktop = parent;
67         study = desktop->getActiveStudy();
68         SALOME_NamingService* namingService = desktop->getNameService();
69         loadEngine(namingService);
70         browser = new SUPERVGUI_Service(namingService);
71         //info    = new SUPERVGUI_Information();
72         cursor  = desktop->cursor();
73         connect(desktop->getMainFrame(), SIGNAL(windowActivated(QWidget*)), this, SLOT(setMain(QWidget*)));
74     };
75 }
76
77
78 QAD_StudyFrame* SUPERVGUI::createGraph() {
79   QAD_StudyFrame* aStudyFrame = study->newWindow3d(study->getNextStudyFrameName(),
80                                                    VIEW_GRAPHSUPERV, false);
81   if (aStudyFrame) {
82     connect(aStudyFrame, 
83             SIGNAL(sfBeforeStudyFrameClosing(QAD_StudyFrame*)), 
84             &Supervision, 
85             SLOT(onGraphClosed(QAD_StudyFrame*)));
86   }
87   return aStudyFrame;
88 }
89
90
91
92 void SUPERVGUI::loadEngine(SALOME_NamingService* namingService) {
93     Trace("SUPERVGUI::loadEngine")
94     SALOME_LifeCycleCORBA LCC(namingService);
95     Engines::Component_var objComponent = LCC.FindOrLoad_Component("SuperVisionContainer", "SUPERV");
96     if (CORBA::is_nil(objComponent)) {
97         QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_LOAD_SUPERV"));
98         return;
99     };
100
101     SUPERV::SuperG_var aSuperVisionComponent;
102     aSuperVisionComponent = SUPERV::SuperG::_narrow(objComponent);
103     if (CORBA::is_nil(aSuperVisionComponent)) {
104         QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_CANT_NARROW_SUPERV"));
105         return;
106     };
107
108     engine  = new SUPERV::SuperG_var;
109     *engine = aSuperVisionComponent;
110 }
111 /*
112 bool SUPERVGUI::information(SUPERV_CNode node, bool isReadOnly) {
113     Trace("SUPERVGUI::information")
114     return(info->run(node, isReadOnly));
115 }
116 */
117 void SUPERVGUI::putInfo(const char* mess) {
118     Trace("SUPERVGUI::putInfo")
119     desktop->putInfo(mess);
120 }
121
122 QAD_Desktop* SUPERVGUI::getDesktop() {
123     Trace("SUPERVGUI::getDesktop")
124     return(desktop);
125 }
126
127 SUPERV_Engine SUPERVGUI::getEngine() {
128     Trace("SUPERVGUI::getEngine")
129     return(engine);
130 }
131
132 SUPERVGUI_Service* SUPERVGUI::getBrowser() {
133     Trace("SUPERVGUI::getBrowser")
134     return(browser);
135 }
136
137 QCursor SUPERVGUI::getCursor() {
138     Trace("SUPERVGUI::getCursor")
139     return(cursor);
140 }
141
142 SUPERVGUI_Main* SUPERVGUI::getMain() {
143     Trace("SUPERVGUI::getMain")
144     return main;
145 }
146
147
148 void SUPERVGUI::registerGraph(QString theName, SUPERVGUI_Main* theGraph){
149   theGraph->setHashCode(theName);
150   myGraphList.append(theGraph);
151 }
152
153
154 void SUPERVGUI::unregisterGraph(SUPERVGUI_Main* theGraph) {
155   SUPERVGUI_Main* aMain;
156   for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
157     if (aMain == theGraph)
158       myGraphList.remove(aMain);
159   }
160 }
161
162
163 bool SUPERVGUI::isContains(QAD_Study* theStudy, const QString theKey) {
164   SUPERVGUI_Main* aMain;
165   for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
166     if ((aMain->getStudy() == theStudy) && (aMain->getHashCode() == theKey))
167       return true;
168   }
169   return false;
170 }
171
172
173 void SUPERVGUI::onGraphClosed(QAD_StudyFrame* theStudyFrame) {
174   QAD_ViewFrame* viewFrame = theStudyFrame->getRightFrame()->getViewFrame();
175   if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast<SUPERVGraph_ViewFrame*>(viewFrame)){
176     disconnect(theStudyFrame, 0 , this, 0);
177     SUPERVGraph_View* view = supervFrame->getViewWidget();
178     SUPERVGUI_Main* aGraph = dynamic_cast<SUPERVGUI_Main*>(view);
179     if (aGraph) {
180       unregisterGraph(aGraph);
181     }
182   }
183 }
184
185 void SUPERVGUI::setMain(QWidget* w) {
186   main = 0;
187   QAD_StudyFrame* aStudyFrame = dynamic_cast<QAD_StudyFrame*>(w);
188   if (!aStudyFrame) return;
189
190   study = aStudyFrame->getStudy();
191   if (!study) return;
192
193   QAD_ViewFrame* viewFrame = aStudyFrame->getRightFrame()->getViewFrame();
194   if(SUPERVGraph_ViewFrame* supervFrame = dynamic_cast<SUPERVGraph_ViewFrame*>(viewFrame)){
195     SUPERVGraph_View* view = supervFrame->getViewWidget();
196     if (view)
197       main = dynamic_cast<SUPERVGUI_Main*>(view);
198   }
199   Trace("SUPERVGUI::setMain - main: "<<main);
200 }
201
202
203 void SUPERVGUI::importDataflow() {
204   Trace("SUPERVGUI::importDataflow");
205   QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
206                                        "",
207                                        "*.xml",
208                                        tr("MSG_IMPORT"),
209                                        true);
210   
211   if (!f.isEmpty()) {
212     if (isContains(study, f)) {
213       if (QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), 
214                                tr("MSG_GRAPH_DISPLAYED").arg(f), 
215                                QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
216         return;
217     }
218
219     SUPERV_Graph aGraph = (*Supervision.getEngine())->GraphE(f);
220     //QFileInfo aFile(f);
221     //aGraph->SetName(aFile.baseName());
222     if (SUPERV_isNull(aGraph)) {
223       QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f));
224       return;
225     }
226
227     QAD_StudyFrame* aStudyFrame = createGraph();
228     SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
229       (aStudyFrame->getRightFrame()->getViewFrame());
230     if(aViewFrame) {
231       main = new SUPERVGUI_Main(aViewFrame, desktop, aGraph);
232       registerGraph(f, main);
233       study->showFrame(aStudyFrame);
234     }   
235   }
236 }
237
238 void SUPERVGUI::displayDataflow() {
239     Trace("SUPERVGUI::displayDataflow");
240     QAD_ObjectBrowser* aBrowser = ((QAD_StudyFrame*)(desktop->getMainFrame()->activeWindow()))->getLeftFrame()->getObjectBrowser();
241     SUPERV_Graph aDataFlow;
242     QString aIORName;
243
244     QAD_ObjectBrowserItem* item = (QAD_ObjectBrowserItem*)(aBrowser->getListView()->currentItem());
245     SALOMEDS::SObject_var aObj = desktop->getActiveStudy()->getStudyDocument()->FindObjectID(item->getEntry().latin1());
246     SALOMEDS::GenericAttribute_var anAttr;
247     if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
248       SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
249       Standard_CString ior = anIOR->Value();
250       aIORName = ior;
251       if (isContains(study, aIORName)) {
252         if (QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), 
253                                  tr("MSG_GRAPH_DISPLAYED").arg(""), 
254                                  QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
255           return;
256       }
257       aDataFlow = (*Supervision.getEngine())->getGraph(ior);
258       if (SUPERV_isNull(aDataFlow)) {
259         QMessageBox::warning(0, tr("ERROR"), tr("MSG_ACCESS_BAD_IOR"));
260         return;
261       }
262     }
263     QAD_StudyFrame* aStudyFrame = createGraph();
264     SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
265       (aStudyFrame->getRightFrame()->getViewFrame());
266     if(aViewFrame) {
267       main = new SUPERVGUI_Main(aViewFrame, desktop, aDataFlow);
268       main->setAsFromStudy(true);
269       registerGraph(aIORName, main);
270       study->showFrame(aStudyFrame);
271     }
272 }
273
274
275 void SUPERVGUI::renameDataflow() {
276   SALOME_Selection* Sel = SALOME_Selection::Selection( study->getSelection() );
277   SALOME_ListIteratorOfListIO It( Sel->StoredIObjects() );
278   for ( ; It.More(); It.Next() ) {
279     Handle(SALOME_InteractiveObject) IObject = It.Value();
280     
281     SALOMEDS::Study_var aStudy = study->getStudyDocument();
282     SALOMEDS::SObject_var obj = aStudy->FindObjectID( IObject->getEntry() );
283     SALOMEDS::GenericAttribute_var anAttr;
284     SALOMEDS::AttributeName_var    aName;
285     if ( !obj->_is_nil() ) {
286       if (obj->FindAttribute(anAttr, "AttributeName")) {
287         aName = SALOMEDS::AttributeName::_narrow(anAttr);
288         QString nm = QString( aName->Value() );
289         bool ok = FALSE;
290         nm = SALOMEGUI_NameDlg::getName( QAD_Application::getDesktop(), nm );
291         if ( !nm.isEmpty() ) {
292           QApplication::setOverrideCursor( Qt::waitCursor );
293           study->renameIObject( IObject, nm );
294           QApplication::restoreOverrideCursor();
295         }
296       }
297     }
298   }
299 }
300
301
302 void SUPERVGUI::exportDataflow() {
303     Trace("SUPERVGUI::exportDataflow")
304     if (main==0) {
305         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_EXPORT"));
306     } else {
307       QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
308                                            "",
309                                            "*.xml",
310                                            tr("TTL_EXPORT_DATAFLOW"),
311                                            false);
312       if (!f.isEmpty()) {
313         if (main->exportDataflow(f)) {
314           unregisterGraph(main);
315           registerGraph(f, main);
316         }
317       }
318     }
319 }
320
321 void SUPERVGUI::newDataflow() {
322     Trace("SUPERVGUI::editDataflow");
323     QAD_StudyFrame* aStudyFrame = createGraph();
324     SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
325       (aStudyFrame->getRightFrame()->getViewFrame());
326     if(aViewFrame){
327       main = new SUPERVGUI_Main(aViewFrame, desktop, false);
328       main->addNode();
329       study->showFrame(aStudyFrame);
330     }
331 }
332
333 void SUPERVGUI::modifyDataflow() {
334     Trace("SUPERVGUI::modifyDataflow")
335     QString f = QAD_FileDlg::getFileName(QAD_Application::getDesktop(),
336                                          "",
337                                          "*.xml",
338                                          tr("Modify Dataflow"),
339                                          true);
340     if (!f.isEmpty()){
341       if (isContains(study, f)) {
342       if (QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), 
343                                tr("MSG_GRAPH_DISPLAYED").arg(f), 
344                                QMessageBox::Yes, QMessageBox::No) == QMessageBox::No)
345         return;
346       }
347       
348       SUPERV_Graph aGraph = (*Supervision.getEngine())->Graph(f);
349       //QFile aFile(f);
350       //aGraph->SetName(aFile.name());
351       if (SUPERV_isNull(aGraph)) {
352         QMessageBox::warning(QAD_Application::getDesktop(), tr("ERROR"), tr("MSG_BAD_FILE").arg(f));
353         return;
354       }
355
356       QAD_StudyFrame* aStudyFrame = createGraph();
357       SUPERVGraph_ViewFrame* aViewFrame = dynamic_cast<SUPERVGraph_ViewFrame*>
358         (aStudyFrame->getRightFrame()->getViewFrame());
359       if(aViewFrame) {
360         main = new SUPERVGUI_Main(aViewFrame, desktop, aGraph);
361         registerGraph(f, main);
362         study->showFrame(aStudyFrame);
363       }
364     }
365 }
366
367 void SUPERVGUI::reloadDataflow() {
368     Trace("SUPERVGUI::reloadDataflow")
369     if (main==0) {
370         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RELOAD"));
371     } else {
372         main->sync();
373     };
374 }
375
376 void SUPERVGUI::runDataflow() {
377     Trace("SUPERVGUI::runDataflow")
378     if (main==0) {
379         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
380     } else {
381         main->run();
382     };
383 }
384
385 void SUPERVGUI::stepByStep() {
386     Trace("SUPERVGUI::stepByStep")
387     if (main==0) {
388         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_RUN"));
389     } else {
390         main->startExecute();
391     }
392 }
393
394 void SUPERVGUI::killDataflow() {
395     Trace("SUPERVGUI::killDataflow")
396     if (main==0) {
397         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_KILL"));
398     } else {
399         main->kill();
400     };
401 }
402
403 void SUPERVGUI::suspendResumeDataflow() {
404     Trace("SUPERVGUI::suspendResumeDataflow")
405     if (main==0) {
406         QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_SUSPEND"));
407     } else {
408         main->suspendResume();
409     };
410 }
411
412 void SUPERVGUI::showComponents() {
413   Trace("SUPERVGUI::showComponents");
414   if (main==0) {
415     QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOWINDOW_TO_ADD"));
416   } else {
417     if (main->isEditable())
418       main->addNode();
419     else
420       QMessageBox::warning(QAD_Application::getDesktop(), tr("WARNING"), tr("MSG_NOTEDITABLE"));
421   }
422 }
423
424 void SUPERVGUI::customPopup(QPopupMenu* popup) {
425   Trace("SUPERVGUI::customPopup");
426   if(popup->count() > 3) {
427     // Temporary code: is to be deleted soon
428     popup->removeItem(QAD_Display_Popup_ID);
429     popup->removeItem(QAD_DisplayOnly_Popup_ID);
430     popup->removeItem(QAD_Erase_Popup_ID);
431     int id = popup->idAt(popup->count() - 1);
432     if (id < 0 && id != -1) popup->removeItem(id); // separator
433     // Temporary code end
434   }
435     SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
436     if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
437
438     Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
439
440     // insert SUPERV-specific popup items here
441
442     bool isDataflow, ownObj;
443     whatIsSelected(anIObj, ownObj, isDataflow);
444     
445     if (isDataflow) {
446       popup->insertItem(tr( "MSG_RENAME" ), this, SLOT(renameDataflow()));
447       popup->insertItem("Display", this, SLOT(displayDataflow()));
448       popup->insertSeparator();
449     }
450     if (ownObj)
451       popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject()));
452 }
453
454  
455
456 /** Returns:
457     theIsOwner = true if Selected object belongs to Suipervision.
458     theIsDataflow = true if Selected object is Dataflow
459 */
460 void SUPERVGUI::whatIsSelected(const Handle(SALOME_InteractiveObject)& theObj, bool& theIsOwner, bool& theIsDataflow) {
461   theIsOwner = false;
462   theIsDataflow = false;
463
464   if (theObj.IsNull()) return;
465   
466   SALOMEDS::Study_var aStudy = study->getStudyDocument();
467   SALOMEDS::SObject_var  obj = aStudy->FindObjectID( theObj->getEntry() );
468
469   if ( !obj->_is_nil() ) {
470     SALOMEDS::SComponent_var comp = obj->GetFatherComponent();
471     if ( !comp->_is_nil() ) {
472       SALOMEDS::GenericAttribute_var anAttr;
473       SALOMEDS::AttributeName_var    aName;
474       if (comp->FindAttribute(anAttr, "AttributeName")) {
475         aName = SALOMEDS::AttributeName::_narrow(anAttr);
476         QString compName(aName->Value());
477         //      if (compName.compare(STUDY_SUPERVISION) == 0) {
478         if (compName.compare( QAD_Application::getDesktop()->getComponentUserName( "SUPERV" ) ) == 0) {
479           SALOMEDS::GenericAttribute_var anAttr;
480           if (obj->FindAttribute(anAttr, "AttributeIOR")) {
481             SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
482             SUPERV_Graph aDataFlow = (*Supervision.getEngine())->getGraph(anIOR->Value());
483             if (!SUPERV_isNull(aDataFlow)) 
484               theIsDataflow = true;
485           }
486           CORBA::String_var anObjectID = obj->GetID();
487           CORBA::String_var aComponentID = comp->GetID();
488           if (strcmp(anObjectID, aComponentID)) theIsOwner = true;          
489         }
490       }
491     }
492   }
493 }
494
495
496 void SUPERVGUI::deleteObject() {
497   SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
498   if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
499   
500   Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
501   bool aIsOwner, aIsDataflow;
502   whatIsSelected(anIObj, aIsOwner, aIsDataflow);
503
504   if (!aIsOwner) return;
505
506   if (QMessageBox::warning(QAD_Application::getDesktop(),
507                            tr("WARNING"),
508                            tr("MSG_ASK_DELETE"),
509                            QMessageBox::No,
510                            QMessageBox::Yes) == QMessageBox::No)
511     return;
512   
513   SALOMEDS::Study_var aStudy = study->getStudyDocument();
514   SALOMEDS::SObject_var  aObj = aStudy->FindObjectID( anIObj->getEntry() );
515   if (!aObj->_is_nil()) {
516     if (aIsDataflow) {
517       SALOMEDS::GenericAttribute_var anAttr;
518       if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
519         SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
520         QString ior = anIOR->Value();
521         
522         SUPERVGUI_Main* aMain;
523         for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
524           if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
525             aMain->setAsFromStudy(false);
526             break;
527           }
528         }
529       }
530     }
531     QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
532     SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
533     op->start();
534     aBuilder->RemoveObjectWithChildren(aObj);
535     op->finish();
536   }
537   Sel->ClearIObjects() ; 
538 }
539
540
541
542 void SUPERVGUI::activeStudyChanged() {
543   Trace("SUPERVGUI::activeStudyChanged");
544   study = desktop->getActiveStudy();
545 }
546
547 extern "C" bool OnGUIEvent(int command, QAD_Desktop* parent) {
548     Supervision.init(parent);
549     switch (command) {
550         case 301: 
551             Supervision.importDataflow();
552             return(false);
553         
554         case 302: 
555             Supervision.exportDataflow();
556             return(false);
557         
558         case 303: 
559             Supervision.newDataflow();
560             return(false);
561         
562         case 304: 
563             Supervision.modifyDataflow();
564             return(false);
565         
566         case 305:
567             Supervision.reloadDataflow();
568             return(false);
569         
570         case 306:
571             Supervision.runDataflow();
572             return(false);
573         
574         case 307: 
575             Supervision.killDataflow();
576             return(false);
577         
578         case 308:
579             Supervision.suspendResumeDataflow();
580             return(false);
581         
582         case 309: 
583             Supervision.showComponents();
584             return(false);
585         
586         case 310: 
587             Supervision.stepByStep();
588             return(false);
589         
590         default: 
591             QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome");
592             return(false);
593         
594     }
595 }
596
597 extern "C" bool OnKeyPress(QKeyEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
598     return(false);
599 }
600
601 extern "C" bool OnMousePress(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
602     return(false);
603 }
604
605 extern "C" bool OnMouseMove(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
606     return(false);
607 }
608
609 extern "C" bool OnPopupGUIEvent(int theCommandID, QAD_Desktop* parent) {
610     return(false);
611 }
612
613 extern "C" bool SetSettings(QAD_Desktop* parent) {
614     Trace("extern SUPERVGUI::SetSettings")
615     Supervision.init(parent);
616     return(true);
617 }
618
619 extern "C" void definePopup(QString& theContext, QString& theParent, QString& theObject) {
620     theObject  = "";
621     theContext = "";
622 }
623
624 extern "C" bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) {
625     Supervision.init(parent);
626     Supervision.customPopup(popup);
627     return(true);
628 }
629
630 extern "C" void activeStudyChanged(QAD_Desktop* parent) {
631     Supervision.activeStudyChanged();
632 }
633
634 extern "C" int supportedViewType()
635 {
636   return (int)VIEW_GRAPHSUPERV;
637 }