SCRNTYPE.MOD 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166
  1. IMPLEMENTATION MODULE ScrnTypes;
  2. (*
  3. * REPERTOIRE
  4. * Release 1.6
  5. * By Charles Bradford and Cole Brecheen
  6. * (c) Copyright 1985-1992 PMI
  7. * Green Bay, Wisconsin
  8. * All rights reserved
  9. * (414) 468-6040
  10. *
  11. * $Header: D:/logfiles/mods/scrntype.mov 1.5 10 Mar 1991 15:32:10 coleb $
  12. *
  13. *)
  14. IMPORT ErrorNames;
  15. IMPORT FrameManager;
  16. IMPORT GenLists;
  17. IMPORT LowLevel;
  18. IMPORT MsColors;
  19. IMPORT NdxTypes;
  20. IMPORT SYSTEM;
  21. IMPORT VStorage;
  22. IMPORT VWindows;
  23. VAR
  24. Initialized : BOOLEAN;
  25. PROCEDURE Init();
  26. BEGIN
  27. IF Initialized THEN
  28. RETURN;
  29. ELSE
  30. Initialized := TRUE;
  31. END;
  32. ErrorNames.Init();
  33. FrameManager.Init();
  34. GenLists.Init();
  35. LowLevel.Init();
  36. MsColors.Init();
  37. NdxTypes.Init();
  38. VStorage.Init();
  39. VWindows.Init();
  40. END Init;
  41. (* The purpose of ScrnTypes is to allow other parts of
  42. Repertoire to refer to data types in the screen system
  43. without importing all screen system's code where it isn't
  44. necessary. We do include initialization procedures here,
  45. however, to prevent programs that do not use the screen
  46. system from doing dangerous things with improperly
  47. initialized or uninitialized data types.*)
  48. PROCEDURE InitDisplayFrame( VAR FrameRec : DisplayFrame;
  49. AssociatedWindow: VWindows.AWindowHandle );
  50. (* Initializes a DisplayFrame before first use. *)
  51. VAR
  52. FrameSize: CARDINAL;
  53. BEGIN (* procedure InitDisplayFrame *)
  54. FrameSize := SYSTEM.TSIZE( DisplayFrameRec );
  55. VStorage.DosAlloc( FrameRec, FrameSize );
  56. FrameManager.AddWindow( AssociatedWindow );
  57. (*Note that we don't call FrameActivated here because
  58. FrameManager only begins to care about a frame once
  59. part of it becomes visible.*)
  60. WITH FrameRec^ DO
  61. ThisFrame[0] := 0C;
  62. WindowHandle := AssociatedWindow;
  63. PushedFrame := NIL;
  64. (*initialize the frame stack to empty*)
  65. ClearFirst := TRUE;
  66. ClearAfter := FALSE;
  67. FrameChanged := FALSE;
  68. EntryBox := VWindows.DoubleBox;
  69. ExitBox := VWindows.SingleBox;
  70. Caption[0] := 0C;
  71. (*changed in 1.5a*)
  72. SelfSharedWithFile := FALSE;
  73. (*changed in 1.5b*)
  74. GenLists.NewList( self );
  75. GenLists.NilList( DataList );
  76. GenLists.NilList( PromptList );
  77. GenLists.NilList( HelpList );
  78. GenLists.NilList( EdFieldList );
  79. GenLists.NilList( FieldList );
  80. GenLists.NilList( ImageList );
  81. GenLists.NilList( LinkedFrames );
  82. (*Now we set up the odd structure of the self; see
  83. the manual for explanation.*)
  84. GenLists.ListInsert( '', GenLists.StrCode, self, 1 );
  85. (*Insert null at position of the HelpFrame.*)
  86. GenLists.ListInsert( '', GenLists.StrCode, self, 2 );
  87. (*Insert null at position of the ParentFrame.*)
  88. GenLists.ListInsert( '', GenLists.StrCode, self, 3 );
  89. (*Insert null at position of the NormalNextFrame.*)
  90. GenLists.ListInsert( '', GenLists.StrCode, self, 4 );
  91. (*Insert null at position of the DisplayFrameRec.*)
  92. GenLists.ListInsert( DataList, GenLists.ListCode, self, 5 );
  93. GenLists.ListInsert( PromptList, GenLists.ListCode, self, 6 );
  94. GenLists.ListInsert( HelpList, GenLists.ListCode, self, 7 );
  95. GenLists.ListInsert( EdFieldList, GenLists.ListCode, self, 8 );
  96. GenLists.ListInsert( FieldList, GenLists.ListCode, self, 9 );
  97. GenLists.ListInsert( ImageList, GenLists.ListCode, self, 10 );
  98. GenLists.ListInsert( LinkedFrames, GenLists.ListCode, self, 11 );
  99. HelpFrame[0] := 0C;
  100. (* initialize the screen fields area to empty *)
  101. startcol := 0;
  102. startrow := 0;
  103. endcol := VWindows.EndCol(AssociatedWindow) - 1;
  104. endrow := VWindows.EndRow(AssociatedWindow) - 1;
  105. RowsScrolled := 0;
  106. ColsScrolled := 0;
  107. CurrentField := 0;
  108. VirtualWidth := 0;
  109. VirtualHeight := 0;
  110. headline := 0;
  111. action := 'W';
  112. (*Wait for any key.*)
  113. parent[0] := 0C;
  114. normlnext[0] := 0C;
  115. (* Now, initialize defaults for colors & mono attributes: *)
  116. normatrb := MsColors.plain;
  117. normfor := MsColors.lightgrey;
  118. normbak := MsColors.blue;
  119. (* Normal text *)
  120. bordatrb := MsColors.plain;
  121. bordfor := MsColors.lightcyan;
  122. bordbak := MsColors.blue;
  123. (* Border colors *)
  124. selatrb := MsColors.bold;
  125. selfor := MsColors.lightmagenta;
  126. selbak := MsColors.blue;
  127. (* Selected text *)
  128. pbatrb := MsColors.ReverseVideo;
  129. pbfor := MsColors.black;
  130. pbbak := MsColors.red;
  131. (* Pointer Bar Colors *)
  132. msgatrb := MsColors.plain;
  133. msgfor := MsColors.black;
  134. msgbak := MsColors.lightgrey;
  135. (* Message Box Colors *)
  136. promatrb := MsColors.ReverseVideo;
  137. promfor := MsColors.black;
  138. prombak := MsColors.cyan;
  139. (* Prompt Line Colors *)
  140. FromFile := NIL;
  141. END;
  142. END InitDisplayFrame;
  143. PROCEDURE InitField( VAR TheField: InputFieldRecord );
  144. BEGIN
  145. LowLevel.Fill( SYSTEM.ADR(TheField),
  146. SYSTEM.TSIZE(InputFieldRecord), 0C );
  147. TheField.typ := DispCode;
  148. END InitField;
  149. BEGIN
  150. Initialized := FALSE;
  151. Init();
  152. END ScrnTypes.