-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathDialEdit.pas
5441 lines (4781 loc) · 163 KB
/
DialEdit.pas
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
{ $IFDEF DPMI}
{ $A+,B-,E+,F-,G+,I+,N+,P-,T-,V-,X+}
{ $M 65520,0}
{ $ELSE}
{ $A+,B-,E+,F-,G+,I+,N+,O+,P-,T-,V-,X+}
{ $M 8192,8192,614400}
{ $ENDIF}
program DialEdit; {&Use32+}
{*******************************************************}
{ }
{ Released under GNU General Public License 3 as }
{ given at https://www.gnu.org/copyleft/gpl.html }
{ April 29, 2014 }
{ }
{*******************************************************}
uses Dos, Objects, Drivers, Memory, Views, Menus, Dialogs, StdDlg,
MsgBox, App, Validate, TVinput, Params, Gadgets, HistList;
const
CopyNote = 'DialEdit 8-14-95 (C) J.M.Clark';
{*******************************************************}
{ }
{ DialEdit - a dialog editor }
{ }
{ This provides for visual editing of TurboVision }
{ dialog boxes (TDialog objects) with the follow- }
{ ing component objects: }
{ }
{ TStaticText }
{ TParamText }
{ TButton }
{ TInputLine \ }
{ TRadioButtons | }
{ TCheckBoxes |- These may have a TLabel. }
{ TMultiCheckBoxes | }
{ TListBox / }
{ }
{ TInputLine may have one of these validators: }
{ FilterValidator }
{ RangeValidator (value is longint) }
{ StringLookupValidator }
{ PXPictureValidator }
{ and may have a History icon. }
{ }
{ TListBox also has a vertical TScrollBar. }
{ }
{ 'Trial' versions of these can be moved/sized by }
{ dragging with left/right mouse buttons. A double }
{ click re-activates the initialing dialog to edit }
{ features. Dialogs can be saved to a file and }
{ fetched later, and Pascal code and/or picture of }
{ the dialog can be generated and written to a disk }
{ file or to standard output. }
{ }
{ For full documentation, see file DialEdit.doc. }
{ }
{*******************************************************}
(****************************************************=--
----------------------- TO DO --------------------------
provide FocusFirst option in create/edit dialogs for all controls.
this would put a control^.Select call at the end of the dialog
init code to make that control focused first.
COMPLETE conversion to dual string collections for Cluster objects.
read/write history should use Done to close BufStream ?
add generic validator to TrialInputLine
in form of
<xxx>InputLine - need name of defining unit
<xxx>Validator - need name of defining unit, and -
generate code as in TvInput unit -
with IL^ do begin
SetValidator(New(P<name>Validator, Init(<arg list>)));
Validator^.Options:= <voXXX bit>; {optional}
Options:= Options or ofValidate;
end;
provide a FileDialog for Select Files dialog
generate optional 'blank' HandleEvent method code
generate const definitions for - - done, need to doc.
History ID names
CheckBox bit positions
MultiCheckBox mask values
RadioButton values
provide variants -
MRadioButtons (from TvInput)
BigCheckBoxes (add to TvInput; for Count >16, <=32)
Use of ValidView -
is it included in ExecDialog?
is it used consistently?
is OutOfMemory involved? needed?
Discard Patterned option? (Pattern indicates editable)
Put pictures in Picture file? Allow PictFile = CodeFile?
Provide for translating trial objects to real dialogs; -- done
( but
collections for ListBoxes,
validators for InputLines, &
commands for Buttons
are not supported in 'real' dialogs.
)
use real dialogs to -
store dialogs in (real) ResourceFile
execute -
for test -- done
to define default data -- done
Provide backup for output file (except '').
Provide backup for collection file.
InputLine length parameter (dialog input) -
default: if input is number,
length is input and type is string[input].
option: if input is type,
length is SizeOf(input)-1 and type is input.
Provide 25-line mode (or version), compact-format dialogs.
Re-structuring -
Use revised OOP form of Params unit (ParamsO).
Look for repeated code that can be merged.
----------------------- NOTES --------------------------
Cluster value size
Documentation and debugger say SizeOf(Value) is 4.
Documentation says DataSize returns SizeOf(Value) --
BUT source code and experimentation say SizeOf(word) !
(However, Value is actually a longint.)
CheckBoxes and RadioButtons do not override DataSize.
MultiCheckBoxes.DataSize = 4 (longint).
ParamText.SetData
The documenation says that ParamText.SetData "reads DataSize
bytes into ParamList from Rec". Actually, it does "ParamList:=
@Rec", so no memory is allocated for ParamList. There is no
GetData method. ParamList points to a FormatStr parameter list,
making the list data available to ParamText.Draw indirectly.
DataSize is the size of the list (4 bytes per item).
ListBox
An item can be selected by double-clicking it with the mouse,
or moving the highlight with the cursor keys and pressing space.
When an item is selected, the ListBox executes:
Message(Owner, evBroadcast, cmListItemSelected, @Self);
But to use this, the Dialog needs code added to its EventHandler
such as in FetchDialogDialog.
Collections - names for item methods -
obvious name Turbo Vision name
------------ -----------------
FreeItem Free
DeleteItem Delete
DisposeItem FreeItem
LoadItem GetItem
StoreItem PutItem
EMSStream cannot support ResourceFile
(as hoped for in CloseCollFile).
TDialog.HandleEvent -
Borland documentation says that TDialog.HandleEvent
"handles most events by calling the HandleEvent method
inherited from TWindow .."
and that TWindow.HandleEvent
"handles events specific to windows"
including command
"cmResize (move or resize the window using DragView)".
However, the debugger *seems* to reveal that TWindow does
the move and resize functions without calling DragView.
Not really -- DragView is not virtual!! (and can't be)
But SetState *is* virtual; use SetState(sfDragging, )
to clear DialSaved.
--=****************************************************)
type
String5 = string[5];
{ command codes }
const
cmNewDialog = 111;
cmNewStaticText = 112;
cmNewParamText = 113;
cmNewButton = 114;
cmNewInputLine = 115;
cmNewRadioButtons = 116;
cmNewCheckBoxes = 117;
cmNewMultiCheckBoxes =118;
cmNewListBox = 119;
cmDelete = cmNo;
cmPutOnTop = cmYes;
cmEditItem = 120;
cmNewItem = 121;
cmSaveDialog = 122;
cmDeleteDialog = 123;
cmFetchDialog = 124;
cmGenCode = 125;
cmSnapPicture = 126;
cmSetFiles = 127;
cmSetDefault = 128;
cmSetPaste = 129;
cmOutput = 130;
cmSwapDialogs = 131;
cmTestDialog = 132;
{$IFDEF ScreenCapture}
cmScreenCapture = 150; {Alt-Z}
{$ENDIF}
cmsNewControls = [
cmNewStaticText, cmNewParamText, cmNewButton, cmNewInputLine,
cmNewRadioButtons, cmNewCheckBoxes, cmNewMultiCheckBoxes,
cmNewListBox, cmSaveDialog, cmDeleteDialog, cmGenCode,
cmSnapPicture, cmTestDialog
];
TitleLen = SizeOf(TTitleStr)-1;
IDChars = ['a'..'z', 'A'..'Z', '0'..'9', '_'];
ShadeChars: String5 = ' °±²Û';
{ history ID codes }
hiDialogName = 102;
hiStaticText = 103;
hiDataName = 104;
hiCmdName = 105;
hiLabelText = 106;
hiValPars = 107;
hiStates = 108;
hiHistID = 109;
hiCollFile = 110;
hiHistFile = 111;
hiCodeFile = 112;
hiTestID = 113; {for 'real' history objects}
{ values for GenVars, indicating dialog variables needed: }
gvInputLine = $0001; {IL}
gvRadioButtons = $0002; {RB}
gvCheckBoxes = $0004; {CB}
gvMultiCheckBoxes=$0008; {MB}
gvScrollBar = $0010; {SB}
gvListBox = $0020; {LB}
{ parts of generated code, in outline form: }
type
TGenPart = (
gpDisabled, {others imply enabled}
{ for generating TV code output: }
gpFileHeader,
gpInterface, {not used}
gpDialogHeader,
gpDataFields,
gpDataConsts,
gpDataHeader,
gpDataValues,
gpImplementation, {not used}
gpHistConsts,
gpDialogInit,
gpControls,
gpDialogFooter,
gpFileFooter,
{ for generating picture output: }
gpPicture, {not used}
{ for creating real dialog from trial dialog: }
gpClone
);
{*******************************************************}
{ Outline of global functions and procedures }
{ These are implemented below in the same sequence }
{
RegisterTrialObjects
shared by trial objects -
DragIt
DragBoth
NewLabel
CodeBounds
InitBounds
CopyStrings
InitStrings
EscQuot
GenImplementation
stream & file routines -
OpenCollFile
CloseCollFile
OpenCodeFile
CloseCodeFile
RemDialog
SaveDialog
DeleteDialog
GetDialog
FetchDialog
TestDialog
ReadHistory
WriteHistory
ScreenCapture * (optional)
}
{*******************************************************}
{ Trial objects, and associated data and dialog objects: }
{ The objects are implemented below in the same sequence. }
{ The Execute method of trial objects is overridden and }
{ used to generate code, because it is generic and not }
{ otherwise used (trial objects are never modal). }
type
{ ControlEditDialog }
PControlEditDialog = ^TControlEditDialog;
TControlEditDialog = object(TDialog)
constructor Init(var Bounds: TRect; ATitle: TTitleStr);
destructor Done; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure MakeDialogNames(SX: integer);
procedure MakeDialogButtons(X1, X2, SY: integer;
Change: boolean; OkMode: word);
end;
{ TrialLabel }
PTrialLabel = ^TTrialLabel;
TTrialLabel = object(TLabel)
constructor Init(var Bounds: TRect; AText: TTitleStr;
ALink: PView);
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
procedure GenCode(const LinkName: string);
procedure ChangeText(const ALabel: string);
procedure TrackTarget(const OldR: TRect);
end;
{ NOTE: No label is indicated EITHER by setting the label }
{ pointer to nil, OR by setting the label text to ''. }
{ TrialStaticText }
PStaticTextDialog = ^TStaticTextDialog;
TStaticTextDialog = object(TControlEditDialog)
constructor Init(Change: boolean);
end;
PStaticTextData = ^TStaticTextData;
TStaticTextData = record
RText: TTitleStr;
end;
PTrialStaticText = ^TTrialStaticText;
TTrialStaticText = object(TStaticText)
constructor Init(AData: PStaticTextData);
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
end;
{ TrialParamText }
PParamTextDialog = ^TParamTextDialog;
TParamTextDialog = object(TControlEditDialog)
constructor Init(Change: boolean);
end;
PParamTextData = ^TParamTextData;
TParamTextData = record
RFormat: TTitleStr;
RNames: TTitleStr;
end;
PTrialParamText = ^TTrialParamText;
TTrialParamText = object(TParamText)
Names: PString;
constructor Init(AData: PParamTextData);
constructor Load(var S: TStream);
destructor Done; virtual;
function Execute: word; virtual;
{ Changed GetText to GetText2 because VP gives error 131: }
{ "Header does not match previous definition" }
{ But it DOES! letter for letter! }
procedure GetText2(var S: String); virtual; {+}
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var Min, Max: TPoint); virtual;
procedure Store(var S: TStream);
end;
{ TrialButton }
PButtonDialog = ^TButtonDialog;
TButtonDialog = object(TControlEditDialog)
constructor Init(Change: boolean);
end;
PButtonData = ^TButtonData;
TButtonData = record
RTitle: TTitleStr;
RCmdName: TTitleStr; {cmXXX name}
RFlags: byte; {bfXXX values}
end;
PTrialButton = ^TTrialButton;
TTrialButton = object(TButton)
CmdName: PString;
constructor Init(AData: PButtonData);
destructor Done; virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
{ TrialInputLine }
PInputLineDialog = ^TInputLineDialog;
TInputLineDialog = object(TControlEditDialog)
MRButtons: PMRadioButtons;
Advice: PStaticText;
constructor Init(Change: boolean);
procedure HandleEvent(var Event: TEvent); virtual;
end;
PInputLineData = ^TInputLineData;
TInputLineData = record
RLabel: TTitleStr;
RDataName: TTitleStr;
RMaxLen: longint;
RHistStr: TTitleStr;
RValidate: word;
RValPars: TTitleStr;
end;
{ TrialHistory }
PTrialHistory = ^TTrialHistory;
TTrialHistory = object(THistory)
procedure HandleEvent(var Event: TEvent); virtual;
procedure TrackTarget(const OldR: TRect);
end;
PTrialInputLine = ^TTrialInputLine;
TTrialInputLine = object(TInputLine)
LabelP: PTrialLabel;
DataName: PString;
History: PTrialHistory;
HistStr: PString;
Validate: word;
ValPars: PString;
constructor Init(AData: PInputLineData);
destructor Done; virtual;
procedure MakeHistory(AHistStr: TTitleStr); virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load01(var S: TStream);
constructor Load02(var S: TStream);
procedure Convert02;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
{ TrialCluster } { shared by 3 descendant trial objects }
TShortName = string[2];
PItemData = ^TItemData;
TItemData = record
Name: TTitleStr; {optional name for item value}
Strg: TTitleStr; {dialog text for cluster item}
end;
PClusterData = ^TClusterData;
TClusterData = record
RLabel: TTitleStr;
RDataName: TTitleStr;
RStrings: PStringCollection;
RFocused: integer;
RItemNames: PStringCollection;
RNFocused: integer;
RStates: TTitleStr; {for MultiCheckBoxes only}
RShortName: TShortName;
end;
PItemDialog = ^TItemDialog;
TItemDialog = object(TDialog)
constructor Init(T: TTitleStr; FocusName: boolean);
end;
PClusterDialog = ^TClusterDialog;
TClusterDialog = object(TControlEditDialog)
StrgList: PListBox;
NameList: PListBox;
FocusName: boolean;
constructor Init(Change: boolean; ShortName: TShortName);
procedure HandleEvent(var Event: TEvent); virtual;
end;
{ ClusterDialog.StrgList^.List = @Cluster.Strings }
{ ClusterDialog.NameList^.List = names for item values }
PTrialCluster = ^TTrialCluster;
TTrialCluster = object(TObject)
DataName: PString;
ShortName: TShortName;
ItemNames: TStringCollection;
constructor Init(AData: PClusterData; var CL: TCluster);
destructor Done; virtual;
procedure Resize(var CL: TCluster; LabelP: PTrialLabel);
virtual;
procedure GenCode(var CL: TCluster); virtual;
procedure HandleEvent(var Event: TEvent; CL: PCluster;
LabelP: PTrialLabel); virtual;
constructor Load01(var S: TStream);
procedure Convert01(var CL: TCluster);
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
PTrialRadioButtons = ^TTrialRadioButtons;
TTrialRadioButtons = object(TRadioButtons)
LabelP: PTrialLabel;
TC: TTrialCluster;
constructor Init(AData: PClusterData);
destructor Done; virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
PTrialCheckBoxes = ^TTrialCheckBoxes;
TTrialCheckBoxes = object(TCheckBoxes)
LabelP: PTrialLabel;
TC: TTrialCluster;
constructor Init(AData: PClusterData);
destructor Done; virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
PTrialMultiCheckBoxes = ^TTrialMultiCheckBoxes;
TTrialMultiCheckBoxes = object(TMultiCheckBoxes)
LabelP: PTrialLabel;
TC: TTrialCluster;
constructor Init(AData: PClusterData);
destructor Done; virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
{ TrialListBox }
PListBoxDialog = ^TListBoxDialog;
TListBoxDialog = object(TControlEditDialog)
constructor Init(Change: boolean);
end;
PListBoxData = ^TListBoxData;
TListBoxData = record
RLabel: TTitleStr;
RListName: TTitleStr;
RSelectName: TTitleStr;
RNumCols: longint;
end;
PTrialScrollBar = ^TTrialScrollBar;
TTrialScrollBar = object(TScrollBar)
Link: PView;
constructor Init(Bounds: TRect; ALink: PView);
procedure HandleEvent(var Event: TEvent); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
procedure GenCode;
procedure TrackTarget(const OldR: TRect);
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
PTrialListBox = ^TTrialListBox;
TTrialListBox = object(TListBox)
LabelP: PTrialLabel;
ListName: PString;
SelectName: PString;
constructor Init(AData: PListBoxData);
destructor Done; virtual;
function Execute: word; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SetState(AState: word; Enable: boolean); virtual;
procedure SizeLimits(var MinSz, MaxSz: TPoint); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
{ TrialDialog }
PDialogDialog = ^TDialogDialog;
TDialogDialog = object(TControlEditDialog)
constructor Init(Change: boolean);
end;
PDialogData = ^TDialogData;
TDialogData = record
RTitle: TTitleStr;
ROptions: word;
RBaseName: TTitleStr;
RTypeName: TTitleStr;
end;
{ Base and Type names are used as in: }
{ TBaseType = object(TType) }
{ TBaseData = record (etc.) }
{ Type is generally Window or Dialog. }
{ values for TDialogData.ROptions: }
const
doGenDefaults = $01;
doCentered = $02;
doOkButton = $04;
doCancelButton = $08;
type
PTrialDialogBackground = ^TTrialDialogBackground;
TTrialDialogBackground = object(TView)
Patterned: boolean;
constructor Init(Bounds: TRect);
procedure Draw; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
PTrialDialog = ^TTrialDialog;
TTrialDialog = object(TDialog)
BaseName: PString;
TypeName: PString;
Background: PTrialDialogBackground;
Centered: boolean;
GenDefaults: boolean;
constructor Init(AData: PDialogData);
destructor Done; virtual;
procedure Close; virtual;
procedure GenCode; virtual;
procedure SnapPicture(AShow, APattern: word); virtual;
procedure HandleEvent(var Event: TEvent); virtual;
procedure SetState(AState: word; Enable: boolean); virtual;
constructor Load01(var S: TStream);
constructor Load(var S: TStream);
procedure Store(var S: TStream); virtual;
end;
{ FetchDialogDialog }
PFetchDialogDialog = ^TFetchDialogDialog;
TFetchDialogDialog = object(TDialog)
ListBox: PListBox;
Plural: boolean;
constructor Init(APlural: boolean);
procedure HandleEvent(var Event: TEvent); virtual;
end;
PFetchDialogData = ^TFetchDialogData;
TFetchDialogData = record
RNames: PStringCollection;
RSelection: word; {for single mode}
end;
{ FileOptDialog }
PFileOptDialog = ^TFileOptDialog;
TFileOptDialog = object(TDialog)
constructor Init;
end;
PFileOptData = ^TFileOptData;
TFileOptData = record
CodeFName: TTitleStr;
CollFName: TTitleStr;
HistFName: TTitleStr;
end;
{ OutOptDialog }
POutOptDialog = ^TOutOptDialog;
TOutOptDialog = object(TDialog)
constructor Init;
end;
POutOptData = ^TOutOptData;
TOutOptData = record
RSave: word;
RInclude: word;
RShow: word;
RShades: longint;
GenFormat: word;
RIndent: longint;
end;
{ Token }
const
sfPaste = $4000; {special}
type
PToken = ^TToken;
TToken = object(TView)
Kind: char; {m = mode; s = swap}
constructor Init(Bounds: TRect; AKind: char);
procedure Draw; virtual;
procedure SetState(AState: word; Enable: boolean); virtual;
procedure Update; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
end;
{ TDialEditApp }
{ supporting routines linked to Params unit:
ShowUsage
SetOpt
DoFile
AppDone
}
PDialEditApp = ^TDialEditApp;
TDialEditApp = object(TApplication)
Clock: PClockView;
{$IFNDEF VPASCAL}
Heap: PHeapView;
{$ENDIF}
constructor Init;
destructor Done; virtual;
procedure InitScreen; virtual;
procedure InitMenuBar; virtual;
procedure InitStatusLine; virtual;
{ supporting local routines:
NewDialog
NewStaticText
NewParamText
NewButton
NewInputLine
NewRadioButtons
NewCheckBoxes
NewMultiChecfkBoxes
NewListBox
SnapIt
SetFiles
}
procedure HandleEvent(var Event: TEvent); virtual;
procedure Idle; virtual;
procedure OutOfMemory; virtual;
procedure GenCode(ATrialDialog: PTrialDialog); virtual;
end;
{ Default / Paste object-edit data buffers }
TEditBuffer = record
DDialog: TDialogData;
DStaticText: TStaticTextData;
DParamText: TParamTextData;
DButton: TButtonData;
DInputLine: TInputLineData;
DRadioButtons: TClusterData;
DCheckBoxes: TClusterData;
DMultiCheckBoxes: TClusterData;
DListBox: TListBoxData;
DOutOpt: TOutOptData;
end;
const
Default: TEditBuffer = (
DDialog: (
RTitle: 'Test Dialog';
ROptions: $0E;
RBaseName: 'Test';
RTypeName: 'Dialog'
);
DStaticText: (
RText: ''
);
DParamText: (
RFormat: '';
RNames: ''
);
DButton: (
RTitle: '~N~o';
RCmdName: 'cmNo';
RFlags: bfNormal
);
DInputLine: (
RLabel: '~N~ame';
RDataName: 'Name';
RMaxLen: 80;
RHistStr: '';
RValidate: 0;
RValPars: ''
);
DRadioButtons: (
RLabel: '~M~ode';
RDataName: 'Mode';
RStrings: nil;
RFocused: 0;
RItemNames: nil;
RNFocused: 0;
RStates: '';
RShortName: 'RB'
);
DCheckBoxes: (
RLabel: '~O~ptions';
RDataName: 'Options';
RStrings: nil;
RFocused: 0;
RItemNames: nil;
RNFocused: 0;
RStates: '';
RShortName: 'CB'
);
DMultiCheckBoxes: (
RLabel: '~C~hoices';
RDataName: 'Choices';
RStrings: nil;
RFocused: 0;
RItemNames: nil;
RNFocused: 0;
RStates: '<=>';
RShortName: 'MB'
);
DListBox: (
RLabel: '~S~election';
RListName: 'List';
RSelectName: 'Selection';
RNumCols: 1
);
DOutOpt: (
RSave: 0;
RInclude: 1;
RShow: 0;
RShades: $32;
GenFormat: 1;
RIndent: 0
)
);
{*******************************************************}
{ }
{ Stream Registration Records }
{ }
{*******************************************************}
const
RTrialLabel: TStreamRec = (
ObjType: 1100;
VmtLink: Ofs(TypeOf(TTrialLabel)^);
Load: @TLabel.Load; {using ancestor's load}
Store: @TLabel.Store {using ancestor's store}
);
RTrialStaticText: TStreamRec = (
ObjType: 1102;
VmtLink: Ofs(TypeOf(TTrialStaticText)^);
Load: @TStaticText.Load; {using ancestor's load}
Store: @TStaticText.Store {using ancestor's store}
);
RTrialParamText: TStreamRec = (
ObjType: 1112;
VmtLink: Ofs(TypeOf(TTrialParamText)^);
Load: @TTrialParamText.Load;
Store: @TTrialParamText.Store
);
RTrialButton: TStreamRec = (
ObjType: 1101;
VmtLink: Ofs(TypeOf(TTrialButton)^);
Load: @TTrialButton.Load;
Store: @TTrialButton.Store
);
RTrialHistory: TStreamRec = (
ObjType: 1113;
VmtLink: Ofs(TypeOf(TTrialHistory)^);
Load: @THistory.Load; {using ancestor's load}
Store: @THistory.Store {using ancestor's store}
);
{ old version; no History icon }
RTrialInputLine01: TStreamRec = (
ObjType: 1103;
VmtLink: Ofs(TypeOf(TTrialInputLine)^);
Load: @TTrialInputLine.Load01; {convert old to new}
Store: @Abstract {can't use}
);
{ newer version; has History ID # }
RTrialInputLine02: TStreamRec = (
ObjType: 1114;
VmtLink: Ofs(TypeOf(TTrialInputLine)^);
Load: @TTrialInputLine.Load02; {convert old to new}
Store: @Abstract {can't use}
);
{ newest version; has History ID string }
RTrialInputLine: TStreamRec = (
ObjType: 1115;
VmtLink: Ofs(TypeOf(TTrialInputLine)^);
Load: @TTrialInputLine.Load;
Store: @TTrialInputLine.Store
);
{ old version; no ItemNames }
RTrialCluster01: TStreamRec = (
ObjType: 1104;
VmtLink: Ofs(TypeOf(TTrialCluster)^);
Load: @TTrialCluster.Load01; {convert old to new}
Store: @Abstract {can't use}
);
{ new version; has ItemNames }
RTrialCluster: TStreamRec = (
ObjType: 1117;
VmtLink: Ofs(TypeOf(TTrialCluster)^);
Load: @TTrialCluster.Load;
Store: @TTrialCluster.Store
);
RTrialRadioButtons: TStreamRec = (
ObjType: 1106;
VmtLink: Ofs(TypeOf(TTrialRadioButtons)^);
Load: @TTrialRadioButtons.Load;
Store: @TTrialRadioButtons.Store
);
RTrialCheckBoxes: TStreamRec = (
ObjType: 1105;
VmtLink: Ofs(TypeOf(TTrialCheckBoxes)^);
Load: @TTrialCheckBoxes.Load;
Store: @TTrialCheckBoxes.Store
);
RTrialMultiCheckBoxes: TStreamRec = (
ObjType: 1111;
VmtLink: Ofs(TypeOf(TTrialMultiCheckBoxes)^);
Load: @TTrialMultiCheckBoxes.Load;
Store: @TTrialMultiCheckBoxes.Store
);
RTrialScrollBar: TStreamRec = (
ObjType: 1109;
VmtLink: Ofs(TypeOf(TTrialScrollBar)^);
Load: @TTrialScrollBar.Load;
Store: @TTrialScrollBar.Store
);
RTrialListBox: TStreamRec = (
ObjType: 1110;
VmtLink: Ofs(TypeOf(TTrialListBox)^);
Load: @TTrialListBox.Load;
Store: @TTrialListBox.Store
);
RTrialDialogBackground: TStreamRec = (
ObjType: 1107;
VmtLink: Ofs(TypeOf(TTrialDialogBackground)^);
Load: @TTrialDialogBackground.Load;
Store: @TTrialDialogBackground.Store
);
{ old version }
RTrialDialog01: TStreamRec = (
ObjType: 1108;
VmtLink: Ofs(TypeOf(TTrialDialog)^);
Load: @TTrialDialog.Load01; {convert to new}