| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176 |
- IMPLEMENTATION MODULE PrtFrame;
- (*
- * REPERTOIRE
- * Release 1.6
- * By Charles Bradford and Cole Brecheen
- * (c) Copyright 1985-1992 PMI
- * Green Bay, Wisconsin
- * All rights reserved
- * (414) 468-6040
- *
- * $Header: D:/logfiles/mods/prtframe.mov 1.5 10 Mar 1991 15:31:40 coleb $
- *
- *)
- IMPORT HandleIO;
- IMPORT GenLists;
- IMPORT ListUtils;
- IMPORT LowLevel;
- IMPORT M2Strings;
- IMPORT Numbers;
- IMPORT ScrnTypes;
- IMPORT ScrnUtl1;
- IMPORT StrEdit;
- IMPORT StringIO;
- IMPORT SYSTEM;
- VAR
- Initialized : BOOLEAN;
- PROCEDURE Init();
- BEGIN
- IF Initialized THEN
- RETURN;
- ELSE
- Initialized := TRUE;
- END;
- HandleIO.Init();
- GenLists.Init();
- ListUtils.Init();
- LowLevel.Init();
- M2Strings.Init();
- Numbers.Init();
- ScrnTypes.Init();
- ScrnUtl1.Init();
- StrEdit.Init();
- StringIO.Init();
- END Init;
- PROCEDURE PrintDisplayFrame(VAR TheFrame: ScrnTypes.DisplayFrame;
- FilHandl, LeftMargin : CARDINAL);
- (* Prints the screen in frecord to the passed file handle *)
- VAR
- BlankStr, TmpStr, String: ARRAY [0..255] OF CHAR;
- ImageCount, leng, cnt, EdWindowWidth, EdWindowHeight,
- TypeCode: CARDINAL;
- TxtList, TmpList : GenLists.GenList;
- ImageRec: ScrnTypes.ImageElement;
- FieldRec: ScrnTypes.InputFieldRecord;
- PROCEDURE PrintAt( col, row: CARDINAL; TheTxt : ARRAY OF CHAR);
- BEGIN
- WHILE GenLists.ListLength( TxtList) < row DO
- (* add new lines needed before this write *)
- GenLists.ListInsert( '', GenLists.StrCode, TxtList, row);
- END;
- GenLists.GetElmt( TxtList, row, TmpStr, TypeCode);
- leng := M2Strings.Length( TmpStr);
- IF col > leng THEN
- (* if adding at end of line *)
- StrEdit.SetLength( BlankStr, col - leng - 1);
- StrEdit.Append( TmpStr, BlankStr);
- StrEdit.Append( TmpStr, TheTxt);
- ELSE
- (* insert into existing line *)
- M2Strings.Delete( TmpStr, col-1, M2Strings.Length( TheTxt));
- M2Strings.Insert( TheTxt, TmpStr, col-1);
- END;
- GenLists.ListReplace( TmpStr, GenLists.StrCode, TxtList, row);
- END PrintAt;
- BEGIN (* PrintDisplayFrame *)
- LowLevel.Fill( SYSTEM.ADR( BlankStr), HIGH(BlankStr) + 1, ' ');
- IF ScrnUtl1.NumberOfImages( TheFrame ) = 0 THEN
- RETURN;
- END;
- GenLists.NewList( TxtList);
- ImageCount := 1;
- REPEAT
- ScrnUtl1.GetImageRec( TheFrame, ImageCount, ImageRec );
- IF (ImageRec.field = 0) THEN
- PrintAt( ImageRec.col, ImageRec.row, ImageRec.text );
- ELSIF ScrnUtl1.ListFromEdField(TheFrame, ImageRec.field, TmpList) THEN
- EdWindowWidth := ScrnUtl1.FieldWidth( TheFrame, ImageRec.field );
- EdWindowHeight := GenLists.ListLength( TmpList );
- FOR cnt := 1 TO EdWindowHeight DO
- GenLists.GetElmt( TmpList, cnt, TmpStr, TypeCode );
- IF M2Strings.Length( TmpStr ) > EdWindowWidth THEN
- StrEdit.SetLength( TmpStr, EdWindowWidth );
- END;
- PrintAt( ImageRec.col, ImageRec.row + (cnt - 1), TmpStr );
- END;
- ELSE
- ScrnUtl1.GetFieldRec( TheFrame, ImageRec.field, FieldRec );
- (* Print choice name in all caps if it is selected;
- added 12 Oct 88, courtesy of Ulrik Schmidt. *)
- IF (FieldRec.typ = ScrnTypes.GroupMember) AND FieldRec.selected THEN
- StrEdit.AssignStr( ImageRec.text, String );
- StrEdit.CAPstr( String );
- PrintAt( ImageRec.col, ImageRec.row, String );
- ELSE
- PrintAt( ImageRec.col, ImageRec.row, ImageRec.text );
- END;
- END;
- INC( ImageCount );
- UNTIL (ImageCount > ScrnUtl1.NumberOfImages( TheFrame ) );
- leng := GenLists.ListLength( TxtList);
- FOR cnt := 1 TO leng DO
- (* write the text to the file *)
- GenLists.GetElmt( TxtList, cnt, TmpStr, TypeCode);
- StringIO.PrintMessage( HandleIO.FillFile( FilHandl,
- LeftMargin, ' ' ) );
- StringIO.WriteEol( FilHandl, TmpStr);
- END;
- GenLists.DisposeList( TxtList);
- END PrintDisplayFrame;
- PROCEDURE PrintFrameData( VAR TheFrame: ScrnTypes.DisplayFrame;
- FileHandle, LeftMargin : CARDINAL );
- VAR
- FieldRec: ScrnTypes.InputFieldRecord;
- ImageRec: ScrnTypes.ImageElement;
- LastField, cnt : CARDINAL;
- TmpList: GenLists.GenList;
- duml: LONGINT;
- BEGIN
- LastField := ScrnUtl1.FieldListTotal( TheFrame );
- FOR cnt := 1 TO LastField DO
- ScrnUtl1.GetFieldRec( TheFrame, cnt, FieldRec );
- IF FieldRec.fnam[0] # 0C THEN
- StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
- LeftMargin, ' ' ) );
- StringIO.WriteStr( FileHandle, FieldRec.fnam );
- StringIO.WriteEol( FileHandle, ':' );
- CASE FieldRec.typ OF
- ScrnTypes.DispCode, ScrnTypes.StringCode,
- ScrnTypes.IntCode, ScrnTypes.RealCode:
- ScrnUtl1.GetFieldImageRec( TheFrame, cnt, ImageRec );
- StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
- LeftMargin + 2, ' ' ) );
- StringIO.WriteEol( FileHandle, ImageRec.text );
- | ScrnTypes.GotoCode: (* do nothing *)
- | ScrnTypes.GroupMember:
- ScrnUtl1.GetFieldImageRec( TheFrame, cnt +
- (ScrnUtl1.WhichChoiceNum( TheFrame, cnt ) -
- 1), ImageRec );
- StringIO.PrintMessage( HandleIO.FillFile( FileHandle,
- LeftMargin + 2, ' ' ) );
- StringIO.WriteEol( FileHandle, ImageRec.text );
- | ScrnTypes.EditorCode:
- IF ScrnUtl1.ListFromEdField(TheFrame, cnt, TmpList) THEN
- ListUtils.PrintList( FileHandle, TmpList, LeftMargin + 2,
- StringIO.CrLf );
- END;
- END;
- END;
- END;
- END PrintFrameData;
- BEGIN
- Initialized := FALSE;
- Init();
- END PrtFrame.
|