source: trunk/IPs/systemC/processor/Morpheo/Tools/Viewer/Graphics/include/window.h @ 81

Last change on this file since 81 was 81, checked in by rosiere, 16 years ago
  • Finish Environment (and test)
  • Continue predictor_unit
  • Add external tools
  • svn keyword "Id" set
  • Property svn:executable set to *
  • Property svn:keywords set to Id
File size: 5.9 KB
Line 
1/******************************************************/
2/*                                                    */
3/*  this class creates the application windows :      */
4/*  - the main window where composants are drawn,     */
5/*  - the parameters window,                          */
6/*  - and the informations window.                    */
7/*                                                    */
8/******************************************************/
9
10
11#ifndef WINDOW_H
12#define WINDOW_H
13
14
15#include <iostream>
16#include <cmath>
17#include <sstream>
18#include <qstring.h>
19#include <qapplication.h>
20#include <qmetaobject.h>
21#include <qmenu.h>
22#include <qmenubar.h>
23#include <qmainwindow.h>
24#include <qwidget.h>
25#include <qboxlayout.h> 
26#include <qpainter.h>
27#include <qcolor.h>
28#include <qlabel.h>
29#include <qstatusbar.h>
30#include <qpushbutton.h>
31#include <qmessagebox.h>
32#include <qlineedit.h>
33#include <qwindowsstyle.h>
34#include <qplastiquestyle.h>
35#include <qlist.h>
36#include <qrect.h>
37#include <string.h>
38#include <qtreeview.h>
39#include <qdirmodel.h>
40#include <qevent.h>
41#include <qfiledialog.h>
42#include <qscrollarea.h>
43#include <qcombobox.h>
44#include <qspinbox.h>
45
46#include "Tools/Viewer/Parser/include/parser.h"
47
48
49#define NORTH 0
50#define SOUTH 1
51#define EAST 2
52#define WEST 3
53
54#define MARGEX 50
55#define MARGEY 70
56
57using namespace morpheo::tools::viewer::parser;
58using namespace morpheo::tools::viewer::bdd;
59using namespace std;
60
61namespace morpheo{
62  namespace tools{
63    namespace viewer{
64      namespace graphics{
65
66class Window : public QMainWindow
67{
68 
69  Q_OBJECT
70
71 public:
72
73  Window(QString name);
74  void _setParse(Parse *p);  //parse the base
75  void _init_file();    //search component and port before drawing
76
77 private slots:
78   
79  void _open(); //open a file
80  void _open_error();
81
82  void _save(); //save a file
83  void _saveAs();
84  void _saveAsOk();
85
86  void _close(); //close a file
87
88  void _quit(); //quit a file
89  void _quit2();
90
91  void _zoomIn(); //zoom for the architecture view
92  void _zoomOut();
93  void _defautZoom();
94
95  void _level();
96  void _informations(); //show or hide informations window
97  void _parameters(); //show or hide parameters window
98  void _about(); //about the programm
99  void _component_name(); //show or hide the components name
100  void _signal_name(); //show or hide the signals name
101
102  void _back();//return to the previous view
103  void _cancel_selection();//cancel the selection of a component
104  void _apply();//apply the parameters changes
105  void currentIndexChanged(QString s);
106  void valueChanged(int i);
107
108 protected :
109   void mousePressEvent (QMouseEvent *); //mouse handler when mouse pressed
110   void mouseMoveEvent (QMouseEvent *); //mouse handler in other case
111 private :
112  void wparameters(); // parameters window builder
113  void winformations(); //informations window builder
114  void paintEvent( QPaintEvent * ); //drawing panel
115  void repaint(); //repaint the panel with current parameters
116  void drawPort(int x,int y,int pos,string dir); //draw the components ports
117  void write_name(string type,string name); //write the name of the component clicked name in the informations window
118  void write_comment(string comment);
119  void write_type(string t);
120  void erase_line(QLabel *l1, QLabel *l2);//erase a line in the informations window
121  void erase_comment();//erase and hide the comment line in the informations window
122  void display_param();//display the parameters
123
124  QList <Port> port_east; //ports lists
125  QList <Port> port_west;
126  QList <Port> port_north;
127  QList <Port> port_south;
128  QList <Component> *compo;//component list
129  QList <Param> param;//parameters list
130  QList <Group> *group;//groups list
131
132  QWidget *wscroll;
133  QMainWindow *wparam;//windows widget (informations, parameters, quit, open)
134  QWidget *winfo;
135  QWidget *wq;
136  QWidget *wa;
137
138  QWidget *mess_charg;
139  QWidget *mess;
140  QBoxLayout *informations; //informations box
141  QBoxLayout *parameters; //parameters box
142  QBoxLayout *pbox;
143
144  Parse *parse; //the parser
145  BaseV *base; //the current BaseV
146  BaseP p; //the current BaseP
147  Entity *entity; //entity of current base
148  Coord *c; 
149 
150  QPainter painter;
151
152  QStatusBar *status;//status bar
153
154  QLineEdit *file_name; //retrieve the name user wants to open from the open window
155  QString current_name; //name of the current file opened
156
157  /*items of the informations window*/
158  QLabel *lname;//name of the component clicked
159  QLabel *ln;
160  QLineEdit *comment;//comment associated with the component clicked
161  QLabel *lt;
162  QLabel *ltype;//type of the component
163 
164  int level; //level of architecture
165  int mouseX; //mouse position
166  int mouseY;
167
168  int window_height; //main window size
169  int window_width;
170  int portX;//port size, position and size of components, used when drawing the architecture
171  int portY;
172  int posX;//used to retrieve the position and the size of a component
173  int posY;
174  int tailleX;
175  int tailleY;
176
177  int cpt_level;//level in the architecture
178  QString tab[20];//save the father when user change the level
179
180  QString father;//father name
181  QString current;//name of the current architecture visible
182
183  QScrollArea *sc;
184
185  bool save_as; 
186  bool info_open; //know if the informations window opened or not
187  bool param_open; //know if the parameters window opened or not
188  bool is_save; //know if the file has been saved
189  bool paint; //(re)paint or not
190  bool wq_open; //know if Quit/Open ( 2 windows possible)/Save window is open
191  bool wa_open;
192  bool quit_demand;//know if user clicked on "quit" (used for saving file before quit)
193  bool file_open;//know if a file is still open (used if user wants to open another file)
194  bool signalName;//show or hide signals name
195  bool componentName;//show or hide components name
196  bool charg_open;//back chargement message box opened or not
197  bool mess_open;//chargment message box opened or not
198  bool component_clicked;//if user clicked on a component to modify its parameters
199  bool apply_display;//if the apply button is displayed
200  bool scroll_hide;
201  bool parameter_modify;
202};
203      };
204    };
205  };
206};
207
208#endif
Note: See TracBrowser for help on using the repository browser.