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

Last change on this file since 30 was 30, checked in by chou, 17 years ago

Morpheo Viewer Release 4.0 :
changements graphiques .

  • Property svn:executable set to *
File size: 5.2 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
43
44#include "Tools/Viewer/Parser/include/parser.h"
45
46
47#define NORTH 0
48#define SOUTH 1
49#define EAST 2
50#define WEST 3
51
52#define MARGEX 50
53#define MARGEY 70
54
55using namespace morpheo::tools::viewer::parser;
56using namespace morpheo::tools::viewer::bdd;
57using namespace std;
58
59namespace morpheo{
60  namespace tools{
61    namespace viewer{
62      namespace graphics{
63
64class Window : public QMainWindow
65{
66 
67  Q_OBJECT
68
69 public:
70
71  Window(QString name);
72  void _setParse(Parse *p);  //parse the base
73  void _init_file();    //search component and port before drawing
74 private slots:
75   
76  void _open(); //open a file
77 void _open_error();
78
79  void _save(); //save a file
80  void _saveAs();
81  void _saveAsOk();
82
83  void _close(); //close a file
84
85  void _quit(); //quit a file
86  void _quit2();
87
88  void _zoomIn(); //zoom for the architecture view
89  void _zoomOut();
90  void _defautZoom();
91
92  void _level(); 
93  void _informations(); //show or hide informations window
94  void _parameters(); //show or hide parameters window
95  void _about(); //about the programm
96  void _component_name(); //show or hide the components name
97  void _signal_name(); //show or hide the signals name
98
99  void _back();//return to the previous view
100  void _cancel_selection();
101  void _apply();
102
103 protected :
104  void mousePressEvent (QMouseEvent *); //mouse handler when mouse pressed
105  void mouseMoveEvent (QMouseEvent *); //mouse handler in other case
106 private :
107  void wparameters(); // parameters window builder
108  void winformations(); //informations window builder
109  void paintEvent( QPaintEvent * ); //drawing panel
110  void repaint(); //repaint the panel with current parameters
111  void drawPort(int x,int y,int pos,string dir); //draw the components ports
112  void write_name(string name); //write the name of the component clicked name in the informations window
113  void write_comment(string comment);
114  void write_type(string t);
115
116  QList <Port> port_east; //ports lists
117  QList <Port> port_west;
118  QList <Port> port_north;
119  QList <Port> port_south;
120  QList <Component> *compo;
121
122  QWidget *wparam;//windows widget (informations, parameters, open, save ...)
123  QWidget *winfo;
124  QWidget *ws;
125  QWidget *wq;
126  QWidget *wa;
127
128  QWidget *mess_charg;
129  QWidget *mess;
130  QBoxLayout *informations; //informations box
131  QBoxLayout *parameters; //parameters box
132
133  Parse *parse; //the parser
134  BaseV *base; //the current BaseV
135  BaseP p; //the current BaseP
136  Entity *entity; //entity of current base
137  Coord *c; 
138 
139  QPainter painter;
140
141  QStatusBar *status;
142
143  QLineEdit *file_name; //retrieve the name user wants to open from the open window
144  QString current_name; //name of the current file opened
145
146  /*items of the informations window*/
147  QLabel *lname;//name of the component clicked
148  QLabel *ln;
149  QLineEdit *comment;//comment associated with the component clicked
150  QLabel *lt;
151  QLabel *ltype;//type of the component
152 
153  int level; //level of architecture
154  int mouseX; //mouse position
155  int mouseY;
156
157  int window_height; //main window size
158  int window_width;
159  int margeX;//size of the marge
160  int margeY;
161  int portX;//port size, position and size of components, used when drawing the architecture
162  int portY;
163  int posX;
164  int posY;
165  int tailleX;
166  int tailleY;
167
168  int cpt_level;
169  QString tab[50];
170
171  QString father;//father name
172  QString current;//name of the current architecture visible
173
174  bool save_as; 
175  bool first_save;
176  bool info_open; //know if the informations window opened or not
177  bool param_open; //know if the parameters window opened or not
178  bool is_save; //know if the file has been saved
179  bool paint; //(re)paint or not
180  bool wq_open; //know if Quit/Open ( 2 windows possible)/Save window is open
181  bool wa_open;
182  bool quit_demand;//know if user clicked on "quit" (used for saving file before quit)
183  bool file_open;//know if a file is still open (used if user wants to open another file)
184  bool signalName;//show or hide signals name
185  bool componentName;//show or hide components name
186  bool charg_open;//back chargement message box opened or not
187  bool mess_open;//chargment message box opened or not
188  bool component_clicked;//if user clicked on a component to modify its parameters
189
190
191};
192      };
193    };
194  };
195};
196
197#endif
Note: See TracBrowser for help on using the repository browser.