/* ************************************************************** */ /* * Module BNMRUI * This module contains functions for the BNMR module * user interface. * * Zachary Wolf * 1/27/03 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "bnmruir.h" #include "bnmrui.h" #include "bnmr.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int bnmr_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void bnmrui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * bnmrui_init * This function initializes the user interface for the BNMR module. * * Zachary Wolf * 1/27/03 */ void bnmrui_init(void) { /* Open the BNMR panel */ bnmr_panel = LoadPanel(0, "bnmruir.uir", BNMRPAN); if (bnmr_panel < 0) { bnmrui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(bnmr_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * bnmrui_error * This function handles error messages for the BNMR user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/26/98 */ void bnmrui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nBNMRUI 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, 80, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK bnmrui_set_mux_chan (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char chan[BNMR_MAX_CMD]; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, BNMRPAN_STR_MUX_CHAN, chan); bnmr_set_mux_chan(chan[0]); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_set_coarse_field (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { int probe_num; double b_coarse; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, BNMRPAN_NUM_PROBE_NUM, &probe_num); GetCtrlVal(panel, BNMRPAN_NUM_COARSE_FIELD, &b_coarse); bnmr_set_coarse_adj(probe_num, b_coarse); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_set_field_dir (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { char dir[BNMR_MAX_CMD]; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, BNMRPAN_STR_FIELD_DIR, dir); bnmr_set_field_dir(dir[0]); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_set_mode_manual (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bnmr_set_search_mode(BNMR_MANUAL); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_set_mode_auto (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bnmr_set_search_mode(BNMR_AUTO); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_set_mode_search (int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bnmr_set_search_mode(BNMR_SEARCH); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_get_b(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double b; switch (event) { case EVENT_COMMIT: bnmr_get_b(&b); SetCtrlVal(panel, BNMRPAN_NUM_B, b); break; } return 0; } /* ************************************************************** */ int CVICALLBACK bnmrui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: bnmr_exit(); QuitUserInterface(0); break; } return 0; }