home *** CD-ROM | disk | FTP | other *** search
/ The World of Computer Software / World_Of_Computer_Software-02-385-Vol-1of3.iso / x / xprism.zip / xprism / src / xprism3 / xp3_main.c < prev    next >
C/C++ Source or Header  |  1992-09-30  |  54KB  |  1,752 lines

  1.  /*
  2.   * Khoros: $Id: xp3_main.c,v 1.4 1992/03/20 22:41:50 dkhoros Exp $
  3.   */
  4.  
  5. #if !defined(lint) && !defined(SABER)
  6. static char rcsid[] = "Khoros: $Id: xp3_main.c,v 1.4 1992/03/20 22:41:50 dkhoros Exp $";
  7. #endif
  8.  
  9.  /*
  10.   * $Log: xp3_main.c,v $
  11.  * Revision 1.4  1992/03/20  22:41:50  dkhoros
  12.  * VirtualPatch5
  13.  *
  14.   */ 
  15.  
  16. /*
  17.  *----------------------------------------------------------------------
  18.  *
  19.  * Copyright 1990, University of New Mexico.  All rights reserved.
  20.  * 
  21.  * Permission to copy and modify this software and its documen-
  22.  * tation only for internal use in your organization is hereby
  23.  * granted, provided that this notice is retained thereon and
  24.  * on all copies.  UNM makes no representations as too the sui-
  25.  * tability and operability of this software for any purpose.
  26.  * It is provided "as is" without express or implied warranty.
  27.  * 
  28.  * UNM DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
  29.  * INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FIT-
  30.  * NESS.  IN NO EVENT SHALL UNM BE LIABLE FOR ANY SPECIAL,
  31.  * INDIRECT OR CONSEQUENTIAL DAMAGES OR ANY OTHER DAMAGES WHAT-
  32.  * SOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER
  33.  * IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
  34.  * ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PER-
  35.  * FORMANCE OF THIS SOFTWARE.
  36.  * 
  37.  * No other rights, including for example, the right to redis-
  38.  * tribute this software and its documentation or the right to
  39.  * prepare derivative works, are granted unless specifically
  40.  * provided in a separate license agreement.
  41.  *----------------------------------------------------------------------
  42.  */
  43.  
  44. #include "unmcopyright.h"     /* Copyright 1990 by UNM */
  45. #include "xprism3.h"
  46.  
  47.  
  48. /* >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<
  49.    >>>>                                                       <<<<
  50.    >>>>     file name: xp3_main.c
  51.    >>>>
  52.    >>>>   description: Main Driver for 3D plotting package xprism2
  53.    >>>>
  54.    >>>>      routines:
  55.    >>>>                 main()
  56.    >>>>                 set_gwin_attr_3D()
  57.    >>>>                 start_cmd_plot_3D()
  58.    >>>>                 change_xprism3_forms()
  59.    >>>>
  60.    >>>>
  61.    >>>>                                                       <<<<
  62.    >>>>>>>>>>>>>>>>>>>>>>>>>>>>> <<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<<< */
  63.  
  64.  
  65.  
  66. /******************************************************************
  67. *                                                                  
  68. *                                                                  
  69. *     >>>>>>>>>>>           M A I N           <<<<<<<<<<<<             
  70. *                                                                  
  71. *                                                                  
  72. ********************************************************************/
  73.  
  74. main(argc, argv)
  75.  
  76. int    argc;
  77. char    *argv[];
  78. {
  79.  
  80.  
  81.         xprism3_struct *xprism3_args;
  82.     xvf_form *form_master; 
  83.  
  84.     Master   master;
  85.     char     *mesg, *filename; 
  86.     Widget   *create_perspective_sel_bar();
  87.     int       i, marker_type, line_type, did_overlays = false;
  88.         int       whichband, cmplx, num_active;
  89.     XObject   *tmp_list;
  90.     Arg        arg[MaxArgs];
  91.     unsigned long pixel;
  92.     float     update;
  93.  
  94.  
  95.     /*
  96.      *  Xprism3 startup
  97.      */
  98.  
  99.     program = VStrcpy(argv[0]);
  100.     ac = argc;
  101.     av = argv;
  102.  
  103.     khoros_init();
  104.         PROG_NAME = xvf_strcpy(program);
  105.  
  106.         xprism3_args = (xprism3_struct *)
  107.                        calloc((unsigned)1, (unsigned)sizeof(xprism3_struct));
  108.         init_xprism3(TRUE, -1, xprism3_args);
  109.         consolidate_args();
  110.  
  111.     /* initialize the display and the forms */
  112.     display = xvf_initialize(ac, av, program);
  113.     if (display == NULL)         /* If an error on the open */
  114.     {
  115.        mesg = xvf_strcpy("Could not open connection to server\n");
  116.        fprintf(stderr,"\nxprism:\n\t%s.\n",mesg);
  117.        free(mesg);
  118.        khoros_close();
  119.     }
  120.     xve_init();
  121.     
  122.  
  123.     /* see if the display is monochrome & set flag accordingly */
  124.         if ( XDisplayPlanes(display, screen) > 1)
  125.            mono_display = false;
  126.         else
  127.            mono_display = true;
  128.  
  129.  
  130.         /* various & sundry global initializations */
  131.         gwin = NULL;
  132.         (void) set_global_indir(xprism3_args->indir);
  133.         (void) set_global_outdir(xprism3_args->outdir);
  134.         gwin_attr = (VPGraphicsWindowAttributes *)
  135.                     malloc (sizeof (VPGraphicsWindowAttributes));
  136.  
  137.         set_gwin_attr_3D(xprism3_args);
  138.  
  139.     /* initialize colors for plots       */
  140.     X3D_allocate_named_colors(display, colornames, Colors, PLOT_COLORNUM,
  141.                                   false, X3D_WHITE);
  142.     X3D_allocate_predefined_colors(display, contour_colors, 
  143.                        CONTOUR_COLORNUM, false, X3D_WHITE);
  144.  
  145.  
  146.     rootwindow = XDefaultRootWindow(display);
  147.  
  148.         /* create the Forms */
  149.     if (!(form_master = xvf_create_form(xprism3_args->form_file, av, ac, 
  150.                             SIMPLE, NULL, -1, -1)))
  151.     {
  152.         khoros_close();
  153.     }
  154.  
  155.     /*
  156.      *  initialize the xprism information structure 
  157.      *  Note this is done AFTER call to xvf_create_form
  158.      */
  159.  
  160.     _xvf_init_Master(form_master, &master);
  161.  
  162.         change_xprism3_forms(form_master, xprism3_args, &master);
  163.  
  164.         /*
  165.          * set the workspace canvas, and give it a black background
  166.          */
  167.  
  168.         _xvf_get_Master(form_master, &master);
  169.  
  170.         i = 0;
  171.         pixel = BlackPixel(display, DefaultScreen(display));
  172.         XtSetArg(arg[i],XtNbackground, pixel);                     i++;
  173.         XtSetArg(arg[i],XtNwidth, 512);                         i++;
  174.         XtSetArg(arg[i],XtNheight, 512);                        i++;
  175.         XtSetArg(arg[i],XtNhorizDistance, 3);                   i++;
  176.         XtSetArg(arg[i],XtNvertDistance, 3);                    i++;
  177.         XtSetArg(arg[i],XtNborderWidth, 0);                     i++;
  178.         canvas = XtCreateManagedWidget("canvas", simpleWidgetClass,
  179.                         master.canvas, arg, i);
  180.  
  181.         if ( xprism3_args->plots_specified )
  182.         {
  183.             start_cmd_plot_3D(xprism3_args);
  184.             update_tics(form_master, master.options->tics);
  185.         }
  186.  
  187.     if (gwin != NULL)
  188.         {
  189.             if (xprism3_args->annotation_in_file != NULL)
  190.             {
  191.                   filename = vfullpath(xprism3_args->annotation_in_file,
  192.                       global_indir, NULL);
  193.                   if (tmp_list = read_overlays(canvas, filename))
  194.                      obj_list = tmp_list;
  195.                   free(filename);
  196.                   did_overlays = true;
  197.              }
  198.         }
  199.  
  200.      /*  create but not map the selection bar widget used for
  201.      *  changing the perspective
  202.      */
  203.  
  204.     persp_toplevel =  create_perspective_sel_bar();
  205.  
  206.     /* turn off "Colors" pane if on monochrome screen */
  207.     if (mono_display == true)
  208.     {
  209.              /* turn off "Colors" pane */
  210.              xvf_change_input(form_master,
  211.                               master.options->colors_gb_index,
  212.                               xvf_activation_chng, "0", 0);
  213.         }
  214.  
  215.  
  216.     /*
  217.          * map the master form
  218.          */
  219.  
  220.         xvf_change_active(form_master,true);
  221.  
  222.  
  223.     /*
  224.      *  start up the forms here 
  225.      */
  226.     do
  227.     {
  228.        /*
  229.         *  get the form information structure indicating
  230.         * selections & and input provided by the user
  231.         */
  232.        form_master = xvf_run_form();
  233.        if (form_master == NULL) break;
  234.  
  235.        _xvf_get_Master(form_master, &master);
  236.  
  237.        if (master.quit) ;
  238.  
  239.        else if (master.info)
  240.        {
  241.           if (gwin != NULL)
  242.           {
  243.              plot_information();
  244.           }
  245.           else
  246.           {
  247.               mesg = xvf_strcpy("Please use Xprism to create a graphics workspace\n");
  248.           xvf_error_wait(mesg, "Main", NULL);
  249.           free(mesg);
  250.           }
  251.        }
  252.          /* allow the user to hide plots */
  253.            else if (master.hide)
  254.            {
  255.               if (gwin != NULL)
  256.           {
  257.                  hide_plots(&num_active);
  258.          if (num_active > 0)
  259.          {
  260.  
  261. /* CLIPPING: remove comments when clipping has been done
  262.  
  263.                      mesg = xvf_strcpy("Do you want to RESET the Min/Max of the Plot Area?\n This will reset the Min/Max for the currently displayed plots");
  264.                      if (xvf_warn_wait(mesg, "RESET AXES", "YES","NO"))
  265.                      {
  266.                 find_wc_min_max();
  267.                     reset_world_coordinates();
  268.              }
  269.              free(mesg);
  270. CLIPPING: remove comments when clipping has been done */
  271.  
  272. /* CLIPPING: delete the following 2 lines when clipping is installed */
  273.              find_wc_min_max();
  274.                      reset_world_coordinates();
  275.          }
  276.  
  277.              update_tics(form_master, master.options->tics);
  278.              plot_routine();
  279.           }
  280.               else
  281.                   xvf_error_wait(" No plots available to hide!\n",
  282.                                  "Xprism Error", NULL);
  283.            }
  284.  
  285.              /* allow the user to delete plots */
  286.            else if (master.delete)
  287.            {
  288.               if (gwin != NULL)
  289.           {
  290.                  delete_plots();
  291.  
  292.          if (gwin != NULL)
  293.          {
  294.  
  295. /* CLIPPING: delete the following 2 lines when clipping is installed */
  296.             find_wc_min_max();
  297.                     reset_world_coordinates();
  298.  
  299. /* CLIPPING: remove comment when clipping has been done
  300.                     mesg = xvf_strcpy("Do you want to RESET the Min/Max of the Plot Area?\n This will reset the Min/Max for the currently displayed plots");
  301.                     if (xvf_warn_wait(mesg, "RESET AXES", "YES","NO"))
  302.                     {
  303.                find_wc_min_max();
  304.                    reset_world_coordinates();
  305.             }
  306.             free(mesg);
  307. CLIPPING: remove comment when clipping has been done */
  308.  
  309.                 update_tics(form_master, master.options->tics);
  310.                 plot_routine();
  311.              }
  312.          else
  313.          {
  314.             for (i = 0; i< MAX_PLOTS; i++)
  315.             {
  316.               xvp_delete_detect_file(update_id[i]);
  317.               update_id[i] = 0;
  318.             }
  319.          }
  320.           }
  321.               else
  322.                   xvf_error_wait(" No plots available to delete!\n",
  323.                                   "Xprism Error", NULL);
  324.            }
  325.                /* refresh the plot area */
  326.            else if (master.refresh)
  327.            {
  328.               if (gwin != NULL)
  329.                   plot_routine();
  330.               else
  331.                   xvf_error_wait(" Nothing displayed to refresh!\n",
  332.                                  "Xprism Error", NULL);
  333.            }
  334.               /* clear the workspace */
  335.            else if (master.clear)
  336.            {
  337.                if (gwin != NULL)
  338.                {
  339.                    freegwin();
  340.                    gwin = NULL;
  341.            for (i = 0; i< MAX_PLOTS; i++)
  342.            {
  343.              xvp_delete_detect_file(update_id[i]);
  344.              update_id[i] = 0;
  345.            }
  346.                }
  347.                else
  348.                    xvf_error_wait("No workspace to clear!\n",
  349.                                   "xprism_input", NULL);
  350.            }
  351.            else if (master.perspective) /* change perspective */
  352.        {
  353.              if (gwin != NULL)
  354.              {
  355.                 display_diagram();
  356.                 XtMapWidget(*persp_toplevel);
  357.              }
  358.          else
  359.          {
  360.                   xvf_error_wait("No plots available to change perspective on!",
  361.                                   "Xprism Error", NULL);
  362.          }
  363.            }
  364.            else if (master.reset_axes) /* change perspective */
  365.        {
  366.              if (gwin != NULL)
  367.              {
  368.             find_wc_min_max();
  369.                 reset_world_coordinates();
  370.             update_tics(form_master, master.options->tics);
  371.             plot_routine();
  372.              }
  373.          else
  374.          {
  375.                   xvf_error_wait("No plots available to reset axes for!",
  376.                                   "Xprism Error", NULL);
  377.          }
  378.            }
  379.  
  380.  
  381.        else if (master.xprism_selected)
  382.        {
  383.                 marker_type = xprism3_args->marker_type;
  384.  
  385.                 line_type = xprism3_args->line_type;
  386.  
  387.                 whichband = xprism3_args->whichband;
  388.  
  389.                 cmplx = xprism3_args->cmplx;
  390.     
  391.             update = xprism3_args->update;
  392.  
  393.         run_xprism_3D(form_master, master.xprism,
  394.                   marker_type, line_type, whichband, cmplx, update);
  395.  
  396.         if (gwin != NULL)
  397.         {
  398.                update_tics(form_master, master.options->tics);
  399.  
  400.            if ((xprism3_args->annotation_in_file != NULL) &&
  401.                       !(did_overlays))
  402.                    {
  403.                        filename = vfullpath(xprism3_args->annotation_in_file,
  404.                         global_indir, NULL);
  405.                        if (tmp_list = read_overlays(canvas, filename))
  406.                           obj_list = tmp_list;
  407.                        free(filename);
  408.            }
  409.         }
  410.        }
  411.        else if (master.xvoverlay_selected)
  412.               run_xvoverlay(form_master, master.xvoverlay);
  413.  
  414.        else if (master.output_selected)
  415.               run_output(form_master, master.output);
  416.  
  417.        else if (master.answer_selected)
  418.               run_answer(form_master, master.answer, &master, &xprism3_args);
  419.  
  420.        else if (master.options_selected) 
  421.        {
  422.               run_options_3D(form_master, master.options);
  423.        }
  424.  
  425.  
  426.        xvf_clear_selections(form_master->db, form_master->line_num);
  427.  
  428.     } while (!master.quit);
  429.  
  430.  
  431.     /* unmap the workspace, and destroy gwin structure */
  432.     if (gwin != NULL)
  433.     {
  434.        freegwin(); 
  435.     }
  436.     XSync(display, 0); XCloseDisplay(display); 
  437.     khoros_close();
  438.  
  439. } /* end main */
  440.  
  441.  
  442.  
  443. /**************************************************************
  444. *
  445. * MODULE NAME: set_gwin_attr_3D
  446. *
  447. *     PURPOSE: This module is get graphics workspace attributes
  448. *        for xprism3 from command line arguments, and set
  449. *        them in the gwin_attr struct
  450. *
  451. *       INPUT: - arguments to xprism3
  452. *
  453. *      OUTPUT: plot(s) displayed as specified
  454. *
  455. * CALLED FROM: main
  456. *
  457. **************************************************************/
  458.  
  459. set_gwin_attr_3D(xprism3_args)
  460. xprism3_struct *xprism3_args;
  461.  
  462. {
  463.   xp3_area_info_struct *area_info;
  464.  
  465.   int  plot_area;
  466.   char     *title, *xaxis, *yaxis, *zaxis;
  467.   int       axes, grid, auto_scale, legend, box, rescale_relabel,
  468.         fonts[6], colors[MAX_COLORS], numlabels, machtype, clear_labels;
  469.   Coord     scale, tics;
  470.   Real  alpha, theta, eye_dist, view_dist;
  471.  
  472.  
  473.   for ( plot_area = 1 ; plot_area <= xprism3_args->number_areas ; plot_area++ )
  474.   {
  475.      area_info = xprism3_args->area_info[plot_area - 1];
  476.  
  477.      if ( area_info != NULL )
  478.      {
  479.     /* initialize fonts */
  480.     fonts[TITLE] = area_info->title_font;
  481.     fonts[XAXIS] = area_info->xaxis_font;
  482.     fonts[YAXIS] = area_info->yaxis_font;
  483.         fonts[ZAXIS] = area_info->zaxis_font;
  484.     fonts[LEGEND]= area_info->legend_font;
  485.     fonts[NUMBERS] = area_info->numbers_font;
  486.  
  487.     /* set labels according to cmd line or default */
  488.  
  489.     title = xvf_strcpy(area_info->title);
  490.     
  491.     xaxis = xvf_strcpy(area_info->xaxis);
  492.  
  493.     yaxis = xvf_strcpy(area_info->yaxis);
  494.  
  495.     zaxis = xvf_strcpy(area_info->zaxis);
  496.  
  497.     /* set colors for labels, axes, grid, etc */
  498.     colors[TITLE_COLOR]  = area_info->title_color;
  499.     colors[XTITLE_COLOR] = area_info->xaxis_label_color;
  500.     colors[YTITLE_COLOR] = area_info->yaxis_label_color;
  501.     colors[ZTITLE_COLOR] = area_info->zaxis_label_color;
  502.     colors[XAXIS_COLOR]  = area_info->xaxis_color;
  503.     colors[YAXIS_COLOR]  = area_info->yaxis_color;
  504.     colors[ZAXIS_COLOR]  = area_info->zaxis_color;
  505.     colors[XNUMS_COLOR]  = area_info->num_xaxis_color;
  506.     colors[YNUMS_COLOR]  = area_info->num_yaxis_color;
  507.     colors[ZNUMS_COLOR]  = area_info->num_zaxis_color;
  508.     colors[GRID_COLOR]   = area_info->grid_color;
  509.     colors[LEGEND_COLOR] = area_info->legend_color;
  510.  
  511.         /* set box for axes */
  512.     box = area_info->box;
  513.  
  514.         /* set machine type for axes */
  515.     machtype = area_info->machine_type;
  516.  
  517.         /* set numerical labels for axes */
  518.     numlabels = area_info->numerical_labels;
  519.  
  520.         /* set axes or rescaling by default */
  521.     rescale_relabel = area_info->rescale_relabel;
  522.  
  523.         /* set the clear_labels flag to false */
  524.     clear_labels = area_info->clear_labels;
  525.  
  526.     /* set axes  */
  527.     axes = area_info->axes;
  528.  
  529.     /* set legend  */
  530.     legend = area_info->legend;
  531.  
  532.     /* set grid  */
  533.     grid = area_info->grid;
  534.  
  535.     /* set auto_scale  */
  536.     auto_scale = area_info->auto_scale;
  537.  
  538.     /* set scale  */
  539. /* all axes scale code is commented out until it can be reworked
  540.     scale.x = area_info->scale.x;
  541.     scale.y = area_info->scale.y;
  542.     scale.z = area_info->scale.z;
  543. */
  544.  
  545.     scale.x = 0;
  546.     scale.y = 0;
  547.     scale.z = 0;
  548.  
  549.         /* set minor tics */
  550.     tics.x = area_info->x_tics;
  551.     tics.y = area_info->y_tics;
  552.     tics.z = area_info->z_tics;
  553.  
  554.     alpha = (Real) area_info->alpha;
  555.     theta = (Real) area_info->theta;
  556.     eye_dist  =  (Real) area_info->eyedist;
  557.     view_dist = (Real) area_info->viewdist;
  558.  
  559.     init_gwin_attr( 1, title, xaxis, yaxis, zaxis, grid, auto_scale, axes,
  560.             box, legend, scale, fonts, colors, tics, numlabels,
  561.             rescale_relabel, machtype, clear_labels, alpha, theta,
  562.             eye_dist, view_dist, xprism3_args->update);
  563.  
  564.     free(title);
  565.     title = NULL;
  566.  
  567.     free(xaxis);
  568.     xaxis = NULL;
  569.  
  570.     free(yaxis);
  571.     yaxis = NULL;
  572.  
  573.     free(zaxis);
  574.     zaxis = NULL;
  575.     }
  576.   }
  577. }
  578.  
  579. /**************************************************************
  580. *
  581. * MODULE NAME: start_cmd_plot_3D
  582. *
  583. *     PURPOSE: This module is used to start xprism from 
  584. *           input files and/or functions entered as
  585. *           command line arguments 
  586. *
  587. *       INPUT: xprism3_args - arguments to xprism3
  588. *
  589. *      OUTPUT: plot(s) displayed as specified
  590. *
  591. * CALLED FROM: main
  592. *
  593. **************************************************************/
  594.  
  595. start_cmd_plot_3D(xprism3_args)
  596. xprism3_struct *xprism3_args;
  597.  
  598. {
  599.  
  600.   xp3_area_info_struct *area_info;
  601.   xp3_plot_info_struct *plot_info;
  602.  
  603.   float update;
  604.  
  605.   XPlot *plot, *get_input_file(), *get_function();
  606.  
  607.   char *function, temp[512], *xrange, *yrange, error[1024], *mesg;
  608.   int data_format, data_type, first_gwin = TRUE, plot_area, plot_number;
  609.   int nc, nr, i;
  610.  
  611.   for ( plot_area = 1 ; plot_area <= xprism3_args->number_areas ; plot_area++ )
  612.   {
  613.  
  614.     area_info = xprism3_args->area_info[plot_area - 1];
  615.  
  616.     for ( plot_number = 1 ; area_info != NULL &&
  617.       plot_number <= area_info->number_plots ; plot_number++ )
  618.     {
  619.  
  620.       plot_info = area_info->plot_info[plot_number - 1];
  621.  
  622.       if ( plot_info != NULL )
  623.       {
  624.     if ( plot_info->i_file != NULL )
  625.     {
  626.  
  627. /*
  628.    Translate command line representation of data_format to xvplot.
  629. */
  630.         if ( plot_info->data_format == MAX_DATA_FORMAT )
  631.         {
  632.           data_format = Z_ONLY;
  633.         }
  634.         else
  635.         {
  636.           data_format = XYZ_TRIPLES;
  637.         }
  638. /*
  639.    Translate command line representation of data_type to xvplot.
  640. */
  641.         if ( plot_info->data_type == MAX_DATA_TYPE )
  642.         {
  643.           data_type = VFF_TYP_FLOAT;
  644.         }
  645.         else if ( plot_info->data_type == (MAX_DATA_TYPE - 1) )
  646.         {
  647.           data_type = VFF_TYP_4_BYTE;
  648.         }
  649.         else
  650.         {
  651.           data_type = plot_info->data_type;
  652.         }
  653.  
  654.         plot = get_input_file(plot_info->i_file,
  655.                   plot_info->plot_type + 1,
  656.                   data_format, plot_info->machine_type,
  657.                   data_type, plot_info->rows, 
  658.                   plot_info->whichband, plot_info->cmplx);
  659.  
  660.         if (plot == NULL) 
  661.         {
  662.           khoros_close();
  663.         }
  664.  
  665.             if (xprism3_args->update != 0.0)
  666.         {
  667.            for (i = 0; i < MAX_PLOTS; i++) 
  668.              if (update_id[i] == 0) break;
  669.  
  670.                update_id[i] = xvp_detect_file(plot->filename,
  671.             xprism3_args->update, update_file, NULL);
  672.            plot->update_id = update_id[i];
  673.         }
  674.             else
  675.         {
  676.            plot->update_id = 0;
  677.         }
  678.  
  679.             nc = plot->row_size;
  680.             nr = plot->size/plot->row_size;
  681.  
  682.         if (((nc == 1) || (nr == 1)) && 
  683.            (plot->plot_type != PLOT_3D && 
  684.             plot->plot_type != PLOT_SCATTER &&
  685.             plot->plot_type != PLOT_IMPULSE))
  686.         {
  687.         fprintf(stderr,
  688.               "start_cmd_plot_3D: Warning, plot #%d requires at least 2 rows and columns\nfor specified plot type. Resetting plot type to 3D\n",
  689.            plot_number);
  690.         plot->plot_type = PLOT_3D;
  691.         plot_info->plot_type = 0;
  692.         }
  693.         
  694.         
  695.     
  696.             if (plot_info->xend_point > nc            ||
  697.                 plot_info->xbegin_point > nc          ||
  698.                 plot_info->xstep_size > nc            ||
  699.                 (plot_info->xend_point <  plot_info->xbegin_point         &&
  700.                  plot_info->xend_point > 0 && plot_info->xbegin_point >0) ||
  701.                 plot_info->xstep_size == 0.0            ||
  702.                 plot_info->yend_point > nr            ||
  703.                 plot_info->ybegin_point > nr          ||
  704.                 plot_info->ystep_size > nr            ||
  705.                 (plot_info->yend_point <  plot_info->ybegin_point         &&
  706.                  plot_info->yend_point > 0 && plot_info->ybegin_point >0) ||
  707.                 plot_info->ystep_size == 0.0)
  708.             {
  709.                  freeplot(plot);
  710.                  mesg = xvf_strcpy("The Begin point, End point or Step Size was specified incorrectly.\n\nPlease check the Begin point, End point and Step Size, and Plot Data again");
  711.                     xvf_error_wait(mesg, "run_input_file", NULL);
  712.                     free(mesg);
  713.             return;
  714.         }
  715.  
  716.     }
  717.     else if ( plot_info->func_str != NULL )
  718.     {
  719.         sprintf(temp, "f(x,y) = %s", plot_info->func_str);
  720.         function = xvf_strcpy(temp);
  721.         sprintf(temp,"x = (%s,%s,%s)", plot_info->func_xmin, 
  722.             plot_info->func_xmax, plot_info->func_xptnum);
  723.         xrange = xvf_strcpy(temp);
  724.         bzero(temp, 512);
  725.         sprintf(temp,"y = (%s,%s,%s)", plot_info->func_ymin, 
  726.             plot_info->func_ymax, plot_info->func_yptnum);
  727.         yrange = xvf_strcpy(temp);
  728.  
  729.         plot = get_function(plot_info->plot_type + 1, 
  730.                 function, xrange, yrange, error);
  731.  
  732.         free(function);
  733.         function = NULL;
  734.  
  735.         free(xrange);
  736.         xrange = NULL;
  737.         free(yrange);
  738.         yrange = NULL;
  739.  
  740.         if (plot == NULL) 
  741.         {
  742.           fprintf(stderr,"%s", error);
  743.           khoros_close();
  744.         }
  745.  
  746.             nc = plot->row_size;
  747.             nr = plot->size/plot->row_size;
  748.  
  749.         if (((nc == 1) || (nr == 1)) && 
  750.            (plot->plot_type != PLOT_3D && 
  751.             plot->plot_type != PLOT_SCATTER &&
  752.             plot->plot_type != PLOT_IMPULSE))
  753.         {
  754.         fprintf(stderr,
  755.               "start_cmd_plot_3D: Warning, plot #%d requires at least 2 rows and columns\nfor specified plot type. Resetting plot type to 3D\n",
  756.            plot_number);
  757.         plot->plot_type = PLOT_3D;
  758.         plot_info->plot_type = 0;
  759.         }
  760.     
  761.             if (plot_info->xend_point > nc            ||
  762.                 plot_info->xbegin_point > nc          ||
  763.                 plot_info->xstep_size > nc            ||
  764.                 (plot_info->xend_point <  plot_info->xbegin_point         &&
  765.                  plot_info->xend_point > 0 && plot_info->xbegin_point >0) ||
  766.                 plot_info->xstep_size == 0.0            ||
  767.                 plot_info->yend_point > nr            ||
  768.                 plot_info->ybegin_point > nr          ||
  769.                 plot_info->ystep_size > nr            ||
  770.                 (plot_info->yend_point <  plot_info->ybegin_point         &&
  771.                  plot_info->yend_point > 0 && plot_info->ybegin_point >0) ||
  772.                 plot_info->ystep_size == 0.0)
  773.             {
  774.                  freeplot(plot);
  775.                  mesg = xvf_strcpy("The Begin point, End point or Step Size was specified incorrectly.\n\nPlease check the Begin point, End point and Step Size, and Plot Data again");
  776.                     xvf_error_wait(mesg, "run_input_file", NULL);
  777.                     free(mesg);
  778.             return;
  779.         }
  780.     }
  781.  
  782.     if ( first_gwin )
  783.     {
  784.         first_gwin = FALSE;
  785.  
  786.         gwin = create_new_gwin(plot, plot_info->plot_type + 1,
  787.                    plot_info->marker_type,
  788.                    plot_info->line_type,
  789.                    plot_info->xstep_size,
  790.                    plot_info->xbegin_point,
  791.                    plot_info->xend_point,
  792.                    plot_info->plot_color,
  793.                    plot_info->ystep_size,
  794.                    plot_info->ybegin_point,
  795.                    plot_info->yend_point,
  796.                    plot_info->legend_str,
  797.                    plot_info->active);
  798.     }
  799.     else
  800.     {
  801.         assign_plot_to_gwin(plot, plot_info->plot_type + 1,
  802.                 plot_info->marker_type,
  803.                 plot_info->line_type,
  804.                 plot_info->xstep_size,
  805.                 plot_info->xbegin_point,
  806.                 plot_info->xend_point,
  807.                 plot_info->plot_color,
  808.                 plot_info->ystep_size,
  809.                 plot_info->ybegin_point,
  810.                 plot_info->yend_point,
  811.                 plot_info->legend_str,
  812.                 plot_info->active);
  813.         reset_world_coordinates();
  814.     }
  815.  
  816.     if (gwin == NULL) 
  817.     {
  818.       fprintf(stderr, "This should not have happened, no user input\n");
  819.       fprintf(stderr, "was specified, but I could of sworn I got some.\n");
  820.       khoros_close();
  821.     }
  822.       }
  823.  
  824.       free(area_info->plot_info[plot_number - 1]);
  825.       area_info->plot_info[plot_number - 1] = NULL;
  826.  
  827.     }
  828.  
  829.  
  830.     if ( area_info->numerical_scale_specified_xmin &&
  831.      area_info->numerical_scale_specified_xmax &&
  832.      area_info->numerical_scale_specified_xint )
  833.     {
  834.       set_gwin_min_max_intv_x(RESCALE, area_info->xmin, area_info->xmax,
  835.                   area_info->major_xint);
  836.     }
  837.  
  838.     if ( area_info->numerical_scale_specified_ymin &&
  839.      area_info->numerical_scale_specified_ymax &&
  840.      area_info->numerical_scale_specified_yint )
  841.     {
  842.       set_gwin_min_max_intv_y(RESCALE, area_info->ymin, area_info->ymax,
  843.                   area_info->major_yint);
  844.     }
  845.     if ( area_info->numerical_scale_specified_zmin &&
  846.      area_info->numerical_scale_specified_zmax &&
  847.      area_info->numerical_scale_specified_zint )
  848.     {
  849.       set_gwin_min_max_intv_z(RESCALE, area_info->zmin, area_info->zmax,
  850.                   area_info->major_zint);
  851.     }
  852.  
  853.     if ( area_info->numerical_relabel_specified_xmin &&
  854.      area_info->numerical_relabel_specified_xmax &&
  855.      area_info->numerical_relabel_specified_xint )
  856.     {
  857.       set_gwin_min_max_intv_x(RELABEL, area_info->xlabel_min,
  858.                   area_info->xlabel_max,
  859.                   area_info->major_xlabel_int);
  860.     }
  861.  
  862.     if ( area_info->numerical_relabel_specified_ymin &&
  863.      area_info->numerical_relabel_specified_ymax &&
  864.      area_info->numerical_relabel_specified_yint )
  865.     {
  866.       set_gwin_min_max_intv_y(RELABEL, area_info->ylabel_min,
  867.                   area_info->ylabel_max,
  868.                   area_info->major_ylabel_int);
  869.     }
  870.  
  871.     if ( area_info->numerical_relabel_specified_zmin &&
  872.      area_info->numerical_relabel_specified_zmax &&
  873.      area_info->numerical_relabel_specified_zint )
  874.     {
  875.       set_gwin_min_max_intv_z(RELABEL, area_info->zlabel_min,
  876.                   area_info->zlabel_max,
  877.                   area_info->major_zlabel_int);
  878.     }
  879.  
  880.  
  881.     free(area_info);
  882.     xprism3_args->area_info[plot_area - 1] = NULL;
  883.  
  884.   }
  885. }
  886.  
  887. /**************************************************************
  888. *
  889. * MODULE NAME: change_xprism3_forms
  890. *
  891. *     PURPOSE: This module is changes values in the xprism3 forms
  892. *           according to command line arguments
  893. *
  894. *       INPUT: xprism3_args - arguments to xprism3
  895. *
  896. *      OUTPUT: plot(s) displayed as specified
  897. *
  898. * CALLED FROM: main
  899. *
  900. **************************************************************/
  901.  
  902. change_xprism3_forms(form, xprism3_args, master)
  903. xvf_form        *form;
  904. xprism3_struct     *xprism3_args;
  905. Master            *master;
  906. {
  907.   xp3_area_info_struct *area_info;
  908.  
  909.   int plot_area;
  910.   char temp[100], *fontstring,  *color;
  911.   char *font_type_string(), *color_string();
  912.     
  913.   for ( plot_area = 1 ; plot_area <= xprism3_args->number_areas ; plot_area++ )
  914.   {
  915.  
  916.     area_info = xprism3_args->area_info[plot_area - 1];
  917.  
  918.     if ( area_info != NULL )
  919.     {
  920. /*
  921.    PLOT SUBFORM INPUT FILE PANE
  922. */
  923.  
  924. /* for begin X points */
  925.     sprintf(temp, "%d", area_info->xbegin_point);
  926.     xvf_change_input(form, master->xprism->input_file->begin_point_x_index,
  927.              xvf_intval_chng, temp, 0);
  928.       xvf_change_input(form,master->xprism->input_function->begin_point_x_index,
  929.              xvf_intval_chng, temp, 0);
  930.     xvf_change_input(form, master->options->attributes->begin_point_x_index,
  931.              xvf_intval_chng, temp, 0);
  932.     master->xprism->input_file->begin_point_x = area_info->xbegin_point;
  933.     master->xprism->input_function->begin_point_x = area_info->xbegin_point;
  934.     master->options->attributes->begin_point_x = area_info->xbegin_point;
  935.  
  936. /* for begin Y points */
  937.     sprintf(temp, "%d", area_info->ybegin_point);
  938.     xvf_change_input(form, master->xprism->input_file->begin_point_y_index,
  939.              xvf_intval_chng, temp, 0);
  940.       xvf_change_input(form,master->xprism->input_function->begin_point_y_index,
  941.              xvf_intval_chng, temp, 0);
  942.     xvf_change_input(form, master->options->attributes->begin_point_y_index,
  943.              xvf_intval_chng, temp, 0);
  944.     master->xprism->input_file->begin_point_y = area_info->ybegin_point;
  945.     master->xprism->input_function->begin_point_y = area_info->ybegin_point;
  946.     master->options->attributes->begin_point_y = area_info->ybegin_point;
  947.  
  948.  
  949. /* for end X points */
  950.     sprintf(temp, "%d", area_info->xend_point);
  951.     xvf_change_input(form,master->xprism->input_file->end_point_x_index,
  952.              xvf_intval_chng, temp, 0);
  953.     xvf_change_input(form,master->xprism->input_function->end_point_x_index,
  954.              xvf_intval_chng, temp, 0);
  955.     xvf_change_input(form,master->options->attributes->end_point_x_index,
  956.              xvf_intval_chng, temp, 0);
  957.     master->xprism->input_file->end_point_x = area_info->xend_point;
  958.     master->xprism->input_function->end_point_x = area_info->xend_point;
  959.     master->options->attributes->end_point_x = area_info->xend_point;
  960.  
  961.  
  962. /* for end Y points */
  963.     sprintf(temp, "%d", area_info->yend_point);
  964.     xvf_change_input(form,master->xprism->input_file->end_point_y_index,
  965.              xvf_intval_chng, temp, 0);
  966.     xvf_change_input(form,master->xprism->input_function->end_point_y_index,
  967.              xvf_intval_chng, temp, 0);
  968.     xvf_change_input(form,master->options->attributes->end_point_y_index,
  969.              xvf_intval_chng, temp, 0);
  970.     master->xprism->input_file->end_point_y = area_info->yend_point;
  971.     master->xprism->input_function->end_point_y = area_info->yend_point;
  972.     master->options->attributes->end_point_y = area_info->yend_point;
  973.  
  974.  
  975. /* for stepsize X points */
  976.     sprintf(temp, "%d", area_info->xstep_size);
  977.     xvf_change_input(form, master->xprism->input_file->step_size_x_index,
  978.              xvf_intval_chng, temp, 0);
  979.     xvf_change_input(form,master->xprism->input_function->step_size_x_index,
  980.              xvf_intval_chng, temp, 0);
  981.     xvf_change_input(form, master->options->attributes->step_size_x_index,
  982.              xvf_intval_chng, temp, 0);
  983.     master->xprism->input_file->step_size_x = area_info->xstep_size;
  984.     master->xprism->input_function->step_size_x = area_info->xstep_size;
  985.     master->options->attributes->step_size_x = area_info->xstep_size;
  986.  
  987. /* for stepsize Y points */
  988.     sprintf(temp, "%d", area_info->ystep_size);
  989.     xvf_change_input(form, master->xprism->input_file->step_size_y_index,
  990.              xvf_intval_chng, temp, 0);
  991.     xvf_change_input(form,master->xprism->input_function->step_size_y_index,
  992.              xvf_intval_chng, temp, 0);
  993.     xvf_change_input(form, master->options->attributes->step_size_y_index,
  994.              xvf_intval_chng, temp, 0);
  995.     master->xprism->input_file->step_size_y = area_info->ystep_size;
  996.     master->xprism->input_function->step_size_y = area_info->ystep_size;
  997.     master->options->attributes->step_size_y = area_info->ystep_size;
  998.  
  999.   /* change the plot type toggle */
  1000.     sprintf(temp, "%d", area_info->plot_type + 1);
  1001.     xvf_change_input(form,
  1002.              master->xprism->input_file->change_plot_type_index,
  1003.              xvf_toggleval_chng, temp, 0);
  1004.     xvf_change_input(form,
  1005.              master->xprism->input_function->change_plot_type_index,
  1006.              xvf_toggleval_chng, temp, 0);
  1007.     xvf_change_input(form,
  1008.              master->options->attributes->change_plot_type_index,
  1009.              xvf_toggleval_chng, temp, 0);
  1010.     master->xprism->input_file->change_plot_type_val =
  1011.         area_info->plot_type + 1;
  1012.     master->xprism->input_function->change_plot_type_val =
  1013.         area_info->plot_type + 1;
  1014.     master->options->attributes->change_plot_type_val =
  1015.         area_info->plot_type + 1;
  1016.  
  1017.     sprintf(temp, "%d", area_info->data_format);
  1018.     xvf_change_input(form, master->xprism->input_file->data_format_index,
  1019.              xvf_toggleval_chng, temp, 0);
  1020.     master->xprism->input_file->data_format_val = area_info->data_format;
  1021.  
  1022.     sprintf(temp, "%d", area_info->data_type);
  1023.     xvf_change_input(form, master->xprism->input_file->data_type_index,
  1024.              xvf_toggleval_chng, temp, 0);
  1025.     master->xprism->input_file->data_type_val = area_info->data_type;
  1026.  
  1027.     xvf_change_input(form,
  1028.              master->xprism->input_file->machine_type_index + 1,
  1029.              xvf_title_chng,
  1030.              machine_defs[area_info->machine_type].hosttype, 20);
  1031.  
  1032. /*
  1033.    PLOT SUBFORM INPUT FUNCTION PANE
  1034. */
  1035.  
  1036. /* take care of X values */
  1037.     sprintf(temp, "%s", area_info->func_xmin);
  1038.     xvf_change_input(form, master->xprism->input_function->x_min_index,
  1039.            xvf_stringval_chng, temp, 0);
  1040.     master->xprism->input_function->x_min =
  1041.         xvf_strcpy(area_info->func_xmin);
  1042.  
  1043.     sprintf(temp, "%s", area_info->func_xmax);
  1044.     xvf_change_input(form, master->xprism->input_function->x_max_index,
  1045.            xvf_stringval_chng, temp, 0);
  1046.     master->xprism->input_function->x_max =
  1047.         xvf_strcpy(area_info->func_xmax);
  1048.  
  1049.     sprintf(temp, "%s", area_info->func_xptnum);
  1050.     xvf_change_input(form, master->xprism->input_function->xnum_pts_index,
  1051.            xvf_stringval_chng, temp, 0);
  1052.     master->xprism->input_function->xnum_pts =
  1053.         xvf_strcpy(area_info->func_xptnum);
  1054.  
  1055. /* Take care of Y values */
  1056.     sprintf(temp, "%s", area_info->func_ymin);
  1057.     xvf_change_input(form, master->xprism->input_function->y_min_index,
  1058.            xvf_stringval_chng, temp, 0);
  1059.     master->xprism->input_function->y_min =
  1060.         xvf_strcpy(area_info->func_ymin);
  1061.  
  1062.     sprintf(temp, "%s", area_info->func_ymax);
  1063.     xvf_change_input(form, master->xprism->input_function->y_max_index,
  1064.            xvf_stringval_chng, temp, 0);
  1065.     master->xprism->input_function->y_max =
  1066.         xvf_strcpy(area_info->func_ymax);
  1067.  
  1068.     sprintf(temp, "%s", area_info->func_yptnum);
  1069.     xvf_change_input(form, master->xprism->input_function->ynum_pts_index,
  1070.            xvf_stringval_chng, temp, 0);
  1071.     master->xprism->input_function->ynum_pts =
  1072.         xvf_strcpy(area_info->func_yptnum);
  1073.  
  1074. /*
  1075.    PLOT SUBFORM ATTRIBUTES PANE
  1076. */
  1077.  
  1078.   /* change the line type */
  1079.     sprintf(temp, "%d", area_info->line_type);
  1080.     xvf_change_input(form,
  1081.              master->options->attributes->change_line_type_index,
  1082.              xvf_toggleval_chng, temp, 0);
  1083.     master->options->attributes->change_line_type_val = area_info->line_type;
  1084.  
  1085.   /* change the marker type */
  1086.     sprintf(temp, "%d", area_info->marker_type);
  1087.     xvf_change_input(form,
  1088.              master->options->attributes->change_marker_type_index,
  1089.              xvf_toggleval_chng, temp, 0);
  1090.     master->options->attributes->change_marker_type_val =
  1091.         area_info->marker_type;
  1092.  
  1093. /*
  1094.    OPTION SUBFORM LABELS PANE
  1095. */
  1096.  
  1097.   /* put in the title */
  1098.     xvf_change_input(form, master->options->label->title_index,
  1099.              xvf_stringval_chng, area_info->title, 0);
  1100.   
  1101.   /* put in the x axis */
  1102.     xvf_change_input(form, master->options->label->xaxis_index,
  1103.              xvf_stringval_chng, area_info->xaxis, 0);
  1104.  
  1105.   /* put in the y axis */
  1106.     xvf_change_input(form, master->options->label->yaxis_index,
  1107.              xvf_stringval_chng, area_info->yaxis, 0);
  1108.  
  1109.   /* put in the z axis */
  1110.     xvf_change_input(form, master->options->label->zaxis_index,
  1111.              xvf_stringval_chng, area_info->zaxis, 0);
  1112.  
  1113.   /* change the title font type */
  1114.     fontstring = font_type_string(area_info->title_font);
  1115.     xvf_change_input(form,master->options->label->title_font_index+1,
  1116.              xvf_title_chng,fontstring,20);
  1117.     free(fontstring);
  1118.     fontstring = NULL;
  1119.  
  1120.   /* change the X Axis font type */
  1121.     fontstring = font_type_string(area_info->xaxis_font);
  1122.     xvf_change_input(form,master->options->label->xaxis_font_index+1,
  1123.              xvf_title_chng,fontstring,20);
  1124.     free(fontstring);
  1125.     fontstring = NULL;
  1126.  
  1127.   /* change the Y Axis font type */
  1128.     fontstring = font_type_string(area_info->yaxis_font);
  1129.     xvf_change_input(form,master->options->label->yaxis_font_index+1,
  1130.              xvf_title_chng,fontstring,20);
  1131.     free(fontstring);
  1132.     fontstring = NULL;
  1133.  
  1134.   /* change the Z Axis font type */
  1135.     fontstring = font_type_string(area_info->zaxis_font);
  1136.     xvf_change_input(form,master->options->label->zaxis_font_index+1,
  1137.              xvf_title_chng,fontstring,20);
  1138.     free(fontstring);
  1139.     fontstring = NULL;
  1140.  
  1141.   /* change the Numbers font type */
  1142.     fontstring = font_type_string(area_info->numbers_font);
  1143.     xvf_change_input(form,master->options->label->num_font_index+1,
  1144.              xvf_title_chng,fontstring,20);
  1145.     free(fontstring);
  1146.     fontstring = NULL;
  1147.  
  1148.   /* change the Legends font type */
  1149.     fontstring = font_type_string(area_info->legend_font);
  1150.     xvf_change_input(form,master->options->label->legend_font_index+1,
  1151.              xvf_title_chng,fontstring,20);
  1152.     free(fontstring);
  1153.     fontstring = NULL;
  1154.  
  1155. /*
  1156.    OPTION SUBFORM LABELS PANE
  1157.  
  1158.    NOTE: UPDATE TICS SET MINIMUM, MAXIMUM, and INTERVAL.
  1159. */
  1160.  
  1161. /* axes code commented out until it can be reworked
  1162.     sprintf(temp, "%d", area_info->scale.x);
  1163.     xvf_change_input(form, master->options->tics->change_xaxes_scale_index,
  1164.              xvf_toggleval_chng, temp, 0);
  1165.     master->options->tics->change_xaxes_scale_val = area_info->scale.x;
  1166.  
  1167.     sprintf(temp, "%d", area_info->scale.y);
  1168.     xvf_change_input(form, master->options->tics->change_yaxes_scale_index,
  1169.              xvf_toggleval_chng, temp, 0);
  1170.     master->options->tics->change_yaxes_scale_val = area_info->scale.y;
  1171.  
  1172.     sprintf(temp, "%d", area_info->scale.z);
  1173.     xvf_change_input(form, master->options->tics->change_zaxes_scale_index,
  1174.              xvf_toggleval_chng, temp, 0);
  1175.     master->options->tics->change_zaxes_scale_val = area_info->scale.z;
  1176. */
  1177.  
  1178.     sprintf(temp, "%d", area_info->grid);
  1179.     xvf_change_input(form, master->options->tics->grid_index,
  1180.              xvf_logicalval_chng, temp, 0);
  1181.  
  1182.     sprintf(temp, "%d", ! area_info->clear_labels);
  1183.     xvf_change_input(form, master->options->tics->clear_labels_index,
  1184.              xvf_logicalval_chng, temp, 0);
  1185.  
  1186.  
  1187.     sprintf(temp, "%d", area_info->box);
  1188.     xvf_change_input(form, master->options->tics->box_index,
  1189.              xvf_logicalval_chng, temp, 0);
  1190.  
  1191.     sprintf(temp, "%d", area_info->axes);
  1192.     xvf_change_input(form, master->options->tics->axes_index,
  1193.              xvf_logicalval_chng, temp, 0);
  1194.  
  1195.     sprintf(temp, "%d", area_info->numerical_labels);
  1196.     xvf_change_input(form, master->options->tics->num_labels_index,
  1197.              xvf_logicalval_chng, temp, 0);
  1198.  
  1199.     sprintf(temp, "%d", area_info->legend);
  1200.     xvf_change_input(form, master->options->tics->legend_index,
  1201.              xvf_logicalval_chng, temp, 0);
  1202.  
  1203.     sprintf(temp, "%d", area_info->auto_scale);
  1204.     xvf_change_input(form, master->options->tics->auto_scale_index,
  1205.              xvf_logicalval_chng, temp, 0);
  1206.  
  1207.     sprintf(temp, "%d", area_info->rescale_relabel);
  1208.     xvf_change_input(form, master->options->tics->change_labeling_index,
  1209.              xvf_toggleval_chng, temp, 0);
  1210.     master->options->tics->change_labeling_val = area_info->rescale_relabel;
  1211.  
  1212.   /* change value listed for number of minor tics on the X axis */
  1213.     sprintf(temp, "%d", area_info->x_tics);
  1214.     xvf_change_input(form, master->options->tics->minor_xtics_index,
  1215.              xvf_intval_chng, temp, 0);
  1216.  
  1217.   /* change value listed for number of minor tics on the Y axis */
  1218.     sprintf(temp, "%d", area_info->y_tics);
  1219.     xvf_change_input(form, master->options->tics->minor_ytics_index,
  1220.              xvf_intval_chng, temp, 0);
  1221.  
  1222.   /* change value listed for number of minor tics on the Z axis */
  1223.     sprintf(temp, "%d", area_info->z_tics);
  1224.     xvf_change_input(form, master->options->tics->minor_ztics_index,
  1225.              xvf_intval_chng, temp, 0);
  1226.     
  1227. /*
  1228.    OPTION SUBFORM COLORS PANE
  1229. */
  1230.  
  1231.     color = color_string(area_info->title_color);
  1232.     xvf_change_input(form, master->options->colors->title_index+1,
  1233.              xvf_title_chng, color, 25);
  1234.     free(color);
  1235.     color = NULL;
  1236.  
  1237.     color = color_string(area_info->xaxis_label_color);
  1238.     xvf_change_input(form, master->options->colors->xaxis_label_index+1,
  1239.              xvf_title_chng, color, 25);
  1240.     free(color);
  1241.     color = NULL;
  1242.  
  1243.     color = color_string(area_info->yaxis_label_color);
  1244.     xvf_change_input(form, master->options->colors->yaxis_label_index+1,
  1245.              xvf_title_chng, color, 25);
  1246.     free(color);
  1247.     color = NULL;
  1248.  
  1249.     color = color_string(area_info->yaxis_label_color);
  1250.     xvf_change_input(form, master->options->colors->zaxis_label_index+1,
  1251.              xvf_title_chng, color, 25);
  1252.     free(color);
  1253.     color = NULL;
  1254.  
  1255.     color = color_string(area_info->xaxis_color);
  1256.     xvf_change_input(form, master->options->colors->xaxis_index+1,
  1257.              xvf_title_chng, color, 25);
  1258.     free(color);
  1259.     color = NULL;
  1260.  
  1261.     color = color_string(area_info->yaxis_color);
  1262.     xvf_change_input(form, master->options->colors->yaxis_index+1,
  1263.              xvf_title_chng, color, 25);
  1264.     free(color);
  1265.     color = NULL;
  1266.  
  1267.     color = color_string(area_info->zaxis_color);
  1268.     xvf_change_input(form, master->options->colors->zaxis_index+1,
  1269.              xvf_title_chng, color, 25);
  1270.     free(color);
  1271.     color = NULL;
  1272.  
  1273.     color = color_string(area_info->num_xaxis_color);
  1274.     xvf_change_input(form, master->options->colors->xaxis_nums_index+1,
  1275.              xvf_title_chng, color, 25);
  1276.     free(color);
  1277.     color = NULL;
  1278.  
  1279.     color = color_string(area_info->num_yaxis_color);
  1280.     xvf_change_input(form, master->options->colors->yaxis_nums_index+1,
  1281.              xvf_title_chng, color, 25);
  1282.     free(color);
  1283.     color = NULL;
  1284.  
  1285.     color = color_string(area_info->num_zaxis_color);
  1286.     xvf_change_input(form, master->options->colors->zaxis_nums_index+1,
  1287.              xvf_title_chng, color, 25);
  1288.     free(color);
  1289.     color = NULL;
  1290.  
  1291.  
  1292.     color = color_string(area_info->grid_color);
  1293.     xvf_change_input(form, master->options->colors->grid_index+1,
  1294.              xvf_title_chng, color, 25);
  1295.     free(color);
  1296.     color = NULL;
  1297.  
  1298.     color = color_string(area_info->legend_color);
  1299.     xvf_change_input(form, master->options->colors->legend_index+1,
  1300.              xvf_title_chng, color, 25);
  1301.     free(color);
  1302.     color = NULL;
  1303.  
  1304.     }
  1305.   }
  1306.  
  1307. /*
  1308.    PLOT SUBFORM ENVIRONMENT PANE
  1309. */
  1310.  
  1311.   /* change Global Input directory */
  1312.   xvf_change_input(form, master->xprism->environment->input_path_index,
  1313.            xvf_stringval_chng, xprism3_args->indir, 0);
  1314.   master->xprism->environment->input_path = xvf_strcpy(xprism3_args->indir);
  1315.             
  1316.   /* change Global Output directory on Plot subform, Env pane */
  1317.   xvf_change_input(form, master->xprism->environment->output_path_index,
  1318.            xvf_stringval_chng, xprism3_args->outdir, 0);
  1319.   master->xprism->environment->output_path = xvf_strcpy(xprism3_args->outdir);
  1320.  
  1321. /*
  1322.    ANNOTATION SUBFORM FILE PANE
  1323. */
  1324.  
  1325.   if ( xprism3_args->annotation_in_file != NULL )
  1326.   {
  1327.     xvf_change_input(form, master->xvoverlay->ovfile->ov_input_index,
  1328.              xvf_inputfile_chng, xprism3_args->annotation_in_file, 0);
  1329.     master->xvoverlay->ovfile->ov_input =
  1330.         xvf_strcpy(xprism3_args->annotation_in_file);
  1331.   }
  1332.  
  1333.   if ( xprism3_args->annotation_out_file != NULL )
  1334.   {
  1335.     xvf_change_input(form, master->xvoverlay->ovfile->ov_output_index,
  1336.              xvf_outputfile_chng, xprism3_args->annotation_out_file, 0);
  1337.     master->xvoverlay->ovfile->ov_output =
  1338.         xvf_strcpy(xprism3_args->annotation_out_file);
  1339.   }
  1340.  
  1341. /*
  1342.    OUTPUT SUBFORM FILES PANE
  1343. */
  1344.  
  1345.   if ( xprism3_args->explicit_imagefile != NULL )
  1346.   {
  1347.     xvf_change_input(form, master->output->file->expl_filename_index,
  1348.              xvf_outputfile_chng, xprism3_args->explicit_imagefile, 0);
  1349.     master->output->file->expl_filename = 
  1350.         xvf_strcpy(xprism3_args->explicit_imagefile);
  1351.   }
  1352.  
  1353.   if ( xprism3_args->implicit_imagefile != NULL )
  1354.   {
  1355.     xvf_change_input(form, master->output->file->impl_filename_index,
  1356.              xvf_outputfile_chng, xprism3_args->implicit_imagefile, 0);
  1357.     master->output->file->impl_filename = 
  1358.         xvf_strcpy(xprism3_args->implicit_imagefile);
  1359.   }
  1360.   if ( xprism3_args->colormap_imagefile != NULL )
  1361.   {
  1362.     xvf_change_input(form, master->output->file->cm_filename_index,
  1363.              xvf_outputfile_chng, xprism3_args->colormap_imagefile, 0);
  1364.     master->output->file->cm_filename = 
  1365.         xvf_strcpy(xprism3_args->colormap_imagefile);
  1366.   }
  1367.  
  1368.   if ( xprism3_args->screendump_file != NULL )
  1369.   {
  1370.     xvf_change_input(form, master->output->file->dump_filename_index,
  1371.              xvf_outputfile_chng, xprism3_args->screendump_file, 0);
  1372.     master->output->file->dump_filename = 
  1373.         xvf_strcpy(xprism3_args->screendump_file);
  1374.   }
  1375.  
  1376. /*
  1377.    OUTPUT SUBFORM POSTSCRIPT PANE
  1378. */
  1379.  
  1380.   if ( xprism3_args->postscr_printer != NULL )
  1381.   {
  1382.     xvf_change_input(form, master->output->postscr->printer_index,
  1383.              xvf_stringval_chng, xprism3_args->postscr_printer, 0);
  1384.     master->output->postscr->printer = 
  1385.         xvf_strcpy(xprism3_args->postscr_printer);
  1386.   }
  1387.  
  1388.   if ( xprism3_args->postscr_file != NULL )
  1389.   {
  1390.     xvf_change_input(form, master->output->postscr->filename_index,
  1391.              xvf_outputfile_chng, xprism3_args->postscr_file, 0);
  1392.     master->output->postscr->filename = 
  1393.         xvf_strcpy(xprism3_args->postscr_file);
  1394.   }
  1395.  
  1396.   sprintf(temp, "%d", xprism3_args->postscr_flush);
  1397.   xvf_change_input(form, master->output->postscr->flush_index,
  1398.            xvf_logicalval_chng, temp, 0);
  1399.   master->output->postscr->flush = xprism3_args->postscr_flush;
  1400.  
  1401.   sprintf(temp, "%d", xprism3_args->postscr_invert);
  1402.   xvf_change_input(form, master->output->postscr->invert_index,
  1403.            xvf_logicalval_chng, temp, 0);
  1404.   master->output->postscr->invert = xprism3_args->postscr_invert;
  1405.  
  1406.   sprintf(temp, "%d", xprism3_args->postscr_landscape);
  1407.   xvf_change_input(form, master->output->postscr->landscape_index,
  1408.            xvf_logicalval_chng, temp, 0);
  1409.   master->output->postscr->landscape = xprism3_args->postscr_landscape;
  1410.  
  1411.   sprintf(temp, "%d", xprism3_args->postscr_mono);
  1412.   xvf_change_input(form, master->output->postscr->mono_index,
  1413.            xvf_logicalval_chng, temp, 0);
  1414.   master->output->postscr->mono = xprism3_args->postscr_mono;
  1415.  
  1416.   sprintf(temp, "%g", xprism3_args->postscr_width);
  1417.   xvf_change_input(form, master->output->postscr->width_index,
  1418.            xvf_floatval_chng, temp, 0);
  1419.   master->output->postscr->width = xprism3_args->postscr_width;
  1420.  
  1421.   sprintf(temp, "%g", xprism3_args->postscr_height);
  1422.   xvf_change_input(form, master->output->postscr->height_index,
  1423.            xvf_floatval_chng, temp, 0);
  1424.   master->output->postscr->height = xprism3_args->postscr_height;
  1425.  
  1426.   sprintf(temp, "%g", xprism3_args->postscr_xoffset);
  1427.   xvf_change_input(form, master->output->postscr->x_offset_index,
  1428.            xvf_floatval_chng, temp, 0);
  1429.   master->output->postscr->x_offset = xprism3_args->postscr_xoffset;
  1430.  
  1431.   sprintf(temp, "%g", xprism3_args->postscr_yoffset);
  1432.   xvf_change_input(form, master->output->postscr->y_offset_index,
  1433.            xvf_floatval_chng, temp, 0);
  1434.   master->output->postscr->y_offset = xprism3_args->postscr_yoffset;
  1435.  
  1436.   sprintf(temp, "%d", xprism3_args->postscr_output_type);
  1437.   xvf_change_input(form, master->output->postscr->output_type_index,
  1438.            xvf_toggleval_chng, temp, 0);
  1439.   master->output->postscr->output_type_val = xprism3_args->postscr_output_type;
  1440.  
  1441. /*
  1442.    OUTPUT SUBFORM IMAGEN PANE
  1443. */
  1444.  
  1445.   if ( xprism3_args->imagen_printer != NULL )
  1446.   {
  1447.     xvf_change_input(form, master->output->imagen->printer_index,
  1448.              xvf_stringval_chng, xprism3_args->imagen_printer, 0);
  1449.     master->output->imagen->printer = 
  1450.         xvf_strcpy(xprism3_args->imagen_printer);
  1451.   }
  1452.  
  1453.   if ( xprism3_args->imagen_file != NULL )
  1454.   {
  1455.     xvf_change_input(form, master->output->imagen->filename_index,
  1456.              xvf_outputfile_chng, xprism3_args->imagen_file, 0);
  1457.     master->output->imagen->filename = 
  1458.         xvf_strcpy(xprism3_args->imagen_file);
  1459.   }
  1460.  
  1461.   sprintf(temp, "%d", xprism3_args->imagen_flush);
  1462.   xvf_change_input(form, master->output->imagen->flush_index,
  1463.            xvf_logicalval_chng, temp, 0);
  1464.   master->output->imagen->flush = xprism3_args->imagen_flush;
  1465.  
  1466.   sprintf(temp, "%d", xprism3_args->imagen_invert);
  1467.   xvf_change_input(form, master->output->imagen->invert_index,
  1468.            xvf_logicalval_chng, temp, 0);
  1469.   master->output->imagen->invert = xprism3_args->imagen_invert;
  1470.  
  1471.   sprintf(temp, "%g", xprism3_args->imagen_width);
  1472.   xvf_change_input(form, master->output->imagen->width_index,
  1473.            xvf_floatval_chng, temp, 0);
  1474.   master->output->imagen->width = xprism3_args->imagen_width;
  1475.  
  1476.   sprintf(temp, "%g", xprism3_args->imagen_height);
  1477.   xvf_change_input(form, master->output->imagen->height_index,
  1478.            xvf_floatval_chng, temp, 0);
  1479.   master->output->imagen->height = xprism3_args->imagen_height;
  1480.  
  1481.   sprintf(temp, "%g", xprism3_args->imagen_xoffset);
  1482.   xvf_change_input(form, master->output->imagen->x_offset_index,
  1483.            xvf_floatval_chng, temp, 0);
  1484.   master->output->imagen->x_offset = xprism3_args->imagen_xoffset;
  1485.  
  1486.   sprintf(temp, "%g", xprism3_args->imagen_yoffset);
  1487.   xvf_change_input(form, master->output->imagen->y_offset_index,
  1488.            xvf_floatval_chng, temp, 0);
  1489.   master->output->imagen->y_offset = xprism3_args->imagen_yoffset;
  1490.  
  1491.   sprintf(temp, "%d", xprism3_args->imagen_output_type);
  1492.   xvf_change_input(form, master->output->imagen->output_type_index,
  1493.            xvf_toggleval_chng, temp, 0);
  1494.   master->output->imagen->output_type_val = xprism3_args->imagen_output_type;
  1495.  
  1496. /*
  1497.    OUTPUT SUBFORM HPGL PANE
  1498. */
  1499.  
  1500.   if ( xprism3_args->hpgl_printer != NULL )
  1501.   {
  1502.     xvf_change_input(form, master->output->hpgl->printer_index,
  1503.              xvf_stringval_chng, xprism3_args->hpgl_printer, 0);
  1504.     master->output->hpgl->printer = 
  1505.         xvf_strcpy(xprism3_args->hpgl_printer);
  1506.   }
  1507.  
  1508.   if ( xprism3_args->hpgl_file != NULL )
  1509.   {
  1510.     xvf_change_input(form, master->output->hpgl->filename_index,
  1511.              xvf_outputfile_chng, xprism3_args->hpgl_file, 0);
  1512.     master->output->hpgl->filename = 
  1513.         xvf_strcpy(xprism3_args->hpgl_file);
  1514.   }
  1515.  
  1516.   sprintf(temp, "%d", xprism3_args->hpgl_flush);
  1517.   xvf_change_input(form, master->output->hpgl->flush_index,
  1518.            xvf_logicalval_chng, temp, 0);
  1519.   master->output->hpgl->flush = xprism3_args->hpgl_flush;
  1520.  
  1521.   sprintf(temp, "%d", xprism3_args->hpgl_landscape);
  1522.   xvf_change_input(form, master->output->hpgl->landscape_index,
  1523.            xvf_logicalval_chng, temp, 0);
  1524.   master->output->hpgl->landscape = xprism3_args->hpgl_landscape;
  1525.  
  1526.   sprintf(temp, "%g", xprism3_args->hpgl_width);
  1527.   xvf_change_input(form, master->output->hpgl->width_index,
  1528.            xvf_floatval_chng, temp, 0);
  1529.   master->output->hpgl->width = xprism3_args->hpgl_width;
  1530.  
  1531.   sprintf(temp, "%g", xprism3_args->hpgl_height);
  1532.   xvf_change_input(form, master->output->hpgl->height_index,
  1533.            xvf_floatval_chng, temp, 0);
  1534.   master->output->hpgl->height = xprism3_args->hpgl_height;
  1535.  
  1536.   sprintf(temp, "%g", xprism3_args->hpgl_xoffset);
  1537.   xvf_change_input(form, master->output->hpgl->x_offset_index,
  1538.            xvf_floatval_chng, temp, 0);
  1539.   master->output->hpgl->x_offset = xprism3_args->hpgl_xoffset;
  1540.  
  1541.   sprintf(temp, "%g", xprism3_args->hpgl_yoffset);
  1542.   xvf_change_input(form, master->output->hpgl->y_offset_index,
  1543.            xvf_floatval_chng, temp, 0);
  1544.   master->output->hpgl->y_offset= xprism3_args->hpgl_yoffset;
  1545.  
  1546. /*
  1547.    OUTPUT SUBFORM LN03 PANE
  1548. */
  1549.  
  1550.   if ( xprism3_args->ln03_printer != NULL )
  1551.   {
  1552.     xvf_change_input(form, master->output->ln03->printer_index,
  1553.              xvf_stringval_chng, xprism3_args->ln03_printer, 0);
  1554.     master->output->ln03->printer = 
  1555.              xvf_strcpy(xprism3_args->ln03_printer);
  1556.   }
  1557.  
  1558.   if ( xprism3_args->ln03_file != NULL )
  1559.   {
  1560.     xvf_change_input(form, master->output->ln03->filename_index,
  1561.              xvf_outputfile_chng, xprism3_args->ln03_file, 0);
  1562.     master->output->ln03->filename = 
  1563.              xvf_strcpy(xprism3_args->ln03_file);
  1564.   }
  1565.  
  1566.   sprintf(temp, "%d", xprism3_args->ln03_invert);
  1567.   xvf_change_input(form, master->output->ln03->invert_index,
  1568.            xvf_logicalval_chng, temp, 0);
  1569.   master->output->ln03->invert = xprism3_args->ln03_invert;
  1570.  
  1571. /*
  1572.    ANSWER FILE PANE
  1573. */
  1574.   if ( xprism3_args->output_answer_file != NULL )
  1575.   {
  1576.     xvf_change_input(form, master->answer->ans_file->out_answer_file_index,
  1577.              xvf_outputfile_chng, xprism3_args->output_answer_file, 0);
  1578.     master->answer->ans_file->out_answer_file =
  1579.         xvf_strcpy(xprism3_args->output_answer_file);
  1580.   }
  1581.  
  1582. }
  1583.  
  1584.  
  1585. /************************************************************
  1586. *
  1587. *   MODULE NAME: update_file
  1588. *
  1589. *       PURPOSE: update file signal handler installed bu xvp_detect_file
  1590. *
  1591. *     OUTPUT: none
  1592. *
  1593. *     CALLED BY: 
  1594. *
  1595. *    WRITTEN BY: Tom Sauer
  1596. *
  1597. ************************************************************/
  1598. int update_file(id, filename, data)
  1599. int  id;
  1600. char *filename;
  1601. char *data;
  1602.  
  1603. {
  1604.     char *legend;
  1605.     int whichband, cmplx, marker_type, plot_type, line_type;
  1606.     long data_type, data_format;
  1607.     int step_size_x, step_size_y, begin_point_x, begin_point_y;
  1608.     int end_point_x, end_point_y;
  1609.     int i, done;
  1610.     XPlot *plot, *newplot, *temp_plot;
  1611.  
  1612.  
  1613.     if (gwin == NULL)
  1614.     {
  1615.            for (i = 0; i< MAX_PLOTS; i++)
  1616.            {
  1617.               xvp_delete_detect_file(update_id[i]);
  1618.               update_id[i] = 0;
  1619.        }
  1620.        return(True);
  1621.       }
  1622.  
  1623.     plot = NULL;
  1624.     temp_plot = gwin->plist;
  1625.     done = False;
  1626.     while ( (temp_plot != NULL) && (!done))
  1627.     {
  1628.        if ( ((strcmp(temp_plot->filename, filename)) == 0) &&
  1629.                (temp_plot->update_id == id))
  1630.        {
  1631.           plot = temp_plot;
  1632.           done = True;
  1633.             }
  1634.             else
  1635.               temp_plot = temp_plot->next;
  1636.     }
  1637.  
  1638.         if (plot == NULL)
  1639.     {
  1640.              (void) xvf_error_wait("Cannot update the plot with the new data in \
  1641. the file, since the plot was previously deleted.\n Please use the Files \
  1642. pane to input the file again."  ,"Xprism Error", NULL);
  1643.        xvp_delete_detect_file(id);
  1644.        return(True);
  1645.     }
  1646.  
  1647.     data_type   = plot->data_type;
  1648.     data_format = plot->data_format;
  1649.     plot_type   = plot->plot_type;
  1650.     marker_type = plot->marker;
  1651.     line_type   = plot->line_type;
  1652.     whichband   = plot->band;
  1653.     cmplx       = plot->cmplx;
  1654.     legend      = VStrcpy(plot->legend_str);
  1655.  
  1656.     step_size_x   = plot->step_size.x;
  1657.     step_size_y   = plot->step_size.y;
  1658.     begin_point_x = plot->begin_point.x;
  1659.     begin_point_y = plot->begin_point.y;
  1660.     end_point_x   = plot->end_point.x;
  1661.     end_point_y   = plot->end_point.y;
  1662.  
  1663.     newplot = get_input_file(filename, plot_type,
  1664.                          data_format, gwin_attr->machine_type_index,
  1665.                          data_type, -1, whichband, cmplx);
  1666.  
  1667.     if (newplot == NULL)
  1668.        return(False);
  1669.  
  1670.     newplot->update_id = id;
  1671.  
  1672.     delete_plot(plot);
  1673.  
  1674.     assign_plot_to_gwin(newplot, plot_type, marker_type, line_type,
  1675.               step_size_x, begin_point_x, end_point_x, 0,
  1676.               step_size_y, begin_point_y, end_point_y, legend, 1);
  1677.  
  1678.     find_wc_min_max();
  1679.     reset_world_coordinates();
  1680.  
  1681.     plot_routine();
  1682.     free(legend);
  1683.     return(True);
  1684.  
  1685. }
  1686.  
  1687.  
  1688. /************************************************************
  1689. *
  1690. *   MODULE NAME: delete_plot
  1691. *
  1692. *       PURPOSE: deletes one or more plots in the workspace
  1693. *
  1694. *     OUTPUT: none
  1695. *
  1696. *     CALLED BY: run_options
  1697. *
  1698. *    WRITTEN BY: Tom Sauer
  1699. *
  1700. ************************************************************/
  1701.  
  1702. delete_plot(delete_plot)
  1703. XPlot *delete_plot;
  1704. {
  1705.     char *temp, *mesg;
  1706.     XPlot *plot, *prev;
  1707.     int  i, num_sels = 1;
  1708.  
  1709.     if (gwin == NULL)
  1710.     {
  1711.        return(False);
  1712.     }
  1713.     
  1714.           /* there is only one plot displayed */
  1715.     else if (gwin->plotnum == 1 )
  1716.     {
  1717.        plot = gwin->plist;
  1718.        freeplot(plot);
  1719.        gwin->plist = NULL;
  1720.        gwin->plotnum--;
  1721.        if (plot->active == TRUE)
  1722.                  gwin->disp_plotnum--;
  1723.        return(True);
  1724.     }
  1725.     else
  1726.     {
  1727.         plot = gwin->plist;
  1728.         prev = plot;
  1729.  
  1730.         for (i = 0; i < gwin->plotnum; i++)
  1731.         {
  1732.          while ((delete_plot->id != plot->id) && (plot->next != NULL))
  1733.          {
  1734.             prev = plot;
  1735.             plot = plot->next;
  1736.          }
  1737.  
  1738.         if (prev == plot)
  1739.             gwin->plist = plot->next;
  1740.         else
  1741.             prev->next = plot->next;
  1742.             
  1743.         if (plot->active == TRUE)
  1744.            gwin->disp_plotnum--;
  1745.  
  1746.             freeplot(plot);
  1747.         gwin->plotnum--;
  1748.        }
  1749.         }
  1750.     return(True);
  1751. }
  1752.