home *** CD-ROM | disk | FTP | other *** search
- // Zinc Interface Library - D_DESIGN.CPP
- // COPYRIGHT (C) 1990, 1991. All Rights Reserved.
- // Zinc Software Incorporated. Pleasant Grove, Utah USA
-
- #include "ui_dsn.hpp"
- #include "d_help.hlh"
- #include <string.h>
- #include <graphics.h>
- int _centerLine;
- int _centerColumn;
-
- main(int argc, char *argv[])
- {
- // Initialize the path.
- _path = new UI_PATH(argv[0], TRUE);
- UI_STORAGE::defaultCacheSize = 20480;
-
- // Initialize the display.
- UI_DISPLAY *display = NULL;
- for (int i = 1; i < argc; i++)
- if (!strcmpi("+25", argv[i]))
- display = new UI_DOS_TEXT_DISPLAY(TDM_25x80);
- else if (!strcmpi("+40", argv[i]))
- display = new UI_DOS_TEXT_DISPLAY(TDM_25x40);
- else if (!strcmpi("+43", argv[i]) || !strcmpi("+50", argv[i]))
- display = new UI_DOS_TEXT_DISPLAY(TDM_43x80);
- if (!display)
- display = new UI_DOS_BGI_DISPLAY;
- if (!display->installed)
- {
- delete display;
- display = new UI_DOS_TEXT_DISPLAY;
- }
- _centerColumn = display->columns / display->cellWidth / 2;
- _centerLine = display->lines / display->cellHeight / 2;
-
- // Initialize the event manager.
- UI_EVENT_MANAGER *eventManager = new UI_EVENT_MANAGER(100, display);
- *eventManager + new UI_BIOS_KEYBOARD + new UI_MS_MOUSE + new UI_CURSOR;
-
- // Initialize the window manager.
- UI_DESIGN_MANAGER *windowManager = new UI_DESIGN_MANAGER(display, eventManager);
-
- // Initialize the help system.
- _helpSystem = new UI_HELP_WINDOW_SYSTEM("d_help", windowManager, HELP_GENERAL);
-
- // Initialize the error system.
- _errorSystem = new UI_ERROR_WINDOW_SYSTEM;
-
- // Process the events.
- int ccode;
- UI_EVENT event;
- do
- {
- // Get a new event.
- eventManager->Get(event, Q_NORMAL);
- if (event.type == S_RESET_DISPLAY)
- {
- delete display;
- if (event.rawCode == TDM_NONE)
- display = new UI_DOS_BGI_DISPLAY;
- else
- display = new UI_DOS_TEXT_DISPLAY(event.rawCode);
- _centerColumn = display->columns / display->cellWidth / 2;
- _centerLine = display->lines / display->cellHeight / 2;
- event.data = display;
- eventManager->Event(event);
- windowManager->Event(event);
- }
- else
- ccode = windowManager->Event(event);
- } while (ccode != L_EXIT);
-
- // Clean up.
- if (_storage)
- delete _storage;
- delete _errorSystem;
- delete _helpSystem;
- delete windowManager;
- delete eventManager;
- delete display;
- delete _path;
- return (0);
- }
-