/******************************************************/ /* */ /* this class creates the application windows : */ /* - the main window where composants are drawn, */ /* - the parameters window, */ /* - and the informations window. */ /* */ /******************************************************/ #ifndef WINDOW_H #define WINDOW_H #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include #include "Tools/Viewer/Parser/include/parser.h" #define NORTH 0 #define SOUTH 1 #define EAST 2 #define WEST 3 #define MARGEX 50 #define MARGEY 70 using namespace morpheo::tools::viewer::parser; using namespace morpheo::tools::viewer::bdd; using namespace std; namespace morpheo{ namespace tools{ namespace viewer{ namespace graphics{ class Window : public QMainWindow { Q_OBJECT public: Window(QString name); void _setParse(Parse *p); //parse the base void _init_file(); //search component and port before drawing private slots: void _open(); //open a file void _open_end(); void _open_error(); void _save(); //save a file void _saveAs(); void _saveAsOk(); void _close(); //close a file void _quit(); //quit a file void _quit2(); void _zoomIn(); //zoom for the architecture view void _zoomOut(); void _defautZoom(); void _level(); void _informations(); //show or hide informations window void _parameters(); //show or hide parameters window void _about(); //about the programm void _component_name(); //show or hide the components name void _signal_name(); //show or hide the signals name void _back();//return to the previous view void _cancel_selection(); void _apply(); protected : void mousePressEvent (QMouseEvent *); //mouse handler when mouse pressed void mouseMoveEvent (QMouseEvent *); //mouse handler in other case private : void wparameters(); // parameters window builder void winformations(); //informations window builder void paintEvent( QPaintEvent * ); //drawing panel void repaint(); //repaint the panel with current parameters void drawPort(int x,int y,int pos,string dir); //draw the components ports void write_name(string name); //write the name of the component clicked name in the informations window void write_position(int x, int y);//write the position of the position clicked in the informations window void write_size(int x, int y);//write the size of the component clicked in the informations window void write_comment(string comment); void erase_position(); void erase_size(); QList port_east; //ports lists QList port_west; QList port_north; QList port_south; QList *compo; QWidget *wparam;//windows widget (informations, parameters, open, save ...) QWidget *winfo; QWidget *ws; QWidget *wq; QWidget *wo; QWidget *wa; QWidget *mess_charg; QWidget *mess; QBoxLayout *informations; //informations box QBoxLayout *parameters; //parameters box Parse *parse; //the parser BaseV *base; //the current BaseV BaseP p; //the current BaseP Entity *entity; //entity of current base Coord *c; QPainter painter; QStatusBar *status; QLineEdit *file_name; //retrieve the name user wants to open from the open window QString current_name; //name of the current file opened /*items of the parameters window*/ QLineEdit *positionX; //x position QLineEdit *positionY;//y position QLineEdit *sizeX;//x size QLineEdit *sizeY;//y size /*items of the informations window*/ QLabel *lname;//name of the component clicked QLineEdit *comment;//comment associated with the component clicked int level; //level of architecture int mouseX; //mouse position int mouseY; int window_height; //main window size int window_width; int margeX;//size of the marge int margeY; int portX;//port size, position and size of components, used when drawing the architecture int portY; int posX; int posY; int tailleX; int tailleY; int cpt_level; QString tab[50]; QString father;//father name QString current;//name of the current architecture visible bool save_as; bool first_save; bool info_open; //know if the informations window opened or not bool param_open; //know if the parameters window opened or not bool is_save; //know if the file has been saved bool paint; //(re)paint or not bool wq_open; //know if Quit/Open ( 2 windows possible)/Save window is open bool wo_open; bool ws_open; bool wa_open; bool quit_demand;//know if user clicked on "quit" (used for saving file before quit) bool file_open;//know if a file is still open (used if user wants to open another file) bool is_parse;//know is the base has been created bool signalName;//show or hide signals name bool componentName;//show or hide components name bool charg_open;//back chargement message box opened or not bool mess_open;//chargment message box opened or not bool component_clicked;//if user clicked on a component to modify its parameters }; }; }; }; }; #endif