-
Notifications
You must be signed in to change notification settings - Fork 0
/
mask4.cpp
278 lines (250 loc) · 8.55 KB
/
mask4.cpp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
/*
This file is part of SCADA Plastic rolling machine.
Copyright 2018, Prointegra SL.
SCADA Plastic rolling machine is free software: you can redistribute it and/or modify it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
SCADA Plastic rolling machiner is distributed in the hope that it will
be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with SCADA Plastic rolling machine.
If not, see <https://www.gnu.org/licenses/>.
*/
////////////////////////////////////////////////////////////////////////////
//
// show_mask1 for ProcessViewServer created: Mi. Okt 20 08:43:44 2010
//
////////////////////////////////////////////////////////////////////////////
#include "pvapp.h"
// _begin_of_generated_area_ (do not edit -> use ui2pvc) -------------------
// our mask contains the following objects
enum {
ID_MAIN_WIDGET = 0,
fondo,
imagen_fondo,
alarmHTML,
ackAll,
resetAll,
button_return,
ID_END_OF_WIDGETS
};
static const char *toolTip[] = {
"",
"",
"",
"",
"",
"",
"",
""};
static const char *whatsThis[] = {
"",
"",
"",
"",
"",
"",
"",
""};
static const int widgetType[ID_END_OF_WIDGETS+1] = {
0,
TQFrame,
TQImage,
TQTextBrowser,
TQPushButton,
TQPushButton,
TQPushButton,
-1 };
static int generated_defineMask(PARAM *p)
{
int w,h,depth;
if(p == NULL) return 1;
w = h = depth = strcmp(toolTip[0],whatsThis[0]);
if(widgetType[0] == -1) return 1;
if(w==h) depth=0; // fool the compiler
pvStartDefinition(p,ID_END_OF_WIDGETS);
pvQFrame(p,fondo,0,StyledPanel,Raised,2,1);
pvSetGeometry(p,fondo,0,0,800,600);
pvSetPaletteBackgroundColor(p,fondo,200,215,200);
pvSetFont(p,fondo,"Arial",11,0,0,0,0);
pvDownloadFile(p,"./images/maquina.jpg");
pvQImage(p,imagen_fondo,fondo,"./images/maquina.jpg",&w,&h,&depth);
pvSetGeometry(p,imagen_fondo,0,0,1280,800);
pvSetFont(p,imagen_fondo,"Arial",11,0,0,0,0);
pvSetWhatsThis(p,imagen_fondo,pvtr("./images/maquina.jpg"));
pvQTextBrowser(p,alarmHTML,imagen_fondo);
pvSetGeometry(p,alarmHTML,5,5,650,590);
pvSetFont(p,alarmHTML,"Sans Serif",10,0,0,0,0);
pvQPushButton(p,ackAll,imagen_fondo);
pvSetGeometry(p,ackAll,660,60,125,30);
pvSetText(p,ackAll,pvtr("Ack All"));
pvSetFont(p,ackAll,"Sans Serif",10,0,0,0,0);
pvQPushButton(p,resetAll,imagen_fondo);
pvSetGeometry(p,resetAll,660,100,125,30);
pvSetText(p,resetAll,pvtr("Reset All"));
pvSetFont(p,resetAll,"Sans Serif",10,0,0,0,0);
pvQPushButton(p,button_return,imagen_fondo);
pvSetGeometry(p,button_return,660,18,125,30);
pvSetText(p,button_return,pvtr("volver"));
pvSetFont(p,button_return,"Ubuntu",11,0,0,0,0);
pvEndDefinition(p);
return 0;
}
// _end_of_generated_area_ (do not edit -> use ui2pvc) ---------------------
#include "mask4_slots.h"
static int defineMask(PARAM *p)
{
if(p == NULL) return 1;
generated_defineMask(p);
// (todo: add your code here)
return 0;
}
static int showData(PARAM *p, DATA *d)
{
if(p == NULL) return 1;
if(d == NULL) return 1;
return 0;
}
static int readData(DATA *d) // from shared memory, database or something else
{
if(d == NULL) return 1;
// (todo: add your code here)
return 0;
}
int show_mask4(PARAM *p)
{
DATA d;
char event[MAX_EVENT_LENGTH];
char text[MAX_EVENT_LENGTH];
char str1[MAX_EVENT_LENGTH];
int i,w,h,val,x,y,button,ret;
float xval, yval;
defineMask(p);
//rlSetDebugPrintf(1);
if((ret=slotInit(p,&d)) != 0) return ret;
readData(&d); // from shared memory, database or something else
showData(p,&d);
while(1)
{
pvPollEvent(p,event);
switch(pvParseEvent(event, &i, text))
{
case NULL_EVENT:
readData(&d); // from shared memory, database or something else
showData(p,&d);
if((ret=slotNullEvent(p,&d)) != 0) return ret;
break;
case BUTTON_EVENT:
if(trace) printf("BUTTON_EVENT id=%d\n",i);
if((ret=slotButtonEvent(p,i,&d)) != 0) return ret;
break;
case BUTTON_PRESSED_EVENT:
if(trace) printf("BUTTON_PRESSED_EVENT id=%d\n",i);
if((ret=slotButtonPressedEvent(p,i,&d)) != 0) return ret;
break;
case BUTTON_RELEASED_EVENT:
if(trace) printf("BUTTON_RELEASED_EVENT id=%d\n",i);
if((ret=slotButtonReleasedEvent(p,i,&d)) != 0) return ret;
break;
case TEXT_EVENT:
if(trace) printf("TEXT_EVENT id=%d %s\n",i,text);
if((ret=slotTextEvent(p,i,&d,text)) != 0) return ret;
break;
case SLIDER_EVENT:
sscanf(text,"(%d)",&val);
if(trace) printf("SLIDER_EVENT val=%d\n",val);
if((ret=slotSliderEvent(p,i,&d,val)) != 0) return ret;
break;
case CHECKBOX_EVENT:
if(trace) printf("CHECKBOX_EVENT id=%d %s\n",i,text);
if((ret=slotCheckboxEvent(p,i,&d,text)) != 0) return ret;
break;
case RADIOBUTTON_EVENT:
if(trace) printf("RADIOBUTTON_EVENT id=%d %s\n",i,text);
if((ret=slotRadioButtonEvent(p,i,&d,text)) != 0) return ret;
break;
case GL_INITIALIZE_EVENT:
if(trace) printf("you have to call initializeGL()\n");
if((ret=slotGlInitializeEvent(p,i,&d)) != 0) return ret;
break;
case GL_PAINT_EVENT:
if(trace) printf("you have to call paintGL()\n");
if((ret=slotGlPaintEvent(p,i,&d)) != 0) return ret;
break;
case GL_RESIZE_EVENT:
sscanf(text,"(%d,%d)",&w,&h);
if(trace) printf("you have to call resizeGL(w,h)\n");
if((ret=slotGlResizeEvent(p,i,&d,w,h)) != 0) return ret;
break;
case GL_IDLE_EVENT:
if((ret=slotGlIdleEvent(p,i,&d)) != 0) return ret;
break;
case TAB_EVENT:
sscanf(text,"(%d)",&val);
if(trace) printf("TAB_EVENT(%d,page=%d)\n",i,val);
if((ret=slotTabEvent(p,i,&d,val)) != 0) return ret;
break;
case TABLE_TEXT_EVENT:
sscanf(text,"(%d,%d,",&x,&y);
pvGetText(text,str1);
if(trace) printf("TABLE_TEXT_EVENT(%d,%d,\"%s\")\n",x,y,str1);
if((ret=slotTableTextEvent(p,i,&d,x,y,str1)) != 0) return ret;
break;
case TABLE_CLICKED_EVENT:
sscanf(text,"(%d,%d,%d)",&x,&y,&button);
if(trace) printf("TABLE_CLICKED_EVENT(%d,%d,button=%d)\n",x,y,button);
if((ret=slotTableClickedEvent(p,i,&d,x,y,button)) != 0) return ret;
break;
case SELECTION_EVENT:
sscanf(text,"(%d,",&val);
pvGetText(text,str1);
if(trace) printf("SELECTION_EVENT(column=%d,\"%s\")\n",val,str1);
if((ret=slotSelectionEvent(p,i,&d,val,str1)) != 0) return ret;
break;
case CLIPBOARD_EVENT:
sscanf(text,"(%d",&val);
if(trace) printf("CLIPBOARD_EVENT(id=%d)\n",val);
if(trace) printf("clipboard = \n%s\n",p->clipboard);
if((ret=slotClipboardEvent(p,i,&d,val)) != 0) return ret;
break;
case RIGHT_MOUSE_EVENT:
if(trace) printf("RIGHT_MOUSE_EVENT id=%d text=%s\n",i,text);
if((ret=slotRightMouseEvent(p,i,&d,text)) != 0) return ret;
break;
case KEYBOARD_EVENT:
sscanf(text,"(%d",&val);
if(trace) printf("KEYBOARD_EVENT modifier=%d key=%d\n",i,val);
if((ret=slotKeyboardEvent(p,i,&d,val,i)) != 0) return ret;
break;
case PLOT_MOUSE_MOVED_EVENT:
sscanf(text,"(%f,%f)",&xval,&yval);
if(trace) printf("PLOT_MOUSE_MOVE %f %f\n",xval,yval);
if((ret=slotMouseMovedEvent(p,i,&d,xval,yval)) != 0) return ret;
break;
case PLOT_MOUSE_PRESSED_EVENT:
sscanf(text,"(%f,%f)",&xval,&yval);
if(trace) printf("PLOT_MOUSE_PRESSED %f %f\n",xval,yval);
if((ret=slotMousePressedEvent(p,i,&d,xval,yval)) != 0) return ret;
break;
case PLOT_MOUSE_RELEASED_EVENT:
sscanf(text,"(%f,%f)",&xval,&yval);
if(trace) printf("PLOT_MOUSE_RELEASED %f %f\n",xval,yval);
if((ret=slotMouseReleasedEvent(p,i,&d,xval,yval)) != 0) return ret;
break;
case MOUSE_OVER_EVENT:
sscanf(text,"%d",&val);
if(trace) printf("MOUSE_OVER_EVENT %d\n",val);
if((ret=slotMouseOverEvent(p,i,&d,val)) != 0) return ret;
break;
case USER_EVENT:
if(trace) printf("USER_EVENT id=%d %s\n",i,text);
if((ret=slotUserEvent(p,i,&d,text)) != 0) return ret;
break;
default:
if(trace) printf("UNKNOWN_EVENT id=%d %s\n",i,text);
break;
}
}
}