File: config.the

package info (click to toggle)
the 3.1-2
  • links: PTS
  • area: main
  • in suites: woody
  • size: 4,452 kB
  • ctags: 5,268
  • sloc: ansic: 63,118; sh: 2,399; makefile: 444
file content (1037 lines) | stat: -rw-r--r-- 33,508 bytes parent folder | download
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
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
/*
 * THE GUI configuration utility
 *
 * This macro requires version 1.2 of Rexx/Tk to function properly.
 *
 * This macro is incomplete - not all settings have been impelemented and it is a bit
 * slow to load.  Might need to load each tab as it is activated.
 */
If RxFuncQuery( 'TkLoadFuncs' ) = 1 Then
   Do
      Call RxFuncAdd 'TkLoadFuncs','rexxtk','TkLoadFuncs'
      If TkLoadFuncs() \= 0 Then Return 1
   End
If RxFuncQuery( 'TkNotebookLoadFuncs' ) = 1 Then
   Do
      Call RxFuncAdd 'TkNotebookLoadFuncs','rexxtknotebook','TkNotebookLoadFuncs'
      If TkNotebookLoadFuncs( TkGetBaseData() ) \= 0 Then Return 1
   End
If RxFuncQuery( 'TkComboboxLoadFuncs' ) = 1 Then
   Do
      Call RxFuncAdd 'TkComboboxLoadFuncs','rexxtkcombobox','TkComboboxLoadFuncs'
      If TkComboboxLoadFuncs( TkGetBaseData() ) \= 0 Then Return 1
   End
Signal on Syntax
/*
 * Descriptions of color areas
 */
color_desc.1 = 'File Area'
color_desc.2 = 'Current Line'
color_desc.3 = 'Marked Block'
color_desc.4 = 'Current Line Block'
color_desc.5 = 'Command Line'
color_desc.6 = 'ID Line'
color_desc.7 = 'Message Lines'
color_desc.8 = 'Arrow'
color_desc.9 = 'Prefix Area'
color_desc.10 = 'Current Prefix Area'
color_desc.11 = 'Pending Prefix'
color_desc.12 = 'Scale Line'
color_desc.13 = 'TOF/EOF Lines'
color_desc.14 = 'Current TOF/EOF Lines'
color_desc.15 = 'Tab Line'
color_desc.16 = 'Shadow Lines'
color_desc.17 = 'Status Line'
color_desc.18 = 'Divider'
color_desc.19 = 'Reserved Lines'
color_desc.20 = 'Non-display Chars'
color_desc.21 = 'Highlight'
color_desc.22 = 'Current Highlight'
color_desc.23 = 'Text Highlight'
color_desc.24 = 'Soft Label Keys'
color_desc.25 = 'Prefix Gap'
color_desc.26 = 'Current Prefix Gap'
color_desc.27 = 'Alert Box'
color_desc.28 = 'Dialog Box'
color_desc.29 = 'Boundmarkers'
/*
 * Descriptions of syntax colors
 */
ecolor_desc.1 = 'A Comments'
ecolor_desc.2 = 'B Strings'
ecolor_desc.3 = 'C Numbers'
ecolor_desc.4 = 'D Keywords'
ecolor_desc.5 = 'E Labels'
ecolor_desc.6 = 'F Preprocessor'
ecolor_desc.7 = 'G Header Lines'
ecolor_desc.8 = 'H N/A'
ecolor_desc.9 = 'I Level 1 Paren'
ecolor_desc.10 = 'J N/A'
ecolor_desc.11 = 'K N/A'
ecolor_desc.12 = 'L N/A'
ecolor_desc.13 = 'M N/A'
ecolor_desc.14 = 'N N/A'
ecolor_desc.15 = 'O N/A'
ecolor_desc.16 = 'P N/A'
ecolor_desc.17 = 'Q N/A'
ecolor_desc.18 = 'R N/A'
ecolor_desc.19 = 'S Incomplete String'
ecolor_desc.20 = 'T HTML Tags'
ecolor_desc.21 = 'U HTML References'
ecolor_desc.22 = 'V Builtin Functions'
ecolor_desc.23 = 'W N/A'
ecolor_desc.24 = 'X N/A'
ecolor_desc.25 = 'Y N/A'
ecolor_desc.26 = 'Z N/A'
ecolor_desc.27 = '1 Alt Keyword 1'
ecolor_desc.28 = '2 Alt Keyword 2'
ecolor_desc.29 = '3 Alt Keyword 3'
ecolor_desc.30 = '4 Alt Keyword 4'
ecolor_desc.31 = '5 Alt Keyword 5'
ecolor_desc.32 = '6 Alt Keyword 6'
ecolor_desc.33 = '7 Alt Keyword 7'
ecolor_desc.34 = '8 Alt Keyword 8'
ecolor_desc.35 = '9 Alt Keyword 9'

colors = 'black blue green cyan red magenta brown grey'
colors_normal = 'Black  blue3 green3 cyan3 red3 magenta3 yellow3 grey'
colors_bold   = 'grey40 blue1 green1 cyan1 red1 magenta1 yellow1 White'

value_font = 'Helvetica 10'

index_inverses = '8 7 6 5 4 3 2 1'

dummy_tab = 4
layout_tab = 1
color_tab = 2
ecolor_tab = 3
tab_names = 'Layout Color EColor test'

layout_commands.dummy_tab = 'alt arbchar autosave autoscroll'
layout_commands.layout_tab = 'cmdline compat curline hexdisplay hexshow idline msgline number prefix scale screen statusline tabline tofeof'

Call TkWm 'geometry', '.', '600x550'
Call TkWm 'title', '.', 'THE Configurator'
f = TkFrame( '.f', )
Call TkPack f, '-side', 'top', '-fill', 'both', '-expand', 1
nb = TkNotebook( f'.nb', '-borderwidth', 2, '-tabs', tab_names, '-rexx', 'RaiseTab')
Call TkPack nb, '-side', 'top', '-fill', 'both', '-expand', 1

Call CreateDummyPage dummy_tab
Call CreateLayoutPage layout_tab
Call CreateColorPage 'color' color_tab
Call CreateColorPage 'ecolor' ecolor_tab

Call TkNotebookRaise nb, 1

Do Forever
   Interpret 'Call' TkWait()
End

Return 0

set_commands = 'alt arbchar autocolor autosave autoscroll backup beep boundmark case clearerrorkey clearscreen clock cmdarrows coloring ctlchar cursorstay defsort dirinclude display eolout equivchar etmode fext filename fname fpath ftype fullfname header hex highlight impmacro impos inputmode insertmode interface lineflag linend macro macroext macropath margins mouse msgmode newlines nondisp parser pending point position printer pscreen readonly reprofile rexxoutput scope select shadow slk statopt stay synonym tabkey tabs tabsin tabsout timecheck tofeof typeahead undoing untaa verify width word wordwrap wrap zone'
/*              f   v       g         f        v          f      g    v?        v    g             g           g     g         f        g       g          g       g          v       g      g         g      f    f        f     f     f     f         v      g   v         v        v     v         g          g?        f        v      v     g        g         v       g     v       v        g       g      v?      v?    g        g       g?      g        g         g          v     v?     v      g?  g?      v    v       g      g    g      g       f         v      */
/*

*/
CreateDummyPage:
Parse Arg tabno

combobox_size = 13
state. = 'normal'
state.on  = 'normal'
state.off = 'disabled'
state.nulls = 'normal'
scale_size = 80
scale_middle_size = 40

tf3 = TkNotebookFrame( nb, tabno )

bf3 = TkFrame( tf3'.bf3'ctype, '-relief', 'raised', '-borderwidth', 3 )
b1 = TkButton(bf3'.b1', '-text', 'Quit', '-rexx', 'Ended')
b2 = TkButton(bf3'.b2', '-text', 'Test Selected', '-rexx', 'TestSet' tabno )
b3 = TkButton(bf3'.b3', '-text', 'Reset Selected', '-rexx', 'ResetSet' tabno )
Call TkPack b1, b2, b3, '-side', 'left', '-padx', 20, '-pady', 5
Call TkPack bf3, '-side', 'bottom', '-padx', 5, '-pady', 5

f3 = TkFrame( tf3'.layout', '-relief', 'raised', '-borderwidth', 3 )
Call TkPack f3,  '-side', 'top', '-padx', 5, '-pady', 5

max_width = 0
Do i = 1 To Words( layout_commands.tabno )
   wl =  Length( Word( layout_commands.tabno, i ) )
   If wl > max_width Then max_width = wl
End
/*
 * Extract anything here that is needed for resolution
 */
'extract /lscreen/'Translate( layout_commands.tabno, '/', ' ' )
/*
 * SET ALT - file
 */
$alt. = ''
$alt.$frame = f3
$alt.$state = alt.1
$alt.$layout.0 = 2
$alt.$layout.1 = 'scale'
$alt.$layout.2 = 'scale'
$alt.$scale.$default.1 = alt.1
$alt.$scale.$from_limit.1 = 0
$alt.$scale.$to_limit.1 = 99
$alt.$scale.$default.2 = alt.2
$alt.$scale.$from_limit.2 = 0
$alt.$scale.$to_limit.2 = 99
/*
 * SET ARBCHAR - view
 */
$arbchar. = ''
$arbchar.$frame = f3
$arbchar.$state = arbchar.1
$arbchar.$layout.0 = 3
$arbchar.$layout.1 = 'combo'
$arbchar.$layout.2 = 'entry'
$arbchar.$layout.3 = 'entry'
$arbchar.$combo.$values.1 = 'ON OFF'
$arbchar.$combo.$default.1 = arbchar.1
$arbchar.$entry.$limit.2 = 1
$arbchar.$entry.$default.2 = arbchar.2
$arbchar.$entry.$limit.3 = 1
$arbchar.$entry.$default.3 = arbchar.3
$arbchar.$control_item = 1
$arbchar.$controlled_items = '2 3'
/*
 * SET AUTOCOLOR - global ( inappropriate )
 */
/*
 * SET AUTOSAVE - file
 */
$autosave. = ''
$autosave.$frame = f3
$autosave.$state = autosave.1
$autosave.$layout.0 = 1
$autosave.$layout.1 = 'combo'
$autosave.$combo.$values.1 = 'OFF'
$autosave.$combo.$editable.1 = 1
$autosave.$combo.$default.1 = autosave.1
/*
 * SET AUTOSCROLL - view
 */
$autoscroll. = ''
$autoscroll.$frame = f3
$autoscroll.$state = autoscroll.1
$autoscroll.$layout.0 = 1
$autoscroll.$layout.1 = 'combo'
$autoscroll.$combo.$values.1 = 'HALF OFF'
$autoscroll.$combo.$editable.1 = 1
$autoscroll.$combo.$default.1 = autoscroll.1

layout_row = 0
Do i = 1 To Words( layout_commands.tabno )
   layout_row = layout_row + 1
   Call CreateLine tabno f3 Word( layout_commands.tabno, i )
End
/*
 * Add the Select/Deselect button
 */
Call CreateSelectButton tabno frame
Return

CreateLayoutPage:
Parse Arg tabno

combobox_size = 13
state. = 'normal'
state.on  = 'normal'
state.off = 'disabled'
state.nulls = 'normal'
scale_size = 80
scale_middle_size = 40

tf3 = TkNotebookFrame( nb, tabno )

bf3 = TkFrame( tf3'.bf3'ctype, '-relief', 'raised', '-borderwidth', 3 )
b1 = TkButton(bf3'.b1', '-text', 'Quit', '-rexx', 'Ended')
b2 = TkButton(bf3'.b2', '-text', 'Test Selected', '-rexx', 'TestSet' tabno )
b3 = TkButton(bf3'.b3', '-text', 'Reset Selected', '-rexx', 'ResetSet' tabno )
Call TkPack b1, b2, b3, '-side', 'left', '-padx', 20, '-pady', 5
Call TkPack bf3, '-side', 'bottom', '-padx', 5, '-pady', 5

f3 = TkFrame( tf3'.layout', '-relief', 'raised', '-borderwidth', 3 )
Call TkPack f3,  '-side', 'top', '-padx', 5, '-pady', 5

max_width = 0
Do i = 1 To Words( layout_commands.tabno )
   wl =  Length( Word( layout_commands.tabno, i ) )
   If wl > max_width Then max_width = wl
End
/*
 * Extract anything here that is needed for resolution
 */
'extract /lscreen/'Translate( layout_commands.tabno, '/', ' ' )
/*
 * SET COMPAT
 */
$compat. = ''
$compat.$frame = f3
$compat.$layout.0 = 3
$compat.$layout.1 = 'combo'
$compat.$layout.2 = 'combo'
$compat.$layout.3 = 'combo'
$compat.$combo.$values.1 = 'THE XEDIT KEDIT KEDITW ISPF'
$compat.$combo.$values.2 = 'THE XEDIT KEDIT KEDITW ISPF'
$compat.$combo.$values.3 = 'THE XEDIT KEDIT KEDITW ISPF'
$compat.$combo.$default.1 = compat.1
$compat.$combo.$default.2 = compat.2
$compat.$combo.$default.3 = compat.3
/*
 * SET CMDLINE
 */
$cmdline. = ''
$cmdline.$frame = f3
$cmdline.$layout.0 = 1
$cmdline.$layout.1 = 'combo'
$cmdline.$combo.$values.1 = 'ON OFF TOP BOTTOM'
$cmdline.$combo.$default.1 = cmdline.1
/*
 * SET CURLINE
 */
$curline. = ''
$curline.$frame = f3
$curline.$layout.0 = 1
$curline.$layout.1 = 'middle'
$curline.$middle.$default.1 = curline.1
$curline.$middle.$from_limit.1 = -lscreen.1
$curline.$middle.$to_limit.1 = lscreen.1
/*
 * SET HEXDISPLAY
 */
$hexdisplay. = ''
$hexdisplay.$frame = f3
$hexdisplay.$layout.0 = 1
$hexdisplay.$layout.1 = 'combo'
$hexdisplay.$combo.$values.1 = 'ON OFF'
$hexdisplay.$combo.$default.1 = hexdisplay.1
/*
 * SET HEXSHOW
 */
$hexshow. = ''
$hexshow.$frame = f3
$hexshow.$state = 'hexshow.1'
$hexshow.$layout.0 = 2
$hexshow.$layout.1 = 'combo'
$hexshow.$layout.2 = 'middle'
$hexshow.$combo.$values.1 = 'ON OFF'
$hexshow.$combo.$default.1 = hexshow.1
$hexshow.$middle.$default.2 = hexshow.2
$hexshow.$middle.$from_limit.2 = lscreen.1 * -1
$hexshow.$middle.$to_limit.2 = lscreen.1
$hexshow.$control_item = 1
$hexshow.$controlled_items = 2
/*
 * SET IDLINE
 */
$idline.$frame = f3
$idline.$layout.0 = 1
$idline.$layout.1 = 'combo'
$idline.$combo.$values.1 = 'ON OFF'
$idline.$combo.$default.1 = idline.1
/*
 * SET MSGLINE
 */
$msgline. = ''
$msgline.$frame = f3
$msgline.$state = msgline.1
$msgline.$layout.0 = 4
$msgline.$layout.1 = 'combo'
$msgline.$layout.2 = 'middle'
$msgline.$layout.3 = 'scale'
$msgline.$layout.4 = 'combo'
$msgline.$combo.$values.1 = 'ON OFF'
$msgline.$combo.$default.1 = msgline.1
$msgline.$middle.$default.2 = msgline.2
$msgline.$middle.$from_limit.2 = lscreen.1 * -1
$msgline.$middle.$to_limit.2 = lscreen.1
$msgline.$scale.$default.3 = msgline.3
$msgline.$scale.$from_limit.3 = 1
$msgline.$scale.$to_limit.3 = lscreen.1
$msgline.$combo.$values.4 = 'OVERLAY'
$msgline.$combo.$default.4 = msgline.4
$msgline.$control_item = 1
$msgline.$controlled_items = '2 3 4'
/*
 * SET NUMBER
 */
$number. = ''
$number.$frame = f3
$number.$layout.0 = 1
$number.$layout.1 = 'combo'
$number.$combo.$values.1 = 'ON OFF'
$number.$combo.$default.1 = number.1
/*
 * SET PREFIX
 */
$prefix. = ''
$prefix.$frame = f3
$prefix.$state = prefix.1
$prefix.$layout.0 = 4
$prefix.$layout.1 = 'combo'
$prefix.$layout.2 = 'combo'
$prefix.$layout.3 = 'scale'
$prefix.$layout.4 = 'scale'
$prefix.$combo.$values.1 = 'ON OFF'
$prefix.$combo.$default.1 = prefix.1
$prefix.$combo.$values.2 = 'LEFT RIGHT'
$prefix.$combo.$default.2 = prefix.2
$prefix.$scale.$default.3 = prefix.3
$prefix.$scale.$from_limit.3 = 2
$prefix.$scale.$to_limit.3 = 20
$prefix.$scale.$default.4 = prefix.4
$prefix.$scale.$from_limit.4 = 0
$prefix.$scale.$to_limit.4 = 19
$prefix.$control_item = 1
$prefix.$controlled_items = '2 3 4'
/*
 * SET SCALE
 */
$scale. = ''
$scale.$frame = f3
$scale.$state = scale.1
$scale.$layout.0 = 2
$scale.$layout.1 = 'combo'
$scale.$layout.2 = 'middle'
$scale.$combo.$values.1 = 'ON OFF'
$scale.$combo.$default.1 = scale.1
$scale.$middle.$default.2 = scale.2
$scale.$middle.$from_limit.2 = lscreen.1 * -1
$scale.$middle.$to_limit.2 = lscreen.1
$scale.$control_item = 1
$scale.$controlled_items = 2
/*
 * SET SCREEN
 */
$screen. = ''
$screen.$frame = f3
$screen.$state = screen.1
$screen.$layout.0 = 2
$screen.$layout.1 = 'scale'
$screen.$layout.2 = 'combo'
$screen.$scale.$default.1 = screen.1
$screen.$scale.$from_limit.1 = 1
$screen.$scale.$to_limit.1 = 2
$screen.$combo.$values.2 = 'HORIZONTAL VERTICAL'
$screen.$combo.$default.2 = screen.2
/*
 * SET STATUSLINE
 */
$statusline. = ''
$statusline.$frame = f3
$statusline.$layout.0 = 1
$statusline.$layout.1 = 'combo'
$statusline.$combo.$values.1 = 'TOP BOTTOM OFF'
$statusline.$combo.$default.1 = statusline.1
/*
 * SET TABLINE
 */
$tabline. = ''                   
$tabline.$frame = f3
$tabline.$state = tabline.1
$tabline.$layout.0 = 2
$tabline.$layout.1 = 'combo'
$tabline.$layout.2 = 'middle'
$tabline.$combo.$values.1 = 'ON OFF'
$tabline.$combo.$default.1 = tabline.1
$tabline.$middle.$default.2 = tabline.2
$tabline.$middle.$from_limit.2 = lscreen.1 * -1
$tabline.$middle.$to_limit.2 = lscreen.1
$tabline.$control_item = 1
$tabline.$controlled_items = 2
/*
 * SET TOFEOF
 */
$tofeof. = ''
$tofeof.$frame = f3
$tofeof.$layout.0 = 1
$tofeof.$layout.1 = 'combo'
$tofeof.$combo.$values.1 = 'ON OFF'
$tofeof.$combo.$default.1 = tofeof.1

layout_row = 0
Do i = 1 To Words( layout_commands.tabno )
   layout_row = layout_row + 1
   Call CreateLine tabno f3 Word( layout_commands.tabno, i )
End
/*
 * Add the Select/Deselect button
 */
Call CreateSelectButton tabno frame

Return

CreateLine:
Parse Arg tabno frame cmd
this_checkbutton_variable = cmd'_checkbutton_variable'
Call TkVar this_checkbutton_variable, 0
this_checkbutton = TkCheckButton( frame'.'cmd'_checkbutton', '-text', '', '-variable', this_checkbutton_variable, '-relief', 'flat', '-takefocus', 0, '-font', value_font  )
Call TkGrid this_checkbutton, '-in', frame, '-row', layout_row, '-column', 0
this_label = TkLabel( frame'.'cmd'_label', '-text', cmd, '-width', max_width )
Call TkGrid this_label, '-in', frame, '-row', layout_row, '-column', 1, '-sticky', 'ew'
num_widgets = Value( '$'cmd'.$layout.0' )
Do cwi = 1 To num_widgets
   wt = Value( '$'cmd'.$layout.cwi' )
   Select
      When wt = 'combo' Then Call CreateCombo frame cmd cwi
      When wt = 'middle' Then Call CreateMiddle frame cmd cwi
      When wt = 'scale' Then Call CreateScale frame cmd cwi
      When wt = 'entry' Then Call CreateEntry frame cmd cwi
      Otherwise Nop
   End
End
/*
 * Now configure the control widget to update the status for each controlled
 * widget.
 */
Call CreateControl cmd
Return

CreateControl:
Parse Arg cmd
If Datatype( Value( '$'cmd'.$control_item' ) ) = 'NUM' Then
   Do
      this_controlled_items = Value( '$'cmd'.$controlled_items' )
      this_control_item = Value( '$'cmd'.$control_item' )
      this_control_widget = Value( '$'cmd'.$widget.'this_control_item )
      this_controlled_widgets = ''
      Do cwi = 1 To Words( this_controlled_items )
         this_controlled_item = Word( this_controlled_items, cwi )
         this_controlled_widgets = this_controlled_widgets Value( '$'cmd'.$widget.'this_controlled_item )
      End
      Call TkConfig this_control_widget, '-rexx', 'LayoutConfig' this_control_widget this_controlled_widgets
   End
Return

/*
 * Creates a combobox widget
 */
CreateCombo:
Parse Arg frame cmd item
this_values = Value( '$'cmd'.$combo.$values.'item )
/*
 * Determine initial state of widget.  If we are the controlling widget
 * leave our state 'normal'
 */
If Value( '$'cmd'.$control_item' ) \= item Then this_state = Value( Value( '$'cmd'.$state' ) )
Else this_state = ''
this_state = state.this_state
/*
 * Determine if we want to be able to edit the contents of the combobox
 */
If Value( '$'cmd'.$combo.$editable.'item ) = 1 Then this_editable = 'true'
Else this_editable = 'false'
/*
 * Get the default value of the combobox
 */
this_default_val = Value( '$'cmd'.$combo.$default.'item )
this_combobox_variable = cmd'_combo_variable'item
Call TkSet this_combobox_variable, this_default_val
this_combobox = TkCombobox( frame'.'cmd'_cb'item, '-editable', this_editable, '-width', combobox_size, '-textvariable', this_combobox_variable, '-value', this_default_val, '-font', value_font, '-state', this_state )
Do cci = 1 To Words( this_values )
   Call TkComboboxListInsert this_combobox, 'end', Word( this_values, cci )
End
Call TkGrid this_combobox, '-in', frame, '-row', layout_row, '-column', item+1, '-sticky', 'ew'
Interpret '$'cmd'.$widget.'item "= this_combobox"
Interpret '$'cmd'.$variables.'item "= this_combobox_variable"
Return

/*
 * Creates a widget containing a "middle" checkbutton, a scale and
 * a label that changes value with the scale
 */
CreateMiddle:
Parse Arg frame cmd item
this_frame = TkFrame( frame'.'cmd'_frame'item, '-borderwidth', 0 )
this_checkbutton_variable = cmd'_checkbutton_variable'item
this_scale_variable = cmd'_scale_variable'item
/*
 * Determine initial state of widget.  If we are the controlling widget
 * leave our state 'normal'
 */
If Value( '$'cmd'.$control_item' ) \= item Then this_state = Value( Value( '$'cmd'.$state' ) )
Else this_state = ''
this_state = state.this_state
this_value = Value( '$'cmd'.$middle.$default.'item )
val = GetRowValue( this_checkbutton_variable this_value )
Call TkVar this_scale_variable, val
this_checkbutton = TkCheckButton( this_frame'.'cmd'_checkbutton'item, '-text', 'Middle', '-variable', this_checkbutton_variable, '-relief', 'flat', '-takefocus', 0, '-state', this_state, '-font', value_font  )
/*
 * Create the label that represents the value of the scale
 */
this_label_variable = cmd'_label_variable'item
Call TkVar this_label_variable, val
this_label = TkLabel( this_frame'.'cmd'_label'item, '-width', 3, '-textvariable', this_label_variable, '-font', value_font, '-state', this_state )
/*
 * Determine scale limits
 */
this_from_limit = Value( '$'cmd'.$middle.$from_limit.'item )
this_to_limit = Value( '$'cmd'.$middle.$to_limit.'item )
/*
 * Create the Scale widget
 */
this_scale = TkScale( this_frame'.'cmd'_scale'item, '-from', this_from_limit, '-to', this_to_limit, '-orient', 'horiz', '-tickinterval', 0, '-length', scale_middle_size, '-label', '', '-sliderlength', 10, '-variable', this_scale_variable, '-state', this_state, '-showvalue', 0, '-command', 'set' this_label_variable  )
Call TkPack this_scale, '-side', 'right', '-anchor', 'e', '-fill', 'x'
Call TkPack this_checkbutton, this_label, '-side', 'left', '-anchor', 'w'
Call TkGrid this_frame, '-in', frame, '-row', layout_row, '-column', item+1, '-sticky', 'ew'
Interpret '$'cmd'.$widget.'item "= this_checkbutton this_label this_scale"
Interpret '$'cmd'.$variables.'item "= this_checkbutton_variable this_label_variable this_scale_variable"
Return

/*
 * Creates a scale widget with a label that changes with the value
 * of the scale
 */
CreateScale:
Parse Arg frame cmd item
this_frame = TkFrame( frame'.'cmd'_frame'item, '-borderwidth', 0 )
this_scale_variable = cmd'_scale_variable'item
/*
 * Determine initial state of widget.  If we are the controlling widget
 * leave our state 'normal'
 */
If Value( '$'cmd'.$control_item' ) \= item Then this_state = Value( Value( '$'cmd'.$state' ) )
Else this_state = ''
this_state = state.this_state
/*
 * Create the label that represents the value of the scale
 */
val = Value( '$'cmd'.$scale.$default.'item )
this_label_variable = cmd'_label_variable'item
Call TkVar this_label_variable, val
this_label = TkLabel( this_frame'.'cmd'_label'item, '-width', 3, '-textvariable', this_label_variable, '-font', value_font, '-state', this_state )
/*
 * Determine scale limits
 */
this_from_limit = Value( '$'cmd'.$scale.$from_limit.'item )
this_to_limit = Value( '$'cmd'.$scale.$to_limit.'item )

Call TkVar this_scale_variable, val
this_scale = TkScale( this_frame'.'cmd'_scale'item, '-from', this_from_limit, '-to', this_to_limit, '-orient', 'horiz', '-tickinterval', 0, '-length', scale_size, '-label', '', '-sliderlength', 10, '-variable', this_scale_variable, '-state', this_state, '-showvalue', 0, '-command', 'set' this_label_variable  )
Call TkPack this_scale, '-side', 'right', '-anchor', 'e', '-fill', 'x'
Call TkPack this_label, '-side', 'left', '-anchor', 'w'
Call TkGrid this_frame, '-in', frame, '-row', layout_row, '-column', item+1, '-sticky', 'ew'
Interpret '$'cmd'.$widget.'item "= this_label this_scale"
Interpret '$'cmd'.$variables.'item "= this_label_variable this_scale_variable"
Return

/*
 * Creates an entry widget
 */
CreateEntry:
Parse Arg frame cmd item
/*
 * Determine initial state of widget.  If we are the controlling widget
 * leave our state 'normal'
 */
If Value( '$'cmd'.$control_item' ) \= item Then this_state = Value( Value( '$'cmd'.$state' ) )
Else this_state = ''
this_state = state.this_state
this_limit = Value( '$'cmd'.$entry.$limit.'item )
this_default_val = Value( '$'cmd'.$entry.$default.'item )
this_entry_variable = cmd'_combo_entry'item
Call TkSet this_entry_variable, this_default_val
this_entry = TkEntry( frame'.'cmd'_ent'item, '-width', this_limit, '-textvariable', this_entry_variable, '-font', value_font )
Call TkInsert this_entry, 'end', this_default_val
Call TkConfig this_entry, '-state', this_state
Call TkGrid this_entry, '-in', frame, '-row', layout_row, '-column', item+1
Interpret '$'cmd'.$widget.'item "= this_entry"
Interpret '$'cmd'.$variables.'item "= this_entry_variable"
Return

LayoutConfig:
Parse Arg base_widget dependent_widgets
status = TkGet( base_widget )
Do i = 1 To Words( dependent_widgets ) - 2
   Call TkConfig Word( dependent_widgets, i ), '-state', state.status
End
Return

TestSet:
Parse Arg tabno
Do i = 1 To Words( layout_commands.tabno )
   cmd = Word( layout_commands.tabno, i )
   If TkVar( cmd'_checkbutton_variable' ) Then
      Do
         num_widgets = Value( '$'cmd'.$layout.0' )
         setcmd = 'set' cmd
         Do tli = 1 To num_widgets
            wt = Value( '$'cmd'.$layout.tli' )
            Select
               When wt = 'combo' Then setcmd = setcmd TkVar( Value( '$'cmd'.$variables.'tli ) )
               When wt = 'middle' Then setcmd = setcmd SetRowValue( Value( '$'cmd'.$variables.'tli ) )
               When wt = 'scale' Then setcmd = setcmd TkVar( Word( Value( '$'cmd'.$variables.'tli ), 2 ) )
               Otherwise Nop
            End
         End
         setcmd
         'refresh'
      End
End
Return

ResetSet:
Parse Arg tabno
Do i = 1 To Words( layout_commands.tabno )
   cmd = Word( layout_commands.tabno, i )
   If TkVar( cmd'_checkbutton_variable' ) Then
      Do
         num_widgets = Value( '$'cmd'.$layout.0' )
         setcmd = 'set' cmd
         Do tli = 1 To num_widgets
            wt = Value( '$'cmd'.$layout.tli' )
            Select
               When wt = 'combo' Then 
                  Do
                     Call TkVar Value( '$'cmd'.$variables.'tli ), Value( '$'cmd'.$combo.$default.'tli )
                  End
               When wt = 'middle' Then 
                  Do
                     vars = Value( '$'cmd'.$variables.'tli )
                     val = GetRowValue( Word( vars, 1 ) Value( '$'cmd'.$middle.$default.'tli ) )
                     Call TkVar Word( vars, 2 ), val
                     Call TkVar Word( vars, 3 ), val
                  End
               When wt = 'scale' Then 
                  Do
                     vars = Value( '$'cmd'.$variables.'tli )
                     val = Value( '$'cmd'.$scale.$default.'tli )
                     Call TkVar Word( vars, 1 ), val
                     Call TkVar Word( vars, 2 ), val
                  End
               Otherwise Nop
            End
         End
/*       Call TestSet tabno */
         Call CreateControl cmd
      End
End
Return

CreateSelectButton:
Parse Arg tabno frame
select_button.tabno = TkButton(frame'.select_button'tabno, '-text', 'Select All', '-rexx', 'SwitchSelect' tabno )
select_button_variable.tabno = 'select_button_variable'tabno
Call TkVar select_button_variable.tabno, 1
layout_row = layout_row + 1
Call TkGrid select_button.tabno, '-in', frame, '-row', layout_row, '-column', 0, '-columnspan', 2, '-sticky', 'ew'
Return

SwitchSelect:
Parse Arg tabno
this_status = TkVar( select_button_variable.tabno )
Do i = 1 To Words( layout_commands.tabno )
   cmd = Word( layout_commands.tabno, i )
   If this_status Then
      Do
         Call TkVar cmd'_checkbutton_variable', 1
      End
   Else
      Do
         Call TkVar cmd'_checkbutton_variable', 0
      End
End
If this_status Then
   Do
      Call TkConfig select_button.tabno, '-text', 'Deselect All'
      Call TkVar select_button_variable.tabno, 0
   End
Else
   Do
      Call TkConfig select_button.tabno, '-text', 'Select All'
      Call TkVar select_button_variable.tabno, 1
   End
Return

GetRowValue: Procedure
Parse Arg var input
If Left( input, 1 ) = 'M' Then
   Do
      If Substr( input, 2, 1 ) = '+' Then val = Substr( input, 3 )
      Else val = Substr( input, 2 )
      If val = '' Then val = 0
      Call TkVar var, 1
   End
Else 
   Do
      val = input
      Call TkVar var, 0
   End
Return val

SetRowValue: Procedure
Parse Arg var1 var2 .
middle = TkVar( var1 )
val = TkVar( var2 )
Select
   When middle & val = 0 Then retval = 'M'
   When middle & val > 0 Then retval = 'M+'val
   When middle & val < 0 Then retval = 'M'val
   Otherwise retval = val
End
Return retval

/*
 * Creates and manipluates color and ecolor pages
 */
CreateColorPage:
Parse Arg ctype tabno

tf3 = TkNotebookFrame( nb, tabno )

bf3 = TkFrame( tf3'.bf3'ctype, '-relief', 'raised', '-borderwidth', 3 )
b1 = TkButton(bf3'.b1', '-text', 'Quit', '-rexx', 'Ended')
b2 = TkButton(bf3'.b2', '-text', 'Test', '-rexx', 'TestColor' ctype )
b3 = TkButton(bf3'.b3', '-text', 'Reset', '-rexx', 'ResetColor' ctype )
Call TkPack b1, b2, b3, '-side', 'left', '-padx', 20, '-pady', 5
Call TkPack bf3, '-side', 'bottom', '-padx', 5, '-pady', 5

f3 = TkFrame( tf3'.f3'ctype, '-relief', 'raised', '-borderwidth', 3 )
Call TkPack f3,  '-side', 'top', '-padx', 5, '-pady', 5

areaf = TkFrame( f3'.areaf', '-borderwidth', 3  )
'extract /'ctype'/'
If ctype = 'color' Then num_colors = color.0
Else num_colors = ecolor.0
max_width = 0
Do i = 1 To num_colors
   If ctype = 'color' Then desc = color_desc.i
   Else desc = ecolor_desc.i
   wl =  Length( desc )
   If wl > max_width Then max_width = wl
End
max_width = max_width + 0
Do i = 1 To num_colors
   col = 2* ((i-1) // 2 )
   row = (i-1) % 2
   If ctype = 'color' Then 
      Do
         color = color.i
         desc = color_desc.i
      End
   Else 
      Do
         color = ecolor.i
         desc = ecolor_desc.i
      End
   arearb.i = TkRadioButton( areaf'.rb'i, '-value', i, '-rexx', 'Area' i, '-variable', 'arearb_'ctype )
   Call TkGrid arearb.i, '-in', areaf, '-row', row, '-column', 0+col, '-pad', 0
/* areala.ctype.i = TkLabel(areaf'.la'ctype||i, '-text', desc, '-width', max_width ) */
   areala.ctype.i = TkText( areaf'.la'ctype||i, '-width', max_width, '-height', 1, '-exportselection', 0 )
   Call TkInsert areala.ctype.i, 'end', desc
   Call TkConfig areala.ctype.i, '-state', 'disabled'
   Call TkGrid areala.ctype.i, '-in', areaf, '-row', row, '-column', 1+col, '-pad', 0
   Call SetColor i color
   Call DrawLabel i ctype
End

allf = TkFrame( f3'.allf', '-relief', 'sunken', '-borderwidth', 3 )
Call TkPack areaf, allf, '-side', 'left', '-padx', 5, '-pady', 5

attrf = TkFrame( allf'.attrf', )
attrs = 'bold reverse italic blink underline'
Do i = 1 To Words( attrs )
   la = TkLabel(attrf'.la'i, '-text', Word( attrs, i ) )
   Call TkGrid la, '-in', attrf, '-row', i, '-column', 0
   chb.i = TkCheckButton(attrf'.chb'i, '-rexx', 'Attr' i, '-variable', 'attr'||Word( attrs, i ) )
   Call TkGrid chb.i, '-in', attrf, '-row', i, '-column', 1
End

foref = TkFrame( allf'.foref', )
backf = TkFrame( allf'.backf', )
forelab = TkLabel( foref'.lab', '-font', 'Helvetica 10', '-text', 'Fore')
Call TkGrid forelab, '-in', foref, '-row', 0, '-column', 0
backlab = TkLabel( backf'.lab', '-font', 'Helvetica 10', '-text', 'Back')
Call TkGrid backlab, '-in', backf, '-row', 0, '-column', 0
Do i = 1 To Words( colors_normal )
   inv = Word( index_inverses, i )
   fb.ctype.i = TkButton(foref'.fore'i, '-text', ' ', '-background', Word( colors_normal, i ), '-activebackground', Word( colors_bold, i ),'-foreground', Word( colors_normal, inv ),'-rexx', 'Fore' i )
   bb.ctype.i = TkButton(backf'.back'i, '-text', ' ', '-background', Word( colors_normal, i ), '-activebackground', Word( colors_bold, i ),'-foreground', Word( colors_normal, inv ),'-rexx', 'Back' i )
   Call TkGrid fb.ctype.i, '-in', foref, '-row', i, '-column', 0
   Call TkGrid bb.ctype.i, '-in', backf, '-row', i, '-column', 0
End

Call TkPack attrf, foref, backf, '-side', 'left'

Call Area 1
Call TkVar 'arearb_'ctype, 1
Return

TestColor:
Parse Arg ctype
/*
'set color' current_area current_fore 'on' current_back
*/
If ctype = 'color' Then num_colors = color.0
Else num_colors = ecolor.0
Do i = 1 To num_colors
   If ctype = 'color' Then color = color.i
   Else color = ecolor.i
   'set' ctype Word( color, 1 ) current_attr.ctype.i current_fore.ctype.i 'on' current_back.ctype.i
End
'refresh'
Return

Fore:
Parse Arg idx
this_fore = Word( colors, idx )
Call TkConfig areala.ctype.current_index, '-foreground', this_fore
current_fore.ctype.current_index = this_fore
Call DrawLabel current_index ctype
Call SetAttrCheckButtons current_index
Return

Back:
Parse Arg idx
this_back = Word( colors, idx )
Call TkConfig areala.ctype.current_index, '-background', this_back
current_back.ctype.current_index = this_back
Call DrawLabel current_index ctype
Call SetAttrCheckButtons current_index
Return

Attr:
Parse Arg idx
this_attr = Word( attrs, idx )
If TkVar( 'attr'||this_attr ) Then
   Do
      /*
       * This attribute turned on, add it to the current area's attributes
       */
      current_attr.ctype.current_index = current_attr.ctype.current_index this_attr
   End
Else
   Do
      /*
       * This attribute turned off, remove it from the current area's attributes
       */
      this_pos = Wordpos( this_attr, current_attr.ctype.current_index )
      current_attr.ctype.current_index = DelWord( current_attr.ctype.current_index, this_pos, 1 )
   End
Call DrawLabel current_index ctype
Return

Area:
Parse Arg val
current_index = val
current_index.ctype = val
Call SetAttrCheckButtons current_index
Return

SetAttrCheckButtons:
Parse Arg idx
color_attrs = GetAttrs( current_attr.ctype.idx )
/*
 * Set all attribute check buttons to off
 */
Do i = 1 To Words( attrs )
   Call TkVar 'attr'||Word( attrs, i ), 0
End
/*
 * Turn on those checkbuttons for the current attributes
 */
Do i = 1 To Words( color_attrs )
   ca = Word( color_attrs, i )
   Call TkVar 'attr'||Word( attrs, ca ), 1
End
Parse Value DrawLabel( idx ctype ) With foreidx backidx
/*
 * Show a big X on the fore/back labels...
 */
Do i = 1 To 8
   Call TkConfig fb.ctype.i, '-text', ' '
   Call TkConfig bb.ctype.i, '-text', ' '
End
Call TkConfig fb.ctype.foreidx, '-text', 'X'
Call TkConfig bb.ctype.backidx, '-text', 'X'
Return

GetAttrs: Procedure Expose attrs
Parse Arg attr
all_wp = ''
Do i = 1 To Words( attr )
   wp = Wordpos( Word( attr, i ), attrs )
   If wp \= 0 Then all_wp = all_wp wp
End
Return all_wp

ResetColor:
Parse Arg ctype
If ctype = 'color' Then num_colors = color.0
Else num_colors = ecolor.0
Do i = 1 To num_colors
   If ctype = 'color' Then Call SetColor i color.i
   Else Call SetColor i ecolor.i
   Call DrawLabel i ctype
End
Call SetAttrCheckButtons current_index
/* Call TestColor ctype */
Return

SetColor:
Parse Arg idx color
tot = Words( color )
current_attr.ctype.idx = Subword( color, 2, tot-4 )
current_fore.ctype.idx = Word( color, tot-2)
current_back.ctype.idx = Word( color, tot)
Return

DrawLabel:
Parse Arg idx ctype
backidx = Wordpos( current_back.ctype.idx, colors )
If Wordpos( 'blink', current_attr.ctype.idx ) \= 0 Then back = Word( colors_bold, backidx )
Else back = Word( colors_normal, backidx )
foreidx = Wordpos( current_fore.ctype.idx, colors )
If Wordpos( 'bold', current_attr.ctype.idx ) \= 0 Then fore = Word( colors_bold, foreidx )
Else fore = Word( colors_normal, foreidx )
font = 'Helvetica 12 bold'
If Wordpos( 'italic', current_attr.ctype.idx ) \= 0 Then font = font 'italic'
If Wordpos( 'underline', current_attr.ctype.idx ) \= 0 Then Nop
Call TkConfig areala.ctype.idx, '-font', font, '-foreground', fore, '-background', back, '-selectforeground', fore, '-selectbackground', back
Return foreidx backidx

RaiseTab:
Parse Arg bn
Select
   When bn = color_tab Then
      Do
         ctype = 'color'
         current_index = current_index.ctype
      End
   When bn = ecolor_tab Then
      Do
         ctype = 'ecolor'
         current_index = current_index.ctype
      End
   Otherwise Nop
End
Return

/*
 * Common routines
 */

Ended:
Call Quit

Syntax:
'msg' 'Syntax error at line:' sigl
'msg' '>>>' Sourceline( sigl )
'msg' Errortext( rc )
If Countstr( '.', Condition( 'E' ) ) \= 0 Then 'msg' Condition( 'D' )
/*
 * Fall through
 */
Quit:
Exit:
Call TkComboboxDropFuncs( 'UNLOAD' )
Call TkNotebookDropFuncs( 'UNLOAD' )
Call TkDropFuncs( 'UNLOAD' )
Exit 0