forked from dmcoles/ReBuild
-
Notifications
You must be signed in to change notification settings - Fork 0
/
eSourceGen.e
1346 lines (1242 loc) · 55.1 KB
/
eSourceGen.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
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
OPT MODULE,LARGE
MODULE 'images/drawlist','gadgets/tabs'
MODULE '*baseStreamer','*sourceGen','*reactionObject','*menuObject','*windowObject','*stringlist','*screenObject'
MODULE '*chooserObject','*clickTabObject','*radioObject','*listBrowserObject','*rexxObject','*tabsObject',
'*reactionListObject','*reactionLists','*drawlistObject','*speedBarObject','*listViewObject','*requesterObject','*requesterItemObject'
EXPORT OBJECT eSrcGen OF srcGen
ENDOBJECT
ENUM ENUM_IDS, ENUM_IDENTS, ENUM_IDXS
PROC create(fser:PTR TO baseStreamer,libsused,definitionOnly,useIds,useMacros) OF eSrcGen
SUPER self.create(fser,libsused,definitionOnly,useIds,useMacros)
self.type:=ESOURCE_GEN
self.stringDelimiter:=39
self.orOperator:='OR'
self.upperCaseProperties:=TRUE
AstrCopy(self.assignChars,':=')
self.extraPadding:=FALSE
self.indent:=0
self.terminator:=0
ENDPROC
PROC createEnum(enumName:PTR TO CHAR, listObjects:PTR TO stdlist, enumType) OF eSrcGen
DEF n=0, j
DEF listObject:PTR TO reactionObject
DEF tempStr[255]:STRING
self.write('ENUM ')
FOR j:=0 TO listObjects.count()-1
IF j>0
self.write(', ')
n:=n+2
ENDIF
IF n>60
self.writeLine('')
self.write(' ')
n:=0
ENDIF
listObject:=listObjects.item(j)
listObject.gadindex:=j
StrCopy(tempStr,listObject.ident)
UpperStr(tempStr)
self.write(tempStr)
n:=n+StrLen(tempStr)
IF (enumType=ENUM_IDS) OR (enumType=ENUM_IDENTS)
StringF(tempStr,'_ID = \d',listObject.id)
n:=n+StrLen(tempStr)
self.write(tempStr)
ENDIF
ENDFOR
self.writeLine('')
ENDPROC
PROC genHeader(screenObject:PTR TO screenObject,rexxObject:PTR TO rexxObject, requesterObject:PTR TO requesterObject,
windowItems:PTR TO stdlist, windowLayouts:PTR TO stdlist, sharedPort) OF eSrcGen
DEF tempStr[200]:STRING
DEF hasarexx,i
DEF windowObject:PTR TO reactionObject
DEF layoutObject:PTR TO reactionObject
DEF listObjects:PTR TO stdlist
DEF reqItem:PTR TO requesterItemObject
DEF bodyText
hasarexx:=(rexxObject.commands.count()>0) AND (StrLen(rexxObject.hostName)>0)
self.writeLine('OPT OSVERSION=37')
self.writeLine('')
self.writeLine(' MODULE \areaction/reaction_macros\a,')
self.writeLine(' \areaction/reaction_lib\a,')
self.writeLine(' \awindow\a,\aclasses/window\a,')
self.writeLine(' \agadgets/layout\a,\alayout\a,')
self.writeLine(' \alibraries/gadtools\a,\agadtools\a,')
self.writeLine(' \aicon\a,')
IF self.libsused[TYPE_BUTTON] THEN self.writeLine(' \abutton\a,\agadgets/button\a,')
IF self.libsused[TYPE_CHECKBOX] THEN self.writeLine(' \acheckbox\a,\agadgets/checkbox\a,')
IF self.libsused[TYPE_CHOOSER] THEN self.writeLine(' \achooser\a,\agadgets/chooser\a,')
IF self.libsused[TYPE_CLICKTAB] THEN self.writeLine(' \aclicktab\a,\agadgets/clicktab\a,')
IF self.libsused[TYPE_FUELGAUGE] THEN self.writeLine(' \afuelgauge\a,\agadgets/fuelgauge\a,')
IF self.libsused[TYPE_GETFILE] THEN self.writeLine(' \agetfile\a,\agadgets/getfile\a,')
IF self.libsused[TYPE_GETFONT] THEN self.writeLine(' \agetfont\a,\agadgets/getfont\a,')
IF self.libsused[TYPE_GETSCREENMODE] THEN self.writeLine(' \agetscreenmode\a,\agadgets/getscreenmode\a,')
IF self.libsused[TYPE_INTEGER] THEN self.writeLine(' \ainteger\a,\agadgets/integer\a,')
IF self.libsused[TYPE_PALETTE] THEN self.writeLine(' \apalette\a,\agadgets/palette\a,')
IF self.libsused[TYPE_LISTBROWSER] THEN self.writeLine(' \alistbrowser\a,\agadgets/listbrowser\a,')
IF self.libsused[TYPE_RADIO] THEN self.writeLine(' \aradiobutton\a,\agadgets/radiobutton\a,')
IF self.libsused[TYPE_SCROLLER] THEN self.writeLine(' \ascroller\a,\agadgets/scroller\a,')
IF self.libsused[TYPE_SLIDER] THEN self.writeLine(' \aslider\a,\agadgets/slider\a,')
IF self.libsused[TYPE_STRING] THEN self.writeLine(' \astring\a,\agadgets/string\a,')
IF self.libsused[TYPE_SPACE] THEN self.writeLine(' \aspace\a,')
IF self.libsused[TYPE_SPEEDBAR] THEN self.writeLine(' \aspeedbar\a,\agadgets/speedbar\a,')
IF self.libsused[TYPE_TEXTFIELD] THEN self.writeLine(' \atextfield\a,\agadgets/textfield\a,')
IF self.libsused[TYPE_BEVEL] THEN self.writeLine(' \abevel\a,')
IF self.libsused[TYPE_DRAWLIST] THEN self.writeLine(' \adrawlist\a,\aimages/drawlist\a,')
IF self.libsused[TYPE_GLYPH] THEN self.writeLine(' \aglyph\a,\aimages/glyph\a,')
IF self.libsused[TYPE_LABEL] THEN self.writeLine(' \alabel\a,\aimages/label\a,')
IF self.libsused[TYPE_BITMAP] THEN self.writeLine(' \abitmap\a,\aimages/bitmap\a,')
IF (self.libsused[TYPE_BOINGBALL] OR self.libsused[TYPE_PENMAP]) THEN self.writeLine(' \apenmap\a,\aimages/penmap\a,')
IF self.libsused[TYPE_COLORWHEEL] THEN self.writeLine(' \acolorwheel\a,\agadgets/colorwheel\a,')
IF self.libsused[TYPE_DATEBROWSER] THEN self.writeLine(' \adatebrowser\a,\agadgets/datebrowser\a,')
IF self.libsused[TYPE_GETCOLOR] THEN self.writeLine(' \agetcolor\a,\agadgets/getcolor\a,')
IF self.libsused[TYPE_GRADSLIDER] THEN self.writeLine(' \agadgets/gradientslider\a,')
IF self.libsused[TYPE_TAPEDECK] THEN self.writeLine(' \agadgets/tapedeck\a,')
IF self.libsused[TYPE_TEXTEDITOR] THEN self.writeLine(' \agadgets/texteditor\a,\atexteditor\a,')
IF self.libsused[TYPE_LED] THEN self.writeLine(' \aimages/led\a,')
IF self.libsused[TYPE_LISTVIEW] THEN self.writeLine(' \agadgets/listview\a,\alistview\a,')
IF self.libsused[TYPE_VIRTUAL] THEN self.writeLine(' \agadgets/virtual\a,\avirtual\a,')
IF self.libsused[TYPE_SKETCH] THEN self.writeLine(' \agadgets/sketchboard\a,\asketchboard\a,')
IF self.libsused[TYPE_TABS] THEN self.writeLine(' \agadgets/tabs\a,')
self.writeLine(' \aimages/bevel\a,')
self.writeLine(' \aamigalib/boopsi\a,')
self.writeLine(' \aexec\a,')
IF self.libsused[TYPE_SPEEDBAR] OR self.libsused[TYPE_LISTVIEW] OR self.libsused[TYPE_LISTBROWSER]
self.writeLine(' \aexec/lists\a,\aexec/nodes\a,')
self.writeLine(' \aexec/memory\a,')
self.writeLine(' \aamigalib/lists\a,')
ENDIF
self.writeLine(' \aintuition/intuition\a,')
self.writeLine(' \aintuition/imageclass\a,')
self.writeLine(' \aintuition/icclass\a,')
self.writeLine(' \aintuition/screens\a,')
IF self.libsused[TYPE_GETSCREENMODE]
self.writeLine(' \agraphics/displayinfo\a,')
ENDIF
IF (screenObject.custom) OR self.libsused[TYPE_GETSCREENMODE]
self.writeLine(' \agraphics/modeid\a,')
ENDIF
IF hasarexx
self.writeLine(' \aclasses/arexx\a,\aarexx\a,')
IF rexxObject.replyHook
self.writeLine(' \autility/hooks\a,\atools/installhook\a,')
ENDIF
ENDIF
IF requesterObject.children.count()>0
self.writeLine(' \arequester\a,\aclasses/requester\a,')
ENDIF
self.writeLine(' \aintuition/gadgetclass\a')
self.writeLine('')
NEW listObjects.stdlist(20)
self.writeLine('')
FOR i:=0 TO windowItems.count()-1
windowObject:=windowItems.item(i)
listObjects.add(windowObject)
ENDFOR
self.writeLine('->window ids')
self.createEnum('win',listObjects,ENUM_IDENTS)
self.writeLine('')
listObjects.clear()
FOR i:=0 TO windowItems.count()-1
layoutObject:=windowLayouts.item(i)
windowObject:=windowItems.item(i)
listObjects.clear()
layoutObject.findObjectsByType(listObjects,-1)
StringF(tempStr,'->\s gadgets',windowObject.ident)
self.writeLine(tempStr)
self.createEnum(windowObject.ident,listObjects,ENUM_IDXS)
IF self.useIds THEN self.createEnum(windowObject.ident,listObjects,ENUM_IDS)
ENDFOR
END listObjects
self.writeLine('')
IF self.libsused[TYPE_GRADSLIDER]
self.writeLine('DEF gradientsliderbase')
ENDIF
IF self.libsused[TYPE_TAPEDECK]
self.writeLine('DEF tapedeckbase')
ENDIF
IF self.libsused[TYPE_LED]
self.writeLine('DEF ledbase')
ENDIF
IF self.libsused[TYPE_TABS]
self.writeLine('DEF tabsbase')
ENDIF
self.writeLine('DEF gScreen=0,gVisInfo=0,gDrawInfo=0,gAppPort=0')
IF sharedPort
self.writeLine('DEF gSharedPort=0')
ENDIF
IF hasarexx
self.writeLine('DEF gArexxObject=0')
IF rexxObject.replyHook
self.writeLine('DEF gArexxReplyHook:hook')
ENDIF
StringF(tempStr,'DEF gRxCommands[\d]:ARRAY OF arexxcmd',rexxObject.commands.count()+1)
self.writeLine(tempStr)
ENDIF
self.writeLine('')
IF hasarexx
self.writeLine('PROC setupArexx()')
FOR i:=0 TO rexxObject.commands.count()-1
StringF(tempStr,'\s',rexxObject.commands.item(i))
StringF(tempStr,' gRxCommands[\d].name:=\a\s\a',i,tempStr)
self.writeLine(tempStr)
StringF(tempStr,' gRxCommands[\d].id:=\d',i,i)
self.writeLine(tempStr)
StringF(tempStr,'rexx_\s',rexxObject.commands.item(i))
LowerStr(tempStr)
StringF(tempStr,' gRxCommands[\d].func:={\s}',i,tempStr)
self.writeLine(tempStr)
self.writeLine('')
ENDFOR
StringF(tempStr,' gRxCommands[\d].name:=0',i)
self.writeLine(tempStr)
StringF(tempStr,' gRxCommands[\d].id:=0',i)
self.writeLine(tempStr)
StringF(tempStr,' gRxCommands[\d].func:=0',i)
self.writeLine(tempStr)
self.writeLine('')
IF self.useMacros
self.writeLine(' gArexxObject:=ARexxObject,')
ELSE
self.writeLine(' gArexxObject:=NewObjectA(Arexx_GetClass(),NIL,[TAG_IGNORE,0,')
ENDIF
StrCopy(tempStr,rexxObject.hostName)
UpperStr(tempStr)
StringF(tempStr,' AREXX_HOSTNAME, \a\s\a,',tempStr)
self.writeLine(tempStr)
self.writeLine(' AREXX_COMMANDS, gRxCommands,')
IF rexxObject.noSlot
self.writeLine(' AREXX_NOSLOT, TRUE,')
ENDIF
IF rexxObject.replyHook
self.writeLine(' AREXX_REPLYHOOK, gArexxReplyHook,')
ENDIF
IF StrLen(rexxObject.extension)>0
StringF(tempStr,' AREXX_DEFEXTENSION, \a\s\a,',rexxObject.extension)
self.writeLine(tempStr)
ENDIF
IF self.useMacros
self.writeLine(' End')
ELSE
self.writeLine(' TAG_END])')
ENDIF
self.writeLine('ENDPROC')
self.writeLine('')
IF rexxObject.replyHook
self.writeLine('PROC rexxReply_CallBack()')
self.writeLine(' GetA4()')
self.writeLine('ENDPROC')
self.writeLine('')
ENDIF
FOR i:=0 TO rexxObject.commands.count()-1
StrCopy(tempStr,rexxObject.commands.item(i))
LowerStr(tempStr)
StringF(tempStr,'PROC rexx_\s',tempStr)
StrAdd(tempStr,'()')
self.writeLine(tempStr)
self.writeLine(' DEF rxcmd:PTR TO arexxcmd')
self.writeLine(' MOVEM.L D0-D7/A0-A6,-(A7)')
self.writeLine(' MOVE.L A0,rxcmd')
self.writeLine(' GetA4()')
self.writeLine(' rxcmd.rc:=0 ->set result code')
self.writeLine(' MOVEM.L (A7)+,D0-D7/A0-A6')
self.writeLine('ENDPROC')
self.writeLine('')
ENDFOR
ENDIF
IF self.definitionOnly THEN RETURN
self.writeLine('PROC setup()')
self.writeLine(' IF (windowbase:=OpenLibrary(\awindow.class\a,0))=NIL THEN Throw(\qLIB\q,\qwin\q)')
IF hasarexx
self.writeLine(' IF (arexxbase:=OpenLibrary(\aarexx.class\a,0))=NIL THEN Throw(\qLIB\q,\qrexx\q)')
ENDIF
self.writeLine(' IF (layoutbase:=OpenLibrary(\agadgets/layout.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qlayo\q)')
self.writeLine(' IF (gadtoolsbase:=OpenLibrary(\agadtools.library\a,0))=NIL THEN Throw(\qLIB\q,\qgadt\q)')
self.writeLine(' IF (iconbase:=OpenLibrary(\aicon.library\a,0))=NIL THEN Throw(\qLIB\q,\qicon\q)')
IF self.libsused[TYPE_BUTTON] THEN self.writeLine(' IF (buttonbase:=OpenLibrary(\agadgets/button.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qbtn\q)')
IF self.libsused[TYPE_CHECKBOX] THEN self.writeLine(' IF (checkboxbase:=OpenLibrary(\agadgets/checkbox.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qchkb\q)')
IF self.libsused[TYPE_CHOOSER] THEN self.writeLine(' IF (chooserbase:=OpenLibrary(\agadgets/chooser.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qchoo\q)')
IF self.libsused[TYPE_CLICKTAB] THEN self.writeLine(' IF (clicktabbase:=OpenLibrary(\agadgets/clicktab.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qclkt\q)')
IF self.libsused[TYPE_FUELGAUGE] THEN self.writeLine(' IF (fuelgaugebase:=OpenLibrary(\agadgets/fuelgauge.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qfuel\q)')
IF self.libsused[TYPE_GETFILE] THEN self.writeLine(' IF (getfilebase:=OpenLibrary(\agadgets/getfile.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qfile\q)')
IF self.libsused[TYPE_GETFONT] THEN self.writeLine(' IF (getfontbase:=OpenLibrary(\agadgets/getfont.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qfont\q)')
IF self.libsused[TYPE_GETSCREENMODE] THEN self.writeLine(' IF (getscreenmodebase:=OpenLibrary(\agadgets/getscreenmode.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qscrn\q)')
IF self.libsused[TYPE_INTEGER] THEN self.writeLine(' IF (integerbase:=OpenLibrary(\agadgets/integer.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qintr\q)')
IF self.libsused[TYPE_PALETTE] THEN self.writeLine(' IF (palettebase:=OpenLibrary(\agadgets/palette.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qpall\q)')
IF self.libsused[TYPE_LISTBROWSER] THEN self.writeLine(' IF (listbrowserbase:=OpenLibrary(\agadgets/listbrowser.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qlist\q)')
IF self.libsused[TYPE_RADIO] THEN self.writeLine(' IF (radiobuttonbase:=OpenLibrary(\agadgets/radiobutton.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qrbtn\q)')
IF self.libsused[TYPE_SCROLLER] THEN self.writeLine(' IF (scrollerbase:=OpenLibrary(\agadgets/scroller.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qscrl\q)')
IF self.libsused[TYPE_SLIDER] THEN self.writeLine(' IF (sliderbase:=OpenLibrary(\agadgets/slider.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qsldr\q)')
IF self.libsused[TYPE_SPEEDBAR] THEN self.writeLine(' IF (speedbarbase:=OpenLibrary(\agadgets/speedbar.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qspdb\q)')
IF self.libsused[TYPE_STRING] THEN self.writeLine(' IF (stringbase:=OpenLibrary(\agadgets/string.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qstrn\q)')
IF self.libsused[TYPE_SPACE] THEN self.writeLine(' IF (spacebase:=OpenLibrary(\agadgets/space.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qspce\q)')
IF self.libsused[TYPE_TEXTFIELD]
IF (self.libsused[TYPE_TEXTEDITOR])
self.writeLine(' ->WARNING: TextEditor and TextField both share the same librarybase variable name so this will need to be rectified manually')
ENDIF
self.writeLine(' IF (textfieldbase:=OpenLibrary(\agadgets/textfield.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qtext\q)')
ENDIF
IF self.libsused[TYPE_BEVEL] THEN self.writeLine(' IF (bevelbase:=OpenLibrary(\aimages/bevel.image\a,0))=NIL THEN Throw(\qLIB\q,\qbevl\q)')
IF self.libsused[TYPE_DRAWLIST] THEN self.writeLine(' IF (drawlistbase:=OpenLibrary(\aimages/drawlist.image\a,0))=NIL THEN Throw(\qLIB\q,\qdraw\q)')
IF self.libsused[TYPE_GLYPH] THEN self.writeLine(' IF (glyphbase:=OpenLibrary(\aimages/glyph.image\a,0))=NIL THEN Throw(\qLIB\q,\qglyp\q)')
IF self.libsused[TYPE_LABEL] THEN self.writeLine(' IF (labelbase:=OpenLibrary(\aimages/label.image\a,0))=NIL THEN Throw(\qLIB\q,\qlabl\q)')
IF self.libsused[TYPE_PENMAP] THEN self.writeLine(' IF (penmapbase:=OpenLibrary(\aimages/penmap.image\a,0))=NIL THEN Throw(\qLIB\q,\qpenm\q)')
IF self.libsused[TYPE_BITMAP] THEN self.writeLine(' IF (bitmapbase:=OpenLibrary(\aimages/bitmap.image\a,0))=NIL THEN Throw(\qLIB\q,\qbmap\q)')
IF self.libsused[TYPE_COLORWHEEL] THEN self.writeLine(' IF (colorwheelbase:=OpenLibrary(\agadgets/colorwheel.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qcwhe\q)')
IF self.libsused[TYPE_DATEBROWSER] THEN self.writeLine(' IF (datebrowserbase:=OpenLibrary(\agadgets/datebrowser.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qdbro\q)')
IF self.libsused[TYPE_GETCOLOR] THEN self.writeLine(' IF (getcolorbase:=OpenLibrary(\agadgets/getcolor.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qgcol\q)')
IF self.libsused[TYPE_GRADSLIDER] THEN self.writeLine(' IF (gradientsliderbase:=OpenLibrary(\agadgets/gradientslider.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qgsld\q)')
IF self.libsused[TYPE_TAPEDECK] THEN self.writeLine(' IF (tapedeckbase:=OpenLibrary(\agadgets/tapedeck.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qtape\q)')
IF self.libsused[TYPE_TEXTEDITOR]
IF (self.libsused[TYPE_TEXTFIELD])
self.writeLine(' ->WARNING: TextEditor and TextField both share the same librarybase variable name so this will need to be rectified manually')
ENDIF
self.writeLine(' IF (textfieldbase:=OpenLibrary(\agadgets/texteditor.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qtext\q)')
ENDIF
IF self.libsused[TYPE_LED] THEN self.writeLine(' IF (ledbase:=OpenLibrary(\aimages/led.image\a,0))=NIL THEN Throw(\qLIB\q,\qed\q)')
IF self.libsused[TYPE_LISTVIEW] THEN self.writeLine(' IF (listviewbase:=OpenLibrary(\agadgets/listview.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qlvw\q)')
IF self.libsused[TYPE_VIRTUAL] THEN self.writeLine(' IF (virtualbase:=OpenLibrary(\agadgets/virtual.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qvirt\q)')
IF self.libsused[TYPE_SKETCH] THEN self.writeLine(' IF (sketchboardbase:=OpenLibrary(\agadgets/sketchboard.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qskch\q)')
IF self.libsused[TYPE_TABS] THEN self.writeLine(' IF (tabsbase:=OpenLibrary(\agadgets/tabs.gadget\a,0))=NIL THEN Throw(\qLIB\q,\qtabs\q)')
IF requesterObject.children.count()>0 THEN self.writeLine(' IF (requesterbase:=OpenLibrary(\aclasses/requester.class\a,0))=NIL THEN Throw(\qLIB\q,\qreqs\q)')
self.genScreenCreate(screenObject)
self.writeLine(' IF (gVisInfo:=GetVisualInfoA(gScreen, [TAG_END]))=NIL THEN Raise(\qvisi\q)')
self.writeLine(' IF (gDrawInfo:=GetScreenDrawInfo(gScreen))=NIL THEN Raise("dinf")')
self.writeLine(' IF (gAppPort:=CreateMsgPort())=NIL THEN Raise(\qport\q)')
IF sharedPort
self.writeLine(' IF (gSharedPort:=CreateMsgPort())=NIL THEN Raise(\qport\q)')
ENDIF
self.writeLine('ENDPROC')
self.writeLine('')
self.writeLine('PROC cleanup()')
self.writeLine(' IF gVisInfo THEN FreeVisualInfo(gVisInfo)')
self.writeLine(' IF gDrawInfo THEN FreeScreenDrawInfo(gScreen,gDrawInfo)')
self.writeLine(' IF gAppPort THEN DeleteMsgPort(gAppPort)')
IF sharedPort
self.writeLine(' IF gSharedPort THEN DeleteMsgPort(gSharedPort)')
ENDIF
self.genScreenFree(screenObject)
self.writeLine('')
self.writeLine(' IF gadtoolsbase THEN CloseLibrary(gadtoolsbase)')
self.writeLine(' IF iconbase THEN CloseLibrary(iconbase)')
self.writeLine(' IF windowbase THEN CloseLibrary(windowbase)')
self.writeLine(' IF layoutbase THEN CloseLibrary(layoutbase)')
IF hasarexx
self.writeLine(' IF arexxbase THEN CloseLibrary(arexxbase)')
ENDIF
IF self.libsused[TYPE_BUTTON] THEN self.writeLine(' IF buttonbase THEN CloseLibrary(buttonbase)')
IF self.libsused[TYPE_CHECKBOX] THEN self.writeLine(' IF checkboxbase THEN CloseLibrary(checkboxbase)')
IF self.libsused[TYPE_CHOOSER] THEN self.writeLine(' IF chooserbase THEN CloseLibrary(chooserbase)')
IF self.libsused[TYPE_CLICKTAB] THEN self.writeLine(' IF clicktabbase THEN CloseLibrary(clicktabbase)')
IF self.libsused[TYPE_FUELGAUGE] THEN self.writeLine(' IF fuelgaugebase THEN CloseLibrary(fuelgaugebase)')
IF self.libsused[TYPE_GETFILE] THEN self.writeLine(' IF getfilebase THEN CloseLibrary(getfilebase)')
IF self.libsused[TYPE_GETFONT] THEN self.writeLine(' IF getfontbase THEN CloseLibrary(getfontbase)')
IF self.libsused[TYPE_GETSCREENMODE] THEN self.writeLine(' IF getscreenmodebase THEN CloseLibrary(getscreenmodebase)')
IF self.libsused[TYPE_INTEGER] THEN self.writeLine(' IF integerbase THEN CloseLibrary(integerbase)')
IF self.libsused[TYPE_PALETTE] THEN self.writeLine(' IF palettebase THEN CloseLibrary(palettebase)')
IF self.libsused[TYPE_LISTBROWSER] THEN self.writeLine(' IF listbrowserbase THEN CloseLibrary(listbrowserbase)')
IF self.libsused[TYPE_RADIO] THEN self.writeLine(' IF radiobuttonbase THEN CloseLibrary(radiobuttonbase)')
IF self.libsused[TYPE_SCROLLER] THEN self.writeLine(' IF scrollerbase THEN CloseLibrary(scrollerbase)')
IF self.libsused[TYPE_SLIDER] THEN self.writeLine(' IF sliderbase THEN CloseLibrary(sliderbase)')
IF self.libsused[TYPE_SPEEDBAR] THEN self.writeLine(' IF speedbarbase THEN CloseLibrary(speedbarbase)')
IF self.libsused[TYPE_STRING] THEN self.writeLine(' IF stringbase THEN CloseLibrary(stringbase)')
IF self.libsused[TYPE_SPACE] THEN self.writeLine(' IF spacebase THEN CloseLibrary(spacebase)')
IF self.libsused[TYPE_TEXTFIELD]
IF (self.libsused[TYPE_TEXTEDITOR])
self.writeLine(' ->WARNING: TextEditor and TextField both share the same librarybase variable name so this will need to be rectified manually')
ENDIF
self.writeLine(' IF textfieldbase THEN CloseLibrary(textfieldbase)')
ENDIF
IF self.libsused[TYPE_BEVEL] THEN self.writeLine(' IF bevelbase THEN CloseLibrary(bevelbase)')
IF self.libsused[TYPE_DRAWLIST] THEN self.writeLine(' IF drawlistbase THEN CloseLibrary(drawlistbase)')
IF self.libsused[TYPE_GLYPH] THEN self.writeLine(' IF glyphbase THEN CloseLibrary(glyphbase)')
IF self.libsused[TYPE_LABEL] THEN self.writeLine(' IF labelbase THEN CloseLibrary(labelbase)')
IF self.libsused[TYPE_PENMAP] THEN self.writeLine(' IF penmapbase THEN CloseLibrary(penmapbase)')
IF self.libsused[TYPE_BITMAP] THEN self.writeLine(' IF bitmapbase THEN CloseLibrary(bitmapbase)')
IF self.libsused[TYPE_COLORWHEEL] THEN self.writeLine(' IF colorwheelbase THEN CloseLibrary(colorwheelbase)')
IF self.libsused[TYPE_DATEBROWSER] THEN self.writeLine(' IF datebrowserbase THEN CloseLibrary(datebrowserbase)')
IF self.libsused[TYPE_GETCOLOR] THEN self.writeLine(' IF getcolorbase THEN CloseLibrary(getcolorbase)')
IF self.libsused[TYPE_GRADSLIDER] THEN self.writeLine(' IF gradientsliderbase THEN CloseLibrary(gradientsliderbase)')
IF self.libsused[TYPE_TAPEDECK] THEN self.writeLine(' IF tapedeckbase THEN CloseLibrary(tapedeckbase)')
IF self.libsused[TYPE_TEXTEDITOR]
IF (self.libsused[TYPE_TEXTFIELD])
self.writeLine(' ->WARNING: TextEditor and TextField both share the same librarybase variable name so this will need to be rectified manually')
ENDIF
self.writeLine(' IF textfieldbase THEN CloseLibrary(textfieldbase)')
ENDIF
IF self.libsused[TYPE_LED] THEN self.writeLine(' IF ledbase THEN CloseLibrary(ledbase)')
IF self.libsused[TYPE_LISTVIEW] THEN self.writeLine(' IF listviewbase THEN CloseLibrary(listviewbase)')
IF self.libsused[TYPE_VIRTUAL] THEN self.writeLine(' IF virtualbase THEN CloseLibrary(virtualbase)')
IF self.libsused[TYPE_SKETCH] THEN self.writeLine(' IF sketchboardbase THEN CloseLibrary(sketchboardbase)')
IF self.libsused[TYPE_TABS] THEN self.writeLine(' IF tabsbase THEN CloseLibrary(tabsbase)')
IF requesterObject.children.count()>0 THEN self.writeLine(' IF requesterbase THEN CloseLibrary(requesterbase)')
self.writeLine('ENDPROC')
self.writeLine('')
IF self.libsused[TYPE_LISTBROWSER]
self.writeLine('PROC browserNodesA_(text:PTR TO LONG, numCols)')
self.writeLine(' DEF list:PTR TO lh')
self.writeLine(' DEF node:PTR TO ln')
self.writeLine('')
self.writeLine(' IF (list:=AllocMem(SIZEOF lh,MEMF_PUBLIC))')
self.writeLine(' newList(list)')
self.writeLine('')
self.writeLine(' WHILE( text[] )')
self.writeLine(' node:=AllocListBrowserNodeA( numCols,[LBNCA_TEXT,text[]++,0])')
self.writeLine(' IF(node=FALSE)')
self.writeLine(' freeBrowserNodes( list )')
self.writeLine(' RETURN NIL')
self.writeLine(' ENDIF')
self.writeLine('')
self.writeLine(' AddTail( list, node )')
self.writeLine(' ENDWHILE')
self.writeLine(' ENDIF')
self.writeLine('ENDPROC list')
self.writeLine('')
ENDIF
IF self.libsused[TYPE_LISTVIEW]
self.writeLine('PROC listViewLabelsA(text:PTR TO LONG)')
self.writeLine(' DEF list:PTR TO lh')
self.writeLine(' DEF node:PTR TO listlabelnode')
self.writeLine(' DEF i=0')
self.writeLine('')
self.writeLine(' IF (list:=AllocMem( SIZEOF lh, MEMF_PUBLIC ))')
self.writeLine(' newList(list)')
self.writeLine('')
self.writeLine(' WHILE (text[])')
self.writeLine(' NEW node')
self.writeLine(' IF node=0')
self.writeLine(' freeListViewLabels(list)')
self.writeLine(' RETURN NIL')
self.writeLine(' ENDIF')
self.writeLine(' node.node.type:=i')
self.writeLine(' node.renderforeground:=1')
self.writeLine(' node.renderbackground:=0')
self.writeLine(' node.selectforeground:=2')
self.writeLine(' node.selectbackground:=3')
self.writeLine(' node.node.name:=text[]++')
self.writeLine(' AddTail(list,node)')
self.writeLine(' ENDWHILE')
self.writeLine(' ENDIF')
self.writeLine('ENDPROC list')
self.writeLine('')
self.writeLine('PROC freeListViewLabels(list:PTR TO lh)')
self.writeLine(' DEF node:PTR TO listlabelnode')
self.writeLine(' DEF nextnode:PTR TO ln')
self.writeLine(' DEF i')
self.writeLine(' ')
self.writeLine(' IF list')
self.writeLine(' node:= list.head')
self.writeLine(' WHILE (nextnode := node.node.succ)')
self.writeLine(' END node')
self.writeLine(' node := nextnode')
self.writeLine(' ENDWHILE')
self.writeLine(' FreeMem(list,SIZEOF lh)')
self.writeLine(' ENDIF')
self.writeLine('ENDPROC')
self.writeLine('')
ENDIF
IF self.libsused[TYPE_SPEEDBAR]
self.writeLine('PROC speedBarNodesA(text:PTR TO LONG)')
self.writeLine(' DEF list:PTR TO lh')
self.writeLine(' DEF node:PTR TO ln')
self.writeLine(' DEF label')
self.writeLine(' DEF i=0,t:PTR TO CHAR')
self.writeLine('')
self.writeLine(' IF (list:=AllocMem( SIZEOF lh, MEMF_PUBLIC ))')
self.writeLine(' newList(list)')
self.writeLine('')
self.writeLine(' WHILE (text[])')
self.writeLine(' t:=text[]')
self.writeLine(' IF t[0]=\q1\q')
IF self.useMacros
self.writeLine(' label:=BitMapObject,')
ELSE
self.writeLine(' label:=NewObjectA(Bitmap_GetClass(),NIL,[TAG_IGNORE,0,')
ENDIF
self.writeLine(' BITMAP_SOURCEFILE, t+1,')
self.writeLine(' BITMAP_SCREEN, gScreen,')
IF self.useMacros
self.writeLine(' BitMapEnd')
ELSE
self.writeLine(' TAG_END])')
ENDIF
self.writeLine(' ELSE')
IF self.useMacros
self.writeLine(' label:=LabelObject,')
ELSE
self.writeLine(' label:=NewObjectA(Label_GetClass(),NIL,[TAG_IGNORE,0,')
ENDIF
self.writeLine(' LABEL_TEXT, t+1,')
IF self.useMacros
self.writeLine(' LabelEnd')
ELSE
self.writeLine(' TAG_END])')
ENDIF
self.writeLine(' ENDIF')
self.writeLine('')
self.writeLine(' IF (node:=AllocSpeedButtonNodeA(')
self.writeLine(' i,[SBNA_IMAGE, label,')
self.writeLine(' SBNA_ENABLED, TRUE,')
self.writeLine(' SBNA_SPACING, 2,')
self.writeLine(' SBNA_HIGHLIGHT, SBH_RECESS,')
self.writeLine(' TAG_DONE]))=FALSE')
self.writeLine('')
self.writeLine(' freeSpeedBarNodes(list)')
self.writeLine(' RETURN NIL')
self.writeLine(' ENDIF')
self.writeLine(' AddTail(list,node)')
self.writeLine(' i++')
self.writeLine(' text++')
self.writeLine(' ENDWHILE')
self.writeLine(' ENDIF')
self.writeLine('ENDPROC list')
self.writeLine('')
self.writeLine('PROC freeSpeedBarNodes(list:PTR TO lh)')
self.writeLine(' DEF node:PTR TO ln')
self.writeLine(' DEF nextnode:PTR TO ln')
self.writeLine(' DEF i,label')
self.writeLine('')
self.writeLine(' IF list')
self.writeLine(' node:= list.head')
self.writeLine(' WHILE (nextnode := node.succ)')
self.writeLine(' GetSpeedButtonNodeAttrsA(node,[SBNA_IMAGE,{label},TAG_END])')
self.writeLine(' DisposeObject(label)')
self.writeLine(' FreeSpeedButtonNode(node)')
self.writeLine(' node := nextnode')
self.writeLine(' ENDWHILE')
self.writeLine(' FreeMem(list,SIZEOF lh)')
self.writeLine(' ENDIF')
self.writeLine('ENDPROC')
self.writeLine('')
ENDIF
IF self.libsused[TYPE_TABS]
self.writeLine('PROC tabLabelsA(text:PTR TO LONG)')
self.writeLine(' DEF i,count,label:PTR TO tablabel')
self.writeLine(' count:=ListLen(text)')
self.writeLine(' label:=New(SIZEOF tablabel*count)')
self.writeLine(' FOR i:=0 TO count-1')
self.writeLine(' label[i].label:=ListItem(text,i)')
self.writeLine(' label[i].pen1:=-1')
self.writeLine(' label[i].pen2:=-1')
self.writeLine(' label[i].pen3:=-1')
self.writeLine(' label[i].pen4:=-1')
self.writeLine(' label[i].attrs:=0')
self.writeLine(' ENDFOR')
self.writeLine('ENDPROC label')
self.writeLine('')
self.writeLine('PROC freeTabLabels(labels)')
self.writeLine(' IF labels THEN Dispose(labels)')
self.writeLine('ENDPROC')
self.writeLine('')
ENDIF
self.writeLine('PROC runWindow(windowObject,windowId, menuStrip, winGadgets:PTR TO LONG) HANDLE')
self.writeLine(' DEF running=TRUE')
self.writeLine(' DEF win:PTR TO window,wsig,code,msg,sig,result')
IF hasarexx
self.writeLine(' DEF rxsig=0')
ENDIF
self.writeLine('')
self.writeLine(' IF (win:=RA_OpenWindow(windowObject))')
self.writeLine(' GetAttr( WINDOW_SIGMASK, windowObject, {wsig} )')
IF hasarexx
self.writeLine(' GetAttr( AREXX_SIGMASK, gArexxObject, {rxsig} )')
IF rexxObject.replyHook
self.writeLine('')
self.writeLine(' installhook( gArexxReplyHook, {rexxReply_CallBack} )')
self.writeLine('')
ENDIF
ENDIF
self.writeLine(' IF menuStrip THEN SetMenuStrip( win, menuStrip )')
self.writeLine('')
self.writeLine(' WHILE running')
IF hasarexx
self.writeLine(' sig:=Wait(wsig OR rxsig)')
self.writeLine('')
self.writeLine(' IF (sig AND rxsig) THEN RA_HandleRexx(gArexxObject)')
self.writeLine('')
ELSE
self.writeLine(' sig:=Wait(wsig)')
ENDIF
self.writeLine(' IF (sig AND (wsig))')
self.writeLine(' WHILE ((result:=RA_HandleInput(windowObject,{code}+2)) <> WMHI_LASTMSG)')
self.writeLine(' msg:=(result AND WMHI_CLASSMASK)')
self.writeLine(' SELECT msg')
self.writeLine(' CASE WMHI_CLOSEWINDOW')
self.writeLine(' running:=FALSE')
self.writeLine(' CASE WMHI_GADGETUP')
self.writeLine(' WriteF(\agadget press\\n\a)')
self.writeLine(' CASE WMHI_MENUPICK')
self.writeLine(' WriteF(\amenu pick\\n\a)')
self.writeLine(' CASE WMHI_ICONIFY')
self.writeLine(' RA_Iconify(windowObject)')
self.writeLine(' CASE WMHI_UNICONIFY')
self.writeLine(' win:=RA_OpenWindow(windowObject)')
self.writeLine(' IF menuStrip THEN SetMenuStrip( win, menuStrip )')
self.writeLine(' ENDSELECT')
self.writeLine(' ENDWHILE')
self.writeLine(' ENDIF')
self.writeLine(' ENDWHILE')
self.writeLine(' ENDIF')
self.writeLine('EXCEPT DO')
self.writeLine(' RA_CloseWindow(windowObject)')
self.writeLine('ENDPROC')
self.writeLine('')
FOR i:=0 TO requesterObject.children.count()-1
reqItem:=requesterObject.children.item(i)
StrCopy(tempStr,reqItem.ident)
LowerStr(tempStr)
StringF(tempStr,'PROC \s(reactionWindow',tempStr)
IF reqItem.titleParam
StrAdd(tempStr,',titleText')
ENDIF
IF reqItem.gadgetsParam
StrAdd(tempStr,',gadgetsText')
ENDIF
IF reqItem.bodyParam
StrAdd(tempStr,',bodyText')
ENDIF
StrAdd(tempStr,')')
self.writeLine(tempStr)
self.writeLine(' DEF reqmsg:PTR TO orrequest')
self.writeLine(' DEF reqobj,win,res=0')
self.writeLine(' SUBA.L #$100,A7')
self.writeLine(' NEW reqmsg')
self.writeLine(' win:=Gets(reactionWindow,WINDOW_WINDOW)')
self.writeLine(' reqmsg.methodid:=RM_OPENREQ')
self.writeLine(' reqmsg.window:=win')
bodyText:=reqItem.bodyText.makeTextString('\\n')
StringF(tempStr,' reqmsg.attrs:=[REQ_TYPE, \s, REQ_IMAGE, \s,',
ListItem(['REQTYPE_INFO','REQTYPE_INTEGER','REQTYPE_STRING'],reqItem.reqType),
ListItem(['REQIMAGE_DEFAULT', 'REQIMAGE_INFO', 'REQIMAGE_WARNING', 'REQIMAGE_ERROR', 'REQIMAGE_QUESTION', 'REQIMAGE_INSERTDISK'],reqItem.image))
self.writeLine(tempStr)
StringF(tempStr,' REQ_TITLETEXT,\s\s\s,',
IF reqItem.titleParam THEN '' ELSE '\a',
IF reqItem.titleParam THEN 'titleText' ELSE reqItem.titleText,
IF reqItem.titleParam THEN '' ELSE '\a')
self.writeLine(tempStr)
StringF(tempStr,' REQ_BODYTEXT,\s\s\s,',
IF reqItem.bodyParam THEN '' ELSE '\a',
IF reqItem.bodyParam THEN 'bodyText' ELSE bodyText,
IF reqItem.bodyParam THEN '' ELSE '\a')
self.writeLine(tempStr)
StringF(tempStr,' REQ_GADGETTEXT,\s\s\s,',
IF reqItem.gadgetsParam THEN '' ELSE '\a',
IF reqItem.gadgetsParam THEN 'gadgetsText' ELSE reqItem.gadgetsText,
IF reqItem.gadgetsParam THEN '' ELSE '\a')
self.writeLine(tempStr)
IF reqItem.invisible
SELECT reqItem.reqType
CASE 1
self.writeLine(' REQI_INVISIBLE, TRUE,')
CASE 2
self.writeLine(' REQS_INVISIBLE, TRUE,')
ENDSELECT
ENDIF
SELECT reqItem.reqType
CASE 1
StringF(tempStr,' REQI_MAXCHARS, \d,',IF reqItem.maxChars>10 THEN 10 ELSE reqItem.maxChars)
self.writeLine(tempStr)
CASE 2
StringF(tempStr,' REQS_MAXCHARS, \d,',reqItem.maxChars)
self.writeLine(tempStr)
ENDSELECT
self.writeLine(' TAG_END]')
DisposeLink(bodyText)
self.writeLine(' reqobj:=NewObjectA(Requester_GetClass(),0,[TAG_END])')
self.writeLine(' IF reqobj')
self.writeLine(' res:=DoMethodA(reqobj, reqmsg)')
self.writeLine(' DisposeObject(reqobj)')
self.writeLine(' ENDIF')
self.writeLine(' END reqmsg')
self.writeLine(' ADD.L #$100,A7')
self.writeLine('ENDPROC res')
self.writeLine('')
ENDFOR
ENDPROC
PROC genWindowHeader(count, windowObject:PTR TO windowObject, menuObject:PTR TO menuObject, layoutObject:PTR TO reactionObject, reactionLists:PTR TO stdlist) OF eSrcGen
DEF tempStr[200]:STRING
DEF endStr[20]:STRING
DEF i,j
DEF menuItem:PTR TO menuItem
DEF itemType
DEF itemName[200]:STRING
DEF hintText:PTR TO CHAR
DEF menuFlags[60]:STRING
DEF currMenu,mut
DEF commKey[10]:STRING
DEF directiveStr[20]:STRING
DEF listObjects:PTR TO stdlist
DEF listObjects2:PTR TO stdlist
DEF listObjects3:PTR TO stdlist
DEF reactionObject:PTR TO reactionObject
DEF drawlistObject:PTR TO drawListObject
DEF listbObject:PTR TO listBrowserObject
DEF listStr
DEF drawlist:PTR TO drawlist
DEF colWidth
DEF colTitle
StrCopy(tempStr,windowObject.ident)
LowerStr(tempStr)
self.write('PROC ')
self.write(tempStr)
IF self.definitionOnly
self.writeLine('()')
ELSE
self.writeLine('() HANDLE')
ENDIF
self.writeLine(' DEF windowObject')
StringF(tempStr,' DEF mainGadgets[\d]:ARRAY OF LONG',count+1)
self.writeLine(tempStr)
IF menuObject.menuItems.count()>0
self.writeLine(' DEF menuStrip=0,menuData=0:PTR TO newmenu')
ENDIF
IF windowObject.gadgetHelp
self.writeLine(' DEF hintInfo:PTR TO hintinfo')
ENDIF
NEW listObjects.stdlist(20)
layoutObject.findObjectsByType(listObjects,TYPE_CHOOSER)
layoutObject.findObjectsByType(listObjects,TYPE_RADIO)
layoutObject.findObjectsByType(listObjects,TYPE_CLICKTAB)
layoutObject.findObjectsByType(listObjects,TYPE_LISTBROWSER)
layoutObject.findObjectsByType(listObjects,TYPE_SPEEDBAR)
layoutObject.findObjectsByType(listObjects,TYPE_LISTVIEW)
layoutObject.findObjectsByType(listObjects,TYPE_TABS)
NEW listObjects2.stdlist(20)
layoutObject.findObjectsByType(listObjects2,TYPE_DRAWLIST)
NEW listObjects3.stdlist(20)
layoutObject.findObjectsByType(listObjects3,TYPE_LISTBROWSER)
FOR i:=0 TO listObjects.count()-1
reactionObject:=listObjects.item(i)
IF reactionObject.type=TYPE_SPEEDBAR
StringF(tempStr,' DEF buttons\d=0',reactionObject.id)
ELSE
StringF(tempStr,' DEF labels\d=0',reactionObject.id)
ENDIF
self.writeLine(tempStr)
ENDFOR
FOR i:=0 TO listObjects2.count()-1
drawlistObject:=listObjects2.item(i)
count:=0
FOR j:=0 TO drawlistObject.drawItemsList.count()-1
drawlist:=drawlistObject.drawItemsList.item(j)
EXIT drawlist.directive=DLST_END
count++
ENDFOR
StringF(tempStr,' DEF dlstDrawList\d[\d]:ARRAY OF drawlist',drawlistObject.id,count+1)
self.writeLine(tempStr)
ENDFOR
FOR i:=0 TO listObjects3.count()-1
listbObject:=listObjects3.item(i)
IF listbObject.columnTitles
StringF(tempStr,' DEF listBrowser\d_ci[\d]:ARRAY OF columninfo',listbObject.id,listbObject.numColumns+1)
self.writeLine(tempStr)
ENDIF
ENDFOR
self.writeLine('')
FOR i:=0 TO listObjects.count()-1
reactionObject:=listObjects.item(i)
StrCopy(endStr,'')
SELECT reactionObject.type
CASE TYPE_CHOOSER
StringF(tempStr,' labels\d:=chooserLabelsA(',reactionObject.id)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::chooserObject.listObjectId)
CASE TYPE_RADIO
StringF(tempStr,' labels\d:=radioButtonsA(',reactionObject.id)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::radioObject.listObjectId)
CASE TYPE_CLICKTAB
StringF(tempStr,' labels\d:=clickTabsA(',reactionObject.id)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::clickTabObject.listObjectId)
CASE TYPE_LISTBROWSER
StringF(tempStr,' labels\d:=browserNodesA_(',reactionObject.id)
StringF(endStr,',\d',reactionObject::listBrowserObject.numColumns)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::listBrowserObject.listObjectId,endStr)
CASE TYPE_SPEEDBAR
StringF(tempStr,' buttons\d:=speedBarNodesA(',reactionObject.id)
listStr:=self.makeList2(tempStr,reactionObject::speedBarObject.buttonList)
CASE TYPE_LISTVIEW
StringF(tempStr,' labels\d:=listViewLabelsA(',reactionObject.id)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::listViewObject.listObjectId)
CASE TYPE_TABS
StringF(tempStr,' labels\d:=tabLabelsA(',reactionObject.id)
listStr:=self.makeList(tempStr,reactionLists,reactionObject::tabsObject.listObjectId)
ENDSELECT
IF listStr
self.writeLine(listStr)
DisposeLink(listStr)
ELSE
StrAdd(tempStr,'[0]')
StrAdd(tempStr,endStr)
StrAdd(tempStr,')')
self.writeLine(tempStr)
ENDIF
ENDFOR
END listObjects
FOR i:=0 TO listObjects2.count()-1
drawlistObject:=listObjects2.item(i)
FOR j:=0 TO drawlistObject.drawItemsList.count()-1
drawlist:=drawlistObject.drawItemsList.item(j)
EXIT drawlist.directive=DLST_END
SELECT drawlist.directive
CASE DLST_LINE
StrCopy(directiveStr,'DLST_LINE')
CASE DLST_RECT
StrCopy(directiveStr,'DLST_RECT')
CASE DLST_LINEPAT
StrCopy(directiveStr,'DLST_LINEPAT')
CASE DLST_FILLPAT
StrCopy(directiveStr,'DLST_FILLPAT')
CASE DLST_LINESIZE
StrCopy(directiveStr,'DLST_LINESIZE')
CASE DLST_AMOVE
StrCopy(directiveStr,'DLST_AMOVE')
CASE DLST_ADRAW
StrCopy(directiveStr,'DLST_ADRAW')
CASE DLST_AFILL
StrCopy(directiveStr,'DLST_AFILL')
CASE DLST_FILL
StrCopy(directiveStr,'DLST_FILL')
CASE DLST_ELLIPSE
StrCopy(directiveStr,'DLST_ELLIPSE')
CASE DLST_CIRCLE
StrCopy(directiveStr,'DLST_CIRCLE')
ENDSELECT
StringF(tempStr,' dlstDrawList\d[\d].directive:=\s',drawlistObject.id,j,directiveStr)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].x1:=\d',drawlistObject.id,j,drawlist.x1)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].y1:=\d',drawlistObject.id,j,drawlist.y1)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].x2:=\d',drawlistObject.id,j,drawlist.x2)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].y2:=\d',drawlistObject.id,j,drawlist.y2)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].pen:=\d',drawlistObject.id,j,drawlist.pen)
self.writeLine(tempStr)
ENDFOR
StringF(tempStr,' dlstDrawList\d[\d].directive:=DLST_END',drawlistObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].x1:=0',drawlistObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].y1:=0',drawlistObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].x2:=0',drawlistObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].y2:=0',drawlistObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' dlstDrawList\d[\d].pen:=0',drawlistObject.id,j)
self.writeLine('')
ENDFOR
END listObjects2
FOR i:=0 TO listObjects3.count()-1
listbObject:=listObjects3.item(i)
IF listbObject.columnTitles
FOR j:=0 TO listbObject.numColumns-1
colWidth:=IF j<listbObject.colWidths.count() THEN listbObject.colWidths.item(j) ELSE 1
colTitle:=IF j<listbObject.colTitles.count() THEN listbObject.colTitles.item(j) ELSE ''
StringF(tempStr,' listBrowser\d_ci[\d].width:=\d',listbObject.id,j,colWidth)
self.writeLine(tempStr)
StringF(tempStr,' listBrowser\d_ci[\d].title:=\a\s\a',listbObject.id,j,colTitle)
self.writeLine(tempStr)
StringF(tempStr,' listBrowser\d_ci[\d].flags:=CIF_WEIGHTED',listbObject.id,j)
self.writeLine(tempStr)
ENDFOR
StringF(tempStr,' listBrowser\d_ci[\d].width:=-1',listbObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' listBrowser\d_ci[\d].title:=-1',listbObject.id,j)
self.writeLine(tempStr)
StringF(tempStr,' listBrowser\d_ci[\d].flags:=-1',listbObject.id,j)
self.writeLine(tempStr)
ENDIF
ENDFOR
END listObjects3
self.writeLine('')
IF menuObject.menuItems.count()>0
StringF(tempStr,' NEW menuData[\d]',menuObject.menuItems.count()+1)
self.writeLine(tempStr)
FOR i:=0 TO menuObject.menuItems.count()-1
menuItem:=menuObject.menuItems.item(i)
StrCopy(commKey,'')
IF menuItem.type=MENU_TYPE_MENUSUB
itemType:='NM_SUB'
IF menuItem.menuBar THEN StrCopy(itemName,'NM_BARLABEL') ELSE StringF(itemName,'\a\s\a',menuItem.itemName)
IF StrLen(menuItem.commKey) THEN StringF(commKey,'\a\s\a',menuItem.commKey)
ELSEIF menuItem.type=MENU_TYPE_MENUITEM
itemType:='NM_ITEM'
IF menuItem.menuBar THEN StrCopy(itemName,'NM_BARLABEL') ELSE StringF(itemName,'\a\s\a',menuItem.itemName)
IF StrLen(menuItem.commKey) THEN StringF(commKey,'\a\s\a',menuItem.commKey)
ELSE
currMenu:=menuItem
mut:=0
itemType:='NM_TITLE'
StringF(itemName,'\a\s\a',menuItem.itemName)
ENDIF
StrCopy(menuFlags,'')
IF menuItem.type<>MENU_TYPE_MENU
mut:=menuObject.makeMutual(currMenu,i)
IF menuItem.check
StrAdd(menuFlags,'CHECKIT')
ENDIF
IF menuItem.toggle
IF EstrLen(menuFlags) THEN StrAdd(menuFlags,' OR ')
StrAdd(menuFlags,'MENUTOGGLE')
ENDIF
IF menuItem.checked
IF EstrLen(menuFlags) THEN StrAdd(menuFlags,' OR ')
StrAdd(menuFlags,'CHECKED')
ENDIF
ENDIF
IF menuItem.disabled
IF EstrLen(menuFlags) THEN StrAdd(menuFlags,' OR ')
IF menuItem.type=MENU_TYPE_MENU
StrAdd(menuFlags,'NM_MENUDISABLED')
ELSE
StrAdd(menuFlags,'NM_ITEMDISABLED')
ENDIF
ENDIF
StringF(tempStr,' menuData[\d].type:=\s',i,itemType)
self.writeLine(tempStr)
IF EstrLen(menuFlags)
StringF(tempStr,' menuData[\d].flags:=\s',i,menuFlags)
self.writeLine(tempStr)
ENDIF
IF mut
StringF(tempStr,' menuData[\d].mutualexclude:=\d',i,mut)
self.writeLine(tempStr)
ENDIF
StringF(tempStr,' menuData[\d].label:=\s',i,itemName)
self.writeLine(tempStr)
IF EstrLen(commKey)>0
StringF(tempStr,' menuData[\d].commkey:=\s',i,commKey)
self.writeLine(tempStr)
ENDIF
ENDFOR
StringF(tempStr,' menuData[\d].type:=NM_END',menuObject.menuItems.count())
self.writeLine(tempStr)
self.writeLine('')
self.writeLine(' IF (menuStrip:=CreateMenusA( menuData, [TAG_END]))=NIL THEN Raise(\qmenu\q)')
self.writeLine(' LayoutMenusA(menuStrip,gVisInfo,[GTMN_NEWLOOKMENUS,TRUE,TAG_END])')
StringF(tempStr,' END menuData[\d]',menuObject.menuItems.count()+1)
self.writeLine(tempStr)
self.writeLine(' menuData:=0')
self.writeLine('')
ENDIF
IF windowObject.gadgetHelp
NEW listObjects.stdlist(20)
layoutObject.findObjectsByType(listObjects,-1)
j:=0
FOR i:=0 TO listObjects.count()-1
reactionObject:=listObjects.item(i)
IF reactionObject.hintText.count()
IF self.useIds
StringF(itemName,'\s_id',reactionObject.ident)
ELSE
StringF(itemName,'\s',reactionObject.ident)