home *** CD-ROM | disk | FTP | other *** search
/ Collection of Internet / Collection of Internet.iso / msdos / lynx / source / doslynx / src / tdoslynx.cpp < prev    next >
Encoding:
C/C++ Source or Header  |  1994-10-25  |  3.9 KB  |  129 lines

  1. //    Copyright (c) 1993, University of Kansas, All Rights Reserved
  2. //
  3. //    Class:        TDosLynx : public TApplication
  4. //    Include File:    TDosLynx.h
  5. //    Purpose:    Implement our application object.
  6. //    Remarks/Portability/Dependencies/Restrictions:
  7. //    Revision History:
  8. //        12-09-93    created
  9. //        02-09-94    Split all members into seperate files to
  10. //                enhance overlay support.
  11. #define Uses_TDeskTop
  12. #include"tdoslynx.h"
  13. #include"globals.h"
  14. #include<new.h>
  15. #include<dos.h>
  16.  
  17. TDosLynx::TDosLynx(int i_argc, char **cpp_argv)
  18.     : TProgInit(&TDosLynx::initStatusLine, &TDosLynx::initMenuBar,
  19.         &TDosLynx::initDeskTop)    {
  20. //    Purpose:    Constructor
  21. //    Arguments:    i_argc        Number of command line arguments passed
  22. //                    in by main.
  23. //            cpp_argv    The command line arguments.
  24. //    Return Value:    none
  25. //    Remarks/Portability/Dependencies/Restrictions:
  26. //        Uses the global variable TC.
  27. //    Revision History:
  28. //        12-09-93    created
  29. //        02-25-94    Added advanced memory handling to the
  30. //                application to avoid often crashes.
  31.  
  32.     //    There is at this point no view to be removed.
  33.     TVp_ToBeRemoved = NULL;
  34.  
  35.     //    There is also no image to be displayed.
  36.     cp_ToBeViewed = NULL;
  37.  
  38.     //    We initially always start in low video.
  39.     B_isLow = True;
  40.  
  41.     //    We want to load the home page by default.
  42.     B_loadHome = True;
  43.  
  44.     //    The default printing device.
  45.     ::cp_Printer = newStr("NUL");
  46.  
  47.     //    The default error file.
  48.     ::cp_ErrorHTML = newStr("ERROR.HTM");
  49.  
  50.     //    The default nntp server.
  51.     ::cp_nntphost = newStr("news");
  52.  
  53.     //    Create the captured view of stdout and stderr.
  54.     TRect TR_extent;
  55.     TR_extent = deskTop->getExtent();
  56.     TR_extent.a.y = TR_extent.b.y - 6;
  57.     ::TC = new TCapture(TR_extent, "Messages", 4096);
  58.     deskTop->insert(::TC);
  59.  
  60.     //    Create a clock view in the upper right corner.
  61.     TR_extent = getExtent();
  62.     TR_extent.a.x = TR_extent.b.x - 9;
  63.     TR_extent.b.y = TR_extent.a.y + 1;
  64.     TCV_clock = (TClockView *)validView(new TClockView(TR_extent));
  65.     insert(TCV_clock);
  66.  
  67.     //    Create a heap view in the lower right corner.
  68.     TR_extent = getExtent();
  69.     TR_extent.a.x = TR_extent.b.x - 13;
  70.     TR_extent.a.y = TR_extent.b.y - 1;
  71.     THV_heap = (THeapView *)validView(new THeapView(TR_extent));
  72.     insert(THV_heap);
  73.  
  74.     //    Create a disk view in the lower right corner.
  75.     TR_extent = getExtent();
  76.     TR_extent.a.x = TR_extent.b.x - 26;
  77.     TR_extent.b.x -= 13;
  78.     TR_extent.a.y = TR_extent.b.y - 1;
  79.     TDV_disk = (TDiskView *)validView(new TDiskView(TR_extent));
  80.     insert(TDV_disk);
  81.  
  82.     //    Create socket activity in the lower right corner.
  83.     TR_extent = getExtent();
  84.     TR_extent.a.x = TR_extent.b.x - 39;
  85.     TR_extent.b.x -= 26;
  86.     TR_extent.a.y = TR_extent.b.y - 1;
  87.     TSV_sock = (TSockView *)validView(new TSockView(TR_extent));
  88.     insert(TSV_sock);
  89.  
  90.     //    Create the HText collection.
  91.     ::TNSCp_LoadedHTexts = new TNSCollection(5, 5);
  92.  
  93.     //    Initialize the new memory failsafe.
  94.     vfp_old_new_handler = set_new_handler(&::ReleaseSomeMemory);
  95.  
  96.     //    Search for the /p command line option and do it if it exists
  97.     //    The /p defines where the configuration file is located.
  98.     for(int i_counter = 0; i_counter < i_argc; i_counter++)    {
  99.         if(*(cpp_argv[i_counter]) == '/')    {
  100.             if(toupper(*(cpp_argv[i_counter] + 1)) == 'P')    {
  101.                 EvalOption(i_counter, cpp_argv[i_counter]);
  102.             }
  103.         }
  104.     }
  105.  
  106.     //    Send the configuration file to be examined.
  107.     EvalConfigFile();
  108.  
  109.     //    See if we should set up expanded and then extended overlays.
  110.     if(::B_ems == True)    {
  111.         if(::_OvrInitEms(0U, 0U, ::usi_emspages) != 0)    {
  112.             doslynxmessage("Unable to initialize EMS.");
  113.         }
  114.     }
  115.     if(::B_xms == True)    {
  116.         if(::_OvrInitExt(::uli_xmsstart, ::uli_xmslength) != 0)    {
  117.             doslynxmessage("Unable to initialize XMS.");
  118.         }
  119.     }
  120.  
  121.     //    Send all command line options to be evaluated.
  122.     for(i_counter = 0; i_counter < i_argc; i_counter++)
  123.         EvalOption(i_counter, cpp_argv[i_counter]);
  124.  
  125.     //    See if we should load up the home page.
  126.     if(B_loadHome == True && ::cp_Home != NULL)    {
  127.         OpenURL(cp_Home);
  128.     }
  129. }