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
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
|
/*
Copyright (C) 2016-2020, Dirk Krause
SPDX-License-Identifier: BSD-3-Clause
*/
/*
WARNING: This file was generated by the dkct program (see
http://dktools.sourceforge.net/ for details).
Changes you make here will be lost if dkct is run again!
You should modify the original source and run dkct on it.
Original source: WxpqdicFrame.wxc
*/
/** @file WxpqdicFrame.h Header file for the WxpqdicFrame module.
*/
#ifndef WXPQDICFRAME_H_INCLUDED
/** Avoid multiple inclusions. */
#define WXPQDICFRAME_H_INCLUDED 1
#line 133 "WxpqdicFrame.wxc"
#line 137 "WxpqdicFrame.wxc"
class WxpqdicFrame : public Dk4WxFrame
{
private:
/** Event table for frame.
*/
#if wxCHECK_VERSION(3,0,0)
wxDECLARE_EVENT_TABLE();
#else
DECLARE_EVENT_TABLE()
#endif
protected:
/** Buffer for response processing.
*/
char bResponse[32 * sizeof(dk4_um_t)];
/** Address pair, 0=remote, 1=local.
*/
dk4_sockaddr_storage_t aAddresses[2];
/** Remote host name as wxChar string.
*/
wxString sHostname;
/** Queue name as wxChar string.
*/
wxString sQueuename;
/** User name as wxChar string.
*/
wxString sUsername;
/** Localized texts.
*/
wxChar const * const *sTexts;
/** Non-localized texts.
*/
wxChar const * const *sNlWx;
/** Non-localized texts.
*/
dkChar const * const *sNlDk;
/** Copy of the command line arguments poiner.
*/
wxChar **copyArgv;
/* __CHANGE__ 011: Add further member variables.
*/
/** Critical section to protect socket and timer.
*/
wxCriticalSection csProtect;
/** Black color for normal status text.
*/
wxColour cBlack;
/** Red color for not allowed to print.
*/
wxColour cRed;
/** Green color for allowed to print.
*/
wxColour cGreen;
/** Timer for periodic updates.
*/
wxTimer timer;
/** Error report from socket subsystem initialization.
*/
dk4_er_t sockerr;
/** Host name to query.
*/
dkChar *pHostname;
/** Print queue to check.
*/
char *pQueuename;
/** User name to use in check.
*/
char *pUsername;
/** Request to send to server.
*/
char *pRequest;
/** Previous limit value.
*/
dk4_um_t uLimit;
/** Previous used value.
*/
dk4_um_t uUsed;
/** Previous account value.
*/
dk4_um_t uAccount;
/** Length of request.
*/
size_t szRequest;
/** Size of response buffer.
*/
size_t szResponse;
/** Time last request was sended.
*/
dk4_time_t tRequestSended;
/** Update interval in seconds.
*/
long lUpdateInterval;
/** Timeout interval before complaining about missing response.
*/
long lWaitResponse;
/** Previous summary value.
*/
int iSummary;
/** Number of command line arguments.
*/
int copyArgc;
/** Current state.
*/
int iState;
/** Socket for data exchange
*/
dk4_socket_t sock;
/** Port number on remote host.
*/
unsigned short usPortnumber;
/** Local port number to use.
*/
unsigned short usLocalPort;
/** Flag: Socket subsystem initialized.
*/
bool bSockInit;
/** Flag: Remote host uses UTF-8 encoding (user name and queue name).
*/
bool bIsUtf8;
/** Flag: This idle event is the first one (no idle events before).
*/
bool bFirstIdle;
/** Flag: All components initialized completely.
*/
bool bIsInitialized;
/** Flag: This is the first response.
*/
bool bFirstResponse;
/** Flag: GUI ok.
*/
bool dkctGUILayoutOK;
/** Contents panel.
*/
wxPanel *dkctGUIContentsPanel;
/** GUI element mainSizer.
*/
#line 58 "WxpqdicFrame.wxc"
wxBoxSizer *mainSizer;
/** GUI element mbMain.
*/
#line 20 "WxpqdicFrame.wxc"
wxMenuBar *mbMain;
/** GUI element tbMain.
*/
#line 115 "WxpqdicFrame.wxc"
wxToolBar *tbMain;
/** GUI element menuFile.
*/
#line 25 "WxpqdicFrame.wxc"
wxMenu *menuFile;
/** GUI element menuView.
*/
#line 34 "WxpqdicFrame.wxc"
wxMenu *menuView;
/** GUI element menuHelp.
*/
#line 43 "WxpqdicFrame.wxc"
wxMenu *menuHelp;
/** GUI element miFileExit.
*/
#line 29 "WxpqdicFrame.wxc"
wxMenuItem *miFileExit;
/** GUI element miViewUpdate.
*/
#line 38 "WxpqdicFrame.wxc"
wxMenuItem *miViewUpdate;
/** GUI element miHelpAbout.
*/
#line 48 "WxpqdicFrame.wxc"
wxMenuItem *miHelpAbout;
/** GUI element miHelpContents.
*/
#line 53 "WxpqdicFrame.wxc"
wxMenuItem *miHelpContents;
/** GUI element verticalSizer.
*/
#line 64 "WxpqdicFrame.wxc"
wxBoxSizer *verticalSizer;
/** GUI element contentsSizer.
*/
#line 72 "WxpqdicFrame.wxc"
wxGridBagSizer *contentsSizer;
/** GUI element lLimit.
*/
#line 87 "WxpqdicFrame.wxc"
wxStaticText *lLimit;
/** GUI element tLimit.
*/
#line 90 "WxpqdicFrame.wxc"
wxStaticText *tLimit;
/** GUI element lUsed.
*/
#line 93 "WxpqdicFrame.wxc"
wxStaticText *lUsed;
/** GUI element tUsed.
*/
#line 96 "WxpqdicFrame.wxc"
wxStaticText *tUsed;
/** GUI element lAccount.
*/
#line 99 "WxpqdicFrame.wxc"
wxStaticText *lAccount;
/** GUI element tAccount.
*/
#line 102 "WxpqdicFrame.wxc"
wxStaticText *tAccount;
/** GUI element lAllowed.
*/
#line 105 "WxpqdicFrame.wxc"
wxStaticText *lAllowed;
/** GUI element tAllowed.
*/
#line 108 "WxpqdicFrame.wxc"
wxStaticText *tAllowed;
/** GUI element lStatus.
*/
#line 111 "WxpqdicFrame.wxc"
wxStaticText *lStatus;
/** GUI element bUpdate.
*/
#line 119 "WxpqdicFrame.wxc"
wxToolBarToolBase *bUpdate;
/** GUI element bExit.
*/
#line 125 "WxpqdicFrame.wxc"
wxToolBarToolBase *bExit;
#line 307 "WxpqdicFrame.wxc"
public:
/** Constructor.
@param wxid Window ID.
@param applicationHelper Application helper object.
@param hc Help controller for online help.
@param argc Number of command line arguments.
@param argv Command line arguments array.
@param localizedTexts Localized wxChar texts.
@param nlWx Non-localized wxChar texts.
@param nlDk Non-localized dkChar texts.
@param bSocketsInitialized Flag: Socket subsys initialized.
@param psockerr Error report from socket initialization.
*/
WxpqdicFrame(
int wxid,
Dk4WxApplicationHelper *applicationHelper,
Dk4WxHelpController *hc,
int argc,
wxChar **argv,
wxChar const * const *localizedTexts,
wxChar const * const *nlWx,
dkChar const * const *nlDk,
bool bSocketsInitialized,
dk4_er_t *psockerr
);
/** Destructor.
*/
~WxpqdicFrame();
/** Check whether we can close the window.
@param isLast Flag: Last main window to close.
*/
bool
CanClose(bool isFinal);
/** Handler for File/Exit.
@param event Event to process.
*/
void
OnQuit(wxCommandEvent & event);
/** Handler for File/Update.
@param event Event to process.
*/
void
OnRun(wxCommandEvent & event);
/** Handler for Help/About.
@param event Event to process.
*/
void
OnAbout(wxCommandEvent & event);
/** Handler for Help/Contents.
@param event Event to process.
*/
void
OnHelpContents(wxCommandEvent & event);
/* __CHANGE__ 008: Remove OnIdle if no idle processing required.
*/
/** Handler for idle events.
*/
void
OnIdle(wxIdleEvent & event);
/* __CHANGE__ 017: Event handlers for further events.
*/
/** Handler for timer event.
@param event Timer event to process.
*/
void
OnTimer(wxTimerEvent & event);
/* __CHANGE__ 014: Add further methods.
*/
private:
/** Attempt to configure.
@param perrc Address of error code variable.
@return True if configuration failed and the application should
exit, false on success.
*/
bool
ConfigureAndCheckNeedToClose(int *perrc);
/** Attempt to receive data, send request again if interval is over.
@return True if the windows requires an update, false otherwise.
*/
bool
DataExchangeWithServer(void);
bool
RetrieveResponse(void);
bool
ProcessResponse(bool & found);
bool
SendRequest(bool force = false);
};
#line 417 "WxpqdicFrame.wxc"
#endif
|