/*-------------------------- DEMOVIS.C -------------------------*/ /* */ /* This file contains the main VISION LIBRARY DEMO software. */ /* */ /* Copyright 1990 Dan Vogel & David Bernazzani */ /* */ /* Date Initials Comments */ /* */ /* 03/07/90 DCV Initial Release 0.00. */ /* 12/18/90 DCV Modified for VISIONS 1.20 */ /*--------------------------------------------------------------*/ #include #include #include #include #include #include "USERFORM.H" #include "USERMENU.H" #include "USERWIND.H" #include "USERLIST.H" #include "USERCOMP.H" #include "USERMOUS.H" #include "DEMOPROT.H" LOCAL TEXT *cnotice="VISIONS Copyright 1990 Dan Vogel & David Bernazzani"; /*--------------------------------------------------------------*/ #define MAIN_DEMO_TOP_Y (UBYTE)1 #define MAIN_DEMO_TOP_X (UBYTE)1 #define MAIN_DEMO_HEIGHT (UBYTE)3 #define MAIN_DEMO_WIDTH (UBYTE)80 #define MAIN_DEMO_BK_COLOR TEXT_BLUE #define MAIN_DEMO_TXT_COLOR TEXT_WHITE #define MAIN_DEMO_HBK_COLOR TEXT_WHITE #define MAIN_DEMO_HTXT_COLOR TEXT_BLUE /*-------------------------------------*/ /* List demonstration selection menus. */ /*-------------------------------------*/ #define LIST_DEMO_TOP_Y 11 #define LIST_DEMO_TOP_X 10 #define LIST_DEMO_HEIGHT 7 #define LIST_DEMO_WIDTH 25 #define LIST_DEMO_BK_COLOR TEXT_BLUE #define LIST_DEMO_TXT_COLOR TEXT_WHITE #define LIST_DEMO_HBK_COLOR TEXT_WHITE #define LIST_DEMO_HTXT_COLOR TEXT_BLUE /*---------------------------------------*/ /* Window demonstration selection menus. */ /*---------------------------------------*/ #define WINDOW_DEMO_TOP_Y 11 #define WINDOW_DEMO_TOP_X 10 #define WINDOW_DEMO_HEIGHT 7 #define WINDOW_DEMO_WIDTH 25 #define WINDOW_DEMO_BK_COLOR TEXT_BLUE #define WINDOW_DEMO_TXT_COLOR TEXT_WHITE #define WINDOW_DEMO_HBK_COLOR TEXT_WHITE #define WINDOW_DEMO_HTXT_COLOR TEXT_BLUE /*-------------------------------------*/ /* Menu demonstration selection menus. */ /*-------------------------------------*/ #define MENU_DEMO_TOP_Y 11 #define MENU_DEMO_TOP_X 10 #define MENU_DEMO_HEIGHT 7 #define MENU_DEMO_WIDTH 25 #define MENU_DEMO_BK_COLOR TEXT_BLUE #define MENU_DEMO_TXT_COLOR TEXT_WHITE #define MENU_DEMO_HBK_COLOR TEXT_WHITE #define MENU_DEMO_HTXT_COLOR TEXT_BLUE /*-------------------------------------*/ /* Form demonstration selection menus. */ /*-------------------------------------*/ #define FORM_DEMO_TOP_Y 11 #define FORM_DEMO_TOP_X 10 #define FORM_DEMO_HEIGHT 7 #define FORM_DEMO_WIDTH 25 #define FORM_DEMO_BK_COLOR TEXT_BLUE #define FORM_DEMO_TXT_COLOR TEXT_WHITE #define FORM_DEMO_HBK_COLOR TEXT_WHITE #define FORM_DEMO_HTXT_COLOR TEXT_BLUE /*-----------------------------*/ /* Information selection menu. */ /*-----------------------------*/ #define INFO_TOP_Y 11 #define INFO_TOP_X 10 #define INFO_HEIGHT 7 #define INFO_WIDTH 25 #define INFO_BK_COLOR TEXT_BLUE #define INFO_TXT_COLOR TEXT_WHITE #define INFO_HBK_COLOR TEXT_WHITE #define INFO_HTXT_COLOR TEXT_BLUE /*-----------------------------------------------------------*/ /* This is the main program for the VISIONS demonstration. */ /* WARNING - Error checking has been removed for clarity. */ /* This should not be a normal practice. */ /*-----------------------------------------------------------*/ main() { MENU_BAR_HEAD *menu_bar; /* Pointer to the menu to be created. */ MENU_HEAD *list_menu, *window_menu, *menu_menu, *form_menu, *info_menu; Window_Init(); Mouse_Init(); /*------------------------------------------------*/ /* Display initial VISION logo and information. */ /*------------------------------------------------*/ VISION_logo(); Share_Policy(); /*-------------------------------------------------*/ /* Create a menubar of choices for demonstrations. */ /* First build the individual menus. */ /*-------------------------------------------------*/ /*-----------*/ /* List Menu */ /*-----------*/ Menu_Define(&list_menu, LIST_DEMO_TOP_Y, LIST_DEMO_TOP_X, LIST_DEMO_HEIGHT, LIST_DEMO_WIDTH, LIST_DEMO_BK_COLOR, LIST_DEMO_TXT_COLOR, LIST_DEMO_HBK_COLOR, LIST_DEMO_HTXT_COLOR, "VISIONS LIST LIBRARY DEMONSTRATION", HOT_EXEC_BIT | SINGLE_BORDER_BIT | POPUP_BIT | MOUSE_ENABLE_BIT); Menu_Add(list_menu, "Run List Demonstration", 'R', 0, *Run_List); Menu_Add(list_menu, "Display List Demonstration Source", 'D', 0, *Display_List); Menu_Add(list_menu, "View List Manual", 'V', 0, *View_List_Manual); Menu_Add(list_menu, "Exit List Demonstration", 'E', 1, NULL); /*-------------*/ /* Window Menu */ /*-------------*/ Menu_Define(&window_menu, WINDOW_DEMO_TOP_Y, WINDOW_DEMO_TOP_X, WINDOW_DEMO_HEIGHT, WINDOW_DEMO_WIDTH, WINDOW_DEMO_BK_COLOR, WINDOW_DEMO_TXT_COLOR, WINDOW_DEMO_HBK_COLOR, WINDOW_DEMO_HTXT_COLOR, "VISIONS WINDOW LIBRARY DEMONSTRATION", HOT_EXEC_BIT | SINGLE_BORDER_BIT | POPUP_BIT | MOUSE_ENABLE_BIT); Menu_Add(window_menu, "Run Window Demonstration", 'R', 0, *Run_Window); Menu_Add(window_menu, "Display Window Demonstration Source", 'D', 0, *Display_Window); Menu_Add(window_menu, "View Window Manual", 'V', 0, *View_Window_Manual); Menu_Add(window_menu, "Exit Window Demonstration", 'E', 1, NULL); /*-----------*/ /* Menu Menu */ /*-----------*/ Menu_Define(&menu_menu, MENU_DEMO_TOP_Y, MENU_DEMO_TOP_X, MENU_DEMO_HEIGHT, MENU_DEMO_WIDTH, MENU_DEMO_BK_COLOR, MENU_DEMO_TXT_COLOR, MENU_DEMO_HBK_COLOR, MENU_DEMO_HTXT_COLOR, "VISIONS MENU LIBRARY DEMONSTRATION", HOT_EXEC_BIT | SINGLE_BORDER_BIT | POPUP_BIT | MOUSE_ENABLE_BIT); Menu_Add(menu_menu, "Run Menu Demonstration", 'R', 0, *Run_Menu); Menu_Add(menu_menu, "Display Menu Demonstration Source", 'D', 0, *Display_Menu); Menu_Add(menu_menu, "View Menu Manual", 'V', 0, *View_Menu_Manual); Menu_Add(menu_menu, "Exit Menu Demonstration", 'E', 1, NULL); /*-----------*/ /* Form Menu */ /*-----------*/ Menu_Define(&form_menu, FORM_DEMO_TOP_Y, FORM_DEMO_TOP_X, FORM_DEMO_HEIGHT, FORM_DEMO_WIDTH, FORM_DEMO_BK_COLOR, FORM_DEMO_TXT_COLOR, FORM_DEMO_HBK_COLOR, FORM_DEMO_HTXT_COLOR, "VISIONS FORM LIBRARY DEMONSTRATION", HOT_EXEC_BIT | SINGLE_BORDER_BIT | POPUP_BIT | MOUSE_ENABLE_BIT); Menu_Add(form_menu, "Run Form Demonstration", 'R', 0, *Run_Form); Menu_Add(form_menu, "Display Form Demonstration Source", 'D', 0, *Display_Form); Menu_Add(form_menu, "View Form Manual", 'V', 0, *View_Form_Manual); Menu_Add(form_menu, "Exit Form Demonstration", 'E', 1, NULL); /*-----------*/ /* Info Menu */ /*-----------*/ Menu_Define(&info_menu, INFO_TOP_Y, INFO_TOP_X, INFO_HEIGHT, INFO_WIDTH, INFO_BK_COLOR, INFO_TXT_COLOR, INFO_HBK_COLOR, INFO_HTXT_COLOR, "VISIONS INFORMATION", HOT_EXEC_BIT | SINGLE_BORDER_BIT | POPUP_BIT | MOUSE_ENABLE_BIT); Menu_Add(info_menu, "Shareware Policy", 'S', 0, *Share_Policy); Menu_Add(info_menu, "Ordering VISIONS", 'O', 0, *Ordering); Menu_Add(info_menu, "System Requirements", 'S', 0, *Requirements); Menu_Add(info_menu, "Revision Notes", 'R', 0, *Revision_Notes); Menu_Add(info_menu, "Mouse Library Documentation", 'M', 0, *Mouse_Doc); Menu_Add(info_menu, "Compiler Specific Library Information", 'C', 0, *Comp_Doc); Menu_Add(info_menu, "Exit Information Menu", 'E', 1, NULL); /*------------------*/ /* Now the menu bar */ /*------------------*/ Menu_Bar_Define(&menu_bar,MAIN_DEMO_TOP_Y,MAIN_DEMO_TOP_X,MAIN_DEMO_WIDTH, MAIN_DEMO_BK_COLOR, MAIN_DEMO_TXT_COLOR, MAIN_DEMO_HBK_COLOR, MAIN_DEMO_HTXT_COLOR, HOT_EXEC_BIT | POPUP_BIT | SINGLE_BORDER_BIT | MOUSE_ENABLE_BIT); Menu_AddToBar(menu_bar, list_menu, 0, "List Demo", 'L'); Menu_AddToBar(menu_bar, window_menu, 0, "Window Demo", 'W'); Menu_AddToBar(menu_bar, menu_menu, 0, "Menu Demo", 'M'); Menu_AddToBar(menu_bar, form_menu, 0, "Form Demo", 'F'); Menu_AddToBar(menu_bar, info_menu, 0, "Information", 'I'); Menu_AddToBar(menu_bar, NULL, 1, "Exit", 'E'); /*-------------------*/ /* Start up the demo */ /*-------------------*/ Menu_DisplayBar(menu_bar); Menu_Delete(list_menu); Menu_Delete(window_menu); Menu_Delete(menu_menu); Menu_Delete(form_menu); Menu_Delete(info_menu); Menu_DeleteBar(menu_bar); Window_Exit(); /*Clear screen and reset mode */ exit(0); } /*-------------------------------------------*/ /* VISION_logo */ /* This is the VISIONS logo display routine. */ /*-------------------------------------------*/ WORD VISION_logo() { WINDOW_HEAD *window_ptr; WORD i; TEXT block[81]; Window_Define(&window_ptr,1,1,24,80,TEXT_BLUE,TEXT_BWHITE, NULL, SINGLE_BORDER_BIT | POPUP_BIT); Window_Display(window_ptr); /*-----------------------------------------*/ /* Block out the logo in X's so its */ /* legible, and then convert it to blocks. */ /*-----------------------------------------*/ strcpy(block," XX XX XXXXX XXX XXXXX XXX X X XXX"); for (i=0;block[i] != 0;i++) if (block[i] == 'X') block[i] = (TEXT)219; Window_Mesg(5,6,block); strcpy(block," XX XX X X X X X XX X X"); for (i=0;block[i] != 0;i++) if (block[i] == 'X') block[i] = (TEXT)219; Window_Mesg(6,6,block); strcpy(block," XX XX X XX X X X X X X XX"); for (i=0;block[i] != 0;i++) if (block[i] == 'X') block[i] = (TEXT)219; Window_Mesg(7,6,block); strcpy(block," XX XX X X X X X X XX X"); for (i=0;block[i] != 0;i++) if (block[i] == 'X') block[i] = (TEXT)219; Window_Mesg(8,6,block); strcpy(block," XXX XXXXX XXX XXXXX XXX X X XXX"); for (i=0;block[i] != 0;i++) if (block[i] == 'X') block[i] = (TEXT)219; Window_Mesg(9,6,block); Window_Mesg(12,27,"Library Demonstration Program"); Window_Mesg(13,33,"Revision 1.20"); Window_Mesg(15,33,"Copyright 1990"); Window_Mesg(17,34,"by Dan Vogel"); Window_Mesg(19,30,"and David Bernazzani"); Window_Mesg(24,28,"Hit any key to continue."); Comp_GetAnyKey(); Window_Remove(window_ptr); Window_Delete(window_ptr); return(0); } /*------------------------------------------------------*/ /* Display the various pieces of text file information. */ /*------------------------------------------------------*/ #define INFOTXT_TOPY 1 #define INFOTXT_TOPX 1 #define INFOTXT_HEIGHT 24 #define INFOTXT_WIDTH 80 #define INFOTXT_BK_COLOR TEXT_BLUE #define INFOTXT_TXT_COLOR TEXT_WHITE /*----------------------*/ /* Ordering Information */ /*----------------------*/ WORD Ordering() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Ordering Information", "V_ORDER.DOC", SINGLE_BORDER_BIT); return(0); } /*---------------------------------*/ /* System Requirements Information */ /*---------------------------------*/ WORD Requirements() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Systems Requirements", "V_REQS.DOC", SINGLE_BORDER_BIT); return(0); } /*----------------*/ /* Revision Notes */ /*----------------*/ WORD Revision_Notes() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Revision 1.20 Notes", "REV120.DOC", SINGLE_BORDER_BIT); return(0); } /*----------------------*/ /* Mouse Library Manual */ /*----------------------*/ WORD Mouse_Doc() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Mouse Library Documentation", "VIS_MOUS.TXT", SINGLE_BORDER_BIT); return(0); } /*--------------------------*/ /* Compiler Specific Manual */ /*--------------------------*/ WORD Comp_Doc() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Compiler Specific Library Documentation", "VIS_COMP.TXT", SINGLE_BORDER_BIT); return(0); } /*--------------------------------------*/ /* Share_Policy */ /* This is the shareware policy display */ /* window for the VISIONS libraries. */ /*--------------------------------------*/ WORD Share_Policy() { /*---------------------------------------------------------*/ /* Display the information using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(INFOTXT_TOPY, INFOTXT_TOPX, INFOTXT_HEIGHT, INFOTXT_WIDTH, INFOTXT_BK_COLOR, INFOTXT_TXT_COLOR, "VISIONS Shareware Policy", "V_SHARE.DOC", SINGLE_BORDER_BIT); return(0); } #define DISP_LIST_TOPY 1 #define DISP_LIST_TOPX 1 #define DISP_LIST_HEIGHT 24 #define DISP_LIST_WIDTH 80 #define DISP_LIST_BK_COLOR TEXT_BLUE #define DISP_LIST_TXT_COLOR TEXT_WHITE /*--------------------------------------------------------------*/ /* Display_List */ /* This is the routine to display the list library source code. */ /*--------------------------------------------------------------*/ WORD Display_List() { /*---------------------------------------------------------*/ /* Display the source code using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(DISP_LIST_TOPY, DISP_LIST_TOPX, DISP_LIST_HEIGHT, DISP_LIST_WIDTH, DISP_LIST_BK_COLOR, DISP_LIST_TXT_COLOR, "List Demonstration Source Code", "DEMOLIST.C", SINGLE_BORDER_BIT); return(0); } #define VIEW_LIST_TOPY 1 #define VIEW_LIST_TOPX 1 #define VIEW_LIST_HEIGHT 24 #define VIEW_LIST_WIDTH 80 #define VIEW_LIST_BK_COLOR TEXT_BLUE #define VIEW_LIST_TXT_COLOR TEXT_BWHITE /*-------------------------------------------------*/ /* View_List_Manual */ /* This is the routine to display the list manual. */ /*-------------------------------------------------*/ WORD View_List_Manual() { /*----------------------------------------------------*/ /* Display the manual using the help window facility. */ /*----------------------------------------------------*/ Window_Help(VIEW_LIST_TOPY, VIEW_LIST_TOPX, VIEW_LIST_HEIGHT, VIEW_LIST_WIDTH, VIEW_LIST_BK_COLOR, VIEW_LIST_TXT_COLOR, "VISIONS List Manual", "VIS_LIST.TXT", SINGLE_BORDER_BIT); return(0); } #define DISP_WINDOW_TOPY 1 #define DISP_WINDOW_TOPX 1 #define DISP_WINDOW_HEIGHT 24 #define DISP_WINDOW_WIDTH 80 #define DISP_WINDOW_BK_COLOR TEXT_BLUE #define DISP_WINDOW_TXT_COLOR TEXT_WHITE /*----------------------------------------------------------------*/ /* Display_Window */ /* This is the routine to display the window library source code. */ /*----------------------------------------------------------------*/ WORD Display_Window() { /*---------------------------------------------------------*/ /* Display the source code using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(DISP_WINDOW_TOPY, DISP_WINDOW_TOPX, DISP_WINDOW_HEIGHT, DISP_WINDOW_WIDTH, DISP_WINDOW_BK_COLOR, DISP_WINDOW_TXT_COLOR, "Window Demonstration Source Code", "DEMOWIND.C",SINGLE_BORDER_BIT); return(0); } #define VIEW_WINDOW_TOPY 1 #define VIEW_WINDOW_TOPX 1 #define VIEW_WINDOW_HEIGHT 24 #define VIEW_WINDOW_WIDTH 80 #define VIEW_WINDOW_BK_COLOR TEXT_BLUE #define VIEW_WINDOW_TXT_COLOR TEXT_BWHITE /*---------------------------------------------------*/ /* View_Window_Manual */ /* This is the routine to display the window manual. */ /*---------------------------------------------------*/ WORD View_Window_Manual() { /*----------------------------------------------------*/ /* Display the manual using the help window facility. */ /*----------------------------------------------------*/ Window_Help(VIEW_WINDOW_TOPY, VIEW_WINDOW_TOPX, VIEW_WINDOW_HEIGHT, VIEW_WINDOW_WIDTH, VIEW_WINDOW_BK_COLOR, VIEW_WINDOW_TXT_COLOR, "VISIONS Window Manual", "VIS_WIND.TXT", SINGLE_BORDER_BIT); return(0); } #define DISP_MENU_TOPY 1 #define DISP_MENU_TOPX 1 #define DISP_MENU_HEIGHT 24 #define DISP_MENU_WIDTH 80 #define DISP_MENU_BK_COLOR TEXT_BLUE #define DISP_MENU_TXT_COLOR TEXT_WHITE /*--------------------------------------------------------------*/ /* Display_Menu */ /* This is the routine to display the menu library source code. */ /*--------------------------------------------------------------*/ WORD Display_Menu() { /*---------------------------------------------------------*/ /* Display the source code using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(DISP_MENU_TOPY, DISP_MENU_TOPX, DISP_MENU_HEIGHT, DISP_MENU_WIDTH, DISP_MENU_BK_COLOR, DISP_MENU_TXT_COLOR, "Menu Demonstration Source Code", "DEMOMENU.C", SINGLE_BORDER_BIT); return(0); } #define VIEW_MENU_TOPY 1 #define VIEW_MENU_TOPX 1 #define VIEW_MENU_HEIGHT 24 #define VIEW_MENU_WIDTH 80 #define VIEW_MENU_BK_COLOR TEXT_BLUE #define VIEW_MENU_TXT_COLOR TEXT_BWHITE /*-------------------------------------------------*/ /* View_Menu_Manual */ /* This is the routine to display the menu manual. */ /*-------------------------------------------------*/ WORD View_Menu_Manual() { /*----------------------------------------------------*/ /* Display the manual using the help window facility. */ /*----------------------------------------------------*/ Window_Help(VIEW_MENU_TOPY, VIEW_MENU_TOPX, VIEW_MENU_HEIGHT, VIEW_MENU_WIDTH, VIEW_MENU_BK_COLOR, VIEW_MENU_TXT_COLOR, "VISIONS Menu Manual", "VIS_MENU.TXT", SINGLE_BORDER_BIT); return(0); } #define DISP_FORM_TOPY 1 #define DISP_FORM_TOPX 1 #define DISP_FORM_HEIGHT 24 #define DISP_FORM_WIDTH 80 #define DISP_FORM_BK_COLOR TEXT_BLUE #define DISP_FORM_TXT_COLOR TEXT_WHITE /*--------------------------------------------------------------*/ /* Display_Form */ /* This is the routine to display the form library source code. */ /*--------------------------------------------------------------*/ WORD Display_Form() { /*---------------------------------------------------------*/ /* Display the source code using the help window facility. */ /*---------------------------------------------------------*/ Window_Help(DISP_FORM_TOPY, DISP_FORM_TOPX, DISP_FORM_HEIGHT, DISP_FORM_WIDTH, DISP_FORM_BK_COLOR, DISP_FORM_TXT_COLOR, "Form Demonstration Source Code", "DEMOFORM.C", SINGLE_BORDER_BIT); return(0); } #define VIEW_FORM_TOPY 1 #define VIEW_FORM_TOPX 1 #define VIEW_FORM_HEIGHT 24 #define VIEW_FORM_WIDTH 80 #define VIEW_FORM_BK_COLOR TEXT_BLUE #define VIEW_FORM_TXT_COLOR TEXT_BWHITE /*-------------------------------------------------*/ /* View_Form_Manual */ /* This is the routine to display the form manual. */ /*-------------------------------------------------*/ WORD View_Form_Manual() { /*----------------------------------------------------*/ /* Display the manual using the help window facility. */ /*----------------------------------------------------*/ Window_Help(VIEW_FORM_TOPY, VIEW_FORM_TOPX, VIEW_FORM_HEIGHT, VIEW_FORM_WIDTH, VIEW_FORM_BK_COLOR, VIEW_FORM_TXT_COLOR, "VISIONS Form Manual", "VIS_FORM.TXT", SINGLE_BORDER_BIT); return(0); }