From: mkr Date: Fri, 27 May 2005 09:34:03 +0000 (+0000) Subject: Module Supervision migration. X-Git-Tag: T3_0_0_a1~92 X-Git-Url: http://git.salome-platform.org/gitweb/?a=commitdiff_plain;h=5927d3f3ff8d637067333f7bd185e9b13a0fe298;p=modules%2Fgui.git Module Supervision migration. --- diff --git a/src/Makefile.in b/src/Makefile.in index 34187dc4d..d41666b38 100755 --- a/src/Makefile.in +++ b/src/Makefile.in @@ -34,7 +34,7 @@ VPATH=.:@srcdir@ SUBDIRS = Qtx SUIT STD CAF CAM SUITApp VTKViewer OCCViewer GLViewer \ LogWindow Event Loader OBJECT Prs PyInterp PythonConsole ObjBrowser \ - RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d SalomeApp SALOME_SWIG SALOME_PY Session -# excluded : SUPERVGraph SALOME_PYQT + RegistryDisplay Plot2d TOOLSGUI SOCC SVTK SPlot2d SalomeApp SALOME_SWIG SALOME_PY SUPERVGraph Session +# excluded : SALOME_PYQT @MODULE@ diff --git a/src/SUPERVGraph/Makefile.in b/src/SUPERVGraph/Makefile.in index 8209a4332..433f6239f 100755 --- a/src/SUPERVGraph/Makefile.in +++ b/src/SUPERVGraph/Makefile.in @@ -7,17 +7,22 @@ VPATH=.:@srcdir@:@top_srcdir@/idl @COMMENCE@ -EXPORT_HEADERS = \ - SUPERVGraph_ViewFrame.h +EXPORT_HEADERS = SUPERVGraph_ViewFrame.h \ + SUPERVGraph_ViewManager.h \ + SUPERVGraph_ViewModel.h # Libraries targets LIB = libSUPERVGraph.la LIB_SRC = SUPERVGraph.cxx \ - SUPERVGraph_ViewFrame.cxx + SUPERVGraph_ViewFrame.cxx \ + SUPERVGraph_ViewManager.cxx \ + SUPERVGraph_ViewModel.cxx LIB_MOC = SUPERVGraph_moc.cxx \ - SUPERVGraph_ViewFrame_moc.cxx + SUPERVGraph_ViewFrame_moc.cxx \ + SUPERVGraph_ViewManager_moc.cxx \ + SUPERVGraph_ViewModel_moc.cxx LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_ModuleCatalog.idl \ @@ -26,8 +31,8 @@ LIB_CLIENT_IDL = SALOMEDS.idl \ SALOME_GenericObj.idl -CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib -lSalomeGUI +CPPFLAGS+=$(QT_INCLUDES) $(OCC_INCLUDES) $(PYTHON_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome -I${GUI_ROOT_DIR}/include/salome +LDFLAGS+=$(QT_MT_LIBS) -L$(top_builddir)/lib @CONCLUDE@ diff --git a/src/SUPERVGraph/SUPERVGraph.cxx b/src/SUPERVGraph/SUPERVGraph.cxx index 140853bb9..35105cfe8 100755 --- a/src/SUPERVGraph/SUPERVGraph.cxx +++ b/src/SUPERVGraph/SUPERVGraph.cxx @@ -30,14 +30,14 @@ using namespace std; #include "SUPERVGraph.h" #include "SUPERVGraph_ViewFrame.h" -QAD_ViewFrame* SUPERVGraph::createView(QAD_RightFrame* parent) +SUIT_ViewWindow* SUPERVGraph::createView(SUIT_Desktop* parent) { - return new SUPERVGraph_ViewFrame( parent, "vtkView" ); + return new SUPERVGraph_ViewFrame( parent/*, "vtkView"*/ ); } extern "C" { - QAD_ViewFrame* createView(QAD_RightFrame* parent) + SUIT_ViewWindow* createView(SUIT_Desktop* parent) { return SUPERVGraph::createView(parent); } diff --git a/src/SUPERVGraph/SUPERVGraph.h b/src/SUPERVGraph/SUPERVGraph.h index 929fc291d..d2d83794e 100755 --- a/src/SUPERVGraph/SUPERVGraph.h +++ b/src/SUPERVGraph/SUPERVGraph.h @@ -29,8 +29,8 @@ #ifndef SUPERVGraph_HeaderFile #define SUPERVGraph_HeaderFile -#include "QAD_RightFrame.h" -#include "QAD_ViewFrame.h" +#include "SUIT_Desktop.h" +#include "SUIT_ViewWindow.h" class SUPERVGraph : public QObject { @@ -38,7 +38,7 @@ class SUPERVGraph : public QObject public : - Standard_EXPORT static QAD_ViewFrame* createView ( QAD_RightFrame* parent); + /*Standard_EXPORT*/ static SUIT_ViewWindow* createView ( SUIT_Desktop* parent); }; diff --git a/src/SUPERVGraph/SUPERVGraph_Graph.cxx b/src/SUPERVGraph/SUPERVGraph_Graph.cxx deleted file mode 100755 index f312dbcde..000000000 --- a/src/SUPERVGraph/SUPERVGraph_Graph.cxx +++ /dev/null @@ -1,304 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SUPERVGraph_Graph.cxx -// Author : Francis KLOSS -// Module : SALOME - -using namespace std; -#include "SUPERVGraph_Graph.h" - -#include "QAD_Settings.h" -#include "QAD_Config.h" - -#include -#include - - -SUPERVGraph_Graph::SUPERVGraph_Graph(QWidget* parent) : - QScrollView(parent), - where(QPoint(0, 0)) -{ - installEventFilter(viewport()); - // viewport()->setBackgroundColor(QColor(165, 255, 176)); - - connect(this, SIGNAL(contentsMoving(int, int)), this, SLOT(Draw(int, int))); - - popup = new QPopupMenu(viewport()); - // if (main->isModify()) { - // pan = popup->insertItem("Add Node", main, SLOT(addNode())); - // pap = popup->insertItem("Add Point", this, SLOT(addPoint())); - // pdl = popup->insertItem("Delete Link", this, SLOT(deleteLink())); - // pif = popup->insertItem("Insert File", main, SLOT(insertFile())); - // pci = popup->insertItem("Change Informations", this, SLOT(changeInformation())); - // popup->insertSeparator(); - // }; - // popup->insertItem("Add in Study", main, SLOT(addStudy())); - // popup->insertItem("Show Informations", this, SLOT(showInformation())); - // popup->insertSeparator(); - // popup->insertItem("Copy (Read Only)", main, SLOT(copyReading())); - // popup->insertItem("Copy (Modifiying)", main, SLOT(copyModifying())); -} - -void SUPERVGraph_Graph::sync() { - // bool editing = main->getDataflow()->IsEditing(); - // if (main->isModify()) { - // popup->setItemEnabled(pci, editing); - // popup->setItemEnabled(pan, editing); - // popup->setItemEnabled(pap, editing); - // popup->setItemEnabled(pdl, editing); - // popup->setItemEnabled(pif, editing); - // }; - - // SUPERVGraph_Node* ihmNode; - // QObjectList* ihmList = queryList("SUPERVGraph_Node"); - // SUPERV_Nodes nodes = main->getDataflow()->Nodes(); - // int n = nodes->length(); - - // for (int i=0; iName(), "SUPERVGraph_Node"); - // if (ihmNode == NULL) { - // ihmNode = new SUPERVGraph_Node(viewport(), main, nodes[i]); - // addChild(ihmNode, nodes[i]->X(), nodes[i]->Y()); - // } else { - // moveChild(ihmNode, nodes[i]->X(), nodes[i]->Y()); - // ihmList->removeRef(ihmNode); - // }; - // ihmNode->sync(); - // }; - - // QObjectListIt i(*ihmList); - // while ((ihmNode=(SUPERVGraph_Node*)i.current()) != 0) { - // ++i; - // ihmNode->close(); - // }; - // delete ihmList; - - // SUPERVGraph_PortIn* pi; - // ihmList = queryList("SUPERVGraph_PortIn"); - // i = *ihmList; - // while ((pi=(SUPERVGraph_PortIn*)i.current()) != 0) { - // ++i; - // pi->sync(true); - // }; - // delete ihmList; - - // SUPERVGraph_PortOut* po; - // ihmList = queryList("SUPERVGraph_PortOut"); - // i = *ihmList; - // while ((po=(SUPERVGraph_PortOut*)i.current()) != 0) { - // ++i; - // po->sync(); - // }; - // delete ihmList; - - // Draw(0, 0); -} - -SUPERVGraph_Graph::~SUPERVGraph_Graph() { -} - -bool SUPERVGraph_Graph::eventFilter(QObject* object, QEvent* event) { - if ((event->type() == QEvent::Move ) || - (event->type() == QEvent::Paint) || - (event->type() == QEvent::Resize) ) { - Draw(0, 0); - }; - return(QScrollView::eventFilter(object, event)); -} - -void SUPERVGraph_Graph::Draw(int x, int y) { - QPainter p(viewport()); - p.eraseRect(viewport()->rect()); - p.setPen(QPen(Qt::black, 2)); - - // SUPERVGraph_Point* c; - // SUPERVGraph_Point* n; - // QObjectList* points = queryList("SUPERVGraph_Point"); - // QObjectListIt i(*points); - // while ((c=(SUPERVGraph_Point*)i.current()) != 0) { - // ++i; - // n=c->getNext(); - // if (n!=c) { - // p.drawLine(contentsToViewport(QPoint(c->getX()+POINT_SIZE_HALF, c->getY()+POINT_SIZE_HALF)), - // contentsToViewport(QPoint(n->getX()+POINT_SIZE_HALF, n->getY()+POINT_SIZE_HALF)) ); - // }; - // }; - // delete points; -} - -void SUPERVGraph_Graph::contentsMousePressEvent(QMouseEvent* e) { - where = viewportToContents(viewport()->mapFromGlobal(e->globalPos())); - // main->showPopup(popup, e); -} - -void SUPERVGraph_Graph::contentsMouseReleaseEvent(QMouseEvent* e) { - // main->sketchPoint(NULL); - - if ( e->button() == Qt::RightButton ) { - QPopupMenu* popup = createPopup(); - if ( popup ) { - popup->exec( QCursor::pos() ); - destroyPopup(); - } - return; - } - -} - -void SUPERVGraph_Graph::contentsMouseMoveEvent(QMouseEvent* e) { - // main->sketchMove(); -} - -float SUPERVGraph_Graph::distance(int xp, int yp, int xl, int yl, int xn, int yn) { - float r, s; - float a, b, c, d; - - float px = (float)(xp); - float py = (float)(yp); - float lx = (float)(xl); - float ly = (float)(yl); - float nx = (float)(xn); - float ny = (float)(yn); - - r = px - lx; - r = r * r; - s = py - ly; - s = s * s; - a = r + s; - - r = px - nx; - r = r * r; - s = py - ny; - s = s * s; - b = r + s; - - r = nx - lx; - r = r * r; - s = ny - ly; - s = s * s; - c = r + s; - - if (c<0.001) { - return(a); - } else { - r = a + c - b; - r = r * r; - d = r / ( 4 * c); - return(a - d); - }; -} - -QPoint SUPERVGraph_Graph::getPoint() { - return(where); -} - -// SUPERVGraph_Point* SUPERVGraph_Graph::findPoint(int x, int y) { -// float m; -// float d = SCROLL_MAX; -// SUPERVGraph_Point* t = NULL; -// SUPERVGraph_Point* c; -// SUPERVGraph_Point* n; -// QObjectList* points = queryList("SUPERVGraph_Point"); -// QObjectListIt i(*points); - -// while ((c=(SUPERVGraph_Point*)i.current()) != 0) { -// ++i; -// n=c->getNext(); -// if (n != c) { -// m = distance(x, y, c->getX(), c->getY(), n->getX(), n->getY()); -// if (m < d) { -// d = m; -// t = c; -// }; -// }; -// }; -// delete points; -// return(t); -// } - -void SUPERVGraph_Graph::addPoint() { - // int x = where.x(); - // int y = where.y(); - // SUPERVGraph_Point* p = findPoint(x, y); - // if (p == NULL) { - // QMessageBox::warning(0, "Supervision Error", "No Link to Add a Point"); - // } else { - // p->addPoint(x, y, true); - // }; -} - -void SUPERVGraph_Graph::deleteLink() { - // SUPERVGraph_Point* p = findPoint(where.x(), where.y()); - // if (p == NULL) { - // QMessageBox::warning(0, "Supervision Error", "No Link to Delete"); - // } else { - // SUPERV_Link l = p->getLink(); - // if (l == NULL) { - // QMessageBox::warning(0, "Supervision Error", "No Link to Delete"); - // } else { - // l->Destroy(); - // main->sync(); - // }; - // }; -} - -void SUPERVGraph_Graph::showInformation() { - // if (Supervision.information(Engines::Node::_narrow(main->getDataflow()), false)) { - // main->sync(); - // }; -} - -void SUPERVGraph_Graph::changeInformation() { - // if (Supervision.information(Engines::Node::_narrow(main->getDataflow()), true)) { - // main->sync(); - // }; -} - -/*! - Creates the popup -*/ -void SUPERVGraph_Graph::onCreatePopup() -{ - if ( myPopup ) { -// if (myPopup->count()<1) { - if ( myPopup->count() > 0 ) - myIDs.append ( myPopup->insertSeparator() ); - int id; - myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) ); - QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) ); -// } - } -} - -void SUPERVGraph_Graph::onChangeBackgroundColor() -{ - QColor previousColor = viewport()->backgroundColor(); - QColor selColor = QColorDialog::getColor ( previousColor, NULL ); - if ( selColor.isValid() ) - viewport()->setBackgroundColor( selColor ); - - QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorRed", selColor.red() ); - QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorGreen", selColor.green() ); - QAD_CONFIG->addSetting( "SUPERVGraph:BackgroundColorBlue", selColor.blue() ); -} diff --git a/src/SUPERVGraph/SUPERVGraph_Graph.h b/src/SUPERVGraph/SUPERVGraph_Graph.h deleted file mode 100755 index ccea5c69a..000000000 --- a/src/SUPERVGraph/SUPERVGraph_Graph.h +++ /dev/null @@ -1,84 +0,0 @@ -// SALOME SUPERVGraph : build Supervisor viewer into desktop -// -// Copyright (C) 2003 OPEN CASCADE, EADS/CCR, LIP6, CEA/DEN, -// CEDRAT, EDF R&D, LEG, PRINCIPIA R&D, BUREAU VERITAS -// -// This library is free software; you can redistribute it and/or -// modify it under the terms of the GNU Lesser General Public -// License as published by the Free Software Foundation; either -// version 2.1 of the License. -// -// This library is distributed in the hope that it will be useful, -// but WITHOUT ANY WARRANTY; without even the implied warranty of -// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU -// Lesser General Public License for more details. -// -// You should have received a copy of the GNU Lesser General Public -// License along with this library; if not, write to the Free Software -// Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -// -// See http://www.opencascade.org/SALOME/ or email : webmaster.salome@opencascade.org -// -// -// -// File : SUPERVGraph_Graph.h -// Author : Francis KLOSS -// Module : SALOME - -#ifndef SUPERVGraph_Graph_HXX -#define SUPERVGraph_Graph_HXX - -#include "QAD.h" -#include "QAD_Popup.h" - -#include -#include - -class QAD_EXPORT SUPERVGraph_Graph: public QScrollView, public QAD_PopupClientServer -{ - Q_OBJECT - -public: - SUPERVGraph_Graph(QWidget* parent); - ~SUPERVGraph_Graph(); - - /* popup management */ - void onCreatePopup(); - - void sync(); - void contentsMousePressEvent(QMouseEvent* e); - void contentsMouseReleaseEvent(QMouseEvent* e); - void contentsMouseMoveEvent(QMouseEvent* e); - - QPoint getPoint(); - -public slots: - void Draw(int x, int y); - -private slots: - void addPoint(); - void deleteLink(); - void showInformation(); - void changeInformation(); - -protected slots: - void onChangeBackgroundColor(); - -protected: - bool eventFilter(QObject* object, QEvent* event); - -private: -// SUPERVGraph_Point* findPoint(int x, int y); - float distance(int xp, int yp, int xl, int yl, int xn, int yn); - -// SUPERVGraph_Main* main; - QPoint where; - QPopupMenu* popup; - int pci; - int pan; - int pap; - int pdl; - int pif; -}; - -#endif diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx index 07ecc21cc..b46810483 100755 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.cxx @@ -29,12 +29,6 @@ using namespace std; #include "SUPERVGraph_ViewFrame.h" -#include "QAD_Settings.h" -#include "QAD_Config.h" -#include "QAD_Application.h" -#include "QAD_Desktop.h" -#include "SALOME_Selection.h" - #include "utilities.h" //QT Include @@ -42,14 +36,23 @@ using namespace std; #include -SUPERVGraph_View::SUPERVGraph_View(QWidget* theParent): QWidget(theParent){ +SUPERVGraph_View::SUPERVGraph_View( QWidget* theParent ): QWidget( theParent ) +{ init(theParent); } -SUPERVGraph_View::SUPERVGraph_View(SUPERVGraph_View* theParent): QWidget(theParent){ - setPopupServer(theParent->getPopupServer()); + +SUPERVGraph_View::SUPERVGraph_View( SUPERVGraph_View* theParent ): QWidget( theParent ) +{ init(theParent); } -void SUPERVGraph_View::init(QWidget* theParent){ + +void SUPERVGraph_View::contextMenuPopup( QPopupMenu* ) +{ + // to be implemented +} + +void SUPERVGraph_View::init( QWidget* theParent ) +{ if ( theParent->inherits( "QMainWindow" ) ) { ( ( QMainWindow* )theParent )->setCentralWidget( this ); } @@ -59,35 +62,15 @@ void SUPERVGraph_View::init(QWidget* theParent){ } } -void SUPERVGraph_View::onCreatePopup(){ - /* - if ( myPopup ) { - QAD_Desktop* Desktop = (QAD_Desktop*) QAD_Application::getDesktop(); - QAD_Study* ActiveStudy = Desktop->getActiveStudy(); - SALOME_Selection* Sel = SALOME_Selection::Selection( ActiveStudy->getSelection() ); - - QString theContext; - QString theParent("Viewer"); - QString theObject; - - Desktop->definePopup( theContext, theParent, theObject ); - Desktop->createPopup( myPopup, theContext, theParent, theObject); - Desktop->customPopup( myPopup, theContext, theParent, theObject ); - if (Sel->IObjectCount() == 0 && myPopup->count()<1) { - int id; - myIDs.append ( id = myPopup->insertItem (tr ("MEN_VP3D_CHANGEBGR")) ); - QAD_ASSERT ( myPopup->connectItem ( id, this, SLOT(onChangeBackgroundColor())) ); - } - } - */ - } + /*! Constructor */ -SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame(QWidget* parent, const char* name) - : QAD_ViewFrame(parent, name) +SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame( SUIT_Desktop* theDesktop ) + : SUIT_ViewWindow( theDesktop ) { myView = 0; + //myView = new SUPERVGraph_View(this); // Set BackgroundColor /* @@ -96,21 +79,21 @@ SUPERVGraph_ViewFrame::SUPERVGraph_ViewFrame(QWidget* parent, const char* name) int B = QAD_CONFIG->getSetting("SUPERVGraph:BackgroundColorBlue").toInt(); setBackgroundColor(QColor(R,G,B));*/ } -SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame(){} + +SUPERVGraph_ViewFrame::~SUPERVGraph_ViewFrame() {} /*! Returns widget containing 3D-Viewer */ -SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget(){ +SUPERVGraph_View* SUPERVGraph_ViewFrame::getViewWidget() +{ return myView; } -void SUPERVGraph_ViewFrame::setViewWidget(SUPERVGraph_View* theView) { +void SUPERVGraph_ViewFrame::setViewWidget( SUPERVGraph_View* theView ) +{ myView = theView; - if (myApp) { - myView->setPopupServer(myApp); - } } @@ -233,7 +216,7 @@ void SUPERVGraph_ViewFrame::onViewFitAll() /*! Set background of the viewport */ -void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color) +void SUPERVGraph_ViewFrame::setBackgroundColor( const QColor& color ) { if (myView) myView->setPaletteBackgroundColor(color); @@ -249,13 +232,7 @@ QColor SUPERVGraph_ViewFrame::backgroundColor() const return QMainWindow::backgroundColor(); } - -void SUPERVGraph_ViewFrame::SetSelectionMode( Selection_Mode mode ) -{ - MESSAGE ( "SUPERVGraph_ViewFrame::SetSelectionMode" ) -} - -void SUPERVGraph_ViewFrame::onAdjustTrihedron( ) +void SUPERVGraph_ViewFrame::onAdjustTrihedron() { MESSAGE ( "SUPERVGraph_ViewFrame::onAdjustTrihedron" ) } @@ -289,22 +266,14 @@ bool SUPERVGraph_ViewFrame::isVisible( const Handle(SALOME_InteractiveObject)& I return false; } -void SUPERVGraph_ViewFrame::setPopupServer( QAD_Application* App ) -{ - myApp = App; - if (myView) { - myView->setPopupServer(myApp); - } -} - -void SUPERVGraph_ViewFrame::undo(const _PTR(Study)& aStudy, - const char* StudyFrameEntry) +void SUPERVGraph_ViewFrame::undo( const _PTR(Study)& aStudy, + const char* StudyFrameEntry ) { MESSAGE ( "SUPERVGraph_ViewFrame::undo" ) } -void SUPERVGraph_ViewFrame::redo(const _PTR(Study)& aStudy, - const char* StudyFrameEntry) +void SUPERVGraph_ViewFrame::redo( const _PTR(Study)& aStudy, + const char* StudyFrameEntry ) { MESSAGE ( "SUPERVGraph_ViewFrame::redo" ) } diff --git a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h index 73133bd84..e6b07bb3e 100755 --- a/src/SUPERVGraph/SUPERVGraph_ViewFrame.h +++ b/src/SUPERVGraph/SUPERVGraph_ViewFrame.h @@ -29,49 +29,48 @@ #ifndef SUPERVGraph_ViewFrame_H #define SUPERVGraph_ViewFrame_H -#include "QAD.h" -#include "QAD_ViewFrame.h" -#include "QAD_Application.h" - #include "SALOME_InteractiveObject.hxx" -#include "SALOME_Selection.h" #include "SALOMEDSClient.hxx" -class QAD_EXPORT SUPERVGraph_View: public QWidget, public QAD_PopupClientServer{ +#include "SalomeApp_Application.h" +#include "SUIT_PopupClient.h" +#include "SUIT_ViewWindow.h" + +class /*SUPERVGRAPH_EXPORT*/ SUPERVGraph_View: public QWidget, public SUIT_PopupClient { Q_OBJECT; public: + static QString Type() { return "SUPERVGraphViewer"; } + SUPERVGraph_View(QWidget* theParent); SUPERVGraph_View(SUPERVGraph_View* theParent); virtual void ActivatePanning() = 0; virtual void ResetView() = 0; + + /* redefine functions from SUIT_PopupClient */ + virtual QString popupClientType() const { return Type(); } + virtual void contextMenuPopup( QPopupMenu* ); + protected: void init(QWidget* theParent); - void onCreatePopup(); }; -class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame { +class /*SUPERVGRAPH_EXPORT*/ SUPERVGraph_ViewFrame : public SUIT_ViewWindow { Q_OBJECT public: - SUPERVGraph_ViewFrame(QWidget* parent, const char* name=0 ); + SUPERVGraph_ViewFrame(SUIT_Desktop* theDesktop ); ~SUPERVGraph_ViewFrame(); - ViewType getTypeView() const{ return VIEW_GRAPHSUPERV;}; SUPERVGraph_View* getViewWidget(); void setViewWidget(SUPERVGraph_View* theView); void setBackgroundColor( const QColor& ); QColor backgroundColor() const; - void SetSelectionMode( Selection_Mode mode ); - void onAdjustTrihedron( ); - /* popup management */ - void setPopupServer( QAD_Application* ); - /* interactive object management */ void highlight( const Handle(SALOME_InteractiveObject)& IObject, bool highlight, bool immediatly = true ); @@ -85,7 +84,7 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame { void undo(const _PTR(Study)& aStudy, const char* StudyFrameEntry); void redo(const _PTR(Study)& aStudy, const char* StudyFrameEntry); - + /* selection */ Handle(SALOME_InteractiveObject) FindIObject(const char* Entry) { Handle(SALOME_InteractiveObject) o; return o; }; @@ -112,9 +111,9 @@ class QAD_EXPORT SUPERVGraph_ViewFrame : public QAD_ViewFrame { void onViewBottom(); void onViewTop(); void onViewTrihedron(); - + private: SUPERVGraph_View* myView; - QAD_Application* myApp; + SalomeApp_Application* myApp; }; #endif diff --git a/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx b/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx new file mode 100644 index 000000000..a1a486518 --- /dev/null +++ b/src/SUPERVGraph/SUPERVGraph_ViewManager.cxx @@ -0,0 +1,24 @@ +#include "SUPERVGraph_ViewManager.h" + +SUPERVGraph_ViewManager::SUPERVGraph_ViewManager( SUIT_Study* theStudy, + SUIT_Desktop* theDesktop, + SUIT_ViewModel* theViewModel ) + : SUIT_ViewManager( theStudy, theDesktop, theViewModel ) +{ +} + +SUPERVGraph_ViewManager::~SUPERVGraph_ViewManager() +{ +} + +void SUPERVGraph_ViewManager::setViewName(SUIT_ViewWindow* theView) +{ + int aPos = myViews.find(theView); + theView->setCaption( QString( "SUPERVISION - viewer:%1" ).arg(aPos+1)); +} + +void SUPERVGraph_ViewManager::contextMenuPopup( QPopupMenu* thePopup) +{ + SUIT_ViewManager::contextMenuPopup( thePopup ); + // to be implemented +} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewManager.h b/src/SUPERVGraph/SUPERVGraph_ViewManager.h new file mode 100644 index 000000000..95b87b811 --- /dev/null +++ b/src/SUPERVGraph/SUPERVGraph_ViewManager.h @@ -0,0 +1,25 @@ +#ifndef SUPERVGRAPH_VIEWMANAGER_H +#define SUPERVGRAPH_VIEWMANAGER_H + +#include "SUPERVGraph_ViewModel.h" + +#include "SUIT_ViewManager.h" + +class SUIT_Desktop; + +class /*SUPERVGRAPH_EXPORT*/ SUPERVGraph_ViewManager : public SUIT_ViewManager +{ + Q_OBJECT + +public: + SUPERVGraph_ViewManager( SUIT_Study* theStudy, SUIT_Desktop* theDesktop, SUIT_ViewModel* theViewModel = 0 ); + ~SUPERVGraph_ViewManager(); + + virtual void contextMenuPopup( QPopupMenu* thePopup ); + +protected: + void setViewName(SUIT_ViewWindow* theView); + +}; + +#endif diff --git a/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx b/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx new file mode 100644 index 000000000..9fab92a58 --- /dev/null +++ b/src/SUPERVGraph/SUPERVGraph_ViewModel.cxx @@ -0,0 +1,19 @@ +#include "SUPERVGraph_ViewModel.h" +#include "SUPERVGraph_ViewFrame.h" +#include "SUIT_Desktop.h" +#include "SUIT_ViewWindow.h" + +SUPERVGraph_Viewer::SUPERVGraph_Viewer() +:SUIT_ViewModel() +{ +} + +SUPERVGraph_Viewer::~SUPERVGraph_Viewer() +{ +} + +SUIT_ViewWindow* SUPERVGraph_Viewer::createView(SUIT_Desktop* theDesktop) +{ + SUPERVGraph_ViewFrame* aRes = new SUPERVGraph_ViewFrame( theDesktop ); + return aRes; +} diff --git a/src/SUPERVGraph/SUPERVGraph_ViewModel.h b/src/SUPERVGraph/SUPERVGraph_ViewModel.h new file mode 100644 index 000000000..ab817dae7 --- /dev/null +++ b/src/SUPERVGraph/SUPERVGraph_ViewModel.h @@ -0,0 +1,20 @@ +#ifndef SUPERVGRAPH_VIEWMODEL_H +#define SUPERVGRAPH_VIEWMODEL_H + +#include "SUIT_ViewModel.h" + +class /*SUPERVGRAPH_EXPORT*/ SUPERVGraph_Viewer: public SUIT_ViewModel +{ + Q_OBJECT + +public: + static QString Type() { return "SUPERVGraphViewer"; } + + SUPERVGraph_Viewer(); + virtual ~SUPERVGraph_Viewer(); + + virtual SUIT_ViewWindow* createView(SUIT_Desktop* theDesktop); + +}; + +#endif diff --git a/src/SalomeApp/Makefile.in b/src/SalomeApp/Makefile.in index 12a6c7111..ab30ac389 100755 --- a/src/SalomeApp/Makefile.in +++ b/src/SalomeApp/Makefile.in @@ -93,7 +93,7 @@ RESOURCES_FILES = icon_about.png \ CPPFLAGS+=$(PYTHON_INCLUDES) $(QT_INCLUDES) $(QWT_INCLUDES) $(OCC_INCLUDES) $(VTK_INCLUDES) $(BOOST_CPPFLAGS) -I${KERNEL_ROOT_DIR}/include/salome LDFLAGS+=$(PYTHON_LIBS) $(QT_MT_LIBS) -LIBS+= -L$(GUI_ROOT_DIR)/lib/salome -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole +LIBS+= -L$(GUI_ROOT_DIR)/lib/salome -lsuit -lstd -lCAM -lObjBrowser -L$(KERNEL_ROOT_DIR)/lib/salome -lOpUtil -lSALOMELocalTrace $(CAS_KERNEL) -lPlot2d -lGLViewer -lOCCViewer -lVTKViewer -lSalomeObject -lSVTK -lSOCC -lPyInterp -lPythonConsole -lLogWindow @CONCLUDE@ diff --git a/src/SalomeApp/resources/SalomeApp.xml b/src/SalomeApp/resources/SalomeApp.xml index 9303bf4c9..16b65befe 100644 --- a/src/SalomeApp/resources/SalomeApp.xml +++ b/src/SalomeApp/resources/SalomeApp.xml @@ -8,7 +8,7 @@ - + @@ -28,6 +28,7 @@ +
@@ -41,6 +42,10 @@
+
+ + +