1 | #include "window.h" |
---|
2 | |
---|
3 | |
---|
4 | using namespace std; |
---|
5 | using namespace morpheo::tools::viewer::parser; |
---|
6 | using namespace morpheo::tools::viewer::bdd; |
---|
7 | using namespace morpheo::tools::viewer::graphics; |
---|
8 | |
---|
9 | Window::Window(QString name) |
---|
10 | { |
---|
11 | paint = false; |
---|
12 | window_height = 620; |
---|
13 | window_width = 620; |
---|
14 | charg_open = false; |
---|
15 | mess_open = false; |
---|
16 | component_clicked = false; |
---|
17 | cpt_level=0; |
---|
18 | apply_display = false; |
---|
19 | scroll_hide = false; |
---|
20 | parameter_modify = false; |
---|
21 | |
---|
22 | /*menu bar*/ |
---|
23 | QMenuBar *menu_bar = new QMenuBar(this); |
---|
24 | |
---|
25 | /*items of the menu bar*/ |
---|
26 | QMenu *file = new QMenu(); |
---|
27 | QMenu *tools = new QMenu(); |
---|
28 | QMenu *help = new QMenu(); |
---|
29 | |
---|
30 | /*connect signals of "file" menu with items of the menu bar*/ |
---|
31 | QAction *openAct; |
---|
32 | openAct = new QAction(tr("&open"),this); |
---|
33 | connect(openAct,SIGNAL(triggered()),this,SLOT(_open())); |
---|
34 | |
---|
35 | QAction *closeAct; |
---|
36 | closeAct = new QAction(tr("&close"),this); |
---|
37 | connect(closeAct,SIGNAL(triggered()),this,SLOT(_close())); |
---|
38 | |
---|
39 | QAction *saveAct; |
---|
40 | saveAct = new QAction(tr("&save"),this); |
---|
41 | connect(saveAct,SIGNAL(triggered()),this,SLOT(_save())); |
---|
42 | |
---|
43 | QAction *saveAsAct; |
---|
44 | saveAsAct = new QAction(tr("&save_as"),this); |
---|
45 | connect(saveAsAct,SIGNAL(triggered()),this,SLOT(_saveAs())); |
---|
46 | |
---|
47 | QAction *quitAct; |
---|
48 | quitAct = new QAction(tr("&quit"),this); |
---|
49 | connect(quitAct,SIGNAL(triggered()),this,SLOT(_quit())); |
---|
50 | |
---|
51 | /*add the menu "file" to the menu bar*/ |
---|
52 | file = menu_bar->addMenu(tr("&File")); |
---|
53 | file->addAction(openAct); |
---|
54 | file->addAction(saveAct); |
---|
55 | file->addAction(saveAsAct); |
---|
56 | file->addAction(closeAct); |
---|
57 | file->addAction(quitAct); |
---|
58 | |
---|
59 | /*connect signals of the menu "tools" with items of the menu bar*/ |
---|
60 | QAction *zoomInAct; |
---|
61 | zoomInAct = new QAction(tr("&zoom in"),this); |
---|
62 | connect(zoomInAct,SIGNAL(triggered()),this,SLOT(_zoomIn())); |
---|
63 | |
---|
64 | QAction *zoomOutAct; |
---|
65 | zoomOutAct = new QAction(tr("&zoom out"),this); |
---|
66 | connect(zoomOutAct,SIGNAL(triggered()),this,SLOT(_zoomOut())); |
---|
67 | |
---|
68 | QAction *defautZoomAct; |
---|
69 | defautZoomAct = new QAction(tr("&defaut zoom"),this); |
---|
70 | connect(defautZoomAct,SIGNAL(triggered()),this,SLOT(_defautZoom())); |
---|
71 | |
---|
72 | QAction *levelAct; |
---|
73 | levelAct = new QAction(tr("&level"),this); |
---|
74 | connect(levelAct,SIGNAL(triggered()),this,SLOT(_level())); |
---|
75 | |
---|
76 | QAction *infoAct; |
---|
77 | infoAct = new QAction(tr("&informations"),this); |
---|
78 | connect(infoAct,SIGNAL(triggered()),this,SLOT(_informations())); |
---|
79 | |
---|
80 | QAction *paramAct; |
---|
81 | paramAct = new QAction(tr("¶meters"),this); |
---|
82 | connect(paramAct,SIGNAL(triggered()),this,SLOT(_parameters())); |
---|
83 | |
---|
84 | |
---|
85 | QAction *compoNameAct; |
---|
86 | compoNameAct = new QAction(tr("&components name"),this); |
---|
87 | connect(compoNameAct,SIGNAL(triggered()),this,SLOT(_component_name())); |
---|
88 | |
---|
89 | QAction *signalNameAct; |
---|
90 | signalNameAct = new QAction(tr("&signals name"),this); |
---|
91 | connect(signalNameAct,SIGNAL(triggered()),this,SLOT(_signal_name())); |
---|
92 | |
---|
93 | /*add the menu "tools" to the menu bar*/ |
---|
94 | tools = menu_bar->addMenu(tr("&Tools")); |
---|
95 | //tools->addAction(zoomInAct); |
---|
96 | //tools->addAction(zoomOutAct); |
---|
97 | //tools->addAction(defautZoomAct); |
---|
98 | tools->addAction(compoNameAct); |
---|
99 | tools->addAction(signalNameAct); |
---|
100 | //tools->addAction(levelAct); |
---|
101 | tools->addAction(infoAct); |
---|
102 | tools->addAction(paramAct); |
---|
103 | |
---|
104 | /*connect the menu "about" with items of the menu bar*/ |
---|
105 | QAction *aboutAct; |
---|
106 | aboutAct = new QAction(tr("&about"),this); |
---|
107 | connect(aboutAct,SIGNAL(triggered()),this,SLOT(_about())); |
---|
108 | |
---|
109 | /*add the emenu "about" yo yhe menu bar*/ |
---|
110 | help = menu_bar->addMenu(tr("&About")); |
---|
111 | help->addAction(aboutAct); |
---|
112 | |
---|
113 | /*add the menu bar to the main window*/ |
---|
114 | this->setMenuWidget(menu_bar); |
---|
115 | |
---|
116 | /*add a status bar to the main menu*/ |
---|
117 | status = new QStatusBar(); |
---|
118 | this->setStatusBar(status); |
---|
119 | |
---|
120 | /*defaut size*/ |
---|
121 | this->setFixedSize(window_width,window_height); |
---|
122 | |
---|
123 | /*defaut position*/ |
---|
124 | this->move(0,50); |
---|
125 | |
---|
126 | /*main window title*/ |
---|
127 | this->setWindowTitle("Morpheo Viewer"); |
---|
128 | |
---|
129 | /*parameters window creation*/ |
---|
130 | this->wparameters(); |
---|
131 | param_open = true; |
---|
132 | |
---|
133 | /*informations window creation*/ |
---|
134 | this->winformations(); |
---|
135 | info_open = true; |
---|
136 | |
---|
137 | /*if quit_demand = true, then the user clicked on "quit"*/ |
---|
138 | quit_demand = false; |
---|
139 | |
---|
140 | /*little windows (open, save...), closed at init*/ |
---|
141 | wq_open = false; |
---|
142 | wa_open = false; |
---|
143 | |
---|
144 | /*signals and components name hidden*/ |
---|
145 | signalName = false; |
---|
146 | componentName = false; |
---|
147 | |
---|
148 | /*file unsaved at init*/ |
---|
149 | save_as = false; |
---|
150 | |
---|
151 | current_name = name; |
---|
152 | if(current_name != NULL){ |
---|
153 | is_save = true; |
---|
154 | } |
---|
155 | else { |
---|
156 | file_open = false; |
---|
157 | paint = false; |
---|
158 | is_save = true; |
---|
159 | } |
---|
160 | } |
---|