]> SALOME platform Git repositories - modules/superv.git/blob - src/SUPERVGUI/SUPERVGUI.cxx
Salome HOME
16526a35ffb178ca12eb17380af594b30f4d7507
[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           SALOMEDS::GenericAttribute_var anAttr;
479           if (obj->FindAttribute(anAttr, "AttributeIOR")) {
480             SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
481             SUPERV_Graph aDataFlow = (*Supervision.getEngine())->getGraph(anIOR->Value());
482             if (!SUPERV_isNull(aDataFlow)) 
483               theIsDataflow = true;
484           }
485           CORBA::String_var anObjectID = obj->GetID();
486           CORBA::String_var aComponentID = comp->GetID();
487           if (strcmp(anObjectID, aComponentID)) theIsOwner = true;          
488         }
489       }
490     }
491   }
492 }
493
494
495 void SUPERVGUI::deleteObject() {
496   SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() );
497   if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return;
498   
499   Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject();
500   bool aIsOwner, aIsDataflow;
501   whatIsSelected(anIObj, aIsOwner, aIsDataflow);
502
503   if (!aIsOwner) return;
504
505   if (QMessageBox::warning(QAD_Application::getDesktop(),
506                            tr("WARNING"),
507                            tr("MSG_ASK_DELETE"),
508                            QMessageBox::No,
509                            QMessageBox::Yes) == QMessageBox::No)
510     return;
511   
512   SALOMEDS::Study_var aStudy = study->getStudyDocument();
513   SALOMEDS::SObject_var  aObj = aStudy->FindObjectID( anIObj->getEntry() );
514   if (!aObj->_is_nil()) {
515     if (aIsDataflow) {
516       SALOMEDS::GenericAttribute_var anAttr;
517       if (aObj->FindAttribute(anAttr, "AttributeIOR")) {
518         SALOMEDS::AttributeIOR_var anIOR = SALOMEDS::AttributeIOR::_narrow(anAttr);
519         QString ior = anIOR->Value();
520         
521         SUPERVGUI_Main* aMain;
522         for (aMain = myGraphList.first(); aMain; aMain = myGraphList.next()) {
523           if ((aMain->getStudy() == study) && (aMain->getHashCode() == ior)) {
524             aMain->setAsFromStudy(false);
525             break;
526           }
527         }
528       }
529     }
530     QAD_Operation* op = new SALOMEGUI_ImportOperation( study );
531     SALOMEDS::StudyBuilder_var aBuilder = aStudy->NewBuilder();
532     op->start();
533     aBuilder->RemoveObjectWithChildren(aObj);
534     op->finish();
535   }
536   Sel->ClearIObjects() ; 
537 }
538
539
540
541 void SUPERVGUI::activeStudyChanged() {
542   Trace("SUPERVGUI::activeStudyChanged");
543   study = desktop->getActiveStudy();
544 }
545
546 extern "C" bool OnGUIEvent(int command, QAD_Desktop* parent) {
547     Supervision.init(parent);
548     switch (command) {
549         case 301: 
550             Supervision.importDataflow();
551             return(false);
552         
553         case 302: 
554             Supervision.exportDataflow();
555             return(false);
556         
557         case 303: 
558             Supervision.newDataflow();
559             return(false);
560         
561         case 304: 
562             Supervision.modifyDataflow();
563             return(false);
564         
565         case 305:
566             Supervision.reloadDataflow();
567             return(false);
568         
569         case 306:
570             Supervision.runDataflow();
571             return(false);
572         
573         case 307: 
574             Supervision.killDataflow();
575             return(false);
576         
577         case 308:
578             Supervision.suspendResumeDataflow();
579             return(false);
580         
581         case 309: 
582             Supervision.showComponents();
583             return(false);
584         
585         case 310: 
586             Supervision.stepByStep();
587             return(false);
588         
589         default: 
590             QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome");
591             return(false);
592         
593     }
594 }
595
596 extern "C" bool OnKeyPress(QKeyEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
597     return(false);
598 }
599
600 extern "C" bool OnMousePress(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
601     return(false);
602 }
603
604 extern "C" bool OnMouseMove(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) {
605     return(false);
606 }
607
608 extern "C" bool OnPopupGUIEvent(int theCommandID, QAD_Desktop* parent) {
609     return(false);
610 }
611
612 extern "C" bool SetSettings(QAD_Desktop* parent) {
613     Trace("extern SUPERVGUI::SetSettings")
614     Supervision.init(parent);
615     return(true);
616 }
617
618 extern "C" void definePopup(QString& theContext, QString& theParent, QString& theObject) {
619     theObject  = "";
620     theContext = "";
621 }
622
623 extern "C" bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) {
624     Supervision.init(parent);
625     Supervision.customPopup(popup);
626     return(true);
627 }
628
629 extern "C" void activeStudyChanged(QAD_Desktop* parent) {
630     Supervision.activeStudyChanged();
631 }
632
633 extern "C" int supportedViewType()
634 {
635   return (int)VIEW_GRAPHSUPERV;
636 }