/* ************************************************************** */ /* * Module BHALLUI * This module contains functions for the Bell BHALL * user interface. * * Zachary Wolf * 1/24/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "bhalluir.h" #include "bhallui.h" #include "bhall.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int bhall_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void bhallui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * bhallui_init * This function initializes the user interface for the BHALL. * * Zachary Wolf * 1/28/00 */ void bhallui_init(void) { /* Open the BHALL panel */ bhall_panel = LoadPanel(0, "bhalluir.uir", BHALLPAN); if (bhall_panel < 0) { bhallui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(bhall_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * bhallui_error * This function handles error messages for the BHALL user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/3/98 */ void bhallui_error(char* message) { /* Declare variables */ char buf[BHALL_MAX_CMD]; /* Notify the operator of the error */ printf("\nBHALLUI ERROR: %s\n", message); Beep(); Delay(.5); Beep(); /* Terminate the program if the operator desires */ printf("Press ENTER to continue.\nPress any key then ENTER to terminate program.\n"); fgets(buf, BHALL_MAX_CMD, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK bhallui_set_range(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int range; switch (event) { case EVENT_COMMIT: GetCtrlVal(bhall_panel, BHALLPAN_NUM_SET_RANGE, &range); bhall_set_range(range); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK bhallui_get_b(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double B; switch (event) { case EVENT_COMMIT: bhall_get_B(&B); SetCtrlVal(bhall_panel, BHALLPAN_NUM_GET_B, B); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK bhallui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bhall_zero(); break; case EVENT_RIGHT_CLICK: break; } return 0; } /* ************************************************************** */ int CVICALLBACK bhallui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bhall_exit(); QuitUserInterface(0); break; case EVENT_RIGHT_CLICK: break; } return 0; }