home *** CD-ROM | disk | FTP | other *** search
/ Il CD di internet / CD.iso / INTERNET / WWW / LYNX / SOURCE / SRC0_8A.ZIP / DOSLYNX / SRC / TDOSLYNX.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1994-08-09  |  4.4 KB  |  151 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.     //    Check the command line to see if we should turn off all
  54.     //        informational views.
  55.     for(int i_counter = 0; i_counter < i_argc; i_counter++)    {
  56.         if(*(cpp_argv[i_counter]) == '/')    {
  57.             if(toupper(*(cpp_argv[i_counter] + 1)) == 'B')    {
  58.                 EvalOption(i_counter, cpp_argv[i_counter]);
  59.             }
  60.         }
  61.     }
  62.  
  63.     //    Create the captured view of stdout and stderr.
  64.     TRect TR_extent;
  65.     TR_extent = deskTop->getExtent();
  66.     TR_extent.a.y = TR_extent.b.y - 6;
  67.     ::TC = new TCapture(TR_extent, "Messages", 4096);
  68.     deskTop->insert(::TC);
  69.  
  70.     //    Do all of this optionally on the /b command line switch.
  71.     if(B_noInfo == TRUE)    {
  72.         if(::TC != NULL)    {
  73.             ::TC->hide();
  74.         }
  75.         TCV_clock = NULL;
  76.         THV_heap = NULL;
  77.         TDV_disk = NULL;
  78.         TSV_sock = NULL;
  79.     }
  80.     else    {
  81.         //    Create a clock view in the upper right corner.
  82.         TR_extent = getExtent();
  83.         TR_extent.a.x = TR_extent.b.x - 9;
  84.         TR_extent.b.y = TR_extent.a.y + 1;
  85.         TCV_clock = (TClockView *)validView(new TClockView(TR_extent));
  86.         insert(TCV_clock);
  87.  
  88.         //    Create a heap view in the lower right corner.
  89.         TR_extent = getExtent();
  90.         TR_extent.a.x = TR_extent.b.x - 13;
  91.         TR_extent.a.y = TR_extent.b.y - 1;
  92.         THV_heap = (THeapView *)validView(new THeapView(TR_extent));
  93.         insert(THV_heap);
  94.  
  95.         //    Create a disk view in the lower right corner.
  96.         TR_extent = getExtent();
  97.         TR_extent.a.x = TR_extent.b.x - 26;
  98.         TR_extent.b.x -= 13;
  99.         TR_extent.a.y = TR_extent.b.y - 1;
  100.         TDV_disk = (TDiskView *)validView(new TDiskView(TR_extent));
  101.         insert(TDV_disk);
  102.  
  103.         //    Create socket activity in the lower right corner.
  104.         TR_extent = getExtent();
  105.         TR_extent.a.x = TR_extent.b.x - 39;
  106.         TR_extent.b.x -= 26;
  107.         TR_extent.a.y = TR_extent.b.y - 1;
  108.         TSV_sock = (TSockView *)validView(new TSockView(TR_extent));
  109.         insert(TSV_sock);
  110.     }
  111.  
  112.     //    Create the HText collection.
  113.     ::TNSCp_LoadedHTexts = new TNSCollection(5, 5);
  114.  
  115.     //    Initialize the new memory failsafe.
  116.     vfp_old_new_handler = set_new_handler(&::ReleaseSomeMemory);
  117.  
  118.     //    Search for the /p command line option and do it if it exists
  119.     //    The /p defines where the configuration file is located.
  120.     for(i_counter = 0; i_counter < i_argc; i_counter++)    {
  121.         if(*(cpp_argv[i_counter]) == '/')    {
  122.             if(toupper(*(cpp_argv[i_counter] + 1)) == 'P')    {
  123.                 EvalOption(i_counter, cpp_argv[i_counter]);
  124.             }
  125.         }
  126.     }
  127.  
  128.     //    Send the configuration file to be examined.
  129.     EvalConfigFile();
  130.  
  131.     //    See if we should set up expanded and then extended overlays.
  132.     if(::B_ems == True)    {
  133.         if(::_OvrInitEms(0U, 0U, ::usi_emspages) != 0)    {
  134.             doslynxmessage("Unable to initialize EMS.");
  135.         }
  136.     }
  137.     if(::B_xms == True)    {
  138.         if(::_OvrInitExt(::uli_xmsstart, ::uli_xmslength) != 0)    {
  139.             doslynxmessage("Unable to initialize XMS.");
  140.         }
  141.     }
  142.  
  143.     //    Send all command line options to be evaluated.
  144.     for(i_counter = 0; i_counter < i_argc; i_counter++)
  145.         EvalOption(i_counter, cpp_argv[i_counter]);
  146.  
  147.     //    See if we should load up the home page.
  148.     if(B_loadHome == True && ::cp_Home != NULL)    {
  149.         OpenURL(cp_Home);
  150.     }
  151. }