| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170 |
- IMPLEMENTATION MODULE MsgBox1;
- (*
- * 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/msgbox1.mov 1.5 10 Mar 1991 15:29:44 coleb $
- *
- *)
- IMPORT GenLists;
- IMPORT KbdInput;
- IMPORT ListUtils;
- IMPORT LowLevel;
- IMPORT Numbers;
- IMPORT NumTypes;
- IMPORT SmartScreen;
- IMPORT SYSTEM;
- IMPORT VWindows;
- IMPORT WindowPrims;
- VAR
- Initialized : BOOLEAN;
- PROCEDURE Init();
- BEGIN
- IF Initialized THEN
- RETURN;
- ELSE
- Initialized := TRUE;
- END;
- GenLists.Init();
- KbdInput.Init();
- ListUtils.Init();
- LowLevel.Init();
- Numbers.Init();
- NumTypes.Init();
- SmartScreen.Init();
- VWindows.Init();
- WindowPrims.Init();
- END Init;
- CONST
- lftcol = 4;
- toprow = 3;
- rtcol = 44;
- btmrow = 14;
- midcol = 24;
- midrow = 9;
- (* These define the starting points for the 4 msg box areas *)
- PROCEDURE FindCoords( locatn: VWindows.Compass; MaxWidth,
- MaxHeight: CARDINAL; VAR col1, row1, col2, row2: CARDINAL );
- BEGIN
- CASE locatn OF
- VWindows.West, VWindows.NW, VWindows.SW :
- col1 := lftcol;
- | VWindows.North, VWindows.South :
- col1 := midcol;
- | VWindows.East, VWindows.NE, VWindows.SE :
- col1 := rtcol;
- END;
- CASE locatn OF
- VWindows.North, VWindows.NW, VWindows.NE :
- row1 := toprow;
- | VWindows.East, VWindows.West :
- row1 := midrow;
- | VWindows.South, VWindows.SE, VWindows.SW :
- row1 := btmrow;
- END;
- col2 := col1 + MaxWidth + 3;
- row2 := row1 + MaxHeight + 3;
- END FindCoords;
- PROCEDURE NullScan( StrAddr: SYSTEM.ADDRESS ): CARDINAL;
- BEGIN
- RETURN LowLevel.ScanEQ( 32767, 0C, StrAddr );
- END NullScan;
- PROCEDURE WinMsgBox( TheWindow: VWindows.AWindowHandle;
- TextPtr: SYSTEM.ADDRESS; CaptionPtr: SYSTEM.ADDRESS;
- WinType: CARDINAL ): CARDINAL;
- VAR
- TxtLngth, CaptionLngth: CARDINAL;
- TmpList: GenLists.GenList;
- KeyPressed: CARDINAL;
- BEGIN
- TxtLngth := NullScan( TextPtr );
- CaptionLngth := NullScan( CaptionPtr );
- GenLists.NewList( TmpList );
- GenLists.ListInsertAdr( TextPtr, TxtLngth,
- GenLists.StrCode, TmpList, 1 );
- ListMsgBox( VWindows.NE, TmpList, KbdInput.AnyKeyNum,
- KeyPressed );
- GenLists.DisposeList( TmpList );
- RETURN KeyPressed;
- END WinMsgBox;
- PROCEDURE ListMsgBox(locatn : VWindows.Compass; TheList :
- GenLists.GenList; LegalKeys: KbdInput.KeyNumSet; VAR KeyPressed :
- CARDINAL);
- VAR
- leng, breakspot, lastbreak, LinesAdded, BytesAdded : INTEGER;
- StartLine, CursorLine, CursorCol, LstLngth, maxleng, newleng, i,
- col1, row1, col2, row2, rowspot, colspot: CARDINAL;
- BytePos : LONGINT;
- screen : WindowPrims.ScreenType;
- TmpAdr: SYSTEM.ADDRESS;
- TypeCode, TmpSize: CARDINAL;
- BEGIN
- WindowPrims.PushColors();
- WindowPrims.PushCursorCoords();
- WindowPrims.PushCursorHeight();
- SmartScreen.SetCursorHeight(0);
- SmartScreen.SetAttribOrColor( WindowPrims.MsgForeColor,
- WindowPrims.MsgBackColor, WindowPrims.MsgMonoAtrib );
- maxleng := Numbers.Min( ListUtils.LongestLine(
- TheList ), SmartScreen.MaxCol - rtcol - 3 );
- StartLine := 1;
- CursorLine := 1;
- CursorCol := 1;
- BytePos := NumTypes.L0;
- ListUtils.ReformPara( TheList, 0, maxleng - 2, StartLine,
- CursorLine, CursorCol, LinesAdded, BytesAdded, BytePos );
- LstLngth := Numbers.Min( GenLists.ListLength(
- TheList ), SmartScreen.MaxRow - btmrow - 3 );
- FindCoords( locatn, maxleng, LstLngth, col1, row1, col2, row2 );
- WindowPrims.ScreenSave(screen, col1, row1, col2, row2 );
- SmartScreen.ClearPart(col1, row1, col2, row2);
- (* save & clear an area of the required size *)
- WindowPrims.DrawThisBox( WindowPrims.SingleBox, col1, row1,
- col2, row2 );
- (* draw a box of the required size *)
- colspot := col1+2;
- rowspot := row1+1;
- FOR i := 1 TO LstLngth DO
- (* write text in window *)
- GenLists.GetElmtAdr( TheList, i, TmpAdr, TmpSize, TypeCode );
- TmpSize := ListUtils.ElmtSize( TheList, i );
- IF TypeCode = GenLists.StrCode THEN
- SmartScreen.AdrWriteAt( colspot, rowspot+i, TmpAdr, TmpSize );
- END;
- END;
- KeyPressed := KbdInput.KeyHit( LegalKeys );
- WindowPrims.ScreenRestore(screen, col1, row1);
- WindowPrims.PopCursorCoords();
- WindowPrims.PopCursorHeight();
- WindowPrims.PopColors();
- (* restore screen, cursor, and mode *)
- END ListMsgBox;
- BEGIN
- Initialized := FALSE;
- Init();
- END MsgBox1.
|