/* ************************************************************** */ /* * Module BHVSZUI * This module contains functions for the Hall probe map * user interface. * * Zachary Wolf * 2/21/00 */ /* ************************************************************** */ /* INCLUDES */ #include #include #include #include /* Needed if linking in external compiler; harmless otherwise */ #include #include "bhall vs z uir.h" #include "bhall vs z ui.h" /* ************************************************************** */ /* PRIVATE VARIABLES */ static int bhvsz_panel; static int bhvsz_num_panel; /* ************************************************************** */ /* PRIVATE FUNCTION DECLARATIONS */ void bhvszui_error(char* msg); /* ************************************************************** */ /* PUBLIC FUNCTIONS */ /* ************************************************************** */ /* * bhvszui_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 * 2/21/00 */ void bhvszui_init(int top_pos, int left_pos) { /* Open the Bhall vs z panel */ bhvsz_panel = LoadPanel(0, "bhall vs z uir.uir", BHVSZPAN); if (bhvsz_panel < 0) { bhvszui_error("Could not open user interface panel"); return; } /* Set the panel position */ SetPanelPos(bhvsz_panel, top_pos, left_pos); /* Display the panel */ DisplayPanel(bhvsz_panel); /* Open the Bhall vs z numbers panel */ bhvsz_num_panel = LoadPanel(0, "bhall vs z uir.uir", NUMPAN); if (bhvsz_num_panel < 0) { bhvszui_error("Could not open user interface panel"); return; } /* Set the panel position */ SetPanelPos(bhvsz_num_panel, top_pos, left_pos + 325 + 10); /* Display the panel */ DisplayPanel(bhvsz_num_panel); /* Done */ return; } /* ************************************************************** */ /* * bhvszui_scale_horiz_axis * This function sets the scale on the horizontal axis of the * Bhall vs Z graph. * * Input: * num_z_pos, number of z positions * z_pos[0 to num_z_pos - 1], z positions * * Zachary Wolf * 2/21/00 */ void bhvszui_scale_horiz_axis(int num_z_pos, double z_pos[]) { /* Declare variables */ double z_min, z_max; int min_index, max_index; /* Determine the minimum and maximum z positions */ MaxMin1D(z_pos, num_z_pos, &z_max, &max_index, &z_min, &min_index); z_min = z_min - .01; z_max = z_max + .01; /* Set the horizontal scale of the Bhall vs Z plot */ SetAxisRange(bhvsz_panel, BHVSZPAN_GRAPH_B_VS_Z, VAL_MANUAL, z_min, z_max, VAL_AUTOSCALE, 0., 0.); /* Done */ return; } /* ************************************************************** */ void bhvszui_update_meas(int meas_num, double zpos, double imag, double Bhall) { /* Declare variables */ char values_string[100]; /* Plot the B vs Z sample */ PlotPoint(bhvsz_panel, BHVSZPAN_GRAPH_B_VS_Z, zpos, Bhall, VAL_SOLID_SQUARE, VAL_RED); /* Write the values */ sprintf(values_string, "%4i %7.4f %9.3f %9.5f\n", meas_num, zpos, imag, Bhall); SetCtrlVal(bhvsz_num_panel, NUMPAN_TEXTBOX_NUM, values_string); /* Done */ return; } /* ************************************************************** */ void bhvszui_clear_plot(void) { /* Remove previous plot */ DeleteGraphPlot(bhvsz_panel, BHVSZPAN_GRAPH_B_VS_Z, -1, VAL_IMMEDIATE_DRAW); /* Done */ return; } /* ************************************************************** */ /* PRIVATE FUNCTIONS */ /* ************************************************************** */ /* * bhvszui_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 bhvszui_error(char* message) { /* Declare variables */ char buf[80]; /* Notify the operator of the error */ printf("\nBHVSZUI 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); }