home *** CD-ROM | disk | FTP | other *** search
/ DP Tool Club 17 / CD_ASCQ_17_101194.iso / vrac / bkgrnd.zip / DOSBKGND.PAS < prev    next >
Pascal/Delphi Source File  |  1994-08-07  |  3KB  |  97 lines

  1. { Contains TDOSDesktop and TDOSBackground - allow using DOS screen before program
  2.   start up as background
  3.   Written by Tim J. Duncan
  4.   Compuserve 72603,3616
  5. }
  6. unit DOSBkGnd;
  7.  
  8. {}Interface{}
  9.  
  10. uses
  11.   App,      {  Turbo Vision unit  }
  12.   Crt,      {  Borland unit  }
  13.   Drivers,  {  Turbo Vision unit  }
  14.   MiscStr,  {  Contains miscellaneous string definitions and routines  }
  15.   Objects,  {  Turbo Vision unit  }
  16.   Video,    {  Contains routines and data to directly access video memory  }
  17.   Views;    {  Turbo Vision unit  }
  18.  
  19.  
  20. type
  21.   {  Uses DOS screen before TV start up as background  }
  22.   {  Must be used by TDOSDesktop only  }
  23.   PDOSBackground = ^TDOSBackground;
  24.   TDOSBackground =
  25.     object (TBackground)
  26.     constructor Init (var Bounds : TRect);
  27.     procedure Draw; virtual;
  28.     end;  {  of TBackground  }
  29.  
  30.   {  Uses TDOSBackground only  }
  31.   PDOSDesktop = ^TDOSDesktop;
  32.   TDOSDesktop =
  33.     object (TDesktop)
  34.     constructor Init;
  35.     procedure InitBackground; virtual;
  36.     end;  {  of TDOSDesktop  }
  37.  
  38. {  Saves a copy of video memory before calling TV's InitVideo  }
  39. procedure InitVideoDOS;
  40. {  Restores the previously saved copy of video memory after calling TV's DoneVideo  }
  41. procedure DoneVideoDOS;
  42.  
  43. {}Implementation{}
  44.  
  45. {  Saves a copy of the contents of video memory before calling TV's InitVideo  }
  46. procedure InitVideoDOS;
  47.   begin
  48.   SaveDOSScreen;
  49.   InitVideo;
  50.   end;  {  of procedure InitVideo2  }
  51.  
  52. {  Restores saved copy of video memory to video memory after TV's DoneVideo  }
  53. procedure DoneVideoDOS;
  54.   begin
  55.   DoneVideo;
  56.   UpdateDOSScreen;
  57.   FreeVideoMemoryCopy;
  58.   end;  {  of procedure DoneVideo2  }
  59.  
  60. {**Definition of methods for TDOSBackground**}
  61.  
  62. constructor TDOSBackground.Init
  63.   (
  64.   var Bounds : TRect  {  Input only  }
  65.   );
  66.   begin
  67.   TView.Init (Bounds);
  68.   GrowMode := gfGrowHiX + gfGrowHiY;
  69.   end;  {  of constructor Init  }
  70.  
  71. procedure TDOSBackground.Draw;
  72.   begin
  73.   WriteBuf (0, 0, ScreenWidth, ScreenHeight, VideoMemoryCopy^);
  74.   end;  {  of procedure Draw  }
  75.  
  76. {**Definition of methods for TDOSDesktop**}
  77.  
  78. constructor TDOSDesktop.Init;
  79.   var
  80.     R : TRect;
  81.   begin
  82.   {  Force TDesktop to control entire screen  }
  83.   Application^.GetExtent (R);
  84.   inherited Init (R);
  85.   end;  {  of constructor Init  }
  86.  
  87. procedure TDOSDesktop.InitBackground;
  88.   var
  89.     R : TRect;
  90.   begin
  91.   GetExtent (R);
  92.   Background := new (PDOSBackground, Init (R));
  93.   end;  {  of procedure InitBackground  }
  94.  
  95. begin
  96. end.  {  unit  }
  97.