PRTFRAME.MOD 6.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176
  1. IMPLEMENTATION MODULE PrtFrame;
  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/prtframe.mov 1.5 10 Mar 1991 15:31:40 coleb $
  12. *
  13. *)
  14. IMPORT HandleIO;
  15. IMPORT GenLists;
  16. IMPORT ListUtils;
  17. IMPORT LowLevel;
  18. IMPORT M2Strings;
  19. IMPORT Numbers;
  20. IMPORT ScrnTypes;
  21. IMPORT ScrnUtl1;
  22. IMPORT StrEdit;
  23. IMPORT StringIO;
  24. IMPORT SYSTEM;
  25. VAR
  26. Initialized : BOOLEAN;
  27. PROCEDURE Init();
  28. BEGIN
  29. IF Initialized THEN
  30. RETURN;
  31. ELSE
  32. Initialized := TRUE;
  33. END;
  34. HandleIO.Init();
  35. GenLists.Init();
  36. ListUtils.Init();
  37. LowLevel.Init();
  38. M2Strings.Init();
  39. Numbers.Init();
  40. ScrnTypes.Init();
  41. ScrnUtl1.Init();
  42. StrEdit.Init();
  43. StringIO.Init();
  44. END Init;
  45. PROCEDURE PrintDisplayFrame(VAR TheFrame: ScrnTypes.DisplayFrame;
  46. FilHandl, LeftMargin : CARDINAL);
  47. (* Prints the screen in frecord to the passed file handle *)
  48. VAR
  49. BlankStr, TmpStr, String: ARRAY [0..255] OF CHAR;
  50. ImageCount, leng, cnt, EdWindowWidth, EdWindowHeight,
  51. TypeCode: CARDINAL;
  52. TxtList, TmpList : GenLists.GenList;
  53. ImageRec: ScrnTypes.ImageElement;
  54. FieldRec: ScrnTypes.InputFieldRecord;
  55. PROCEDURE PrintAt( col, row: CARDINAL; TheTxt : ARRAY OF CHAR);
  56. BEGIN
  57. WHILE GenLists.ListLength( TxtList) < row DO
  58. (* add new lines needed before this write *)
  59. GenLists.ListInsert( '', GenLists.StrCode, TxtList, row);
  60. END;
  61. GenLists.GetElmt( TxtList, row, TmpStr, TypeCode);
  62. leng := M2Strings.Length( TmpStr);
  63. IF col > leng THEN
  64. (* if adding at end of line *)
  65. StrEdit.SetLength( BlankStr, col - leng - 1);
  66. StrEdit.Append( TmpStr, BlankStr);
  67. StrEdit.Append( TmpStr, TheTxt);
  68. ELSE
  69. (* insert into existing line *)
  70. M2Strings.Delete( TmpStr, col-1, M2Strings.Length( TheTxt));
  71. M2Strings.Insert( TheTxt, TmpStr, col-1);
  72. END;
  73. GenLists.ListReplace( TmpStr, GenLists.StrCode, TxtList, row);
  74. END PrintAt;
  75. BEGIN (* PrintDisplayFrame *)
  76. LowLevel.Fill( SYSTEM.ADR( BlankStr), HIGH(BlankStr) + 1, ' ');
  77. IF ScrnUtl1.NumberOfImages( TheFrame ) = 0 THEN
  78. RETURN;
  79. END;
  80. GenLists.NewList( TxtList);
  81. ImageCount := 1;
  82. REPEAT
  83. ScrnUtl1.GetImageRec( TheFrame, ImageCount, ImageRec );
  84. IF (ImageRec.field = 0) THEN
  85. PrintAt( ImageRec.col, ImageRec.row, ImageRec.text );
  86. ELSIF ScrnUtl1.ListFromEdField(TheFrame, ImageRec.field, TmpList) THEN
  87. EdWindowWidth := ScrnUtl1.FieldWidth( TheFrame, ImageRec.field );
  88. EdWindowHeight := GenLists.ListLength( TmpList );
  89. FOR cnt := 1 TO EdWindowHeight DO
  90. GenLists.GetElmt( TmpList, cnt, TmpStr, TypeCode );
  91. IF M2Strings.Length( TmpStr ) > EdWindowWidth THEN
  92. StrEdit.SetLength( TmpStr, EdWindowWidth );
  93. END;
  94. PrintAt( ImageRec.col, ImageRec.row + (cnt - 1), TmpStr );
  95. END;
  96. ELSE
  97. ScrnUtl1.GetFieldRec( TheFrame, ImageRec.field, FieldRec );
  98. (* Print choice name in all caps if it is selected;
  99. added 12 Oct 88, courtesy of Ulrik Schmidt. *)
  100. IF (FieldRec.typ = ScrnTypes.GroupMember) AND FieldRec.selected THEN
  101. StrEdit.AssignStr( ImageRec.text, String );
  102. StrEdit.CAPstr( String );
  103. PrintAt( ImageRec.col, ImageRec.row, String );
  104. ELSE
  105. PrintAt( ImageRec.col, ImageRec.row, ImageRec.text );
  106. END;
  107. END;
  108. INC( ImageCount );
  109. UNTIL (ImageCount > ScrnUtl1.NumberOfImages( TheFrame ) );
  110. leng := GenLists.ListLength( TxtList);
  111. FOR cnt := 1 TO leng DO
  112. (* write the text to the file *)
  113. GenLists.GetElmt( TxtList, cnt, TmpStr, TypeCode);
  114. StringIO.PrintMessage( HandleIO.FillFile( FilHandl,
  115. LeftMargin, ' ' ) );
  116. StringIO.WriteEol( FilHandl, TmpStr);
  117. END;
  118. GenLists.DisposeList( TxtList);
  119. END PrintDisplayFrame;
  120. PROCEDURE PrintFrameData( VAR TheFrame: ScrnTypes.DisplayFrame;
  121. FileHandle, LeftMargin : CARDINAL );
  122. VAR
  123. FieldRec: ScrnTypes.InputFieldRecord;
  124. ImageRec: ScrnTypes.ImageElement;
  125. LastField, cnt : CARDINAL;
  126. TmpList: GenLists.GenList;
  127. duml: LONGINT;
  128. BEGIN
  129. LastField := ScrnUtl1.FieldListTotal( TheFrame );
  130. FOR cnt := 1 TO LastField DO
  131. ScrnUtl1.GetFieldRec( TheFrame, cnt, FieldRec );
  132. IF FieldRec.fnam[0] # 0C THEN
  133. StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
  134. LeftMargin, ' ' ) );
  135. StringIO.WriteStr( FileHandle, FieldRec.fnam );
  136. StringIO.WriteEol( FileHandle, ':' );
  137. CASE FieldRec.typ OF
  138. ScrnTypes.DispCode, ScrnTypes.StringCode,
  139. ScrnTypes.IntCode, ScrnTypes.RealCode:
  140. ScrnUtl1.GetFieldImageRec( TheFrame, cnt, ImageRec );
  141. StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
  142. LeftMargin + 2, ' ' ) );
  143. StringIO.WriteEol( FileHandle, ImageRec.text );
  144. | ScrnTypes.GotoCode: (* do nothing *)
  145. | ScrnTypes.GroupMember:
  146. ScrnUtl1.GetFieldImageRec( TheFrame, cnt +
  147. (ScrnUtl1.WhichChoiceNum( TheFrame, cnt ) -
  148. 1), ImageRec );
  149. StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
  150. LeftMargin + 2, ' ' ) );
  151. StringIO.WriteEol( FileHandle, ImageRec.text );
  152. | ScrnTypes.EditorCode:
  153. IF ScrnUtl1.ListFromEdField(TheFrame, cnt, TmpList) THEN
  154. ListUtils.PrintList( FileHandle, TmpList, LeftMargin + 2,
  155. StringIO.CrLf );
  156. END;
  157. END;
  158. END;
  159. END;
  160. END PrintFrameData;
  161. BEGIN
  162. Initialized := FALSE;
  163. Init();
  164. END PrtFrame.