Salome HOME
Merge from OCC_development_generic_2006
[modules/superv.git] / src / SUPERVGUI / SUPERVGUI_Service.h
index 9a2f1613d18b39d45ae73d37d51bdb7e6e42ba1e..3a466790dff17010eacc81404631a599e613a384 100644 (file)
 #ifndef SUPERVGUI_Service_H
 #define SUPERVGUI_Service_H
 
-using namespace std;
 #include "SUPERVGUI_Def.h"
 #include <qtabwidget.h>
 #include <qhgroupbox.h>
 #include <qwidgetstack.h>
 
+class QListBox; 
 
-//*****************************************************
-//  Pane for Python script editing
-//*****************************************************
+/*!
+ * Pane for Python script editing
+ */
 class SUPERVGUI_PythonEditPane: public QFrame {
+
   Q_OBJECT
 
- public:
-  SUPERVGUI_PythonEditPane(QWidget* theParent);
+public:
+  SUPERVGUI_PythonEditPane( QWidget* theParent, const bool isNodeCreation, int& theX, int& theY );
   ~SUPERVGUI_PythonEditPane() {};
   
   QString getFuncName();
@@ -53,13 +54,23 @@ class SUPERVGUI_PythonEditPane: public QFrame {
   SUPERV_Strings getFunction();
   void setFunction(SUPERV_Strings theStr);
     
- public slots:
+public slots:
+  // load all functions from an XML file into internal structures 
   void loadFile();
-  void readFunction();
 
- private:
+  // when user presses "Enter" - automatically set indentation of next line
+  void autoIndentLine(); 
+
+  // when user select another function name in combo box - fill myText with its body
+  void readFunction( int i ); 
+
+  // when user presses "Library" button - open a "Create node from Library" dialog
+  void library();
+
+private:
+  bool         myIsWithLibrary;
   QTextEdit*   myText;
-  QPushButton* myNextBtn;
+  QComboBox*   myFunctionsCombo;
 
   // fills myPyFunctions list.  called from loadFile() after user selects a file.
   void         initPyFunctions( QTextStream& );
@@ -68,31 +79,40 @@ class SUPERVGUI_PythonEditPane: public QFrame {
   // in readFunction()
   QStringList  myPyFunctions; 
 
-  // index of currently displayed Python function
-  int          myPyIndex;
-};
-
+  int& myX; // comes from SUPERVGUI_Service 
+  int& myY; // comes from SUPERVGUI_Service 
 
-//*****************************************************
-//  Dialog box for node creation
-//*****************************************************
+};
 
+/*!
+ * Dialog box for node creation
+ */
 class SUPERVGUI_Service: public QDialog {
+
   Q_OBJECT
 
-  public:
+public:
     SUPERVGUI_Service(SALOME_NamingService* ns);
     ~SUPERVGUI_Service();
 
     void choose();
 
- protected:
+    /*!
+     * Do the following actions for newly created Engine's CNode:
+     * 1. Create a presentation for it (CanvasNode)
+     * 2. Place the CanvasNode to the current top-left corner or the current viewport
+     * 3. Increment the coordinates of the next CanvasNode (new nodes are "cascaded" when several of them are created at once)
+     * PS theEndNode is passed only for Loop and Switch nodes (EndLoop and EndSwitch)
+     */ 
+    static void addNode( SUPERV::CNode_var theNode, SUPERV::INode_var theEndNode, int& theX, int& theY );
+
+protected:
     void showEvent(QShowEvent* theEvent);
 
-  private:
+private:
     void initialise();
 
-  private slots:
+private slots:
     void tabChanged(QWidget *);
     void addComputeNode();
     void addFactoryNode();
@@ -101,8 +121,8 @@ class SUPERVGUI_Service: public QDialog {
     void typeNodeSelected(int theRow);
     void loadGraph();
 
-  private:
-    QListView*            components;
+private:
+    QListView* components;
     SALOME_NamingService* naming;
     int myX, myY;
     QWidgetStack* myStackWidget;
@@ -128,9 +148,10 @@ class SUPERVGUI_Service: public QDialog {
  * Edit Python dialog
  */
 class SUPERVGUI_EditPythonDlg: public QDialog {
+
   Q_OBJECT
     
- public:
+public:
   SUPERVGUI_EditPythonDlg(bool isLoop = false);
   ~SUPERVGUI_EditPythonDlg() {};
 
@@ -177,7 +198,10 @@ class SUPERVGUI_EditPythonDlg: public QDialog {
   void setNextFunction(SUPERV_Strings theStr)
     { myNextPane->setFunction(theStr); }
 
- private:
+public slots:
+  void clickOnOk();
+
+private:
   SUPERVGUI_PythonEditPane* myEditPane;
   SUPERVGUI_PythonEditPane* myInitPane;
   SUPERVGUI_PythonEditPane* myMorePane;