-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathfuelGaugeObject.e
527 lines (449 loc) · 17.4 KB
/
fuelGaugeObject.e
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
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
OPT MODULE, OSVERSION=37
MODULE 'reaction/reaction_macros',
'window','classes/window',
'gadgets/layout','layout',
'reaction/reaction_lib',
'button','gadgets/button',
'fuelgauge','gadgets/fuelgauge',
'string',
'gadgets/integer','integer',
'gadgets/chooser','chooser',
'gadgets/checkbox','checkbox',
'images/label','label',
'images/bevel',
'amigalib/boopsi',
'libraries/gadtools',
'intuition/screens',
'intuition/intuition',
'intuition/imageclass',
'intuition/gadgetclass'
MODULE '*reactionObject','*reactionForm','*colourPicker','*sourceGen','*validator'
EXPORT ENUM FGAUGEGAD_IDENT, FGAUGEGAD_NAME, FGAUGEGAD_HINT, FGAUGEGAD_MIN, FGAUGEGAD_MAX, FGAUGEGAD_LEVEL, FGAUGEGAD_TICKSIZE,
FGAUGEGAD_TICKS, FGAUGEGAD_ORIENTATION, FGAUGEGAD_JUSTIFICATION, FGAUGEGAD_SHORTTICKS,
FGAUGEGAD_PERCENT, FGAUGEGAD_TICKPEN, FGAUGEGAD_PERCENTPEN, FGAUGEGAD_EMPTYPEN,
FGAUGEGAD_FILLPEN,
FGAUGEGAD_OK, FGAUGEGAD_CHILD, FGAUGEGAD_CANCEL
CONST NUM_FGAUGE_GADS=FGAUGEGAD_CANCEL+1
EXPORT OBJECT fuelGaugeObject OF reactionObject
min:INT
max:INT
level:INT
tickSize:INT
ticks:INT
orientation:CHAR
justification:CHAR
shortTicks:CHAR
percent:CHAR
tickPen:CHAR
percentPen:CHAR
emptyPen:CHAR
fillPen:CHAR
ENDOBJECT
OBJECT fuelGaugeSettingsForm OF reactionForm
PRIVATE
fuelGaugeObject:PTR TO fuelGaugeObject
labels1:PTR TO LONG
labels2:PTR TO LONG
labels3:PTR TO LONG
ENDOBJECT
PROC create() OF fuelGaugeSettingsForm
DEF gads:PTR TO LONG
NEW gads[NUM_FGAUGE_GADS]
self.gadgetList:=gads
NEW gads[NUM_FGAUGE_GADS]
self.gadgetActions:=gads
self.labels3:=chooserLabelsA(['DETAILPEN', 'BLOCKPEN', 'TEXTPEN', 'SHINEPEN','SHADOWPEN','FILLPEN','FILLTEXTPEN','BACKGROUNDPEN','HIGHLIGHTTEXTPEN',0])
self.windowObj:=WindowObject,
WA_TITLE, 'FuelGauge Attribute Setting',
WA_LEFT, 0,
WA_TOP, 0,
WA_HEIGHT, 80,
WA_WIDTH, 150,
WA_MINWIDTH, 150,
WA_MAXWIDTH, 8192,
WA_MINHEIGHT, 80,
WA_MAXHEIGHT, 8192,
WA_ACTIVATE, TRUE,
WINDOW_POSITION, WPOS_CENTERSCREEN,
WA_PUBSCREEN, 0,
->WA_CustomScreen, gScreen,
->WINDOW_AppPort, gApp_port,
WA_CLOSEGADGET, TRUE,
WA_DEPTHGADGET, TRUE,
WA_SIZEGADGET, TRUE,
WA_DRAGBAR, TRUE,
WA_IDCMP,IDCMP_GADGETDOWN OR IDCMP_GADGETUP OR IDCMP_CLOSEWINDOW OR 0,
WINDOW_PARENTGROUP, VLayoutObject,
LAYOUT_SPACEOUTER, TRUE,
LAYOUT_DEFERLAYOUT, TRUE,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_IDENT ]:=StringObject,
GA_ID, FGAUGEGAD_IDENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Identifier',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_NAME ]:=StringObject,
GA_ID, FGAUGEGAD_NAME,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
STRINGA_MAXCHARS, 80,
StringEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Label',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_HINT ]:=ButtonObject,
GA_ID, FGAUGEGAD_HINT,
GA_TEXT, 'Hint',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_MIN ]:=IntegerObject,
GA_ID, FGAUGEGAD_MIN,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MINIMUM, 0,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Min',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_MAX ]:=IntegerObject,
GA_ID, FGAUGEGAD_MAX,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MINIMUM, 0,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Ma_x',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_LEVEL ]:=IntegerObject,
GA_ID, FGAUGEGAD_LEVEL,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MINIMUM, 0,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Level',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_TICKSIZE ]:=IntegerObject,
GA_ID, FGAUGEGAD_TICKSIZE,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MINIMUM, 0,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Tick _Size',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_TICKS ]:=IntegerObject,
GA_ID, FGAUGEGAD_TICKS,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
INTEGER_MINIMUM, 0,
IntegerEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Ticks',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_ORIENTATION ]:=ChooserObject,
GA_ID, FGAUGEGAD_ORIENTATION,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels1:=chooserLabelsA(['FGORIENT_HORIZ','FGORIENT_VERT',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Or_ientation',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_JUSTIFICATION ]:=ChooserObject,
GA_ID, FGAUGEGAD_JUSTIFICATION,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels2:=chooserLabelsA(['FGJ_LEFT','FGJ_CENTER',0]),
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_Justification',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_SHORTTICKS ]:=CheckBoxObject,
GA_ID, FGAUGEGAD_SHORTTICKS,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, 'Sho_rtTicks',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_PERCENT ]:=CheckBoxObject,
GA_ID, FGAUGEGAD_PERCENT,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, '_Percent',
CHECKBOX_TEXTPLACE, PLACETEXT_LEFT,
CheckBoxEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_TICKPEN ]:=ChooserObject,
GA_ID, FGAUGEGAD_TICKPEN,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels3,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Tic_kPen',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_PERCENTPEN ]:=ChooserObject,
GA_ID, FGAUGEGAD_PERCENTPEN,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels3,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Perc_ent',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_EMPTYPEN ]:=ChooserObject,
GA_ID, FGAUGEGAD_EMPTYPEN,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels3,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, 'Empt_yPen',
LabelEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_FILLPEN ]:=ChooserObject,
GA_ID, FGAUGEGAD_FILLPEN,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
CHOOSER_POPUP, TRUE,
CHOOSER_MAXLABELS, 12,
CHOOSER_ACTIVE, 0,
CHOOSER_WIDTH, -1,
CHOOSER_LABELS, self.labels3,
ChooserEnd,
CHILD_LABEL, LabelObject,
LABEL_TEXT, '_FillPen',
LabelEnd,
LayoutEnd,
LAYOUT_ADDCHILD, LayoutObject,
LAYOUT_ORIENTATION, LAYOUT_ORIENT_HORIZ,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_OK ]:=ButtonObject,
GA_ID, FGAUGEGAD_OK,
GA_TEXT, '_OK',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_CHILD ]:=ButtonObject,
GA_ID, FGAUGEGAD_CHILD,
GA_TEXT, 'C_hild',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LAYOUT_ADDCHILD, self.gadgetList[ FGAUGEGAD_CANCEL ]:=ButtonObject,
GA_ID, FGAUGEGAD_CANCEL,
GA_TEXT, '_Cancel',
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
ButtonEnd,
LayoutEnd,
LayoutEnd,
WindowEnd
self.gadgetActions[FGAUGEGAD_CHILD]:={editChildSettings}
self.gadgetActions[FGAUGEGAD_HINT]:={editHint}
self.gadgetActions[FGAUGEGAD_CANCEL]:=MR_CANCEL
self.gadgetActions[FGAUGEGAD_OK]:=MR_OK
ENDPROC
PROC editHint(nself,gadget,id,code) OF fuelGaugeSettingsForm
self:=nself
self.setBusy()
self.fuelGaugeObject.editHint()
self.clearBusy()
self.updateHint(FGAUGEGAD_HINT, self.fuelGaugeObject.hintText)
ENDPROC
PROC editChildSettings(nself,gadget,id,code) OF fuelGaugeSettingsForm
self:=nself
self.setBusy()
self.fuelGaugeObject.editChildSettings()
self.clearBusy()
ENDPROC
PROC end() OF fuelGaugeSettingsForm
freeChooserLabels( self.labels1 )
freeChooserLabels( self.labels2 )
freeChooserLabels( self.labels3 )
END self.gadgetList[NUM_FGAUGE_GADS]
END self.gadgetActions[NUM_FGAUGE_GADS]
DisposeObject(self.windowObj)
ENDPROC
EXPORT PROC canClose(modalRes) OF fuelGaugeSettingsForm
DEF res
IF modalRes=MR_CANCEL THEN RETURN TRUE
IF checkIdent(self,self.fuelGaugeObject,FGAUGEGAD_IDENT)=FALSE
RETURN FALSE
ENDIF
ENDPROC TRUE
PROC editSettings(comp:PTR TO fuelGaugeObject) OF fuelGaugeSettingsForm
DEF res
self.fuelGaugeObject:=comp
self.updateHint(FGAUGEGAD_HINT, comp.hintText)
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_IDENT ],0,0,[STRINGA_TEXTVAL,comp.ident,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_NAME ],0,0,[STRINGA_TEXTVAL,comp.name,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_MIN ],0,0,[INTEGER_NUMBER,comp.min,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_MAX ],0,0,[INTEGER_NUMBER,comp.max,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_LEVEL ],0,0,[INTEGER_NUMBER,comp.level,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_TICKSIZE ],0,0,[INTEGER_NUMBER,comp.tickSize,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_TICKS ],0,0,[INTEGER_NUMBER,comp.ticks,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_ORIENTATION ],0,0,[CHOOSER_SELECTED,comp.orientation,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_JUSTIFICATION ],0,0,[CHOOSER_SELECTED,comp.justification,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_SHORTTICKS ],0,0,[CHECKBOX_CHECKED,comp.shortTicks,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_PERCENT ],0,0,[CHECKBOX_CHECKED,comp.percent,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_TICKPEN ],0,0,[CHOOSER_SELECTED,comp.tickPen,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_PERCENTPEN ],0,0,[CHOOSER_SELECTED,comp.percentPen,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_EMPTYPEN ],0,0,[CHOOSER_SELECTED,comp.emptyPen,0])
SetGadgetAttrsA(self.gadgetList[ FGAUGEGAD_FILLPEN ],0,0,[CHOOSER_SELECTED,comp.fillPen,0])
res:=self.showModal()
IF res=MR_OK
AstrCopy(comp.ident,Gets(self.gadgetList[ FGAUGEGAD_IDENT ],STRINGA_TEXTVAL))
AstrCopy(comp.name,Gets(self.gadgetList[ FGAUGEGAD_NAME ],STRINGA_TEXTVAL))
comp.min:=Gets(self.gadgetList[ FGAUGEGAD_MIN ],INTEGER_NUMBER)
comp.max:=Gets(self.gadgetList[ FGAUGEGAD_MAX ],INTEGER_NUMBER)
comp.level:=Gets(self.gadgetList[ FGAUGEGAD_LEVEL ],INTEGER_NUMBER)
comp.tickSize:=Gets(self.gadgetList[ FGAUGEGAD_TICKSIZE ],INTEGER_NUMBER)
comp.ticks:=Gets(self.gadgetList[ FGAUGEGAD_TICKS ],INTEGER_NUMBER)
IF comp.ticks=1 THEN comp.ticks:=2 ->will cause a crash if ticks=1
comp.orientation:=Gets(self.gadgetList[ FGAUGEGAD_ORIENTATION ],CHOOSER_SELECTED)
comp.justification:=Gets(self.gadgetList[ FGAUGEGAD_JUSTIFICATION ],CHOOSER_SELECTED)
comp.shortTicks:=Gets(self.gadgetList[ FGAUGEGAD_SHORTTICKS ],CHECKBOX_CHECKED)
comp.percent:=Gets(self.gadgetList[ FGAUGEGAD_PERCENT ],CHECKBOX_CHECKED)
comp.tickPen:=Gets(self.gadgetList[ FGAUGEGAD_TICKPEN ],CHOOSER_SELECTED)
comp.percentPen:=Gets(self.gadgetList[ FGAUGEGAD_PERCENTPEN ],CHOOSER_SELECTED)
comp.emptyPen:=Gets(self.gadgetList[ FGAUGEGAD_EMPTYPEN ],CHOOSER_SELECTED)
comp.fillPen:=Gets(self.gadgetList[ FGAUGEGAD_FILLPEN ],CHOOSER_SELECTED)
ENDIF
ENDPROC res=MR_OK
EXPORT PROC createPreviewObject(scr) OF fuelGaugeObject
self.previewObject:=FuelGaugeObject,
GA_ID, self.id,
GA_RELVERIFY, TRUE,
GA_TABCYCLE, TRUE,
GA_TEXT, self.name,
FUELGAUGE_MIN, self.min,
FUELGAUGE_MAX, self.max,
FUELGAUGE_LEVEL, self.level,
FUELGAUGE_ORIENTATION, ListItem([FGORIENT_HORIZ,FGORIENT_VERT],self.orientation),
FUELGAUGE_PERCENT, self.percent,
FUELGAUGE_SHORTTICKS, self.shortTicks,
FUELGAUGE_TICKS,self.ticks,
FUELGAUGE_TICKSIZE,self.tickSize,
FUELGAUGE_TICKPEN,self.tickPen,
FUELGAUGE_PERCENTPEN,self.percentPen,
FUELGAUGE_EMPTYPEN,self.emptyPen,
FUELGAUGE_FILLPEN,self.fillPen,
FUELGAUGE_JUSTIFICATION, ListItem([FGJ_LEFT, FGJ_CENTER],self.justification),
FuelGaugeEnd
IF self.previewObject=0 THEN self.previewObject:=self.createErrorObject(scr)
self.makePreviewChildAttrs(0)
ENDPROC
EXPORT PROC create(parent) OF fuelGaugeObject
self.type:=TYPE_FUELGAUGE
SUPER self.create(parent)
self.min:=0
self.max:=0
self.level:=0
self.tickSize:=5
self.ticks:=0
self.orientation:=0
self.justification:=0
self.shortTicks:=0
self.percent:=0
self.tickPen:=3
self.percentPen:=2
self.emptyPen:=7
self.fillPen:=5
self.libsused:=[TYPE_FUELGAUGE, TYPE_LABEL]
ENDPROC
EXPORT PROC editSettings() OF fuelGaugeObject
DEF editForm:PTR TO fuelGaugeSettingsForm
DEF res
NEW editForm.create()
res:=editForm.editSettings(self)
END editForm
ENDPROC res
#define makeProp(a,b) 'a',{self.a},b
EXPORT PROC serialiseData() OF fuelGaugeObject IS
[
makeProp(min,FIELDTYPE_INT),
makeProp(max,FIELDTYPE_INT),
makeProp(level,FIELDTYPE_INT),
makeProp(tickSize,FIELDTYPE_INT),
makeProp(ticks,FIELDTYPE_INT),
makeProp(orientation,FIELDTYPE_CHAR),
makeProp(justification,FIELDTYPE_CHAR),
makeProp(shortTicks,FIELDTYPE_CHAR),
makeProp(percent,FIELDTYPE_CHAR),
makeProp(tickPen,FIELDTYPE_CHAR),
makeProp(percentPen,FIELDTYPE_CHAR),
makeProp(emptyPen,FIELDTYPE_CHAR),
makeProp(fillPen,FIELDTYPE_CHAR)
]
EXPORT PROC genCodeProperties(srcGen:PTR TO srcGen) OF fuelGaugeObject
DEF penlist
penlist:=['DETAILPEN', 'BLOCKPEN', 'TEXTPEN', 'SHINEPEN','SHADOWPEN','FILLPEN','FILLTEXTPEN','BACKGROUNDPEN','HIGHLIGHTTEXTPEN']
srcGen.componentProperty('GA_RelVerify','TRUE',FALSE)
srcGen.componentPropertyInt('GA_Text',self.name)
srcGen.componentPropertyInt('FUELGAUGE_Min',self.min)
srcGen.componentPropertyInt('FUELGAUGE_Max',self.max)
srcGen.componentPropertyInt('FUELGAUGE_Level',self.level)
IF self.tickSize<>5 THEN srcGen.componentPropertyInt('FUELGAUGE_TickSize',self.tickSize)
IF self.ticks<>4 THEN srcGen.componentPropertyInt('FUELGAUGE_Ticks',self.ticks)
IF self.shortTicks THEN srcGen.componentProperty('FUELGAUGE_ShortTicks','TRUE',FALSE)
IF self.percent=FALSE THEN srcGen.componentProperty('FUELGAUGE_Percent','FALSE',FALSE)
IF self.orientation<>0 THEN srcGen.componentProperty('FUELGAUGE_Orientation',ListItem(['FGORIENT_HORIZ','FGORIENT_VERT'],self.orientation),FALSE)
IF self.justification<>0 THEN srcGen.componentProperty('FUELGAUGE_Justification',ListItem(['FGJ_LEFT','FGJ_CENTER'],self.justification),FALSE)
IF self.tickPen<>3 THEN srcGen.componentProperty('FUELGAUGE_TickPen',ListItem(penlist,self.tickPen),FALSE)
IF self.percentPen<>2 THEN srcGen.componentProperty('FUELGAUGE_PercentPen',ListItem(penlist,self.percentPen),FALSE)
IF self.emptyPen<>7 THEN srcGen.componentProperty('FUELGAUGE_EmptyPen',ListItem(penlist,self.emptyPen),FALSE)
IF self.fillPen<>7 THEN srcGen.componentProperty('FUELGAUGE_FillPen',ListItem(penlist,self.fillPen),FALSE)
ENDPROC
EXPORT PROC genCodeChildProperties(srcGen:PTR TO srcGen) OF fuelGaugeObject
SUPER self.genCodeChildProperties(srcGen)
ENDPROC
EXPORT PROC getTypeName() OF fuelGaugeObject
RETURN 'FuelGauge'
ENDPROC
EXPORT PROC createFuelGaugeObject(parent)
DEF fuel:PTR TO fuelGaugeObject
NEW fuel.create(parent)
ENDPROC fuel