home *** CD-ROM | disk | FTP | other *** search
/ Power Programming / powerprogramming1994.iso / progtool / pibterm / pibt41s4.arc / RESGENRT.MOD < prev    next >
Text File  |  1988-01-25  |  4KB  |  99 lines

  1. (*----------------------------------------------------------------------*)
  2. (*    Reset_General_Terminal --- Reset terminal to initial defaults     *)
  3. (*----------------------------------------------------------------------*)
  4.  
  5. PROCEDURE Reset_General_Terminal( ClearScreen : BOOLEAN );
  6.  
  7. (*----------------------------------------------------------------------*)
  8. (*                                                                      *)
  9. (*     Routine:  Reset_General_Terminal                                 *)
  10. (*                                                                      *)
  11. (*     Purpose:  Resets general emulation                               *)
  12. (*                                                                      *)
  13. (*     Calling Sequence:                                                *)
  14. (*                                                                      *)
  15. (*        Reset_General_Terminal( ClearScreen : BOOLEAN );              *)
  16. (*                                                                      *)
  17. (*           ClearScreen --- TRUE to clear screen                       *)
  18. (*                                                                      *)
  19. (*     Called by:  Emulate_General                                      *)
  20. (*                                                                      *)
  21. (*----------------------------------------------------------------------*)
  22.  
  23. BEGIN (* Reset_General_Terminal *)
  24.                                    (* Turn on the cursor            *)
  25.    CursorOn;
  26.                                    (* Initialize terminal state     *)
  27.    Do_Status_Time      := OFF;
  28.    Alt_Keypad_Mode     := OFF;
  29.    Graphics_Mode       := OFF;
  30.    Auto_Print_Mode     := OFF;
  31.    Printer_Ctrl_Mode   := OFF;
  32.    Auto_Wrap_Mode      := ON;
  33.    Hold_Screen_Mode    := OFF;
  34.    New_Line            := New_Line_Param;
  35.    Insertion_Mode      := OFF;
  36.    Double_Width_Mode   := OFF;
  37.    Do_Script_Tests     := Waitstring_Mode OR When_Mode OR
  38.                           WaitCount_Mode  OR WaitQuiet_Mode OR
  39.                           Script_Learn_Mode;
  40.  
  41.                                    (* Set display actions *)
  42.    Set_Display_Actions;
  43.                                    (* Get terminal name *)
  44.  
  45.    Short_Terminal_Name := Terminal_Name_List[ ORD( Terminal_To_Emulate ) ];
  46.  
  47.                                    (* Set up status line *)
  48.  
  49.    IF Reverse_Status_Colors THEN
  50.       Status_Line_Attr    := 16 * ( ForeGround_Color AND 7 ) + BackGround_Color
  51.    ELSE
  52.       Status_Line_Attr    := 16 * ( Status_BackGround_Color AND 7 ) + Status_ForeGround_Color;
  53.  
  54.    Do_Status_Line      := Show_Status_Line AND ( NOT Use_Dos_Con_Output );
  55.    Do_Status_Time      := Do_Status_Line AND Show_Status_Time;
  56.    Current_Status_Time := -1;
  57.  
  58.    IF Do_Status_Line THEN
  59.       BEGIN
  60.          Set_Status_Line_Name(Short_Terminal_Name);
  61.          Write_To_Status_Line( Status_Line_Name, 1 );
  62.          Ansi_Last_Line := PRED( Max_Screen_Line );
  63.          PibTerm_Window( 1, 1, Max_Screen_Col, Ansi_Last_Line );
  64.       END
  65.    ELSE
  66.       Ansi_Last_Line := Max_Screen_Line;
  67.  
  68.                                    (* Ensure proper screen length *)
  69.  
  70.    Wrap_Screen_Col := Max_Screen_Col;
  71.  
  72.                                    (* Reset escape mode      *)
  73.    Escape_Mode           := FALSE;
  74.    Escape_Str            := '';
  75.  
  76.                                    (* Reset scrolling region *)
  77.    Top_Scroll            := 1;
  78.    Bottom_Scroll         := Ansi_Last_Line;
  79.  
  80.                                    (* Clear screen if requested *)
  81.    IF ClearScreen THEN
  82.       BEGIN
  83.          Scroll( 1, Ansi_Last_Line, 1, Max_Screen_Col, 0,
  84.                  ForeGround_Color, BackGround_Color );
  85.          NewX := 1;
  86.          NewY := 1;
  87.          GoToXY( 1 , 1 );
  88.       END
  89.    ELSE
  90.       BEGIN
  91.          NewX := WhereX;
  92.          NewY := WhereY;
  93.       END;
  94.                                    (* Clear line attributes *)
  95.  
  96.    FillChar( Line_Attributes, 100, 0 );
  97.  
  98. END   (* Reset_General_Terminal *);
  99.