forked from jackokring/rub
-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathdialogs.pas
4186 lines (3848 loc) · 184 KB
/
dialogs.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
{********[ SOURCE FILE OF GRAPHICAL FREE VISION ]**********}
{ }
{ System independent GRAPHICAL clone of DIALOGS.PAS }
{ }
{ Interface Copyright (c) 1992 Borland International }
{ }
{ Copyright (c) 1996, 1997, 1998, 1999 by Leon de Boer }
{ [email protected] - primary e-mail addr }
{ [email protected] - backup e-mail addr }
{ }
{****************[ THIS CODE IS FREEWARE ]*****************}
{ }
{ This sourcecode is released for the purpose to }
{ promote the pascal language on all platforms. You may }
{ redistribute it and/or modify with the following }
{ DISCLAIMER. }
{ }
{ This SOURCE CODE is distributed "AS IS" WITHOUT }
{ WARRANTIES AS TO PERFORMANCE OF MERCHANTABILITY OR }
{ ANY OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. }
{ }
{*****************[ SUPPORTED PLATFORMS ]******************}
{ }
{ Only Free Pascal Compiler supported }
{ }
{**********************************************************}
UNIT Dialogs;
{$CODEPAGE cp437}
{2.0 compatibility}
{$ifdef VER2_0}
{$macro on}
{$define resourcestring := const}
{$endif}
{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
INTERFACE
{<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>>}
{====Include file to sort compiler platform out =====================}
{$I platform.inc}
{====================================================================}
{==== Compiler directives ===========================================}
{$X+} { Extended syntax is ok }
{$R-} { Disable range checking }
{$S-} { Disable Stack Checking }
{$I-} { Disable IO Checking }
{$Q-} { Disable Overflow Checking }
{$V-} { Turn off strict VAR strings }
{====================================================================}
USES
{$IFDEF OS_WINDOWS} { WIN/NT CODE }
Windows, { Standard units }
{$ENDIF}
{$IFDEF OS_OS2} { OS2 CODE }
OS2Def, DosCalls, PMWIN, { Standard units }
{$ENDIF}
FVCommon, FVConsts, Objects, Drivers, Views, Validate; { Standard GFV units }
{***************************************************************************}
{ PUBLIC CONSTANTS }
{***************************************************************************}
{---------------------------------------------------------------------------}
{ COLOUR PALETTE DEFINITIONS }
{---------------------------------------------------------------------------}
CONST
CGrayDialog = #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;
CBlueDialog = #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#92#94#95;
CCyanDialog = #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;
CStaticText = #6#7#8#9;
CLabel = #7#8#9#9;
CButton = #10#11#12#13#14#14#14#15;
CCluster = #16#17#18#18#31#6;
CInputLine = #19#19#20#21#14;
CHistory = #22#23;
CHistoryWindow = #19#19#21#24#25#19#20;
CHistoryViewer = #6#6#7#6#6;
CDialog = CGrayDialog; { Default palette }
const
{ ldXXXX constants }
ldNone = $0000;
ldNew = $0001;
ldEdit = $0002;
ldDelete = $0004;
ldNewEditDelete = ldNew or ldEdit or ldDelete;
ldHelp = $0008;
ldAllButtons = ldNew or ldEdit or ldDelete or ldHelp;
ldNewIcon = $0010;
ldEditIcon = $0020;
ldDeleteIcon = $0040;
ldAllIcons = ldNewIcon or ldEditIcon or ldDeleteIcon;
ldAll = ldAllIcons or ldAllButtons;
ldNoFrame = $0080;
ldNoScrollBar = $0100;
{ ofXXXX constants }
ofNew = $0001;
ofDelete = $0002;
ofEdit = $0004;
ofNewEditDelete = ofNew or ofDelete or ofEdit;
{---------------------------------------------------------------------------}
{ TDialog PALETTE COLOUR CONSTANTS }
{---------------------------------------------------------------------------}
CONST
dpBlueDialog = 0; { Blue dialog colour }
dpCyanDialog = 1; { Cyan dialog colour }
dpGrayDialog = 2; { Gray dialog colour }
{---------------------------------------------------------------------------}
{ TButton FLAGS MASKS }
{---------------------------------------------------------------------------}
CONST
bfNormal = $00; { Normal displayed }
bfDefault = $01; { Default command }
bfLeftJust = $02; { Left just text }
bfBroadcast = $04; { Broadcast command }
bfGrabFocus = $08; { Grab focus }
{---------------------------------------------------------------------------}
{ TMultiCheckBoxes FLAGS - (HiByte = Bits LoByte = Mask) }
{---------------------------------------------------------------------------}
CONST
cfOneBit = $0101; { One bit masks }
cfTwoBits = $0203; { Two bit masks }
cfFourBits = $040F; { Four bit masks }
cfEightBits = $08FF; { Eight bit masks }
{---------------------------------------------------------------------------}
{ DIALOG BROADCAST COMMANDS }
{---------------------------------------------------------------------------}
CONST
cmRecordHistory = 60; { Record history cmd }
{***************************************************************************}
{ RECORD DEFINITIONS }
{***************************************************************************}
{---------------------------------------------------------------------------}
{ ITEM RECORD DEFINITION }
{---------------------------------------------------------------------------}
TYPE
PSItem = ^TSItem;
TSItem = RECORD
Value: PString; { Item string }
Next: PSItem; { Next item }
END;
{***************************************************************************}
{ OBJECT DEFINITIONS }
{***************************************************************************}
{---------------------------------------------------------------------------}
{ TInputLine OBJECT - INPUT LINE OBJECT }
{---------------------------------------------------------------------------}
TYPE
TInputLine = OBJECT (TView)
MaxLen: Sw_Integer; { Max input length }
CurPos: Sw_Integer; { Cursor position }
FirstPos: Sw_Integer; { First position }
SelStart: Sw_Integer; { Selected start }
SelEnd: Sw_Integer; { Selected end }
Data: PString; { Input line data }
Validator: PValidator; { Validator of view }
CONSTRUCTOR Init (Var Bounds: TRect; AMaxLen: Sw_Integer);
CONSTRUCTOR Load (Var S: TStream);
DESTRUCTOR Done; Virtual;
FUNCTION DataSize: Sw_Word; Virtual;
FUNCTION GetPalette: PPalette; Virtual;
FUNCTION Valid (Command: Word): Boolean; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE DrawCursor; Virtual;
PROCEDURE SelectAll (Enable: Boolean);
PROCEDURE SetValidator (AValid: PValidator);
PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
PROCEDURE GetData (Var Rec); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
PRIVATE
FUNCTION CanScroll (Delta: Sw_Integer): Boolean;
END;
PInputLine = ^TInputLine;
{---------------------------------------------------------------------------}
{ TButton OBJECT - BUTTON ANCESTOR OBJECT }
{---------------------------------------------------------------------------}
TYPE
TButton = OBJECT (TView)
AmDefault: Boolean; { If default button }
Flags : Byte; { Button flags }
Command : Word; { Button command }
Title : PString; { Button title }
CONSTRUCTOR Init (Var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;
AFlags: Word);
CONSTRUCTOR Load (Var S: TStream);
DESTRUCTOR Done; Virtual;
FUNCTION GetPalette: PPalette; Virtual;
PROCEDURE Press; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE DrawState (Down: Boolean);
PROCEDURE MakeDefault (Enable: Boolean);
PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
PRIVATE
DownFlag: Boolean;
END;
PButton = ^TButton;
{---------------------------------------------------------------------------}
{ TCluster OBJECT - CLUSTER ANCESTOR OBJECT }
{---------------------------------------------------------------------------}
TYPE
{ Palette layout }
{ 1 = Normal text }
{ 2 = Selected text }
{ 3 = Normal shortcut }
{ 4 = Selected shortcut }
{ 5 = Disabled text }
TCluster = OBJECT (TView)
Id : Sw_Integer; { New communicate id }
Sel : Sw_Integer; { Selected item }
Value : LongInt; { Bit value }
EnableMask: LongInt; { Mask enable bits }
Strings : TStringCollection; { String collection }
CONSTRUCTOR Init (Var Bounds: TRect; AStrings: PSItem);
CONSTRUCTOR Load (Var S: TStream);
DESTRUCTOR Done; Virtual;
FUNCTION DataSize: Sw_Word; Virtual;
FUNCTION GetHelpCtx: Word; Virtual;
FUNCTION GetPalette: PPalette; Virtual;
FUNCTION Mark (Item: Sw_Integer): Boolean; Virtual;
FUNCTION MultiMark (Item: Sw_Integer): Byte; Virtual;
FUNCTION ButtonState (Item: Sw_Integer): Boolean;
PROCEDURE Draw; Virtual;
PROCEDURE Press (Item: Sw_Integer); Virtual;
PROCEDURE MovedTo (Item: Sw_Integer); Virtual;
PROCEDURE SetState (AState: Word; Enable: Boolean); Virtual;
PROCEDURE DrawMultiBox (Const Icon, Marker: String);
PROCEDURE DrawBox (Const Icon: String; Marker: Char);
PROCEDURE SetButtonState (AMask: Longint; Enable: Boolean);
PROCEDURE GetData (Var Rec); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
PRIVATE
FUNCTION FindSel (P: TPoint): Sw_Integer;
FUNCTION Row (Item: Sw_Integer): Sw_Integer;
FUNCTION Column (Item: Sw_Integer): Sw_Integer;
END;
PCluster = ^TCluster;
{---------------------------------------------------------------------------}
{ TRadioButtons OBJECT - RADIO BUTTON OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Normal text }
{ 2 = Selected text }
{ 3 = Normal shortcut }
{ 4 = Selected shortcut }
TYPE
TRadioButtons = OBJECT (TCluster)
FUNCTION Mark (Item: Sw_Integer): Boolean; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE Press (Item: Sw_Integer); Virtual;
PROCEDURE MovedTo(Item: Sw_Integer); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
END;
PRadioButtons = ^TRadioButtons;
{---------------------------------------------------------------------------}
{ TCheckBoxes OBJECT - CHECK BOXES OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Normal text }
{ 2 = Selected text }
{ 3 = Normal shortcut }
{ 4 = Selected shortcut }
TYPE
TCheckBoxes = OBJECT (TCluster)
FUNCTION Mark (Item: Sw_Integer): Boolean; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE Press (Item: Sw_Integer); Virtual;
END;
PCheckBoxes = ^TCheckBoxes;
{---------------------------------------------------------------------------}
{ TMultiCheckBoxes OBJECT - CHECK BOXES OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Normal text }
{ 2 = Selected text }
{ 3 = Normal shortcut }
{ 4 = Selected shortcut }
TYPE
TMultiCheckBoxes = OBJECT (TCluster)
SelRange: Byte; { Select item range }
Flags : Word; { Select flags }
States : PString; { Strings }
CONSTRUCTOR Init (Var Bounds: TRect; AStrings: PSItem;
ASelRange: Byte; AFlags: Word; Const AStates: String);
CONSTRUCTOR Load (Var S: TStream);
DESTRUCTOR Done; Virtual;
FUNCTION DataSize: Sw_Word; Virtual;
FUNCTION MultiMark (Item: Sw_Integer): Byte; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE Press (Item: Sw_Integer); Virtual;
PROCEDURE GetData (Var Rec); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
PROCEDURE Store (Var S: TStream);
END;
PMultiCheckBoxes = ^TMultiCheckBoxes;
{---------------------------------------------------------------------------}
{ TListBox OBJECT - LIST BOX OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Active }
{ 2 = Inactive }
{ 3 = Focused }
{ 4 = Selected }
{ 5 = Divider }
TYPE
TListBox = OBJECT (TListViewer)
List: PCollection; { List of strings }
CONSTRUCTOR Init (Var Bounds: TRect; ANumCols: Sw_Word;
AScrollBar: PScrollBar);
CONSTRUCTOR Load (Var S: TStream);
FUNCTION DataSize: Sw_Word; Virtual;
FUNCTION GetText (Item: Sw_Integer; MaxLen: Sw_Integer): String; Virtual;
PROCEDURE NewList(AList: PCollection); Virtual;
PROCEDURE GetData (Var Rec); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
PROCEDURE Store (Var S: TStream);
procedure DeleteFocusedItem; virtual;
{ DeleteFocusedItem deletes the focused item and redraws the view. }
{#X FreeFocusedItem }
procedure DeleteItem (Item : Sw_Integer); virtual;
{ DeleteItem deletes Item from the associated collection. }
{#X FreeItem }
procedure FreeAll; virtual;
{ FreeAll deletes and disposes of all items in the associated
collection. }
{ FreeFocusedItem FreeItem }
procedure FreeFocusedItem; virtual;
{ FreeFocusedItem deletes and disposes of the focused item then redraws
the listbox. }
{#X FreeAll FreeItem }
procedure FreeItem (Item : Sw_Integer); virtual;
{ FreeItem deletes Item from the associated collection and disposes of
it, then redraws the listbox. }
{#X FreeFocusedItem FreeAll }
function GetFocusedItem : Pointer; virtual;
{ GetFocusedItem is a more readable method of returning the focused
item from the listbox. It is however slightly slower than: }
{#M+}
{
Item := ListBox^.List^.At(ListBox^.Focused); }
{#M-}
procedure Insert (Item : Pointer); virtual;
{ Insert inserts Item into the collection, adjusts the listbox's range,
then redraws the listbox. }
{#X FreeItem }
procedure SetFocusedItem (Item : Pointer); virtual;
{ SetFocusedItem changes the focused item to Item then redraws the
listbox. }
{# FocusItemNum }
END;
PListBox = ^TListBox;
{---------------------------------------------------------------------------}
{ TStaticText OBJECT - STATIC TEXT OBJECT }
{---------------------------------------------------------------------------}
TYPE
TStaticText = OBJECT (TView)
Text: PString; { Text string ptr }
CONSTRUCTOR Init (Var Bounds: TRect; Const AText: String);
CONSTRUCTOR Load (Var S: TStream);
DESTRUCTOR Done; Virtual;
FUNCTION GetPalette: PPalette; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE GetText (Var S: String); Virtual;
END;
PStaticText = ^TStaticText;
{---------------------------------------------------------------------------}
{ TParamText OBJECT - PARMETER STATIC TEXT OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Text }
TYPE
TParamText = OBJECT (TStaticText)
ParamCount: Sw_Integer; { Parameter count }
ParamList : Pointer; { Parameter list }
CONSTRUCTOR Init (Var Bounds: TRect; Const AText: String;
AParamCount: Sw_Integer);
CONSTRUCTOR Load (Var S: TStream);
FUNCTION DataSize: Sw_Word; Virtual;
PROCEDURE GetData (Var Rec); Virtual;
PROCEDURE SetData (Var Rec); Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE GetText (Var S: String); Virtual;
END;
PParamText = ^TParamText;
{---------------------------------------------------------------------------}
{ TLabel OBJECT - LABEL OBJECT }
{---------------------------------------------------------------------------}
TYPE
TLabel = OBJECT (TStaticText)
Light: Boolean;
Link: PView; { Linked view }
CONSTRUCTOR Init (Var Bounds: TRect; CONST AText: String; ALink: PView);
CONSTRUCTOR Load (Var S: TStream);
FUNCTION GetPalette: PPalette; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
END;
PLabel = ^TLabel;
{---------------------------------------------------------------------------}
{ THistoryViewer OBJECT - HISTORY VIEWER OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Active }
{ 2 = Inactive }
{ 3 = Focused }
{ 4 = Selected }
{ 5 = Divider }
TYPE
THistoryViewer = OBJECT (TListViewer)
HistoryId: Word; { History id }
CONSTRUCTOR Init(Var Bounds: TRect; AHScrollBar, AVScrollBar: PScrollBar;
AHistoryId: Word);
FUNCTION HistoryWidth: Sw_Integer;
FUNCTION GetPalette: PPalette; Virtual;
FUNCTION GetText (Item: Sw_Integer; MaxLen: Sw_Integer): String; Virtual;
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
END;
PHistoryViewer = ^THistoryViewer;
{---------------------------------------------------------------------------}
{ THistoryWindow OBJECT - HISTORY WINDOW OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Frame passive }
{ 2 = Frame active }
{ 3 = Frame icon }
{ 4 = ScrollBar page area }
{ 5 = ScrollBar controls }
{ 6 = HistoryViewer normal text }
{ 7 = HistoryViewer selected text }
TYPE
THistoryWindow = OBJECT (TWindow)
Viewer: PListViewer; { List viewer object }
CONSTRUCTOR Init (Var Bounds: TRect; HistoryId: Word);
FUNCTION GetSelection: String; Virtual;
FUNCTION GetPalette: PPalette; Virtual;
PROCEDURE InitViewer (HistoryId: Word); Virtual;
END;
PHistoryWindow = ^THistoryWindow;
{---------------------------------------------------------------------------}
{ THistory OBJECT - HISTORY OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Arrow }
{ 2 = Sides }
TYPE
THistory = OBJECT (TView)
HistoryId: Word;
Link: PInputLine;
CONSTRUCTOR Init (Var Bounds: TRect; ALink: PInputLine; AHistoryId: Word);
CONSTRUCTOR Load (Var S: TStream);
FUNCTION GetPalette: PPalette; Virtual;
FUNCTION InitHistoryWindow (Var Bounds: TRect): PHistoryWindow; Virtual;
PROCEDURE Draw; Virtual;
PROCEDURE RecordHistory (CONST S: String); Virtual;
PROCEDURE Store (Var S: TStream);
PROCEDURE HandleEvent (Var Event: TEvent); Virtual;
END;
PHistory = ^THistory;
{#Z+}
PBrowseInputLine = ^TBrowseInputLine;
TBrowseInputLine = Object(TInputLine)
History: Sw_Word;
constructor Init(var Bounds: TRect; AMaxLen: Sw_Integer; AHistory: Sw_Word);
constructor Load(var S: TStream);
function DataSize: Sw_Word; virtual;
procedure GetData(var Rec); virtual;
procedure SetData(var Rec); virtual;
procedure Store(var S: TStream);
end; { of TBrowseInputLine }
TBrowseInputLineRec = record
Text: string;
History: Sw_Word;
end; { of TBrowseInputLineRec }
{#Z+}
PBrowseButton = ^TBrowseButton;
{#Z-}
TBrowseButton = Object(TButton)
Link: PBrowseInputLine;
constructor Init(var Bounds: TRect; ATitle: TTitleStr; ACommand: Word;
AFlags: Byte; ALink: PBrowseInputLine);
constructor Load(var S: TStream);
procedure Press; virtual;
procedure Store(var S: TStream);
end; { of TBrowseButton }
{#Z+}
PCommandIcon = ^TCommandIcon;
{#Z-}
TCommandIcon = Object(TStaticText)
{ A TCommandIcon sends an evCommand message to its owner with
Event.Command set to #Command# when it is clicked with a mouse. }
constructor Init (var Bounds : TRect; AText : String; ACommand : Word);
{ Creates an instance of a TCommandIcon and sets #Command# to
ACommand. AText is the text which is displayed as the icon. If an
error occurs Init fails. }
procedure HandleEvent (var Event : TEvent); virtual;
{ Captures mouse events within its borders and sends an evCommand to
its owner in response to the mouse event. }
{#X Command }
private
Command : Word;
{ Command is the command sent to the command icon's owner when it is
clicked. }
end; { of TCommandIcon }
{#Z+}
PCommandSItem = ^TCommandSItem;
{#Z-}
TCommandSItem = record
{ A TCommandSItem is the data structure used to initialize command
clusters with #NewCommandSItem# rather than the standarad #NewSItem#.
It is used to associate a command with an individual cluster item. }
{#X TCommandCheckBoxes TCommandRadioButtons }
Value : String;
{ Value is the text displayed for the cluster item. }
{#X Command Next }
Command : Word;
{ Command is the command broadcast when the cluster item is pressed. }
{#X Value Next }
Next : PCommandSItem;
{ Next is a pointer to the next item in the cluster. }
{#X Value Command }
end; { of TCommandSItem }
TCommandArray = array[0..15] of Word;
{ TCommandArray holds a list of commands which are associated with a
cluster. }
{#X TCommandCheckBoxes TCommandRadioButtons }
{#Z+}
PCommandCheckBoxes = ^TCommandCheckBoxes;
{#Z-}
TCommandCheckBoxes = Object(TCheckBoxes)
{ TCommandCheckBoxes function as normal TCheckBoxes, except that when a
cluster item is pressed it broadcasts a command associated with the
cluster item to the cluster's owner.
TCommandCheckBoxes are useful when other parts of a dialog should be
enabled or disabled in response to a check box's status. }
CommandList : TCommandArray;
{ CommandList is the list of commands associated with each check box
item. }
{#X Init Load Store }
constructor Init (var Bounds : TRect; ACommandStrings : PCommandSItem);
{ Init calls the inherited constructor, then sets up the #CommandList#
with the specified commands. If an error occurs Init fails. }
{#X NewCommandSItem }
constructor Load (var S : TStream);
{ Load calls the inherited constructor, then loads the #CommandList#
from the stream S. If an error occurs Load fails. }
{#X Store Init }
procedure Press (Item : Sw_Integer); virtual;
{ Press calls the inherited Press then broadcasts the command
associated with the cluster item that was pressed to the check boxes'
owner. }
{#X CommandList }
procedure Store (var S : TStream); { store should never be virtual;}
{ Store calls the inherited Store method then writes the #CommandList#
to the stream. }
{#X Load }
end; { of TCommandCheckBoxes }
{#Z+}
PCommandRadioButtons = ^TCommandRadioButtons;
{#Z-}
TCommandRadioButtons = Object(TRadioButtons)
{ TCommandRadioButtons function as normal TRadioButtons, except that when
a cluster item is pressed it broadcasts a command associated with the
cluster item to the cluster's owner.
TCommandRadioButtons are useful when other parts of a dialog should be
enabled or disabled in response to a radiobutton's status. }
CommandList : TCommandArray; { commands for each possible value }
{ The list of commands associated with each radio button item. }
{#X Init Load Store }
constructor Init (var Bounds : TRect; ACommandStrings : PCommandSItem);
{ Init calls the inherited constructor and sets up the #CommandList#
with the specified commands. If an error occurs Init disposes of the
command strings then fails. }
{#X NewCommandSItem }
constructor Load (var S : TStream);
{ Load calls the inherited constructor then loads the #CommandList#
from the stream S. If an error occurs Load fails. }
{#X Store }
procedure MovedTo (Item : Sw_Integer); virtual;
{ MovedTo calls the inherited MoveTo, then broadcasts the command of
the newly selected cluster item to the cluster's owner. }
{#X Press CommandList }
procedure Press (Item : Sw_Integer); virtual;
{ Press calls the inherited Press then broadcasts the command
associated with the cluster item that was pressed to the check boxes
owner. }
{#X CommandList MovedTo }
procedure Store (var S : TStream); { store should never be virtual;}
{ Store calls the inherited Store method then writes the #CommandList#
to the stream. }
{#X Load }
end; { of TCommandRadioButtons }
PEditListBox = ^TEditListBox;
TEditListBox = Object(TListBox)
CurrentField : Integer;
constructor Init (Bounds : TRect; ANumCols: Word;
AVScrollBar : PScrollBar);
constructor Load (var S : TStream);
function FieldValidator : PValidator; virtual;
function FieldWidth : Integer; virtual;
procedure GetField (InputLine : PInputLine); virtual;
function GetPalette : PPalette; virtual;
procedure HandleEvent (var Event : TEvent); virtual;
procedure SetField (InputLine : PInputLine); virtual;
function StartColumn : Integer; virtual;
PRIVATE
procedure EditField (var Event : TEvent);
end; { of TEditListBox }
PModalInputLine = ^TModalInputLine;
TModalInputLine = Object(TInputLine)
function Execute : Word; virtual;
procedure HandleEvent (var Event : TEvent); virtual;
procedure SetState (AState : Word; Enable : Boolean); virtual;
private
EndState : Word;
end; { of TModalInputLine }
{---------------------------------------------------------------------------}
{ TDialog OBJECT - DIALOG OBJECT }
{---------------------------------------------------------------------------}
{ Palette layout }
{ 1 = Frame passive }
{ 2 = Frame active }
{ 3 = Frame icon }
{ 4 = ScrollBar page area }
{ 5 = ScrollBar controls }
{ 6 = StaticText }
{ 7 = Label normal }
{ 8 = Label selected }
{ 9 = Label shortcut }
{ 10 = Button normal }
{ 11 = Button default }
{ 12 = Button selected }
{ 13 = Button disabled }
{ 14 = Button shortcut }
{ 15 = Button shadow }
{ 16 = Cluster normal }
{ 17 = Cluster selected }
{ 18 = Cluster shortcut }
{ 19 = InputLine normal text }
{ 20 = InputLine selected text }
{ 21 = InputLine arrows }
{ 22 = History arrow }
{ 23 = History sides }
{ 24 = HistoryWindow scrollbar page area }
{ 25 = HistoryWindow scrollbar controls }
{ 26 = ListViewer normal }
{ 27 = ListViewer focused }
{ 28 = ListViewer selected }
{ 29 = ListViewer divider }
{ 30 = InfoPane }
{ 31 = Cluster disabled }
{ 32 = Reserved }
PDialog = ^TDialog;
TDialog = object(TWindow)
constructor Init(var Bounds: TRect; ATitle: TTitleStr);
constructor Load(var S: TStream);
procedure Cancel (ACommand : Word); virtual;
{ If the dialog is a modal dialog, Cancel calls EndModal(ACommand). If
the dialog is non-modal Cancel calls Close.
Cancel may be overridden to provide special processing prior to
destructing the dialog. }
procedure ChangeTitle (ANewTitle : TTitleStr); virtual;
{ ChangeTitle disposes of the current title, assigns ANewTitle to Title,
then redraws the dialog. }
procedure FreeSubView (ASubView : PView); virtual;
{ FreeSubView deletes and disposes ASubView from the dialog. }
{#X FreeAllSubViews IsSubView }
procedure FreeAllSubViews; virtual;
{ Deletes then disposes all subviews in the dialog. }
{#X FreeSubView IsSubView }
function GetPalette: PPalette; virtual;
procedure HandleEvent(var Event: TEvent); virtual;
function IsSubView (AView : PView) : Boolean; virtual;
{ IsSubView returns True if AView is non-nil and is a subview of the
dialog. }
{#X FreeSubView FreeAllSubViews }
function NewButton (X, Y, W, H : Sw_Integer; ATitle : TTitleStr;
ACommand, AHelpCtx : Word;
AFlags : Byte) : PButton;
{ Creates and inserts into the dialog a new TButton with the
help context AHelpCtx.
A pointer to the new button is returned for checking validity of the
initialization. }
{#X NewInputLine NewLabel }
function NewLabel (X, Y : Sw_Integer; AText : String;
ALink : PView) : PLabel;
{ NewLabel creates and inserts into the dialog a new TLabel and
associates it with ALink. }
{#X NewButton NewInputLine }
function NewInputLine (X, Y, W, AMaxLen : Sw_Integer; AHelpCtx : Word
; AValidator : PValidator) : PInputLine;
{ NewInputLine creates and inserts into the dialog a new TBSDInputLine
with the help context to AHelpCtx and the validator AValidator.
A pointer to the inputline is returned for checking validity of the
initialization. }
{#X NewButton NewLabel }
function Valid(Command: Word): Boolean; virtual;
end;
PListDlg = ^TListDlg;
TListDlg = object(TDialog)
{ TListDlg displays a listbox of items, with optional New, Edit, and
Delete buttons displayed according to the options bit set in the
dialog. Use the ofXXXX flags declared in this unit OR'd with the
standard ofXXXX flags to set the appropriate bits in Options.
If enabled, when the New or Edit buttons are pressed, an evCommand
message is sent to the application with a Command value of NewCommand
or EditCommand, respectively. Using this mechanism in combination with
the declared Init parameters, a standard TListDlg can be used with any
type of list displayable in a TListBox or its descendant. }
NewCommand: Word;
EditCommand: Word;
ListBox: PListBox;
ldOptions: Word;
constructor Init (ATitle: TTitleStr; Items: string; AButtons: Word;
AListBox: PListBox; AEditCommand, ANewCommand: Word);
constructor Load(var S: TStream);
procedure HandleEvent(var Event: TEvent); virtual;
procedure Store(var S: TStream); { store should never be virtual;}
end; { of TListDlg }
{***************************************************************************}
{ INTERFACE ROUTINES }
{***************************************************************************}
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{ ITEM STRING ROUTINES }
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{-NewSItem-----------------------------------------------------------
Allocates memory for a new TSItem record and sets the text field
and chains to the next TSItem. This allows easy construction of
singly-linked lists of strings, to end a chain the next TSItem
should be nil.
28Apr98 LdB
---------------------------------------------------------------------}
FUNCTION NewSItem (Const Str: String; ANext: PSItem): PSItem;
{ NewCommandSItem allocates and returns a pointer to a new #TCommandSItem#
record. The Value and Next fields of the record are set to NewStr(Str)
and ANext, respectively. The NewSItem function and the TSItem record type
allow easy construction of singly-linked lists of command strings. }
function NewCommandSItem (Str : String; ACommand : Word;
ANext : PCommandSItem) : PCommandSItem;
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{ DIALOG OBJECT REGISTRATION PROCEDURE }
{+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++}
{-RegisterDialogs----------------------------------------------------
This registers all the view type objects used in this unit.
30Sep99 LdB
---------------------------------------------------------------------}
PROCEDURE RegisterDialogs;
{***************************************************************************}
{ STREAM REGISTRATION RECORDS }
{***************************************************************************}
{---------------------------------------------------------------------------}
{ TDialog STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RDialog: TStreamRec = (
ObjType: idDialog; { Register id = 10 }
VmtLink: TypeOf(TDialog);
Load: @TDialog.Load; { Object load method }
Store: @TDialog.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TInputLine STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RInputLine: TStreamRec = (
ObjType: idInputLine; { Register id = 11 }
VmtLink: TypeOf(TInputLine);
Load: @TInputLine.Load; { Object load method }
Store: @TInputLine.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TButton STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RButton: TStreamRec = (
ObjType: idButton; { Register id = 12 }
VmtLink: TypeOf(TButton);
Load: @TButton.Load; { Object load method }
Store: @TButton.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TCluster STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RCluster: TStreamRec = (
ObjType: idCluster; { Register id = 13 }
VmtLink: TypeOf(TCluster);
Load: @TCluster.Load; { Object load method }
Store: @TCluster.Store { Objects store method }
);
{---------------------------------------------------------------------------}
{ TRadioButtons STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RRadioButtons: TStreamRec = (
ObjType: idRadioButtons; { Register id = 14 }
VmtLink: TypeOf(TRadioButtons);
Load: @TRadioButtons.Load; { Object load method }
Store: @TRadioButtons.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TCheckBoxes STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RCheckBoxes: TStreamRec = (
ObjType: idCheckBoxes; { Register id = 15 }
VmtLink: TypeOf(TCheckBoxes);
Load: @TCheckBoxes.Load; { Object load method }
Store: @TCheckBoxes.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TMultiCheckBoxes STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RMultiCheckBoxes: TStreamRec = (
ObjType: idMultiCheckBoxes; { Register id = 27 }
VmtLink: TypeOf(TMultiCheckBoxes);
Load: @TMultiCheckBoxes.Load; { Object load method }
Store: @TMultiCheckBoxes.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TListBox STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RListBox: TStreamRec = (
ObjType: idListBox; { Register id = 16 }
VmtLink: TypeOf(TListBox);
Load: @TListBox.Load; { Object load method }
Store: @TListBox.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TStaticText STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RStaticText: TStreamRec = (
ObjType: idStaticText; { Register id = 17 }
VmtLink: TypeOf(TStaticText);
Load: @TStaticText.Load; { Object load method }
Store: @TStaticText.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TLabel STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RLabel: TStreamRec = (
ObjType: idLabel; { Register id = 18 }
VmtLink: TypeOf(TLabel);
Load: @TLabel.Load; { Object load method }
Store: @TLabel.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ THistory STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RHistory: TStreamRec = (
ObjType: idHistory; { Register id = 19 }
VmtLink: TypeOf(THistory);
Load: @THistory.Load; { Object load method }
Store: @THistory.Store { Object store method }
);
{---------------------------------------------------------------------------}
{ TParamText STREAM REGISTRATION }
{---------------------------------------------------------------------------}
CONST
RParamText: TStreamRec = (
ObjType: idParamText; { Register id = 20 }
VmtLink: TypeOf(TParamText);
Load: @TParamText.Load; { Object load method }
Store: @TParamText.Store { Object store method }
);
RCommandCheckBoxes : TStreamRec = (
ObjType : idCommandCheckBoxes;
VmtLink : Ofs(TypeOf(TCommandCheckBoxes)^);
Load : @TCommandCheckBoxes.Load;
Store : @TCommandCheckBoxes.Store);
RCommandRadioButtons : TStreamRec = (
ObjType : idCommandRadioButtons;
VmtLink : Ofs(TypeOf(TCommandRadioButtons)^);
Load : @TCommandRadioButtons.Load;
Store : @TCommandRadioButtons.Store);
RCommandIcon : TStreamRec = (
ObjType : idCommandIcon;
VmtLink : Ofs(Typeof(TCommandIcon)^);
Load : @TCommandIcon.Load;
Store : @TCommandIcon.Store);
RBrowseButton: TStreamRec = (
ObjType : idBrowseButton;
VmtLink : Ofs(TypeOf(TBrowseButton)^);
Load : @TBrowseButton.Load;
Store : @TBrowseButton.Store);
REditListBox : TStreamRec = (