/* ************************************************************** */ /* * Module BHVSXYUI * This module contains functions for the Hall probe map * user interface. * * Zachary Wolf * 12/18/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "bhall vs xy uir.h" #include "bhall vs xy ui.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int bhvsxy_panel; static int bhvsxy_num_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONS */ void bhvsxyui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * bhvsxyui_init * This function initializes the user interface for the Bhall vs Z system. * * Input: * top_pos, vertical position of top left panel corner in screen coordinates * left_pos, horizontal position of top left panel corner in screen coordinates * * Zachary Wolf * 12/18/00 */ void bhvsxyui_init(int top_pos, int left_pos) { /* Open the Bhall vs xy panel */ bhvsxy_panel = LoadPanel(0, "bhall vs xy uir.uir", BHVSXYPAN); if (bhvsxy_panel < 0) { bhvsxyui_error("Could not open user interface panel"); return; } /* Set the panel position */ SetPanelPos(bhvsxy_panel, top_pos, left_pos); /* Display the panel */ DisplayPanel(bhvsxy_panel); /* Open the Bhall vs xy numbers panel */ bhvsxy_num_panel = LoadPanel(0, "bhall vs xy uir.uir", NUMPAN); if (bhvsxy_num_panel < 0) { bhvsxyui_error("Could not open user interface panel"); return; } /* Set the panel position */ SetPanelPos(bhvsxy_num_panel, top_pos, left_pos + 325 + 10); /* Display the panel */ DisplayPanel(bhvsxy_num_panel); /* Done */ return; } /* ************************************************************** */ /* * bhvsxyui_scale_horiz_axis * This function sets the scale on the horizontal axis of the * Bhall vs X graph. * * Input: * num_x_pos, number of x positions * x_pos[0 to num_x_pos - 1], x positions * * Zachary Wolf * 12/18/00 */ void bhvsxyui_scale_horiz_axis(int num_x_pos, double x_pos[]) { /* Declare variables */ double x_min, x_max; int min_index, max_index; /* Determine the minimum and maximum x positions */ MaxMin1D(x_pos, num_x_pos, &x_max, &max_index, &x_min, &min_index); x_min = x_min - .01; x_max = x_max + .01; /* Set the horizontal scale of the Bhall vs X plot */ SetAxisRange(bhvsxy_panel, BHVSXYPAN_GRAPH_B_VS_X, VAL_MANUAL, x_min, x_max, VAL_AUTOSCALE, 0., 0.); /* Done */ return; } /* ************************************************************** */ void bhvsxyui_update_meas(int x_meas_num, int y_meas_num, double xpos, double ypos, double imag, double Bhall) { /* Declare variables */ char values_string[100]; int color; /* Plot the B vs X sample */ if (y_meas_num%3 == 1) color = VAL_RED; else if (y_meas_num%3 == 2) color = VAL_GREEN; else if (y_meas_num%3 == 0) color = VAL_BLUE; PlotPoint(bhvsxy_panel, BHVSXYPAN_GRAPH_B_VS_X, xpos, Bhall, VAL_SOLID_SQUARE, color); /* Write the values */ sprintf(values_string, "%3i %3i %6.3f %6.3f %7.2f %8.5f\n", x_meas_num, y_meas_num, xpos, ypos, imag, Bhall); SetCtrlVal(bhvsxy_num_panel, NUMPAN_TEXTBOX_NUM, values_string); /* Done */ return; } /* ************************************************************** */ void bhvsxyui_clear_plot(void) { /* Remove previous plot */ DeleteGraphPlot(bhvsxy_panel, BHVSXYPAN_GRAPH_B_VS_X, -1, VAL_IMMEDIATE_DRAW); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * bhvsxyui_error * This function handles error messages for the BLwire user interface. * * Input: * message, string to display in standard I/O * * Zachary Wolf * 9/18/98 */ void bhvsxyui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nBHVSXYUI 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); }