home *** CD-ROM | disk | FTP | other *** search
/ Piper's Pit BBS/FTP: ibm 0040 - 0049 / ibm0040-0049 / ibm0040.tar / ibm0040 / ZINC_6.ZIP / DOSSRC.ZIP / D_DESIGN.CPP < prev    next >
Encoding:
C/C++ Source or Header  |  1991-06-01  |  2.3 KB  |  85 lines

  1. //    Zinc Interface Library - D_DESIGN.CPP
  2. //    COPYRIGHT (C) 1990, 1991.  All Rights Reserved.
  3. //    Zinc Software Incorporated.  Pleasant Grove, Utah  USA
  4.  
  5. #include "ui_dsn.hpp"
  6. #include "d_help.hlh"
  7. #include <string.h>
  8. #include <graphics.h>
  9. int _centerLine;
  10. int _centerColumn;
  11.  
  12. main(int argc, char *argv[])
  13. {
  14.     // Initialize the path.
  15.     _path = new UI_PATH(argv[0], TRUE);
  16.     UI_STORAGE::defaultCacheSize = 20480;
  17.  
  18.     // Initialize the display.
  19.     UI_DISPLAY *display = NULL;
  20.     for (int i = 1; i < argc; i++)
  21.         if (!strcmpi("+25", argv[i]))
  22.             display = new UI_DOS_TEXT_DISPLAY(TDM_25x80);
  23.         else if (!strcmpi("+40", argv[i]))
  24.             display = new UI_DOS_TEXT_DISPLAY(TDM_25x40);
  25.         else if (!strcmpi("+43", argv[i]) || !strcmpi("+50", argv[i]))
  26.             display = new UI_DOS_TEXT_DISPLAY(TDM_43x80);
  27.     if (!display)
  28.         display = new UI_DOS_BGI_DISPLAY;
  29.     if (!display->installed)
  30.     {
  31.         delete display;
  32.         display = new UI_DOS_TEXT_DISPLAY;
  33.     }
  34.     _centerColumn = display->columns / display->cellWidth / 2;
  35.     _centerLine = display->lines / display->cellHeight / 2;
  36.  
  37.     // Initialize the event manager.
  38.     UI_EVENT_MANAGER *eventManager = new UI_EVENT_MANAGER(100, display);
  39.     *eventManager + new UI_BIOS_KEYBOARD + new UI_MS_MOUSE + new UI_CURSOR;
  40.  
  41.     // Initialize the window manager.
  42.     UI_DESIGN_MANAGER *windowManager = new UI_DESIGN_MANAGER(display, eventManager);
  43.  
  44.     // Initialize the help system.
  45.     _helpSystem = new UI_HELP_WINDOW_SYSTEM("d_help", windowManager, HELP_GENERAL);
  46.  
  47.     // Initialize the error system.
  48.     _errorSystem = new UI_ERROR_WINDOW_SYSTEM;
  49.  
  50.     // Process the events.
  51.     int ccode;
  52.     UI_EVENT event;
  53.     do
  54.     {
  55.         // Get a new event.
  56.         eventManager->Get(event, Q_NORMAL);
  57.         if (event.type == S_RESET_DISPLAY)
  58.         {
  59.             delete display;
  60.             if (event.rawCode == TDM_NONE)
  61.                 display = new UI_DOS_BGI_DISPLAY;
  62.             else
  63.                 display = new UI_DOS_TEXT_DISPLAY(event.rawCode);
  64.             _centerColumn = display->columns / display->cellWidth / 2;
  65.             _centerLine = display->lines / display->cellHeight / 2;
  66.             event.data = display;
  67.             eventManager->Event(event);
  68.             windowManager->Event(event);
  69.         }
  70.         else
  71.             ccode = windowManager->Event(event);
  72.     } while (ccode != L_EXIT);
  73.  
  74.     // Clean up.
  75.     if (_storage)
  76.         delete _storage;
  77.     delete _errorSystem;
  78.     delete _helpSystem;
  79.     delete windowManager;
  80.     delete eventManager;
  81.     delete display;
  82.     delete _path;
  83.     return (0);
  84. }
  85.