home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Hall of Fame
/
HallofFameCDROM.cdr
/
prpascal
/
pibmenu.lzh
/
PIBMENUS.FIX
< prev
next >
Wrap
Text File
|
1986-01-16
|
12KB
|
268 lines
Date: April 1, 1985
From: Philip R. Burns
To: PIBMENUS users
This file contains fixes to the PIBMENUS routines so that they
will work correctly with version 3.0 of Turbo Pascal.
First, add the following global variable declaration to the others
in PIBMENUS:
Menu_Turbo_Version : Integer (* Version of Turbo Pascal *);
This variable will take on values of 2 or 3, depending upon the
version of Turbo Pascal. You may set this variable (to 2 or 3)
in the initialization code of your program, or you may call the
following procedure, which will also set the variable:
----------------------------------------------------------------------------
(*----------------------------------------------------------------------*)
(* Set_Turbo_Version --- Set version of Turbo Pascal *)
(*----------------------------------------------------------------------*)
Procedure Set_Turbo_Version;
(*----------------------------------------------------------------------*)
(* *)
(* Procedure: Set_Turbo_Version *)
(* *)
(* Purpose: Set version of Turbo Pascal *)
(* *)
(* Calling Sequence: *)
(* *)
(* Set_Turbo_Version; *)
(* *)
(* Calls: Window *)
(* *)
(* Remarks: *)
(* *)
(* This routine heuristically determines which version (2 or 3) *)
(* of Turbo Pascal it has been compiled with. This information *)
(* is needed to save the coordinates of the current window when *)
(* performing a screen save. *)
(* *)
(*----------------------------------------------------------------------*)
BEGIN (* Set_Turbo_Version *)
(* Set an unusual window *)
Window( 53, 23, 78, 25 );
IF ( MEM[ Dseg : 4 ] = 52 ) AND
( MEM[ Dseg : 5 ] = 22 ) THEN
Menu_Turbo_Version := 3
ELSE
Menu_Turbo_Version := 2;
Window( 1, 1, 80, 25 );
END (* Set_Turbo_Version *);
----------------------------------------------------------------------------
It is VITAL to provide the correct version number of the compiler
you are using, else PIBMENUS will take off for hyperspace and very
likely take your machine with it, requiring a re-boot.
You must also replace the following routines with the revised
versions of those routines provided here:
-- Upper_Left_Column
-- Upper_Left_Row
-- Draw_Menu_Frame
The revised versions follow. These routines will work correctly
with either version 2 or version 3, as long as the variable
'Menu_Turbo_Version' has been set correctly as described above.
Also see the final comment after the following code.
----------------------------------------------------------------------------
(*----------------------------------------------------------------------*)
(* TURBO Pascal Window Location Routines *)
(*----------------------------------------------------------------------*)
(* *)
(* These routines and constants give the four corners of the current *)
(* Turbo window: *)
(* *)
(* Lower right-hand corner: (Lower_Right_Column, Lower_Right_Row) *)
(* Upper left_hand corner: (Upper_Left_Column, Upper_Right_Column) *)
(* *)
(*----------------------------------------------------------------------*)
(* Lower right corner of *)
(* current TURBO window *)
Var
Lower_Right_Column : Byte ABSOLUTE Cseg:$016A;
Lower_Right_Row : Byte ABSOLUTE Cseg:$016B;
(*----------------------------------------------------------------------*)
(* Upper_Left_Column --- Upper Left Col. Position of current window *)
(*----------------------------------------------------------------------*)
Function Upper_Left_Column : Integer;
(* *)
(* Function: Upper_Left_Column *)
(* *)
(* Purpose: Returns upper left col. pos. of current TURBO window *)
(* *)
(* Calling Sequence: *)
(* *)
(* Pos := Upper_Left_Column : Integer; *)
(* *)
(* Calls: Mem *)
(* *)
Begin (* Upper_Left_Column *)
IF Menu_Turbo_Version = 2 THEN
Upper_Left_Column := MEM[ Dseg:$0156 ] + 1
ELSE
Upper_Left_Column := MEM[ Dseg:$0004 ] + 1;
End (* Upper_Left_Column *);
(*----------------------------------------------------------------------*)
(* Upper_Left_Row --- Upper Left Row Position of current window *)
(*----------------------------------------------------------------------*)
Function Upper_Left_Row : Integer;
(* *)
(* Function: Upper_Left_Row *)
(* *)
(* Purpose: Returns upper left row pos. of current TURBO window *)
(* *)
(* Calling Sequence: *)
(* *)
(* Pos := Upper_Left_Row : Integer; *)
(* *)
(* Calls: Mem *)
(* *)
Begin (* Upper_Left_Row *)
IF Menu_Turbo_Version = 2 THEN
Upper_Left_Row := Mem[ Dseg:$0157 ] + 1
ELSE
Upper_Left_Row := Mem[ Dseg:$0005 ] + 1;
End (* Upper_Left_Row *);
(*----------------------------------------------------------------------*)
(* Draw_Menu_Frame --- Draw a Frame *)
(*----------------------------------------------------------------------*)
Procedure Draw_Menu_Frame( UpperLeftX, UpperLeftY,
LowerRightX, LowerRightY : Integer;
Frame_Color, Title_Color : Integer;
Menu_Title: AnyStr );
(* *)
(* Procedure: Draw_Menu_Frame *)
(* *)
(* Purpose: Draws a titled frame using PC graphics characters *)
(* *)
(* Calling Sequence: *)
(* *)
(* Draw_Menu_Frame( UpperLeftX, UpperLeftY, *)
(* LowerRightX, LowerRightY, *)
(* Frame_Color, Title_Color : Integer; *)
(* Menu_Title: AnyStr ); *)
(* *)
(* UpperLeftX, UpperLeftY --- Upper left coordinates *)
(* LowerRightX, LowerRightY --- Lower right coordinates *)
(* Frame_Color --- Color for frame *)
(* Title_Color --- Color for title text *)
(* Menu_Title --- Menu Title *)
(* *)
(* Calls: GoToXY *)
(* Window *)
(* ClrScr *)
(* *)
(* Remarks: *)
(* *)
(* The area inside the frame is cleared after the frame is *)
(* drawn. If a box without a title is desired, enter a null *)
(* string for a title. *)
Var
I : Integer;
L : Integer;
LT : Integer;
Begin (* Draw_Menu_Frame *)
(* Move to top left-hand corner of menu *)
GoToXY( UpperLeftX, UpperLeftY );
L := LowerRightX - UpperLeftX;
LT := LENGTH( Menu_Title );
(* Adjust title length if necessary *)
If LT > ( L - 5 ) Then Menu_Title[0] := CHR( L - 5 );
(* Color for frame *)
TextColor( Frame_Color );
(* Write upper left hand corner and title *)
If LT > 0 Then
Begin
Write('╒[ ');
TextColor( Title_Color );
Write( Menu_Title );
TextColor( Frame_Color );
Write(' ]');
End
Else
Write('╒════');
(* Draw remainder of top of frame *)
For I := ( UpperLeftX + LT + 5 ) To ( LowerRightX - 1 ) Do Write('═');
Write('╕');
(* Draw sides of frame *)
For I := UpperLeftY+1 To LowerRightY-1 Do
Begin
GoToXY( UpperLeftX , I ); Write( '│' );
GoToXY( LowerRightX , I ); Write( '│' );
End;
(* Draw bottom of frame *)
GoToXY( UpperLeftX, LowerRightY );
Write( '╘' );
For I := UpperLeftX+1 To LowerRightX-1 Do Write( '═' );
Write( '╛' );
(* Establish scrolling window area *)
Window( UpperLeftX+1, UpperLeftY+1, LowerRightX-2, LowerRightY-1 );
(* Clear out the window area *)
ClrScr;
(* Ensure proper color for text *)
TextColor( Title_Color );
End (* Draw_Menu_Frame *);
----------------------------------------------------------------------------
Please advise me of any other problems you encounter with PIBMENUS.
And, if you make any improvements, please leave me a note as well,
so that I can incorporate them in future versions of PIBMENUS.
You can reach me on either of the following two Chicago BBSs:
Gene Plantz's BBS (312) 882 4227
Ron Fox's BBS (312) 940 6496
Thanks,
Phil Burnswing two Chicago BBSs:
Gene Plantz's BBS (31