/* ************************************************************** */ /* * Module MOVEXUI * This module contains functions for the MOVEX * user interface. * * Zachary Wolf * 6/15/01 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "movexuir.h" #include "movexui.h" #include "movex.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int movex_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void movexui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * movexui_init * This function initializes the user interface for MOVEX. * * Zachary Wolf * 6/15/01 */ void movexui_init(void) { /* Open the MOVEX panel */ movex_panel = LoadPanel(0, "movexuir.uir", MOVEXPAN); if (movex_panel < 0) { movexui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(movex_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * movexui_error * This function handles error messages for the MOVEX user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/26/98 */ void movexui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nMOVEXUI 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."); fgets(buf, 80, stdin); if (buf[0] == '\n') return; else exit(0); } /* ************************************************************** */ /* PRIVATE USER INTERFACE FUNCTIONS */ /* ************************************************************** */ int CVICALLBACK movexui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: movex_exit(); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_move_abs(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MOVEXPAN_NUM_MOVE_ABS, &x_pos); movex_abs_stage_move(x_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_move_rel(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_rel; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MOVEXPAN_NUM_MOVE_REL, &x_rel); movex_rel_stage_move(x_rel); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_get_pos(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos; switch (event) { case EVENT_COMMIT: movex_get_stage_pos(&x_pos); SetCtrlVal(panel, MOVEXPAN_NUM_READ_X_POS, x_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_move_2_abs(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MOVEXPAN_NUM_MOVE_2_ABS, &x_pos); movex_abs_2_stage_move(x_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_move_2_rel(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_rel; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MOVEXPAN_NUM_MOVE_2_REL, &x_rel); movex_rel_2_stage_move(x_rel); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_get_2_pos(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos, xs_pos; switch (event) { case EVENT_COMMIT: movex_get_2_stage_pos(&x_pos, &xs_pos); SetCtrlVal(panel, MOVEXPAN_NUM_READ_X_2_POS, x_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos, xs_pos; switch (event) { case EVENT_COMMIT: movex_zero(); movex_get_stage_pos(&x_pos); SetCtrlVal(panel, MOVEXPAN_NUM_READ_X_POS, x_pos); SetCtrlVal(panel, MOVEXPAN_NUM_READ_X_2_POS, x_pos); break; case EVENT_RIGHT_CLICK: break; } return 0; }