/* ************************************************************** */ /* * Module MOVEXYUI * This module contains functions for the MOVEXY * user interface. * * Zachary Wolf * 12/19/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "movexyuir.h" #include "movexyui.h" #include "movexy.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int movexy_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONSS */ void movexyui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * movexyui_init * This function initializes the user interface for MOVEXY. * * Zachary Wolf * 12/19/00 */ void movexyui_init(void) { /* Open the MOVEXY panel */ movexy_panel = LoadPanel(0, "movexyuir.uir", MOVEXYPAN); if (movexy_panel < 0) { movexyui_error("Could not open user interface panel"); return; } /* Display the panel when the user interface runs */ DisplayPanel(movexy_panel); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * movexyui_error * This function handles error messages for the MOVEXY user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 8/26/98 */ void movexyui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nMOVEXYUI 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 movexyui_quit(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { switch (event) { case EVENT_COMMIT: movexy_exit(); QuitUserInterface(0); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexyui_move(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos, y_pos; switch (event) { case EVENT_COMMIT: GetCtrlVal(panel, MOVEXYPAN_NUM_MOVE_X_POS, &x_pos); GetCtrlVal(panel, MOVEXYPAN_NUM_MOVE_Y_POS, &y_pos); movexy_abs_move(x_pos, y_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexyui_get_pos(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos, y_pos; switch (event) { case EVENT_COMMIT: movexy_get_pos(&x_pos, &y_pos); SetCtrlVal(panel, MOVEXYPAN_NUM_READ_X_POS, x_pos); SetCtrlVal(panel, MOVEXYPAN_NUM_READ_Y_POS, y_pos); break; } return 0; } /* ************************************************************** */ int CVICALLBACK movexyui_zero(int panel, int control, int event, void *callbackData, int eventData1, int eventData2) { double x_pos, y_pos; switch (event) { case EVENT_COMMIT: movexy_zero(); movexy_get_pos(&x_pos, &y_pos); SetCtrlVal(panel, MOVEXYPAN_NUM_READ_X_POS, x_pos); SetCtrlVal(panel, MOVEXYPAN_NUM_READ_Y_POS, y_pos); break; case EVENT_RIGHT_CLICK: break; } return 0; }