From 170c87d16b79fe77bd587da27493b40fe5391f27 Mon Sep 17 00:00:00 2001 From: smh Date: Fri, 2 Apr 2004 14:21:19 +0000 Subject: [PATCH] Inherit Supervision GUI object from SALOMEGUI class --- src/SUPERVGUI/SUPERVGUI.cxx | 164 ++++++++++++++++-------------------- src/SUPERVGUI/SUPERVGUI.h | 22 +++-- 2 files changed, 89 insertions(+), 97 deletions(-) diff --git a/src/SUPERVGUI/SUPERVGUI.cxx b/src/SUPERVGUI/SUPERVGUI.cxx index 5f57e85..5dcf2e5 100644 --- a/src/SUPERVGUI/SUPERVGUI.cxx +++ b/src/SUPERVGUI/SUPERVGUI.cxx @@ -49,13 +49,14 @@ using namespace std; int SUPERVGUI::factory = 0; -SUPERVGUI Supervision; +SUPERVGUI Supervision(""); -SUPERVGUI::SUPERVGUI(): QObject(), - desktop(0), - study(0), - browser(0) +SUPERVGUI::SUPERVGUI(const QString& theName, QObject* theParent) + : SALOMEGUI( theName, theParent ), + desktop(0), + study(0), + browser(0) //info(0) { Trace("SUPERVGUI::SUPERVGUI") @@ -441,8 +442,10 @@ void SUPERVGUI::showComponents() { } } -void SUPERVGUI::customPopup(QPopupMenu* popup) { + +bool SUPERVGUI::CustomPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { Trace("SUPERVGUI::customPopup"); + Supervision.init(parent); if(popup->count() > 3) { // Temporary code: is to be deleted soon popup->removeItem(QAD_Display_Popup_ID); @@ -453,7 +456,7 @@ void SUPERVGUI::customPopup(QPopupMenu* popup) { // Temporary code end } SALOME_Selection* Sel = SALOME_Selection::Selection(study->getSelection() ); - if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return; + if ((Sel==NULL) || (Sel->IObjectCount() == 0)) return false; if (Sel->IObjectCount() == 1) { Handle(SALOME_InteractiveObject) anIObj = Sel->firstIObject(); @@ -484,6 +487,7 @@ void SUPERVGUI::customPopup(QPopupMenu* popup) { if (aIObjCount == Sel->IObjectCount()) //all selected objects belong to Supervision popup->insertItem(tr("MSG_DELETE"), this, SLOT(deleteObject())); } + return(true); } @@ -573,105 +577,81 @@ void SUPERVGUI::deleteObject() { Sel->ClearIObjects() ; } - - -void SUPERVGUI::activeStudyChanged() { - Trace("SUPERVGUI::activeStudyChanged"); - study = desktop->getActiveStudy(); -} - -extern "C" bool OnGUIEvent(int command, QAD_Desktop* parent) { - Supervision.init(parent); - switch (command) { - case 301: - Supervision.importDataflow(); - return(false); - - case 302: - Supervision.exportDataflow(); - return(false); - - case 303: - Supervision.newDataflow(); - return(false); - - case 304: - Supervision.modifyDataflow(); - return(false); - - case 305: - Supervision.reloadDataflow(); - return(false); - - case 306: - Supervision.runDataflow(); - return(false); - - case 307: - Supervision.killDataflow(); - return(false); - - case 308: - Supervision.suspendResumeDataflow(); - return(false); - - case 309: - Supervision.showComponents(); - return(false); - - case 310: - Supervision.stepByStep(); - return(false); - - default: - QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome"); - return(false); - - } -} - -extern "C" bool OnKeyPress(QKeyEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { +bool SUPERVGUI::OnGUIEvent(int command, QAD_Desktop* parent) { + Supervision.init(parent); + switch (command) { + case 301: + Supervision.importDataflow(); return(false); -} - -extern "C" bool OnMousePress(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { + + case 302: + Supervision.exportDataflow(); return(false); -} - -extern "C" bool OnMouseMove(QMouseEvent* e, QAD_Desktop* parent, SUPERVGUI_Main* s) { + + case 303: + Supervision.newDataflow(); return(false); -} - -extern "C" bool OnPopupGUIEvent(int theCommandID, QAD_Desktop* parent) { + + case 304: + Supervision.modifyDataflow(); return(false); + + case 305: + Supervision.reloadDataflow(); + return(false); + + case 306: + Supervision.runDataflow(); + return(false); + + case 307: + Supervision.killDataflow(); + return(false); + + case 308: + Supervision.suspendResumeDataflow(); + return(false); + + case 309: + Supervision.showComponents(); + return(false); + + case 310: + Supervision.stepByStep(); + return(false); + + default: + QMessageBox::warning(QAD_Application::getDesktop(), "Supervision Error", "Unknown Command From Salome"); + return(false); + } } -extern "C" bool SetSettings(QAD_Desktop* parent) { - Trace("extern SUPERVGUI::SetSettings") - Supervision.init(parent); - return(true); -} - -extern "C" void definePopup(QString& theContext, QString& theParent, QString& theObject) { - theObject = ""; - theContext = ""; +bool SUPERVGUI::SetSettings(QAD_Desktop* parent) { + Trace("SUPERVGUI::SetSettings"); + Supervision.init(parent); + return(true); } -extern "C" bool customPopup(QAD_Desktop* parent, QPopupMenu* popup, const QString& theContext, const QString& theParent, const QString& theObject) { - Supervision.init(parent); - Supervision.customPopup(popup); - return(true); +void SUPERVGUI::DefinePopup(QString& theContext, QString& theParent, QString& theObject) { + theObject = ""; + theContext = ""; } -extern "C" void activeStudyChanged(QAD_Desktop* parent) { - Supervision.activeStudyChanged(); +bool SUPERVGUI::ActiveStudyChanged(QAD_Desktop* parent) { + Trace("SUPERVGUI::activeStudyChanged"); + study = desktop->getActiveStudy(); + return true; } -extern "C" int supportedViewType() +void SUPERVGUI::SupportedViewType (int* buffer, int bufferSize) { - return (int)VIEW_GRAPHSUPERV; + if (!buffer || !bufferSize) return; + buffer[0] = (int)VIEW_GRAPHSUPERV; } -extern "C" void buildPresentation ( const Handle(SALOME_InteractiveObject)& theIO ) +extern "C" { + Standard_EXPORT SALOMEGUI* GetComponentGUI() { + return &Supervision; + } } diff --git a/src/SUPERVGUI/SUPERVGUI.h b/src/SUPERVGUI/SUPERVGUI.h index 3bf4606..977e719 100644 --- a/src/SUPERVGUI/SUPERVGUI.h +++ b/src/SUPERVGUI/SUPERVGUI.h @@ -28,7 +28,7 @@ #ifndef SUPERVGUI_H #define SUPERVGUI_H -// Acces a l'ihm de SALOME +// Acces a l`ihm de SALOME // ----------------------- #include "QAD_Desktop.h" @@ -39,15 +39,16 @@ #include "SUPERVGUI_Main.h" //#include "SUPERVGUI_Information.h" +#include "SALOMEGUI.h" // Definition de la classe principale du module de supervision // ----------------------------------------------------------- -class SUPERVGUI: public QObject { +class SUPERVGUI: public SALOMEGUI { Q_OBJECT public: - SUPERVGUI(); + SUPERVGUI( const QString&, QObject* = 0 ); virtual ~SUPERVGUI(); QAD_Desktop* getDesktop(); @@ -73,8 +74,19 @@ class SUPERVGUI: public QObject { void init(QAD_Desktop* parent); SUPERVGUI_Main* getMain(); - void customPopup(QPopupMenu* popup); - void activeStudyChanged(); + + bool OnGUIEvent(int theCommandID, QAD_Desktop* parent); + bool SetSettings(QAD_Desktop* parent); + void DefinePopup(QString & theContext, + QString & theParent, + QString & theObject ) ; + bool CustomPopup(QAD_Desktop* parent, + QPopupMenu* popup, + const QString & theContext, + const QString & theParent, + const QString & theObject); + bool ActiveStudyChanged( QAD_Desktop* parent ); + void SupportedViewType (int* buffer, int bufferSize); bool isContains(QAD_Study* theStudy, const QString theKey); -- 2.39.2