home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / general / procssng / compstol / cmpsttl1.lha / CompositeTool / v1.1.dist / compositetool.c next >
Encoding:
C/C++ Source or Header  |  1990-05-08  |  340.1 KB  |  11,955 lines

  1. /*
  2. ******************************************************************************
  3. *                               NCSA CompositeTool 1.1
  4. *                           18 April 1990
  5. * NCSA CompositeTool 1.1 source code and documentation are in the public
  6. * domain.
  7. * Specifically, we give to the public domain all rights for future licensing
  8. * of the source code, all resale rights, and all publishing rights.
  9. * We ask, but do not require, that the following message be included in all
  10. * derived works:
  11. * Portions developed at the National Center for Supercomputing Applications at
  12. * the University of Illinois at Urbana-Champaign.
  13. * THE UNIVERSITY OF ILLINOIS GIVES NO WARRANTY, EXPRESSED OR IMPLIED, FOR THE
  14. * SOFTWARE AND/OR DOCUMENTATION PROVIDED, INCLUDING, WITHOUT LIMITATION,
  15. * WARRANTY OF MERCHANTABILITY AND WARRANTY OF FITNESS FOR A PARTICULAR PURPOSE
  16. ******************************************************************************
  17. */
  18. /* cat > headers/all.h << "EOF" */
  19. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  20. /* all.h: common include files for CompositeTool    */
  21. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  22. /* SCCS information: %W%    %G% */
  23.  
  24. #include        <suntool/sunview.h>
  25. #include        <suntool/panel.h>
  26. #include        <suntool/canvas.h>
  27. #include        <suntool/walkmenu.h>
  28. #include        <sys/file.h>
  29. #include        <sys/dir.h>
  30. #include        <sys/stat.h>
  31. #include        <sys/types.h>
  32. #include        <math.h>
  33. #include        <stdio.h>
  34. /* #include        <usercore.h> */    /* Why? */
  35.  
  36. /* #include    "const.h" */
  37. /* #include    "struct.h" */
  38. /* #include    "ext.h" */
  39. /* EOF */
  40.  
  41. /* cat > headers/const.h << "EOF" */
  42. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  43. /* const.h: constants for CompositeTool            */
  44. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  45. /* SCCS information: %W%    %G% */
  46.  
  47. #define         N_image         20
  48. #define         N_vector        20
  49. #define         N_contour       20
  50. #define         N_text          40
  51. #define         N_frame         10
  52. #define         N_panel         10
  53. #define         N_pbutton       116
  54. #define         N_pslider       4
  55. #define         N_ptext         59
  56.     /* 4 messages for the base frame header. 1 message for the feature
  57.        frame */
  58. #define         N_pmessage      5
  59. #define         N_xscr          1152
  60. #define         N_yscr        900
  61. #define         N_hpix          1142
  62. #define         N_vpix          890
  63.     /* 1.1 addition */
  64. #define        MAXNAMELEN    255
  65. /* EOF */
  66.  
  67. /* cat > headers/struct.h << "EOF" */
  68. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  69. /* struct.h: structure declarations for CompositeTool    */
  70. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  71. /* SCCS information: %W%    %G% */
  72.  
  73. struct s_text
  74. {
  75.     int             holder;
  76.     int             sw;
  77.     char            body[80];
  78.     int             xpos;
  79.     char            prefont[60];
  80.     int             ypos;
  81.     char            postfont[20];
  82.     int             color;
  83. };
  84. struct s_contour
  85. {
  86.     int             holder;
  87.     int             sw;
  88.     char            fname[MAXNAMELEN + 1];    /* changed in 1.1 */
  89.     int             color;
  90.     int             first;
  91.     int             last;
  92.     int             interval;
  93.     int             dis;
  94.     int             xpos;
  95.     int             ypos;
  96.     int             xpts;
  97.     int             ypts;
  98. };
  99. struct s_feature
  100. {
  101.     int             holder;
  102.     int             xax_sw;
  103.     int             xax_thick;
  104.     int             xax_color;
  105.     int             xax_bot;
  106.     int             xax_top;
  107.     int             yax_sw;
  108.     int             yax_thick;
  109.     int             yax_color;
  110.     int             yax_left;
  111.     int             yax_right;
  112.     int             xgr_sw;
  113.     int             xgr_thick;
  114.     int             xgr_color;
  115.     int             xgr_space;
  116.     int             ygr_sw;
  117.     int             ygr_thick;
  118.     int             ygr_color;
  119.     int             ygr_space;
  120.     int             xt1_sw;
  121.     int             xt1_thick;
  122.     int             xt1_color;
  123.     int             xt1_bot;
  124.     int             xt1_top;
  125.     int             xt1_space;
  126.     int             xt1_len;
  127.     int             xt1_direc;
  128.     int             yt1_sw;
  129.     int             yt1_thick;
  130.     int             yt1_color;
  131.     int             yt1_left;
  132.     int             yt1_right;
  133.     int             yt1_space;
  134.     int             yt1_len;
  135.     int             yt1_direc;
  136.     int             xt2_sw;
  137.     int             xt2_thick;
  138.     int             xt2_color;
  139.     int             xt2_bot;
  140.     int             xt2_top;
  141.     int             xt2_space;
  142.     int             xt2_len;
  143.     int             xt2_direc;
  144.     int             yt2_sw;
  145.     int             yt2_thick;
  146.     int             yt2_color;
  147.     int             yt2_left;
  148.     int             yt2_right;
  149.     int             yt2_space;
  150.     int             yt2_len;
  151.     int             yt2_direc;
  152. };
  153. struct s_image
  154. {
  155.     int             holder;
  156.     int             sw;
  157.     char            fname[MAXNAMELEN + 1];    /* changed in 1.1 */
  158.     int             xpos;
  159.     int             ypos;
  160.     int             xpts;
  161.     int             ypts;
  162. };
  163. struct s_vector
  164. {
  165.     int             holder;
  166.     int             sw;
  167.     char            xname[MAXNAMELEN + 1];    /* changed in 1.1 */
  168.     int             xpos;
  169.     char            yname[MAXNAMELEN + 1];    /* changed in 1.1 */
  170.     int             ypos;
  171.     int             xpts;
  172.     int             ypts;
  173.     int             xstart;
  174.     int             xend;
  175.     int             xinterval;
  176.     int             ystart;
  177.     int             yend;
  178.     int             yinterval;
  179.     int             xdis;
  180.     int             ydis;
  181.     int             color;
  182.     int             maxlen;
  183.     int             xzero;
  184.     float           xscale;
  185.     int             yzero;
  186.     float           yscale;
  187. };
  188. struct s_grid
  189. {
  190.     int             holder;
  191.     int             sw;
  192.     int             xpix;
  193.     int             ypix;
  194.     int             color;
  195. };
  196. struct s_colorbar
  197. {
  198.     int             holder;
  199.     int             sw;
  200.     int             xpos;
  201.     int             ypos;
  202.     int             xpts;
  203.     int             ypts;
  204. };
  205. struct s_scrdump
  206. {
  207.     int             holder;
  208.     int             xstart;
  209.     int             ystart;
  210.     char            fname[MAXNAMELEN + 1];    /* changed in 1.1 */
  211.     int             xend;
  212.     int             yend;
  213. };
  214.  
  215. /* EOF */
  216. /* cat > headers/ext.h << "EOF" */
  217. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  218. /* ext.h: extern declarations for CompositeTool        */
  219. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  220. /* SCCS information: %W%    %G% */
  221.  
  222. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  223. extern
  224. int             tag_to_string(),        string_to_tag(),
  225.                 write_string(),         read_string();
  226. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  227. extern
  228. int        msg_draw(),        msg_move(),    x_start,    y_start;
  229. extern
  230. int                            x_end,        y_end;
  231. extern
  232. int                            x_interval,    y_interval;
  233. extern
  234. int        mouse_msg(),        kbyte_msg(),    draw_box();
  235. extern
  236. int        sw_flash,        sw_draw,        sw_move;
  237. extern
  238. int        odd_read();
  239. extern
  240. int        check_file(),        resetb_feature();
  241. extern
  242. int        event_dump(),        event_colorbar(),    event_image(),
  243.         event_contour(),    event_vector(),        event_text();
  244. extern
  245. int        reset_mcolorbar(),    reset_mcontour(),    reset_mimage(),
  246.         reset_mtext(),        reset_mvector();
  247. extern
  248. int        sw_palette,        confirm_palette(),    reset_palette(),
  249.         sw_grid,        confirm_grid(),        reset_grid(),
  250.         sw_colorbar,        confirm_colorbar(),    reset_colorbar(),
  251.         sw_image,    sw_i[5],confirm_image(),    reset_image(),
  252.         sw_contour,    sw_c[5],confirm_contour(),    reset_contour(),
  253.         sw_vector,    sw_v[5],confirm_vector(),    reset_vector(),
  254.         sw_text,    sw_t[5],confirm_text(),        reset_text();
  255. extern
  256. int                     draw_colorbar(),null_colorbar(),ok_colorbar(),
  257.                 nc,     draw_contour(), null_contour(), ok_contour(),
  258.                         draw_grid(),    null_grid(),    ok_grid(),
  259.                 nf,     draw_feature(),    null_feature(),    nosho_feature(),
  260.                 ni,     draw_image(),   null_image(),   ok_image(),
  261.                 nt,     draw_text(),    null_text(),    ok_text(),
  262.                 nv,     draw_vector(),  null_vector(),  ok_vector(),    draw_vector1();
  263. extern
  264. int             con_row(),con_col();
  265. extern
  266. int        info_msg(),    warn_msg(),    warn_msgt();
  267. extern
  268. int             bad_data(),     canvas_done(),  load_rgb(),     no_op();
  269. extern
  270. int             make_fr(),      make_pb(),      make_pm(),      make_pmnn(),
  271.                 make_pt(),    make_ps();
  272. extern
  273. int             my_ftoa(),      my_itoa(),      my_atof(),      my_isint(),
  274.                 my_isfloat(),   my_stripfn(),   my_otod();
  275. extern
  276. int             p0(),p1(),p2(),p3(),p4(),p5(),p6(),p7(),p8(),p9(),
  277.                 p10(),p11(),p12(),p13(),p14(),p15(),p16(),p17(),p18(),p19(),
  278.                 p20(),p21(),p22(),p23(),p24(),p25(),p26(),p27(),p28(),p29(),
  279.                 p30(),p31(),p32(),p33(),p34(),p35(),p36(),p37(),p38(),p39(),
  280.                 p40(),p41(),p42(),p43(),p44(),p45(),p46(),p47(),p48(),p49(),
  281.                 p50(),p51(),p52(),p53(),p54(),p55(),p56(),p57(),p58(),p59(),
  282.                 p60(),p61(),p62(),p63(),p64(),p65(),p66(),p67(),p68(),p69(),
  283.                 p70(),p71(),p72(),p73(),p74(),p75(),p76(),p77(),p78(),p79(),
  284.                 p80(),p81(),p82(),p83(),p84(),p85(),p86(),p87(),p88(),p89(),
  285.                 p90(),p91(),p92(),p93(),p94(),p95(),p96(),p97(),p98(),p99(),
  286.                 p100(),p101(),p102(),p103(),p104(),p105(),p106(),p107(),p108(),p109(),
  287.         p110(),p111(),p112(),p113(),p114(),p115();
  288. extern
  289. int             cpw_event(),    cpw_check();
  290. extern
  291. int     (*fdp[])();
  292. extern
  293. int     (*bnp[])();
  294. extern
  295. int        s0(),s1(),s2(),s3();
  296. extern
  297. int     (*snp[])();
  298. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  299. extern
  300. Frame           fr[N_frame],
  301.                 c_frame;
  302. extern
  303. Panel           pa[N_panel];
  304. extern
  305. Panel_item      pb[N_pbutton],
  306.                 pt[N_ptext],
  307.                 ps[N_pslider],
  308.                 pm[N_pmessage];
  309. extern
  310. Canvas          canvas;
  311. extern
  312. Pixwin          *cpw,*bpw;
  313. extern
  314. Pixrect        *x1_save,*x2_save,*y1_save,*y2_save;
  315. extern
  316. struct mpr_data *x1_ptr,*x2_ptr,*y1_ptr,*y2_ptr;
  317. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  318. extern
  319. int             clear_color,
  320.                 csw_dump,    csw_colorbar,    csw_text,
  321.         csw_image,    csw_contour,    csw_vector;
  322.         msg_no;
  323. extern
  324. short int    rw_toggle[N_image + N_contour + N_vector + N_text];
  325. extern
  326. char            c_cmsn[24],
  327.                 b_cmsn[24];
  328.  
  329. extern
  330. struct    stat    my_stat;
  331. extern
  332. struct  s_text  text[N_text+1];
  333. extern
  334. struct  s_contour con[N_contour+1];
  335. extern
  336. struct  s_feature feat[N_image + N_contour + N_vector];
  337. extern
  338. struct  s_image image[N_image+1];
  339. extern
  340. struct  s_vector vec[N_vector+1];
  341. extern
  342. struct  s_grid  grid,tgrid;
  343. extern
  344. struct  s_colorbar cbar,tcbar;
  345. extern
  346. struct  s_scrdump  sdump;
  347. /*      --------        */
  348. extern
  349. unsigned char   red[256],    green[256],    blue[256];
  350. extern
  351. char            pfn[256],    txt[256],       msg[256];
  352. extern
  353. char        compat_hdr[40];
  354. /* EOF */
  355.  
  356. /* cat > headers/define.h << "EOF" */
  357. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  358. /* define.h: definitions for CompositeTool        */
  359. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  360. /* SCCS information: %W%    %G% */
  361.  
  362. int        x_start,    y_start;
  363. int        x_end,        y_end;
  364. int        x_interval,    y_interval;
  365. int        sw_flash,        sw_draw,        sw_move;
  366. int        sw_palette,
  367.         sw_grid,
  368.         sw_colorbar,
  369.         sw_image,    sw_i[5],
  370.         sw_contour,    sw_c[5],
  371.         sw_vector,    sw_v[5],
  372.         sw_text,    sw_t[5];
  373. int                   
  374.                 nc,  
  375.                     
  376.                 nf,
  377.                 ni,
  378.                 nt,
  379.                 nv;
  380. int     (*fdp[])() =
  381.                 {
  382.                 no_op,  /* fr  0 */
  383.                 p13,    /* fr  1 */
  384.                 p16,    /* fr  2 */
  385.                 p22,    /* fr  3 */
  386.                 p30,    /* fr  4 */
  387.                 p41,    /* fr  5 */
  388.                 p46,    /* fr  6 */
  389.                 p58,    /* fr  7 */
  390.                 p70,    /* fr  8 */
  391.                 p88,    /* fr  9 */
  392.                 };
  393. int     (*bnp[])() =
  394.                 {
  395.                 p0,p1,p2,p3,p4,p5,p6,p7,p8,p9,
  396.                 p10,p11,p12,p13,p14,p15,p16,p17,p18,p19,
  397.                 p20,p21,p22,p23,p24,p25,p26,p27,p28,p29,
  398.                 p30,p31,p32,p33,p34,p35,p36,p37,p38,p39,
  399.                 p40,p41,p42,p43,p44,p45,p46,p47,p48,p49,
  400.                 p50,p51,p52,p53,p54,p55,p56,p57,p58,p59,
  401.                 p60,p61,p62,p63,p64,p65,p66,p67,p68,p69,
  402.                 p70,p71,p72,p73,p74,p75,p76,p77,p78,p79,
  403.                 p80,p81,p82,p83,p84,p85,p86,p87,p88,p89,
  404.                 p90,p91,p92,p93,p94,p95,p96,p97,p98,p99,
  405.                 p100,p101,p102,p103,p104,p105,p106,p107,p108,p109,
  406.         p110,p111,p112,p113,p114,p115
  407.                 };
  408. int     (*snp[])() =
  409.                 {
  410.         s0,s1,s2,s3
  411.         };
  412. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  413. Frame           fr[N_frame],
  414.                 c_frame;
  415. Panel           pa[N_panel];
  416. Panel_item      pb[N_pbutton],
  417.                 pt[N_ptext],
  418.                 ps[N_pslider],
  419.                 pm[N_pmessage];
  420. Canvas          canvas;
  421. Pixwin          *cpw,*bpw;
  422. Pixrect        *x1_save,*x2_save,*y1_save,*y2_save;
  423. struct mpr_data *x1_ptr,*x2_ptr,*y1_ptr,*y2_ptr;
  424. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  425. int             clear_color,
  426.                 csw_dump,    csw_colorbar,    csw_text,
  427.         csw_image,    csw_contour,    csw_vector;
  428.         msg_no;
  429. short int    rw_toggle[N_image + N_contour + N_vector + N_text];
  430. char            c_cmsn[24],
  431.                 b_cmsn[24];
  432.  
  433. struct    stat    my_stat;
  434. struct  s_text  text[N_text+1];
  435. struct  s_contour con[N_contour+1];
  436. struct  s_feature feat[N_image + N_contour + N_vector];
  437. struct  s_image image[N_image+1];
  438. struct  s_vector vec[N_vector+1];
  439. struct  s_grid grid,tgrid;
  440. struct  s_colorbar cbar,tcbar;
  441. struct  s_scrdump  sdump;
  442. /*      --------        */
  443. unsigned char   red[256],    green[256],    blue[256];
  444. char            pfn[256],    txt[256],       msg[256];
  445. char        compat_hdr[40];
  446. /*      --------        */
  447.  
  448. Pixfont *font_panel_button, *font_panel;
  449. int base_frame_up;
  450.  
  451. char    msg2[256];
  452.  
  453. /* EOF */
  454.  
  455. /* cat > headers/newext.h << "EOF" */
  456. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  457. /* newext.h: new declarations for CompositeTool        */
  458. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  459. /* SCCS information: %W%    %G% */
  460.  
  461. #define DEBUG    1 
  462.  
  463. #include <string.h>        /* SUN BUG (386i - 4.0.1)! Cannot put
  464.                    string.h after sunwindow/defaults.h.
  465.                    ERRORS! */
  466. #include <sunwindow/defaults.h>        /* for defaults database */
  467. #include <fcntl.h>            /* for open system call */
  468.  
  469. #include "df.h"
  470.  
  471. #define DEFAULT_FONT_PANEL "/CompositeTool/Font_panel"
  472. #define DEFAULT_FONT_PANEL_BUTTON "/CompositeTool/Font_panel_button"
  473. #define DEFAULT_INITIAL_PALETTE_FILE "/CompositeTool/Initial_palette_file"
  474. #define DEFAULT_LOGO_PALETTE_FILE "/CompositeTool/Logo_palette_file"
  475. #define DEFAULT_LOGO_IMAGE_FILE "/CompositeTool/Logo_image_file"
  476. #define DEFAULT_TEXT_FONT_DIR "/CompositeTool/Text_font_dir"
  477. #define DEFAULT_TEXT_FONT "/CompositeTool/Text_font"
  478.  
  479. extern int errno;
  480.  
  481. extern Pixfont *font_panel_button, *font_panel;
  482. extern int base_frame_up;
  483. extern char msg2[256];
  484. extern unsigned char palette [768];
  485. extern char pfntmp[256];
  486. extern int grid_down;
  487. extern struct s_grid lgrid;
  488. extern char dprefont[60];
  489. extern char dpostfont[20];
  490. extern char fn_new_defaults[32];
  491. extern char fntmp[MAXNAMELEN + 1];
  492. extern char util_read_dir[MAXNAMELEN + 1];
  493. extern Panel_item    util_pc_save,
  494.             util_pb_saveall;
  495.  
  496. extern void bad_data2 ();
  497. extern int check_image ();
  498. extern int check_palette ();
  499. extern char *get_defaults ();
  500. extern void move_defaults ();
  501. extern int info_msg2 ();
  502. extern char *itoa ();
  503. extern int load_contour_image ();
  504. extern int load_image ();
  505. extern int load_vector_image ();
  506. extern Panel make_p ();
  507. extern void pad_image ();
  508. extern void reverse ();
  509. extern int store_image ();
  510. extern void unpad_image ();
  511. extern int xstrcmp ();
  512. extern int xstrlen ();
  513. extern Notify_value main_destroy_interposer ();
  514. extern int getdirname ();
  515. extern int getbasename ();
  516. extern int swapdirnames ();
  517. extern int set_frame_label ();
  518. extern int strip_wspace ();
  519. extern int util_proc_saveall ();
  520.  
  521. extern void adjust_colormap ();
  522. extern void set_colormap ();
  523. extern void reset_colormap ();
  524. extern void set_frame_colormap ();
  525. extern void set_panel_colormap ();
  526. extern void set_canvas_colormap ();
  527.  
  528. /* EOF */
  529.  
  530. /* cat > headers/newdefine.h << "EOF" */
  531. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  532. /* newdefine.h: new definitions for CompositeTool    */
  533. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  534. /* SCCS information: %W%    %G% */
  535.  
  536. /*      --------        */
  537.  
  538. Pixfont        *font_panel_button, *font_panel;
  539. int             base_frame_up;
  540. struct s_image  s_logo_image;
  541. char            msg2[256];
  542. unsigned char   palette[768];
  543. char            pfntmp[MAXNAMELEN + 1];    /* temporary palette filename */
  544. int             grid_down;
  545. struct s_grid   lgrid;
  546. char            dprefont[60];
  547. char            dpostfont[20];
  548. char            fn_new_defaults[32];
  549. char            util_read_dir[MAXNAMELEN + 1];
  550.  
  551. Panel_item      util_pc_save,
  552.         util_pb_saveall;
  553.  
  554. /* EOF */
  555. /* cat > src+obj/main.c << "EOF" */
  556. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  557. /* main: main program                    */
  558. /*     CompositeTool authors:                */
  559. /*         1.0    - Mark Stupar            */
  560. /*         1.1    - Martin Knapp-Cordes        */
  561. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  562. /* SCCS information: %W%    %G% - NCSA */
  563.  
  564. /* #include "all.h" */
  565. /* #include "newext.h" */
  566. /* #include "define.h" */
  567. /* #include "newdefine.h" */
  568.  
  569. main (argc, argv)
  570.     int             argc;
  571.     char          **argv;
  572. {
  573.     register int    y;
  574.     register int    i;
  575.     char           *s;
  576.     char           *font_panel_file, *font_panel_button_file;
  577.     char           *logo_palette, *logo_image;
  578.     char           *initial_palette;
  579.     char           *text_font_dir, *text_font;
  580.  
  581.     strcpy (compat_hdr, "1988 July 19 format\n");
  582.  
  583. /* ~~~~~ base frame not up - for error messages ~~~~~~ */
  584.  
  585.     base_frame_up = FALSE;
  586.  
  587. /* ~~~~~ grid not down ~~~~~ */
  588.  
  589.     grid_down = FALSE;
  590.  
  591. /* ~~~~~ get fonts ~~~~~ */
  592.  
  593.     if ((font_panel_file = get_defaults (DEFAULT_FONT_PANEL)) == NULL)
  594.     {
  595.         bad_data2 ("No panel font file in private or master defaults database, CompositeTool terminated.",
  596.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  597.         exit (-1);
  598.     }
  599.     if ((font_panel = pf_open (font_panel_file)) == NULL)
  600.     {
  601.         sprintf (msg, "File = %s - Incorrect file name or nonexistent font. Check defaults database with defaultsedit.", font_panel_file);
  602.         bad_data2 ("Could not load panel font file, CompositeTool terminated.", msg);
  603.         exit (-1);
  604.     }
  605.     if ((font_panel_button_file = get_defaults (DEFAULT_FONT_PANEL_BUTTON)) == NULL)
  606.     {
  607.         bad_data2 ("No panel button font file in private or master defaults database, CompositeTool terminated.",
  608.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  609.         exit (-1);
  610.     };
  611.     if ((font_panel_button = pf_open (font_panel_button_file)) == NULL)
  612.     {
  613.         sprintf (msg, "File = %s - Incorrect file name or nonexistent font. Check defaults database with defaultsedit.", font_panel_file);
  614.         bad_data2 ("Could not load panel button font file, Compositetool terminated", msg);
  615.         exit (-1);
  616.     }
  617.     msg_no = 0;
  618.     for (i = 0; i < N_image + N_contour + N_vector + N_text; i++)
  619.         *(rw_toggle + i) = FALSE;
  620.     sw_draw = sw_move = sw_flash = FALSE;
  621.     csw_dump = csw_colorbar = csw_text = csw_image = csw_image = csw_contour = FALSE;
  622.     csw_vector = FALSE;
  623.     sw_palette = sw_text = sw_grid = sw_image = sw_vector = 0;
  624.     sw_contour = sw_colorbar = 0;
  625.     for (i = 0; i < 5; i++)
  626.     {
  627.         sw_i[i] = sw_c[i] = sw_v[i] = sw_t[i] = 0;
  628.     }
  629.  
  630. /* ~~~~~ get default text font directory and default text font ~~~~~ */
  631.  
  632.     if ((text_font_dir = get_defaults (DEFAULT_TEXT_FONT_DIR)) == NULL)
  633.     {
  634.         bad_data2 ("No default text font directory in private or master defaults database, CompositeTool terminated.",
  635.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  636.         exit (-1);
  637.     }
  638.     strcpy (dprefont, text_font_dir);
  639.     if ((text_font = get_defaults (DEFAULT_TEXT_FONT)) == NULL)
  640.     {
  641.         bad_data2 ("No default text font file in private or master defaults database, CompositeTool terminated.",
  642.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  643.         exit (-1);
  644.     }
  645.     strcpy (dpostfont, text_font);
  646.     for (i = 0; i < N_text; i++)
  647.         null_text (&text[i]);
  648.  
  649.     for (i = 0; i < N_image; i++)
  650.         null_image (&image[i]);
  651.     for (i = 0; i < N_image + N_contour + N_vector; i++)
  652.         null_feature (&feat[i]);
  653.     for (i = 0; i < N_contour; i++)
  654.         null_contour (&con[i]);
  655.     for (i = 0; i < N_vector; i++)
  656.         null_vector (&vec[i]);
  657.     null_colorbar (&cbar);
  658.     null_grid (&grid);
  659.  
  660. /* ~~~~~ load logo palette ~~~~~ */
  661.  
  662.     if ((logo_palette = get_defaults (DEFAULT_LOGO_PALETTE_FILE)) == NULL)
  663.     {
  664.         bad_data2 ("No logo palette file in private or master defaults database, CompositeTool terminated.",
  665.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  666.         exit (-1);
  667.     }
  668.     if (load_rgb (logo_palette, 1))    /* error on loading */
  669.         exit (-1);
  670.  
  671.     strcpy (sdump.fname, "");
  672.     clear_color = 0;
  673.     cbar.xpos = 800;
  674.     cbar.ypos = 200;
  675.     cbar.xpts = 100;
  676.     cbar.ypts = 256;
  677.     grid.xpix = 100;
  678.     grid.ypix = 100;
  679.     grid.color = 255;
  680.     sdump.xstart = sdump.ystart = sdump.xend = sdump.yend = 0;
  681.     s = b_cmsn;
  682.     *s++ = 'x';
  683.     my_itoa (getpid (), s);
  684.     strcpy (c_cmsn, b_cmsn);
  685.     strcat (c_cmsn, "x");
  686.  
  687.     fr[0] = window_create (NULL, FRAME,
  688.                    WIN_X, 0,
  689.                    WIN_Y, 0,
  690.                    WIN_HEIGHT, 1,
  691.                    WIN_WIDTH, 1,
  692.                    0);
  693.     c_frame = window_create (fr[0], FRAME,
  694.                  WIN_SHOW, FALSE,
  695.                  WIN_X, (N_xscr - 308) / 2,
  696.                  WIN_Y, (N_yscr - 219) / 2,
  697.                  WIN_HEIGHT, 219 + 10,
  698.                  WIN_WIDTH, 308 + 10,
  699.                  0);
  700.     canvas = window_create (c_frame, CANVAS,
  701.                 WIN_SHOW, FALSE,
  702.                 CANVAS_AUTO_SHRINK, FALSE,
  703.                 CANVAS_FIXED_IMAGE, FALSE,
  704.                 CANVAS_RETAINED, TRUE,
  705.                 CANVAS_WIDTH, N_hpix,
  706.                 CANVAS_HEIGHT, N_vpix,
  707.                 WIN_X, 0,
  708.                 WIN_Y, 0,
  709.                 0);
  710.     bpw = (Pixwin *) window_get (fr[0], WIN_PIXWIN);
  711.     cpw = canvas_pixwin (canvas);
  712.  
  713.     set_colormap ();
  714.  
  715.     window_set (c_frame, WIN_SHOW, TRUE, 0);
  716.     window_set (canvas, WIN_SHOW, TRUE, 0);
  717.  
  718. /* ~~~~~ load logo image ~~~~~ */
  719.  
  720.     if ((logo_image = get_defaults (DEFAULT_LOGO_IMAGE_FILE)) == NULL)
  721.     {
  722.         bad_data2 ("No logo image file in private or master defaults database, CompositeTool terminated.",
  723.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  724.         exit (-1);
  725.     }
  726.     strcpy (s_logo_image.fname, logo_image);
  727.     s_logo_image.xpos = 0;
  728.     s_logo_image.ypos = 0;
  729.     s_logo_image.xpts = 308;
  730.     s_logo_image.ypts = 219;
  731.  
  732.     if (draw_image (&s_logo_image, 1))    /* error on loading */
  733.         exit (-1);
  734.  
  735.     system ("sleep 3");
  736.     window_set (fr[0],
  737.             FRAME_SHOW_LABEL, TRUE,
  738.             FRAME_NO_CONFIRM, FALSE,
  739.             WIN_X, 0,
  740.             WIN_Y, 0,
  741.             WIN_HEIGHT, 180,    /* added 23 for new message line */
  742.             WIN_WIDTH, 900,
  743.             FRAME_DONE_PROC, no_op,
  744. /*            FRAME_INHERIT_COLORS, TRUE, */
  745.             0);
  746.     (void) set_frame_label (fr[0]);
  747.  
  748.     (void) notify_interpose_destroy_func (fr[0], main_destroy_interposer);
  749.  
  750.     y = (int) window_get (fr[0], WIN_Y, 0);
  751.     if (y > N_yscr - (int) window_get (fr[0], WIN_HEIGHT, 0) - 600)
  752.         y = 0;
  753.     else
  754.         y = (int) window_get (fr[0], WIN_HEIGHT, 0);
  755.     window_set (c_frame,
  756.             WIN_SHOW, FALSE,
  757.             FRAME_DONE_PROC, canvas_done,
  758.             WIN_X, 0,
  759.             WIN_Y, y,
  760.             WIN_HEIGHT, 600,
  761.             WIN_WIDTH, N_hpix + 10,
  762.             0);
  763.     window_set (canvas,
  764.             WIN_SHOW, FALSE,
  765.             WIN_EVENT_PROC, cpw_event,
  766.             WIN_CONSUME_PICK_EVENT, LOC_DRAG,
  767.             WIN_IGNORE_PICK_EVENT, MS_MIDDLE,
  768.             WIN_IGNORE_PICK_EVENT, MS_RIGHT,
  769.             0);
  770.     pa[0] = window_create (fr[0], PANEL, 0);
  771.     window_set (pa[0],
  772.             WIN_IGNORE_PICK_EVENT, MS_MIDDLE,
  773.             WIN_IGNORE_PICK_EVENT, MS_RIGHT,
  774.             0);
  775.  
  776. /* added 23 to each y for new message line */
  777.     make_pb (0, 10, 114, 0, 9, "Canvas");
  778.     make_pb (1, 115, 102, 0, 9, "FinalPic");
  779.     make_pb (2, 115, 125, 0, 9, "Clear");
  780.     make_pb (3, 235, 102, 0, 9, "Palette");
  781.     make_pb (4, 235, 125, 0, 9, "Grid");
  782.     make_pb (5, 330, 102, 0, 9, "ColorBar");
  783.     make_pb (6, 330, 125, 0, 9, "Text");
  784.     make_pb (7, 455, 102, 0, 9, "Image");
  785.     make_pb (8, 455, 125, 0, 9, "Contour");
  786.     make_pb (9, 550, 102, 0, 9, "Vector");
  787.     make_pb (10, 550, 125, 0, 9, "Feature");
  788.     make_pb (11, 670, 114, 0, 9, "FileUtil");
  789.     make_pb (12, 785, 114, 0, 9, "Quit");
  790.     window_set (fr[0], WIN_SHOW, FALSE, 0);
  791.  
  792. /* ~~~~~ load initial palette ~~~~~ */
  793.  
  794.     if ((initial_palette = get_defaults (DEFAULT_INITIAL_PALETTE_FILE)) == NULL)
  795.     {
  796.         bad_data2 ("No initial palette file in private or master defaults database, CompositeTool terminated.",
  797.                "Incorrect installation or change. Check defaults database with defaultsedit.");
  798.         exit (-1);
  799.     }
  800.     strcpy (pfn, initial_palette);
  801.     if (load_rgb (pfn, 1))    /* error on loading */
  802.         exit (-1);
  803.  
  804.     x1_save = mem_create (N_hpix, 1, 8);
  805.     x1_ptr = mpr_d (x1_save);
  806.     x2_save = mem_create (N_hpix, 1, 8);
  807.     x2_ptr = mpr_d (x2_save);
  808.     y1_save = mem_create (1, N_vpix, 8);    /* temp storage for filling last column of odd width images */
  809.     y1_ptr = mpr_d (y1_save);
  810.     y2_save = mem_create (1, N_vpix, 8);
  811.     y2_ptr = mpr_d (y2_save);
  812.  
  813.     for (i = 1; i <= 9; i++)
  814.     {
  815.         fr[i] = NULL;
  816.         pa[i] = NULL;
  817.     }
  818.  
  819.     reset_colormap ();
  820.  
  821.     make_pm (0, 10, 10, 0, "");
  822.     make_pm (1, 10, 33, 0, "");
  823.     make_pm (2, 10, 56, 0, "");
  824.     make_pm (3, 10, 79, 0, "");
  825.  
  826. /* ~~~~~ utility frame initializations ~~~~~~ */
  827.  
  828.     util_read_dir[0] = '\0';
  829.  
  830. /* ~~~~~ base frame up - for error messages ~~~~~~ */
  831.  
  832.     base_frame_up = TRUE;
  833.  
  834.     info_msg ("", "Base frame brought up.", "");
  835.  
  836.     window_main_loop (fr[0]);
  837.     return;
  838. }
  839. /* EOF */
  840. /* cat > src+obj/bad_data.c << "EOF" */
  841. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  842. /* bad_data: one-line error message            */
  843. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  844. /* SCCS information: %W%    %G% - NCSA */
  845.  
  846. /* #include "all.h" */
  847.  
  848. int    bad_data(s) char *s;
  849. {
  850.     info_msg("          ----- ERROR MESSAGE -----",
  851.          s,
  852.          "          ----- ERROR MESSAGE -----");
  853.     return;
  854. }
  855. /* EOF */
  856. /* cat > src+obj/canvas_done.c << "EOF" */
  857. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  858. /* canvas_done: put away the canvas            */
  859. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  860. /* SCCS information: %W%    %G% - NCSA */
  861.  
  862. /* #include "all.h" */
  863.  
  864. int    canvas_done()
  865. {
  866.         window_set(     canvas,WIN_SHOW,FALSE,0);
  867.         window_set(     c_frame,WIN_SHOW,FALSE,0);
  868.         panel_set(      pb[0],PANEL_SHOW_ITEM,TRUE,0);
  869.     reset_mcolorbar();
  870.     reset_mcontour();
  871.     reset_mimage();
  872.     reset_mtext();
  873.     reset_mvector();
  874.     info_msg("","Canvas put away and all draw and move buttons deactivated.","");
  875.         return;
  876. }
  877. /* EOF */
  878. /* cat > src+obj/check_file.c << "EOF" */
  879. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  880. /* check_file: return 0 if ok, 1 if file not openable,    */
  881. /*           2 if badpts for non-HDF files, 3 if HDF    */
  882. /*           file with new values, DFerror if HDF    */
  883. /*           error.                    */
  884. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  885. /* SCCS information: %W%    %G% - NCSA */
  886.  
  887. /* #include "all.h" */
  888. /* #include "newext.h" */
  889.  
  890. int    check_file(s, w1, h1, w2, h2, n)
  891.  
  892.            char    *s;
  893.            int    *w1, *h1, *w2, *h2;
  894.            int    n;     /* sequence number of image in HDF file */
  895. {
  896.     int        f, size, i, dummy;
  897.     DF        *file;
  898.  
  899.     if ((file = DFopen (s, DFACC_READ, 0)) == NULL)
  900.     {
  901.         if (DFerror == DFE_FNF)        /* file not found error */
  902.             return (1);
  903.         else if (DFerror == DFE_NOTDFFILE)    /* regular file */
  904.         {
  905.             stat(s,&my_stat);
  906.             size = (*w1) * (*h1);
  907.             if (my_stat.st_size != size) return(2);
  908.             return (0);
  909.         }
  910.         else
  911.             return (DFerror);    /* other HDF error */
  912.     }
  913.     DFclose (file);
  914.     for (i = 0; i < n; i++)
  915.         if (DFR8getdims (s, w2, h2, &dummy)) 
  916.             return (DFerror);        /* other HDF error */
  917.     if ((*w1) != (*w2) || (*h1) != (*h2))
  918.         return (3);            /* new size */
  919.     else
  920.         return (0);
  921.     
  922. }
  923. /* EOF */
  924. /* cat > src+obj/con_col.c << "EOF" */
  925. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  926. /* con_col: draw the contour "columns"            */
  927. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  928. /* SCCS information: %W%    %G% - NCSA */
  929.  
  930. /* #include "all.h" */
  931.  
  932. int    con_col(value,h,s) int value; unsigned char *h;
  933.                            struct s_contour *s;
  934. {
  935.         int             col_done,ph,use1;
  936.         unsigned char   *t,*u,*p,*q;
  937.         register int    k,use;
  938.             ph = s->xpts * (s->ypts - 1);
  939.         for (k = 0; k < s->xpts; k++)
  940.            {t = h + k;
  941.             u = h + ph + k;
  942.             p = t;
  943.             col_done = FALSE;
  944.             while (col_done == FALSE)
  945.                  {if (*p < value && col_done == FALSE)
  946.                     {while (*p < value && p < u) p += s->xpts;
  947.                      if (p == u)
  948.                        {col_done = TRUE;
  949.                         if (*p > value)
  950.                           {use = (p - t) / (s->xpts + 0);
  951.                            pw_put(cpw,s->xpos + k,s->ypos + use - 1,s->color);
  952.                           }
  953.                        }   
  954.                      else if (*p > value)
  955.                             {use = (p - t) / (s->xpts + 0);
  956.                              pw_put(cpw,s->xpos + k,s->ypos + use - 1,s->color);
  957.                             }
  958.                      else;
  959.                     }
  960.                   if (*p == value && col_done == FALSE)
  961.                     {q = p;
  962.                      while (*q == value && q < u) q += s->xpts;
  963.                      if (q == u) col_done = TRUE;
  964.                      use = (p - t) / (s->xpts + 0);
  965.                      use1 = (q - p) / (s->xpts + 0);
  966.                      pw_put(cpw,s->xpos + k,s->ypos + use - 1 + use1/2,s->color);
  967.                      p = q;
  968.                     }
  969.                   if (*p > value && col_done == FALSE)
  970.                     {while (*p > value && p < u) p += s->xpts;
  971.                      if (p == u)
  972.                        {col_done = TRUE;
  973.                         if (*p < value)
  974.                           {use = (p - t) / (s->xpts + 0);
  975.                            pw_put(cpw,s->xpos + k,s->ypos + use - 1,s->color);
  976.                           }
  977.                        }   
  978.                      else if (*p < value)
  979.                             {use = (p - t) / (s->xpts + 0);
  980.                              pw_put(cpw,s->xpos + k,s->ypos + use - 1,s->color);
  981.                             }
  982.                      else;
  983.                     }
  984.                  }   
  985.            }
  986.         return;
  987. }
  988. /* EOF */
  989. /* cat > src+obj/con_row.c << "EOF" */
  990. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  991. /* con_row: draw the contour "rows"            */
  992. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  993. /* SCCS information: %W%    %G% - NCSA */
  994.  
  995. /* #include "all.h" */
  996.  
  997. int     con_row(value,h,s) int value; unsigned char *h;
  998.                              struct s_contour *s;
  999. {
  1000.         int             row_done,ph;
  1001.         unsigned char   *t,*u,*p,*q;
  1002.         register int    k;
  1003.         for (k = 0; k < s->ypts; k++)
  1004.            {ph = s->xpts * k;
  1005.             t = h + ph;
  1006.             u = t + s->xpts - 1;
  1007.             p = t;
  1008.             row_done = FALSE;
  1009.             while (row_done == FALSE)
  1010.                  {if (*p < value && row_done == FALSE)
  1011.                     {while (*p < value && p < u) p++;
  1012.                      if (p == u)
  1013.                        {row_done = TRUE;
  1014.                         if (*p > value)
  1015.                            pw_put(cpw,s->xpos + p - t - 1,s->ypos + k,s->color);
  1016.                        } 
  1017.                      else if (*p > value)
  1018.                              pw_put(cpw,s->xpos + p - t - 1,s->ypos + k,s->color);
  1019.                      else;
  1020.                     }
  1021.                   if (*p == value && row_done == FALSE)
  1022.                     {q = p;
  1023.                      while (*q == value && q < u) q++;
  1024.                      if (q == u) row_done = TRUE;
  1025.                      pw_put(cpw,s->xpos + p - t - 1 + (q - p)/2,s->ypos + k,s->color);
  1026.                      p = q;
  1027.                     }
  1028.                   if (*p > value && row_done == FALSE)
  1029.                     {while (*p > value && p < u) p++;
  1030.                      if (p == u)
  1031.                        {row_done = TRUE;
  1032.                         if (*p < value)
  1033.                            pw_put(cpw,s->xpos + p - t - 1,s->ypos + k,s->color);
  1034.                        } 
  1035.                      else if (*p < value)
  1036.                              pw_put(cpw,s->xpos + p - t - 1,s->ypos + k,s->color);
  1037.                      else;
  1038.                     }
  1039.                  }   
  1040.            }
  1041.         return;
  1042. }
  1043. /* EOF */
  1044. /* cat > src+obj/confirm_colorbar.c << "EOF" */
  1045. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1046. /* confirm_colorbar: confirm TRUE if colorbar display    */
  1047. /*             is not stored data            */
  1048. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1049. /* SCCS information: %W%    %G% - NCSA */
  1050.  
  1051. /* #include "all.h" */
  1052.  
  1053. int    confirm_colorbar()
  1054. {
  1055.     if (0 == cbar.xpts)    strcpy(txt,"");
  1056.     else            my_itoa(cbar.xpts,txt);
  1057.     if (0 != strcmp(txt,panel_get(pt[6],PANEL_VALUE,0)))
  1058.            return(TRUE);
  1059.     if (0 == cbar.ypts)    strcpy(txt,"");
  1060.     else            my_itoa(cbar.ypts,txt);
  1061.     if (0 != strcmp(txt,panel_get(pt[7],PANEL_VALUE,0)))
  1062.            return(TRUE);
  1063.     if (0 == cbar.xpos)    strcpy(txt,"");
  1064.     else            my_itoa(cbar.xpos,txt);
  1065.     if (0 != strcmp(txt,panel_get(pt[8],PANEL_VALUE,0)))
  1066.            return(TRUE);
  1067.     if (0 == cbar.ypos)    strcpy(txt,"");
  1068.     else            my_itoa(cbar.ypos,txt);
  1069.     if (0 != strcmp(txt,panel_get(pt[9],PANEL_VALUE,0)))
  1070.            return(TRUE);
  1071.     return(FALSE);
  1072. }
  1073. /* EOF */
  1074. /* cat > src+obj/confirm_contour.c << "EOF" */
  1075. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1076. /* confirm_contour: confirm TRUE if contour display is    */
  1077. /*            not stored data            */
  1078. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1079. /* SCCS information: %W%    %G% - NCSA */
  1080.  
  1081. /* #include "all.h" */
  1082.  
  1083. int    confirm_contour()
  1084. {
  1085.     if (0 != strcmp(con[nc].fname,panel_get(pt[29],PANEL_VALUE,0)))
  1086.        return(TRUE);
  1087.     if (0 == con[nc].xpts)    strcpy(txt,"");
  1088.     else            my_itoa(con[nc].xpts,txt);
  1089.     if (0 != strcmp(txt,panel_get(pt[30],PANEL_VALUE,0)))
  1090.            return(TRUE);
  1091.     if (0 == con[nc].ypts)    strcpy(txt,"");
  1092.     else            my_itoa(con[nc].ypts,txt);
  1093.     if (0 != strcmp(txt,panel_get(pt[31],PANEL_VALUE,0)))
  1094.            return(TRUE);
  1095.     if (0 == con[nc].xpos)    strcpy(txt,"");
  1096.     else            my_itoa(con[nc].xpos,txt);
  1097.     if (0 != strcmp(txt,panel_get(pt[32],PANEL_VALUE,0)))
  1098.            return(TRUE);
  1099.     if (0 == con[nc].ypos)    strcpy(txt,"");
  1100.     else            my_itoa(con[nc].ypos,txt);
  1101.     if (0 != strcmp(txt,panel_get(pt[33],PANEL_VALUE,0)))
  1102.            return(TRUE);
  1103.     if (0 == con[nc].color)    strcpy(txt,"");
  1104.     else            my_itoa(con[nc].color,txt);
  1105.     if (0 != strcmp(txt,panel_get(pt[34],PANEL_VALUE,0)))
  1106.            return(TRUE);
  1107.     if (0 == con[nc].first)    strcpy(txt,"");
  1108.     else            my_itoa(con[nc].first,txt);
  1109.     if (0 != strcmp(txt,panel_get(pt[35],PANEL_VALUE,0)))
  1110.            return(TRUE);
  1111.     if (0 == con[nc].last)    strcpy(txt,"");
  1112.     else            my_itoa(con[nc].last,txt);
  1113.     if (0 != strcmp(txt,panel_get(pt[36],PANEL_VALUE,0)))
  1114.            return(TRUE);
  1115.     if (0 == con[nc].interval)    strcpy(txt,"");
  1116.     else            my_itoa(con[nc].interval,txt);
  1117.     if (0 != strcmp(txt,panel_get(pt[37],PANEL_VALUE,0)))
  1118.            return(TRUE);
  1119.     return(FALSE);
  1120. }
  1121. /* EOF */
  1122. /* cat > src+obj/confirm_grid.c << "EOF" */
  1123. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1124. /* confirm_grid: confirm TRUE if grid display is not    */
  1125. /*         stored data                */
  1126. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1127. /* SCCS information: %W%    %G% - NCSA */
  1128.  
  1129. /* #include "all.h" */
  1130.  
  1131. int    confirm_grid()
  1132. {
  1133.     if (0 == grid.color)    strcpy(txt,"");
  1134.     else            my_itoa(grid.color,txt);
  1135.     if (0 != strcmp(txt,panel_get(pt[2],PANEL_VALUE,0)))
  1136.            return(TRUE);
  1137.     if (0 == grid.xpix)    strcpy(txt,"");
  1138.     else            my_itoa(grid.xpix,txt);
  1139.     if (0 != strcmp(txt,panel_get(pt[3],PANEL_VALUE,0)))
  1140.            return(TRUE);
  1141.     if (0 == grid.ypix)    strcpy(txt,"");
  1142.     else            my_itoa(grid.ypix,txt);
  1143.     if (0 != strcmp(txt,panel_get(pt[4],PANEL_VALUE,0)))
  1144.            return(TRUE);
  1145.     return(FALSE);
  1146. }
  1147. /* EOF */
  1148. /* cat > src+obj/confirm_image.c << "EOF" */
  1149. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1150. /* confirm_image: confirm TRUE if image display is not    */
  1151. /*          stored data                */
  1152. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1153. /* SCCS information: %W%    %G% - NCSA */
  1154.  
  1155. /* #include "all.h" */
  1156.  
  1157. int    confirm_image()
  1158. {
  1159.     if (0 != strcmp(image[ni].fname,panel_get(pt[27],PANEL_VALUE,0)))
  1160.        return(TRUE);
  1161.     if (0 == image[ni].xpts)    strcpy(txt,"");
  1162.     else            my_itoa(image[ni].xpts,txt);
  1163.     if (0 != strcmp(txt,panel_get(pt[23],PANEL_VALUE,0)))
  1164.            return(TRUE);
  1165.     if (0 == image[ni].ypts)    strcpy(txt,"");
  1166.     else            my_itoa(image[ni].ypts,txt);
  1167.     if (0 != strcmp(txt,panel_get(pt[24],PANEL_VALUE,0)))
  1168.            return(TRUE);
  1169.     if (0 == image[ni].xpos)    strcpy(txt,"");
  1170.     else            my_itoa(image[ni].xpos,txt);
  1171.     if (0 != strcmp(txt,panel_get(pt[25],PANEL_VALUE,0)))
  1172.            return(TRUE);
  1173.     if (0 == image[ni].ypos)    strcpy(txt,"");
  1174.     else            my_itoa(image[ni].ypos,txt);
  1175.     if (0 != strcmp(txt,panel_get(pt[26],PANEL_VALUE,0)))
  1176.            return(TRUE);
  1177.     return(FALSE);
  1178. }
  1179. /* EOF */
  1180. /* cat > src+obj/confirm_palette.c << "EOF" */
  1181. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1182. /* confirm_palette: confirm TRUE if palette display is    */
  1183. /*            not stored data            */
  1184. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1185. /* SCCS information: %W%    %G% - NCSA */
  1186.  
  1187. /* #include "all.h" */
  1188.  
  1189. int    confirm_palette()
  1190. {
  1191.     if (0 != strcmp(pfn,panel_get(pt[0],PANEL_VALUE,0)))
  1192.        return(TRUE);
  1193.     if (0 == clear_color)
  1194.        strcpy(txt,"");
  1195.     else
  1196.        my_itoa(clear_color,txt);
  1197.     if (0 != strcmp(txt,panel_get(pt[1],PANEL_VALUE,0)))
  1198.        return(TRUE);
  1199.     return(FALSE);
  1200. }
  1201. /* EOF */
  1202. /* cat > src+obj/confirm_text.c << "EOF" */
  1203. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1204. /* confirm_text: confirm TRUE if text display is not    */
  1205. /*         stored data                */
  1206. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1207. /* SCCS information: %W%    %G% - NCSA */
  1208.  
  1209. /* #include "all.h" */
  1210.  
  1211. int    confirm_text()
  1212. {
  1213.     if (0 == text[nt].color)    strcpy(txt,"");
  1214.     else            my_itoa(text[nt].color,txt);
  1215.     if (0 != strcmp(txt,panel_get(pt[11],PANEL_VALUE,0)))
  1216.            return(TRUE);
  1217.     if (0 == text[nt].xpos)    strcpy(txt,"");
  1218.     else            my_itoa(text[nt].xpos,txt);
  1219.     if (0 != strcmp(txt,panel_get(pt[12],PANEL_VALUE,0)))
  1220.            return(TRUE);
  1221.     if (0 == text[nt].ypos)    strcpy(txt,"");
  1222.     else            my_itoa(text[nt].ypos,txt);
  1223.     if (0 != strcmp(txt,panel_get(pt[13],PANEL_VALUE,0)))
  1224.            return(TRUE);
  1225.     if (0 != strcmp(text[nt].body,panel_get(pt[14],PANEL_VALUE,0)))
  1226.        return(TRUE);
  1227.     if (0 != strcmp(text[nt].prefont,panel_get(pt[15],PANEL_VALUE,0)))
  1228.        return(TRUE);
  1229.     if (0 != strcmp(text[nt].postfont,panel_get(pt[16],PANEL_VALUE,0)))
  1230.        return(TRUE);
  1231.     return(FALSE);
  1232. }
  1233. /* EOF */
  1234. /* cat > src+obj/confirm_vector.c << "EOF" */
  1235. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1236. /* confirm_vector: confirm TRUE if vector display is    */
  1237. /*           not stored data            */
  1238. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1239. /* SCCS information: %W%    %G% - NCSA */
  1240.  
  1241. /* #include "all.h" */
  1242.  
  1243. int    confirm_vector()
  1244. {
  1245.     float    f;
  1246.     if (0 != strcmp(vec[nv].xname,panel_get(pt[39],PANEL_VALUE,0)))
  1247.        return(TRUE);
  1248.     if (0 != strcmp(vec[nv].yname,panel_get(pt[40],PANEL_VALUE,0)))
  1249.        return(TRUE);
  1250.     if (0 == vec[nv].xpts)    strcpy(txt,"");
  1251.     else            my_itoa(vec[nv].xpts,txt);
  1252.     if (0 != strcmp(txt,panel_get(pt[41],PANEL_VALUE,0)))
  1253.            return(TRUE);
  1254.     if (0 == vec[nv].ypts)    strcpy(txt,"");
  1255.     else            my_itoa(vec[nv].ypts,txt);
  1256.     if (0 != strcmp(txt,panel_get(pt[42],PANEL_VALUE,0)))
  1257.            return(TRUE);
  1258.     if (0 == vec[nv].xpos)    strcpy(txt,"");
  1259.     else            my_itoa(vec[nv].xpos,txt);
  1260.     if (0 != strcmp(txt,panel_get(pt[43],PANEL_VALUE,0)))
  1261.            return(TRUE);
  1262.     if (0 == vec[nv].ypos)    strcpy(txt,"");
  1263.     else            my_itoa(vec[nv].ypos,txt);
  1264.     if (0 != strcmp(txt,panel_get(pt[44],PANEL_VALUE,0)))
  1265.            return(TRUE);
  1266.     if (0 == vec[nv].xzero)    strcpy(txt,"");
  1267.     else            my_itoa(vec[nv].xzero,txt);
  1268.     if (0 != strcmp(txt,panel_get(pt[45],PANEL_VALUE,0)))
  1269.            return(TRUE);
  1270.     if (0 == vec[nv].yzero)    strcpy(txt,"");
  1271.     else            my_itoa(vec[nv].yzero,txt);
  1272.     if (0 != strcmp(txt,panel_get(pt[46],PANEL_VALUE,0)))
  1273.            return(TRUE);
  1274.     if (FALSE == my_isfloat(panel_get(pt[47],PANEL_VALUE,0)))
  1275.        return(TRUE);
  1276.     my_atof(&f,panel_get(pt[47],PANEL_VALUE,0));
  1277.     if ( vec[nv].xscale != f)
  1278.        return(TRUE);
  1279.     if (0 == vec[nv].xstart)    strcpy(txt,"");
  1280.     else            my_itoa(vec[nv].xstart,txt);
  1281.     if (0 != strcmp(txt,panel_get(pt[48],PANEL_VALUE,0)))
  1282.            return(TRUE);
  1283.     if (0 == vec[nv].ystart)    strcpy(txt,"");
  1284.     else            my_itoa(vec[nv].ystart,txt);
  1285.     if (0 != strcmp(txt,panel_get(pt[49],PANEL_VALUE,0)))
  1286.            return(TRUE);
  1287.     if (0 == vec[nv].xend)    strcpy(txt,"");
  1288.     else            my_itoa(vec[nv].xend,txt);
  1289.     if (0 != strcmp(txt,panel_get(pt[50],PANEL_VALUE,0)))
  1290.            return(TRUE);
  1291.     if (0 == vec[nv].yend)    strcpy(txt,"");
  1292.     else            my_itoa(vec[nv].yend,txt);
  1293.     if (0 != strcmp(txt,panel_get(pt[51],PANEL_VALUE,0)))
  1294.            return(TRUE);
  1295.     if (0 == vec[nv].xinterval)    strcpy(txt,"");
  1296.     else            my_itoa(vec[nv].xinterval,txt);
  1297.     if (0 != strcmp(txt,panel_get(pt[52],PANEL_VALUE,0)))
  1298.            return(TRUE);
  1299.     if (0 == vec[nv].yinterval)    strcpy(txt,"");
  1300.     else            my_itoa(vec[nv].yinterval,txt);
  1301.     if (0 != strcmp(txt,panel_get(pt[53],PANEL_VALUE,0)))
  1302.            return(TRUE);
  1303.     if (0 == vec[nv].color)    strcpy(txt,"");
  1304.     else            my_itoa(vec[nv].color,txt);
  1305.     if (0 != strcmp(txt,panel_get(pt[54],PANEL_VALUE,0)))
  1306.            return(TRUE);
  1307.     if (0 == vec[nv].maxlen)    strcpy(txt,"");
  1308.     else            my_itoa(vec[nv].maxlen,txt);
  1309.     if (0 != strcmp(txt,panel_get(pt[55],PANEL_VALUE,0)))
  1310.            return(TRUE);
  1311.     if (FALSE == my_isfloat(panel_get(pt[56],PANEL_VALUE,0)))
  1312.        return(TRUE);
  1313.     my_atof(&f,panel_get(pt[56],PANEL_VALUE,0));
  1314.     if ( vec[nv].yscale != f)
  1315.        return(TRUE);
  1316.     return(FALSE);
  1317. }
  1318. /* EOF */
  1319. /* cat > src+obj/cpw_check.c << "EOF" */
  1320. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1321. /* cpw_check: TRUE if a frame is using the canvas    */
  1322. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1323. /* SCCS information: %W%    %G% - NCSA */
  1324.  
  1325. /* #include "all.h" */
  1326.  
  1327. int    cpw_check()
  1328. {
  1329.     if (csw_dump == TRUE)
  1330.        {bad_data("File Utility frame using canvas mouse until you specify otherwise.");
  1331.         return(TRUE);
  1332.        }
  1333.     if (csw_colorbar == TRUE)
  1334.        {bad_data("ColorBar frame using canvas mouse until you specify otherwise.");
  1335.         return(TRUE);
  1336.        }
  1337.     if (csw_image == TRUE)
  1338.        {bad_data("Image frame using canvas mouse until you specify otherwise.");
  1339.         return(TRUE);
  1340.        }
  1341.     if (csw_contour == TRUE)
  1342.        {bad_data("Contour frame using canvas mouse until you specify otherwise.");
  1343.         return(TRUE);
  1344.        }
  1345.     if (csw_text == TRUE)
  1346.        {bad_data("Text frame using canvas mouse until you specify otherwise.");
  1347.         return(TRUE);
  1348.        }
  1349.     if (csw_vector == TRUE)
  1350.        {bad_data("Vector frame using canvas mouse until you specify otherwise.");
  1351.         return(TRUE);
  1352.        }
  1353.     return(FALSE);
  1354. }
  1355. /* EOF */
  1356. /* cat > src+obj/cpw_event.c << "EOF" */
  1357. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1358. /* cpw_event: canvas events, pixwin is cpw                */
  1359. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1360. /* SCCS information: %W%    %G% - NCSA */
  1361.  
  1362. /* #include "all.h" */
  1363.  
  1364. int    cpw_event(c,e) Canvas c; Event *e;
  1365. {
  1366.     int    x     = event_x(e),
  1367.         y     = event_y(e),
  1368.         down,
  1369.         drag,
  1370.         up,
  1371.         leave;
  1372.     if    (event_id(e) == LOC_WINEXIT)
  1373.         {drag    = FALSE;
  1374.          down    = FALSE;
  1375.          up    = FALSE;
  1376.          leave    = TRUE;
  1377.         }
  1378.     else if    (event_id(e) == LOC_DRAG)
  1379.         {drag    = TRUE;
  1380.          down    = FALSE;
  1381.          up    = FALSE;
  1382.          leave    = FALSE;
  1383.         }
  1384.     else if    (event_id(e) == MS_LEFT && event_is_down(e))
  1385.         {drag    = FALSE;
  1386.          down    = TRUE;
  1387.          up    = FALSE;
  1388.          leave    = FALSE;
  1389.         }
  1390.     else if    (event_id(e) == MS_LEFT && event_is_up(e))
  1391.         {drag    = FALSE;
  1392.          down    = FALSE;
  1393.          up    = TRUE;
  1394.          leave    = FALSE;
  1395.         }
  1396.     else
  1397.         {down    = FALSE;
  1398.          drag    = FALSE;
  1399.          up    = FALSE;
  1400.          leave    = FALSE;
  1401.         }
  1402.         if      (csw_dump     == TRUE)    event_dump(    x,y,down,drag,up,leave);
  1403.         else if    (csw_colorbar == TRUE)    event_colorbar(    x,y,down,drag,up,leave);
  1404.         else if    (csw_text     == TRUE)    event_text(    x,y,down,drag,up,leave);
  1405.         else if    (csw_image    == TRUE)    event_image(    x,y,down,drag,up,leave);
  1406.         else if    (csw_contour  == TRUE)    event_contour(    x,y,down,drag,up,leave);
  1407.         else if    (csw_vector   == TRUE)    event_vector(    x,y,down,drag,up,leave);
  1408.     else    return;
  1409. }
  1410. /* EOF */
  1411. /* cat > src+obj/draw_box.c << "EOF" */
  1412. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1413. /* draw_box: for mouse operations on the canvas        */
  1414. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1415. /* SCCS information: %W%    %G% - NCSA */
  1416.  
  1417. /* #include "all.h" */
  1418.  
  1419. int    draw_box(s,x1,y1,x2,y2)
  1420.          char    *s;
  1421.          int    x1,y1,x2,y2;
  1422. {
  1423.  
  1424.     if    (0 == strcmp(s,"read"))
  1425.         {pw_read(x1_save,0,0,N_hpix,1,PIX_SRC,cpw,0,y1);
  1426.          pw_read(x2_save,0,0,N_hpix,1,PIX_SRC,cpw,0,y2);
  1427.          pw_read(y1_save,0,0,1,N_vpix,PIX_SRC,cpw,x1,0);
  1428.          pw_read(y2_save,0,0,1,N_vpix,PIX_SRC,cpw,x2,0);
  1429.         }
  1430.     else if    (0 == strcmp(s,"write"))
  1431.         {pw_write(cpw,0,y1,N_hpix,1,PIX_SRC,x1_save,0,0);
  1432.          pw_write(cpw,0,y2,N_hpix,1,PIX_SRC,x2_save,0,0);
  1433.          pw_write(cpw,x1,0,1,N_vpix,PIX_SRC,y1_save,0,0);
  1434.          pw_write(cpw,x2,0,1,N_vpix,PIX_SRC,y2_save,0,0);
  1435.         }
  1436.     else if    (0 == strcmp(s,"draw"))
  1437.         {pw_vector(cpw,x1,y1,x1,y2,PIX_SRC,255);
  1438.          pw_vector(cpw,x1,y2,x2,y2,PIX_SRC,255);
  1439.          pw_vector(cpw,x2,y2,x2,y1,PIX_SRC,255);
  1440.          pw_vector(cpw,x2,y1,x1,y1,PIX_SRC,255);
  1441.         }
  1442.     else;
  1443.     return;
  1444. }
  1445. /* EOF */
  1446. /* cat > src+obj/draw_colorbar.c << "EOF" */
  1447. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1448. /* draw_colorbar: draw the colorbar on the canvas    */
  1449. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1450. /* SCCS information: %W%    %G% - NCSA */
  1451.  
  1452. /* #include "all.h" */
  1453.  
  1454. int    draw_colorbar(s) struct s_colorbar *s;
  1455. {
  1456.         int             c;
  1457.         float           f = 255.00001/s->ypts;
  1458.         register int    i;
  1459.         for (i = 0; i < s->ypts; i++)
  1460.            {c = f * i;
  1461.         pw_rop(cpw,s->xpos,
  1462.                s->ypos + s->ypts - 1 - i,
  1463.                s->xpts,
  1464.                1,
  1465.            PIX_SRC | ((c) << 5),NULL,0,0);
  1466.            }
  1467.         return;
  1468. }
  1469. /* EOF */
  1470. /* cat > src+obj/draw_contour.c << "EOF" */
  1471. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1472. /* draw_contour: draw a contour on the canvas        */
  1473. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1474. /* SCCS information: %W%    %G% - NCSA */
  1475.  
  1476. /* #include "all.h" */
  1477. /* #include "newext.h" */
  1478.  
  1479. int     draw_contour(s, n) struct s_contour *s;
  1480.                int n; /* sequence number of image in HDF file */
  1481. {
  1482.     int    z;
  1483.     int    nxpts, nypts, filetype;
  1484.  
  1485.     z = check_image (s->fname, &(s->xpts), &(s->ypts), &nxpts, &nypts, n, &filetype);
  1486.     if    (z == 1)
  1487.     {
  1488.         sprintf (msg, "File = %s", s->fname);
  1489.                 bad_data2 ("Cannot open contour file, request ignored.", msg);
  1490.                 return;
  1491.     }
  1492.         else if (z == 2)
  1493.     {
  1494.         sprintf (msg, "File = %s", s->fname);
  1495.                 bad_data2 ("X-pts * Y-pts != contour filesize, request ignored.", msg);
  1496.                 return;
  1497.     }
  1498.     else if (z == 3)
  1499.     {
  1500.         sprintf (msg, "File = %s", s->fname);
  1501.         bad_data2 ("Not enough images in HDF file for contour image, request ignored.", msg);
  1502.         return;
  1503.     }
  1504.     else if (z < 0)        /* HDF error */
  1505.     {
  1506.         sprintf (msg, "HDF file error (DFerror = %d) for contour image, request ignored.", z);
  1507.         sprintf (msg2, "File = %s", s->fname);
  1508.         bad_data2 (msg, msg2);
  1509.         return;
  1510.     }
  1511.     if (z == 4)        /* HDF - different size */
  1512.     {
  1513.         sprintf (msg, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d)", s->fname, s->xpts, s->ypts, nxpts, nypts);
  1514.         info_msg2 ("           ----- INFORMATION MESSAGE -----",
  1515.                "HDF file image dimensions used for contour image.", msg,
  1516.                "           ----- INFORMATION MESSAGE -----");
  1517.         z = 0;
  1518.         s->xpts = nxpts;
  1519.         s->ypts = nypts;
  1520.     }
  1521.         if (z == 0)
  1522.     {
  1523.             unsigned char   *h;
  1524.             int             cfirst,clast,cinterval,f;
  1525.             register int    i,j;
  1526.  
  1527.             if (s->first < 0)          cfirst = 0;
  1528.             else if (s->first > 255)   cfirst = 255;
  1529.             else                       cfirst = s->first;
  1530.             if (s->last < cfirst)      clast = cfirst;
  1531.             else if (s->last > 255)    clast = 255;
  1532.             else                       clast = s->last;
  1533.             if (s->interval < 1)       cinterval = 9999;
  1534.             else                       cinterval = s->interval;
  1535.         if (NULL == (h = (unsigned char *)calloc(s->xpts * s->ypts,
  1536.                               sizeof(unsigned char))))
  1537.         {
  1538.             bad_data ("Cannot allocate contour memory, request ignored.");
  1539.                  return;
  1540.         }
  1541.         if (load_contour_image (s->fname, s->xpts, s->ypts, h, n))
  1542.         {
  1543.             free ((char *) h);
  1544.             return;
  1545.         }
  1546.             for (i = cfirst; i <= clast; i += cinterval)
  1547.         {
  1548.                    con_row(i,h,s);
  1549.                           con_col(i,h,s);
  1550.                }
  1551.             free((char *) h);
  1552.             return;
  1553.     }
  1554.     else
  1555.     {
  1556.         bad_data("This contour error message is not possible.");
  1557.         return;
  1558.     }
  1559. }
  1560. /* EOF */
  1561. /* cat > src+obj/draw_feature.c << "EOF" */
  1562. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1563. /* draw_feature: draw the overlay features        */
  1564. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1565. /* SCCS information: %W%    %G% - NCSA */
  1566.  
  1567. /* #include "all.h" */
  1568.  
  1569. int    draw_feature(s,n,z) struct s_feature *s;
  1570.                 int    n,z;
  1571. {
  1572.  
  1573.     int        x1,x2,y1,y2;
  1574.     int        t,u,c;
  1575.     register int    i;
  1576.     if (n >= N_image + N_contour)
  1577.        {x1 = vec[n - N_image - N_contour].xpos;
  1578.         y2 = vec[n - N_image - N_contour].ypos;
  1579.         x2 = x1 - 1 + vec[n - N_image - N_contour].xpts;
  1580.         y1 = y2 - 1 + vec[n - N_image - N_contour].ypts;
  1581.        }
  1582.     else if (n < N_image)
  1583.        {x1 = image[n].xpos;
  1584.         y2 = image[n].ypos;
  1585.         x2 = x1 - 1 + image[n].xpts;
  1586.         y1 = y2 - 1 + image[n].ypts;
  1587.        }
  1588.     else
  1589.        {x1 = con[n - N_image].xpos;
  1590.         y2 = con[n - N_image].ypos;
  1591.         x2 = x1 - 1 + con[n - N_image].xpts;
  1592.         y1 = y2 - 1 + con[n - N_image].ypts;
  1593.        }
  1594.     if (x1 > x2 || y2 > y1)
  1595.        {bad_data("start/end pts prob:  remember features uses STORED values, not displayed.");
  1596.         return(1);
  1597.        }
  1598.  
  1599.     if (TRUE == s->xgr_sw)
  1600.        {t = s->xgr_thick / 2;
  1601.         if (z == FALSE)    c = clear_color;
  1602.         else        c = s->xgr_color;
  1603.         for (i = x1 + s->xgr_space; i < x2; i += s->xgr_space)
  1604.         pw_rop(cpw,i - t,y2,s->xgr_thick,y1 - y2 + 1,
  1605.                PIX_SRC | ((c) << 5),NULL,0,0);
  1606.        }
  1607.  
  1608.     if (TRUE == s->ygr_sw)
  1609.        {t = s->ygr_thick / 2;
  1610.         if (z == TRUE)    c = s->ygr_color;
  1611.         else        c = clear_color;
  1612.         for (i = y1 - s->ygr_space; i > y2; i -= s->ygr_space)
  1613.         pw_rop(cpw,x1,i - t,x2 - x1 + 1,s->ygr_thick,
  1614.                PIX_SRC | ((c) << 5),NULL,0,0);
  1615.        }
  1616.  
  1617.     if (TRUE == s->xax_sw)
  1618.        {if (z == TRUE)    c = s->xax_color;
  1619.         else        c = clear_color;
  1620.         if (s->yax_sw == FALSE || (s->yax_sw == TRUE && s->yax_left == FALSE &&
  1621.         s->yax_right == FALSE))
  1622.            {if (s->xax_bot == TRUE)
  1623.            pw_rop(cpw,x1,
  1624.                   y1 + 1,
  1625.                   x2 - x1 + 1,
  1626.                   s->xax_thick,
  1627.               PIX_SRC | ((c) << 5),NULL,0,0);
  1628.             if (s->xax_top == TRUE)
  1629.            pw_rop(cpw,x1,
  1630.                   y2 - s->xax_thick,
  1631.                   x2 - x1 + 1,
  1632.                   s->xax_thick,
  1633.               PIX_SRC | ((c) << 5),NULL,0,0);
  1634.            }
  1635.         if (s->yax_sw == TRUE && s->yax_left == TRUE && s->yax_right == FALSE)
  1636.            {if (s->xax_bot == TRUE)
  1637.            pw_rop(cpw,x1 - s->yax_thick,
  1638.                   y1 + 1,
  1639.                   x2 - x1 + 1 + s->yax_thick,
  1640.                   s->xax_thick,
  1641.               PIX_SRC | ((c) << 5),NULL,0,0);
  1642.             if (s->xax_top == TRUE)
  1643.            pw_rop(cpw,x1 - s->yax_thick,
  1644.                   y2 - s->xax_thick,
  1645.                   x2 - x1 + 1 + s->yax_thick,
  1646.                   s->xax_thick,
  1647.               PIX_SRC | ((c) << 5),NULL,0,0);
  1648.            }
  1649.     
  1650.         if (s->yax_sw == TRUE && s->yax_left == FALSE && s->yax_right == TRUE)
  1651.            {if (s->xax_bot == TRUE)
  1652.            pw_rop(cpw,x1,
  1653.                   y1 + 1,
  1654.                   x2 - x1 + 1 + s->yax_thick,
  1655.                   s->xax_thick,
  1656.               PIX_SRC | ((c) << 5),NULL,0,0);
  1657.             if (s->xax_top == TRUE)
  1658.            pw_rop(cpw,x1,
  1659.                   y2 - s->xax_thick,
  1660.                   x2 - x1 + 1 + s->yax_thick,
  1661.                   s->xax_thick,
  1662.               PIX_SRC | ((c) << 5),NULL,0,0);
  1663.            }
  1664.     
  1665.         if (s->yax_sw == TRUE && s->yax_left == TRUE  && s->yax_right == TRUE)
  1666.            {if (s->xax_bot == TRUE)
  1667.            pw_rop(cpw,x1 - s->yax_thick,
  1668.                   y1 + 1,
  1669.                   x2 - x1 + 1 + s->yax_thick +s->yax_thick,
  1670.                   s->xax_thick,
  1671.               PIX_SRC | ((c) << 5),NULL,0,0);
  1672.             if (s->xax_top == TRUE)
  1673.            pw_rop(cpw,x1 - s->yax_thick,
  1674.                   y2 - s->xax_thick,
  1675.                   x2 - x1 + 1 + s->yax_thick + s->yax_thick,
  1676.                   s->xax_thick,
  1677.               PIX_SRC | ((c) << 5),NULL,0,0);
  1678.            }
  1679.     
  1680.        }
  1681.  
  1682.     if (TRUE == s->yax_sw)
  1683.        {if (z == TRUE)    c = s->yax_color;
  1684.         else        c = clear_color;
  1685.         if (s->xax_sw == FALSE || (s->xax_sw == TRUE && s->xax_bot == FALSE &&
  1686.         s->xax_top == FALSE))
  1687.            {if (s->yax_left == TRUE)
  1688.            pw_rop(cpw,x1 - s->yax_thick,
  1689.                   y2,
  1690.                   s->yax_thick,
  1691.                   y1 - y2 + 1,
  1692.               PIX_SRC | ((c) << 5),NULL,0,0);
  1693.             if (s->yax_right == TRUE)
  1694.            pw_rop(cpw,x2 + 1,
  1695.                   y2,
  1696.                   s->yax_thick,
  1697.                   y1 - y2 + 1,
  1698.               PIX_SRC | ((c) << 5),NULL,0,0);
  1699.            }
  1700.         if (s->xax_sw == TRUE && s->xax_bot == TRUE && s->xax_top == FALSE)
  1701.            {if (s->yax_left == TRUE)
  1702.            pw_rop(cpw,x1 - s->yax_thick,
  1703.                   y2,
  1704.                   s->yax_thick,
  1705.                   y1 - y2 + 1 + s->xax_thick,
  1706.               PIX_SRC | ((c) << 5),NULL,0,0);
  1707.             if (s->yax_right == TRUE)
  1708.            pw_rop(cpw,x2 + 1,
  1709.                   y2,
  1710.                   s->yax_thick,
  1711.                   y1 - y2 + 1 + s->xax_thick,
  1712.               PIX_SRC | ((c) << 5),NULL,0,0);
  1713.            }
  1714.     
  1715.         if (s->xax_sw == TRUE && s->xax_bot == FALSE && s->xax_top == TRUE)
  1716.            {if (s->yax_left == TRUE)
  1717.            pw_rop(cpw,x1 - s->yax_thick,
  1718.                   y2 - s->xax_thick,
  1719.                   s->yax_thick,
  1720.                   y1 - y2 + 1 +s->xax_thick,
  1721.               PIX_SRC | ((c) << 5),NULL,0,0);
  1722.             if (s->yax_right == TRUE)
  1723.            pw_rop(cpw,x2 + 1,
  1724.                   y2 - s->xax_thick,
  1725.                   s->yax_thick,
  1726.                   y1 - y2 + 1 + s->xax_thick,
  1727.               PIX_SRC | ((c) << 5),NULL,0,0);
  1728.            }
  1729.     
  1730.         if (s->xax_sw == TRUE && s->xax_bot == TRUE  && s->xax_top == TRUE)
  1731.            {if (s->yax_left == TRUE)
  1732.            pw_rop(cpw,x1 - s->yax_thick,
  1733.                   y2 - s->xax_thick,
  1734.                   s->yax_thick,
  1735.                   y1 - y2 + 1 + s->xax_thick + s->xax_thick,
  1736.               PIX_SRC | ((c) << 5),NULL,0,0);
  1737.             if (s->yax_right == TRUE)
  1738.            pw_rop(cpw,x2 + 1,
  1739.                   y2 - s->xax_thick,
  1740.                   s->yax_thick,
  1741.                   y1 - y2 + 1 +s->xax_thick + s->xax_thick,
  1742.               PIX_SRC | ((c) << 5),NULL,0,0);
  1743.            }
  1744.  
  1745.        }
  1746.  
  1747.     if (TRUE == s->xt2_sw)
  1748.        {if (z == TRUE)    c = s->xt2_color;
  1749.         else        c = clear_color;
  1750.         t = s->xt2_thick / 2;
  1751.         if (s->xt2_direc == FALSE && s->xt2_bot == TRUE)
  1752.            for (i = x1; i <= x2; i += s->xt2_space)
  1753.            pw_rop(cpw,i - t,
  1754.                   y1 - s->xt2_len + 1,
  1755.                   s->xt2_thick,
  1756.                   s->xt2_len,
  1757.               PIX_SRC | ((c) << 5),NULL,0,0);
  1758.         if (s->xt2_direc == FALSE && s->xt2_top == TRUE)
  1759.            for (i = x1; i <= x2; i += s->xt2_space)
  1760.            pw_rop(cpw,i - t,
  1761.                   y2,
  1762.                   s->xt2_thick,
  1763.                   s->xt2_len,
  1764.               PIX_SRC | ((c) << 5),NULL,0,0);
  1765.         if (s->xt2_direc == TRUE && s->xt2_bot == TRUE)
  1766.            for (i = x1; i <= x2; i += s->xt2_space)
  1767.            pw_rop(cpw,i - t,
  1768.                   y1 + 1,
  1769.                   s->xt2_thick,
  1770.                   s->xt2_len,
  1771.               PIX_SRC | ((c) << 5),NULL,0,0);
  1772.         if (s->xt2_direc == TRUE && s->xt2_top == TRUE)
  1773.            for (i = x1; i <= x2; i += s->xt2_space)
  1774.            pw_rop(cpw,i - t,
  1775.                   y2 - s->xt2_len,
  1776.                   s->xt2_thick,
  1777.                   s->xt2_len,
  1778.               PIX_SRC | ((c) << 5),NULL,0,0);
  1779.        }
  1780.  
  1781.     if (TRUE == s->yt2_sw)
  1782.        {if (z == TRUE)    c = s->yt2_color;
  1783.         else        c = clear_color;
  1784.         t = s->yt2_thick / 2;
  1785.         if (s->yt2_direc == FALSE && s->yt2_left == TRUE)
  1786.            for (i = y1; i >= y2; i -= s->yt2_space)
  1787.            pw_rop(cpw,x1,
  1788.                   i - t,
  1789.                   s->yt2_len,
  1790.                   s->yt2_thick,
  1791.               PIX_SRC | ((c) << 5),NULL,0,0);
  1792.         if (s->yt2_direc == FALSE && s->yt2_right == TRUE)
  1793.            for (i = y1; i >= y2; i -= s->yt2_space)
  1794.            pw_rop(cpw,x2 - s->yt2_len + 1,
  1795.                   i - t,
  1796.                   s->yt2_len,
  1797.                   s->yt2_thick,
  1798.               PIX_SRC | ((c) << 5),NULL,0,0);
  1799.         if (s->yt2_direc == TRUE && s->yt2_left == TRUE)
  1800.            for (i = y1; i >= y2; i -= s->yt2_space)
  1801.            pw_rop(cpw,x1 - s->yt2_len,
  1802.                   i - t,
  1803.                   s->yt2_len,
  1804.                   s->yt2_thick,
  1805.               PIX_SRC | ((c) << 5),NULL,0,0);
  1806.         if (s->yt2_direc == TRUE && s->yt2_right == TRUE)
  1807.            for (i = y1; i >= y2; i -= s->yt2_space)
  1808.            pw_rop(cpw,x2 + 1,
  1809.                   i - t,
  1810.                   s->yt2_len,
  1811.                   s->yt2_thick,
  1812.               PIX_SRC | ((c) << 5),NULL,0,0);
  1813.        }
  1814.  
  1815.     if (TRUE == s->xt1_sw)
  1816.        {if (z == TRUE)    c = s->xt1_color;
  1817.         else        c = clear_color;
  1818.         t = s->xt1_thick / 2;
  1819.         if (s->xt1_direc == FALSE && s->xt1_bot == TRUE)
  1820.            for (i = x1; i <= x2; i += s->xt1_space)
  1821.            pw_rop(cpw,i - t,
  1822.                   y1 - s->xt1_len + 1,
  1823.                   s->xt1_thick,
  1824.                   s->xt1_len,
  1825.               PIX_SRC | ((c) << 5),NULL,0,0);
  1826.         if (s->xt1_direc == FALSE && s->xt1_top == TRUE)
  1827.            for (i = x1; i <= x2; i += s->xt1_space)
  1828.            pw_rop(cpw,i - t,
  1829.                   y2,
  1830.                   s->xt1_thick,
  1831.                   s->xt1_len,
  1832.               PIX_SRC | ((c) << 5),NULL,0,0);
  1833.         if (s->xt1_direc == TRUE && s->xt1_bot == TRUE)
  1834.            for (i = x1; i <= x2; i += s->xt1_space)
  1835.            pw_rop(cpw,i - t,
  1836.                   y1 + 1,
  1837.                   s->xt1_thick,
  1838.                   s->xt1_len,
  1839.               PIX_SRC | ((c) << 5),NULL,0,0);
  1840.         if (s->xt1_direc == TRUE && s->xt1_top == TRUE)
  1841.            for (i = x1; i <= x2; i += s->xt1_space)
  1842.            pw_rop(cpw,i - t,
  1843.                   y2 - s->xt1_len,
  1844.                   s->xt1_thick,
  1845.                   s->xt1_len,
  1846.               PIX_SRC | ((c) << 5),NULL,0,0);
  1847.        }
  1848.  
  1849.     if (TRUE == s->yt1_sw)
  1850.        {if (z == TRUE)    c = s->yt1_color;
  1851.         else        c = clear_color;
  1852.         t = s->yt1_thick / 2;
  1853.         if (s->yt1_direc == FALSE && s->yt1_left == TRUE)
  1854.            for (i = y1; i >= y2; i -= s->yt1_space)
  1855.            pw_rop(cpw,x1,
  1856.                   i - t,
  1857.                   s->yt1_len,
  1858.                   s->yt1_thick,
  1859.               PIX_SRC | ((c) << 5),NULL,0,0);
  1860.         if (s->yt1_direc == FALSE && s->yt1_right == TRUE)
  1861.            for (i = y1; i >= y2; i -= s->yt1_space)
  1862.            pw_rop(cpw,x2 - s->yt1_len + 1,
  1863.                   i - t,
  1864.                   s->yt1_len,
  1865.                   s->yt1_thick,
  1866.               PIX_SRC | ((c) << 5),NULL,0,0);
  1867.         if (s->yt1_direc == TRUE && s->yt1_left == TRUE)
  1868.            for (i = y1; i >= y2; i -= s->yt1_space)
  1869.            pw_rop(cpw,x1 - s->yt1_len,
  1870.                   i - t,
  1871.                   s->yt1_len,
  1872.                   s->yt1_thick,
  1873.               PIX_SRC | ((c) << 5),NULL,0,0);
  1874.         if (s->yt1_direc == TRUE && s->yt1_right == TRUE)
  1875.            for (i = y1; i >= y2; i -= s->yt1_space)
  1876.            pw_rop(cpw,x2 + 1,
  1877.                   i - t,
  1878.                   s->yt1_len,
  1879.                   s->yt1_thick,
  1880.               PIX_SRC | ((c) << 5),NULL,0,0);
  1881.        }
  1882.  
  1883.         return(0);
  1884. }
  1885. /* EOF */
  1886. /* cat > src+obj/draw_grid.c << "EOF" */
  1887. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1888. /* draw_grid: draw the grid on the canvas        */
  1889. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1890. /* SCCS information: %W%    %G% - NCSA */
  1891.  
  1892. /* #include "all.h" */
  1893.  
  1894. int    draw_grid(s) struct s_grid *s;
  1895. {
  1896.     int            n = PIX_SRC | ((s->color) << 5);
  1897.         register int            i;
  1898.         pw_vector(cpw,0,0,N_hpix-1,N_vpix-1,PIX_SRC,s->color);
  1899.         pw_vector(cpw,0,N_vpix-1,N_hpix-1,0,PIX_SRC,s->color);
  1900.         for (i=s->xpix; i < N_hpix; i += s->xpix)
  1901.         pw_rop(cpw,i,0,1,N_vpix,n,NULL,0,0);
  1902.         for (i=s->ypix; i < N_vpix; i += s->ypix)
  1903.         pw_rop(cpw,0,i,N_hpix,1,n,NULL,0,0);
  1904.         return;
  1905. }
  1906. /* EOF */
  1907. /* cat > src+obj/draw_image.c << "EOF" */
  1908. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1909. /* draw_image: draw an image on the canvas        */
  1910. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  1911. /* SCCS information: %W%    %G% - NCSA */
  1912.  
  1913. /* #include "all.h" */
  1914. /* #include "newext.h" */
  1915.  
  1916. int 
  1917. draw_image (s, n)
  1918.     struct s_image *s;
  1919.     int             n;    /* sequence number of image in HDF file */
  1920. {
  1921.     int             z;
  1922.     int             nxpts, nypts, filetype;
  1923.  
  1924.     z = check_image (s->fname, &(s->xpts), &(s->ypts), &nxpts, &nypts, n, &filetype);
  1925.     if (z == 1)
  1926.     {
  1927.         if (base_frame_up)
  1928.         {
  1929.             sprintf (msg, "File = %s", s->fname);
  1930.             bad_data2 ("Cannot open image file, request ignored.", msg);
  1931.             return (-1);
  1932.         }
  1933.         else
  1934.         {
  1935.             sprintf (msg, "File = %s - Incorrect file name or nonexistent file. Check defaults database with defaultsedit.", s->fname);
  1936.             bad_data2 ("Cannot open image file, CompositeTool terminated.", msg);
  1937.             return (-1);
  1938.         }
  1939.     }
  1940.     else if (z == 2)
  1941.     {
  1942.         if (base_frame_up)
  1943.         {
  1944.             sprintf (msg, "File = %s", s->fname);
  1945.             bad_data2 ("X-pts * Y-pts != image filesize, request ignored.", msg);
  1946.             return (-1);
  1947.         }
  1948.         else
  1949.         {
  1950.             sprintf (msg, "File = %s - Correct raw image file? Check defaults database with defaultsedit.", s->fname);
  1951.             bad_data2 ("X-pts * Y-pts != image filesize, CompositeTool terminated.", msg);
  1952.             return (-1);
  1953.         }
  1954.     }
  1955.     else if (z == 3)
  1956.     {
  1957.         if (base_frame_up)
  1958.         {
  1959.             sprintf (msg, "File = %s", s->fname);
  1960.             bad_data2 ("Not enough images in HDF file, request ignored.", msg);
  1961.             return (-1);
  1962.         }
  1963.         else
  1964.         {
  1965.             sprintf (msg, "File = %s - Correct HDF file? Check defaults database with defaultsedit.", s->fname);
  1966.             bad_data2 ("Not enough images in HDF file, CompositeTool terminated.", msg);
  1967.             return (-1);
  1968.         }
  1969.     }
  1970.     else if (z < 0)        /* HDF error */
  1971.     {
  1972.         if (base_frame_up)
  1973.         {
  1974.             sprintf (msg, "HDF file error (DFerror = %d), request ignored.", z);
  1975.             sprintf (msg2, "File = %s", s->fname);
  1976.             bad_data2 (msg, msg2);
  1977.             return (-1);
  1978.         }
  1979.         else
  1980.         {
  1981.             sprintf (msg, "HDF file error (DFerror = %d), CompositeTool terminated.", z);
  1982.             sprintf (msg2, "File = %s - Bad HDF file. Check defaults database with defaultsedit.", s->fname);
  1983.             bad_data2 (msg, msg2);
  1984.             return (-1);
  1985.         }
  1986.     }
  1987.     if (z == 4)        /* HDF - different size */
  1988.     {
  1989.         if (base_frame_up)
  1990.         {
  1991.             sprintf (msg, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d).", s->fname, s->xpts, s->ypts, nxpts, nypts);
  1992.             info_msg2 ("          ----- INFORMATION MESSAGE -----",
  1993.                    "HDF file image dimensions used", msg,
  1994.                        "          ----- INFORMATION MESSAGE -----");
  1995.         }
  1996.         else        /* logo file only */
  1997.         {
  1998.             sprintf (msg, "file = %s - Check defaults database with defaultsedit.", s->fname);
  1999.             bad_data2 ("HDF file dimensions disagree with required values, CompositeTool terminated.", msg);
  2000.             return (-1);
  2001.         }
  2002.         z = 0;
  2003.         s->xpts = nxpts;
  2004.         s->ypts = nypts;
  2005.     }
  2006.     if (z == 0)
  2007.     {
  2008.         struct pixrect *i;
  2009.         i = mem_create (s->xpts, s->ypts, 8);
  2010.         if (load_image (s->fname, s->xpts, s->ypts, s->xpos, s->ypos, i, n))
  2011.             return (-1);
  2012.         pw_rop (cpw, s->xpos, s->ypos, s->xpts, s->ypts, PIX_SRC, i, 0, 0);
  2013.         return (0);
  2014.     }
  2015.     else
  2016.     {
  2017.         bad_data ("This image draw error is not possible.");
  2018.         return (-1);
  2019.     }
  2020. }
  2021. /* EOF */
  2022. /* cat > src+obj/draw_text.c << "EOF" */
  2023. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2024. /* draw_text: draw a text on the canvas            */
  2025. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2026. /* SCCS information: %W%    %G% - NCSA */
  2027.  
  2028. /* #include "all.h" */
  2029.  
  2030. int    draw_text(s) struct s_text *s;
  2031. {
  2032.         struct pixfont  *f;
  2033.         strcpy(txt,s->prefont);
  2034.         strcat(txt,"/");
  2035.         strcat(txt,s->postfont);
  2036.         if (NULL == (f = pf_open(txt)))
  2037.            {bad_data("Can not open font file, request ignored.");
  2038.         return;
  2039.        }
  2040.         pw_ttext(cpw,s->xpos,s->ypos,PIX_SRC | ((s->color) << 5),f,s->body);
  2041.         pf_close(f);
  2042.         return;
  2043. }
  2044. /* EOF */
  2045. /* cat > src+obj/draw_vector.c << "EOF" */
  2046. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2047. /* draw_vector: draw a vector on the canvas        */
  2048. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2049. /* SCCS information: %W%    %G% - NCSA */
  2050.  
  2051. /* #include "all.h" */
  2052. /* #include "newext.h" */
  2053.  
  2054. int    draw_vector(flag, s, n) int flag; struct s_vector *s;
  2055.                 int n; /* sequence number of x-image in HDF
  2056.                       file. y-image follows x-image if 
  2057.                       same HDF file or sequence number if
  2058.                       different HDF file */
  2059. {
  2060.         int        maxx,maxy,startx,starty,
  2061.             intervalx,intervaly,endx,endy;
  2062.         int             f,b;
  2063.         unsigned char   *x,*y;
  2064.         register int    i,j;
  2065.  
  2066.     int    z;
  2067.     int    nxpts, nypts, filetype;
  2068.  
  2069.         if (s->xzero < 128)     maxx    = 255 - s->xzero;
  2070.         else                    maxx    = s->xzero;
  2071.         if (s->yzero < 128)     maxy    = 255 - s->yzero;
  2072.         else                    maxy    = s->yzero;
  2073.         if (flag == TRUE)
  2074.           {startx       = s->xdis;
  2075.            intervalx    = 9999;
  2076.            endx         = startx;
  2077.            starty       = s->ydis;
  2078.            intervaly    = 9999;
  2079.            endy         = starty;
  2080.            if (startx < 0 || startx >= s->xpts ||
  2081.            starty < 0 || starty >= s->ypts)
  2082.           return;
  2083.           }
  2084.         else
  2085.             {if (s->xstart < 0)         startx  = 0;
  2086.              else if (s->xstart >= s->xpts)     startx  = s->xpts - 1;
  2087.              else                               startx  = s->xstart;
  2088.              if (s->xinterval < 1)              intervalx = 9999;
  2089.              else                               intervalx = s->xinterval;
  2090.              if (s->xend < 0)           endx    = 0;
  2091.              else if (s->xend >= s->xpts)       endx    = s->xpts - 1;
  2092.              else                               endx    = s->xend;
  2093.              if (s->ystart < 0)         starty  = 0;
  2094.              else if (s->ystart >= s->ypts)     starty  = s->ypts - 1;
  2095.              else                               starty  = s->ystart;
  2096.              if (s->yinterval < 1)              intervaly = 9999;
  2097.              else                               intervaly = s->yinterval;
  2098.              if (s->yend < 0)           endy    = 0;
  2099.              else if (s->yend >= s->ypts)       endy    = s->ypts - 1;
  2100.              else                               endy    = s->yend;
  2101.             }
  2102.  
  2103.     z = check_image (s->xname, &(s->xpts), &(s->ypts), &nxpts, &nypts, n, &filetype);
  2104.     if    (z == 1)
  2105.     {
  2106.         sprintf (msg, "File = %s", s->xname);
  2107.                 bad_data2 ("Cannot open x-image file, request ignored.", msg);
  2108.                 return;
  2109.         }
  2110.         else if (z == 2)
  2111.     {
  2112.         sprintf (msg, "File = %s", s->xname);
  2113.                 bad_data2 ("X-pts * Y-pts != x-image filesize, request ignored.", msg);
  2114.                 return;
  2115.         }
  2116.     else if (z == 3)
  2117.     {
  2118.         sprintf (msg, "File = %s", s->xname);
  2119.         bad_data2 ("Not enough images in HDF file for x-image, request ignored.", msg);
  2120.         return;
  2121.     }
  2122.     else if (z < 0)        /* HDF error */
  2123.     {
  2124.         sprintf (msg, "HDF file error (DFerror = %d) for x-image, request ignored.", z);
  2125.         sprintf (msg2, "File = %s", s->xname);
  2126.         bad_data2 (msg, msg2);
  2127.         return;
  2128.     }
  2129.     if (z == 4)        /* HDF - different size */
  2130.     {
  2131.         sprintf (msg, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d)", s->xname, s->xpts, s->ypts, nxpts, nypts);
  2132.         info_msg2 ("          ----- INFORMATION MESSAGE -----",
  2133.                "HDF file x-image dimensions used", msg,
  2134.                "          ----- INFORMATION MESSAGE -----");
  2135.         z = 0;
  2136.         s->xpts = nxpts;
  2137.         s->ypts = nypts;
  2138.     }
  2139.     z = check_image (s->yname, &(s->xpts), &(s->ypts), &nxpts, &nypts,
  2140.              (! strcmp (s->xname, s->yname)) ? n + 1 : n, &filetype);
  2141.     if    (z == 1)
  2142.     {
  2143.         sprintf (msg, "File = %s", s->yname);
  2144.                 bad_data2 ("Cannot open y-image file, request ignored.", msg);
  2145.                 return;
  2146.         }
  2147.         else if (z == 2)
  2148.     {
  2149.         sprintf (msg, "File = %s", s->yname);
  2150.                 bad_data2 ("X-pts * Y-pts != y-image filesize, request ignored.", msg);
  2151.                 return;
  2152.         }
  2153.     else if (z == 3)
  2154.     {
  2155.         sprintf (msg, "File = %s", s->yname);
  2156.         bad_data2 ("Not enough images in HDF file for y-image, request ignored.", msg);
  2157.         return;
  2158.     }
  2159.     else if (z < 0)        /* HDF error */
  2160.     {
  2161.         sprintf (msg, "HDF file error (DFerror = %d) for y-image, request ignored.", z);
  2162.         sprintf (msg2, "File = %s", s->yname);
  2163.         bad_data2 (msg, msg2);
  2164.         return;
  2165.     }
  2166.     if (z == 4)        /* HDF - different size */
  2167.     {
  2168.         sprintf (msg, "File = %s, x-image(x=%d,y=%d), y-image(x=%d,y=%dr)", s->yname, s->xpts, s->ypts, nxpts, nypts);
  2169.         bad_data2 ("X-image different size than y-image, request ignored.", msg);
  2170.         return;
  2171.     }
  2172.         if (NULL == (x = (unsigned char *)calloc(s->xpts * s->ypts,sizeof(unsigned char))))
  2173.     {
  2174.             bad_data ("Cannot allocate x-image memory, request ignored.");
  2175.         return;
  2176.         }
  2177.     if (load_vector_image (s->xname, s->xpts, s->ypts, x, n, 0)) /* 0 == x-image */
  2178.     {
  2179.         free ((char *) x);
  2180.         return;
  2181.     }
  2182.         if (NULL == (y = (unsigned char *)calloc(s->xpts * s->ypts,sizeof(unsigned char))))
  2183.     {
  2184.             bad_data ("Cannot allocate y-image memory, request ignored.");
  2185.         free ((char *) x);
  2186.         return;
  2187.         }
  2188.     if (load_vector_image (s->yname, s->xpts, s->ypts, y, n, 1)) /* 1 == y-image */
  2189.     {
  2190.         free ((char *) x);
  2191.         free ((char *) y);
  2192.         return;
  2193.     }
  2194.         for (j = starty; j <= endy; j += intervaly)
  2195.             for (i = startx; i <= endx; i += intervalx)
  2196.                draw_vector1(s,x,y,s->xpos + i,s->ypos + j,
  2197.                             s->xpts * (s->ypts - j - 1) + i,maxx,maxy);
  2198. /*
  2199.                draw_vector1(s,x,y,s->xpos + i,s->ypos + s->ypts - 1 - j,
  2200.                             s->xpts * (s->ypts - j - 1) + i,maxx,maxy);
  2201. */
  2202.         free((char *) x);
  2203.         free((char *) y);
  2204.         return;
  2205. }
  2206. /* EOF */
  2207. /* cat > src+obj/draw_vector1.c << "EOF" */
  2208. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2209. /* draw_vector1: draw vector arrowhead            */
  2210. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2211. /* SCCS information: %W%    %G% - NCSA */
  2212.  
  2213. /* #include "all.h" */
  2214.  
  2215. int    draw_vector1(s,x,y,xc,yc,off,maxx,maxy)
  2216.                      struct s_vector *s;
  2217.              unsigned char *x,*y;
  2218.                      int xc,yc,off,maxx,maxy;
  2219. {
  2220.         register int            i,j;
  2221.         int                     a,b,xuse,yuse,xp0,yp0,xp1,yp1;
  2222.         float                   xv,yv,lv,st,ct,hlen = 6.,hwid = 3.;
  2223.         i = *(x + off);
  2224.         j = *(y + off);
  2225.         if (s->maxlen == 0 ||
  2226.            (s->xscale < .0001 && s->xscale > -.0001 &&
  2227.             s->yscale < .0001 && s->yscale > -.0001) ||
  2228.            (i == s->xzero && j == s->yzero))
  2229.           {pw_vector(cpw,xc+2,yc-2,xc+2,yc+2,PIX_SRC,s->color);
  2230.            pw_vector(cpw,xc+2,yc+2,xc-2,yc+2,PIX_SRC,s->color);
  2231.            pw_vector(cpw,xc-2,yc+2,xc-2,yc-2,PIX_SRC,s->color);
  2232.            pw_vector(cpw,xc-2,yc-2,xc+2,yc-2,PIX_SRC,s->color);
  2233.            return;
  2234.           }
  2235.         xv = s->xscale * (i - s->xzero) / (maxx + 0.);
  2236.         yv = s->yscale * (j - s->yzero) / (maxy + 0.);
  2237.         lv = sqrt(xv * xv + yv * yv);
  2238.         st = yv / lv;
  2239.         ct = xv / lv;
  2240.         xuse = s->maxlen * xv * .5;
  2241.         yuse = s->maxlen * yv * .5;
  2242.         xp0 = xc - xuse;
  2243.         yp0 = yc + yuse;
  2244.         xp1 = xc + xuse;
  2245.         yp1 = yc - yuse;
  2246.         pw_vector(cpw,xp0,yp0,xp1,yp1,PIX_SRC,s->color);
  2247.         a = - hlen * ct - hwid * st;
  2248.         b =   hlen * st - hwid * ct;
  2249.         pw_vector(cpw,xp1,yp1,xp1+a,yp1+b,PIX_SRC,s->color);
  2250.         a = - hlen * ct + hwid * st;
  2251.         b =   hlen * st + hwid * ct;
  2252.         pw_vector(cpw,xp1,yp1,xp1+a,yp1+b,PIX_SRC,s->color);
  2253.         return;
  2254. }
  2255. /* EOF */
  2256. /* cat > src+obj/event_colorbar.c << "EOF" */
  2257. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2258. /* event_colorbar: canvas events, pixwin is cpw        */
  2259. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2260. /* SCCS information: %W%    %G% - NCSA */
  2261.  
  2262. /* #include "all.h" */
  2263.  
  2264. int    event_colorbar(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2265. {
  2266.     char        c[10],
  2267.             d[10];
  2268.     if (sw_draw == TRUE)
  2269.        {if (down == TRUE)
  2270.            {if (FALSE == ok_colorbar(&tcbar))
  2271.            {reset_mcolorbar();
  2272.             return;
  2273.            }
  2274.         tcbar.xpos = x;
  2275.         tcbar.ypos = y;
  2276.         my_itoa(x,c);
  2277.         my_itoa(y,d);
  2278.         panel_set(pt[8],PANEL_VALUE,c,0);
  2279.         panel_set(pt[9],PANEL_VALUE,d,0);
  2280.         draw_colorbar(&tcbar);
  2281.         return;
  2282.            }
  2283.         mouse_msg(x,y);
  2284.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2285.         return;
  2286.        }
  2287.     if (sw_move == TRUE)
  2288.        {if (down == TRUE)
  2289.            {if (FALSE == ok_colorbar(&tcbar))
  2290.            {reset_mcolorbar();
  2291.             return;
  2292.            }
  2293.                 x_start = tcbar.xpos - 1;
  2294.                 x_end   = tcbar.xpos + tcbar.xpts;
  2295.                 y_start = tcbar.ypos - 1;
  2296.                 y_end   = tcbar.ypos + tcbar.ypts;
  2297.                 draw_box("read",x_start,y_start,x_end,y_end);
  2298.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2299.                 x_interval = x;
  2300.                 y_interval = y;
  2301.                } 
  2302.             else if (drag == TRUE)
  2303.                {draw_box("write",x_start,y_start,x_end,y_end);
  2304.                 x_start += (x - x_interval);
  2305.                 x_end   += (x - x_interval);
  2306.                 y_start += (y - y_interval);
  2307.                 y_end   += (y - y_interval);
  2308.                 x_interval = x;
  2309.                 y_interval = y;
  2310.                 draw_box("read",x_start,y_start,x_end,y_end);
  2311.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2312.                }
  2313. /*
  2314.             else if (leave == TRUE)
  2315.                draw_box("write",x_start,y_start,x_end,y_end);
  2316. */
  2317.             else if (up == TRUE)
  2318.                {draw_box("write",x_start,y_start,x_end,y_end);
  2319.         if (FALSE == ok_colorbar(&tcbar))
  2320.            {reset_mcolorbar();
  2321.             return;
  2322.            }
  2323.         pw_rop(cpw,tcbar.xpos,tcbar.ypos,
  2324.                tcbar.xpts,tcbar.ypts,
  2325.                PIX_SRC | ((clear_color) << 5),NULL,0,0);
  2326.                 tcbar.xpos = x_start + 1;
  2327.                 tcbar.ypos = y_start + 1;
  2328.         draw_colorbar(&tcbar);
  2329.         my_itoa(tcbar.xpos,c);
  2330.         my_itoa(tcbar.ypos,d);
  2331.         panel_set(pt[8],PANEL_VALUE,c,0);
  2332.         panel_set(pt[9],PANEL_VALUE,d,0);
  2333.                }
  2334.             else;
  2335.             mouse_msg(x,y);
  2336.             panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2337.             return;
  2338.            }
  2339. }
  2340. /* EOF */
  2341. /* cat > src+obj/event_contour.c << "EOF" */
  2342. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2343. /* event_contour: canvas events, pixwin is cpw        */
  2344. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2345. /* SCCS information: %W%    %G% - NCSA */
  2346.  
  2347. /* #include "all.h" */
  2348.  
  2349. int    event_contour(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2350. {
  2351.     char        c[10],
  2352.             d[10];
  2353.     if (sw_draw == TRUE)
  2354.        {if (down == TRUE)
  2355.            {if (FALSE == ok_contour(&con[N_contour], 1))
  2356.            {reset_mcontour();
  2357.             return;
  2358.            }
  2359.         con[N_contour].xpos = x;
  2360.         con[N_contour].ypos = y;
  2361.         my_itoa(x,c);
  2362.         my_itoa(y,d);
  2363.         panel_set(pt[32],PANEL_VALUE,c,0);
  2364.         panel_set(pt[33],PANEL_VALUE,d,0);
  2365.         draw_contour(&con[N_contour], 1);
  2366.         return;
  2367.            }
  2368.         mouse_msg(x,y);
  2369.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2370.         return;
  2371.        }
  2372.     if (sw_move == TRUE)
  2373.        {if (down == TRUE)
  2374.            {if (FALSE == ok_contour(&con[N_contour], 1))
  2375.            {reset_mcontour();
  2376.             return;
  2377.            }
  2378.                 x_start = con[N_contour].xpos - 1;
  2379.                 x_end   = con[N_contour].xpos + con[N_contour].xpts;
  2380.                 y_start = con[N_contour].ypos - 1;
  2381.                 y_end   = con[N_contour].ypos + con[N_contour].ypts;
  2382.                 draw_box("read",x_start,y_start,x_end,y_end);
  2383.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2384.                 x_interval = x;
  2385.                 y_interval = y;
  2386.            }
  2387.         else if (drag == TRUE)
  2388.                {draw_box("write",x_start,y_start,x_end,y_end);
  2389.                 x_start += (x - x_interval);
  2390.                 x_end   += (x - x_interval);
  2391.                 y_start += (y - y_interval);
  2392.                 y_end   += (y - y_interval);
  2393.                 x_interval = x;
  2394.                 y_interval = y;
  2395.                 draw_box("read",x_start,y_start,x_end,y_end);
  2396.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2397.                }
  2398. /*
  2399.             else if (leave == TRUE)
  2400.                draw_box("write",x_start,y_start,x_end,y_end);
  2401. */
  2402.             else if (up == TRUE)
  2403.                {draw_box("write",x_start,y_start,x_end,y_end);
  2404.                 if (FALSE == ok_contour(&con[N_contour], 1))
  2405.                    {reset_mcontour();
  2406.                     return;
  2407.                    }
  2408.         pw_rop(cpw,con[N_contour].xpos,con[N_contour].ypos,
  2409.                con[N_contour].xpts,con[N_contour].ypts,
  2410.                PIX_SRC | ((clear_color) << 5),NULL,0,0);
  2411.                 con[N_contour].xpos = x_start + 1;
  2412.                 con[N_contour].ypos = y_start + 1;
  2413.                 draw_contour(&con[N_contour], 1);
  2414.                 my_itoa(con[N_contour].xpos,c);
  2415.                 my_itoa(con[N_contour].ypos,d);
  2416.         panel_set(pt[32],PANEL_VALUE,c,0);
  2417.         panel_set(pt[33],PANEL_VALUE,d,0);
  2418.            }
  2419.         else;
  2420.         mouse_msg(x,y);
  2421.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2422.         return;
  2423.        }
  2424. }
  2425. /* EOF */
  2426. /* cat > src+obj/event_dump.c << "EOF" */
  2427. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2428. /* event_dump: canvas events, pixwin is cpw        */
  2429. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2430. /* SCCS information: %W%    %G% - NCSA */
  2431.  
  2432. /* #include "all.h" */
  2433.  
  2434. int    event_dump(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2435. {
  2436.     char        c[10],
  2437.             d[10];
  2438.  
  2439.     mouse_msg(x,y);
  2440.     if (down == TRUE)
  2441.        {sdump.xstart = sdump.xend = x;
  2442.         sdump.ystart = sdump.yend = y;
  2443.         draw_box("read",sdump.xstart,sdump.ystart,sdump.xend,sdump.yend);
  2444.         my_itoa(x,c);
  2445.         my_itoa(y,d);
  2446.         panel_set(pt[18],PANEL_VALUE,c,0);
  2447.         panel_set(pt[20],PANEL_VALUE,c,0);
  2448.         panel_set(pt[19],PANEL_VALUE,d,0);
  2449.         panel_set(pt[21],PANEL_VALUE,d,0);
  2450.        }
  2451.     else if (drag == TRUE)
  2452.        {draw_box("write",sdump.xstart,sdump.ystart,sdump.xend,sdump.yend);
  2453.         sdump.xend = x;
  2454.         if ((sdump.xend - sdump.xstart +1) % 2 != 0) sdump.xend -= 1;
  2455.         sdump.yend = y;
  2456.         draw_box("read",sdump.xstart,sdump.ystart,sdump.xend,sdump.yend);
  2457.         draw_box("draw",sdump.xstart,sdump.ystart,sdump.xend,sdump.yend);
  2458.         my_itoa(sdump.xend,c);
  2459.         my_itoa(y,d);
  2460.         panel_set(pt[20],PANEL_VALUE,c,0);
  2461.         panel_set(pt[21],PANEL_VALUE,d,0);
  2462.        }
  2463.     else if (up == TRUE || leave == TRUE)
  2464.        draw_box("write",sdump.xstart,sdump.ystart,sdump.xend,sdump.yend);
  2465.     else;
  2466.     kbyte_msg(sdump.xend - sdump.xstart + 1,
  2467.           sdump.yend - sdump.ystart + 1);
  2468.     return;
  2469. }
  2470. /* EOF */
  2471. /* cat > src+obj/event_image.c << "EOF" */
  2472. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2473. /* event_image: canvas events, pixwin is cpw        */
  2474. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2475. /* SCCS information: %W%    %G% - NCSA */
  2476.  
  2477. /* #include "all.h" */
  2478.  
  2479. int    event_image(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2480. {
  2481.     char        c[10],
  2482.             d[10];
  2483.     if (sw_draw == TRUE)
  2484.        {if (down == TRUE)
  2485.            {if (FALSE == ok_image(&image[N_image], 1))
  2486.            {reset_mimage();
  2487.             return;
  2488.            }
  2489.         image[N_image].xpos = x;
  2490.         image[N_image].ypos = y;
  2491.         my_itoa(x,c);
  2492.         my_itoa(y,d);
  2493.         panel_set(pt[25],PANEL_VALUE,c,0);
  2494.         panel_set(pt[26],PANEL_VALUE,d,0);
  2495.         draw_image(&image[N_image], 1);
  2496.         return;
  2497.            }
  2498.         mouse_msg(x,y);
  2499.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2500.         return;
  2501.        }
  2502.     if (sw_move == TRUE)
  2503.        {if (down == TRUE)
  2504.            {if (FALSE == ok_image(&image[N_image], 1))
  2505.            {reset_mimage();
  2506.             return;
  2507.            }
  2508.                 x_start = image[N_image].xpos - 1;
  2509.                 x_end   = image[N_image].xpos + image[N_image].xpts;
  2510.                 y_start = image[N_image].ypos - 1;
  2511.                 y_end   = image[N_image].ypos + image[N_image].ypts;
  2512.                 draw_box("read",x_start,y_start,x_end,y_end);
  2513.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2514.                 x_interval = x;
  2515.                 y_interval = y;
  2516.            }
  2517.         else if (drag == TRUE)
  2518.                {draw_box("write",x_start,y_start,x_end,y_end);
  2519.                 x_start += (x - x_interval);
  2520.                 x_end   += (x - x_interval);
  2521.                 y_start += (y - y_interval);
  2522.                 y_end   += (y - y_interval);
  2523.                 x_interval = x;
  2524.                 y_interval = y;
  2525.                 draw_box("read",x_start,y_start,x_end,y_end);
  2526.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2527.                }
  2528. /*
  2529.         else if (leave == TRUE)
  2530.                draw_box("write",x_start,y_start,x_end,y_end);
  2531. */
  2532.         else if (up == TRUE)
  2533.                {draw_box("write",x_start,y_start,x_end,y_end);
  2534.                 if (FALSE == ok_image(&image[N_image], 1))
  2535.                    {reset_mimage();
  2536.                     return;
  2537.                    }
  2538.         pw_rop(cpw,image[N_image].xpos,image[N_image].ypos,
  2539.                image[N_image].xpts,image[N_image].ypts,
  2540.                PIX_SRC | ((clear_color) << 5),NULL,0,0);
  2541.         image[N_image].xpos = x_start + 1;
  2542.         image[N_image].ypos = y_start + 1;
  2543.         draw_image(&image[N_image], 1);
  2544.         my_itoa(image[N_image].xpos,c);
  2545.         my_itoa(image[N_image].ypos,d);
  2546.         panel_set(pt[25],PANEL_VALUE,c,0);
  2547.         panel_set(pt[26],PANEL_VALUE,d,0);
  2548.                }
  2549.         else;
  2550.         mouse_msg(x,y);
  2551.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2552.         return;
  2553.        }
  2554. }
  2555. /* EOF */
  2556. /* cat > src+obj/event_text.c << "EOF" */
  2557. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2558. /* event_text: canvas events, pixwin is cpw        */
  2559. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2560. /* SCCS information: %W%    %G% - NCSA */
  2561.  
  2562. /* #include "all.h" */
  2563.  
  2564. int    event_text(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2565. {
  2566.     char        c[10],
  2567.             d[10];
  2568.     register int    i;
  2569.     if (sw_draw == TRUE)
  2570.        {if (down == TRUE)
  2571.            {if (FALSE == ok_text(&text[N_text]))
  2572.            {reset_mtext();
  2573.             return;
  2574.            }
  2575.         text[N_text].xpos = x;
  2576.         text[N_text].ypos = y;
  2577.         my_itoa(x,c);
  2578.         my_itoa(y,d);
  2579.         panel_set(pt[12],PANEL_VALUE,c,0);
  2580.         panel_set(pt[13],PANEL_VALUE,d,0);
  2581.         draw_text(&text[N_text]);
  2582.         return;
  2583.            }
  2584.         mouse_msg(x,y);
  2585.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2586.         return;
  2587.        }
  2588.     if (sw_move == TRUE)
  2589.        {if (down == TRUE)
  2590.            {if (FALSE == ok_text(&text[N_text]))
  2591.            {reset_mtext();
  2592.             return;
  2593.            }
  2594.         x_start = text[N_text].xpos;
  2595.         x_end   = text[N_text].xpos + 20;
  2596.         y_start = text[N_text].ypos - 20;
  2597.         y_end   = text[N_text].ypos;
  2598.             draw_box("read",x_start,y_start,x_end,y_end);
  2599.             draw_box("draw",x_start,y_start,x_end,y_end);
  2600.         x_interval = x;
  2601.         y_interval = y;
  2602.            }
  2603.         else if (drag == TRUE)
  2604.            {draw_box("write",x_start,y_start,x_end,y_end);
  2605.         x_start += (x - x_interval);
  2606.         x_end   += (x - x_interval);
  2607.         y_start += (y - y_interval);
  2608.         y_end   += (y - y_interval);
  2609.         x_interval = x;
  2610.         y_interval = y;
  2611.             draw_box("read",x_start,y_start,x_end,y_end);
  2612.             draw_box("draw",x_start,y_start,x_end,y_end);
  2613.            }
  2614. /*
  2615.         else if (leave == TRUE)
  2616.             draw_box("write",x_start,y_start,x_end,y_end);
  2617. */
  2618.         else if (up == TRUE)
  2619.            {draw_box("write",x_start,y_start,x_end,y_end);
  2620.         if (FALSE == ok_text(&text[N_text]))
  2621.            {reset_mtext();
  2622.             return;
  2623.            }
  2624.         i = text[N_text].color;
  2625.         text[N_text].color = clear_color;
  2626.         draw_text(&text[N_text]);
  2627.         text[N_text].xpos = x_start;
  2628.         text[N_text].ypos = y_start + 20;
  2629.         my_itoa(text[N_text].xpos,c);
  2630.         my_itoa(text[N_text].ypos,d);
  2631.         panel_set(pt[12],PANEL_VALUE,c,0);
  2632.         panel_set(pt[13],PANEL_VALUE,d,0);
  2633.         text[N_text].color = i;
  2634.         draw_text(&text[N_text]);
  2635.            }
  2636.         else;
  2637.         mouse_msg(x,y);
  2638.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2639.         return;
  2640.        }
  2641. }
  2642. /* EOF */
  2643. /* cat > src+obj/event_vector.c << "EOF" */
  2644. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2645. /* event_vector:  canvas events, pixwin is cpw        */
  2646. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2647. /* SCCS information: %W%    %G% - NCSA */
  2648.  
  2649. /* #include "all.h" */
  2650.  
  2651. int    event_vector(x,y,down,drag,up,leave) int x,y,down,drag,up,leave;
  2652. {
  2653.     char        c[10],
  2654.             d[10];
  2655.     register int    i;
  2656.     if (sw_draw == TRUE)
  2657.        {if (down == TRUE)
  2658.            {if (FALSE == ok_vector(&vec[N_vector], 1))
  2659.            {reset_mvector();
  2660.             return;
  2661.            }
  2662.         vec[N_vector].xpos = x;
  2663.         vec[N_vector].ypos = y;
  2664.         my_itoa(x,c);
  2665.         my_itoa(y,d);
  2666.         panel_set(pt[43],PANEL_VALUE,c,0);
  2667.         panel_set(pt[44],PANEL_VALUE,d,0);
  2668.         draw_vector(FALSE,&vec[N_vector], 1);
  2669.         return;
  2670.            }
  2671.         mouse_msg(x,y);
  2672.         panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2673.         return;
  2674.        }
  2675.     if (sw_move == TRUE)
  2676.        {if (down == TRUE)
  2677.            {if (FALSE == ok_vector(&vec[N_vector], 1))
  2678.            {reset_mvector();
  2679.             return;
  2680.            }
  2681.                 x_start = vec[N_vector].xpos - 1;
  2682.                 x_end   = vec[N_vector].xpos + vec[N_vector].xpts;
  2683.                 y_start = vec[N_vector].ypos - 1;
  2684.                 y_end   = vec[N_vector].ypos + vec[N_vector].ypts;
  2685.                 draw_box("read",x_start,y_start,x_end,y_end);
  2686.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2687.                 x_interval = x;
  2688.                 y_interval = y;
  2689.            }
  2690.         else if (drag == TRUE)
  2691.                {draw_box("write",x_start,y_start,x_end,y_end);
  2692.                 x_start += (x - x_interval);
  2693.                 x_end   += (x - x_interval);
  2694.                 y_start += (y - y_interval);
  2695.                 y_end   += (y - y_interval);
  2696.                 x_interval = x;
  2697.                 y_interval = y;
  2698.                 draw_box("read",x_start,y_start,x_end,y_end);
  2699.                 draw_box("draw",x_start,y_start,x_end,y_end);
  2700.                }
  2701. /*
  2702.             else if (leave == TRUE)
  2703.                draw_box("write",x_start,y_start,x_end,y_end);
  2704. */
  2705.             else if (up == TRUE)
  2706.                {draw_box("write",x_start,y_start,x_end,y_end);
  2707.                 if (FALSE == ok_vector(&vec[N_vector], 1))
  2708.                    {reset_mvector();
  2709.                     return;
  2710.                    }
  2711.         i = vec[N_vector].color;
  2712.         vec[N_vector].color = clear_color;
  2713.         draw_vector(FALSE,&vec[N_vector], 1);
  2714.         vec[N_vector].color = i;
  2715.                 vec[N_vector].xpos = x_start + 1;
  2716.                 vec[N_vector].ypos = y_start + 1;
  2717.                 draw_vector(FALSE,&vec[N_vector], 1);
  2718.         my_itoa(vec[N_vector].xpos,c);
  2719.         my_itoa(vec[N_vector].ypos,d);
  2720.         panel_set(pt[43],PANEL_VALUE,c,0);
  2721.         panel_set(pt[44],PANEL_VALUE,d,0);
  2722.                }
  2723.             else;
  2724.             mouse_msg(x,y);
  2725.             panel_set(pm[2],PANEL_LABEL_STRING,"",0);
  2726.             return;
  2727.            }
  2728. }
  2729. /* EOF */
  2730. /* cat > src+obj/info_msg.c << "EOF" */
  2731. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2732. /* info_msg: put three messages on the main panel    */
  2733. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2734. /* SCCS information: %W%    %G% - NCSA */
  2735.  
  2736. /* #include "all.h" */
  2737.  
  2738. int    info_msg(p,q,r) char *p,*q,*r;
  2739. {
  2740.     char    m[10],*s,*t;
  2741.     msg_no++;
  2742.     my_itoa(msg_no,m);
  2743.     if (strlen(p) <= strlen(m))
  2744.        panel_set(pm[0],PANEL_LABEL_STRING,m,0);
  2745.     else
  2746.        {s = m;
  2747.         t = p;
  2748.         while (*s) *t++ = *s++;
  2749.         panel_set(pm[0],PANEL_LABEL_STRING,p,0);
  2750.        }
  2751.     panel_set(pm[1],PANEL_LABEL_STRING,q,0);
  2752.     panel_set(pm[2],PANEL_LABEL_STRING,r,0);
  2753.     panel_set (pm[3], PANEL_LABEL_STRING, "", 0);
  2754.     return;
  2755. }
  2756. /* EOF */
  2757. /* cat > src+obj/kbyte_msg.c << "EOF" */
  2758. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2759. /* kbyte_msg: state the kbytes to dump screen to file    */
  2760. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2761. /* SCCS information: %W%    %G% - NCSA */
  2762.  
  2763. /* #include "all.h" */
  2764.  
  2765. int    kbyte_msg(x,y) int    x,y;
  2766. {
  2767.     char        *s;
  2768.     if ( x <= 0 || y <= 0)
  2769.   strcpy(txt,"*** WARNING *** won't work:  start-end points specify nonpositive area.");
  2770.     else
  2771.        {strcpy(txt,"Kbytes memory and disk to dump = ");
  2772.         s = txt;
  2773.         while (*s) s++;
  2774.         my_itoa(((x * y) >> 10) + 1, s);
  2775.         while (*s) s++;
  2776.         strcat(s,", xpts = ");
  2777.         while (*s) s++;
  2778.         my_itoa(x,s);
  2779.         while (*s) s++;
  2780.         strcat(s,", ypts = ");
  2781.         while (*s) s++;
  2782.         my_itoa(y,s);
  2783.         while (*s) s++;
  2784.         *s++ = '.';
  2785.         *s   = '\0';
  2786.        }
  2787.     panel_set(pm[2],PANEL_LABEL_STRING,txt,0);
  2788.     return;
  2789. }
  2790. /* EOF */
  2791. /* cat > src+obj/load_rgb.c << "EOF" */
  2792. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2793. /* load_rgb: load the red, blue, and green arrays for    */
  2794. /*         the palette                */
  2795. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2796. /* SCCS information: %W%    %G% - NCSA */
  2797.  
  2798. /* #include "all.h" */
  2799. /* #include "newext.h" */
  2800.  
  2801. int
  2802. load_rgb (rawpfn, n)
  2803.     char *rawpfn;
  2804.         /* input: unprocessed palette filename.
  2805.            returns: stripped palette filename if loaded. */
  2806.     int n;
  2807.         /* sequence number of palette in HDF file */
  2808. {
  2809.     int        z, i, f;
  2810.     unsigned char *p_palette;
  2811.     char s[MAXNAMELEN + 1];    
  2812.  
  2813.     strcpy (s, rawpfn);
  2814.     (void) strip_wspace (s);
  2815.     if (strlen (s) == 0)
  2816.     {
  2817.         if (base_frame_up)
  2818.         {
  2819.             bad_data ("Empty palette file, request ignored.");
  2820.              return (-1);
  2821.         }
  2822.         else
  2823.         {
  2824.             sprintf (msg, "Empty palette file. Check defaults database with defaultsedit.", s);
  2825.             bad_data2 ("Cannot open palette file, CompositeTool terminated.", msg);
  2826.             return (-1);
  2827.         }
  2828.     }
  2829.     
  2830.     z = check_palette (s, n);
  2831.     if    (z == 1)
  2832.     {
  2833.         if (base_frame_up)
  2834.         {
  2835.             sprintf (msg, "File = %s", s);
  2836.             bad_data2 ("Cannot open palette file, request ignored.", msg);
  2837.              return (-1);
  2838.         }
  2839.         else
  2840.         {
  2841.             sprintf (msg, "File = %s - Incorrect file name or nonexistent file. Check defaults database with defaultsedit.", s);
  2842.             bad_data2 ("Cannot open palette file, CompositeTool terminated.", msg);
  2843.             return (-1);
  2844.         }
  2845.     }
  2846.     else if    (z == 2)
  2847.     {
  2848.         if (base_frame_up)
  2849.         {
  2850.             sprintf (msg, "File = %s", s);
  2851.             bad_data2 ("Palette size != 768, request ignored.", msg);
  2852.              return (-1);
  2853.         }
  2854.         else
  2855.         {
  2856.             sprintf (msg, "File = %s - Correct raw palette file? Check defaults database with defaultsedit.", s);
  2857.             bad_data2 ("Palette size != 768, CompositeTool terminated.", msg);
  2858.             return (-1);
  2859.         }
  2860.     }
  2861.     else if (z == 3)
  2862.     {
  2863.         if (base_frame_up)
  2864.         {
  2865.             sprintf (msg, "File = %s", s);
  2866.             bad_data2 ("Not enough palettes in HDF file, request ignored.", msg);
  2867.              return (-1);
  2868.         }
  2869.         else
  2870.         {
  2871.             sprintf (msg, "File = %s - Correct HDF file? Check defaults database with defaultsedit.", s);
  2872.             bad_data2 ("Not enough palettes in HDF file, CompositeTool terminated.", msg);
  2873.             return (-1);
  2874.         }
  2875.     }
  2876.     else if (z < 0)        /* HDF error */
  2877.     {
  2878.         if (base_frame_up)
  2879.         {
  2880.             sprintf (msg, "HDF file error (DFerror = %d), request ignored.", z);
  2881.             sprintf (msg2, "File = %s", s);
  2882.             bad_data2 (msg, msg2);
  2883.             return (-1);
  2884.         }
  2885.         else
  2886.         {
  2887.             sprintf (msg, "HDF file error (DFerror = %d), CompositeTool terminated.", z);
  2888.             sprintf (msg2, "File = %s - Bad HDF file. Check defaults database with defaultsedit.", s);
  2889.             bad_data2 (msg, msg2);
  2890.             return (-1);
  2891.         }
  2892.     }
  2893.  
  2894.     if (DFPgetpal (s, palette))
  2895.     {
  2896.         f = open (s, O_RDONLY);        /* should not fail */
  2897.         read (f, red, 256);
  2898.         read (f, green, 256);
  2899.         read (f, blue, 256);
  2900.         close (f);
  2901.     }
  2902.     else 
  2903.     {
  2904.         for (i = 1; i < n; i++)        /* should not fail */
  2905.             DFPgetpal (s, palette);
  2906.         p_palette = palette;
  2907.         for (i = 0; i < 256; i++) /* put in red, green, blue arrays */
  2908.         {
  2909.             red[i] = *p_palette++;
  2910.             green[i] = *p_palette++;
  2911.             blue[i] = *p_palette++;
  2912.         }
  2913.         DFPrestart ();
  2914.     }
  2915.  
  2916.     adjust_colormap ();
  2917. /*
  2918.         *red         = *green         = *blue         = 255;
  2919.         *(red + 255) = *(green + 255) = *(blue + 255) = 0;
  2920.         *(red + 254) = *(green + 254) = *(blue + 254) = 255;
  2921.         *(red + 253) = *(green + 253) = *(blue + 253) = 0;
  2922. */
  2923.  
  2924.     strcpy (rawpfn, s);
  2925.         return (0);
  2926. }
  2927. /* EOF */
  2928. /* cat > src+obj/make_fr.c << "EOF" */
  2929. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2930. /* make_fr: make a frame                */
  2931. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2932. /* SCCS information: %W%    %G% - NCSA */
  2933.  
  2934. /* #include "all.h" */
  2935. /* #include "newext.h" */
  2936.  
  2937. int    make_fr(n,x,y,h,w,s) int n,x,y,h,w; char *s;
  2938. {
  2939.         fr[n]   = window_create(fr[0],FRAME,
  2940.                 FRAME_SHOW_LABEL,               TRUE,
  2941.                 FRAME_NO_CONFIRM,               TRUE,
  2942.                 WIN_X,                          x,
  2943.                 WIN_Y,                          y,
  2944.                 WIN_HEIGHT,                     h,
  2945.                 WIN_WIDTH,                      w,
  2946.                 FRAME_DONE_PROC,                *fdp[n],
  2947.                 FRAME_LABEL,                    s,
  2948.         FRAME_SHOW_SHADOW,        FALSE,
  2949.                 0);
  2950.     set_frame_colormap (fr[n], b_cmsn);
  2951.         return;
  2952. }
  2953. /* EOF */
  2954. /* cat > src+obj/make_pb.c << "EOF" */
  2955. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2956. /* make_pb: make a panel button                */
  2957. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2958. /* SCCS information: %W%    %G% - NCSA */
  2959.  
  2960. /* #include "all.h" */
  2961. /* #include "newext.h" */
  2962.  
  2963. int    make_pb(n,x,y,a,w,s) int n,x,y,a,w; char *s;
  2964. {
  2965.         pb[n]   = panel_create_item(pa[a],PANEL_BUTTON,
  2966.                 PANEL_ITEM_X,                   x,
  2967.                 PANEL_ITEM_Y,                   y,
  2968.                 PANEL_LABEL_IMAGE,
  2969.             panel_button_image(pa[a],s,w,font_panel_button),
  2970.                 PANEL_NOTIFY_PROC,              *bnp[n],
  2971.                 0);
  2972.         return;
  2973. }
  2974. /* EOF */
  2975. /* cat > src+obj/make_pm.c << "EOF" */
  2976. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2977. /* make_pm: make a panel message to be referenced in    */
  2978. /*        the pgm                    */
  2979. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2980. /* SCCS information: %W%    %G% - NCSA */
  2981.  
  2982. /* #include "all.h" */
  2983.  
  2984. int    make_pm(n,x,y,a,s) int n,x,y,a; char *s;
  2985. {
  2986.         pm[n]   = panel_create_item(pa[a],PANEL_MESSAGE,
  2987.                 PANEL_ITEM_X,                   x,
  2988.                 PANEL_ITEM_Y,                   y,
  2989.                 PANEL_LABEL_STRING,             s,
  2990.                 PANEL_LABEL_BOLD,               TRUE,
  2991.                 0);
  2992.         return;
  2993. }
  2994. /* EOF */
  2995. /* cat > src+obj/make_pmnn.c << "EOF" */
  2996. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  2997. /* make_pmnn: make a panel message never referenced in    */
  2998. /*           the pgm                    */
  2999. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3000. /* SCCS information: %W%    %G% - NCSA */
  3001.  
  3002. /* #include "all.h" */
  3003.  
  3004. int    make_pmnn(x,y,a,s) int x,y,a; char *s;
  3005. {
  3006.                 panel_create_item(pa[a],PANEL_MESSAGE,
  3007.                 PANEL_ITEM_X,                   x,
  3008.                 PANEL_ITEM_Y,                   y,
  3009.                 PANEL_LABEL_STRING,             s,
  3010.                 PANEL_LABEL_BOLD,               TRUE,
  3011.                 0);
  3012.         return;
  3013. }
  3014. /* EOF */
  3015. /* cat > src+obj/make_ps.c << "EOF" */
  3016. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3017. /* make_ps: make a panel slider                */
  3018. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3019. /* SCCS information: %W%    %G% - NCSA */
  3020.  
  3021. /* #include "all.h" */
  3022.  
  3023. int    make_ps(n,x,y,w,i,j,a,s) int n,x,y,w,i,j,a; char *s;
  3024. {
  3025.         ps[n]   = panel_create_item(pa[a],PANEL_SLIDER,
  3026.                 PANEL_LAYOUT,                   PANEL_HORIZONTAL,
  3027.                 PANEL_SHOW_RANGE,               TRUE,
  3028.                 PANEL_SHOW_VALUE,               TRUE,
  3029.                 PANEL_ITEM_X,                   x,
  3030.                 PANEL_ITEM_Y,                   y,
  3031.                 PANEL_SLIDER_WIDTH,             w,
  3032.                 PANEL_MIN_VALUE,                i,
  3033.                 PANEL_MAX_VALUE,                j,
  3034.                 PANEL_LABEL_STRING,             s,
  3035.                 PANEL_NOTIFY_PROC,              *snp[n],
  3036.                 0);
  3037.         return;
  3038. }
  3039. /* EOF */
  3040. /* cat > src+obj/make_pt.c << "EOF" */
  3041. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3042. /* make_pt: make a panel text                */
  3043. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3044. /* SCCS information: %W%    %G% - NCSA */
  3045.  
  3046. /* #include "all.h" */
  3047.  
  3048. int    make_pt(n,x,y,a,d,e,s) int n,x,y,a,d,e; char *s;
  3049. {
  3050.         pt[n]   = panel_create_item(pa[a],PANEL_TEXT,
  3051.                 PANEL_ITEM_X,                   x,
  3052.                 PANEL_ITEM_Y,                   y,
  3053.                 PANEL_VALUE_STORED_LENGTH,      d,
  3054.                 PANEL_VALUE_DISPLAY_LENGTH,     e,
  3055.                 PANEL_LABEL_STRING,             s,
  3056.                 PANEL_LABEL_BOLD,               TRUE,
  3057.                 0);
  3058.         return;
  3059. }
  3060. /* EOF */
  3061. /* cat > src+obj/mouse_msg.c << "EOF" */
  3062. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3063. /* mouse_msg: state the current mouse canvas position    */
  3064. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3065. /* SCCS information: %W%    %G% - NCSA */
  3066.  
  3067. /* #include "all.h" */
  3068.  
  3069. int    mouse_msg(x,y) int    x,y;
  3070. {
  3071.     char        *s;
  3072.     strcpy(txt,panel_get(pm[0],PANEL_LABEL_STRING,0));
  3073.     *(txt + 10) = '\0';
  3074.     panel_set(pm[0],PANEL_LABEL_STRING,txt,0);
  3075.     strcpy(txt,"Mouse now at x = ");
  3076.     s = txt;
  3077.     while (*s) s++;
  3078.     my_itoa(x,s);
  3079.     while (*s) s++;
  3080.     strcat(    s,", y = ");
  3081.     while (*s) s++;
  3082.     my_itoa(y,s);
  3083.     while (*s) s++;
  3084.     *s++ = '.';
  3085.     *s   = '\0';
  3086.     panel_set(pm[1],PANEL_LABEL_STRING,txt,0);
  3087.     return;
  3088. }
  3089. /* EOF */
  3090. /* cat > src+obj/msg_draw.c << "EOF" */
  3091. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3092. /* msg_draw: say draw button activated for some frame    */
  3093. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3094. /* SCCS information: %W%    %G% - NCSA */
  3095.  
  3096. /* #include "all.h" */
  3097.  
  3098. int    msg_draw(s) char *s;
  3099. {
  3100.     strcpy(txt,"          ");
  3101.     strcat(txt,s);
  3102.     strcat(txt,"  move the mouse into the canvas to the point");
  3103.     info_msg(txt,"where you want the origin to be, then click the mouse button.","");
  3104.     return;
  3105. }
  3106. /* EOF */
  3107. /* cat > src+obj/msg_move.c << "EOF" */
  3108. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3109. /* msg_move: say move button activated for some frame    */
  3110. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3111. /* SCCS information: %W%    %G% - NCSA */
  3112.  
  3113. /* #include "all.h" */
  3114.  
  3115. int    msg_move(s) char *s;
  3116. {
  3117.     strcpy(txt,"          ");
  3118.     strcat(txt,s);
  3119.     strcat(txt,"  move the mouse into the canvas and press the mouse button (hold");
  3120.     info_msg(txt,
  3121.          "it down).  Drag the mouse to some other point and release it.  The data",
  3122.          "is moved according to the vector you have just defined.");
  3123.     return;
  3124. }
  3125. /* EOF */
  3126. /* cat > src+obj/my_atof.c << "EOF" */
  3127. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3128. /* my_atof: my alpha to floating point            */
  3129. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3130. /* SCCS information: %W%    %G% - NCSA */
  3131.  
  3132. /* #include "all.h" */
  3133.  
  3134. int    my_atof(f,s) float *f; char *s;
  3135. {
  3136.         float           n;
  3137.         char            c,*t;
  3138.         if (*s == '\0') {*f = 0.; return;}
  3139.         while (*s == ' ') s++;
  3140.         t = s;
  3141.         while (*t && *t != '.') t++;
  3142.         if (*t == '\0') {*f = atoi(s); return;}
  3143.         *t = '\0';
  3144.         *f = atoi(s);
  3145.         *t++ = '.';
  3146.         if (*t == '\0') return;
  3147.         s = t;
  3148.         while (*t >= '0' && *t <= '9') t++;
  3149.         c = *t;
  3150.         *t = '\0';
  3151.         n = 1.;
  3152.         while (s < t) {n *= 10.; *f += (*s - '0') / n; s++;}
  3153.         *t = c;
  3154.         return;
  3155. }
  3156. /* EOF */
  3157. /* cat > src+obj/my_ftoa.c << "EOF" */
  3158. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3159. /* my_ftoa: my floating point to alpha            */
  3160. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3161. /* SCCS information: %W%    %G% - NCSA */
  3162.  
  3163. /* #include "all.h" */
  3164.  
  3165. int    my_ftoa(f,d,s) float f; int d; char *s;
  3166. {
  3167.         register int            n;
  3168.         n = f;
  3169.         my_itoa(n,s);
  3170.         n = f;
  3171.         while (n > 0) {s++; n /= 10;}
  3172.         *s++ = '.';
  3173.         n = f;
  3174.         f -= n;
  3175.         while (d-- > 0) f *= 10.;
  3176.         n = f;
  3177.         my_itoa(n,s);
  3178.         return;
  3179. }
  3180. /* EOF */
  3181. /* cat > src+obj/my_isfloat.c << "EOF" */
  3182. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3183. /* my_isfloat: is the char string a floating point    */
  3184. /*           number?                    */
  3185. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3186. /* SCCS information: %W%    %G% - NCSA */
  3187.  
  3188. /* #include "all.h" */
  3189.  
  3190. int    my_isfloat(s) char *s;
  3191. {
  3192.         char            *t;
  3193.         if (*s == '\0') return(TRUE);
  3194.         while (*s == ' ') s++;
  3195.         t = s;
  3196.         while (*t && *t != '.') t++;
  3197.         if (*t == '\0') return(my_isint(s));
  3198.         if (*t != '.') return(FALSE);
  3199.         *t = '\0';
  3200.         if (FALSE == my_isint(s)) return(FALSE);
  3201.         *t++ = '.';
  3202.         if (FALSE == my_isint(t)) return(FALSE);
  3203.         return(TRUE);
  3204. }
  3205. /* EOF */
  3206. /* cat > src+obj/my_isint.c << "EOF" */
  3207. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3208. /* my_isint: is the char string an integer?        */
  3209. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3210. /* SCCS information: %W%    %G% - NCSA */
  3211.  
  3212. /* #include "all.h" */
  3213.  
  3214. int    my_isint(s) char *s;
  3215. {
  3216.         char            *t;
  3217.         if (*s == '\0') return(TRUE);
  3218.         while (*s == ' ') s++;
  3219.         if (*s == '-') s++;
  3220.         t = s;
  3221.         while (*t) t++;
  3222.         t--;
  3223.         while(*t == ' ') *t-- = '\0';
  3224.         while (*s) {if (*s < '0' || *s > '9') return(FALSE); s++;}
  3225.         return(TRUE);
  3226. }
  3227. /* EOF */
  3228. /* cat > src+obj/my_itoa.c << "EOF" */
  3229. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3230. /* my_itoa: my integer to alpha                */
  3231. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3232. /* SCCS information: %W%    %G% - NCSA */
  3233.  
  3234. /* #include "all.h" */
  3235.  
  3236. int    my_itoa(n,s) int n; char *s;
  3237. {
  3238.         char                    *t;
  3239.         register int            j;
  3240.         if (n == 0) {*s++ = '0'; *s = '\0'; return;}
  3241.         if (n < 0) {*s++ = '-'; n = - n;}
  3242.         if (n < 10) {*s++ = '0' + n; *s = '\0'; return;}
  3243.         t = s;
  3244.         j = n;
  3245.         while (j > 0) {t++; j /= 10;}
  3246.         *t-- = '\0';
  3247.         while (t > s) {j = n/10; *t-- = '0' + n - 10*j; n /= 10;}
  3248.         *t = '0' +j;
  3249.         return;
  3250. }
  3251. /* EOF */
  3252. /* cat > src+obj/my_otod.c << "EOF" */
  3253. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3254. /* my_otod: my octal to decimal integer            */
  3255. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3256. /* SCCS information: %W%    %G% - NCSA */
  3257.  
  3258. /* #include "all.h" */
  3259.  
  3260. int    my_otod(n) int n;
  3261. {
  3262.         char            s[8],*t;
  3263.         register int    k,m;
  3264.         k       = 0;
  3265.         m       = 1;
  3266.         my_itoa(n,s);
  3267.         t = s;
  3268.         while (*t) t++;
  3269.         t--;
  3270.         while (t > s) {k += m * (*t - '0'); m *= 8; t--;}
  3271.         k += m * (*t - '0');
  3272.         return(k);
  3273. }
  3274. /* EOF */
  3275. /* cat > src+obj/my_stripfn.c << "EOF" */
  3276. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3277. /* my_stripfn: my strip file name            */
  3278. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3279. /* SCCS information: %W%    %G% - NCSA */
  3280.  
  3281. /* #include "all.h" */
  3282.  
  3283. int    my_stripfn(s) char *s;
  3284. {
  3285.         char            *t;
  3286.         if (*s == '\0') return;
  3287.         t = s;
  3288.         while (*t == ' ') t++;
  3289.         while (*t != ' ' && *t) *s++ = *t++;
  3290.         *s = '\0';
  3291.         return;
  3292. }
  3293. /* EOF */
  3294. /* cat > src+obj/no_op.c << "EOF" */
  3295. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3296. /* no_op: no operation                    */
  3297. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3298. /* SCCS information: %W%    %G% - NCSA */
  3299.  
  3300. /* #include "all.h" */
  3301.  
  3302. int    no_op()
  3303. {
  3304.         return;
  3305. }
  3306. /* EOF */
  3307. /* cat > src+obj/nosho_feature.c << "EOF" */
  3308. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3309. /* nosho_feature: no-sho the features frame elements    */
  3310. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3311. /* SCCS information: %W%    %G% - NCSA */
  3312.  
  3313. /* #include "all.h" */
  3314.  
  3315. int    nosho_feature()
  3316. {
  3317.     panel_set(pb[107],PANEL_SHOW_ITEM,FALSE,0);
  3318.     panel_set(pb[108],PANEL_SHOW_ITEM,FALSE,0);
  3319.     panel_set(pb[110],PANEL_SHOW_ITEM,FALSE,0);
  3320.     panel_set(pb[111],PANEL_SHOW_ITEM,FALSE,0);
  3321.     panel_set(pb[112],PANEL_SHOW_ITEM,FALSE,0);
  3322.     panel_set(ps[  0],PANEL_SHOW_ITEM,FALSE,0);
  3323.     panel_set(ps[  1],PANEL_SHOW_ITEM,FALSE,0);
  3324.     panel_set(ps[  2],PANEL_SHOW_ITEM,FALSE,0);
  3325.     panel_set(ps[  3],PANEL_SHOW_ITEM,FALSE,0);
  3326.         return;
  3327. }
  3328. /* EOF */
  3329. /* cat > src+obj/null_colorbar.c << "EOF" */
  3330. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3331. /* null_colorbar: null the colorbar structure        */
  3332. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3333. /* SCCS information: %W%    %G% - NCSA */
  3334.  
  3335. /* #include "all.h" */
  3336.  
  3337. int    null_colorbar(s) struct s_colorbar *s;
  3338. {
  3339.         s -> sw         = FALSE;
  3340.         s -> xpos       = 0;
  3341.         s -> ypos       = 0;
  3342.         s -> xpts       = 100;
  3343.         s -> ypts       = 256;
  3344.         return;
  3345. }
  3346. /* EOF */
  3347. /* cat > src+obj/null_contour.c << "EOF" */
  3348. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3349. /* null_contour: null a contour data structure        */
  3350. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3351. /* SCCS information: %W%    %G% - NCSA */
  3352.  
  3353. /* #include "all.h" */
  3354.  
  3355. int    null_contour(s) struct s_contour *s;
  3356. {
  3357.         s -> sw         = FALSE;
  3358.         strcpy(s -> fname,"");
  3359.         s -> color      = 255;
  3360.         s -> first      = 0;
  3361.         s -> last       = 255;
  3362.         s -> interval   = 32;
  3363.         s -> dis        = 0;
  3364.         s -> xpos       = 0;
  3365.         s -> ypos       = 0;
  3366.         s -> xpts       = 0;
  3367.         s -> ypts       = 0;
  3368.         return;
  3369. }
  3370. /* EOF */
  3371. /* cat > src+obj/null_feature.c << "EOF" */
  3372. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3373. /* null_feature: null a feature structure        */
  3374. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3375. /* SCCS information: %W%    %G% - NCSA */
  3376.  
  3377. /* #include "all.h" */
  3378.  
  3379. int    null_feature(s) struct s_feature *s;
  3380. {
  3381.         s -> xax_sw     = FALSE;
  3382.         s -> xax_thick  = 1;
  3383.         s -> xax_color  = 255;
  3384.         s -> xax_bot    = TRUE;
  3385.         s -> xax_top    = TRUE;
  3386.         s -> yax_sw     = FALSE;
  3387.         s -> yax_thick  = 1;
  3388.         s -> yax_color  = 255;
  3389.         s -> yax_left   = TRUE;
  3390.         s -> yax_right  = TRUE;
  3391.         s -> xgr_sw     = FALSE;
  3392.         s -> xgr_thick  = 1;
  3393.         s -> xgr_color  = 255;
  3394.         s -> xgr_space  = 64;
  3395.         s -> ygr_sw     = FALSE;
  3396.         s -> ygr_thick  = 1;
  3397.         s -> ygr_color  = 255;
  3398.         s -> ygr_space  = 64;
  3399.         s -> xt1_sw     = FALSE;
  3400.         s -> xt1_thick  = 1;
  3401.         s -> xt1_color  = 255;
  3402.         s -> xt1_bot    = TRUE;
  3403.         s -> xt1_top    = TRUE;
  3404.         s -> xt1_space  = 32;
  3405.         s -> xt1_len    = 10;
  3406.         s -> xt1_direc  = FALSE;
  3407.         s -> yt1_sw     = FALSE;
  3408.         s -> yt1_thick  = 1;
  3409.         s -> yt1_color  = 255;
  3410.         s -> yt1_left   = TRUE;
  3411.         s -> yt1_right  = TRUE;
  3412.         s -> yt1_space  = 32;
  3413.         s -> yt1_len    = 10;
  3414.         s -> yt1_direc  = FALSE;
  3415.         s -> xt2_sw     = FALSE;
  3416.         s -> xt2_thick  = 1;
  3417.         s -> xt2_color  = 255;
  3418.         s -> xt2_bot    = TRUE;
  3419.         s -> xt2_top    = TRUE;
  3420.         s -> xt2_space  = 8;
  3421.         s -> xt2_len    = 5;
  3422.         s -> xt2_direc  = FALSE;
  3423.         s -> yt2_sw     = FALSE;
  3424.         s -> yt2_thick  = 1;
  3425.         s -> yt2_color  = 255;
  3426.         s -> yt2_left   = TRUE;
  3427.         s -> yt2_right  = TRUE;
  3428.         s -> yt2_space  = 8;
  3429.         s -> yt2_len    = 5;
  3430.         s -> yt2_direc  = FALSE;
  3431.         return;
  3432. }
  3433. /* EOF */
  3434. /* cat > src+obj/null_grid.c << "EOF" */
  3435. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3436. /* null_grid: null the grid structure            */
  3437. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3438. /* SCCS information: %W%    %G% - NCSA */
  3439.  
  3440. /* #include "all.h" */
  3441.  
  3442. int    null_grid(s) struct s_grid *s;
  3443. {
  3444.         s -> sw         = FALSE;
  3445.         s -> xpix       = 100;
  3446.         s -> ypix       = 100;
  3447.         s -> color      = 255;
  3448.         return;
  3449. }
  3450. /* EOF */
  3451. /* cat > src+obj/null_image.c << "EOF" */
  3452. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3453. /* null_image: null an image structure            */
  3454. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3455. /* SCCS information: %W%    %G% - NCSA */
  3456.  
  3457. /* #include "all.h" */
  3458.  
  3459. int    null_image(s) struct s_image *s;
  3460. {
  3461.         s -> sw         = FALSE;
  3462.         strcpy(s -> fname,"");
  3463.         s -> xpos       = 0;
  3464.         s -> ypos       = 0;
  3465.         s -> xpts       = 0;
  3466.         s -> ypts       = 0;
  3467.         return;
  3468. }
  3469. /* EOF */
  3470. /* cat > src+obj/null_text.c << "EOF" */
  3471. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3472. /* null_text: null a text structure            */
  3473. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3474. /* SCCS information: %W%    %G% - NCSA */
  3475.  
  3476. /* #include "all.h" */
  3477. /* #include "newext.h" */
  3478.  
  3479. int    null_text(s) struct s_text *s;
  3480. {
  3481.         s -> sw         = FALSE;
  3482.         strcpy(s -> body,"");
  3483.         strcpy(s -> prefont, dprefont);
  3484.         strcpy(s -> postfont, dpostfont);
  3485.         s -> xpos       = 0;
  3486.         s -> ypos       = 0;
  3487.         s -> color      = 0;
  3488.         return;
  3489. }
  3490. /* EOF */
  3491. /* cat > src+obj/null_vector.c << "EOF" */
  3492. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3493. /* null_vector: null a vector structure            */
  3494. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3495. /* SCCS information: %W%    %G% - NCSA */
  3496.  
  3497. /* #include "all.h" */
  3498.  
  3499. int    null_vector(s) struct s_vector *s;
  3500. {
  3501.         s -> sw         = FALSE;
  3502.         strcpy(s -> xname,"");
  3503.         strcpy(s -> yname,"");
  3504.         s -> xpos       = 0;
  3505.         s -> ypos       = 0;
  3506.         s -> xpts       = 0;
  3507.         s -> ypts       = 0;
  3508.         s -> xstart     = 0;
  3509.         s -> xend       = 0;
  3510.         s -> xinterval  = 50;
  3511.         s -> ystart     = 0;
  3512.         s -> yend       = 0;
  3513.         s -> yinterval  = 50;
  3514.         s -> color      = 255;
  3515.         s -> maxlen     = 30;
  3516.         s -> xzero      = 128;
  3517.         s -> xscale     = 1.;
  3518.         s -> yscale     = 1.;
  3519.         s -> yzero      = 128;
  3520.         s -> xdis       = 0;
  3521.         s -> ydis       = 0;
  3522.         return;
  3523. }
  3524. /* EOF */
  3525. /* cat > src+obj/ok_colorbar.c << "EOF" */
  3526. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3527. /* ok_colorbar: is the structure ok for the displayed    */
  3528. /*        colorbar?                */
  3529. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3530. /* SCCS information: %W%    %G% - NCSA */
  3531.  
  3532. /* #include "all.h" */
  3533.  
  3534. int    ok_colorbar(s) struct s_colorbar *s;
  3535. {
  3536.         if    (FALSE == my_isint(panel_get(pt[6],PANEL_VALUE,0)))
  3537.         {bad_data("X-points not integer, request ignored.");
  3538.          return(FALSE);
  3539.         }
  3540.         else if    (atoi(panel_get(pt[6],PANEL_VALUE,0)) < 1)
  3541.         {bad_data("X-points < 1, request ignored.");
  3542.          return(FALSE);
  3543.         }
  3544.         else if    (FALSE == my_isint(panel_get(pt[7],PANEL_VALUE,0)))
  3545.         {bad_data("Y-points not integer, request ignored.");
  3546.          return(FALSE);
  3547.         }
  3548.         else if    (atoi(panel_get(pt[7],PANEL_VALUE,0)) < 1)
  3549.         {bad_data("Y-points < 1, request ignored.");
  3550.          return(FALSE);
  3551.         }
  3552.         else if    (FALSE == my_isint(panel_get(pt[8],PANEL_VALUE,0)))
  3553.         {bad_data("X-origin not integer, request ignored.");
  3554.          return(FALSE);
  3555.         }
  3556.         else if    (FALSE == my_isint(panel_get(pt[9],PANEL_VALUE,0)))
  3557.         {bad_data("Y-origin not integer, request ignored.");
  3558.          return(FALSE);
  3559.         }
  3560.     else
  3561.             {s->xpts = atoi(panel_get(pt[6],PANEL_VALUE,0));
  3562.              s->ypts = atoi(panel_get(pt[7],PANEL_VALUE,0));
  3563.              s->xpos = atoi(panel_get(pt[8],PANEL_VALUE,0));
  3564.              s->ypos = atoi(panel_get(pt[9],PANEL_VALUE,0));
  3565.              return(TRUE);
  3566.         }
  3567. }
  3568. /* EOF */
  3569. /* cat > src+obj/ok_contour.c << "EOF" */
  3570. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3571. /* ok_contour: is the structure ok for the displayed    */
  3572. /*           contour?                    */
  3573. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3574. /* SCCS information: %W%    %G% - NCSA */
  3575.  
  3576. /* #include "all.h" */
  3577.  
  3578. int
  3579. ok_contour (s, n)
  3580.     struct s_contour *s;
  3581.     int n;
  3582.         /* input: sequence number of image in HDF file */
  3583. {
  3584.         register int             i;
  3585.     int xv, yv, *pxv, *pyv, nxv, nyv, filetype;
  3586.     char *xs, *ys;
  3587.     char tmpfn[MAXNAMELEN + 1];
  3588.  
  3589.         if    (FALSE == my_isint(panel_get(pt[30],PANEL_VALUE,0)))
  3590.         {bad_data("X-points not integer, request ignored.");
  3591.          return(FALSE);
  3592.         }
  3593.         else if    (atoi(panel_get(pt[30],PANEL_VALUE,0)) < 0)
  3594.         {bad_data("X-points < 0, request ignored.");
  3595.          return(FALSE);
  3596.         }
  3597.         else if    (FALSE == my_isint(panel_get(pt[31],PANEL_VALUE,0)))
  3598.         {bad_data("Y-points not integer, request ignored.");
  3599.          return(FALSE);
  3600.         }
  3601.         else if    (atoi(panel_get(pt[31],PANEL_VALUE,0)) < 0)
  3602.         {bad_data("Y-points < 0, request ignored.");
  3603.          return(FALSE);
  3604.         }
  3605.         else if    (FALSE == my_isint(panel_get(pt[32],PANEL_VALUE,0)))
  3606.         {bad_data("X-origin not integer, request ignored.");
  3607.          return(FALSE);
  3608.         }
  3609.         else if    (FALSE == my_isint(panel_get(pt[33],PANEL_VALUE,0)))
  3610.         {bad_data("Y-origin not integer, request ignored.");
  3611.          return(FALSE);
  3612.         }
  3613.         else if    (FALSE == my_isint(panel_get(pt[34],PANEL_VALUE,0)))
  3614.         {bad_data("Color not integer, request ignored.");
  3615.          return(FALSE);
  3616.         }
  3617.         else if    (atoi(panel_get(pt[34],PANEL_VALUE,0)) < 0 ||
  3618.          atoi(panel_get(pt[34],PANEL_VALUE,0)) > 255)
  3619.         {bad_data("Color < 0 or > 255, request ignored.");
  3620.          return(FALSE);
  3621.         }
  3622.         else if    (FALSE == my_isint(panel_get(pt[35],PANEL_VALUE,0)))
  3623.         {bad_data("Start color not integer, request ignored.");
  3624.          return(FALSE);
  3625.         }
  3626.         else if    (FALSE == my_isint(panel_get(pt[36],PANEL_VALUE,0)))
  3627.         {bad_data("End color not integer, request ignored.");
  3628.          return(FALSE);
  3629.         }
  3630.     else if    (FALSE == my_isint(panel_get(pt[37],PANEL_VALUE,0)))
  3631.         {bad_data("Interval not integer, request ignored.");
  3632.          return(FALSE);
  3633.         }
  3634.     else
  3635.     {
  3636.         pxv = (xstrlen ((xs = panel_get (pt[30], PANEL_VALUE, 0))) == 0) ? NULL : &xv;
  3637.         if (pxv != NULL)
  3638.             xv = atoi (xs);
  3639.         pyv = (xstrlen ((ys = panel_get (pt[31], PANEL_VALUE, 0))) == 0) ? NULL : &yv;
  3640.         if (pyv != NULL)
  3641.             yv = atoi (ys);
  3642.         strcpy (tmpfn, panel_get (pt[29], PANEL_VALUE, 0));
  3643.         if (xstrlen (tmpfn) == 0) /* no file */
  3644.         {
  3645.             bad_data ("No contour image file given, request ignored.");
  3646.             return (FALSE);
  3647.         }
  3648.         else
  3649.         {
  3650.             (void) strip_wspace (tmpfn);
  3651.             i = check_image (tmpfn, pxv, pyv, &nxv, &nyv, n, &filetype);
  3652.         }
  3653.         if (i == 1)
  3654.         {
  3655.             bad_data ("Cannot open contour image file, request ignored.");
  3656.                      return (FALSE);
  3657.                 }
  3658.         else if    (i == 2)
  3659.         {
  3660.             if (pxv == NULL && pyv != NULL)
  3661.             {
  3662.                 bad_data ("No X points given - not HDF file, request ignored.");
  3663.                 return (FALSE);
  3664.             }
  3665.             else if (pxv != NULL && pyv == NULL)
  3666.             {
  3667.                 bad_data ("No Y points given - not HDF file, request ignored.");
  3668.                 return (FALSE);
  3669.             }
  3670.             else if (xv == 0)
  3671.             {
  3672.                 bad_data ("X-points < 1, request ignored.");
  3673.                 return (FALSE);
  3674.             }
  3675.             else if (yv == 0)
  3676.             {
  3677.                 bad_data ("Y-points < 1, request ignored.");
  3678.                 return (FALSE);
  3679.             }
  3680.             else
  3681.             {
  3682.                 bad_data ("X-pts*Y-pts != contour image filesize, request ignored.");
  3683.                          return (FALSE);
  3684.                     }
  3685.         }
  3686.         else if (i == 3)
  3687.         {
  3688.             bad_data ("Not enough images in HDF file for contour image, request ignored");
  3689.             return (FALSE);
  3690.         }
  3691.         else if (i < 0)        /* HDF error */
  3692.         {
  3693.             sprintf (msg, "HDF file error (DFerror = %d) for contour image, request ignored.", i);
  3694.             bad_data (msg);
  3695.             return (FALSE);
  3696.         }
  3697.         if (i == 4)
  3698.         {
  3699. /*
  3700.             info_msg ("          ----- INFORMATION MESSAGE -----",
  3701.                   "HDF file contour image dimensions used",
  3702.                   "          ----- INFORMATION MESSAGE -----");
  3703. */
  3704.             sprintf (msg, "%d", nxv);  
  3705.             panel_set_value (pt[30], msg);
  3706.             sprintf (msg, "%d", nyv);
  3707.             panel_set_value (pt[31], msg);
  3708.             xv = nxv;
  3709.             yv = nyv;
  3710.             i = 0;
  3711.         }
  3712.         if (i == 0)
  3713.         {
  3714.             strcpy(s->fname, tmpfn);
  3715.             panel_set (pt[29], PANEL_VALUE, tmpfn, 0);
  3716.             s->xpts = xv;
  3717.             s->ypts = yv;
  3718.             s->xpos = atoi(panel_get(pt[32],PANEL_VALUE,0));
  3719.             s->ypos = atoi(panel_get(pt[33],PANEL_VALUE,0));
  3720.             s->color = atoi(panel_get(pt[34],PANEL_VALUE,0));
  3721.             s->first = atoi(panel_get(pt[35],PANEL_VALUE,0));
  3722.             s->last = atoi(panel_get(pt[36],PANEL_VALUE,0));
  3723.             s->interval = atoi(panel_get(pt[37],PANEL_VALUE,0));
  3724.             return (TRUE);
  3725.         }
  3726.         else
  3727.         {
  3728.             bad_data("This ok_contour error is not possible.");
  3729.             return(FALSE);
  3730.         }
  3731.     }
  3732. }
  3733. /* EOF */
  3734. /* cat > src+obj/ok_grid.c << "EOF" */
  3735. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3736. /* ok_grid: is the structure ok for the displayed grid?    */
  3737. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3738. /* SCCS information: %W%    %G% - NCSA */
  3739.  
  3740. /* #include "all.h" */
  3741.  
  3742. int    ok_grid(s) struct s_grid *s;
  3743. {
  3744.         if    (FALSE == my_isint(panel_get(pt[2],PANEL_VALUE,0)))
  3745.         {bad_data("Color not integer, request ignored.");
  3746.          return(FALSE);
  3747.         }
  3748.         else if    (atoi(panel_get(pt[2],PANEL_VALUE,0)) < 0 ||
  3749.          atoi(panel_get(pt[2],PANEL_VALUE,0)) > 255)
  3750.         {bad_data("Color < 0 or > 255, request ignored.");
  3751.          return(FALSE);
  3752.         }
  3753.         else if    (FALSE == my_isint(panel_get(pt[3],PANEL_VALUE,0)))
  3754.         {bad_data("Pix/x-grid not integer, request ignored.");
  3755.          return(FALSE);
  3756.         }
  3757.         else if    (atoi(panel_get(pt[3],PANEL_VALUE,0)) < 1)
  3758.         {bad_data("Pix/x-grid < 1, request ignored.");
  3759.          return(FALSE);
  3760.         }
  3761.         else if    (FALSE == my_isint(panel_get(pt[4],PANEL_VALUE,0)))
  3762.         {bad_data("Pix/y-grid not integer, request ignored.");
  3763.          return(FALSE);
  3764.         }
  3765.         else if    (atoi(panel_get(pt[4],PANEL_VALUE,0)) < 1)
  3766.         {bad_data("Pix/y-grid < 1, request ignored.");
  3767.          return(FALSE);
  3768.         }
  3769.     else
  3770.             {s->color = atoi(panel_get(pt[2],PANEL_VALUE,0));
  3771.              s->xpix = atoi(panel_get(pt[3],PANEL_VALUE,0));
  3772.              s->ypix = atoi(panel_get(pt[4],PANEL_VALUE,0));
  3773.              return(TRUE);
  3774.         }
  3775. }
  3776. /* EOF */
  3777. /* cat > src+obj/ok_image.c << "EOF" */
  3778. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3779. /* ok_image: is the structure ok for the displayed    */
  3780. /*         image?                    */
  3781. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3782. /* SCCS information: %W%    %G% - NCSA */
  3783.  
  3784. /* #include "all.h" */
  3785. /* #include "newext.h" */
  3786.  
  3787. int
  3788. ok_image (s, n)
  3789.     struct s_image *s;
  3790.     int n;
  3791.         /* input: sequence number of image in HDF file. */
  3792. {
  3793.     register int    i;
  3794.     int xv, yv, *pxv, *pyv, nxv, nyv, filetype;
  3795.     char *xs, *ys;
  3796.     char tmpfn[MAXNAMELEN + 1];
  3797.  
  3798.         if    (FALSE == my_isint(panel_get(pt[23],PANEL_VALUE,0)))
  3799.         {bad_data("X-points not integer, request ignored.");
  3800.          return(FALSE);
  3801.         }
  3802.         else if    (atoi(panel_get(pt[23],PANEL_VALUE,0)) < 0) 
  3803.         {bad_data("X-points < 0, request ignored.");
  3804.          return(FALSE);
  3805.         }
  3806.         else if    (FALSE == my_isint(panel_get(pt[24],PANEL_VALUE,0)))
  3807.         {bad_data("Y-points not integer, request ignored.");
  3808.          return(FALSE);
  3809.         }
  3810.         else if    (atoi(panel_get(pt[24],PANEL_VALUE,0)) < 0)
  3811.         {bad_data("Y-points < 0, request ignored.");
  3812.          return(FALSE);
  3813.         }
  3814.         else if    (FALSE == my_isint(panel_get(pt[25],PANEL_VALUE,0)))
  3815.         {bad_data("X-origin not integer, request ignored.");
  3816.         return(FALSE);
  3817.         }
  3818.         else if    (FALSE == my_isint(panel_get(pt[26],PANEL_VALUE,0)))
  3819.         {bad_data("Y-origin not integer, request ignored.");
  3820.          return(FALSE);
  3821.         }
  3822.     else
  3823.     {
  3824.         pxv = (xstrlen ((xs = panel_get (pt[23], PANEL_VALUE, 0))) == 0) ? NULL : &xv;
  3825.         if (pxv != NULL)
  3826.             xv = atoi (xs);
  3827.         pyv = (xstrlen ((ys = panel_get (pt[24], PANEL_VALUE, 0))) == 0) ? NULL : &yv;
  3828.         if (pyv != NULL)
  3829.             yv = atoi (ys);
  3830.         strcpy (tmpfn, panel_get (pt[27], PANEL_VALUE, 0));
  3831.         if (xstrlen (tmpfn) == 0) /* no file */
  3832.         {
  3833.             bad_data ("No image file given, request ignored.");
  3834.             return (FALSE);
  3835.         }
  3836.         else
  3837.         {
  3838.             (void) strip_wspace (tmpfn);
  3839.             i = check_image (tmpfn, pxv, pyv, &nxv, &nyv, n, &filetype);
  3840.         }
  3841.         if (i == 1)
  3842.         {
  3843.             bad_data ("Cannot open image file, request ignored.");
  3844.                      return (FALSE);
  3845.                 }
  3846.         else if    (i == 2)
  3847.         {
  3848.             if (pxv == NULL && pyv != NULL)
  3849.             {
  3850.                 bad_data ("No X points given - not HDF file, request ignored.");
  3851.                 return (FALSE);
  3852.             }
  3853.             else if (pxv != NULL && pyv == NULL)
  3854.             {
  3855.                 bad_data ("No Y points given - not HDF file, request ignored.");
  3856.                 return (FALSE);
  3857.             }
  3858.             else if (xv == 0)
  3859.             {
  3860.                 bad_data ("X-points < 1, request ignored.");
  3861.                 return (FALSE);
  3862.             }
  3863.             else if (yv == 0)
  3864.             {
  3865.                 bad_data ("Y-points < 1, request ignored.");
  3866.                 return (FALSE);
  3867.             }
  3868.             else
  3869.             {
  3870.                 bad_data ("X-pts*Y-pts != image filesize, request ignored.");
  3871.                          return (FALSE);
  3872.                     }
  3873.         }
  3874.         else if (i == 3)
  3875.         {
  3876.             bad_data ("Not enough images in HDF file, request ignored");
  3877.             return (FALSE);
  3878.         }
  3879.         else if (i < 0)        /* HDF error */
  3880.         {
  3881.             sprintf (msg, "HDF file error (DFerror = %d) for image, request ignored.", i);
  3882.             bad_data (msg);
  3883.             return (FALSE);
  3884.         }
  3885.         if (i == 4)
  3886.         {
  3887. /*
  3888.             info_msg ("          ----- INFORMATION MESSAGE -----",
  3889.                   "HDF file image dimensions used",
  3890.                   "          ----- INFORMATION MESSAGE -----");
  3891. */
  3892.             sprintf (msg, "%d", nxv);  
  3893.             panel_set_value (pt[23], msg);
  3894.             sprintf (msg, "%d", nyv);
  3895.             panel_set_value (pt[24], msg);
  3896.             xv = nxv;
  3897.             yv = nyv;
  3898.             i = 0;
  3899.         }
  3900.         if (i == 0)
  3901.         {
  3902.             s->xpts = xv;
  3903.             s->ypts = yv;
  3904.             s->xpos = atoi(panel_get(pt[25],PANEL_VALUE,0));
  3905.             s->ypos = atoi(panel_get(pt[26],PANEL_VALUE,0));
  3906.             strcpy(s->fname, tmpfn);
  3907.             panel_set (pt[27], PANEL_VALUE, tmpfn, 0);
  3908.             return (TRUE);
  3909.         }
  3910.         else
  3911.         {
  3912.             bad_data("This ok_image error is not possible.");
  3913.             return(FALSE);
  3914.         }
  3915.     }
  3916. }
  3917. /* EOF */
  3918. /* cat > src+obj/ok_text.c << "EOF" */
  3919. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3920. /* ok_text: is the structure ok for the displayed text?    */
  3921. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3922. /* SCCS information: %W%    %G% - NCSA */
  3923.  
  3924. /* #include "all.h" */
  3925.  
  3926. int    ok_text(s) struct s_text *s;
  3927. {
  3928.         struct pixfont          *f;
  3929.  
  3930.         if    (FALSE == my_isint(panel_get(pt[11],PANEL_VALUE,0)))
  3931.         {bad_data("Color is not an integer, request ignored.");
  3932.          return(FALSE);
  3933.         }
  3934.         else if    (atoi(panel_get(pt[11],PANEL_VALUE,0)) < 0 ||
  3935.          atoi(panel_get(pt[11],PANEL_VALUE,0)) > 255)
  3936.         {bad_data("Color < 0 or > 255, request ignored.");
  3937.          return(FALSE);
  3938.         }
  3939.         else if    (FALSE == my_isint(panel_get(pt[12],PANEL_VALUE,0)))
  3940.         {bad_data("X-origin not integer, request ignored.");
  3941.          return(FALSE);
  3942.         }
  3943.         else if    (FALSE == my_isint(panel_get(pt[13],PANEL_VALUE,0)))
  3944.         {bad_data("Y-origin not integer, request ignored.");
  3945.          return(FALSE);
  3946.         }
  3947.     else;
  3948.         strcpy(txt,panel_get(pt[15],PANEL_VALUE,0));
  3949.         strcat(txt,"/");
  3950.         strcat(txt,panel_get(pt[16],PANEL_VALUE,0));
  3951.         if    (NULL == (f = pf_open(txt)))
  3952.         {bad_data("Cannot open the font file, request ignored.");
  3953.          return(FALSE);
  3954.         }
  3955.     else
  3956.         {pf_close(f);
  3957.          s->color = atoi(panel_get(pt[11],PANEL_VALUE,0));
  3958.          s->xpos = atoi(panel_get(pt[12],PANEL_VALUE,0));
  3959.          s->ypos = atoi(panel_get(pt[13],PANEL_VALUE,0));
  3960.          strcpy(s->body,panel_get(pt[14],PANEL_VALUE,0));
  3961.          strcpy(s->prefont,panel_get(pt[15],PANEL_VALUE,0));
  3962.          strcpy(s->postfont,panel_get(pt[16],PANEL_VALUE,0));
  3963.          return(TRUE);
  3964.         }
  3965. }
  3966. /* EOF */
  3967. /* cat > src+obj/ok_vector.c << "EOF" */
  3968. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3969. /* ok_vector: is the structure ok for the displayed    */
  3970. /*          vector?                    */
  3971. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  3972. /* SCCS information: %W%    %G% - NCSA */
  3973.  
  3974. /* #include "all.h" */
  3975. /* #include "newext.h" */
  3976.  
  3977. int
  3978. ok_vector (s, n)
  3979.     struct s_vector *s;
  3980.     int             n;
  3981.         /* input: sequence number of x-image in HDF file.
  3982.               y-image follows x-image if same HDF file
  3983.               or sequence number if different HDF file */
  3984. {
  3985.     int             i;
  3986.     int             xv, yv, *pxv, *pyv, nxv, nyv, filetype;
  3987.     char           *xs, *ys;
  3988.     char           *fxs, *fys;
  3989.     char            tmpfnx[MAXNAMELEN + 1];
  3990.     char            tmpfny[MAXNAMELEN + 1];
  3991.  
  3992.     if (FALSE == my_isint (panel_get (pt[41], PANEL_VALUE, 0)))
  3993.     {
  3994.         bad_data ("X-points not integer, request ignored.");
  3995.         return (FALSE);
  3996.     }
  3997.     else if (atoi (panel_get (pt[41], PANEL_VALUE, 0)) < 0)
  3998.     {
  3999.         bad_data ("X-points < 0,request ignored.");
  4000.         return (FALSE);
  4001.     }
  4002.     else if (FALSE == my_isint (panel_get (pt[42], PANEL_VALUE, 0)))
  4003.     {
  4004.         bad_data ("Y-points not integer, request ignored.");
  4005.         return (FALSE);
  4006.     }
  4007.     else if (atoi (panel_get (pt[42], PANEL_VALUE, 0)) < 0)
  4008.     {
  4009.         bad_data ("Y-points < 0,request ignored.");
  4010.         return (FALSE);
  4011.     }
  4012.     else if (FALSE == my_isint (panel_get (pt[43], PANEL_VALUE, 0)))
  4013.     {
  4014.         bad_data ("X-origin not integer, request ignored.");
  4015.         return (FALSE);
  4016.     }
  4017.     else if (FALSE == my_isint (panel_get (pt[44], PANEL_VALUE, 0)))
  4018.     {
  4019.         bad_data ("Y-origin not integer, request ignored.");
  4020.         return (FALSE);
  4021.     }
  4022.     else if (FALSE == my_isint (panel_get (pt[55], PANEL_VALUE, 0)))
  4023.     {
  4024.         bad_data ("Max vector length not integer, request ignored.");
  4025.         return (FALSE);
  4026.     }
  4027.     else if (atoi (panel_get (pt[55], PANEL_VALUE, 0)) < 0)
  4028.     {
  4029.         bad_data ("Max vector length < 0, request ignored.");
  4030.         return (FALSE);
  4031.     }
  4032.     else if (FALSE == my_isint (panel_get (pt[54], PANEL_VALUE, 0)))
  4033.     {
  4034.         bad_data ("Vector color not integer, request ignored.");
  4035.         return (FALSE);
  4036.     }
  4037.     else if (atoi (panel_get (pt[54], PANEL_VALUE, 0)) < 0 ||
  4038.          atoi (panel_get (pt[54], PANEL_VALUE, 0)) > 255)
  4039.     {
  4040.         bad_data ("Vector color not >=0 and <= 255, request ignored.");
  4041.         return (FALSE);
  4042.     }
  4043.     else if (FALSE == my_isint (panel_get (pt[48], PANEL_VALUE, 0)))
  4044.     {
  4045.         bad_data ("X-start not integer, request ignored.");
  4046.         return (FALSE);
  4047.     }
  4048.     else if (FALSE == my_isint (panel_get (pt[49], PANEL_VALUE, 0)))
  4049.     {
  4050.         bad_data ("Y-start not integer, request ignored.");
  4051.         return (FALSE);
  4052.     }
  4053.     else if (FALSE == my_isint (panel_get (pt[50], PANEL_VALUE, 0)))
  4054.     {
  4055.         bad_data ("X-end not integer, request ignored.");
  4056.         return (FALSE);
  4057.     }
  4058.     else if (FALSE == my_isint (panel_get (pt[51], PANEL_VALUE, 0)))
  4059.     {
  4060.         bad_data ("Y-end not integer, request ignored.");
  4061.         return (FALSE);
  4062.     }
  4063.     else if (FALSE == my_isint (panel_get (pt[52], PANEL_VALUE, 0)))
  4064.     {
  4065.         bad_data ("X-interval not integer, request ignored.");
  4066.         return (FALSE);
  4067.     }
  4068.     else if (FALSE == my_isint (panel_get (pt[53], PANEL_VALUE, 0)))
  4069.     {
  4070.         bad_data ("Y-interval not integer, request ignored.");
  4071.         return (FALSE);
  4072.     }
  4073.     else if (FALSE == my_isint (panel_get (pt[45], PANEL_VALUE, 0)))
  4074.     {
  4075.         bad_data ("X-color=0 not integer, request ignored.");
  4076.         return (FALSE);
  4077.     }
  4078.     else if (atoi (panel_get (pt[45], PANEL_VALUE, 0)) < 0 ||
  4079.          atoi (panel_get (pt[45], PANEL_VALUE, 0)) > 255)
  4080.     {
  4081.         bad_data ("X-color=0 not >= 0 and <= 255, request ignored.");
  4082.         return (FALSE);
  4083.     }
  4084.     else if (FALSE == my_isint (panel_get (pt[46], PANEL_VALUE, 0)))
  4085.     {
  4086.         bad_data ("Y-color=0 not integer, request ignored.");
  4087.         return (FALSE);
  4088.     }
  4089.     else if (atoi (panel_get (pt[46], PANEL_VALUE, 0)) < 0 ||
  4090.          atoi (panel_get (pt[46], PANEL_VALUE, 0)) > 255)
  4091.     {
  4092.         bad_data ("Y-color=0 not >= 0 and <= 255, request ignored.");
  4093.         return (FALSE);
  4094.     }
  4095.     else if (FALSE == my_isfloat (panel_get (pt[47], PANEL_VALUE, 0)))
  4096.     {
  4097.         bad_data ("X-scale is not floating point, request ignored.");
  4098.         return (FALSE);
  4099.     }
  4100.     else if (FALSE == my_isfloat (panel_get (pt[56], PANEL_VALUE, 0)))
  4101.     {
  4102.         bad_data ("Y-scale is not floating point, request ignored.");
  4103.         return (FALSE);
  4104.     }
  4105.     else
  4106.     {
  4107.         pxv = (xstrlen ((xs = panel_get (pt[41], PANEL_VALUE, 0))) == 0) ? NULL : &xv;
  4108.         if (pxv != NULL)
  4109.             xv = atoi (xs);
  4110.         pyv = (xstrlen ((ys = panel_get (pt[42], PANEL_VALUE, 0))) == 0) ? NULL : &yv;
  4111.         if (pyv != NULL)
  4112.             yv = atoi (ys);
  4113.         strcpy (tmpfnx, panel_get (pt[39], PANEL_VALUE, 0));
  4114.         if (xstrlen (tmpfnx) == 0)    /* no file */
  4115.         {
  4116.             bad_data ("No vector x-image file given, request ignored.");
  4117.             return (FALSE);
  4118.         }
  4119.         else
  4120.         {
  4121.             (void) strip_wspace (tmpfnx);
  4122.             i = check_image (tmpfnx, pxv, pyv, &nxv, &nyv, n, &filetype);
  4123.         }
  4124.         if (i == 1)
  4125.         {
  4126.             bad_data ("Cannot open vector x-image file, request ignored.");
  4127.             return (FALSE);
  4128.         }
  4129.         else if (i == 2)
  4130.         {
  4131.             if (pxv == NULL && pyv != NULL)
  4132.             {
  4133.                 bad_data ("No X points given - not HDF file, request ignored.");
  4134.                 return (FALSE);
  4135.             }
  4136.             else if (pxv != NULL && pyv == NULL)
  4137.             {
  4138.                 bad_data ("No Y points given - not HDF file, request ignored.");
  4139.                 return (FALSE);
  4140.             }
  4141.             else if (xv == 0)
  4142.             {
  4143.                 bad_data ("X-points < 1, request ignored.");
  4144.                 return (FALSE);
  4145.             }
  4146.             else if (yv == 0)
  4147.             {
  4148.                 bad_data ("Y-points < 1, request ignored.");
  4149.                 return (FALSE);
  4150.             }
  4151.             else
  4152.             {
  4153.                 bad_data ("X-pts*Y-pts != vector x-image filesize, request ignored.");
  4154.                 return (FALSE);
  4155.             }
  4156.         }
  4157.         else if (i == 3)
  4158.         {
  4159.             bad_data ("Not enough images in HDF file for vector x-image, request ignored");
  4160.             return (FALSE);
  4161.         }
  4162.         else if (i < 0)    /* HDF error */
  4163.         {
  4164.             sprintf (msg, "HDF file error (DFerror = %d) for vector x-image, request ignored.", i);
  4165.             bad_data (msg);
  4166.             return (FALSE);
  4167.         }
  4168.         if (i == 4)
  4169.         {
  4170. /*
  4171.             info_msg ("          ----- INFORMATION MESSAGE -----",
  4172.                   "HDF file vector x-image dimensions used",
  4173.                   "          ----- INFORMATION MESSAGE -----");
  4174. */
  4175.             sprintf (msg, "%d", nxv);
  4176.             panel_set_value (pt[41], msg);
  4177.             sprintf (msg, "%d", nyv);
  4178.             panel_set_value (pt[42], msg);
  4179.             xv = nxv;
  4180.             yv = nyv;
  4181.             i = 0;
  4182.         }
  4183. /*
  4184.         pxv = (xstrlen((xs = panel_get (pt[41], PANEL_VALUE, 0))) == 0) ? NULL : &xv;
  4185.         if (pxv != NULL)
  4186.             xv = atoi (xs);
  4187. */
  4188.         xv = atoi (panel_get (pt[41], PANEL_VALUE, 0));
  4189. /*
  4190.         pyv = (xstrlen((ys = panel_get (pt[42], PANEL_VALUE, 0))) == 0) ? NULL : &yv;
  4191.         if (pyv != NULL)
  4192.             yv = atoi (ys);
  4193. */
  4194.         yv = atoi (panel_get (pt[42], PANEL_VALUE, 0));
  4195.         strcpy (tmpfny, panel_get (pt[40], PANEL_VALUE, 0));
  4196.         if (xstrlen (tmpfny) == 0)    /* no y-image filename give */
  4197.         {
  4198.             if (filetype == 0)    /* not HDF file */
  4199.             {
  4200.                 bad_data ("No vector y-image file given (vector x-image not HDF file), request ignored.");
  4201.                 return (FALSE);
  4202.             }
  4203.             else    /* HDF file */
  4204.                 i = check_image (tmpfnx, &xv, &yv, &nxv, &nyv, n + 1, &filetype);
  4205.         }
  4206.         else
  4207.         {
  4208.             (void) strip_wspace (tmpfny);
  4209.             i = check_image (tmpfny, &xv, &yv, &nxv, &nyv, (!xstrcmp (tmpfnx, tmpfny)) ? n + 1 : n, &filetype);
  4210.         }
  4211.         if (i == 1)
  4212.         {
  4213.             bad_data ("Cannot open vector y-image file, request ignored.");
  4214.             return (FALSE);
  4215.         }
  4216.         else if (i == 2)
  4217.         {
  4218.             bad_data ("X-pts*Y-pts != vector y-image filesize, request ignored.");
  4219.             return (FALSE);
  4220.         }
  4221.         else if (i == 3)
  4222.         {
  4223.             bad_data ("Not enough images in HDF file for vector y-image, request ignored");
  4224.             return (FALSE);
  4225.         }
  4226.         else if (i < 0)    /* HDF error */
  4227.         {
  4228.             sprintf (msg, "HDF file error (DFerror = %d) for vector y-image, request ignored.", i);
  4229.             bad_data (msg);
  4230.             return (FALSE);
  4231.         }
  4232.         if (i == 4)
  4233.         {
  4234.             sprintf (msg, "x-image(x=%d,y=%d), y-image(x=%d,y=%d)", xv, yv, nxv, nyv);
  4235.             bad_data2 ("Vector x-image different size than vector y-image, request ignored.", msg);
  4236.             return (FALSE);
  4237.         }
  4238.         if (i == 0)
  4239.         {
  4240.             float           f;
  4241.  
  4242.             panel_set (pt[39], PANEL_VALUE, tmpfnx, 0);
  4243.             strcpy (s->xname, tmpfnx);
  4244.             if (xstrlen (tmpfny) == 0)
  4245.             {
  4246.                 panel_set (pt[40], PANEL_VALUE, tmpfnx, 0);
  4247.                 strcpy (s->yname, tmpfnx);
  4248.             }
  4249.             else
  4250.             {
  4251.                 panel_set (pt[40], PANEL_VALUE, tmpfny, 0);
  4252.                 strcpy (s->yname, tmpfny);
  4253.             }
  4254.             s->xpts = xv;
  4255.             s->ypts = yv;
  4256.             s->xpos = atoi (panel_get (pt[43], PANEL_VALUE, 0));
  4257.             s->ypos = atoi (panel_get (pt[44], PANEL_VALUE, 0));
  4258.             s->maxlen = atoi (panel_get (pt[55], PANEL_VALUE, 0));
  4259.             s->color = atoi (panel_get (pt[54], PANEL_VALUE, 0));
  4260.             s->xend = atoi (panel_get (pt[50], PANEL_VALUE, 0));
  4261.             s->xstart = atoi (panel_get (pt[48], PANEL_VALUE, 0));
  4262.             s->ystart = atoi (panel_get (pt[49], PANEL_VALUE, 0));
  4263.             s->yend = atoi (panel_get (pt[51], PANEL_VALUE, 0));
  4264.             s->xinterval = atoi (panel_get (pt[52], PANEL_VALUE, 0));
  4265.             s->yinterval = atoi (panel_get (pt[53], PANEL_VALUE, 0));
  4266.             s->xzero = atoi (panel_get (pt[45], PANEL_VALUE, 0));
  4267.             s->yzero = atoi (panel_get (pt[46], PANEL_VALUE, 0));
  4268.             sscanf (panel_get (pt[47], PANEL_VALUE, 0), "%f", &f);
  4269.             s->xscale = f;
  4270.             sscanf (panel_get (pt[56], PANEL_VALUE, 0), "%f", &f);
  4271.             s->yscale = f;
  4272.             return (TRUE);
  4273.         }
  4274.         else
  4275.         {
  4276.             bad_data ("This ok_vector error is not possible.");
  4277.             return (FALSE);
  4278.         }
  4279.     }
  4280. }
  4281. /* EOF */
  4282. /* cat > src+obj/p0.c << "EOF" */
  4283. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4284. /* p0: p0 button - show the canvas            */
  4285. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4286. /* SCCS information: %W%    %G% - NCSA */
  4287.  
  4288. /* #include "all.h" */
  4289.  
  4290. int    p0()
  4291. {
  4292.         window_set(    c_frame,WIN_SHOW,TRUE,0);
  4293.         window_set(    canvas,WIN_SHOW,TRUE,0);
  4294.         pw_rop(        cpw,0,0,
  4295.                         window_get(canvas,WIN_WIDTH,0),
  4296.                         window_get(canvas,WIN_HEIGHT,0),
  4297.                         PIX_SRC | ((clear_color) << 5),NULL,0,0);
  4298.         panel_set(      pb[0],PANEL_SHOW_ITEM,FALSE,0);
  4299.     info_msg("","Canvas brought up.","");
  4300.     return;
  4301. }
  4302. /* EOF */
  4303. /* cat > src+obj/p1.c << "EOF" */
  4304. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4305. /* p1: p1 button - execute FinalPic            */
  4306. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4307. /* SCCS information: %W%    %G% - NCSA */
  4308.  
  4309. /* #include "all.h" */
  4310.  
  4311. int    p1()
  4312. {
  4313.     int        z = 0;
  4314.         register int    i;
  4315.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  4316.       {info_msg("","Canvas is not up, request ignored.","");
  4317.         return;
  4318.       }
  4319.         pw_rop(cpw,0,0,N_hpix,N_vpix,
  4320.                PIX_SRC | ((clear_color) << 5),NULL,0,0);
  4321.         for (i=0; i<N_image; i++)
  4322.             if  (TRUE == image[i].sw)
  4323.         {draw_image(&image[i], 1);
  4324.          if (0 != draw_feature(&feat[i],i,TRUE)) z = 1;
  4325.         }
  4326.         for (i=0; i<N_contour; i++)
  4327.             if  (TRUE == con[i].sw)
  4328.         {draw_contour(&con[i], 1);
  4329.          if (0 != draw_feature(&feat[i + N_image],
  4330.                          i + N_image,TRUE)) z = 2;
  4331.         }
  4332.         for (i=0; i<N_vector; i++)
  4333.             if  (TRUE == vec[i].sw)
  4334.         {draw_vector(FALSE,&vec[i], 1);
  4335.          if (0 != draw_feature(&feat[i + N_image + N_contour],
  4336.                          i + N_image + N_contour,TRUE)) z = 3;
  4337.         }
  4338.         if      (TRUE == cbar.sw)       draw_colorbar(  &cbar);
  4339.         for (i=0; i<N_text; i++)
  4340.             if  (TRUE == text[i].sw)    draw_text(      &text[i]);
  4341.         if      (TRUE == grid.sw)       draw_grid(      &grid);
  4342.     if (z == 0)
  4343.        info_msg("","FinalPic completed.","");
  4344.     else
  4345.        bad_data("Problem in FinalPic execution.");
  4346.         return;
  4347. }
  4348. /* EOF */
  4349. /* cat > src+obj/p2.c << "EOF" */
  4350. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4351. /* p2: p2 button - execute Clear            */
  4352. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4353. /* SCCS information: %W%    %G% - NCSA */
  4354.  
  4355. /* #include "all.h" */
  4356.  
  4357. int    p2()
  4358. {
  4359.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  4360.       {info_msg("","Canvas is not up, request ignored.","");
  4361.         return;
  4362.       }
  4363.         pw_rop(cpw,0,0,N_hpix,N_vpix,
  4364.                    PIX_SRC | ((clear_color) << 5),NULL,0,0);
  4365.     info_msg("","Canvas cleared.","");
  4366.         return;
  4367. }
  4368. /* EOF */
  4369. /* cat > src+obj/p3.c << "EOF" */
  4370. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4371. /* p3: p3 button - create palette frame            */
  4372. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4373. /* SCCS information: %W%    %G% - NCSA */
  4374.  
  4375. /* #include "all.h" */
  4376. /* #include "newext.h" */
  4377.  
  4378. int    p3()
  4379. {
  4380.         char        s[8];
  4381.     register int    y;
  4382.  
  4383.         panel_set(              pb[3],PANEL_SHOW_ITEM,FALSE,0);
  4384.     y = (int)window_get(fr[0],WIN_Y,0);
  4385.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 75)
  4386.        y = 0;
  4387.     else
  4388.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4389.         make_fr( 1,
  4390.          10,y,
  4391.          75,600,
  4392.         "CompositeTool 1.1 Palette (tag 'p')"
  4393.            );
  4394.     pa[1] = make_p (fr[1]);
  4395. /*
  4396.         pa[1] = window_create(  fr[1],PANEL,0);
  4397. */
  4398.     window_set(pa[1],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4399.     window_set(pa[1],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4400.         make_pb(    13,10, 5,1,7,"Done");
  4401.         make_pb(        14,90, 5,1,2," ");
  4402.         make_pt(        0,120,10,1,79,43,"Load palette:");
  4403.         make_pb(        15,90,27,1,2," ");
  4404.         make_pt(        1,120,32,1, 3,3,"Load background color:");
  4405.         panel_set(        pt[0],PANEL_VALUE,pfn,0);
  4406.         if (clear_color == 0)
  4407.        panel_set(        pt[1],PANEL_VALUE,"",0);
  4408.         else
  4409.        {my_itoa(clear_color,s);
  4410.         panel_set(        pt[1],PANEL_VALUE,s,0);
  4411.        }
  4412.         window_set(        fr[1],WIN_SHOW,TRUE,0);
  4413.     info_msg("","Palette frame brought up.","");
  4414.         return;
  4415. }
  4416. /* EOF */
  4417. /* cat > src+obj/p4.c << "EOF" */
  4418. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4419. /* p4: p4 button - create grid frame            */
  4420. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4421. /* SCCS information: %W%    %G% - NCSA */
  4422.  
  4423. /* #include "all.h" */
  4424. /* #include "newext.h" */
  4425.  
  4426. int    p4()
  4427. {
  4428.     register int    y;
  4429.  
  4430.         panel_set(      pb[4],PANEL_SHOW_ITEM,FALSE,0);
  4431.     y = (int)window_get(fr[0],WIN_Y,0);
  4432.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 150)
  4433.        y = 0;
  4434.     else
  4435.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4436.         make_fr( 2,
  4437.          20,y,
  4438.          150,375,
  4439.         "CompositeTool 1.1 Grid (tag 'g')"
  4440.            );
  4441.     pa[2] = make_p (fr[2]);
  4442. /*
  4443.         pa[2] = window_create(  fr[2],PANEL,
  4444.                 WIN_FONT, font_panel, 0);
  4445. */
  4446.     window_set(pa[2],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4447.     window_set(pa[2],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4448.         make_pb(    16, 10, 5,2,7,"Done");
  4449.     if (0 == grid.sw)
  4450.        make_pb(        17, 10,52,2,21,"FinalPic toggle (OFF)");
  4451.     else
  4452.        make_pb(        17, 10,52,2,21,"FinalPic toggle (ON) ");
  4453.         make_pb(        18, 10,77,2,24," STORE  displayed values");
  4454.         make_pb(        19, 10,99,2,24,"DISCARD displayed values");
  4455.         make_pb(        20,220,77,2,8," DRAW it");
  4456.         make_pb(        21,220,99,2,8,"ERASE it");
  4457.         make_pt(         2,220,10,2,3,3,"     Color:");
  4458.         make_pt(         3,220,32,2,4,4,"Pix/x-grid:");
  4459.         make_pt(         4,220,54,2,4,4,"Pix/y-grid:");
  4460.         p19();
  4461.         window_set(     fr[2],WIN_SHOW,TRUE,0);
  4462.         return;  
  4463. }
  4464. /* EOF */
  4465. /* cat > src+obj/p5.c << "EOF" */
  4466. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4467. /* p5: p5 button - create colorbar frame        */
  4468. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4469. /* SCCS information: %W%    %G% - NCSA */
  4470.  
  4471. /* #include "all.h" */
  4472. /* #include "newext.h" */
  4473.  
  4474. int    p5()
  4475. {
  4476.     register int    y;
  4477.  
  4478.         panel_set(      pb[5],PANEL_SHOW_ITEM,FALSE,0);
  4479.     y = (int)window_get(fr[0],WIN_Y,0);
  4480.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 192)
  4481.        y = 0;
  4482.     else
  4483.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4484.         make_fr( 3,
  4485.          30,y,
  4486.          /* 192,395, */
  4487.          192, 415,
  4488.         "CompositeTool 1.1 ColorBar (tag 'b')"
  4489.            );
  4490.     pa[3] = make_p (fr[3]);
  4491. /*
  4492.         pa[3] = window_create(    fr[3],PANEL,0);
  4493. */
  4494.     window_set(pa[3],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4495.     window_set(pa[3],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4496.         make_pb(    22, 10,  5,3,7,"Done");
  4497.     if (0 == cbar.sw)
  4498.             make_pb(23, 10, 52,3,21,"FinalPic toggle (OFF)");
  4499.     else
  4500.             make_pb(23, 10, 52,3,21,"FinalPic toggle (ON) ");
  4501.         make_pb(        24, 10, 74,3,24," STORE  displayed values");
  4502.         make_pb(        25, 10, 96,3,24,"DISCARD displayed values");
  4503.         make_pb(        26, 10,118,3, 8," DRAW it");
  4504.         make_pb(        27, 10,140,3, 8,"ERASE it");
  4505.     make_pb(    28,100,118,3, 8,"ms draw");
  4506.     panel_set(    pb[28],PANEL_SHOW_ITEM,FALSE,0);
  4507.     make_pb(    84,100,129,3, 9,"mouse mv");
  4508.         make_pb(        29, 90, 16,3, 2," ");
  4509.         make_pt(        5,120, 21,3,3,3,"Show color:");
  4510.         make_pt(        6,250, 54,3,4,4,"X-points:");
  4511.         make_pt(        7,250, 76,3,4,4,"Y-points:");
  4512.         make_pt(        8,250, 98,3,4,4,"X-origin:");
  4513.         make_pt(        9,250,120,3,4,4,"Y-origin:");
  4514.         p25();
  4515.         window_set(     fr[3],WIN_SHOW,TRUE,0);
  4516.         return;
  4517. }
  4518. /* EOF */
  4519. /* cat > src+obj/p6.c << "EOF" */
  4520. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4521. /* p6: p6 button - create text frame            */
  4522. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4523. /* SCCS information: %W%    %G% - NCSA */
  4524.  
  4525. /* #include "all.h" */
  4526. /* #include "newext.h" */
  4527.  
  4528. int    p6()
  4529. {
  4530.     register int    y;
  4531.  
  4532.         panel_set(      pb[6],PANEL_SHOW_ITEM,FALSE,0);
  4533.     y = (int)window_get(fr[0],WIN_Y,0);
  4534.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 250)
  4535.        y = 0;
  4536.     else
  4537.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4538.         make_fr( 4,
  4539.          40,y,
  4540.          250,460,
  4541.         "CompositeTool 1.1 Text (tag 't0')"
  4542.            );
  4543.     pa[4] = make_p (fr[4]);
  4544. /*
  4545.         pa[4] = window_create(  fr[4],PANEL,0);
  4546. */
  4547.     window_set(pa[4],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4548.     window_set(pa[4],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4549.         make_pb(        30, 10,  5,4,7,"Done");
  4550.     if (0 == text[0].sw)
  4551.            make_pb(    31, 10, 52,4,21,"FinalPic toggle (OFF)");
  4552.     else
  4553.            make_pb(     31, 10, 52,4,21,"FinalPic toggle (ON) ");
  4554.         make_pb(        32, 10, 74,4,24," STORE  displayed values");
  4555.         make_pb(        33, 10, 96,4,24,"DISCARD displayed values");
  4556.         make_pmnn(          90, 10,4,"Tag Selector");
  4557.         make_pb(        36, 90, 27,4,2," ");
  4558.         make_pt(        10,120, 32,4,3,3,"Copy data from text tag:");
  4559.         make_pb(        37,190,  5,4,2,"-5");
  4560.         make_pb(        38,224,  5,4,1,"-");
  4561.         make_pb(        39,248,  5,4,1,"+");
  4562.         make_pb(        40,270,  5,4,2,"+5");
  4563.         make_pt(        11,228, 52,4, 3,3,"   Color:");
  4564.         make_pt(        12,228, 74,4, 4,4,"X-origin:");
  4565.         make_pt(        13,228, 96,4, 4,4,"Y-origin:");
  4566.     make_pt(        14, 10,162,4,79,40,"Text Body:");
  4567.         make_pt(        15, 10,184,4,59,30,"Font directory:");
  4568.         make_pt(        16, 10,206,4,19,19,"Font:");
  4569.         make_pb(        34, 10,118,4, 8," DRAW it");
  4570.         make_pb(        35, 10,140,4, 8,"ERASE it");
  4571.         make_pb(        82,100,118,4, 8,"ms draw");
  4572.     panel_set(    pb[82],PANEL_SHOW_ITEM,FALSE,0);
  4573.         make_pb(        83,100,129,4, 9,"mouse mv");
  4574.         nt      = 0;
  4575.         window_set(             fr[4],WIN_SHOW,TRUE,0);
  4576.         p33();
  4577.     return;
  4578. }
  4579. /* EOF */
  4580. /* cat > src+obj/p7.c << "EOF" */
  4581. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4582. /* p7: p7 button - create image frame            */
  4583. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4584. /* SCCS information: %W%    %G% - NCSA */
  4585.  
  4586. /* #include "all.h" */
  4587. /* #include "newext.h" */
  4588.  
  4589. int    p7()
  4590. {
  4591.     register int    y;
  4592.  
  4593.         panel_set(      pb[7],PANEL_SHOW_ITEM,FALSE,0);
  4594.     y = (int)window_get(fr[0],WIN_Y,0);
  4595.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 210)
  4596.        y = 0;
  4597.     else
  4598.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4599.         make_fr( 6,
  4600.          70,y,
  4601.          210,425,
  4602.         "CompositeTool 1.1 Image (tag 'i0')"
  4603.            );
  4604.     pa[6] = make_p (fr[6]);
  4605. /*
  4606.         pa[6] = window_create(  fr[6],PANEL,0);
  4607. */
  4608.     window_set(pa[6],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4609.     window_set(pa[6],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4610.         make_pb(        46, 10,  5,6,7,"Done");
  4611.     if (0 == image[0].sw)
  4612.            make_pb(    47, 10, 52,6,21,"FinalPic toggle (OFF)");
  4613.     else
  4614.            make_pb(     47, 10, 52,6,21,"FinalPic toggle (ON) ");
  4615.         make_pb(        48, 10, 74,6,24," STORE  displayed values");
  4616.         make_pb(        49, 10, 96,6,24,"DISCARD displayed values");
  4617.         make_pmnn(          90, 10,6,"Tag Selector");
  4618.         make_pb(        53, 90, 27,6,2," ");
  4619.         make_pt(        22,120, 32,6,3,3,"Copy data from image tag:");
  4620.         make_pb(        54,190,  5,6,2,"-5");
  4621.         make_pb(        55,224,  5,6,1,"-");
  4622.         make_pb(        56,248,  5,6,1,"+");
  4623.         make_pb(        57,270,  5,6,2,"+5");
  4624.     make_pt(        27, 10,162,6,79,43,"File:");
  4625.         make_pb(        50, 10,118,6,8," DRAW it");
  4626.         make_pb(        51, 10,140,6,8,"ERASE it");
  4627.         make_pb(        52,105,118,6,8,"ms draw");
  4628.     panel_set(    pb[52],PANEL_SHOW_ITEM,FALSE,0);
  4629.         make_pb(        85,105,129,6,9,"mouse mv");
  4630.         make_pt(        23,228, 52,6,4,4,"X-points:");
  4631.         make_pt(        24,228, 74,6,4,4,"Y-points:");
  4632.         make_pt(        25,228, 96,6,4,4,"X-origin:");
  4633.         make_pt(        26,228,118,6,4,4,"Y-origin:");
  4634.         ni      = 0;
  4635.         window_set(     fr[6],WIN_SHOW,TRUE,0);
  4636.         p49();
  4637.     return;
  4638. }
  4639. /* EOF */
  4640. /* cat > src+obj/p8.c << "EOF" */
  4641. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4642. /* p8: p8 button - create contour frame            */
  4643. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4644. /* SCCS information: %W%    %G% - NCSA */
  4645.  
  4646. /* #include "all.h" */
  4647. /* #include "newext.h" */
  4648.  
  4649. int    p8()
  4650. {
  4651.     register int    y;
  4652.  
  4653.         panel_set(      pb[8],PANEL_SHOW_ITEM,FALSE,0);
  4654.     y = (int)window_get(fr[0],WIN_Y,0);
  4655.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 210)
  4656.        y = 0;
  4657.     else
  4658.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4659.         make_fr( 7,
  4660.         110,y,
  4661.          210,550,
  4662.         "CompositeTool 1.1 Contour (tag 'c0')"
  4663.            );
  4664.     pa[7] = make_p (fr[7]);
  4665. /*
  4666.         pa[7] = window_create(  fr[7],PANEL,0);
  4667. */
  4668.     window_set(pa[7],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4669.     window_set(pa[7],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4670.         make_pb(        58, 10,  5,7,7,"Done");
  4671.     if (0 == con[0].sw)
  4672.            make_pb(    59, 10, 52,7,21,"FinalPic toggle (OFF)");
  4673.     else
  4674.            make_pb(     59, 10, 52,7,21,"FinalPic toggle (ON) ");
  4675.         make_pb(        60, 10, 74,7,24," STORE  displayed values");
  4676.         make_pb(        61, 10, 96,7,24,"DISCARD displayed values");
  4677.         make_pmnn(          90, 10,7,"Tag Selector");
  4678.         make_pb(        65, 90, 27,7,2," ");
  4679.         make_pt(        28,120, 32,7,3,3,"Copy data from contour tag:");
  4680.         make_pb(        66,190,  5,7,2,"-5");
  4681.         make_pb(        67,224,  5,7,1,"-");
  4682.         make_pb(        68,248,  5,7,1,"+");
  4683.         make_pb(        69,270,  5,7,2,"+5");
  4684.     make_pt(        29, 10,162,7,79,50,"File:");
  4685.         make_pb(        62, 10,118,7,8," DRAW it");
  4686.         make_pb(        63, 10,140,7,8,"ERASE it");
  4687.         make_pb(        64,100,118,7,8,"ms draw");
  4688.     panel_set(    pb[64],PANEL_SHOW_ITEM,FALSE,0);
  4689.         make_pb(        86,100,129,7,9,"mouse mv");
  4690.         make_pt(        30,228, 52,7,4,4,"X-points:");
  4691.         make_pt(        31,228, 74,7,4,4,"Y-points:");
  4692.         make_pt(        32,228, 96,7,4,4,"X-origin:");
  4693.         make_pt(        33,228,118,7,4,4,"Y-origin:");
  4694.         make_pt(        34,228,140,7,3,3,"   Color:");
  4695.         make_pmnn(         390, 32,7,"Contour levels");
  4696.         make_pt(        35,390, 54,7,4,4,"Start color:");
  4697.         make_pt(        36,390, 76,7,4,4,"  End color:");
  4698.         make_pt(        37,390, 98,7,4,4,"   Interval:");
  4699.         nc      = 0;
  4700.         window_set(    fr[7],WIN_SHOW,TRUE,0);
  4701.         p61();
  4702.     return;
  4703. }
  4704. /* EOF */
  4705. /* cat > src+obj/p9.c << "EOF" */
  4706. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4707. /* p9: p9 button - create vector frame            */
  4708. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4709. /* SCCS information: %W%    %G% - NCSA */
  4710.  
  4711. /* #include "all.h" */
  4712. /* #include "newext.h" */
  4713.  
  4714. int    p9()
  4715. {
  4716.     register int    y;
  4717.  
  4718.         panel_set(      pb[9],PANEL_SHOW_ITEM,FALSE,0);
  4719.     y = (int)window_get(fr[0],WIN_Y,0);
  4720.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 230)
  4721.        y = 0;
  4722.     else
  4723.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4724.         make_fr( 8,
  4725.          90,y,
  4726.          /* 230,750, */
  4727.          240, 750,
  4728.         "CompositeTool 1.1 Vector (tag 'v0')"
  4729.            );
  4730.  
  4731.     pa[8] = make_p (fr[8]);
  4732. /*
  4733.         pa[8] = window_create(  fr[8],PANEL,0);
  4734. */
  4735.     window_set(pa[8],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4736.     window_set(pa[8],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4737.         make_pb(        70, 10,  5,8,7,"Done");
  4738.     if (0 == vec[0].sw)
  4739.            make_pb(    71, 10, 52,8,21,"FinalPic toggle (OFF)");
  4740.     else
  4741.            make_pb(     71, 10, 52,8,21,"FinalPic toggle (ON) ");
  4742.         make_pb(        72, 10, 74,8,24," STORE  displayed values");
  4743.         make_pb(        73, 10, 96,8,24,"DISCARD displayed values");
  4744.         make_pmnn(          90, 10,8,"Tag Selector");
  4745.         make_pb(        77, 90, 27,8,2," ");
  4746.         make_pt(        38,120, 32,8,3,3,"Copy data from vector tag:");
  4747.         make_pb(        78,190,  5,8,2,"-5");
  4748.         make_pb(        79,224,  5,8,1,"-");
  4749.         make_pb(        80,248,  5,8,1,"+");
  4750.         make_pb(        81,270,  5,8,2,"+5");
  4751.     make_pt(        39, 10,169,8,79,60,"X-file:");
  4752.     make_pt(        40, 10,191,8,79,60,"Y-file:");
  4753.         make_pb(        74, 10,118,8,8," DRAW it");
  4754.         make_pb(        75, 10,140,8,8,"ERASE it");
  4755.         make_pb(        76,100,118,8,8,"ms draw");
  4756.     panel_set(    pb[76],PANEL_SHOW_ITEM,FALSE,0);
  4757.         make_pb(        87,100,129,8,9,"mouse mv");
  4758.         make_pt(        41,228, 52,8,4,4,"X-points:");
  4759.         make_pt(        42,228, 74,8,4,4,"Y-points:");
  4760.         make_pt(        43,228, 96,8,4,4,"X-origin:");
  4761.         make_pt(        44,228,118,8,4,4,"Y-origin:");
  4762.         make_pmnn(         370, 10,8,"Color/Scale data");
  4763.         make_pt(        45,370, 32,8,3,3,"X color=0 value:");
  4764.         make_pt(        46,370, 54,8,3,3,"Y color=0 value:");
  4765.         make_pt(        47,370, 76,8,8,8,"        X scale:");
  4766.         make_pt(        56,370, 98,8,8,8,"        Y scale:");
  4767.         make_pt(        54,370,120,8,3,3,"    Vector color:");
  4768.         make_pt(        55,370,142,8,4,4,"Max length (pix):");
  4769.         make_pmnn(         600, 10,8,"Points on image");
  4770.         make_pt(        48,600, 32,8,4,4,"   X-start:");
  4771.         make_pt(        49,600, 54,8,4,4,"   Y-start:");
  4772.         make_pt(        50,600, 76,8,4,4,"     X-end:");
  4773.         make_pt(        51,600, 98,8,4,4,"     Y-end:");
  4774.         make_pt(        52,600,120,8,4,4,"X-interval:");
  4775.         make_pt(        53,600,142,8,4,4,"Y-interval:");
  4776.         nv      = 0;
  4777.         window_set(    fr[8],WIN_SHOW,TRUE,0);
  4778.         p73();
  4779.     return;
  4780. }
  4781. /* EOF */
  4782. /* cat > src+obj/p10.c << "EOF" */
  4783. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4784. /* p10: p10 button - create feature frame        */
  4785. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4786. /* SCCS information: %W%    %G% - NCSA */
  4787.  
  4788. /* #include "all.h" */
  4789. /* #include "newext.h" */
  4790.  
  4791. int    p10()
  4792. {
  4793.     register int    y;
  4794.  
  4795.         panel_set(      pb[10],PANEL_SHOW_ITEM,FALSE,0);
  4796.     y = (int)window_get(fr[0],WIN_Y,0);
  4797.     if (y > N_yscr - (int)window_get(fr[0],WIN_HEIGHT,0) - 195)
  4798.        y = 0;
  4799.     else
  4800.        y = (int)window_get(fr[0],WIN_HEIGHT,0);
  4801.         make_fr( 9,
  4802.          90,y,
  4803.          /* 206,700, */
  4804.          206, 710,
  4805.         "CompositeTool 1.1 Features (for tag 'i0')"
  4806.            );
  4807.     pa[9] = make_p (fr[9]);
  4808. /*
  4809.         pa[9] = window_create(  fr[9],PANEL,0);
  4810. */
  4811.     window_set(pa[9],WIN_IGNORE_PICK_EVENT,MS_MIDDLE,0);
  4812.     window_set(pa[9],WIN_IGNORE_PICK_EVENT,MS_RIGHT,0);
  4813.         make_pb(        88, 10,  5,9,7,"Done");
  4814.         make_pb(        89, 10, 32,9, 8," DRAW it");
  4815.         make_pb(        90, 10, 54,9, 8,"ERASE it");
  4816.         make_pb(       109,110,  5,9, 8,"Select");
  4817.         make_pt(        57,187, 10,9,3,3,"Image, Contour, or Vector tag:");
  4818.         make_pb(       113,110, 27,9, 8,"  Copy");
  4819.         make_pt(        58,187, 32,9,3,3,"features from another tag:");
  4820.         make_pb(       114,540,  5,9,12,"Features ON ");
  4821.         make_pb(       115,540, 27,9,12,"Features OFF");
  4822.         make_pb(        91,110, 54,9, 7,"x-axis");
  4823.         make_pb(        92,180, 54,9, 3,"off");
  4824.         make_pb(        93,110, 76,9, 7,"y-axis");
  4825.         make_pb(        94,180, 76,9, 3,"off");
  4826.         make_pb(        95,240, 54,9, 7,"x-grid");
  4827.         make_pb(        96,310, 54,9, 3,"off");
  4828.         make_pb(        97,240, 76,9, 7,"y-grid");
  4829.         make_pb(        98,310, 76,9, 3,"off");
  4830.         make_pb(        99,370, 54,9, 7,"x-tic1");
  4831.         make_pb(       100,440, 54,9, 3,"off");
  4832.         make_pb(       101,370, 76,9, 7,"y-tic1");
  4833.         make_pb(       102,440, 76,9, 3,"off");
  4834.         make_pb(       103,500, 54,9, 7,"x-tic2");
  4835.         make_pb(       104,570, 54,9, 3,"off");
  4836.         make_pb(       105,500, 76,9, 7,"y-tic2");
  4837.         make_pb(       106,570, 76,9, 3,"off");
  4838.     make_pm(     4, 10, 92,9,"X-AXIS");
  4839.     make_ps(     0, 10,114, 20,1, 10,9,"Thickness");
  4840.     make_ps(     1, 10,136,512,0,255,9,"Color");
  4841.     make_ps(     2,240,114,220,1,110,9,"Spacing (pix)");
  4842.     make_ps(     3, 10,158, 20,1, 10,9,"Length   ");
  4843.         make_pb(       107,240,114,9,14,"left side off");
  4844.         make_pb(       108,380,114,9,14,"right side off");
  4845.         make_pb(       111,240,158,9,14,"left side off");
  4846.         make_pb(       112,380,158,9,14,"right side off");
  4847.         make_pb(       110,540,158,9, 7,"now OUT");
  4848.     panel_set(    pt[57],PANEL_VALUE,"i0",0);
  4849.     p109();
  4850.         window_set(    fr[9],WIN_SHOW,TRUE,0);
  4851.     return;
  4852. }
  4853. /* EOF */
  4854. /* cat > src+obj/p11.c << "EOF" */
  4855. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4856. /* p11: p11 button - create fileutil frame        */
  4857. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4858. /* SCCS information: %W%    %G% - NCSA */
  4859.  
  4860. /* #include "all.h" */
  4861. /* #include "newext.h" */
  4862.  
  4863. int
  4864. p11 ()
  4865. {
  4866.     register int    y;
  4867.     int             xpos, ypos;
  4868.     char           *getwd ();
  4869.  
  4870.     panel_set (pb[11], PANEL_SHOW_ITEM, FALSE, 0);
  4871.     y = (int) window_get (fr[0], WIN_Y, 0);
  4872.     if (y > N_yscr - (int) window_get (fr[0], WIN_HEIGHT, 0) - 225)
  4873.         y = 0;
  4874.     else
  4875.         y = (int) window_get (fr[0], WIN_HEIGHT, 0);
  4876.     make_fr (5,
  4877.          100, y,
  4878.          262, 660,
  4879.          "CompositeTool 1.1 File Utility"
  4880.         );
  4881.     pa[5] = make_p (fr[5]);
  4882.  
  4883.     window_set (pa[5], WIN_IGNORE_PICK_EVENT, MS_MIDDLE, 0);
  4884.     window_set (pa[5], WIN_IGNORE_PICK_EVENT, MS_RIGHT, 0);
  4885.     make_pb (41, (xpos = 10), (ypos = 5), 5, 7, "Done");
  4886.     make_pt (17, (xpos = 10), (ypos += 25), 5, MAXNAMELEN, 50, "File:");
  4887.     make_pb (42, (xpos = 10), (ypos += 25), 5, 6, "WRITE");
  4888.     make_pmnn ((xpos = 75), (ypos), 5, "program settings to file.");
  4889.     make_pb (43, (xpos = 305), (ypos), 5, 6, "READ");
  4890.     make_pmnn ((xpos = 370), (ypos), 5, "program settings from file.");
  4891.  
  4892.     util_pb_saveall = panel_create_item (pa[5], PANEL_BUTTON,
  4893.                          PANEL_ITEM_X, (xpos = 10),
  4894.                          PANEL_ITEM_Y, (ypos += 25),
  4895.                          PANEL_LABEL_IMAGE,
  4896.                          panel_button_image (pa[5], "SAVE ALL", 9, font_panel_button),
  4897.                          PANEL_NOTIFY_PROC, util_proc_saveall,
  4898.                          0);
  4899.  
  4900.     strcpy (txt, "of screen to file.");
  4901.     make_pmnn ((xpos = 100), (ypos), 5, txt);
  4902.     make_pb (44, (xpos = 10), (ypos += 25), 5, 10, "SAVE PART");
  4903.     strcpy (txt, "of screen to file, based on start and end points below.");
  4904.     make_pmnn ((xpos = 100), (ypos), 5, txt);
  4905.  
  4906.     make_pt (18, (xpos = 100), (ypos += 25), 5, 4, 4, "X-pix start:");
  4907.     make_pt (20, (xpos = 260), (ypos), 5, 4, 4, "X-pix end:");
  4908.     make_pt (19, (xpos = 100), (ypos += 25), 5, 4, 4, "Y-pix start:");
  4909.     make_pt (21, (xpos = 260), (ypos), 5, 4, 4, "Y-pix end:");
  4910.     make_pb (45, (xpos = 100), (ypos += 25), 5, 7, "now OFF");
  4911.  
  4912.     strcpy (txt, "Load start and end points by mouse.");
  4913.     make_pmnn ((xpos = 175), (ypos), 5, txt);
  4914.     util_pc_save = panel_create_item (pa[5], PANEL_CYCLE,
  4915.                       PANEL_LABEL_X, (xpos = 10),
  4916.                       PANEL_LABEL_Y, (ypos +=25),
  4917.                       PANEL_CHOICE_STRINGS,
  4918.                       "Save palette and image as HDF 8-bit Raster Image Set",
  4919.                       "Save palette and compressed image as HDF 8-bit Raster Image Set",
  4920.                       "Save image only as raw raster", 0,
  4921.                       0);
  4922.     my_itoa (sdump.xstart, txt);
  4923.     panel_set (pt[18], PANEL_VALUE, txt, 0);
  4924.     my_itoa (sdump.ystart, txt);
  4925.     panel_set (pt[19], PANEL_VALUE, txt, 0);
  4926.     my_itoa (sdump.xend, txt);
  4927.     panel_set (pt[20], PANEL_VALUE, txt, 0);
  4928.     my_itoa (sdump.yend, txt);
  4929.     panel_set (pt[21], PANEL_VALUE, txt, 0);
  4930.     window_set (fr[5], WIN_SHOW, TRUE, 0);
  4931.     info_msg ("", "File Utility frame brought up.", "");
  4932.     return;
  4933. }
  4934. /* EOF */
  4935. /* cat > src+obj/p12.c << "EOF" */
  4936. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4937. /* p12: p12 button - quit comptool            */
  4938. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4939. /* SCCS information: %W%    %G% - NCSA */
  4940.  
  4941. /* #include "all.h" */
  4942. /* #include "newext.h" */
  4943.  
  4944. int 
  4945. p12 ()
  4946. {
  4947.     window_destroy (fr[0]);
  4948.     return;
  4949. }
  4950. /* EOF */
  4951. /* cat > src+obj/p13.c << "EOF" */
  4952. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4953. /* p13: p13 button - done with the palette frame    */
  4954. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4955. /* SCCS information: %W%    %G% - NCSA */
  4956.  
  4957. /* #include "all.h" */
  4958.  
  4959. int 
  4960. p13 ()
  4961. {
  4962.     if (1 == sw_palette || FALSE == confirm_palette ())
  4963.     {
  4964.         window_destroy (pa[1]);
  4965.         window_destroy (fr[1]);
  4966.         pa[1] = fr[1] = NULL;
  4967.         panel_set (pb[3], PANEL_SHOW_ITEM, TRUE, 0);
  4968.         info_msg ("", "Palette frame put away.", "");
  4969.         sw_palette = 0;
  4970.         return;
  4971.     }
  4972.     panel_set (pb[13], PANEL_LABEL_IMAGE,
  4973.            panel_button_image (pa[1], "CONFIRM", 7, NULL), 0);
  4974.     sw_palette = 1;
  4975.     warn_msg ();
  4976.     return;
  4977. }
  4978. /* EOF */
  4979. /* cat > src+obj/p14.c << "EOF" */
  4980. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4981. /* p14: p14 button - load the palette            */
  4982. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  4983. /* SCCS information: %W%    %G% - NCSA */
  4984.  
  4985. /* #include "all.h" */
  4986. /* #include "newext.h" */
  4987.  
  4988. int    p14()
  4989. {
  4990.     char pfntmp[MAXNAMELEN + 1];
  4991.  
  4992.     reset_palette();
  4993.     strcpy (pfntmp, panel_get (pt[0], PANEL_VALUE, 0));
  4994.     if (load_rgb (pfntmp, 1))
  4995.     {
  4996.         panel_set (pt[0], PANEL_VALUE, pfn, 0);
  4997.         (void) load_rgb (pfn, 1);
  4998.         return;
  4999.     }
  5000.         strcpy(pfn, pfntmp);
  5001.     panel_set (pt[0], PANEL_VALUE, pfn, 0);
  5002.     
  5003.     reset_colormap ();
  5004.  
  5005.     info_msg("","Palette loaded.","");
  5006.         return;
  5007. }
  5008. /* EOF */
  5009. /* cat > src+obj/p15.c << "EOF" */
  5010. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5011. /* p15: p15 button - load background color        */
  5012. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5013. /* SCCS information: %W%    %G% - NCSA */
  5014.  
  5015. /* #include "all.h" */
  5016.  
  5017. int    p15()
  5018. {
  5019.         register int            c;
  5020.     reset_palette();
  5021.         strcpy(txt,panel_get    (pt[1],PANEL_VALUE,0));
  5022.         if (FALSE == my_isint(txt))
  5023.        {strcat(txt," is not an integer");
  5024.         bad_data(txt);
  5025.         return;
  5026.        }
  5027.         c       = atoi(txt);
  5028.         if (c < 0 || c > 255)
  5029.        {bad_data("value < 0 or value > 255");
  5030.         return;
  5031.        }
  5032.         clear_color     = c;
  5033. info_msg("","Background color loaded and in effect for all future actions.","");
  5034.         return;
  5035. }
  5036. /* EOF */
  5037. /* cat > src+obj/p16.c << "EOF" */
  5038. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5039. /* p16: p16 button - done with the grid frame        */
  5040. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5041. /* SCCS information: %W%    %G% - NCSA */
  5042.  
  5043. /* #include "all.h" */
  5044.  
  5045. int 
  5046. p16 ()
  5047. {
  5048.     if (1 == sw_grid || FALSE == confirm_grid ())
  5049.     {
  5050.         window_destroy (pa[2]);
  5051.         window_destroy (fr[2]);
  5052.         pa[2] = fr[2] = NULL;
  5053.         panel_set (pb[4], PANEL_SHOW_ITEM, TRUE, 0);
  5054.         info_msg ("", "Grid frame put away.", "");
  5055.         sw_grid = 0;
  5056.         return;
  5057.     }
  5058.     panel_set (pb[16], PANEL_LABEL_IMAGE,
  5059.            panel_button_image (pa[2], "CONFIRM", 7, NULL), 0);
  5060.     sw_grid = 1;
  5061.     warn_msg ();
  5062.     return;
  5063. }
  5064. /* EOF */
  5065. /* cat > src+obj/p17.c << "EOF" */
  5066. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5067. /* p17: p17 button - grid...toggle the FinalPic switch    */
  5068. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5069. /* SCCS information: %W%    %G% - NCSA */
  5070.  
  5071. /* #include "all.h" */
  5072.  
  5073. int    p17()
  5074. {
  5075.     reset_grid();
  5076.         if (grid.sw == 1)
  5077.           {grid.sw = 0;
  5078.            panel_set(    pb[17],PANEL_LABEL_IMAGE,
  5079.             panel_button_image(pa[2],
  5080.             "FinalPic toggle (OFF)",21,NULL),
  5081.             0);
  5082.           }
  5083.         else
  5084.           {grid.sw = 1;
  5085.            panel_set(    pb[17],PANEL_LABEL_IMAGE,
  5086.             panel_button_image(pa[2],
  5087.             "FinalPic toggle (ON) ",21,NULL),
  5088.             0);
  5089.           }
  5090.     info_msg("","FinalPic switch toggled for grid.","");
  5091.         return;
  5092. }
  5093. /* EOF */
  5094. /* cat > src+obj/p18.c << "EOF" */
  5095. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5096. /* p18: p18 button - grid...store displayed values    */
  5097. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5098. /* SCCS information: %W%    %G% - NCSA */
  5099.  
  5100. /* #include "all.h" */
  5101.  
  5102. int    p18()
  5103. {
  5104.     reset_grid();
  5105.         if (FALSE == ok_grid(&tgrid)) return;
  5106.         grid.color      = tgrid.color;
  5107.         grid.xpix       = tgrid.xpix;
  5108.         grid.ypix       = tgrid.ypix;
  5109.     p19();
  5110.         return;
  5111. }
  5112. /* EOF */
  5113. /* cat > src+obj/p19.c << "EOF" */
  5114. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5115. /* p19: p19 button - grid...discard displayed values    */
  5116. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5117. /* SCCS information: %W%    %G% - NCSA */
  5118.  
  5119. /* #include "all.h" */
  5120.  
  5121. int    p19()
  5122. {
  5123.     reset_grid();
  5124.         if    (grid.color == 0)
  5125.         panel_set(    pt[2],PANEL_VALUE,"",0);
  5126.         else
  5127.         {my_itoa(grid.color,txt);
  5128.          panel_set(    pt[2],PANEL_VALUE,txt,0);
  5129.         }
  5130.         if      (grid.xpix == 0)
  5131.         panel_set(    pt[3],PANEL_VALUE,"",0);
  5132.         else
  5133.         {my_itoa(grid.xpix,txt);
  5134.          panel_set(    pt[3],PANEL_VALUE,txt,0);
  5135.         }
  5136.         if      (grid.ypix == 0)
  5137.         panel_set(    pt[4],PANEL_VALUE,"",0);
  5138.         else
  5139.         {my_itoa(grid.ypix,txt);
  5140.          panel_set(    pt[4],PANEL_VALUE,txt,0);
  5141.         }
  5142.     info_msg("","Display now shows currently stored values for grid.","");
  5143.         return;
  5144. }
  5145. /* EOF */
  5146. /* cat > src+obj/p20.c << "EOF" */
  5147. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5148. /* p20: p20 button - draw the grid            */
  5149. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5150. /* SCCS information: %W%    %G% - NCSA */
  5151.  
  5152. /* #include "all.h" */
  5153. /* #include "newext.h" */
  5154.  
  5155. int    p20()
  5156. {
  5157.     reset_grid();
  5158.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5159.       {info_msg("","Canvas is not up, request ignored.","");
  5160.        return;
  5161.       }
  5162.         if (FALSE == ok_grid(&tgrid)) return;
  5163.     if (grid_down)        /* already grid down - erase first */
  5164.     {
  5165.         lgrid.color = clear_color;
  5166.         draw_grid (&lgrid);
  5167.     }
  5168.         draw_grid(&tgrid);
  5169.     lgrid = tgrid;
  5170.     grid_down = TRUE;
  5171.     info_msg("","Grid drawn.","");
  5172.         return;
  5173. }
  5174. /* EOF */
  5175. /* cat > src+obj/p21.c << "EOF" */
  5176. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5177. /* p21: p21 button - erase the grid            */
  5178. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5179. /* SCCS information: %W%    %G% - NCSA */
  5180.  
  5181. /* #include "all.h" */
  5182. /* #include "newext.h" */
  5183.  
  5184. int    p21()
  5185. {
  5186.     reset_grid();
  5187.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5188.       {info_msg("","Canvas is not up, request ignored.","");
  5189.        return;
  5190.       }
  5191.         if (FALSE == ok_grid(&tgrid)) return;
  5192.         tgrid.color     = clear_color;
  5193.         draw_grid(&tgrid);
  5194.     grid_down = FALSE;
  5195.     info_msg("","Grid erased.","");
  5196.         return;
  5197. }
  5198. /* EOF */
  5199. /* cat > src+obj/p22.c << "EOF" */
  5200. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5201. /* p22: p22 button - done with colorbar frame        */
  5202. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5203. /* SCCS information: %W%    %G% - NCSA */
  5204.  
  5205. /* #include "all.h" */
  5206.  
  5207. int 
  5208. p22 ()
  5209. {
  5210.     if (1 == sw_colorbar || FALSE == confirm_colorbar ())
  5211.     {
  5212.         reset_mcolorbar ();
  5213.         window_destroy (pa[3]);
  5214.         window_destroy (fr[3]);
  5215.         pa[3] = fr[3] = NULL;
  5216.         panel_set (pb[5], PANEL_SHOW_ITEM, TRUE, 0);
  5217.         info_msg ("", "ColorBar frame put away.", "");
  5218.         sw_colorbar = 0;
  5219.         return;
  5220.     }
  5221.     panel_set (pb[22], PANEL_LABEL_IMAGE,
  5222.            panel_button_image (pa[3], "CONFIRM", 7, NULL), 0);
  5223.     sw_colorbar = 1;
  5224.     warn_msg ();
  5225.     return;
  5226. }
  5227. /* EOF */
  5228. /* cat > src+obj/p23.c << "EOF" */
  5229. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5230. /* p23: p23 button - colorbar...toggle the FinalPic    */
  5231. /*    switch                        */
  5232. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5233. /* SCCS information: %W%    %G% - NCSA */
  5234.  
  5235. /* #include "all.h" */
  5236.  
  5237. int    p23()
  5238. {
  5239.     reset_colorbar();
  5240.         if (cbar.sw == 1)
  5241.           {cbar.sw = 0;
  5242.            panel_set(    pb[23],PANEL_LABEL_IMAGE,
  5243.             panel_button_image(pa[3],
  5244.             "FinalPic toggle (OFF)",21,NULL),
  5245.             0);
  5246.           }
  5247.         else
  5248.           {cbar.sw = 1;
  5249.            panel_set(    pb[23],PANEL_LABEL_IMAGE,
  5250.             panel_button_image(pa[3],
  5251.             "FinalPic toggle (ON) ",21,NULL),
  5252.             0);
  5253.           }
  5254.     info_msg("","FinalPic switch toggled for colorbar.","");
  5255.         return;
  5256. }
  5257. /* EOF */
  5258. /* cat > src+obj/p24.c << "EOF" */
  5259. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5260. /* p24: p24 button - colorbar...store displayed values    */
  5261. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5262. /* SCCS information: %W%    %G% - NCSA */
  5263.  
  5264. /* #include "all.h" */
  5265.  
  5266. int    p24()
  5267. {
  5268.     reset_colorbar();
  5269.         if (FALSE == ok_colorbar(&tcbar)) return;
  5270.         cbar.xpts       = tcbar.xpts;
  5271.         cbar.ypts       = tcbar.ypts;
  5272.         cbar.xpos       = tcbar.xpos;
  5273.         cbar.ypos       = tcbar.ypos;
  5274.     p25();
  5275.         return;
  5276. }
  5277. /* EOF */
  5278. /* cat > src+obj/p25.c << "EOF" */
  5279. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5280. /* p25: p25 button:  colorbar...discard displayed    */
  5281. /*    values                        */
  5282. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5283. /* SCCS information: %W%    %G% - NCSA */
  5284.  
  5285. /* #include "all.h" */
  5286.  
  5287. int    p25()
  5288. {
  5289.     reset_colorbar();
  5290.     reset_mcolorbar();
  5291.         panel_set(      pt[5],PANEL_VALUE,"128",0);
  5292.         if      (cbar.xpts == 0)
  5293.         panel_set(    pt[6],PANEL_VALUE,"",0);
  5294.         else
  5295.         {my_itoa(cbar.xpts,txt);
  5296.          panel_set(    pt[6],PANEL_VALUE,txt,0);
  5297.         }
  5298.         if      (cbar.ypts == 0)
  5299.         panel_set(    pt[7],PANEL_VALUE,"",0);
  5300.         else
  5301.         {my_itoa(cbar.ypts,txt);
  5302.          panel_set(    pt[7],PANEL_VALUE,txt,0);
  5303.         }
  5304.         if      (cbar.xpos == 0)
  5305.         panel_set(    pt[8],PANEL_VALUE,"",0);
  5306.         else
  5307.         {my_itoa(cbar.xpos,txt);
  5308.          panel_set(      pt[8],PANEL_VALUE,txt,0);
  5309.         }
  5310.         if      (cbar.ypos == 0)
  5311.         panel_set(    pt[9],PANEL_VALUE,"",0);
  5312.         else
  5313.         {my_itoa(cbar.ypos,txt);
  5314.          panel_set(      pt[9],PANEL_VALUE,txt,0);
  5315.         }
  5316.     info_msg("","Display now shows currently stored values for colorbar.","");
  5317.         return;
  5318. }
  5319. /* EOF */
  5320. /* cat > src+obj/p26.c << "EOF" */
  5321. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5322. /* p26: p26 button - colorbar...draw it            */
  5323. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5324. /* SCCS information: %W%    %G% - NCSA */
  5325.  
  5326. /* #include "all.h" */
  5327.  
  5328. int    p26()
  5329. {
  5330.     reset_colorbar();
  5331.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5332.       {info_msg("","Canvas is not up, request ignored.","");
  5333.        return;
  5334.       }
  5335.         if (FALSE == ok_colorbar(&tcbar)) return;
  5336.         draw_colorbar(&tcbar);
  5337.     info_msg("","Colorbar drawn.","");
  5338.         return;
  5339. }
  5340. /* EOF */
  5341. /* cat > src+obj/p27.c << "EOF" */
  5342. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5343. /* p27: p27 button - colorbar...erase it        */
  5344. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5345. /* SCCS information: %W%    %G% - NCSA */
  5346.  
  5347. /* #include "all.h" */
  5348.  
  5349. int     p27()
  5350. {
  5351.     reset_colorbar();
  5352.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5353.       {info_msg("","Canvas is not up, request ignored.","");
  5354.        return;
  5355.       }
  5356.         if (FALSE == ok_colorbar(&tcbar)) return;
  5357.         pw_rop(cpw,    tcbar.xpos,
  5358.                         tcbar.ypos,
  5359.                         tcbar.xpts,
  5360.                         tcbar.ypts,
  5361.                 PIX_SRC | ((clear_color) << 5),NULL,0,0);
  5362.     info_msg("","Colorbar erased.","");
  5363.         return;
  5364. }
  5365. /* EOF */
  5366. /* cat > src+obj/p28.c << "EOF" */
  5367. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5368. /* p28: p28 button - colorbar...mouse draw         */
  5369. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5370. /* SCCS information: %W%    %G% - NCSA */
  5371.  
  5372. /* #include "all.h" */
  5373.  
  5374. int    p28()
  5375. {
  5376.         reset_colorbar();
  5377.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5378.           {info_msg("","Canvas is not up, request ignored.","");
  5379.            return;
  5380.           }
  5381.     if (csw_colorbar == FALSE)
  5382.        {if (cpw_check() == TRUE)
  5383.            return;
  5384.         csw_colorbar = TRUE;
  5385.         sw_draw = TRUE;
  5386.         panel_set(pb[28],PANEL_LABEL_IMAGE,
  5387.               panel_button_image(pa[3],"MS DRAW",8,NULL),0);
  5388.         msg_draw("ColorBar frame:");
  5389.         return;
  5390.        }
  5391.     if (sw_draw == TRUE)
  5392.        {sw_draw = FALSE;
  5393.         csw_colorbar = FALSE;
  5394.         panel_set(pb[28],PANEL_LABEL_IMAGE,
  5395.               panel_button_image(pa[3],"ms draw",8,NULL),0);
  5396.         info_msg("","Draw ColorBar with mouse deactivated.","");
  5397.         return;
  5398.        }
  5399.     sw_move = FALSE;
  5400.     panel_set(pb[84],PANEL_LABEL_IMAGE,
  5401.            panel_button_image(pa[3],"mouse mv",9,NULL),0);
  5402.     sw_draw = TRUE;
  5403.     panel_set(pb[28],PANEL_LABEL_IMAGE,
  5404.           panel_button_image(pa[3],"MS DRAW",8,NULL),0);
  5405.     msg_draw("ColorBar frame:");
  5406.     return;
  5407. }
  5408. /* EOF */
  5409. /* cat > src+obj/p29.c << "EOF" */
  5410. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5411. /* p29: p29 button - colorbar...temporary show color    */
  5412. /*    pos                        */
  5413. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5414. /* SCCS information: %W%    %G% - NCSA */
  5415.  
  5416. /* #include "all.h" */
  5417.  
  5418. int    p29()
  5419. {
  5420.         int             c;
  5421.         float           f = 255.00001;
  5422.     reset_colorbar();
  5423.         if    (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5424.       {info_msg("","Canvas is not up, request ignored.","");
  5425.        return;
  5426.       }
  5427.         if    (FALSE == ok_colorbar(&tcbar)) return;
  5428.         strcpy( txt,panel_get(  pt[5],PANEL_VALUE,0));
  5429.         if    (FALSE == my_isint(txt))
  5430.         {strcat(txt," is not an integer, request ignored.");
  5431.          bad_data(txt);
  5432.          return;
  5433.         }
  5434.         c       = atoi(txt);
  5435.         if    (c < 0 || c > 255)
  5436.         {bad_data("Value < 0 or value > 255, request ignored.");
  5437.          return;
  5438.         }
  5439.         c = c * (f / (0. + tcbar.ypts));
  5440.         pw_vector(cpw,    tcbar.xpos + tcbar.xpts,
  5441.                 tcbar.ypos + tcbar.ypts - 1 - c,
  5442.             tcbar.xpos + tcbar.xpts + 5,
  5443.             tcbar.ypos + tcbar.ypts - 1 - c + 5,
  5444.             PIX_SRC,255);
  5445.         pw_vector(cpw,    tcbar.xpos + tcbar.xpts,
  5446.             tcbar.ypos + tcbar.ypts - 1 - c,
  5447.             tcbar.xpos + tcbar.xpts + 5,
  5448.             tcbar.ypos + tcbar.ypts - 1 - c - 5,
  5449.             PIX_SRC,255);
  5450.     info_msg("","Specified color shown on colorbar.","");
  5451.         return;
  5452. }
  5453. /* EOF */
  5454. /* cat > src+obj/p30.c << "EOF" */
  5455. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5456. /* p30: p30 button - done with text frame        */
  5457. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5458. /* SCCS information: %W%    %G% - NCSA */
  5459.  
  5460. /* #include "all.h" */
  5461.  
  5462. int 
  5463. p30 ()
  5464. {
  5465.     if (1 == sw_text || FALSE == confirm_text ())
  5466.     {
  5467.         reset_text ();
  5468.         reset_mtext ();
  5469.         window_destroy (pa[4]);
  5470.         window_destroy (fr[4]);
  5471.         panel_set (pb[6], PANEL_SHOW_ITEM, TRUE, 0);
  5472.         info_msg ("", "Text frame put away.", "");
  5473.         reset_text ();
  5474.         csw_text = FALSE;
  5475.         pa[4] = fr[4] = NULL;
  5476.         return;
  5477.     }
  5478.     reset_text ();
  5479.     panel_set (pb[30], PANEL_LABEL_IMAGE,
  5480.            panel_button_image (pa[4], "CONFIRM", 7, NULL), 0);
  5481.     sw_text = 1;
  5482.     warn_msg ();
  5483.     return;
  5484. }
  5485. /* EOF */
  5486. /* cat > src+obj/p31.c << "EOF" */
  5487. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5488. /* p31: p31 button - text...toggle the FinalPic switch    */
  5489. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5490. /* SCCS information: %W%    %G% - NCSA */
  5491.  
  5492. /* #include "all.h" */
  5493.  
  5494. int    p31()
  5495. {
  5496.     reset_text();
  5497.         if (text[nt].sw == 1)
  5498.           {text[nt].sw = 0;
  5499.            panel_set(    pb[31],PANEL_LABEL_IMAGE,
  5500.             panel_button_image(pa[4],
  5501.             "FinalPic toggle (OFF)",21,NULL),
  5502.             0);
  5503.           }
  5504.         else
  5505.           {text[nt].sw = 1;
  5506.            panel_set(    pb[31],PANEL_LABEL_IMAGE,
  5507.             panel_button_image(pa[4],
  5508.             "FinalPic toggle (ON) ",21,NULL),
  5509.             0);
  5510.       }
  5511.     *(rw_toggle + N_image + N_contour + N_vector + nt) = TRUE;
  5512.     info_msg("","FinalPic toggled for text.","");
  5513.         return;
  5514. }
  5515. /* EOF */
  5516. /* cat > src+obj/p32.c << "EOF" */
  5517. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5518. /* p32: p32 button - text...store displayed values    */
  5519. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5520. /* SCCS information: %W%    %G% - NCSA */
  5521.  
  5522. /* #include "all.h" */
  5523.  
  5524. int    p32()
  5525. {
  5526.     reset_text();
  5527.         if (FALSE == ok_text(&text[N_text])) return;
  5528.         text[nt].color  = text[N_text].color;
  5529.         text[nt].xpos   = text[N_text].xpos;
  5530.         text[nt].ypos   = text[N_text].ypos;
  5531.         strcpy(text[nt].body,text[N_text].body);
  5532.         strcpy(text[nt].prefont,text[N_text].prefont);
  5533.         strcpy(text[nt].postfont,text[N_text].postfont);
  5534.     reset_text();
  5535.     p33();
  5536.     *(rw_toggle + N_image + N_contour + N_vector + nt) = TRUE;
  5537.         return;
  5538. }
  5539. /* EOF */
  5540. /* cat > src+obj/p33.c << "EOF" */
  5541. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5542. /* p33: p33 button - text...discard displayed values    */
  5543. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5544. /* SCCS information: %W%    %G% - NCSA */
  5545.  
  5546. /* #include "all.h" */
  5547.  
  5548. int    p33()
  5549. {
  5550.         char            *s;
  5551.     reset_text();
  5552.     reset_mtext();
  5553.         strcpy(txt,window_get(fr[4],FRAME_LABEL,0));
  5554.         s = txt;
  5555.         while (*s) s++;
  5556.     while (*s != 't') s--;
  5557.     s++;
  5558.         my_itoa(nt,s);
  5559.         while (*s) s++;
  5560.         *s++ = '\'';
  5561.         *s++ = ')';
  5562.         *s   = '\0';
  5563.         window_set(     fr[4],FRAME_LABEL,txt,0);
  5564.         if      (text[nt].sw == 0)
  5565.             panel_set(    pb[31],PANEL_LABEL_IMAGE,
  5566.                 panel_button_image(pa[4],
  5567.                 "FinalPic toggle (OFF)",21,NULL),
  5568.                 0);
  5569.         else
  5570.             panel_set(    pb[31],PANEL_LABEL_IMAGE,
  5571.                 panel_button_image(pa[4],
  5572.                 "FinalPic toggle (ON) ",21,NULL),
  5573.                 0);
  5574.         if      (text[nt].color == 0)
  5575.         panel_set(      pt[11],PANEL_VALUE,"",0);
  5576.         else
  5577.         {my_itoa(text[nt].color,txt);
  5578.          panel_set(pt[11],PANEL_VALUE,txt,0);
  5579.         }
  5580.         if      (text[nt].xpos == 0)
  5581.         panel_set(      pt[12],PANEL_VALUE,"",0);
  5582.         else
  5583.         {my_itoa(text[nt].xpos,txt);
  5584.          panel_set(pt[12],PANEL_VALUE,txt,0);
  5585.         }
  5586.         if      (text[nt].ypos == 0)
  5587.         panel_set(      pt[13],PANEL_VALUE,"",0);
  5588.         else
  5589.         {my_itoa(text[nt].ypos,txt);
  5590.          panel_set(pt[13],PANEL_VALUE,txt,0);
  5591.         }
  5592.         panel_set(      pt[14],PANEL_VALUE,text[nt].body,0);
  5593.         panel_set(      pt[15],PANEL_VALUE,text[nt].prefont,0);
  5594.         panel_set(      pt[16],PANEL_VALUE,text[nt].postfont,0);
  5595.         s = txt;
  5596.         *s++ = 't';
  5597.         if (nt == 0)    {*s++ = '0'; *s = '\0';}
  5598.         else            my_itoa(nt-1,s);
  5599.         panel_set(      pt[10],PANEL_VALUE,txt,0);
  5600.     info_msg("","Display now shows currently stored values for text.","");
  5601.         return;
  5602. }
  5603. /* EOF */
  5604. /* cat > src+obj/p34.c << "EOF" */
  5605. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5606. /* p34: p34 button - text...draw it            */
  5607. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5608. /* SCCS information: %W%    %G% - NCSA */
  5609.  
  5610. /* #include "all.h" */
  5611.  
  5612. int    p34()
  5613. {
  5614.     reset_text();
  5615.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5616.       {info_msg("","Canvas is not up, request ignored.","");
  5617.        return;
  5618.       }
  5619.         if (FALSE == ok_text(&text[N_text])) return;
  5620.         draw_text(&text[N_text]);
  5621.     info_msg("","Text drawn.","");
  5622.         return;
  5623. }
  5624. /* EOF */
  5625. /* cat > src+obj/p35.c << "EOF" */
  5626. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5627. /* p35: p35 button - text...erase it            */
  5628. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5629. /* SCCS information: %W%    %G% - NCSA */
  5630.  
  5631. /* #include "all.h" */
  5632.  
  5633. int    p35()
  5634. {
  5635.     reset_text();
  5636.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  5637.       {info_msg("","Canvas is not up, request ignored.","");
  5638.        return;
  5639.       }
  5640.         if (FALSE == ok_text(&text[N_text])) return;
  5641.     text[N_text].color = clear_color;
  5642.         draw_text(&text[N_text]);
  5643.     info_msg("","Text erased.","");
  5644.         return;
  5645. }
  5646. /* EOF */
  5647. /* cat > src+obj/p36.c << "EOF" */
  5648. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5649. /* p36: p36 button - text...copy data from another tag    */
  5650. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5651. /* SCCS information: %W%    %G% - NCSA */
  5652.  
  5653. /* #include "all.h" */
  5654.  
  5655. int    p36()
  5656. {
  5657.         register int    n;
  5658.         char            *s;
  5659.         strcpy(txt,panel_get(   pt[10],PANEL_VALUE,0));
  5660.         s = txt;
  5661.         if (*s != 't' || *(s + 1) == '\0')
  5662.       {strcat(txt," is not a valid text tag.");
  5663.        reset_text();
  5664.        bad_data(txt);
  5665.        return;
  5666.       }
  5667.         s++;
  5668.         if (FALSE == my_isint(s))
  5669.       {strcat(txt," is not a valid text tag.");
  5670.        reset_text();
  5671.        bad_data(txt);
  5672.        return;
  5673.       }
  5674.         n = atoi(s);
  5675.         if (n < 0)
  5676.       {strcat(txt," is not a valid text tag.");
  5677.        reset_text();
  5678.        bad_data(txt);
  5679.        return;
  5680.       }
  5681.         if (n >= N_text)
  5682.       {strcat(txt," is valid, but there are not that many tags.");
  5683.        reset_text();
  5684.        bad_data(txt);
  5685.        return;
  5686.       }
  5687.     if (nt == n)
  5688.        {reset_text();
  5689.         info_msg("","This text tag already showing.","");
  5690.         return;
  5691.        }
  5692.     if (sw_t[0] == 0 && TRUE == confirm_text())
  5693.        {reset_text();
  5694.         panel_set(pb[36],PANEL_LABEL_IMAGE,
  5695.               panel_button_image(pa[4],"*",2,NULL),0);
  5696.         sw_t[0] = 1;
  5697.         warn_msgt();
  5698.         return;
  5699.        }
  5700.         if      (text[n].color == 0)
  5701.         panel_set(      pt[11],PANEL_VALUE,"",0);
  5702.         else
  5703.         {my_itoa(text[n].color,txt);
  5704.          panel_set(pt[11],PANEL_VALUE,txt,0);
  5705.         }
  5706.         if      (text[n].xpos == 0)
  5707.         panel_set(      pt[12],PANEL_VALUE,"",0);
  5708.         else
  5709.         {my_itoa(text[n].xpos,txt);
  5710.          panel_set(pt[12],PANEL_VALUE,txt,0);
  5711.         }
  5712.         if      (text[n].ypos == 0)
  5713.         panel_set(      pt[13],PANEL_VALUE,"",0);
  5714.         else
  5715.         {my_itoa(text[n].ypos,txt);
  5716.          panel_set(pt[13],PANEL_VALUE,txt,0);
  5717.         }
  5718.         panel_set(      pt[14],PANEL_VALUE,text[n].body,0);
  5719.         panel_set(      pt[15],PANEL_VALUE,text[n].prefont,0);
  5720.         panel_set(      pt[16],PANEL_VALUE,text[n].postfont,0);
  5721.     reset_text();
  5722.     reset_mtext();
  5723.     info_msg("","Text displayed has been copied from",
  5724.             "another tag but has not been stored.");
  5725.         return;
  5726. }
  5727. /* EOF */
  5728. /* cat > src+obj/p37.c << "EOF" */
  5729. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5730. /* p37: p37 button - text...decrement tag number by 5    */
  5731. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5732. /* SCCS information: %W%    %G% - NCSA */
  5733.  
  5734. /* #include "all.h" */
  5735.  
  5736. int    p37()
  5737. {
  5738.     if (nt == 0)
  5739.        {reset_text();
  5740.         info_msg("","This text tag is the first one.","");
  5741.         return;
  5742.        }
  5743.     if (sw_t[1] == 1 || FALSE == confirm_text())
  5744.            {nt -= 5;
  5745.             if (nt < 0) nt = 0;
  5746.             p33();
  5747.         reset_text();
  5748.             return;
  5749.        }
  5750.     reset_text();
  5751.     panel_set(pb[37],PANEL_LABEL_IMAGE,
  5752.           panel_button_image(pa[4],"*",2,NULL),0);
  5753.     sw_t[1] = 1;
  5754.     warn_msgt();
  5755.     return;
  5756. }
  5757. /* EOF */
  5758. /* cat > src+obj/p38.c << "EOF" */
  5759. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5760. /* p38: p38 button - text...decrement tag number by 1    */
  5761. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5762. /* SCCS information: %W%    %G% - NCSA */
  5763.  
  5764. /* #include "all.h" */
  5765.  
  5766. int    p38()
  5767. {
  5768.     if (nt == 0)
  5769.        {reset_text();
  5770.         info_msg("","This text tag already displayed.","");
  5771.         return;
  5772.        }
  5773.     if (sw_t[2] == 1 || FALSE == confirm_text())
  5774.            {nt--;
  5775.             p33();
  5776.         reset_text();
  5777.             return;
  5778.        }
  5779.     reset_text();
  5780.     panel_set(pb[38],PANEL_LABEL_IMAGE,
  5781.           panel_button_image(pa[4],"*",1,NULL),0);
  5782.     sw_t[2] = 1;
  5783.     warn_msgt();
  5784.     return;
  5785. }
  5786. /* EOF */
  5787. /* cat > src+obj/p39.c << "EOF" */
  5788. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5789. /* p39: p39 button - text...increment tag number by 1    */
  5790. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5791. /* SCCS information: %W%    %G% - NCSA */
  5792.  
  5793. /* #include "all.h" */
  5794.  
  5795. int    p39()
  5796. {
  5797.     if (nt == N_text - 1)
  5798.        {reset_text();
  5799.         info_msg("","This text tag already displayed.","");
  5800.         return;
  5801.        }
  5802.     if (sw_t[3] == 1 || FALSE == confirm_text())
  5803.            {nt++;
  5804.             p33();
  5805.         reset_text();
  5806.             return;
  5807.        }
  5808.     reset_text();
  5809.     panel_set(pb[39],PANEL_LABEL_IMAGE,
  5810.           panel_button_image(pa[4],"*",1,NULL),0);
  5811.     sw_t[3] = 1;
  5812.     warn_msgt();
  5813.     return;
  5814. }
  5815. /* EOF */
  5816. /* cat > src+obj/p40.c << "EOF" */
  5817. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5818. /* p40: p40 button - text...increment tag number by 5    */
  5819. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5820. /* SCCS information: %W%    %G% - NCSA */
  5821.  
  5822. /* #include "all.h" */
  5823.  
  5824. int    p40()
  5825. {
  5826.     if (nt == N_text - 1)
  5827.        {reset_text();
  5828.         info_msg("","This text tag already displayed.","");
  5829.         return;
  5830.        }
  5831.     if (sw_t[4] == 1 || FALSE == confirm_text())
  5832.            {nt += 5;
  5833.         if (nt > N_text - 1) nt = N_text - 1;
  5834.             p33();
  5835.         reset_text();
  5836.             return;
  5837.        }
  5838.     reset_text();
  5839.     panel_set(pb[40],PANEL_LABEL_IMAGE,
  5840.           panel_button_image(pa[4],"*",2,NULL),0);
  5841.     sw_t[4] = 1;
  5842.     warn_msgt();
  5843.     return;
  5844. }
  5845. /* EOF */
  5846. /* cat > src+obj/p41.c << "EOF" */
  5847. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5848. /* p41: p41 button - done with fileutile frame        */
  5849. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5850. /* SCCS information: %W%    %G% - NCSA */
  5851.  
  5852. /* #include "all.h" */
  5853.  
  5854. int 
  5855. p41 ()
  5856. {
  5857.     if (csw_dump == TRUE)
  5858.         sw_flash = FALSE;
  5859.     window_destroy (pa[5]);
  5860.     window_destroy (fr[5]);
  5861.     pa[5] = fr[5] = NULL;
  5862.     panel_set (pb[11], PANEL_SHOW_ITEM, TRUE, 0);
  5863.     csw_dump = FALSE;
  5864.     info_msg ("", "File utility frame put away.", "");
  5865.     return;
  5866. }
  5867. /* EOF */
  5868. /* cat > src+obj/p42.c << "EOF" */
  5869. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5870. /* p42: p42 button - fileutil...write settings to file    */
  5871. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  5872. /* SCCS information: %W%    %G% - NCSA */
  5873.  
  5874. /* #include "all.h" */
  5875. /* #include "newext.h" */
  5876.  
  5877. int 
  5878. p42 ()
  5879. {
  5880.     register int    i, m;
  5881.     int             f, b;
  5882.  
  5883.     m = my_otod (644);
  5884.     strcpy (txt, panel_get (pt[17], PANEL_VALUE, 0));
  5885.     if (xstrlen (txt) == 0)    /* no filename */
  5886.     {
  5887.         bad_data ("No filename given, request ignored.");
  5888.         return;
  5889.     }
  5890.     if (-1 == (f = creat (txt, m)))
  5891.     {
  5892.         bad_data ("Cannot create file, request ignored.");
  5893.         return;
  5894.     }
  5895.     b = strlen (compat_hdr);
  5896.     if (b != write (f, compat_hdr, b))
  5897.     {
  5898.         bad_data ("Problem writing compatibility header, premature end.");
  5899.         close (f);
  5900.         return;
  5901.     }
  5902.     tag_to_string ("g", -1, msg);
  5903.     b = strlen (msg);
  5904.     if (b != write (f, msg, b))
  5905.     {
  5906.         bad_data ("Problem writing grid tag, premature end.");
  5907.         close (f);
  5908.         return;
  5909.     }
  5910.     tag_to_string ("p", -1, msg);
  5911.     b = strlen (msg);
  5912.     if (b != write (f, msg, b))
  5913.     {
  5914.         bad_data ("Problem writing palette tag, premature end.");
  5915.         close (f);
  5916.         return;
  5917.     }
  5918.     tag_to_string ("b", -1, msg);
  5919.     b = strlen (msg);
  5920.     if (b != write (f, msg, b))
  5921.     {
  5922.         bad_data ("Problem writing colorbar tag, premature end.");
  5923.         close (f);
  5924.         return;
  5925.     }
  5926.     for (i = 0; i < N_text; i++)
  5927.     {
  5928.         if (*(rw_toggle + N_image + N_contour + N_vector + i) == TRUE)
  5929.         {
  5930.             tag_to_string ("t", i, msg);
  5931.             b = strlen (msg);
  5932.             if (b != write (f, msg, b))
  5933.             {
  5934.                 bad_data ("Problem writing text tag, premature end.");
  5935.                 close (f);
  5936.                 return;
  5937.             }
  5938.         }
  5939.     }
  5940.     for (i = 0; i < N_image; i++)
  5941.     {
  5942.         if (*(rw_toggle + i) == TRUE)
  5943.         {
  5944.             tag_to_string ("i", i, msg);
  5945.             b = strlen (msg);
  5946.             if (b != write (f, msg, b))
  5947.             {
  5948.                 bad_data ("Problem writing image tag, premature end.");
  5949.                 close (f);
  5950.                 return;
  5951.             }
  5952.         }
  5953.     }
  5954.     for (i = 0; i < N_image + N_contour + N_vector; i++)
  5955.     {
  5956.         if (*(rw_toggle + i) == TRUE)
  5957.         {
  5958.             tag_to_string ("f", i, msg);
  5959.             b = strlen (msg);
  5960.             if (b != write (f, msg, b))
  5961.             {
  5962.                 bad_data ("Problem writing feature tag, premature end.");
  5963.                 close (f);
  5964.                 return;
  5965.             }
  5966.         }
  5967.     }
  5968.     for (i = 0; i < N_vector; i++)
  5969.     {
  5970.         if (*(rw_toggle + N_image + N_contour + i) == TRUE)
  5971.         {
  5972.             tag_to_string ("v", i, msg);
  5973.             b = strlen (msg);
  5974.             if (b != write (f, msg, b))
  5975.             {
  5976.                 bad_data ("Problem writing vector tag, premature end.");
  5977.                 close (f);
  5978.                 return;
  5979.             }
  5980.         }
  5981.     }
  5982.     for (i = 0; i < N_contour; i++)
  5983.     {
  5984.         if (*(rw_toggle + N_image + i) == TRUE)
  5985.         {
  5986.             tag_to_string ("c", i, msg);
  5987.             b = strlen (msg);
  5988.             if (b != write (f, msg, b))
  5989.             {
  5990.                 bad_data ("Problem writing contour tag, premature end.");
  5991.                 close (f);
  5992.                 return;
  5993.             }
  5994.         }
  5995.     }
  5996.     strcpy (msg, "\\");
  5997.     write (f, msg, 1);
  5998.     close (f);
  5999.     info_msg ("", "Program settings written to file.", "");
  6000.     return;
  6001. }
  6002. /* EOF */
  6003. /* cat > src+obj/p43.c << "EOF" */
  6004. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6005. /* p43: p43 button - fileutil...read settings from file    */
  6006. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6007. /* SCCS information: %W%    %G% - NCSA */
  6008.  
  6009. /* #include "all.h" */
  6010. /* #include "newext.h" */
  6011.  
  6012. int 
  6013. p43 ()
  6014. {
  6015.     char           *s, t[8], my_eof = '\\', nd = '\0', td = '\n';
  6016.     int             f, n, done = FALSE;
  6017.     register int    i;
  6018.  
  6019.     strcpy (txt, panel_get (pt[17], PANEL_VALUE, 0));
  6020.     if (xstrlen (txt) == 0)
  6021.     {
  6022.         bad_data ("No filename given, request ignored.");
  6023.         return;
  6024.     }
  6025.     if (-1 == (f = open (txt, 0)))
  6026.     {
  6027.         bad_data ("Cannot open file, request ignored.");
  6028.         return;
  6029.     }
  6030.  
  6031.         /* get directory part of filename */
  6032.  
  6033.     (void) getdirname (txt, util_read_dir);
  6034.  
  6035.     n = strlen (compat_hdr);
  6036.     read (f, msg, n);
  6037.     *(msg + n) = '\0';
  6038.     if (strcmp (compat_hdr, msg) != 0)
  6039.     {
  6040.         bad_data ("File format for this tool has changed since file was written: unable to read.");
  6041.         close (f);
  6042.         return;
  6043.     }
  6044.  
  6045.     for (i = 0; i < N_image + N_contour + N_vector + N_text; i++)
  6046.         *(rw_toggle + i) = FALSE;
  6047.     for (i = 0; i < N_text; i++)
  6048.         null_text (&text[i]);
  6049.     for (i = 0; i < N_image; i++)
  6050.         null_image (&image[i]);
  6051.     for (i = 0; i < N_image + N_contour + N_vector; i++)
  6052.         null_feature (&feat[i]);
  6053.     for (i = 0; i < N_contour; i++)
  6054.         null_contour (&con[i]);
  6055.     for (i = 0; i < N_vector; i++)
  6056.         null_vector (&vec[i]);
  6057.  
  6058.     while (done == FALSE)
  6059.     {
  6060.         s = msg;
  6061.         read (f, s, 1);
  6062.         if (*s == my_eof)
  6063.             done = TRUE;
  6064.         else
  6065.         {
  6066.             s++;
  6067.             while (*(s - 1) != td)
  6068.             {
  6069.                 read (f, s, 1);
  6070.                 s++;
  6071.             }
  6072.             *s = nd;
  6073.             if (FALSE == string_to_tag (msg, util_read_dir))
  6074.             {
  6075.                 close (f);
  6076.                 return;
  6077.             }
  6078.         }
  6079.     }
  6080.     close (f);
  6081.  
  6082.     if (TRUE == (int) window_get (fr[9], WIN_SHOW, 0))
  6083.     {
  6084.         strcpy (t, panel_get (pm[3], PANEL_LABEL_STRING, 0));
  6085.         if (strcmp (t, "X-AXIS") == 0)
  6086.             p91 ();
  6087.         else if (strcmp (t, "Y-AXIS") == 0)
  6088.             p93 ();
  6089.         else if (strcmp (t, "X-GRID") == 0)
  6090.             p95 ();
  6091.         else if (strcmp (t, "Y-GRID") == 0)
  6092.             p97 ();
  6093.         else if (strcmp (t, "X-TIC1") == 0)
  6094.             p99 ();
  6095.         else if (strcmp (t, "Y-TIC1") == 0)
  6096.             p101 ();
  6097.         else if (strcmp (t, "X-TIC2") == 0)
  6098.             p103 ();
  6099.         else if (strcmp (t, "Y-TIC2") == 0)
  6100.             p105 ();
  6101.         else
  6102.         {
  6103.             bad_data ("It is not possible to get this feature error message, p43");
  6104.             return;
  6105.         }
  6106.     }
  6107.  
  6108.     info_msg ("", "Program settings read from file.", "");
  6109.     return;
  6110. }
  6111. /* EOF */
  6112. /* cat > src+obj/p44.c << "EOF" */
  6113. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6114. /* p44: p44 button - fileutil...dump screen to file    */
  6115. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6116. /* SCCS information: %W%    %G% - NCSA */
  6117.  
  6118. /* #include "all.h" */
  6119. /* #include "newext.h" */
  6120.  
  6121. int
  6122. p44 ()
  6123. {
  6124.     Pixrect        *p;
  6125.     struct mpr_data *s;
  6126.     int             f, nx, ny;
  6127.  
  6128.     if (FALSE == (int) window_get (c_frame, WIN_SHOW, 0))
  6129.     {
  6130.         info_msg ("", "Canvas is not up, request ignored.", "");
  6131.         return;
  6132.     }
  6133.     else if (FALSE == my_isint (panel_get (pt[18], PANEL_VALUE, 0)))
  6134.     {
  6135.         bad_data ("X-pix start is not an integer, request ignored.");
  6136.         return;
  6137.     }
  6138.     else if (FALSE == my_isint (panel_get (pt[20], PANEL_VALUE, 0)))
  6139.     {
  6140.         bad_data ("X-pix end is not an integer, request ignored.");
  6141.         return;
  6142.     }
  6143.     else if (FALSE == my_isint (panel_get (pt[19], PANEL_VALUE, 0)))
  6144.     {
  6145.         bad_data ("Y-pix start is not an integer, request ignored.");
  6146.         return;
  6147.     }
  6148.     else if (FALSE == my_isint (panel_get (pt[21], PANEL_VALUE, 0)))
  6149.     {
  6150.         bad_data ("Y-pix end is not an integer, request ignored.");
  6151.         return;
  6152.     }
  6153.     else if (atoi (panel_get (pt[18], PANEL_VALUE, 0)) < 0)
  6154.     {
  6155.         bad_data ("X-pix start is less than zero, request ignored.");
  6156.         return;
  6157.     }
  6158.     else if (atoi (panel_get (pt[18], PANEL_VALUE, 0)) >= N_hpix)
  6159.     {
  6160.         my_itoa (N_hpix - 1, txt);
  6161.         strcat (txt, " is largest X-pix start allowed, request ignored.");
  6162.         bad_data (txt);
  6163.         return;
  6164.     }
  6165.     else if (atoi (panel_get (pt[20], PANEL_VALUE, 0)) < 0)
  6166.     {
  6167.         bad_data ("X-pix end is less than zero, request ignored.");
  6168.         return;
  6169.     }
  6170.     else if (atoi (panel_get (pt[20], PANEL_VALUE, 0)) >= N_hpix)
  6171.     {
  6172.         my_itoa (N_hpix - 1, txt);
  6173.         strcat (txt, " is largest X-pix end allowed, request ignored.");
  6174.         bad_data (txt);
  6175.         return;
  6176.     }
  6177.     else if (atoi (panel_get (pt[20], PANEL_VALUE, 0)) <
  6178.          atoi (panel_get (pt[18], PANEL_VALUE, 0)))
  6179.     {
  6180.         bad_data ("X-pix end < X-pix start, request ignored.");
  6181.         return;
  6182.     }
  6183.     else if (atoi (panel_get (pt[19], PANEL_VALUE, 0)) < 0)
  6184.     {
  6185.         bad_data ("Y-pix start is less than zero, request ignored.");
  6186.         return;
  6187.     }
  6188.     else if (atoi (panel_get (pt[19], PANEL_VALUE, 0)) >= N_vpix)
  6189.     {
  6190.         my_itoa (N_vpix - 1, txt);
  6191.         strcat (txt, " is largest Y-pix start allowed, request ignored.");
  6192.         bad_data (txt);
  6193.         return;
  6194.     }
  6195.     else if (atoi (panel_get (pt[21], PANEL_VALUE, 0)) < 0)
  6196.     {
  6197.         bad_data ("Y-pix end is less than zero, request ignored.");
  6198.         return;
  6199.     }
  6200.     else if (atoi (panel_get (pt[21], PANEL_VALUE, 0)) >= N_vpix)
  6201.     {
  6202.         my_itoa (N_vpix - 1, txt);
  6203.         strcat (txt, " is largest Y-pix end allowed, request ignored.");
  6204.         bad_data (txt);
  6205.         return;
  6206.     }
  6207.     else if (atoi (panel_get (pt[21], PANEL_VALUE, 0)) <
  6208.          atoi (panel_get (pt[19], PANEL_VALUE, 0)))
  6209.     {
  6210.         bad_data ("Y-pix end < Y-pix start, request ignored.");
  6211.         return;
  6212.     }
  6213.     else if ((atoi (panel_get (pt[18], PANEL_VALUE, 0)) ==
  6214.           atoi (panel_get (pt[20], PANEL_VALUE, 0)) &&
  6215.           atoi (panel_get (pt[21], PANEL_VALUE, 0)) <
  6216.           atoi (panel_get (pt[19], PANEL_VALUE, 0))) ||
  6217.          (atoi (panel_get (pt[19], PANEL_VALUE, 0)) ==
  6218.           atoi (panel_get (pt[21], PANEL_VALUE, 0)) &&
  6219.           atoi (panel_get (pt[20], PANEL_VALUE, 0)) <
  6220.           atoi (panel_get (pt[18], PANEL_VALUE, 0))))
  6221.     {
  6222.         bad_data ("A region of negative area defined, request ignored.");
  6223.         return;
  6224.     }
  6225.     else if (xstrlen (panel_get (pt[17], PANEL_VALUE, 0)) == 0)
  6226.     {
  6227.         bad_data ("No filename given, request ignored.");
  6228.         return;
  6229.     }
  6230.     else
  6231.     {
  6232.         sdump.xstart = atoi (panel_get (pt[18], PANEL_VALUE, 0));
  6233.         sdump.xend = atoi (panel_get (pt[20], PANEL_VALUE, 0));
  6234.         sdump.ystart = atoi (panel_get (pt[19], PANEL_VALUE, 0));
  6235.         sdump.yend = atoi (panel_get (pt[21], PANEL_VALUE, 0));
  6236.     }
  6237.     nx = sdump.xend - sdump.xstart + 1;
  6238.     ny = sdump.yend - sdump.ystart + 1;
  6239.     p = mem_create (nx, ny, 8);
  6240.     s = mpr_d (p);
  6241.     pw_read (p, 0, 0, nx, ny, PIX_SRC, cpw, sdump.xstart, sdump.ystart);
  6242.     s = mpr_d (p);
  6243.  
  6244.  /* unpad image before saving it */
  6245.  
  6246.     unpad_image (nx, ny, p);
  6247.  
  6248.     if (store_image (panel_get_value (pt[17]), nx, ny, (unsigned char *) s->md_image, (int) panel_get_value (util_pc_save)))
  6249.         return;
  6250.     info_msg ("", "Screen dumped to file.", "");
  6251.     return;
  6252. }
  6253. /* EOF */
  6254. /* cat > src+obj/p45.c << "EOF" */
  6255. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6256. /* p45: p45 button - fileutil...load dump parms via    */
  6257. /*    mouse                        */
  6258. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6259. /* SCCS information: %W%    %G% - NCSA */
  6260.  
  6261. /* #include "all.h" */
  6262.  
  6263. int    p45()
  6264. {
  6265.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6266.       {info_msg("","Canvas is not up, request ignored.","");
  6267.        return;
  6268.       }
  6269.     if (csw_dump == TRUE)
  6270.        {panel_set(pb[45],PANEL_LABEL_IMAGE, 
  6271.                       panel_button_image(pa[5],"now OFF",7,NULL),0);
  6272.         info_msg("","File Utility:  mouse disabled for the canvas.","");
  6273.         sw_flash = FALSE;
  6274.         csw_dump = FALSE;
  6275.             return;
  6276.        }
  6277.     if (FALSE == cpw_check())
  6278.        {csw_dump = TRUE;
  6279.         panel_set(pb[45],PANEL_LABEL_IMAGE,
  6280.               panel_button_image(pa[5],"now ON",7,NULL),0);
  6281.        info_msg("          File Utility:  move the cursor into the canvas and then",
  6282.        "press the left mouse to define your start point.  Hold the mouse down and drag",
  6283.        "it to your end point, then release it. Use on/off button to disable mouse.");
  6284.             return;
  6285.        }
  6286.     return;
  6287. }
  6288. /* EOF */
  6289. /* cat > src+obj/p46.c << "EOF" */
  6290. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6291. /* p46: p46 button - done with image frame        */
  6292. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6293. /* SCCS information: %W%    %G% - NCSA */
  6294.  
  6295. /* #include "all.h" */
  6296.  
  6297. int 
  6298. p46 ()
  6299. {
  6300.     if (1 == sw_image || FALSE == confirm_image ())
  6301.     {
  6302.         reset_image ();
  6303.         reset_mimage ();
  6304.         window_destroy (pa[6]);
  6305.         window_destroy (fr[6]);
  6306.         panel_set (pb[7], PANEL_SHOW_ITEM, TRUE, 0);
  6307.         info_msg ("", "Image frame put away.", "");
  6308.         reset_image ();
  6309.         pa[6] = fr[6] = NULL;
  6310.         return;
  6311.     }
  6312.     reset_image ();
  6313.     panel_set (pb[46], PANEL_LABEL_IMAGE,
  6314.            panel_button_image (pa[6], "CONFIRM", 7, NULL), 0);
  6315.     sw_image = 1;
  6316.     warn_msg ();
  6317.     return;
  6318. }
  6319. /* EOF */
  6320. /* cat > src+obj/p47.c << "EOF" */
  6321. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6322. /* p47: p47 button - image...toggle the FinalPic switch    */
  6323. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6324. /* SCCS information: %W%    %G% - NCSA */
  6325.  
  6326. /* #include "all.h" */
  6327.  
  6328. int    p47()
  6329. {
  6330.     reset_image();
  6331.         if (image[ni].sw == 1)
  6332.           {image[ni].sw = 0;
  6333.            panel_set(    pb[47],PANEL_LABEL_IMAGE,
  6334.             panel_button_image(pa[6],
  6335.             "FinalPic toggle (OFF)",21,NULL),
  6336.             0);
  6337.           }
  6338.         else
  6339.           {image[ni].sw = 1;
  6340.            panel_set(    pb[47],PANEL_LABEL_IMAGE,
  6341.             panel_button_image(pa[6],
  6342.             "FinalPic toggle (ON) ",21,NULL),
  6343.             0);
  6344.       }
  6345.     *(rw_toggle + ni) = TRUE;
  6346.     info_msg("","FinalPic toggled for image.","");
  6347.         return;
  6348. }
  6349. /* EOF */
  6350. /* cat > src+obj/p48.c << "EOF" */
  6351. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6352. /* p48: p48 button - image...store displayed values    */
  6353. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6354. /* SCCS information: %W%    %G% - NCSA */
  6355.  
  6356. /* #include "all.h" */
  6357.  
  6358. int    p48()
  6359. {
  6360.     reset_image();
  6361.         if (FALSE == ok_image(&image[N_image], 1)) return;
  6362.         image[ni].xpts  = image[N_image].xpts;
  6363.         image[ni].ypts  = image[N_image].ypts;
  6364.         image[ni].xpos  = image[N_image].xpos;
  6365.         image[ni].ypos  = image[N_image].ypos;
  6366.         strcpy(image[ni].fname,image[N_image].fname);
  6367.     p49();
  6368.     *(rw_toggle + ni) = TRUE;
  6369.         return;
  6370. }
  6371. /* EOF */
  6372. /* cat > src+obj/p49.c << "EOF" */
  6373. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6374. /* p49: p49 button - image...discard displayed values    */
  6375. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6376. /* SCCS information: %W%    %G% - NCSA */
  6377.  
  6378. /* #include "all.h" */
  6379.  
  6380. int    p49()
  6381. {
  6382.         char            *s;
  6383.     reset_image();
  6384.     reset_mimage();
  6385.         strcpy(txt,window_get(fr[6],FRAME_LABEL,0));
  6386.         s = txt;
  6387.         while (*s) s++;
  6388.     while (*s != 'i') s--;
  6389.     s++;
  6390.         my_itoa(ni,s);
  6391.         while (*s) s++;
  6392.         *s++ = '\'';
  6393.         *s++ = ')';
  6394.         *s   = '\0';
  6395.         window_set(     fr[6],FRAME_LABEL,txt,0);
  6396.         if      (image[ni].sw == 0)
  6397.             panel_set(    pb[47],PANEL_LABEL_IMAGE,
  6398.                 panel_button_image(pa[6],
  6399.                 "FinalPic toggle (OFF)",21,NULL),
  6400.                 0);
  6401.         else
  6402.             panel_set(    pb[47],PANEL_LABEL_IMAGE,
  6403.                 panel_button_image(pa[6],
  6404.                 "FinalPic toggle (ON) ",21,NULL),
  6405.                 0);
  6406.         if      (image[ni].xpts == 0)
  6407.         panel_set(    pt[23],PANEL_VALUE,"",0);
  6408.         else
  6409.         {my_itoa(image[ni].xpts,txt);
  6410.          panel_set(pt[23],PANEL_VALUE,txt,0);
  6411.         }
  6412.         if      (image[ni].ypts == 0)
  6413.         panel_set(      pt[24],PANEL_VALUE,"",0);
  6414.         else
  6415.         {my_itoa(image[ni].ypts,txt);
  6416.          panel_set(pt[24],PANEL_VALUE,txt,0);
  6417.         }
  6418.         if      (image[ni].xpos == 0)
  6419.         panel_set(      pt[25],PANEL_VALUE,"",0);
  6420.         else
  6421.         {my_itoa(image[ni].xpos,txt);
  6422.          panel_set( pt[25],PANEL_VALUE,txt,0);
  6423.         }
  6424.         if      (image[ni].ypos == 0)
  6425.         panel_set(      pt[26],PANEL_VALUE,"",0);
  6426.         else
  6427.         {my_itoa(image[ni].ypos,txt);
  6428.          panel_set( pt[26],PANEL_VALUE,txt,0);
  6429.         }
  6430.         panel_set(      pt[27],PANEL_VALUE,image[ni].fname,0);
  6431.         s = txt;
  6432.         *s++ = 'i';
  6433.         if (ni == 0)    {*s++ = '0'; *s = '\0';}
  6434.         else            my_itoa(ni-1,s);
  6435.         panel_set(      pt[22],PANEL_VALUE,txt,0);
  6436.     info_msg("","Display now shows currently stored values for image.","");
  6437.         return;
  6438. }
  6439. /* EOF */
  6440. /* cat > src+obj/p50.c << "EOF" */
  6441. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6442. /* p50: p50 button - image...draw it            */
  6443. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6444. /* SCCS information: %W%    %G% - NCSA */
  6445.  
  6446. /* #include "all.h" */
  6447.  
  6448. int    p50()
  6449. {
  6450.     reset_image();
  6451.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6452.       {info_msg("","Canvas is not up, request ignored.","");
  6453.        return;
  6454.       }
  6455.         if (FALSE == ok_image(&image[N_image], 1)) return;
  6456.         draw_image(&image[N_image], 1);
  6457.     info_msg("","Image drawn.","");
  6458.         return;
  6459. }
  6460. /* EOF */
  6461. /* cat > src+obj/p51.c << "EOF" */
  6462. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6463. /* p51: p51 button - image...erase it            */
  6464. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6465. /* SCCS information: %W%    %G% - NCSA */
  6466.  
  6467. /* #include "all.h" */
  6468.  
  6469. int    p51()
  6470. {
  6471.     reset_image();
  6472.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6473.       {info_msg("","Canvas is not up, request ignored.","");
  6474.        return;
  6475.       }
  6476.         if (FALSE == ok_image(&image[N_image], 1)) return;
  6477.         pw_writebackground(cpw, image[N_image].xpos,    image[N_image].ypos,
  6478.                                 image[N_image].xpts,    image[N_image].ypts,
  6479.                                 PIX_SRC | (clear_color) << 5);
  6480.     info_msg("","Image erased.","");
  6481.         return;
  6482. }
  6483. /* EOF */
  6484. /* cat > src+obj/p52.c << "EOF" */
  6485. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6486. /* p52: p52 button - image...mouse draw            */
  6487. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6488. /* SCCS information: %W%    %G% - NCSA */
  6489.  
  6490. /* #include "all.h" */
  6491.  
  6492. int    p52()
  6493. {
  6494.         reset_image();
  6495.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6496.           {info_msg("","Canvas is not up, request ignored.","");
  6497.            return;
  6498.           }
  6499.     if (csw_image == FALSE)
  6500.        {if (cpw_check() == TRUE)
  6501.            return;
  6502.         csw_image = TRUE;
  6503.         sw_draw = TRUE;
  6504.         panel_set(pb[52],PANEL_LABEL_IMAGE,
  6505.               panel_button_image(pa[6],"MS DRAW",8,NULL),0);
  6506.         msg_draw("Image frame:");
  6507.         return;
  6508.        }
  6509.     if (sw_draw == TRUE)
  6510.        {sw_draw = FALSE;
  6511.         csw_image = FALSE;
  6512.         panel_set(pb[52],PANEL_LABEL_IMAGE,
  6513.               panel_button_image(pa[6],"ms draw",8,NULL),0);
  6514.         info_msg("","Draw Images with mouse deactivated.","");
  6515.         return;
  6516.        }
  6517.     sw_move = FALSE;
  6518.     panel_set(pb[85],PANEL_LABEL_IMAGE,
  6519.            panel_button_image(pa[6],"mouse mv",9,NULL),0);
  6520.     sw_draw = TRUE;
  6521.     panel_set(pb[52],PANEL_LABEL_IMAGE,
  6522.           panel_button_image(pa[6],"MS DRAW",8,NULL),0);
  6523.     msg_draw("Image frame:");
  6524.     return;
  6525. }
  6526. /* EOF */
  6527. /* cat > src+obj/p53.c << "EOF" */
  6528. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6529. /* p53: p53 button - image...copy data from another tag    */
  6530. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6531. /* SCCS information: %W%    %G% - NCSA */
  6532.  
  6533. /* #include "all.h" */
  6534.  
  6535. int    p53()
  6536. {
  6537.         register int    n;
  6538.         char            *s;
  6539.         strcpy(txt,panel_get(   pt[22],PANEL_VALUE,0));
  6540.         s = txt;
  6541.         if (*s != 'i' || *(s + 1) == '\0')
  6542.       {strcat(txt," is not a valid image tag.");
  6543.        reset_image();
  6544.        bad_data(txt);
  6545.        return;
  6546.       }
  6547.         s++;
  6548.         if (FALSE == my_isint(s))
  6549.       {strcat(txt," is not a valid image tag.");
  6550.        reset_image();
  6551.        bad_data(txt);
  6552.        return;
  6553.       }
  6554.         n = atoi(s);
  6555.         if (n < 0)
  6556.       {strcat(txt," is not a valid image tag.");
  6557.        reset_image();
  6558.        bad_data(txt);
  6559.        return;
  6560.       }
  6561.         if (n >= N_image)
  6562.       {strcat(txt," is valid, but there are not that many tags.");
  6563.        reset_image();
  6564.        bad_data(txt);
  6565.        return;
  6566.       }
  6567.     if (ni == n)
  6568.        {reset_image();
  6569.         info_msg("", "This image tag already showing.","");
  6570.         return;
  6571.        }
  6572.     if (sw_i[0] == 0 && TRUE == confirm_image())
  6573.        {reset_image();
  6574.         panel_set(pb[53],PANEL_LABEL_IMAGE,
  6575.               panel_button_image(pa[6],"*",2,NULL),0);
  6576.         sw_i[0] = 1;
  6577.         warn_msgt();
  6578.         return;
  6579.        }
  6580.         if      (image[n].xpts == 0)
  6581.         panel_set(      pt[23],PANEL_VALUE,"",0);
  6582.         else
  6583.         {my_itoa(image[n].xpts,txt);
  6584.          panel_set(pt[23],PANEL_VALUE,txt,0);
  6585.         }
  6586.         if      (image[n].ypts == 0)
  6587.         panel_set(      pt[24],PANEL_VALUE,"",0);
  6588.         else
  6589.         {my_itoa(image[n].ypts,txt);
  6590.          panel_set(pt[24],PANEL_VALUE,txt,0);
  6591.         }
  6592.         if      (image[n].xpos == 0)
  6593.         panel_set(      pt[25],PANEL_VALUE,"",0);
  6594.         else
  6595.         {my_itoa(image[n].xpos,txt);
  6596.          panel_set(pt[25],PANEL_VALUE,txt,0);
  6597.         }
  6598.         if      (image[n].ypos == 0)
  6599.         panel_set(      pt[26],PANEL_VALUE,"",0);
  6600.         else
  6601.         {my_itoa(image[n].ypos,txt);
  6602.          panel_set(pt[26],PANEL_VALUE,txt,0);
  6603.         }
  6604.         panel_set(      pt[27],PANEL_VALUE,image[n].fname,0);
  6605.     reset_image();
  6606.     reset_mimage();
  6607.     info_msg("","Image displayed has been copied from",
  6608.             "another tag but has not been stored.");
  6609.         return;
  6610. }
  6611. /* EOF */
  6612. /* cat > src+obj/p54.c << "EOF" */
  6613. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6614. /* p54: p54 button - image...decrement tag number by 5    */
  6615. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6616. /* SCCS information: %W%    %G% - NCSA */
  6617.  
  6618. /* #include "all.h" */
  6619.  
  6620. int    p54()
  6621. {
  6622.     if (ni == 0)
  6623.        {reset_image();
  6624.         info_msg("","This image tag already displayed.","");
  6625.         return;
  6626.        }
  6627.     if (sw_i[1] == 1 || FALSE == confirm_image())
  6628.            {ni -= 5;
  6629.         if (ni < 0) ni = 0;
  6630.             p49();
  6631.         reset_image();
  6632.             return;
  6633.        }
  6634.     reset_image();
  6635.     panel_set(pb[54],PANEL_LABEL_IMAGE,
  6636.           panel_button_image(pa[6],"*",2,NULL),0);
  6637.     sw_i[1] = 1;
  6638.     warn_msgt();
  6639.     return;
  6640. }
  6641. /* EOF */
  6642. /* cat > src+obj/p55.c << "EOF" */
  6643. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6644. /* p55: p55 button - image...decrement tag number by 1    */
  6645. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6646. /* SCCS information: %W%    %G% - NCSA */
  6647.  
  6648. /* #include "all.h" */
  6649.  
  6650. int    p55()
  6651. {
  6652.     if (ni == 0)
  6653.        {reset_image();
  6654.         info_msg("","This image tag already displayed.","");
  6655.         return;
  6656.        }
  6657.     if (sw_i[2] == 1 || FALSE == confirm_image())
  6658.            {ni --;
  6659.             p49();
  6660.         reset_image();
  6661.             return;
  6662.        }
  6663.     reset_image();
  6664.     panel_set(pb[55],PANEL_LABEL_IMAGE,
  6665.           panel_button_image(pa[6],"*",1,NULL),0);
  6666.     sw_i[2] = 1;
  6667.     warn_msgt();
  6668.     return;
  6669. }
  6670. /* EOF */
  6671. /* cat > src+obj/p56.c << "EOF" */
  6672. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6673. /* p56: p56 button - image...increment tag number by 1    */
  6674. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6675. /* SCCS information: %W%    %G% - NCSA */
  6676.  
  6677. /* #include "all.h" */
  6678.  
  6679. int    p56()
  6680. {
  6681.     if (ni == N_image - 1)
  6682.        {reset_image();
  6683.         info_msg("","This image tag already displayed.","");
  6684.         return;
  6685.        }
  6686.     if (sw_i[3] == 1 || FALSE == confirm_image())
  6687.            {ni++;
  6688.             p49();
  6689.         reset_image();
  6690.             return;
  6691.        }
  6692.     reset_image();
  6693.     panel_set(pb[56],PANEL_LABEL_IMAGE,
  6694.           panel_button_image(pa[6],"*",1,NULL),0);
  6695.     sw_i[3] = 1;
  6696.     warn_msgt();
  6697.     return;
  6698. }
  6699. /* EOF */
  6700. /* cat > src+obj/p57.c << "EOF" */
  6701. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6702. /* p57: p57 button - image...increment tag number by 5    */
  6703. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6704. /* SCCS information: %W%    %G% - NCSA */
  6705.  
  6706. /* #include "all.h" */
  6707.  
  6708. int    p57()
  6709. {
  6710.     if (ni == N_image - 1)
  6711.        {reset_image();
  6712.         info_msg("","This image tag already displayed.","");
  6713.         return;
  6714.        }
  6715.     if (sw_i[4] == 1 || FALSE == confirm_image())
  6716.            {ni += 5;
  6717.         if (ni > N_image - 1) ni = N_image - 1;
  6718.             p49();
  6719.         reset_image();
  6720.             return;
  6721.        }
  6722.     reset_image();
  6723.     panel_set(pb[57],PANEL_LABEL_IMAGE,
  6724.           panel_button_image(pa[6],"*",2,NULL),0);
  6725.     sw_i[4] = 1;
  6726.     warn_msgt();
  6727.     return;
  6728. }
  6729. /* EOF */
  6730. /* cat > src+obj/p58.c << "EOF" */
  6731. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6732. /* p58: p58 button - done with contour frame        */
  6733. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6734. /* SCCS information: %W%    %G% - NCSA */
  6735.  
  6736. /* #include "all.h" */
  6737.  
  6738. int 
  6739. p58 ()
  6740. {
  6741.     if (1 == sw_contour || FALSE == confirm_contour ())
  6742.     {
  6743.         reset_mcontour ();
  6744.         reset_contour ();
  6745.         window_destroy (pa[7]);
  6746.         window_destroy (fr[7]);
  6747.         pa[7] = fr[7] = NULL;
  6748.         panel_set (pb[8], PANEL_SHOW_ITEM, TRUE, 0);
  6749.         info_msg ("", "Contour frame put away.", "");
  6750.         return;
  6751.     }
  6752.     reset_contour ();
  6753.     panel_set (pb[58], PANEL_LABEL_IMAGE,
  6754.            panel_button_image (pa[7], "CONFIRM", 7, NULL), 0);
  6755.     sw_contour = 1;
  6756.     warn_msg ();
  6757.     return;
  6758. }
  6759. /* EOF */
  6760. /* cat > src+obj/p59.c << "EOF" */
  6761. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6762. /* p59: p59 button - contour...toggle the FinalPic    */
  6763. /*    switch                        */
  6764. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6765. /* SCCS information: %W%    %G% - NCSA */
  6766.  
  6767. /* #include "all.h" */
  6768.  
  6769. int    p59()
  6770. {
  6771.     reset_contour();
  6772.         if (con[nc].sw == 1)
  6773.           {con[nc].sw = 0;
  6774.            panel_set(    pb[59],PANEL_LABEL_IMAGE,
  6775.             panel_button_image(pa[7],
  6776.             "FinalPic toggle (OFF)",21,NULL),
  6777.             0);
  6778.           }
  6779.         else
  6780.           {con[nc].sw = 1;
  6781.            panel_set(    pb[59],PANEL_LABEL_IMAGE,
  6782.             panel_button_image(pa[7],
  6783.             "FinalPic toggle (ON) ",21,NULL),
  6784.             0);
  6785.       }
  6786.     *(rw_toggle + N_image + nc) = TRUE;
  6787.     info_msg("","FinalPic toggled for contour.","");
  6788.         return;
  6789. }
  6790. /* EOF */
  6791. /* cat > src+obj/p60.c << "EOF" */
  6792. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6793. /* p60: p60 button - contour...store displayed values    */
  6794. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6795. /* SCCS information: %W%    %G% - NCSA */
  6796.  
  6797. /* #include "all.h" */
  6798.  
  6799. int    p60()
  6800. {
  6801.     reset_contour();
  6802.         if (FALSE == ok_contour(&con[N_contour], 1)) return;
  6803.         con[nc].xpts    = con[N_contour].xpts;
  6804.         con[nc].ypts    = con[N_contour].ypts;
  6805.         con[nc].xpos    = con[N_contour].xpos;
  6806.         con[nc].ypos    = con[N_contour].ypos;
  6807.         con[nc].first   = con[N_contour].first;
  6808.         con[nc].last    = con[N_contour].last;
  6809.         con[nc].interval = con[N_contour].interval;
  6810.         con[nc].color   = con[N_contour].color;
  6811.         con[nc].dis     = con[N_contour].dis;
  6812.         strcpy(con[nc].fname,con[N_contour].fname);
  6813.     p61();
  6814.     *(rw_toggle + N_image + nc) = TRUE;
  6815.         return;
  6816. }
  6817. /* EOF */
  6818. /* cat > src+obj/p61.c << "EOF" */
  6819. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6820. /* p61: p61 button - contour...discard displayed values    */
  6821. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6822. /* SCCS information: %W%    %G% - NCSA */
  6823.  
  6824. /* #include "all.h" */
  6825.  
  6826. int    p61()
  6827. {
  6828.         char            *s;
  6829.     reset_contour();
  6830.     reset_mcontour();
  6831.         strcpy(txt,window_get(fr[7],FRAME_LABEL,0));
  6832.         s = txt;
  6833.         while (*s) s++;
  6834.     while (*s != 'c') s--;
  6835.     s++;
  6836.         my_itoa(nc,s);
  6837.         while (*s) s++;
  6838.         *s++ = '\'';
  6839.         *s++ = ')';
  6840.         *s   = '\0';
  6841.         window_set(     fr[7],FRAME_LABEL,txt,0);
  6842.         if      (con[nc].sw == 0)
  6843.             panel_set(    pb[59],PANEL_LABEL_IMAGE,
  6844.                 panel_button_image(pa[7],
  6845.                 "FinalPic toggle (OFF)",21,NULL),
  6846.                 0);
  6847.         else
  6848.             panel_set(    pb[59],PANEL_LABEL_IMAGE,
  6849.                 panel_button_image(pa[7],
  6850.                 "FinalPic toggle (ON) ",21,NULL),
  6851.                 0);
  6852.         if      (con[nc].xpts == 0)
  6853.         panel_set(    pt[30],PANEL_VALUE,"",0);
  6854.         else
  6855.         {my_itoa(con[nc].xpts,txt);
  6856.          panel_set(    pt[30],PANEL_VALUE,txt,0);
  6857.         }
  6858.         if      (con[nc].ypts == 0)
  6859.         panel_set(    pt[31],PANEL_VALUE,"",0);
  6860.         else
  6861.         {my_itoa(con[nc].ypts,txt);
  6862.          panel_set(    pt[31],PANEL_VALUE,txt,0);
  6863.         }
  6864.         if      (con[nc].xpos == 0)
  6865.         panel_set(    pt[32],PANEL_VALUE,"",0);
  6866.         else
  6867.         {my_itoa(con[nc].xpos,txt);
  6868.          panel_set(    pt[32],PANEL_VALUE,txt,0);
  6869.         }
  6870.         if      (con[nc].ypos == 0)
  6871.         panel_set(    pt[33],PANEL_VALUE,"",0);
  6872.         else
  6873.         {my_itoa(con[nc].ypos,txt);
  6874.          panel_set(    pt[33],PANEL_VALUE,txt,0);
  6875.         }
  6876.         if      (con[nc].first == 0)
  6877.         panel_set(    pt[35],PANEL_VALUE,"",0);
  6878.         else
  6879.         {my_itoa(con[nc].first,txt);
  6880.          panel_set(    pt[35],PANEL_VALUE,txt,0);
  6881.         }
  6882.         if      (con[nc].last == 0)
  6883.         panel_set(    pt[36],PANEL_VALUE,"",0);
  6884.         else
  6885.         {my_itoa(con[nc].last,txt);
  6886.          panel_set(    pt[36],PANEL_VALUE,txt,0);
  6887.         }
  6888.         if      (con[nc].interval == 0)
  6889.         panel_set(    pt[37],PANEL_VALUE,"",0);
  6890.         else
  6891.         {my_itoa(con[nc].interval,txt);
  6892.          panel_set(    pt[37],PANEL_VALUE,txt,0);
  6893.         }
  6894.         if      (con[nc].color == 0)
  6895.         panel_set(    pt[34],PANEL_VALUE,"",0);
  6896.         else
  6897.         {my_itoa(con[nc].color,txt);
  6898.          panel_set(    pt[34],PANEL_VALUE,txt,0);
  6899.         }
  6900.         panel_set(    pt[29],PANEL_VALUE,con[nc].fname,0);
  6901.         s = txt;
  6902.         *s++ = 'c';
  6903.         if (nc == 0)    {*s++ = '0'; *s = '\0';}
  6904.         else            my_itoa(nc-1,s);
  6905.         panel_set(      pt[28],PANEL_VALUE,txt,0);
  6906.     info_msg("","Display now shows current stored values for contour.","");
  6907.         return;
  6908. }
  6909. /* EOF */
  6910. /* cat > src+obj/p62.c << "EOF" */
  6911. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6912. /* p62: p62 button - contour...draw it            */
  6913. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6914. /* SCCS information: %W%    %G% - NCSA */
  6915.  
  6916. /* #include "all.h" */
  6917.  
  6918. int    p62()
  6919. {
  6920.     reset_contour();
  6921.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6922.       {info_msg("","Canvas is not up, request ignored.","");
  6923.        return;
  6924.       }
  6925.         if (FALSE == ok_contour(&con[N_contour], 1)) return;
  6926.         draw_contour(&con[N_contour], 1);
  6927.     info_msg("","Contour drawn.","");
  6928.         return;
  6929. }
  6930. /* EOF */
  6931. /* cat > src+obj/p63.c << "EOF" */
  6932. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6933. /* p63: p63 button - contour...erase it            */
  6934. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6935. /* SCCS information: %W%    %G% - NCSA */
  6936.  
  6937. /* #include "all.h" */
  6938.  
  6939. int    p63()
  6940. {
  6941.     reset_contour();
  6942.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6943.       {info_msg("","Canvas is not up, request ignored.","");
  6944.        return;
  6945.       }
  6946.         if (FALSE == ok_contour(&con[N_contour], 1)) return;
  6947.         con[N_contour].color = clear_color;
  6948.         pw_writebackground(cpw, con[N_image].xpos,    con[N_image].ypos,
  6949.                                 con[N_image].xpts,    con[N_image].ypts,
  6950.                                 PIX_SRC | (clear_color) << 5);
  6951.     info_msg("","Contour erased.","");
  6952.         return;
  6953. }
  6954. /* EOF */
  6955. /* cat > src+obj/p64.c << "EOF" */
  6956. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6957. /* p64: p64 button - contour...mouse draw        */
  6958. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  6959. /* SCCS information: %W%    %G% - NCSA */
  6960.  
  6961. /* #include "all.h" */
  6962.  
  6963. int    p64()
  6964. {
  6965.         reset_contour();
  6966.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  6967.           {info_msg("","Canvas is not up, request ignored.","");
  6968.            return;
  6969.           }
  6970.     if (csw_contour == FALSE)
  6971.        {if (cpw_check() == TRUE)
  6972.            return;
  6973.         csw_contour = TRUE;
  6974.         sw_draw = TRUE;
  6975.         panel_set(pb[64],PANEL_LABEL_IMAGE,
  6976.               panel_button_image(pa[7],"MS DRAW",8,NULL),0);
  6977.         msg_draw("Contour frame:");
  6978.         return;
  6979.        }
  6980.     if (sw_draw == TRUE)
  6981.        {sw_draw = FALSE;
  6982.         csw_contour = FALSE;
  6983.         panel_set(pb[64],PANEL_LABEL_IMAGE,
  6984.               panel_button_image(pa[7],"ms draw",8,NULL),0);
  6985.         info_msg("","Draw Contours with mouse deactivated.","");
  6986.         return;
  6987.        }
  6988.     sw_move = FALSE;
  6989.     panel_set(pb[86],PANEL_LABEL_IMAGE,
  6990.            panel_button_image(pa[7],"mouse mv",9,NULL),0);
  6991.     sw_draw = TRUE;
  6992.     panel_set(pb[64],PANEL_LABEL_IMAGE,
  6993.           panel_button_image(pa[7],"MS DRAW",8,NULL),0);
  6994.     msg_draw("Contour frame:");
  6995.     return;
  6996. }
  6997. /* EOF */
  6998. /* cat > src+obj/p65.c << "EOF" */
  6999. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7000. /* p65: p65 button - contour...copy data from another    */
  7001. /*    tag                        */
  7002. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7003. /* SCCS information: %W%    %G% - NCSA */
  7004.  
  7005. /* #include "all.h" */
  7006.  
  7007. int    p65()
  7008. {
  7009.         register int    n;
  7010.         char            *s;
  7011.         strcpy(txt,panel_get(   pt[28],PANEL_VALUE,0));
  7012.         s = txt;
  7013.         if (*s != 'c' || *(s + 1) == '\0')
  7014.       {strcat(txt," is not a valid text tag.");
  7015.        reset_contour();
  7016.        bad_data(txt);
  7017.        return;
  7018.       }
  7019.         s++;
  7020.         if (FALSE == my_isint(s))
  7021.       {strcat(txt," is not a valid text tag.");
  7022.        reset_contour();
  7023.        bad_data(txt);
  7024.        return;
  7025.       }
  7026.         n = atoi(s);
  7027.         if (n < 0)
  7028.       {strcat(txt," is not a valid text tag.");
  7029.        reset_contour();
  7030.        bad_data(txt);
  7031.        return;
  7032.       }
  7033.         if (n >= N_contour)
  7034.       {strcat(txt," is valid, but there are not that many tags.");
  7035.        reset_contour();
  7036.        bad_data(txt);
  7037.        return;
  7038.       }
  7039.     if (nc == n)
  7040.        {reset_contour();
  7041.         info_msg("","This contour tag already showing.","");
  7042.         return;
  7043.        }
  7044.     if (sw_c[0] == 0 && TRUE == confirm_contour())
  7045.        {reset_contour();
  7046.         panel_set(pb[65],PANEL_LABEL_IMAGE,
  7047.               panel_button_image(pa[7],"*",2,NULL),0);
  7048.         sw_c[0] = 1;
  7049.         warn_msgt();
  7050.         return;
  7051.        }
  7052.         if      (con[n].xpts == 0)
  7053.         panel_set(    pt[30],PANEL_VALUE,"",0);
  7054.         else
  7055.         {my_itoa(con[n].xpts,txt);
  7056.          panel_set(    pt[30],PANEL_VALUE,txt,0);
  7057.         }
  7058.         if      (con[n].ypts == 0)
  7059.         panel_set(    pt[31],PANEL_VALUE,"",0);
  7060.         else
  7061.         {my_itoa(con[n].ypts,txt);
  7062.          panel_set(    pt[31],PANEL_VALUE,txt,0);
  7063.         }
  7064.         if      (con[n].xpos == 0)
  7065.         panel_set(    pt[32],PANEL_VALUE,"",0);
  7066.         else
  7067.         {my_itoa(con[n].xpos,txt);
  7068.          panel_set(    pt[32],PANEL_VALUE,txt,0);
  7069.         }
  7070.         if      (con[n].ypos == 0)
  7071.         panel_set(    pt[33],PANEL_VALUE,"",0);
  7072.         else
  7073.         {my_itoa(con[n].ypos,txt);
  7074.          panel_set(    pt[33],PANEL_VALUE,txt,0);
  7075.         }
  7076.         if      (con[n].first == 0)
  7077.         panel_set(    pt[35],PANEL_VALUE,"",0);
  7078.         else
  7079.         {my_itoa(con[n].first,txt);
  7080.          panel_set(    pt[35],PANEL_VALUE,txt,0);
  7081.         }
  7082.         if      (con[n].last == 0)
  7083.         panel_set(    pt[36],PANEL_VALUE,"",0);
  7084.         else
  7085.         {my_itoa(con[n].last,txt);
  7086.          panel_set(    pt[36],PANEL_VALUE,txt,0);
  7087.         }
  7088.         if      (con[n].interval == 0)
  7089.         panel_set(    pt[37],PANEL_VALUE,"",0);
  7090.         else
  7091.         {my_itoa(con[n].interval,txt);
  7092.          panel_set(    pt[37],PANEL_VALUE,txt,0);
  7093.         }
  7094.         if      (con[n].color == 0)
  7095.         panel_set(    pt[34],PANEL_VALUE,"",0);
  7096.         else
  7097.         {my_itoa(con[n].color,txt);
  7098.          panel_set(    pt[34],PANEL_VALUE,txt,0);
  7099.         }
  7100.         panel_set(    pt[29],PANEL_VALUE,con[n].fname,0);
  7101.     reset_contour();
  7102.     reset_mcontour();
  7103.     info_msg("","Contour displayed has been copied from",
  7104.             "another tag but has not been stored.");
  7105.         return;
  7106. }
  7107. /* EOF */
  7108. /* cat > src+obj/p66.c << "EOF" */
  7109. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7110. /* p66: p66 button - contour...decrement tag number by    */
  7111. /*    5                        */
  7112. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7113. /* SCCS information: %W%    %G% - NCSA */
  7114.  
  7115. /* #include "all.h" */
  7116.  
  7117. int    p66()
  7118. {
  7119.     if (nc == 0)
  7120.        {reset_contour();
  7121.         info_msg("","This contour tag already showing.","");
  7122.         return;
  7123.        }
  7124.     if (sw_c[1] == 1 || FALSE == confirm_contour())
  7125.            {nc -= 5;
  7126.         if (nc < 0) nc = 0;
  7127.             p61();
  7128.         reset_contour();
  7129.             return;
  7130.        }
  7131.     reset_contour();
  7132.     panel_set(pb[66],PANEL_LABEL_IMAGE,
  7133.           panel_button_image(pa[7],"*",2,NULL),0);
  7134.     sw_c[1] = 1;
  7135.     warn_msgt();
  7136.     return;
  7137. }
  7138. /* EOF */
  7139. /* cat > src+obj/p67.c << "EOF" */
  7140. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7141. /* p67: p67 button - contour...decrement tag number by    */
  7142. /*    1                        */
  7143. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7144. /* SCCS information: %W%    %G% - NCSA */
  7145.  
  7146. /* #include "all.h" */
  7147.  
  7148. int    p67()
  7149. {
  7150.     if (nc == 0)
  7151.        {reset_contour();
  7152.         info_msg("","This contour tag already showing.","");
  7153.         return;
  7154.        }
  7155.     if (sw_c[2] == 1 || FALSE == confirm_contour())
  7156.            {nc --;
  7157.             p61();
  7158.         reset_contour();
  7159.             return;
  7160.        }
  7161.     reset_contour();
  7162.     panel_set(pb[67],PANEL_LABEL_IMAGE,
  7163.           panel_button_image(pa[7],"*",1,NULL),0);
  7164.     sw_c[2] = 1;
  7165.     warn_msgt();
  7166.     return;
  7167. }
  7168. /* EOF */
  7169. /* cat > src+obj/p68.c << "EOF" */
  7170. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7171. /* p68: p68 button - contour...increment tag number by    */
  7172. /*    1                        */
  7173. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7174. /* SCCS information: %W%    %G% - NCSA */
  7175.  
  7176. /* #include "all.h" */
  7177.  
  7178. int    p68()
  7179. {
  7180.     if (nc == N_contour - 1)
  7181.        {reset_contour();
  7182.         info_msg("","This contour tag already showing.","");
  7183.         return;
  7184.        }
  7185.     if (sw_c[3] == 1 || FALSE == confirm_contour())
  7186.            {nc ++;
  7187.             p61();
  7188.         reset_contour();
  7189.             return;
  7190.        }
  7191.     reset_contour();
  7192.     panel_set(pb[68],PANEL_LABEL_IMAGE,
  7193.           panel_button_image(pa[7],"*",1,NULL),0);
  7194.     sw_c[3] = 1;
  7195.     warn_msgt();
  7196.     return;
  7197. }
  7198. /* EOF */
  7199. /* cat > src+obj/p69.c << "EOF" */
  7200. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7201. /* p69: p69 button - contour...increment tag number by    */
  7202. /*    5                        */
  7203. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7204. /* SCCS information: %W%    %G% - NCSA */
  7205.  
  7206. /* #include "all.h" */
  7207.  
  7208. int    p69()
  7209. {
  7210.     if (nc == N_contour - 1)
  7211.        {reset_contour();
  7212.         info_msg("","This contour tag already showing.","");
  7213.         return;
  7214.        }
  7215.     if (sw_c[4] == 1 || FALSE == confirm_contour())
  7216.            {nc += 5;
  7217.             if (nc > N_contour - 1) nc = N_contour - 1;
  7218.             p61();
  7219.         reset_contour();
  7220.             return;
  7221.        }
  7222.     reset_contour();
  7223.     panel_set(pb[69],PANEL_LABEL_IMAGE,
  7224.           panel_button_image(pa[7],"*",2,NULL),0);
  7225.     sw_c[4] = 1;
  7226.     warn_msgt();
  7227.     return;
  7228. }
  7229. /* EOF */
  7230. /* cat > src+obj/p70.c << "EOF" */
  7231. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7232. /* p70: p70 button - done with vector frame        */
  7233. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7234. /* SCCS information: %W%    %G% - NCSA */
  7235.  
  7236. /* #include "all.h" */
  7237.  
  7238. int 
  7239. p70 ()
  7240. {
  7241.     if (1 == sw_vector || FALSE == confirm_vector ())
  7242.     {
  7243.         reset_vector ();
  7244.         reset_mvector ();
  7245.         window_destroy (pa[8]);
  7246.         window_destroy (fr[8]);
  7247.         panel_set (pb[9], PANEL_SHOW_ITEM, TRUE, 0);
  7248.         info_msg ("", "Vector frame put away.", "");
  7249.         reset_vector ();
  7250.         pa[8] = fr[8] = NULL;
  7251.         return;
  7252.     }
  7253.     reset_vector ();
  7254.     panel_set (pb[70], PANEL_LABEL_IMAGE,
  7255.            panel_button_image (pa[8], "CONFIRM", 7, NULL), 0);
  7256.     sw_vector = 1;
  7257.     warn_msg ();
  7258.     return;
  7259. }
  7260. /* EOF */
  7261. /* cat > src+obj/p71.c << "EOF" */
  7262. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7263. /* p71: p71 button - vector...toggle the FinalPic    */
  7264. /*    switch                        */
  7265. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7266. /* SCCS information: %W%    %G% - NCSA */
  7267.  
  7268. /* #include "all.h" */
  7269.  
  7270. int    p71()
  7271. {
  7272.     reset_vector();
  7273.         if (vec[nv].sw == 1)
  7274.           {vec[nv].sw = 0;
  7275.            panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7276.             panel_button_image(pa[8],
  7277.             "FinalPic toggle (OFF)",21,NULL),
  7278.             0);
  7279.           }
  7280.         else
  7281.           {vec[nv].sw = 1;
  7282.            panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7283.             panel_button_image(pa[8],
  7284.             "FinalPic toggle (ON) ",21,NULL),
  7285.             0);
  7286.       }
  7287.     *(rw_toggle + N_image + N_contour + nv) = TRUE;
  7288.     info_msg("","FinalPic toggled for vector.","");
  7289.         return;
  7290. }
  7291. /* EOF */
  7292. /* cat > src+obj/p72.c << "EOF" */
  7293. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7294. /* p72: p72 button - vector...store displayed values    */
  7295. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7296. /* SCCS information: %W%    %G% - NCSA */
  7297.  
  7298. /* #include "all.h" */
  7299.  
  7300. int    p72()
  7301. {
  7302.     reset_vector();
  7303.         if (FALSE == ok_vector(&vec[N_vector], 1)) return;
  7304.         vec[nv].xpts    = vec[N_vector].xpts;
  7305.         vec[nv].ypts    = vec[N_vector].ypts;
  7306.         vec[nv].xpos    = vec[N_vector].xpos;
  7307.         vec[nv].ypos    = vec[N_vector].ypos;
  7308.         vec[nv].xstart  = vec[N_vector].xstart;
  7309.         vec[nv].xend    = vec[N_vector].xend;
  7310.         vec[nv].xinterval       = vec[N_vector].xinterval;
  7311.         vec[nv].ystart  = vec[N_vector].ystart;
  7312.         vec[nv].yend    = vec[N_vector].yend;
  7313.         vec[nv].yinterval       = vec[N_vector].yinterval;
  7314.         vec[nv].color   = vec[N_vector].color;
  7315.         vec[nv].maxlen  = vec[N_vector].maxlen;
  7316.         vec[nv].xzero   = vec[N_vector].xzero;
  7317.         vec[nv].yzero   = vec[N_vector].yzero;
  7318.         strcpy(vec[nv].xname,vec[N_vector].xname);
  7319.         strcpy(vec[nv].yname,vec[N_vector].yname);
  7320.         vec[nv].xscale  = vec[N_vector].xscale;
  7321.         vec[nv].yscale  = vec[N_vector].yscale;
  7322.     p73();
  7323.     *(rw_toggle + N_image + N_contour + nv) = TRUE;
  7324.         return;
  7325. }
  7326. /* EOF */
  7327. /* cat > src+obj/p73.c << "EOF" */
  7328. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7329. /* p73: p73 button - vector...discard displayed values    */
  7330. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7331. /* SCCS information: %W%    %G% - NCSA */
  7332.  
  7333. /* #include "all.h" */
  7334.  
  7335. int    p73()
  7336. {
  7337.         char            *s;
  7338.     int        n = nv;
  7339.     reset_vector();
  7340.     reset_mvector();
  7341.         strcpy(txt,window_get(fr[8],FRAME_LABEL,0));
  7342.         s = txt;
  7343.         while (*s) s++;
  7344.     while (*s != 'v') s--;
  7345.     s++;
  7346.         my_itoa(nv,s);
  7347.         while (*s) s++;
  7348.         *s++ = '\'';
  7349.         *s++ = ')';
  7350.         *s   = '\0';
  7351.         window_set(     fr[8],FRAME_LABEL,txt,0);
  7352.         if      (vec[n].sw == 0)
  7353.             panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7354.                 panel_button_image(pa[8],
  7355.                 "FinalPic toggle (OFF)",21,NULL),
  7356.                 0);
  7357.         else
  7358.             panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7359.                 panel_button_image(pa[8],
  7360.                 "FinalPic toggle (ON) ",21,NULL),
  7361.                 0);
  7362.         if      (vec[n].xpts == 0)
  7363.         panel_set(    pt[41],PANEL_VALUE,"",0);
  7364.         else
  7365.         {my_itoa(vec[n].xpts,txt);
  7366.          panel_set(    pt[41],PANEL_VALUE,txt,0);
  7367.         }
  7368.         if      (vec[n].ypts == 0)
  7369.         panel_set(    pt[42],PANEL_VALUE,"",0);
  7370.         else
  7371.         {my_itoa(vec[n].ypts,txt);
  7372.          panel_set(    pt[42],PANEL_VALUE,txt,0);
  7373.         }
  7374.         if      (vec[n].xpos == 0)
  7375.         panel_set(    pt[43],PANEL_VALUE,"",0);
  7376.         else
  7377.         {my_itoa(vec[n].xpos,txt);
  7378.          panel_set(    pt[43],PANEL_VALUE,txt,0);
  7379.         }
  7380.         if      (vec[n].ypos == 0)
  7381.         panel_set(    pt[44],PANEL_VALUE,"",0);
  7382.         else
  7383.         {my_itoa(vec[n].ypos,txt);
  7384.          panel_set(    pt[44],PANEL_VALUE,txt,0);
  7385.         }
  7386.         if      (vec[n].xstart == 0)
  7387.         panel_set(    pt[48],PANEL_VALUE,"",0);
  7388.         else
  7389.         {my_itoa(vec[n].xstart,txt);
  7390.          panel_set(    pt[48],PANEL_VALUE,txt,0);
  7391.         }
  7392.         if      (vec[n].ystart == 0)
  7393.         panel_set(    pt[49],PANEL_VALUE,"",0);
  7394.         else
  7395.         {my_itoa(vec[n].ystart,txt);
  7396.          panel_set(    pt[49],PANEL_VALUE,txt,0);
  7397.         }
  7398.         if      (vec[n].xend == 0)
  7399.         panel_set(    pt[50],PANEL_VALUE,"",0);
  7400.         else
  7401.         {my_itoa(vec[n].xend,txt);
  7402.          panel_set(    pt[50],PANEL_VALUE,txt,0);
  7403.         }
  7404.         if      (vec[n].yend == 0)
  7405.         panel_set(    pt[51],PANEL_VALUE,"",0);
  7406.         else
  7407.         {my_itoa(vec[n].yend,txt);
  7408.          panel_set(    pt[51],PANEL_VALUE,txt,0);
  7409.         }
  7410.         if      (vec[n].xinterval == 0)
  7411.         panel_set(    pt[52],PANEL_VALUE,"",0);
  7412.         else
  7413.         {my_itoa(vec[n].xinterval,txt);
  7414.          panel_set(    pt[52],PANEL_VALUE,txt,0);
  7415.         }
  7416.         if      (vec[n].yinterval == 0)
  7417.         panel_set(    pt[53],PANEL_VALUE,"",0);
  7418.         else
  7419.         {my_itoa(vec[n].yinterval,txt);
  7420.          panel_set(    pt[53],PANEL_VALUE,txt,0);
  7421.         }
  7422.         if      (vec[n].color == 0)
  7423.         panel_set(    pt[54],PANEL_VALUE,"",0);
  7424.         else
  7425.         {my_itoa(vec[n].color,txt);
  7426.          panel_set(    pt[54],PANEL_VALUE,txt,0);
  7427.         }
  7428.         if      (vec[n].maxlen == 0)
  7429.         panel_set(    pt[55],PANEL_VALUE,"",0);
  7430.         else
  7431.         {my_itoa(vec[n].maxlen,txt);
  7432.          panel_set(    pt[55],PANEL_VALUE,txt,0);
  7433.         }
  7434.         if      (vec[n].xzero == 0)
  7435.         panel_set(    pt[45],PANEL_VALUE,"",0);
  7436.         else
  7437.         {my_itoa(vec[n].xzero,txt);
  7438.          panel_set(    pt[45],PANEL_VALUE,txt,0);
  7439.         }
  7440.         if      (vec[n].yzero == 0)
  7441.         panel_set(    pt[46],PANEL_VALUE,"",0);
  7442.         else
  7443.         {my_itoa(vec[n].yzero,txt);
  7444.          panel_set(    pt[46],PANEL_VALUE,txt,0);
  7445.         }
  7446.         my_ftoa(vec[n].xscale,4,txt);
  7447.         panel_set(    pt[47],PANEL_VALUE,txt,0);
  7448.         my_ftoa(vec[n].yscale,4,txt);
  7449.         panel_set(    pt[56],PANEL_VALUE,txt,0);
  7450.         panel_set(    pt[39],PANEL_VALUE,vec[n].xname,0);
  7451.         panel_set(    pt[40],PANEL_VALUE,vec[n].yname,0);
  7452.         s = txt;
  7453.         *s++ = 'v';
  7454.         if (nv == 0)    {*s++ = '0'; *s = '\0';}
  7455.         else            my_itoa(nv-1,s);
  7456.         panel_set(      pt[38],PANEL_VALUE,txt,0);
  7457.     info_msg("","Display shows currently stored values for vector.","");
  7458.         return;
  7459. }
  7460. /* EOF */
  7461. /* cat > src+obj/p74.c << "EOF" */
  7462. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7463. /* p74: p74 button - vector...draw it            */
  7464. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7465. /* SCCS information: %W%    %G% - NCSA */
  7466.  
  7467. /* #include "all.h" */
  7468.  
  7469. int    p74()
  7470. {
  7471.     reset_vector();
  7472.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7473.       {info_msg("","Canvas is not up, request ignored.","");
  7474.        return;
  7475.       }
  7476.         if (FALSE == ok_vector(&vec[N_vector], 1)) return;
  7477.         draw_vector(FALSE,&vec[N_vector], 1);
  7478.     info_msg("","Vector drawn.","");
  7479.         return;
  7480. }
  7481. /* EOF */
  7482. /* cat > src+obj/p75.c << "EOF" */
  7483. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7484. /* p75: p75 button - vector...erase it            */
  7485. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7486. /* SCCS information: %W%    %G% - NCSA */
  7487.  
  7488. /* #include "all.h" */
  7489.  
  7490. int    p75()
  7491. {
  7492.     reset_vector();
  7493.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7494.       {info_msg("","Canvas is not up, request ignored.","");
  7495.        return;
  7496.       }
  7497.         if (FALSE == ok_vector(&vec[N_vector], 1)) return;
  7498.         vec[N_vector].color = clear_color;
  7499.         draw_vector(FALSE,&vec[N_vector], 1);
  7500.     info_msg("","Vector erased.","");
  7501.         return;
  7502. }
  7503. /* EOF */
  7504. /* cat > src+obj/p76.c << "EOF" */
  7505. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7506. /* p76: p76 button - vector...mouse draw        */
  7507. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7508. /* SCCS information: %W%    %G% - NCSA */
  7509.  
  7510. /* #include "all.h" */
  7511.  
  7512. int    p76()
  7513. {
  7514.         reset_vector();
  7515.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7516.           {info_msg("","Canvas is not up, request ignored.","");
  7517.            return;
  7518.           }
  7519.     if (csw_vector == FALSE)
  7520.        {if (cpw_check() == TRUE)
  7521.            return;
  7522.         csw_vector = TRUE;
  7523.         sw_draw = TRUE;
  7524.         panel_set(pb[76],PANEL_LABEL_IMAGE,
  7525.               panel_button_image(pa[8],"MS DRAW",8,NULL),0);
  7526.         msg_draw("Vector frame:");
  7527.         return;
  7528.        }
  7529.     if (sw_draw == TRUE)
  7530.        {sw_draw = FALSE;
  7531.         csw_vector = FALSE;
  7532.         panel_set(pb[76],PANEL_LABEL_IMAGE,
  7533.               panel_button_image(pa[8],"ms draw",8,NULL),0);
  7534.         info_msg("","Draw Vectors with mouse deactivated.","");
  7535.         return;
  7536.        }
  7537.     sw_move = FALSE;
  7538.     panel_set(pb[87],PANEL_LABEL_IMAGE,
  7539.            panel_button_image(pa[8],"mouse mv",9,NULL),0);
  7540.     sw_draw = TRUE;
  7541.     panel_set(pb[76],PANEL_LABEL_IMAGE,
  7542.           panel_button_image(pa[8],"MS DRAW",8,NULL),0);
  7543.     msg_draw("Vector frame:");
  7544.     return;
  7545. }
  7546. /* EOF */
  7547. /* cat > src+obj/p77.c << "EOF" */
  7548. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7549. /* p77: p77 button - vector...copy data from another    */
  7550. /*    tag                        */
  7551. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7552. /* SCCS information: %W%    %G% - NCSA */
  7553.  
  7554. /* #include "all.h" */
  7555.  
  7556. int    p77()
  7557. {
  7558.         register int    n;
  7559.         char            *s;
  7560.         strcpy(txt,panel_get(   pt[38],PANEL_VALUE,0));
  7561.         s = txt;
  7562.         if (*s != 'v' || *(s + 1) == '\0')
  7563.       {strcat(txt," is not a valid vector tag.");
  7564.        reset_vector();
  7565.        bad_data(txt);
  7566.        return;
  7567.       }
  7568.         s++;
  7569.         if (FALSE == my_isint(s))
  7570.       {strcat(txt," is not a valid vector tag.");
  7571.        reset_vector();
  7572.        bad_data(txt);
  7573.        return;
  7574.       }
  7575.         n = atoi(s);
  7576.         if (n < 0)
  7577.       {strcat(txt," is not a valid vector tag.");
  7578.        reset_vector();
  7579.        bad_data(txt);
  7580.        return;
  7581.       }
  7582.         if (n >= N_vector)
  7583.       {strcat(txt," is valid, but there are not that many tags.");
  7584.        reset_vector();
  7585.        bad_data(txt);
  7586.        return;
  7587.       }
  7588.     if (nv == n)
  7589.        {reset_vector();
  7590.         info_msg("","This vector tag already showing.","");
  7591.         return;
  7592.        }
  7593.     if (sw_v[0] == 0 && TRUE == confirm_vector())
  7594.        {reset_vector();
  7595.         panel_set(pb[77],PANEL_LABEL_IMAGE,
  7596.               panel_button_image(pa[8],"*",2,NULL),0);
  7597.         sw_v[0] = 1;
  7598.         warn_msgt();
  7599.         return;
  7600.        }
  7601.         if      (vec[n].sw == 0)
  7602.             panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7603.                 panel_button_image(pa[8],
  7604.                 "FinalPic toggle (OFF)",21,NULL),
  7605.                 0);
  7606.         else
  7607.             panel_set(    pb[71],PANEL_LABEL_IMAGE,
  7608.                 panel_button_image(pa[8],
  7609.                 "FinalPic toggle (ON) ",21,NULL),
  7610.                 0);
  7611.         if      (vec[n].xpts == 0)
  7612.         panel_set(    pt[41],PANEL_VALUE,"",0);
  7613.         else
  7614.         {my_itoa(vec[n].xpts,txt);
  7615.          panel_set(    pt[41],PANEL_VALUE,txt,0);
  7616.         }
  7617.         if      (vec[n].ypts == 0)
  7618.         panel_set(    pt[42],PANEL_VALUE,"",0);
  7619.         else
  7620.         {my_itoa(vec[n].ypts,txt);
  7621.          panel_set(    pt[42],PANEL_VALUE,txt,0);
  7622.         }
  7623.         if      (vec[n].xpos == 0)
  7624.         panel_set(    pt[43],PANEL_VALUE,"",0);
  7625.         else
  7626.         {my_itoa(vec[n].xpos,txt);
  7627.          panel_set(    pt[43],PANEL_VALUE,txt,0);
  7628.         }
  7629.         if      (vec[n].ypos == 0)
  7630.         panel_set(    pt[44],PANEL_VALUE,"",0);
  7631.         else
  7632.         {my_itoa(vec[n].ypos,txt);
  7633.          panel_set(    pt[44],PANEL_VALUE,txt,0);
  7634.         }
  7635.         if      (vec[n].xstart == 0)
  7636.         panel_set(    pt[48],PANEL_VALUE,"",0);
  7637.         else
  7638.         {my_itoa(vec[n].xstart,txt);
  7639.          panel_set(    pt[48],PANEL_VALUE,txt,0);
  7640.         }
  7641.         if      (vec[n].ystart == 0)
  7642.         panel_set(    pt[49],PANEL_VALUE,"",0);
  7643.         else
  7644.         {my_itoa(vec[n].ystart,txt);
  7645.          panel_set(    pt[49],PANEL_VALUE,txt,0);
  7646.         }
  7647.         if      (vec[n].xend == 0)
  7648.         panel_set(    pt[50],PANEL_VALUE,"",0);
  7649.         else
  7650.         {my_itoa(vec[n].xend,txt);
  7651.          panel_set(    pt[50],PANEL_VALUE,txt,0);
  7652.         }
  7653.         if      (vec[n].yend == 0)
  7654.         panel_set(    pt[51],PANEL_VALUE,"",0);
  7655.         else
  7656.         {my_itoa(vec[n].yend,txt);
  7657.          panel_set(    pt[51],PANEL_VALUE,txt,0);
  7658.         }
  7659.         if      (vec[n].xinterval == 0)
  7660.         panel_set(    pt[52],PANEL_VALUE,"",0);
  7661.         else
  7662.         {my_itoa(vec[n].xinterval,txt);
  7663.          panel_set(    pt[52],PANEL_VALUE,txt,0);
  7664.         }
  7665.         if      (vec[n].yinterval == 0)
  7666.         panel_set(    pt[53],PANEL_VALUE,"",0);
  7667.         else
  7668.         {my_itoa(vec[n].yinterval,txt);
  7669.          panel_set(    pt[53],PANEL_VALUE,txt,0);
  7670.         }
  7671.         if      (vec[n].color == 0)
  7672.         panel_set(    pt[54],PANEL_VALUE,"",0);
  7673.         else
  7674.         {my_itoa(vec[n].color,txt);
  7675.          panel_set(    pt[54],PANEL_VALUE,txt,0);
  7676.         }
  7677.         if      (vec[n].maxlen == 0)
  7678.         panel_set(    pt[55],PANEL_VALUE,"",0);
  7679.         else
  7680.         {my_itoa(vec[n].maxlen,txt);
  7681.          panel_set(    pt[55],PANEL_VALUE,txt,0);
  7682.         }
  7683.         if      (vec[n].xzero == 0)
  7684.         panel_set(    pt[45],PANEL_VALUE,"",0);
  7685.         else
  7686.         {my_itoa(vec[n].xzero,txt);
  7687.          panel_set(    pt[45],PANEL_VALUE,txt,0);
  7688.         }
  7689.         if      (vec[n].yzero == 0)
  7690.         panel_set(    pt[46],PANEL_VALUE,"",0);
  7691.         else
  7692.         {my_itoa(vec[n].yzero,txt);
  7693.          panel_set(    pt[46],PANEL_VALUE,txt,0);
  7694.         }
  7695.         my_ftoa(vec[n].xscale,4,txt);
  7696.         panel_set(    pt[47],PANEL_VALUE,txt,0);
  7697.         my_ftoa(vec[n].yscale,4,txt);
  7698.         panel_set(    pt[56],PANEL_VALUE,txt,0);
  7699.         panel_set(    pt[39],PANEL_VALUE,vec[n].xname,0);
  7700.         panel_set(    pt[40],PANEL_VALUE,vec[n].yname,0);
  7701.     reset_vector();
  7702.     reset_mvector();
  7703.     info_msg("","Vector displayed has been copied from",
  7704.             "another tag but has not been stored.");
  7705.         return;
  7706. }
  7707. /* EOF */
  7708. /* cat > src+obj/p78.c << "EOF" */
  7709. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7710. /* p78: p78 button - vector...decrement tag number by 5    */
  7711. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7712. /* SCCS information: %W%    %G% - NCSA */
  7713.  
  7714. /* #include "all.h" */
  7715.  
  7716. int    p78()
  7717. {
  7718.     if (nv == 0)
  7719.        {reset_vector();
  7720.         info_msg("","This vector tag already displayed.","");
  7721.         return;
  7722.        }
  7723.     if (sw_v[1] == 1 || FALSE == confirm_vector())
  7724.            {nv -= 5;
  7725.             if (nv < 0) nv = 0;
  7726.             p73();
  7727.         reset_vector();
  7728.             return;
  7729.        }
  7730.     reset_vector();
  7731.     panel_set(pb[78],PANEL_LABEL_IMAGE,
  7732.           panel_button_image(pa[8],"*",2,NULL),0);
  7733.     sw_v[1] = 1;
  7734.     warn_msgt();
  7735.     return;
  7736. }
  7737. /* EOF */
  7738. /* cat > src+obj/p79.c << "EOF" */
  7739. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7740. /* p79: p79 button - vector...decrement tag number by 1    */
  7741. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7742. /* SCCS information: %W%    %G% - NCSA */
  7743.  
  7744. /* #include "all.h" */
  7745.  
  7746. int    p79()
  7747. {
  7748.     if (nv == 0)
  7749.        {reset_vector();
  7750.         info_msg("","This vector tag already displayed.","");
  7751.         return;
  7752.        }
  7753.     if (sw_v[2] == 1 || FALSE == confirm_vector())
  7754.            {nv--;
  7755.             p73();
  7756.         reset_vector();
  7757.             return;
  7758.        }
  7759.     reset_vector();
  7760.     panel_set(pb[79],PANEL_LABEL_IMAGE,
  7761.           panel_button_image(pa[8],"*",1,NULL),0);
  7762.     sw_v[2] = 1;
  7763.     warn_msgt();
  7764.     return;
  7765. }
  7766. /* EOF */
  7767. /* cat > src+obj/p80.c << "EOF" */
  7768. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7769. /* p80: p80 button - vector...increment tag number by 1    */
  7770. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7771. /* SCCS information: %W%    %G% - NCSA */
  7772.  
  7773. /* #include "all.h" */
  7774.  
  7775. int    p80()
  7776. {
  7777.     if (nv == N_vector - 1)
  7778.        {reset_vector();
  7779.         info_msg("","This vector tag already displayed.","");
  7780.         return;
  7781.        }
  7782.     if (sw_v[3] == 1 || FALSE == confirm_vector())
  7783.            {nv++;
  7784.             p73();
  7785.         reset_vector();
  7786.             return;
  7787.        }
  7788.     reset_vector();
  7789.     panel_set(pb[80],PANEL_LABEL_IMAGE,
  7790.           panel_button_image(pa[8],"*",1,NULL),0);
  7791.     sw_v[3] = 1;
  7792.     warn_msgt();
  7793.     return;
  7794. }
  7795. /* EOF */
  7796. /* cat > src+obj/p81.c << "EOF" */
  7797. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7798. /* p81: p81 button - vector...increment tag number by 5    */
  7799. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7800. /* SCCS information: %W%    %G% - NCSA */
  7801.  
  7802. /* #include "all.h" */
  7803.  
  7804. int    p81()
  7805. {
  7806.     if (nv == N_vector - 1)
  7807.        {reset_vector();
  7808.         info_msg("","This vector tag already displayed.","");
  7809.         return;
  7810.        }
  7811.     if (sw_v[4] == 1 || FALSE == confirm_vector())
  7812.            {nv += 5;
  7813.             if (nv > N_vector - 1) nv = N_vector - 1;
  7814.             p73();
  7815.         reset_vector();
  7816.             return;
  7817.        }
  7818.     reset_vector();
  7819.     panel_set(pb[81],PANEL_LABEL_IMAGE,
  7820.           panel_button_image(pa[8],"*",2,NULL),0);
  7821.     sw_v[4] = 1;
  7822.     warn_msgt();
  7823.     return;
  7824. }
  7825. /* EOF */
  7826. /* cat > src+obj/p82.c << "EOF" */
  7827. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7828. /* p82: p82 button - text...mouse draw            */
  7829. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7830. /* SCCS information: %W%    %G% - NCSA */
  7831.  
  7832. /* #include "all.h" */
  7833.  
  7834. int    p82()
  7835. {
  7836.         reset_text();
  7837.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7838.           {info_msg("","Canvas is not up, request ignored.","");
  7839.            return;
  7840.           }
  7841.     if (csw_text == FALSE)
  7842.        {if (cpw_check() == TRUE)
  7843.            return;
  7844.         csw_text = TRUE;
  7845.         sw_draw = TRUE;
  7846.         panel_set(pb[82],PANEL_LABEL_IMAGE,
  7847.               panel_button_image(pa[4],"MS DRAW",8,NULL),0);
  7848.         msg_draw("Text frame:");
  7849.         return;
  7850.        }
  7851.     if (sw_draw == TRUE)
  7852.        {sw_draw = FALSE;
  7853.         csw_text = FALSE;
  7854.         panel_set(pb[82],PANEL_LABEL_IMAGE,
  7855.               panel_button_image(pa[4],"ms draw",8,NULL),0);
  7856.         info_msg("","Draw Texts with mouse deactivated.","");
  7857.         return;
  7858.        }
  7859.     sw_move = FALSE;
  7860.     panel_set(pb[83],PANEL_LABEL_IMAGE,
  7861.            panel_button_image(pa[4],"mouse mv",9,NULL),0);
  7862.     sw_draw = TRUE;
  7863.     panel_set(pb[82],PANEL_LABEL_IMAGE,
  7864.           panel_button_image(pa[4],"MS DRAW",8,NULL),0);
  7865.     msg_draw("Text frame:");
  7866.     return;
  7867. }
  7868. /* EOF */
  7869. /* cat > src+obj/p83.c << "EOF" */
  7870. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7871. /* p83: p83 button - text...mouse move            */
  7872. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7873. /* SCCS information: %W%    %G% - NCSA */
  7874.  
  7875. /* #include "all.h" */
  7876.  
  7877. int    p83()
  7878. {
  7879.         reset_text();
  7880.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7881.           {info_msg("","Canvas is not up, request ignored.","");
  7882.            return;
  7883.           }
  7884.     if (csw_text == FALSE)
  7885.        {if (cpw_check() == TRUE)
  7886.            return;
  7887.         csw_text = TRUE;
  7888.         sw_move = TRUE;
  7889.         panel_set(pb[83],PANEL_LABEL_IMAGE,
  7890.               panel_button_image(pa[4],"MOUSE MV",9,NULL),0);
  7891.         msg_move("Text frame:");
  7892.         return;
  7893.        }
  7894.     if (sw_move == TRUE)
  7895.        {sw_move = FALSE;
  7896.         csw_text = FALSE;
  7897.         panel_set(pb[83],PANEL_LABEL_IMAGE,
  7898.               panel_button_image(pa[4],"mouse mv",9,NULL),0);
  7899.         info_msg("","Move Texts with mouse deactivated.","");
  7900.         return;
  7901.        }
  7902.     sw_draw = FALSE;
  7903.     panel_set(pb[82],PANEL_LABEL_IMAGE,
  7904.            panel_button_image(pa[4],"ms draw",8,NULL),0);
  7905.     sw_move = TRUE;
  7906.     panel_set(pb[83],PANEL_LABEL_IMAGE,
  7907.           panel_button_image(pa[4],"MOUSE MV",9,NULL),0);
  7908.     msg_move("Text frame:");
  7909.     return;
  7910. }
  7911. /* EOF */
  7912. /* cat > src+obj/p84.c << "EOF" */
  7913. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7914. /* p84: p84 button - colorbar...mouse move        */
  7915. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7916. /* SCCS information: %W%    %G% - NCSA */
  7917.  
  7918. /* #include "all.h" */
  7919.  
  7920. int    p84()
  7921. {
  7922.         reset_colorbar();
  7923.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7924.           {info_msg("","Canvas is not up, request ignored.","");
  7925.            return;
  7926.           }
  7927.     if (csw_colorbar == FALSE)
  7928.        {if (cpw_check() == TRUE)
  7929.            return;
  7930.         csw_colorbar = TRUE;
  7931.         sw_move = TRUE;
  7932.         panel_set(pb[84],PANEL_LABEL_IMAGE,
  7933.               panel_button_image(pa[3],"MOUSE MV",9,NULL),0);
  7934.         msg_move("ColorBar frame:");
  7935.         return;
  7936.        }
  7937.     if (sw_move == TRUE)
  7938.        {sw_move = FALSE;
  7939.         csw_colorbar = FALSE;
  7940.         panel_set(pb[84],PANEL_LABEL_IMAGE,
  7941.               panel_button_image(pa[3],"mouse mv",9,NULL),0);
  7942.         info_msg("","Move ColorBar with mouse deactivated.","");
  7943.         return;
  7944.        }
  7945.     sw_draw = FALSE;
  7946.     panel_set(pb[28],PANEL_LABEL_IMAGE,
  7947.            panel_button_image(pa[3],"ms draw",8,NULL),0);
  7948.     sw_move = TRUE;
  7949.     panel_set(pb[84],PANEL_LABEL_IMAGE,
  7950.           panel_button_image(pa[3],"MOUSE MV",9,NULL),0);
  7951.     msg_move("ColorBar frame:");
  7952.     return;
  7953. }
  7954. /* EOF */
  7955. /* cat > src+obj/p85.c << "EOF" */
  7956. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7957. /* p85: p85 button - image...mouse move            */
  7958. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  7959. /* SCCS information: %W%    %G% - NCSA */
  7960.  
  7961. /* #include "all.h" */
  7962.  
  7963. int    p85()
  7964. {
  7965.         reset_image();
  7966.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  7967.           {info_msg("","Canvas is not up, request ignored.","");
  7968.            return;
  7969.           }
  7970.     if (csw_image == FALSE)
  7971.        {if (cpw_check() == TRUE)
  7972.            return;
  7973.         csw_image = TRUE;
  7974.         sw_move = TRUE;
  7975.         panel_set(pb[85],PANEL_LABEL_IMAGE,
  7976.               panel_button_image(pa[6],"MOUSE MV",9,NULL),0);
  7977.         msg_move("Image frame:");
  7978.         return;
  7979.        }
  7980.     if (sw_move == TRUE)
  7981.        {sw_move = FALSE;
  7982.         csw_image = FALSE;
  7983.         panel_set(pb[85],PANEL_LABEL_IMAGE,
  7984.               panel_button_image(pa[6],"mouse mv",9,NULL),0);
  7985.         info_msg("","Move Images with mouse deactivated.","");
  7986.         return;
  7987.        }
  7988.     sw_draw = FALSE;
  7989.     panel_set(pb[52],PANEL_LABEL_IMAGE,
  7990.            panel_button_image(pa[6],"ms draw",8,NULL),0);
  7991.     sw_move = TRUE;
  7992.     panel_set(pb[85],PANEL_LABEL_IMAGE,
  7993.           panel_button_image(pa[6],"MOUSE MV",9,NULL),0);
  7994.     msg_move("Image frame:");
  7995.     return;
  7996. }
  7997. /* EOF */
  7998. /* cat > src+obj/p86.c << "EOF" */
  7999. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8000. /* p86: p86 button - contour...mouse move        */
  8001. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8002. /* SCCS information: %W%    %G% - NCSA */
  8003.  
  8004. /* #include "all.h" */
  8005.  
  8006. int    p86()
  8007. {
  8008.         reset_contour();
  8009.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  8010.           {info_msg("","Canvas is not up, request ignored.","");
  8011.            return;
  8012.           }
  8013.     if (csw_contour == FALSE)
  8014.        {if (cpw_check() == TRUE)
  8015.            return;
  8016.         csw_contour = TRUE;
  8017.         sw_move = TRUE;
  8018.         panel_set(pb[86],PANEL_LABEL_IMAGE,
  8019.               panel_button_image(pa[7],"MOUSE MV",9,NULL),0);
  8020.         msg_move("Contour frame:");
  8021.         return;
  8022.        }
  8023.     if (sw_move == TRUE)
  8024.        {sw_move = FALSE;
  8025.         csw_contour = FALSE;
  8026.         panel_set(pb[86],PANEL_LABEL_IMAGE,
  8027.               panel_button_image(pa[7],"mouse mv",9,NULL),0);
  8028.         info_msg("","Move Contours with mouse deactivated.","");
  8029.         return;
  8030.        }
  8031.     sw_draw = FALSE;
  8032.     panel_set(pb[64],PANEL_LABEL_IMAGE,
  8033.            panel_button_image(pa[7],"ms draw",8,NULL),0);
  8034.     sw_move = TRUE;
  8035.     panel_set(pb[86],PANEL_LABEL_IMAGE,
  8036.           panel_button_image(pa[7],"MOUSE MV",9,NULL),0);
  8037.     msg_move("Contour frame:");
  8038.     return;
  8039. }
  8040. /* EOF */
  8041. /* cat > src+obj/p87.c << "EOF" */
  8042. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8043. /* p87: p87 button - vector...mouse move        */
  8044. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8045. /* SCCS information: %W%    %G% - NCSA */
  8046.  
  8047. /* #include "all.h" */
  8048.  
  8049. int    p87()
  8050. {
  8051.         reset_vector();
  8052.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  8053.           {info_msg("","Canvas is not up, request ignored.","");
  8054.            return;
  8055.           }
  8056.     if (csw_vector == FALSE)
  8057.        {if (cpw_check() == TRUE)
  8058.            return;
  8059.         csw_vector = TRUE;
  8060.         sw_move = TRUE;
  8061.         panel_set(pb[87],PANEL_LABEL_IMAGE,
  8062.               panel_button_image(pa[8],"MOUSE MV",9,NULL),0);
  8063.         msg_move("Vector frame:");
  8064.         return;
  8065.        }
  8066.     if (sw_move == TRUE)
  8067.        {sw_move = FALSE;
  8068.         csw_vector = FALSE;
  8069.         panel_set(pb[87],PANEL_LABEL_IMAGE,
  8070.               panel_button_image(pa[8],"mouse mv",9,NULL),0);
  8071.         info_msg("","Move Vectors with mouse deactivated.","");
  8072.         return;
  8073.        }
  8074.     sw_draw = FALSE;
  8075.     panel_set(pb[76],PANEL_LABEL_IMAGE,
  8076.            panel_button_image(pa[8],"ms draw",8,NULL),0);
  8077.     sw_move = TRUE;
  8078.     panel_set(pb[87],PANEL_LABEL_IMAGE,
  8079.           panel_button_image(pa[8],"MOUSE MV",9,NULL),0);
  8080.     msg_move("Vector frame:");
  8081.     return;
  8082. }
  8083. /* EOF */
  8084. /* cat > src+obj/p88.c << "EOF" */
  8085. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8086. /* p88: p88 button - feature...done            */
  8087. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8088. /* SCCS information: %W%    %G% - NCSA */
  8089.  
  8090. /* #include "all.h" */
  8091.  
  8092. int 
  8093. p88 ()
  8094. {
  8095.     window_destroy (pa[9]);
  8096.     window_destroy (fr[9]);
  8097.     pa[9] = fr[9] = NULL;
  8098.     panel_set (pb[10], PANEL_SHOW_ITEM, TRUE, 0);
  8099.     info_msg ("", "Features frame put away.", "");
  8100.     return;
  8101. }
  8102. /* EOF */
  8103. /* cat > src+obj/p89.c << "EOF" */
  8104. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8105. /* p89: p89 button - feature...draw            */
  8106. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8107. /* SCCS information: %W%    %G% - NCSA */
  8108.  
  8109. /* #include "all.h" */
  8110.  
  8111. int    p89()
  8112. {
  8113.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  8114.           {info_msg("","Canvas is not up, request ignored.","");
  8115.            return;
  8116.           }
  8117.     if (0 == draw_feature(&feat[nf],nf,TRUE))
  8118.        info_msg("","Features drawn for this tag.","");
  8119.     return;
  8120. }
  8121. /* EOF */
  8122. /* cat > src+obj/p90.c << "EOF" */
  8123. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8124. /* p90: p90 button - feature...erase            */
  8125. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8126. /* SCCS information: %W%    %G% - NCSA */
  8127.  
  8128. /* #include "all.h" */
  8129.  
  8130. int    p90()
  8131. {
  8132.         if (FALSE == (int)window_get(c_frame,WIN_SHOW,0))
  8133.           {info_msg("","Canvas is not up, request ignored.","");
  8134.            return;
  8135.           }
  8136.     if (0 == draw_feature(&feat[nf],nf,FALSE))
  8137.        info_msg("","Features erased for this tag.","");
  8138.     return;
  8139. }
  8140. /* EOF */
  8141. /* cat > src+obj/p91.c << "EOF" */
  8142. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8143. /* p91: p91 button  - feature...x-axis select        */
  8144. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8145. /* SCCS information: %W%    %G% - NCSA */
  8146.  
  8147. /* #include "all.h" */
  8148.  
  8149. int    p91()
  8150. {
  8151.     resetb_feature();
  8152.     panel_set(pb[91],PANEL_LABEL_IMAGE,
  8153.           panel_button_image(pa[9],"X-AXIS",7,NULL),0);
  8154.     nosho_feature();
  8155.     panel_set(pm[4],PANEL_LABEL_STRING,"X-AXIS",0);
  8156.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8157.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8158.     panel_set(pb[107],PANEL_SHOW_ITEM,TRUE,0);
  8159.     panel_set(pb[108],PANEL_SHOW_ITEM,TRUE,0);
  8160.     if (feat[nf].xax_bot == TRUE)
  8161.        panel_set(pb[107],PANEL_LABEL_IMAGE,
  8162.              panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8163.     else
  8164.        panel_set(pb[107],PANEL_LABEL_IMAGE,
  8165.              panel_button_image(pa[9],"bot side OFF",14,NULL),0);
  8166.     if (feat[nf].xax_top == TRUE)
  8167.        panel_set(pb[108],PANEL_LABEL_IMAGE,
  8168.              panel_button_image(pa[9],"top side ON",14,NULL),0);
  8169.     else
  8170.        panel_set(pb[108],PANEL_LABEL_IMAGE,
  8171.              panel_button_image(pa[9],"top side OFF",14,NULL),0);
  8172.     panel_set(ps[0],PANEL_VALUE,feat[nf].xax_thick,0);
  8173.     panel_set(ps[1],PANEL_VALUE,feat[nf].xax_color,0);
  8174.     return;
  8175. }
  8176. /* EOF */
  8177. /* cat > src+obj/p92.c << "EOF" */
  8178. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8179. /* p92: p92 button - feature...x-axis switch        */
  8180. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8181. /* SCCS information: %W%    %G% - NCSA */
  8182.  
  8183. /* #include "all.h" */
  8184.  
  8185. int    p92()
  8186. {
  8187.     if (feat[nf].xax_sw == TRUE)
  8188.        {feat[nf].xax_sw = FALSE;
  8189.         panel_set(pb[92],PANEL_LABEL_IMAGE,
  8190.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8191.        }
  8192.     else
  8193.        {feat[nf].xax_sw = TRUE;
  8194.         panel_set(pb[92],PANEL_LABEL_IMAGE,
  8195.               panel_button_image(pa[9],"ON",3,NULL),0);
  8196.        }
  8197.     return;
  8198. }
  8199. /* EOF */
  8200. /* cat > src+obj/p93.c << "EOF" */
  8201. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8202. /* p93: p93 button - feature...y-axis select        */
  8203. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8204. /* SCCS information: %W%    %G% - NCSA */
  8205.  
  8206. /* #include "all.h" */
  8207.  
  8208. int    p93()
  8209. {
  8210.         resetb_feature();
  8211.         panel_set(pb[93],PANEL_LABEL_IMAGE,
  8212.                   panel_button_image(pa[9],"Y-AXIS",7,NULL),0);
  8213.         nosho_feature();
  8214.         panel_set(pm[4],PANEL_LABEL_STRING,"Y-AXIS",0);
  8215.         panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8216.         panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8217.         panel_set(pb[107],PANEL_SHOW_ITEM,TRUE,0);
  8218.         panel_set(pb[108],PANEL_SHOW_ITEM,TRUE,0);
  8219.         if (feat[nf].yax_left == TRUE)
  8220.            panel_set(pb[107],PANEL_LABEL_IMAGE,
  8221.                      panel_button_image(pa[9],"left side ON",14,NULL),0);
  8222.         else
  8223.            panel_set(pb[107],PANEL_LABEL_IMAGE,
  8224.                      panel_button_image(pa[9],"left side OFF",14,NULL),0);
  8225.         if (feat[nf].yax_right == TRUE)
  8226.            panel_set(pb[108],PANEL_LABEL_IMAGE,
  8227.                      panel_button_image(pa[9],"right side ON",14,NULL),0);
  8228.         else
  8229.            panel_set(pb[108],PANEL_LABEL_IMAGE,
  8230.                      panel_button_image(pa[9],"right side OFF",14,NULL),0);
  8231.         panel_set(ps[0],PANEL_VALUE,feat[nf].yax_thick,0);
  8232.         panel_set(ps[1],PANEL_VALUE,feat[nf].yax_color,0);
  8233.     return;
  8234. }
  8235. /* EOF */
  8236. /* cat > src+obj/p94.c << "EOF" */
  8237. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8238. /* p94: p94 button - feature...y-axis switch        */
  8239. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8240. /* SCCS information: %W%    %G% - NCSA */
  8241.  
  8242. /* #include "all.h" */
  8243.  
  8244. int    p94()
  8245. {
  8246.     if (feat[nf].yax_sw == TRUE)
  8247.        {feat[nf].yax_sw = FALSE;
  8248.         panel_set(pb[94],PANEL_LABEL_IMAGE,
  8249.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8250.        }
  8251.     else
  8252.        {feat[nf].yax_sw = TRUE;
  8253.         panel_set(pb[94],PANEL_LABEL_IMAGE,
  8254.               panel_button_image(pa[9],"ON",3,NULL),0);
  8255.        }
  8256.     return;
  8257. }
  8258. /* EOF */
  8259. /* cat > src+obj/p95.c << "EOF" */
  8260. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8261. /* p95: p95 button - feature...x-grid select        */
  8262. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8263. /* SCCS information: %W%    %G% - NCSA */
  8264.  
  8265. /* #include "all.h" */
  8266.  
  8267. int    p95()
  8268. {
  8269.     resetb_feature();
  8270.     panel_set(pb[95],PANEL_LABEL_IMAGE,
  8271.           panel_button_image(pa[9],"X-GRID",7,NULL),0);
  8272.     nosho_feature();
  8273.     panel_set(pm[4],PANEL_LABEL_STRING,"X-GRID",0);
  8274.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8275.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8276.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8277.     panel_set(ps[0],PANEL_VALUE,feat[nf].xgr_thick,0);
  8278.     panel_set(ps[1],PANEL_VALUE,feat[nf].xgr_color,0);
  8279.     panel_set(ps[2],PANEL_VALUE,feat[nf].xgr_space,0);
  8280.     return;
  8281. }
  8282. /* EOF */
  8283. /* cat > src+obj/p96.c << "EOF" */
  8284. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8285. /* p96: p96 button - feature...x-grid switch        */
  8286. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8287. /* SCCS information: %W%    %G% - NCSA */
  8288.  
  8289. /* #include "all.h" */
  8290.  
  8291. int    p96()
  8292. {
  8293.     if (feat[nf].xgr_sw == TRUE)
  8294.        {feat[nf].xgr_sw = FALSE;
  8295.         panel_set(pb[96],PANEL_LABEL_IMAGE,
  8296.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8297.        }
  8298.     else
  8299.        {feat[nf].xgr_sw = TRUE;
  8300.         panel_set(pb[96],PANEL_LABEL_IMAGE,
  8301.               panel_button_image(pa[9],"ON",3,NULL),0);
  8302.        }
  8303.     return;
  8304. }
  8305. /* EOF */
  8306. /* cat > src+obj/p97.c << "EOF" */
  8307. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8308. /* p97: p97 button - feature...y-grid select        */
  8309. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8310. /* SCCS information: %W%    %G% - NCSA */
  8311.  
  8312. /* #include "all.h" */
  8313.  
  8314. int    p97()
  8315. {
  8316.     resetb_feature();
  8317.     panel_set(pb[97],PANEL_LABEL_IMAGE,
  8318.           panel_button_image(pa[9],"Y-GRID",7,NULL),0);
  8319.     nosho_feature();
  8320.     panel_set(pm[4],PANEL_LABEL_STRING,"Y-GRID",0);
  8321.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8322.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8323.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8324.     panel_set(ps[0],PANEL_VALUE,feat[nf].ygr_thick,0);
  8325.     panel_set(ps[1],PANEL_VALUE,feat[nf].ygr_color,0);
  8326.     panel_set(ps[2],PANEL_VALUE,feat[nf].ygr_space,0);
  8327.     return;
  8328. }
  8329. /* EOF */
  8330. /* cat > src+obj/p98.c << "EOF" */
  8331. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8332. /* p98: p98 button - feature...y-grid switch        */
  8333. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8334. /* SCCS information: %W%    %G% - NCSA */
  8335.  
  8336. /* #include "all.h" */
  8337.  
  8338. int    p98()
  8339. {
  8340.     if (feat[nf].ygr_sw == TRUE)
  8341.        {feat[nf].ygr_sw = FALSE;
  8342.         panel_set(pb[98],PANEL_LABEL_IMAGE,
  8343.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8344.        }
  8345.     else
  8346.        {feat[nf].ygr_sw = TRUE;
  8347.         panel_set(pb[98],PANEL_LABEL_IMAGE,
  8348.               panel_button_image(pa[9],"ON",3,NULL),0);
  8349.        }
  8350.     return;
  8351. }
  8352. /* EOF */
  8353. /* cat > src+obj/p99.c << "EOF" */
  8354. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8355. /* p99: p99 button - feature...x-ticks1 select        */
  8356. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8357. /* SCCS information: %W%    %G% - NCSA */
  8358.  
  8359. /* #include "all.h" */
  8360.  
  8361. int    p99()
  8362. {
  8363.     resetb_feature();
  8364.     panel_set(pb[99],PANEL_LABEL_IMAGE,
  8365.           panel_button_image(pa[9],"X-TIC1",7,NULL),0);
  8366.     nosho_feature();
  8367.     panel_set(pm[4],PANEL_LABEL_STRING,"X-TIC1",0);
  8368.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8369.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8370.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8371.     panel_set(ps[3],PANEL_SHOW_ITEM,TRUE,0);
  8372.     panel_set(pb[110],PANEL_SHOW_ITEM,TRUE,0);
  8373.     panel_set(pb[111],PANEL_SHOW_ITEM,TRUE,0);
  8374.     panel_set(pb[112],PANEL_SHOW_ITEM,TRUE,0);
  8375.     if (feat[nf].xt1_bot == TRUE)
  8376.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8377.              panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8378.     else
  8379.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8380.              panel_button_image(pa[9],"bot side OFF",14,NULL),0);
  8381.     if (feat[nf].xt1_top == TRUE)
  8382.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8383.              panel_button_image(pa[9],"top side ON",14,NULL),0);
  8384.     else
  8385.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8386.              panel_button_image(pa[9],"top side OFF",14,NULL),0);
  8387.     if (feat[nf].xt1_direc == TRUE)
  8388.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8389.              panel_button_image(pa[9],"now OUT",7,NULL),0);
  8390.     else
  8391.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8392.              panel_button_image(pa[9],"now IN",7,NULL),0);
  8393.     panel_set(ps[0],PANEL_VALUE,feat[nf].xt1_thick,0);
  8394.     panel_set(ps[1],PANEL_VALUE,feat[nf].xt1_color,0);
  8395.     panel_set(ps[2],PANEL_VALUE,feat[nf].xt1_space,0);
  8396.     panel_set(ps[3],PANEL_VALUE,feat[nf].xt1_len,0);
  8397.     return;
  8398. }
  8399. /* EOF */
  8400. /* cat > src+obj/p100.c << "EOF" */
  8401. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8402. /* p100: p100 button - feature...x-ticks1 switch    */
  8403. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8404. /* SCCS information: %W%    %G% - NCSA */
  8405.  
  8406. /* #include "all.h" */
  8407.  
  8408. int    p100()
  8409. {
  8410.     if (feat[nf].xt1_sw == TRUE)
  8411.        {feat[nf].xt1_sw = FALSE;
  8412.         panel_set(pb[100],PANEL_LABEL_IMAGE,
  8413.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8414.        }
  8415.     else
  8416.        {feat[nf].xt1_sw = TRUE;
  8417.         panel_set(pb[100],PANEL_LABEL_IMAGE,
  8418.               panel_button_image(pa[9],"ON",3,NULL),0);
  8419.        }
  8420.     return;
  8421. }
  8422. /* EOF */
  8423. /* cat > src+obj/p101.c << "EOF" */
  8424. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8425. /* p101: p101 button - feature...y-ticks1 select    */
  8426. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8427. /* SCCS information: %W%    %G% - NCSA */
  8428.  
  8429. /* #include "all.h" */
  8430.  
  8431. int    p101()
  8432. {
  8433.     resetb_feature();
  8434.     panel_set(pb[101],PANEL_LABEL_IMAGE,
  8435.           panel_button_image(pa[9],"Y-TIC1",7,NULL),0);
  8436.     nosho_feature();
  8437.     panel_set(pm[4],PANEL_LABEL_STRING,"Y-TIC1",0);
  8438.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8439.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8440.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8441.     panel_set(ps[3],PANEL_SHOW_ITEM,TRUE,0);
  8442.     panel_set(pb[110],PANEL_SHOW_ITEM,TRUE,0);
  8443.     panel_set(pb[111],PANEL_SHOW_ITEM,TRUE,0);
  8444.     panel_set(pb[112],PANEL_SHOW_ITEM,TRUE,0);
  8445.     if (feat[nf].yt1_left == TRUE)
  8446.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8447.              panel_button_image(pa[9],"left side ON",14,NULL),0);
  8448.     else
  8449.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8450.              panel_button_image(pa[9],"left side OFF",14,NULL),0);
  8451.     if (feat[nf].yt1_right == TRUE)
  8452.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8453.              panel_button_image(pa[9],"right side ON",14,NULL),0);
  8454.     else
  8455.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8456.              panel_button_image(pa[9],"right side OFF",14,NULL),0);
  8457.     if (feat[nf].yt1_direc == TRUE)
  8458.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8459.              panel_button_image(pa[9],"now OUT",7,NULL),0);
  8460.     else
  8461.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8462.              panel_button_image(pa[9],"now IN",7,NULL),0);
  8463.     panel_set(ps[0],PANEL_VALUE,feat[nf].yt1_thick,0);
  8464.     panel_set(ps[1],PANEL_VALUE,feat[nf].yt1_color,0);
  8465.     panel_set(ps[2],PANEL_VALUE,feat[nf].yt1_space,0);
  8466.     panel_set(ps[3],PANEL_VALUE,feat[nf].yt1_len,0);
  8467.     return;
  8468. }
  8469. /* EOF */
  8470. /* cat > src+obj/p102.c << "EOF" */
  8471. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8472. /* p102: p102 button - feature...y-ticks1 switch    */
  8473. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8474. /* SCCS information: %W%    %G% - NCSA */
  8475.  
  8476. /* #include "all.h" */
  8477.  
  8478. int    p102()
  8479. {
  8480.     if (feat[nf].yt1_sw == TRUE)
  8481.        {feat[nf].yt1_sw = FALSE;
  8482.         panel_set(pb[102],PANEL_LABEL_IMAGE,
  8483.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8484.        }
  8485.     else
  8486.        {feat[nf].yt1_sw = TRUE;
  8487.         panel_set(pb[102],PANEL_LABEL_IMAGE,
  8488.               panel_button_image(pa[9],"ON",3,NULL),0);
  8489.        }
  8490.     return;
  8491. }
  8492. /* EOF */
  8493. /* cat > src+obj/p103.c << "EOF" */
  8494. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8495. /* p103: p103 button - feature...x-tick2 select        */
  8496. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8497. /* SCCS information: %W%    %G% - NCSA */
  8498.  
  8499. /* #include "all.h" */
  8500.  
  8501. int    p103()
  8502. {
  8503.     resetb_feature();
  8504.     panel_set(pb[103],PANEL_LABEL_IMAGE,
  8505.           panel_button_image(pa[9],"X-TIC2",7,NULL),0);
  8506.     nosho_feature();
  8507.     panel_set(pm[4],PANEL_LABEL_STRING,"X-TIC2",0);
  8508.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8509.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8510.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8511.     panel_set(ps[3],PANEL_SHOW_ITEM,TRUE,0);
  8512.     panel_set(pb[110],PANEL_SHOW_ITEM,TRUE,0);
  8513.     panel_set(pb[111],PANEL_SHOW_ITEM,TRUE,0);
  8514.     panel_set(pb[112],PANEL_SHOW_ITEM,TRUE,0);
  8515.     if (feat[nf].xt2_bot == TRUE)
  8516.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8517.              panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8518.     else
  8519.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8520.              panel_button_image(pa[9],"bot side OFF",14,NULL),0);
  8521.     if (feat[nf].xt2_top == TRUE)
  8522.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8523.              panel_button_image(pa[9],"top side ON",14,NULL),0);
  8524.     else
  8525.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8526.              panel_button_image(pa[9],"top side OFF",14,NULL),0);
  8527.     if (feat[nf].xt2_direc == TRUE)
  8528.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8529.              panel_button_image(pa[9],"now OUT",7,NULL),0);
  8530.     else
  8531.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8532.              panel_button_image(pa[9],"now IN",7,NULL),0);
  8533.     panel_set(ps[0],PANEL_VALUE,feat[nf].xt2_thick,0);
  8534.     panel_set(ps[1],PANEL_VALUE,feat[nf].xt2_color,0);
  8535.     panel_set(ps[2],PANEL_VALUE,feat[nf].xt2_space,0);
  8536.     panel_set(ps[3],PANEL_VALUE,feat[nf].xt2_len,0);
  8537.     return;
  8538. }
  8539. /* EOF */
  8540. /* cat > src+obj/p104.c << "EOF" */
  8541. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8542. /* p104: p104 button - feature...x-ticks2 switch    */
  8543. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8544. /* SCCS information: %W%    %G% - NCSA */
  8545.  
  8546. /* #include "all.h" */
  8547.  
  8548. int    p104()
  8549. {
  8550.     if (feat[nf].xt2_sw == TRUE)
  8551.        {feat[nf].xt2_sw = FALSE;
  8552.         panel_set(pb[104],PANEL_LABEL_IMAGE,
  8553.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8554.        }
  8555.     else
  8556.        {feat[nf].xt2_sw = TRUE;
  8557.         panel_set(pb[104],PANEL_LABEL_IMAGE,
  8558.               panel_button_image(pa[9],"ON",3,NULL),0);
  8559.        }
  8560.     return;
  8561. }
  8562. /* EOF */
  8563. /* cat > src+obj/p105.c << "EOF" */
  8564. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8565. /* p105: p105 button - feature...y-ticks2 select    */
  8566. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8567. /* SCCS information: %W%    %G% - NCSA */
  8568.  
  8569. /* #include "all.h" */
  8570.  
  8571. int    p105()
  8572. {
  8573.     resetb_feature();
  8574.     panel_set(pb[105],PANEL_LABEL_IMAGE,
  8575.           panel_button_image(pa[9],"Y-TIC2",7,NULL),0);
  8576.     nosho_feature();
  8577.     panel_set(pm[4],PANEL_LABEL_STRING,"Y-TIC2",0);
  8578.     panel_set(ps[0],PANEL_SHOW_ITEM,TRUE,0);
  8579.     panel_set(ps[1],PANEL_SHOW_ITEM,TRUE,0);
  8580.     panel_set(ps[2],PANEL_SHOW_ITEM,TRUE,0);
  8581.     panel_set(ps[3],PANEL_SHOW_ITEM,TRUE,0);
  8582.     panel_set(pb[110],PANEL_SHOW_ITEM,TRUE,0);
  8583.     panel_set(pb[111],PANEL_SHOW_ITEM,TRUE,0);
  8584.     panel_set(pb[112],PANEL_SHOW_ITEM,TRUE,0);
  8585.     if (feat[nf].yt2_left == TRUE)
  8586.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8587.              panel_button_image(pa[9],"left side ON",14,NULL),0);
  8588.     else
  8589.        panel_set(pb[111],PANEL_LABEL_IMAGE,
  8590.              panel_button_image(pa[9],"left side OFF",14,NULL),0);
  8591.     if (feat[nf].yt2_right == TRUE)
  8592.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8593.              panel_button_image(pa[9],"right side ON",14,NULL),0);
  8594.     else
  8595.        panel_set(pb[112],PANEL_LABEL_IMAGE,
  8596.              panel_button_image(pa[9],"right side OFF",14,NULL),0);
  8597.     if (feat[nf].yt2_direc == TRUE)
  8598.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8599.              panel_button_image(pa[9],"now OUT",7,NULL),0);
  8600.     else
  8601.        panel_set(pb[110],PANEL_LABEL_IMAGE,
  8602.              panel_button_image(pa[9],"now IN",7,NULL),0);
  8603.     panel_set(ps[0],PANEL_VALUE,feat[nf].yt2_thick,0);
  8604.     panel_set(ps[1],PANEL_VALUE,feat[nf].yt2_color,0);
  8605.     panel_set(ps[2],PANEL_VALUE,feat[nf].yt2_space,0);
  8606.     panel_set(ps[3],PANEL_VALUE,feat[nf].yt2_len,0);
  8607.     return;
  8608. }
  8609. /* EOF */
  8610. /* cat > src+obj/p106.c << "EOF" */
  8611. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8612. /* p106: p106 button - feature...y-ticks2 switch    */
  8613. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8614. /* SCCS information: %W%    %G% - NCSA */
  8615.  
  8616. /* #include "all.h" */
  8617.  
  8618. int    p106()
  8619. {
  8620.     if (feat[nf].yt2_sw == TRUE)
  8621.        {feat[nf].yt2_sw = FALSE;
  8622.         panel_set(pb[106],PANEL_LABEL_IMAGE,
  8623.               panel_button_image(pa[9],"OFF",3,NULL),0);
  8624.        }
  8625.     else
  8626.        {feat[nf].yt2_sw = TRUE;
  8627.         panel_set(pb[106],PANEL_LABEL_IMAGE,
  8628.               panel_button_image(pa[9],"ON",3,NULL),0);
  8629.        }
  8630.     return;
  8631. }
  8632. /* EOF */
  8633. /* cat > src+obj/p107.c << "EOF" */
  8634. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8635. /* p107: p107 button - feature...axis left side switch    */
  8636. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8637. /* SCCS information: %W%    %G% - NCSA */
  8638.  
  8639. /* #include "all.h" */
  8640.  
  8641. int    p107()
  8642. {
  8643.     char        c[8];
  8644.     strcpy(c,panel_get(pm[4],PANEL_LABEL_STRING,0));
  8645.     if (strcmp(c,"X-AXIS") == 0)
  8646.        {if (feat[nf].xax_bot == FALSE)
  8647.            {feat[nf].xax_bot = TRUE;
  8648.         panel_set(pb[107],PANEL_LABEL_IMAGE,
  8649.               panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8650.            }
  8651.         else
  8652.            {feat[nf].xax_bot = FALSE; 
  8653.                 panel_set(pb[107],PANEL_LABEL_IMAGE, 
  8654.                           panel_button_image(pa[9],"bot side OFF",14,NULL),0); 
  8655.                }
  8656.        }
  8657.     else if (strcmp(c,"Y-AXIS") == 0)
  8658.        {if (feat[nf].yax_left == FALSE)
  8659.            {feat[nf].yax_left = TRUE;
  8660.         panel_set(pb[107],PANEL_LABEL_IMAGE,
  8661.               panel_button_image(pa[9],"left side ON",14,NULL),0);
  8662.            }
  8663.         else
  8664.            {feat[nf].yax_left = FALSE; 
  8665.                 panel_set(pb[107],PANEL_LABEL_IMAGE, 
  8666.                           panel_button_image(pa[9],"left side OFF",14,NULL),0); 
  8667.                }
  8668.        }
  8669.     else
  8670.        bad_data("It is not possible to get this feature error message, p107");
  8671.     return;
  8672. }
  8673. /* EOF */
  8674. /* cat > src+obj/p108.c << "EOF" */
  8675. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8676. /* p108: p108 button - feature...axis right side switch    */
  8677. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8678. /* SCCS information: %W%    %G% - NCSA */
  8679.  
  8680. /* #include "all.h" */
  8681.  
  8682. int    p108()
  8683. {
  8684.     char        c[8];
  8685.     strcpy(c,panel_get(pm[4],PANEL_LABEL_STRING,0));
  8686.     if (strcmp(c,"X-AXIS") == 0)
  8687.        {if (feat[nf].xax_top == FALSE)
  8688.            {feat[nf].xax_top = TRUE;
  8689.         panel_set(pb[108],PANEL_LABEL_IMAGE,
  8690.               panel_button_image(pa[9],"top side ON",14,NULL),0);
  8691.            }
  8692.         else
  8693.            {feat[nf].xax_top = FALSE; 
  8694.                 panel_set(pb[108],PANEL_LABEL_IMAGE, 
  8695.                           panel_button_image(pa[9],"top side OFF",14,NULL),0); 
  8696.                }
  8697.        }
  8698.     else if (strcmp(c,"Y-AXIS") == 0)
  8699.        {if (feat[nf].yax_right == FALSE)
  8700.            {feat[nf].yax_right = TRUE;
  8701.         panel_set(pb[108],PANEL_LABEL_IMAGE,
  8702.               panel_button_image(pa[9],"right side ON",14,NULL),0);
  8703.            }
  8704.         else
  8705.            {feat[nf].yax_right = FALSE; 
  8706.                 panel_set(pb[108],PANEL_LABEL_IMAGE, 
  8707.                           panel_button_image(pa[9],"right side OFF",14,NULL),0); 
  8708.                }
  8709.        }
  8710.     else
  8711.        bad_data("It is not possible to get this feature error message, p108");
  8712.     return;
  8713. }
  8714. /* EOF */
  8715. /* cat > src+obj/p109.c << "EOF" */
  8716. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8717. /* p109: p109 button - feature...specify tag        */
  8718. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8719. /* SCCS information: %W%    %G% - NCSA */
  8720.  
  8721. /* #include "all.h" */
  8722.  
  8723. int    p109()
  8724. {
  8725.     char        c[10],
  8726.             *s,*t;
  8727.     register int    n;
  8728.     strcpy(c,panel_get(pt[57],PANEL_VALUE,0));
  8729.     s = c;
  8730.     if (*s == '\0')
  8731.        {bad_data("No tag given, request ignored.");
  8732.         return;
  8733.        }
  8734.     if (*s != 'i' && *s != 'c' && *s != 'v')
  8735.        {strcpy(txt,c);
  8736.         strcat(txt,":  does not begin with i, c, or v, request ignored.");
  8737.         bad_data(txt);
  8738.         panel_set(pt[57],PANEL_VALUE,"",0);
  8739.         return;
  8740.        }
  8741.     s++;
  8742.     if (FALSE == my_isint(s))
  8743.        {strcpy(txt,c);
  8744.       strcat(txt,": first letter ok, but remainder not integer, request ignored.");
  8745.         bad_data(txt);
  8746.         panel_set(pt[57],PANEL_VALUE,"",0);
  8747.         return;
  8748.        }
  8749.     n = atoi(s);
  8750.     if (n < 0)
  8751.        {strcpy(txt,c);
  8752.         strcat(txt,": first letter ok, but remainder < 0, request ignored.");
  8753.         bad_data(txt);
  8754.         panel_set(pt[57],PANEL_VALUE,"",0);
  8755.         return;
  8756.        }
  8757.     if (*c == 'i' && n >= N_image)
  8758.        {strcpy(txt,c);
  8759.         strcat(txt,":  not that many image tags, request ignored.");
  8760.         bad_data(txt);
  8761.         panel_set(pt[57],PANEL_VALUE,"",0);
  8762.         return;
  8763.        }
  8764.     if (*c == 'c' && n >= N_contour)
  8765.        {strcpy(txt,c);
  8766.         strcat(txt,":  not that many contour tags, request ignored.");
  8767.         bad_data(txt);
  8768.         panel_set(pt[57],PANEL_VALUE,"",0);
  8769.         return;
  8770.        }
  8771.     if (*c == 'v' && n >= N_vector)
  8772.        {strcpy(txt,c);
  8773.         strcat(txt,":  not that many vector tags, request ignored.");
  8774.         bad_data(txt);
  8775.         panel_set(pt[57],PANEL_VALUE,"",0);
  8776.         return;
  8777.        }
  8778.     if    (*c == 'i')    nf = n;
  8779.     else if (*c == 'c')    nf = N_image + n;
  8780.     else            nf = N_image + N_contour + n;
  8781.     strcpy(txt,window_get(fr[9],FRAME_LABEL,0));
  8782.     t = txt;
  8783.     while (*t) t++;
  8784.     while (*t != '\'') t--;
  8785.     t--;
  8786.     while (*t != '\'') t--;
  8787.     t++;
  8788.     s = c;
  8789.     while (*s) *t++ = *s++;
  8790.     *t++ = '\'';
  8791.     *t++ = ')';
  8792.     *t = '\0';
  8793.     window_set(fr[9],FRAME_LABEL,txt,0);
  8794.     panel_set(pt[57],PANEL_VALUE,"",0);
  8795.     p91();
  8796.     info_msg("","Feature tag selected.","");
  8797.     return;
  8798. }
  8799. /* EOF */
  8800. /* cat > src+obj/p110.c << "EOF" */
  8801. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8802. /* p110: p110 button - feature...ticks in or out    */
  8803. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8804. /* SCCS information: %W%    %G% - NCSA */
  8805.  
  8806. /* #include "all.h" */
  8807.  
  8808. int    p110()
  8809. {
  8810.     char        c[8];
  8811.     strcpy(c,panel_get(pm[4],PANEL_LABEL_STRING,0));
  8812.     if (strcmp(c,"X-TIC1") == 0)
  8813.        {if (feat[nf].xt1_direc == FALSE)
  8814.            {feat[nf].xt1_direc = TRUE;
  8815.         panel_set(pb[110],PANEL_LABEL_IMAGE,
  8816.               panel_button_image(pa[9],"now OUT",7,NULL),0);
  8817.            }
  8818.         else
  8819.            {feat[nf].xt1_direc = FALSE; 
  8820.                 panel_set(pb[110],PANEL_LABEL_IMAGE, 
  8821.                           panel_button_image(pa[9],"now IN",7,NULL),0); 
  8822.                }
  8823.        }
  8824.     else if (strcmp(c,"Y-TIC1") == 0)
  8825.        {if (feat[nf].yt1_direc == FALSE)
  8826.            {feat[nf].yt1_direc = TRUE;
  8827.         panel_set(pb[110],PANEL_LABEL_IMAGE,
  8828.               panel_button_image(pa[9],"now OUT",7,NULL),0);
  8829.            }
  8830.         else
  8831.            {feat[nf].yt1_direc = FALSE; 
  8832.                 panel_set(pb[110],PANEL_LABEL_IMAGE, 
  8833.                           panel_button_image(pa[9],"now IN",7,NULL),0); 
  8834.                }
  8835.        }
  8836.     else if (strcmp(c,"X-TIC2") == 0)
  8837.        {if (feat[nf].xt2_direc == FALSE)
  8838.            {feat[nf].xt2_direc = TRUE;
  8839.         panel_set(pb[110],PANEL_LABEL_IMAGE,
  8840.               panel_button_image(pa[9],"now OUT",7,NULL),0);
  8841.            }
  8842.         else
  8843.            {feat[nf].xt2_direc = FALSE; 
  8844.                 panel_set(pb[110],PANEL_LABEL_IMAGE, 
  8845.                           panel_button_image(pa[9],"now IN",7,NULL),0); 
  8846.                }
  8847.        }
  8848.     else if (strcmp(c,"Y-TIC2") == 0)
  8849.        {if (feat[nf].yt2_direc == FALSE)
  8850.            {feat[nf].yt2_direc = TRUE;
  8851.         panel_set(pb[110],PANEL_LABEL_IMAGE,
  8852.               panel_button_image(pa[9],"now OUT",7,NULL),0);
  8853.            }
  8854.         else
  8855.            {feat[nf].yt2_direc = FALSE; 
  8856.                 panel_set(pb[110],PANEL_LABEL_IMAGE, 
  8857.                           panel_button_image(pa[9],"now IN",7,NULL),0); 
  8858.                }
  8859.        }
  8860.     else
  8861.        bad_data("It is not possible to get this feature error message, p110");
  8862.     return;
  8863. }
  8864. /* EOF */
  8865. /* cat > src+obj/p111.c << "EOF" */
  8866. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8867. /* p111: p111 button - feature...ticks on left/bot    */
  8868. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8869. /* SCCS information: %W%    %G% - NCSA */
  8870.  
  8871. /* #include "all.h" */
  8872.  
  8873. int    p111()
  8874. {
  8875.     char        c[8];
  8876.     strcpy(c,panel_get(pm[4],PANEL_LABEL_STRING,0));
  8877.     if (strcmp(c,"X-TIC1") == 0)
  8878.        {if (feat[nf].xt1_bot == FALSE)
  8879.            {feat[nf].xt1_bot = TRUE;
  8880.         panel_set(pb[111],PANEL_LABEL_IMAGE,
  8881.               panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8882.            }
  8883.         else
  8884.            {feat[nf].xt1_bot = FALSE; 
  8885.                 panel_set(pb[111],PANEL_LABEL_IMAGE, 
  8886.                           panel_button_image(pa[9],"bot side OFF",14,NULL),0); 
  8887.                }
  8888.        }
  8889.     else if (strcmp(c,"Y-TIC1") == 0)
  8890.        {if (feat[nf].yt1_left == FALSE)
  8891.            {feat[nf].yt1_left = TRUE;
  8892.         panel_set(pb[111],PANEL_LABEL_IMAGE,
  8893.               panel_button_image(pa[9],"left side ON",14,NULL),0);
  8894.            }
  8895.         else
  8896.            {feat[nf].yt1_left = FALSE; 
  8897.                 panel_set(pb[111],PANEL_LABEL_IMAGE, 
  8898.                           panel_button_image(pa[9],"left side OFF",14,NULL),0); 
  8899.                }
  8900.        }
  8901.     else if (strcmp(c,"X-TIC2") == 0)
  8902.        {if (feat[nf].xt2_bot == FALSE)
  8903.            {feat[nf].xt2_bot = TRUE;
  8904.         panel_set(pb[111],PANEL_LABEL_IMAGE,
  8905.               panel_button_image(pa[9],"bot side ON",14,NULL),0);
  8906.            }
  8907.         else
  8908.            {feat[nf].xt2_bot = FALSE; 
  8909.                 panel_set(pb[111],PANEL_LABEL_IMAGE, 
  8910.                           panel_button_image(pa[9],"bot side OFF",14,NULL),0); 
  8911.                }
  8912.        }
  8913.     else if (strcmp(c,"Y-TIC2") == 0)
  8914.        {if (feat[nf].yt2_left == FALSE)
  8915.            {feat[nf].yt2_left = TRUE;
  8916.         panel_set(pb[111],PANEL_LABEL_IMAGE,
  8917.               panel_button_image(pa[9],"left side ON",14,NULL),0);
  8918.            }
  8919.         else
  8920.            {feat[nf].yt2_left = FALSE; 
  8921.                 panel_set(pb[111],PANEL_LABEL_IMAGE, 
  8922.                           panel_button_image(pa[9],"left side OFF",14,NULL),0); 
  8923.                }
  8924.        }
  8925.     else
  8926.        bad_data("It is not possible to get this feature error message, p111");
  8927.     return;
  8928. }
  8929. /* EOF */
  8930. /* cat > src+obj/p112.c << "EOF" */
  8931. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8932. /* p112: p112 button - feature...ticks on right/top    */
  8933. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8934. /* SCCS information: %W%    %G% - NCSA */
  8935.  
  8936. /* #include "all.h" */
  8937.  
  8938. int    p112()
  8939. {
  8940.     char        c[8];
  8941.     strcpy(c,panel_get(pm[4],PANEL_LABEL_STRING,0));
  8942.     if (strcmp(c,"X-TIC1") == 0)
  8943.        {if (feat[nf].xt1_top == FALSE)
  8944.            {feat[nf].xt1_top = TRUE;
  8945.         panel_set(pb[112],PANEL_LABEL_IMAGE,
  8946.               panel_button_image(pa[9],"top side ON",14,NULL),0);
  8947.            }
  8948.         else
  8949.            {feat[nf].xt1_top = FALSE; 
  8950.                 panel_set(pb[112],PANEL_LABEL_IMAGE, 
  8951.                           panel_button_image(pa[9],"top side OFF",14,NULL),0); 
  8952.                }
  8953.        }
  8954.     else if (strcmp(c,"Y-TIC1") == 0)
  8955.        {if (feat[nf].yt1_right == FALSE)
  8956.            {feat[nf].yt1_right = TRUE;
  8957.         panel_set(pb[112],PANEL_LABEL_IMAGE,
  8958.               panel_button_image(pa[9],"right side ON",14,NULL),0);
  8959.            }
  8960.         else
  8961.            {feat[nf].yt1_right = FALSE; 
  8962.                 panel_set(pb[112],PANEL_LABEL_IMAGE, 
  8963.                           panel_button_image(pa[9],"right side OFF",14,NULL),0); 
  8964.                }
  8965.        }
  8966.     else if (strcmp(c,"X-TIC2") == 0)
  8967.        {if (feat[nf].xt2_top == FALSE)
  8968.            {feat[nf].xt2_top = TRUE;
  8969.         panel_set(pb[112],PANEL_LABEL_IMAGE,
  8970.               panel_button_image(pa[9],"top side ON",14,NULL),0);
  8971.            }
  8972.         else
  8973.            {feat[nf].xt2_top = FALSE; 
  8974.                 panel_set(pb[112],PANEL_LABEL_IMAGE, 
  8975.                           panel_button_image(pa[9],"top side OFF",14,NULL),0); 
  8976.                }
  8977.        }
  8978.     else if (strcmp(c,"Y-TIC2") == 0)
  8979.        {if (feat[nf].yt2_right == FALSE)
  8980.            {feat[nf].yt2_right = TRUE;
  8981.         panel_set(pb[112],PANEL_LABEL_IMAGE,
  8982.               panel_button_image(pa[9],"right side ON",14,NULL),0);
  8983.            }
  8984.         else
  8985.            {feat[nf].yt2_right = FALSE; 
  8986.                 panel_set(pb[112],PANEL_LABEL_IMAGE, 
  8987.                           panel_button_image(pa[9],"right side OFF",14,NULL),0); 
  8988.                }
  8989.        }
  8990.     else
  8991.        bad_data("It is not possible to get this feature error message, p112");
  8992.     return;
  8993. }
  8994. /* EOF */
  8995. /* cat > src+obj/p113.c << "EOF" */
  8996. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8997. /* p113: p113 button - feature...copy from another tag    */
  8998. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  8999. /* SCCS information: %W%    %G% - NCSA */
  9000.  
  9001. /* #include "all.h" */
  9002.  
  9003. int    p113()
  9004. {
  9005.         char            c[8],
  9006.             d[8],
  9007.                         *s;
  9008.         register int    n;
  9009.         strcpy(c,panel_get(pt[58],PANEL_VALUE,0));
  9010.     strcpy(d,panel_get(pm[3],PANEL_LABEL_STRING,0));
  9011.         s = c;
  9012.     if (*s == '\0')
  9013.        {bad_data("No tag given, request ignored.");
  9014.         return;
  9015.        }
  9016.         if (*s != 'i' && *s != 'c' && *s != 'v')
  9017.            {strcpy(txt,c);
  9018.             strcat(txt,":  does not begin with i, c, or v, copy request ignored.");
  9019.             bad_data(txt);
  9020.             panel_set(pt[58],PANEL_VALUE,"",0);
  9021.             return;
  9022.            }
  9023.         s++;
  9024.         if (FALSE == my_isint(s))
  9025.            {strcpy(txt,c);
  9026.           strcat(txt,": first letter ok, but remainder not integer, copy request ignored.");
  9027.             bad_data(txt);
  9028.             panel_set(pt[58],PANEL_VALUE,"",0);
  9029.             return;
  9030.            }
  9031.         n = atoi(s);
  9032.         if (n < 0)
  9033.            {strcpy(txt,c);
  9034.             strcat(txt,": first letter ok, but remainder < 0, copy request ignored.");
  9035.             bad_data(txt);
  9036.             panel_set(pt[58],PANEL_VALUE,"",0);
  9037.             return;
  9038.            }
  9039.         if (*c == 'i' && n >= N_image)
  9040.            {strcpy(txt,c);
  9041.             strcat(txt,":  not that many image tags, copy request ignored.");
  9042.             bad_data(txt);
  9043.             panel_set(pt[58],PANEL_VALUE,"",0);
  9044.             return;
  9045.            }
  9046.         if (*c == 'c' && n >= N_contour)
  9047.            {strcpy(txt,c);
  9048.             strcat(txt,":  not that many contour tags, copy request ignored.");
  9049.             bad_data(txt);
  9050.             panel_set(pt[58],PANEL_VALUE,"",0);
  9051.             return;
  9052.            }
  9053.         if (*c == 'v' && n >= N_vector)
  9054.            {strcpy(txt,c);
  9055.             strcat(txt,":  not that many vector tags, copy request ignored.");
  9056.             bad_data(txt);
  9057.             panel_set(pt[58],PANEL_VALUE,"",0);
  9058.             return;
  9059.            }
  9060.         if    (*c == 'c')     n = N_image + n;
  9061.         else if    (*c == 'v')    n = N_image + N_contour + n;
  9062.     else;
  9063.  
  9064.     feat[nf].xax_sw        = feat[n].xax_sw;
  9065.     feat[nf].xax_thick    = feat[n].xax_thick;
  9066.     feat[nf].xax_color    = feat[n].xax_color;
  9067.     feat[nf].xax_bot    = feat[n].xax_bot;
  9068.     feat[nf].xax_top    = feat[n].xax_top;
  9069.     feat[nf].yax_sw        = feat[n].yax_sw;
  9070.     feat[nf].yax_thick    = feat[n].yax_thick;
  9071.     feat[nf].yax_color    = feat[n].yax_color;
  9072.     feat[nf].yax_left    = feat[n].yax_left;
  9073.     feat[nf].yax_right    = feat[n].yax_right;
  9074.  
  9075.     feat[nf].xgr_sw        = feat[n].xgr_sw;
  9076.     feat[nf].xgr_thick    = feat[n].xgr_thick;
  9077.     feat[nf].xgr_color    = feat[n].xgr_color;
  9078.     feat[nf].xgr_space    = feat[n].xgr_space;
  9079.     feat[nf].ygr_sw        = feat[n].ygr_sw;
  9080.     feat[nf].ygr_thick    = feat[n].ygr_thick;
  9081.     feat[nf].ygr_color    = feat[n].ygr_color;
  9082.     feat[nf].ygr_space    = feat[n].ygr_space;
  9083.  
  9084.     feat[nf].xt1_sw        = feat[n].xt1_sw;
  9085.     feat[nf].xt1_thick    = feat[n].xt1_thick;
  9086.     feat[nf].xt1_color    = feat[n].xt1_color;
  9087.     feat[nf].xt1_bot    = feat[n].xt1_bot;
  9088.     feat[nf].xt1_top    = feat[n].xt1_top;
  9089.     feat[nf].xt1_space    = feat[n].xt1_space;
  9090.     feat[nf].xt1_direc    = feat[n].xt1_direc;
  9091.     feat[nf].yt1_sw        = feat[n].yt1_sw;
  9092.     feat[nf].yt1_thick    = feat[n].yt1_thick;
  9093.     feat[nf].yt1_color    = feat[n].yt1_color;
  9094.     feat[nf].yt1_left    = feat[n].yt1_left;
  9095.     feat[nf].yt1_right    = feat[n].yt1_right;
  9096.     feat[nf].yt1_space    = feat[n].yt1_space;
  9097.     feat[nf].yt1_direc    = feat[n].yt1_direc;
  9098.  
  9099.     feat[nf].xt2_sw        = feat[n].xt2_sw;
  9100.     feat[nf].xt2_thick    = feat[n].xt2_thick;
  9101.     feat[nf].xt2_color    = feat[n].xt2_color;
  9102.     feat[nf].xt2_bot    = feat[n].xt2_bot;
  9103.     feat[nf].xt2_top    = feat[n].xt2_top;
  9104.     feat[nf].xt2_space    = feat[n].xt2_space;
  9105.     feat[nf].xt2_direc    = feat[n].xt2_direc;
  9106.     feat[nf].yt2_sw        = feat[n].yt2_sw;
  9107.     feat[nf].yt2_thick    = feat[n].yt2_thick;
  9108.     feat[nf].yt2_color    = feat[n].yt2_color;
  9109.     feat[nf].yt2_left    = feat[n].yt2_left;
  9110.     feat[nf].yt2_right    = feat[n].yt2_right;
  9111.     feat[nf].yt2_space    = feat[n].yt2_space;
  9112.     feat[nf].yt2_direc    = feat[n].yt2_direc;
  9113.  
  9114.     if    (strcmp(d,"X-AXIS") == 0) p91();
  9115.     else if    (strcmp(d,"Y-AXIS") == 0) p93();
  9116.     else if    (strcmp(d,"X-GRID") == 0) p95();
  9117.     else if    (strcmp(d,"Y-GRID") == 0) p97();
  9118.     else if    (strcmp(d,"X-TIC1") == 0) p99();
  9119.     else if    (strcmp(d,"Y-TIC1") == 0) p101();
  9120.     else if    (strcmp(d,"X-TIC2") == 0) p103();
  9121.     else if    (strcmp(d,"Y-TIC2") == 0) p105();
  9122.     else
  9123.        {bad_data("It is not possible to get this feature error message, p113");
  9124.         return;
  9125.        }
  9126.  
  9127.         panel_set(pt[58],PANEL_VALUE,"",0);
  9128.     strcpy(txt,"Current feature tag data copied from feature tag ");
  9129.     strcat(txt,c);
  9130.         info_msg("",txt,"");
  9131.     return;
  9132. }
  9133. /* EOF */
  9134. /* cat > src+obj/p114.c << "EOF" */
  9135. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9136. /* p114: p114 button - feature...all features on    */
  9137. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9138. /* SCCS information: %W%    %G% - NCSA */
  9139.  
  9140. /* #include "all.h" */
  9141.  
  9142. int    p114()
  9143. {
  9144.     feat[nf].xax_sw = TRUE;
  9145.     feat[nf].yax_sw = TRUE;
  9146.     feat[nf].xgr_sw = TRUE;
  9147.     feat[nf].ygr_sw = TRUE;
  9148.     feat[nf].xt1_sw = TRUE;
  9149.     feat[nf].yt1_sw = TRUE;
  9150.     feat[nf].xt2_sw = TRUE;
  9151.     feat[nf].yt2_sw = TRUE;
  9152.     panel_set(pb[92],PANEL_LABEL_IMAGE,
  9153.           panel_button_image(pa[9],"ON",3,NULL),0);
  9154.     panel_set(pb[94],PANEL_LABEL_IMAGE,
  9155.           panel_button_image(pa[9],"ON",3,NULL),0);
  9156.     panel_set(pb[96],PANEL_LABEL_IMAGE,
  9157.           panel_button_image(pa[9],"ON",3,NULL),0);
  9158.     panel_set(pb[98],PANEL_LABEL_IMAGE,
  9159.           panel_button_image(pa[9],"ON",3,NULL),0);
  9160.     panel_set(pb[100],PANEL_LABEL_IMAGE,
  9161.           panel_button_image(pa[9],"ON",3,NULL),0);
  9162.     panel_set(pb[102],PANEL_LABEL_IMAGE,
  9163.           panel_button_image(pa[9],"ON",3,NULL),0);
  9164.     panel_set(pb[104],PANEL_LABEL_IMAGE,
  9165.           panel_button_image(pa[9],"ON",3,NULL),0);
  9166.     panel_set(pb[106],PANEL_LABEL_IMAGE,
  9167.           panel_button_image(pa[9],"ON",3,NULL),0);
  9168.     return;
  9169. }
  9170. /* EOF */
  9171. /* cat > src+obj/p115.c << "EOF" */
  9172. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9173. /* p115: p115 button - feature...all features off    */
  9174. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9175. /* SCCS information: %W%    %G% - NCSA */
  9176.  
  9177. /* #include "all.h" */
  9178.  
  9179. int    p115()
  9180. {
  9181.     feat[nf].xax_sw = FALSE;
  9182.     feat[nf].yax_sw = FALSE;
  9183.     feat[nf].xgr_sw = FALSE;
  9184.     feat[nf].ygr_sw = FALSE;
  9185.     feat[nf].xt1_sw = FALSE;
  9186.     feat[nf].yt1_sw = FALSE;
  9187.     feat[nf].xt2_sw = FALSE;
  9188.     feat[nf].yt2_sw = FALSE;
  9189.     panel_set(pb[92],PANEL_LABEL_IMAGE,
  9190.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9191.     panel_set(pb[94],PANEL_LABEL_IMAGE,
  9192.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9193.     panel_set(pb[96],PANEL_LABEL_IMAGE,
  9194.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9195.     panel_set(pb[98],PANEL_LABEL_IMAGE,
  9196.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9197.     panel_set(pb[100],PANEL_LABEL_IMAGE,
  9198.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9199.     panel_set(pb[102],PANEL_LABEL_IMAGE,
  9200.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9201.     panel_set(pb[104],PANEL_LABEL_IMAGE,
  9202.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9203.     panel_set(pb[106],PANEL_LABEL_IMAGE,
  9204.           panel_button_image(pa[9],"OFF",3,NULL),0);
  9205.     return;
  9206. }
  9207. /* EOF */
  9208. /* cat > src+obj/reset_colorbar.c << "EOF" */
  9209. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9210. /* reset_colorbar: reset the colorbar "Done" button and    */
  9211. /*           switch                */
  9212. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9213. /* SCCS information: %W%    %G% - NCSA */
  9214.  
  9215. /* #include "all.h" */
  9216.  
  9217. int    reset_colorbar()
  9218. {
  9219.     sw_colorbar = 0;
  9220.     panel_set(pb[22],PANEL_LABEL_IMAGE,
  9221.           panel_button_image(pa[3],"Done",7,NULL),0);
  9222.     return;
  9223. }
  9224. /* EOF */
  9225. /* cat > src+obj/reset_contour.c << "EOF" */
  9226. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9227. /* reset_contour: reset the change contour buttons and    */
  9228. /*          switches                */
  9229. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9230. /* SCCS information: %W%    %G% - NCSA */
  9231.  
  9232. /* #include "all.h" */
  9233.  
  9234. int    reset_contour()
  9235. {
  9236.     sw_contour = 0;
  9237.     panel_set(pb[58],PANEL_LABEL_IMAGE,
  9238.           panel_button_image(pa[7],"Done",7,NULL),0);
  9239.     sw_c[0] = sw_c[1] = sw_c[2] = sw_c[3] = sw_c[4] = 0;
  9240.     panel_set(pb[66],PANEL_LABEL_IMAGE,
  9241.           panel_button_image(pa[7],"-5",2,NULL),0);
  9242.     panel_set(pb[67],PANEL_LABEL_IMAGE,
  9243.           panel_button_image(pa[7],"-",1,NULL),0);
  9244.     panel_set(pb[68],PANEL_LABEL_IMAGE,
  9245.           panel_button_image(pa[7],"+",1,NULL),0);
  9246.     panel_set(pb[69],PANEL_LABEL_IMAGE,
  9247.           panel_button_image(pa[7],"+5",2,NULL),0);
  9248.     panel_set(pb[65],PANEL_LABEL_IMAGE,
  9249.           panel_button_image(pa[7]," ",2,NULL),0);
  9250.     return;
  9251. }
  9252. /* EOF */
  9253. /* cat > src+obj/reset_grid.c << "EOF" */
  9254. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9255. /* reset_grid: reset the grid "Done" button and switch    */
  9256. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9257. /* SCCS information: %W%    %G% - NCSA */
  9258.  
  9259. /* #include "all.h" */
  9260.  
  9261. int    reset_grid()
  9262. {
  9263.     sw_grid = 0;
  9264.     panel_set(pb[16],PANEL_LABEL_IMAGE,
  9265.           panel_button_image(pa[2],"Done",7,NULL),0);
  9266.     return;
  9267. }
  9268. /* EOF */
  9269. /* cat > src+obj/reset_image.c << "EOF" */
  9270. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9271. /* reset_image: reset the change image buttons and    */
  9272. /*        switches                */
  9273. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9274. /* SCCS information: %W%    %G% - NCSA */
  9275.  
  9276. /* #include "all.h" */
  9277.  
  9278. int    reset_image()
  9279. {
  9280.     sw_image = 0;
  9281.     panel_set(pb[46],PANEL_LABEL_IMAGE,
  9282.           panel_button_image(pa[6],"Done",7,NULL),0);
  9283.     sw_i[0] = sw_i[1] = sw_i[2] = sw_i[3] = sw_i[4] = 0;
  9284.     panel_set(pb[54],PANEL_LABEL_IMAGE,
  9285.           panel_button_image(pa[6],"-5",2,NULL),0);
  9286.     panel_set(pb[55],PANEL_LABEL_IMAGE,
  9287.           panel_button_image(pa[6],"-",1,NULL),0);
  9288.     panel_set(pb[56],PANEL_LABEL_IMAGE,
  9289.           panel_button_image(pa[6],"+",1,NULL),0);
  9290.     panel_set(pb[57],PANEL_LABEL_IMAGE,
  9291.           panel_button_image(pa[6],"+5",2,NULL),0);
  9292.     panel_set(pb[53],PANEL_LABEL_IMAGE,
  9293.           panel_button_image(pa[6]," ",2,NULL),0);
  9294.     return;
  9295. }
  9296. /* EOF */
  9297. /* cat > src+obj/reset_mcolorbar.c << "EOF" */
  9298. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9299. /* reset_mcolorbar: reset the colorbar draw & move    */
  9300. /*            buttons and switches        */
  9301. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9302. /* SCCS information: %W%    %G% - NCSA */
  9303.  
  9304. /* #include "all.h" */
  9305.  
  9306. int    reset_mcolorbar()
  9307. {
  9308.     if (csw_colorbar == TRUE)
  9309.        {csw_colorbar = FALSE;
  9310.         sw_draw     = FALSE;
  9311.         sw_move     = FALSE;
  9312.        }
  9313.     if (TRUE == (int)window_get(fr[3],WIN_SHOW,TRUE,0))
  9314.        {panel_set(pb[28],PANEL_LABEL_IMAGE,
  9315.           panel_button_image(pa[3],"ms draw",8,NULL),0);
  9316.         panel_set(pb[84],PANEL_LABEL_IMAGE,
  9317.           panel_button_image(pa[3],"mouse mv",9,NULL),0);
  9318.        }
  9319.     return;
  9320. }
  9321. /* EOF */
  9322. /* cat > src+obj/reset_mcontour.c << "EOF" */
  9323. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9324. /* reset_mcontour: reset the contour draw & move    */
  9325. /*           buttons and switches            */
  9326. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9327. /* SCCS information: %W%    %G% - NCSA */
  9328.  
  9329. /* #include "all.h" */
  9330.  
  9331. int    reset_mcontour()
  9332. {
  9333.     if (csw_contour == TRUE)
  9334.        {csw_contour = FALSE;
  9335.         sw_draw    = FALSE;
  9336.         sw_move    = FALSE;
  9337.        }
  9338.     if (TRUE == (int)window_get(fr[7],WIN_SHOW,TRUE,0))
  9339.        {panel_set(pb[64],PANEL_LABEL_IMAGE,
  9340.           panel_button_image(pa[7],"ms draw",8,NULL),0);
  9341.         panel_set(pb[86],PANEL_LABEL_IMAGE,
  9342.           panel_button_image(pa[7],"mouse mv",9,NULL),0);
  9343.        }
  9344.     return;
  9345. }
  9346. /* EOF */
  9347. /* cat > src+obj/reset_mimage.c << "EOF" */
  9348. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9349. /* reset_mimage: reset the image draw & move buttons    */
  9350. /*         and switches                */
  9351. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9352. /* SCCS information: %W%    %G% - NCSA */
  9353.  
  9354. /* #include "all.h" */
  9355.  
  9356. int    reset_mimage()
  9357. {
  9358.     if (csw_image  == TRUE)
  9359.        {csw_image    = FALSE;
  9360.         sw_draw    = FALSE;
  9361.         sw_move    = FALSE;
  9362.        }
  9363.     if (TRUE == (int)window_get(fr[6],WIN_SHOW,TRUE,0))
  9364.        {panel_set(pb[52],PANEL_LABEL_IMAGE,
  9365.           panel_button_image(pa[6],"ms draw",8,NULL),0);
  9366.         panel_set(pb[85],PANEL_LABEL_IMAGE,
  9367.           panel_button_image(pa[6],"mouse mv",9,NULL),0);
  9368.        }
  9369.     return;
  9370. }
  9371. /* EOF */
  9372. /* cat > src+obj/reset_mtext.c << "EOF" */
  9373. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9374. /* reset_mtext: reset the text draw & move buttons and    */
  9375. /*        switches                */
  9376. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9377. /* SCCS information: %W%    %G% - NCSA */
  9378.  
  9379. /* #include "all.h" */
  9380.  
  9381. int    reset_mtext()
  9382. {
  9383.     if (csw_text   == TRUE)
  9384.        {csw_text    = FALSE;
  9385.         sw_draw    = FALSE;
  9386.         sw_move    = FALSE;
  9387.        }
  9388.     if (TRUE == (int)window_get(fr[4],WIN_SHOW,TRUE,0))
  9389.        {panel_set(pb[82],PANEL_LABEL_IMAGE,
  9390.           panel_button_image(pa[4],"ms draw",8,NULL),0);
  9391.         panel_set(pb[83],PANEL_LABEL_IMAGE,
  9392.           panel_button_image(pa[4],"mouse mv",9,NULL),0);
  9393.        }
  9394.     return;
  9395. }
  9396. /* EOF */
  9397. /* cat > src+obj/reset_mvector.c << "EOF" */
  9398. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9399. /* reset_mvector: reset the vector draw & move buttons    */
  9400. /*          and switches                */
  9401. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9402. /* SCCS information: %W%    %G% - NCSA */
  9403.  
  9404. /* #include "all.h" */
  9405.  
  9406. int    reset_mvector()
  9407. {
  9408.     if (csw_vector == TRUE)
  9409.        {csw_vector    = FALSE;
  9410.         sw_draw    = FALSE;
  9411.         sw_move    = FALSE;
  9412.        }
  9413.     if (TRUE == (int)window_get(fr[8],WIN_SHOW,TRUE,0))
  9414.        {panel_set(pb[76],PANEL_LABEL_IMAGE,
  9415.           panel_button_image(pa[8],"ms draw",8,NULL),0);
  9416.         panel_set(pb[87],PANEL_LABEL_IMAGE,
  9417.           panel_button_image(pa[8],"mouse mv",9,NULL),0);
  9418.        }
  9419.     return;
  9420. }
  9421. /* EOF */
  9422. /* cat > src+obj/reset_palette.c << "EOF" */
  9423. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9424. /* reset_palette: reset the palette "Done" button and    */
  9425. /*          switch                */
  9426. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9427. /* SCCS information: %W%    %G% - NCSA */
  9428.  
  9429. /* #include "all.h" */
  9430.  
  9431. int    reset_palette()
  9432. {
  9433.     sw_palette = 0;
  9434.     panel_set(pb[13],PANEL_LABEL_IMAGE,
  9435.           panel_button_image(pa[1],"Done",7,NULL),0);
  9436.     return;
  9437. }
  9438. /* EOF */
  9439. /* cat > src+obj/reset_text.c << "EOF" */
  9440. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9441. /* reset_text: reset the change text buttons and    */
  9442. /*           switches                    */
  9443. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9444. /* SCCS information: %W%    %G% - NCSA */
  9445.  
  9446. /* #include "all.h" */
  9447.  
  9448. int    reset_text()
  9449. {
  9450.     sw_text = 0;
  9451.     panel_set(pb[30],PANEL_LABEL_IMAGE,
  9452.           panel_button_image(pa[4],"Done",7,NULL),0);
  9453.     sw_t[0] = sw_t[1] = sw_t[2] = sw_t[3] = sw_t[4] = 0;
  9454.     panel_set(pb[37],PANEL_LABEL_IMAGE,
  9455.           panel_button_image(pa[4],"-5",2,NULL),0);
  9456.     panel_set(pb[38],PANEL_LABEL_IMAGE,
  9457.           panel_button_image(pa[4],"-",1,NULL),0);
  9458.     panel_set(pb[39],PANEL_LABEL_IMAGE,
  9459.           panel_button_image(pa[4],"+",1,NULL),0);
  9460.     panel_set(pb[40],PANEL_LABEL_IMAGE,
  9461.           panel_button_image(pa[4],"+5",2,NULL),0);
  9462.     panel_set(pb[36],PANEL_LABEL_IMAGE,
  9463.           panel_button_image(pa[4]," ",2,NULL),0);
  9464.     return;
  9465. }
  9466. /* EOF */
  9467. /* cat > src+obj/reset_vector.c << "EOF" */
  9468. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9469. /* reset_vector: reset the change vector buttons and    */
  9470. /*         switches                */
  9471. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9472. /* SCCS information: %W%    %G% - NCSA */
  9473.  
  9474. /* #include "all.h" */
  9475.  
  9476. int    reset_vector()
  9477. {
  9478.     sw_vector = 0;
  9479.     panel_set(pb[70],PANEL_LABEL_IMAGE,
  9480.           panel_button_image(pa[8],"Done",7,NULL),0);
  9481.     sw_v[0] = sw_v[1] = sw_v[2] = sw_v[3] = sw_v[4] = 0;
  9482.     panel_set(pb[78],PANEL_LABEL_IMAGE,
  9483.           panel_button_image(pa[8],"-5",2,NULL),0);
  9484.     panel_set(pb[79],PANEL_LABEL_IMAGE,
  9485.           panel_button_image(pa[8],"-",1,NULL),0);
  9486.     panel_set(pb[80],PANEL_LABEL_IMAGE,
  9487.           panel_button_image(pa[8],"+",1,NULL),0);
  9488.     panel_set(pb[81],PANEL_LABEL_IMAGE,
  9489.           panel_button_image(pa[8],"+5",2,NULL),0);
  9490.     panel_set(pb[77],PANEL_LABEL_IMAGE,
  9491.           panel_button_image(pa[8]," ",2,NULL),0);
  9492.     return;
  9493. }
  9494. /* EOF */
  9495. /* cat > src+obj/resetb_feature.c << "EOF" */
  9496. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9497. /* resetb_feature: reset the feature buttons        */
  9498. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9499. /* SCCS information: %W%    %G% - NCSA */
  9500.  
  9501. /* #include "all.h" */
  9502.  
  9503. int    resetb_feature()
  9504. {
  9505.     panel_set(pb[91],PANEL_LABEL_IMAGE,
  9506.           panel_button_image(pa[9],"x-axis",7,NULL),0);
  9507.     panel_set(pb[93],PANEL_LABEL_IMAGE,
  9508.           panel_button_image(pa[9],"y-axis",7,NULL),0);
  9509.     panel_set(pb[95],PANEL_LABEL_IMAGE,
  9510.           panel_button_image(pa[9],"x-grid",7,NULL),0);
  9511.     panel_set(pb[97],PANEL_LABEL_IMAGE,
  9512.           panel_button_image(pa[9],"y-grid",7,NULL),0);
  9513.     panel_set(pb[99],PANEL_LABEL_IMAGE,
  9514.           panel_button_image(pa[9],"x-tic1",7,NULL),0);
  9515.     panel_set(pb[101],PANEL_LABEL_IMAGE,
  9516.           panel_button_image(pa[9],"y-tic1",7,NULL),0);
  9517.     panel_set(pb[103],PANEL_LABEL_IMAGE,
  9518.           panel_button_image(pa[9],"x-tic2",7,NULL),0);
  9519.     panel_set(pb[105],PANEL_LABEL_IMAGE,
  9520.           panel_button_image(pa[9],"y-tic2",7,NULL),0);
  9521.     if (feat[nf].xax_sw == FALSE)
  9522.        panel_set(pb[92],PANEL_LABEL_IMAGE,
  9523.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9524.     else
  9525.        panel_set(pb[92],PANEL_LABEL_IMAGE,
  9526.              panel_button_image(pa[9],"ON",3,NULL),0);
  9527.     if (feat[nf].yax_sw == FALSE)
  9528.        panel_set(pb[94],PANEL_LABEL_IMAGE,
  9529.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9530.     else
  9531.        panel_set(pb[94],PANEL_LABEL_IMAGE,
  9532.              panel_button_image(pa[9],"ON",3,NULL),0);
  9533.     if (feat[nf].xgr_sw == FALSE)
  9534.        panel_set(pb[96],PANEL_LABEL_IMAGE,
  9535.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9536.     else
  9537.        panel_set(pb[96],PANEL_LABEL_IMAGE,
  9538.              panel_button_image(pa[9],"ON",3,NULL),0);
  9539.     if (feat[nf].ygr_sw == FALSE)
  9540.        panel_set(pb[98],PANEL_LABEL_IMAGE,
  9541.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9542.     else
  9543.        panel_set(pb[98],PANEL_LABEL_IMAGE,
  9544.              panel_button_image(pa[9],"ON",3,NULL),0);
  9545.     if (feat[nf].xt1_sw == FALSE)
  9546.        panel_set(pb[100],PANEL_LABEL_IMAGE,
  9547.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9548.     else
  9549.        panel_set(pb[100],PANEL_LABEL_IMAGE,
  9550.              panel_button_image(pa[9],"ON",3,NULL),0);
  9551.     if (feat[nf].yt1_sw == FALSE)
  9552.        panel_set(pb[102],PANEL_LABEL_IMAGE,
  9553.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9554.     else
  9555.        panel_set(pb[102],PANEL_LABEL_IMAGE,
  9556.              panel_button_image(pa[9],"ON",3,NULL),0);
  9557.     if (feat[nf].xt2_sw == FALSE)
  9558.        panel_set(pb[104],PANEL_LABEL_IMAGE,
  9559.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9560.     else
  9561.        panel_set(pb[104],PANEL_LABEL_IMAGE,
  9562.              panel_button_image(pa[9],"ON",3,NULL),0);
  9563.     if (feat[nf].yt2_sw == FALSE)
  9564.        panel_set(pb[106],PANEL_LABEL_IMAGE,
  9565.              panel_button_image(pa[9],"OFF",3,NULL),0);
  9566.     else
  9567.        panel_set(pb[106],PANEL_LABEL_IMAGE,
  9568.              panel_button_image(pa[9],"ON",3,NULL),0);
  9569.     return;
  9570. }
  9571. /* EOF */
  9572. /* cat > src+obj/s0.c << "EOF" */
  9573. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9574. /* s0: s0 slider - feature...specify thickness        */
  9575. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9576. /* SCCS information: %W%    %G% - NCSA */
  9577.  
  9578. /* #include "all.h" */
  9579.  
  9580. int    s0()
  9581. {
  9582.     strcpy(txt,panel_get(pm[4],PANEL_LABEL_STRING,0));
  9583.     if    (strcmp(txt,"X-AXIS") == 0)
  9584.        feat[nf].xax_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9585.     else if (strcmp(txt,"Y-AXIS") == 0)
  9586.        feat[nf].yax_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9587.     else if (strcmp(txt,"X-GRID") == 0)
  9588.        feat[nf].xgr_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9589.     else if (strcmp(txt,"Y-GRID") == 0)
  9590.        feat[nf].ygr_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9591.     else if (strcmp(txt,"X-TIC1") == 0)
  9592.        feat[nf].xt1_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9593.     else if (strcmp(txt,"Y-TIC1") == 0)
  9594.        feat[nf].yt1_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9595.     else if (strcmp(txt,"X-TIC2") == 0)
  9596.        feat[nf].xt2_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9597.     else if (strcmp(txt,"Y-TIC2") == 0)
  9598.        feat[nf].yt2_thick = (int)panel_get(ps[0],PANEL_VALUE,0);
  9599.     else
  9600.        bad_data("This feature error message for thickness is not possible.");
  9601.     return;
  9602. }
  9603. /* EOF */
  9604. /* cat > src+obj/s1.c << "EOF" */
  9605. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9606. /* s1: s1 slider - feature...specify color        */
  9607. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9608. /* SCCS information: %W%    %G% - NCSA */
  9609.  
  9610. /* #include "all.h" */
  9611.  
  9612. int    s1()
  9613. {
  9614.     strcpy(txt,panel_get(pm[4],PANEL_LABEL_STRING,0));
  9615.     if    (strcmp(txt,"X-AXIS") == 0)
  9616.        feat[nf].xax_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9617.     else if (strcmp(txt,"Y-AXIS") == 0)
  9618.        feat[nf].yax_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9619.     else if (strcmp(txt,"X-GRID") == 0)
  9620.        feat[nf].xgr_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9621.     else if (strcmp(txt,"Y-GRID") == 0)
  9622.        feat[nf].ygr_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9623.     else if (strcmp(txt,"X-TIC1") == 0)
  9624.        feat[nf].xt1_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9625.     else if (strcmp(txt,"Y-TIC1") == 0)
  9626.        feat[nf].yt1_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9627.     else if (strcmp(txt,"X-TIC2") == 0)
  9628.        feat[nf].xt2_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9629.     else if (strcmp(txt,"Y-TIC2") == 0)
  9630.        feat[nf].yt2_color = (int)panel_get(ps[1],PANEL_VALUE,0);
  9631.     else
  9632.        bad_data("This feature error message for color is not possible.");
  9633.     return;
  9634. }
  9635. /* EOF */
  9636. /* cat > src+obj/s2.c << "EOF" */
  9637. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9638. /* s2: s2 slider - feature...specify spacing        */
  9639. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9640. /* SCCS information: %W%    %G% - NCSA */
  9641.  
  9642. /* #include "all.h" */
  9643.  
  9644. int    s2()
  9645. {
  9646.     strcpy(txt,panel_get(pm[4],PANEL_LABEL_STRING,0));
  9647.     if     (strcmp(txt,"X-GRID") == 0)
  9648.        feat[nf].xgr_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9649.     else if (strcmp(txt,"Y-GRID") == 0)
  9650.        feat[nf].ygr_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9651.     else if (strcmp(txt,"X-TIC1") == 0)
  9652.        feat[nf].xt1_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9653.     else if (strcmp(txt,"Y-TIC1") == 0)
  9654.        feat[nf].yt1_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9655.     else if (strcmp(txt,"X-TIC2") == 0)
  9656.        feat[nf].xt2_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9657.     else if (strcmp(txt,"Y-TIC2") == 0)
  9658.        feat[nf].yt2_space = (int)panel_get(ps[2],PANEL_VALUE,0);
  9659.     else
  9660.        bad_data("This feature error message for spacing is not possible.");
  9661.     return;
  9662. }
  9663. /* EOF */
  9664. /* cat > src+obj/s3.c << "EOF" */
  9665. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9666. /* s3: s3 slider - feature...specify tick length    */
  9667. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9668. /* SCCS information: %W%    %G% - NCSA */
  9669.  
  9670. /* #include "all.h" */
  9671.  
  9672. int    s3()
  9673. {
  9674.     strcpy(txt,panel_get(pm[4],PANEL_LABEL_STRING,0));
  9675.     if    (strcmp(txt,"X-TIC1") == 0)
  9676.        feat[nf].xt1_len = (int)panel_get(ps[3],PANEL_VALUE,0);
  9677.     else if (strcmp(txt,"Y-TIC1") == 0)
  9678.        feat[nf].yt1_len = (int)panel_get(ps[3],PANEL_VALUE,0);
  9679.     else if (strcmp(txt,"X-TIC2") == 0)
  9680.        feat[nf].xt2_len = (int)panel_get(ps[3],PANEL_VALUE,0);
  9681.     else if (strcmp(txt,"Y-TIC2") == 0)
  9682.        feat[nf].yt2_len = (int)panel_get(ps[3],PANEL_VALUE,0);
  9683.     else
  9684.        bad_data("This feature error message for tic length is not possible.");
  9685.     return;
  9686. }
  9687. /* EOF */
  9688. /* cat > src+obj/string_to_tag.c << "EOF" */
  9689. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9690. /* string_to_tag: create a program tag from a file char    */
  9691. /*          string                */
  9692. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  9693. /* SCCS information: %W%    %G% - NCSA */
  9694.  
  9695. /* #include "all.h" */
  9696. /* #include "newext.h" */
  9697.  
  9698. int 
  9699. string_to_tag (s, dir)
  9700.     char           *s;
  9701.     char           *dir;    /* file directory path */
  9702. {
  9703.     struct pixfont *a;
  9704.     char           *q, c, fd = '\t', td = '\n', nd = '\0';
  9705.     int             z, nxpts, nypts, w, x, y;
  9706.     register int    n;
  9707.     float           f;
  9708.     int             filetype;
  9709.     char        tmpfn[MAXNAMELEN + 1];
  9710.     char        msg1[MAXNAMELEN + 1];
  9711.  
  9712.     q = s;
  9713.     if (*s == 'p')
  9714.     {
  9715.         while (*q)
  9716.         {
  9717.             if (*q == fd)
  9718.                 *q = nd;
  9719.             q++;
  9720.         }
  9721.         s++;
  9722.         s++;
  9723.  
  9724.         strcpy (pfntmp, s);
  9725.  
  9726.         z = check_palette (pfntmp, 1);
  9727.         if (z == 1)
  9728.         {
  9729.             (void) swapdirnames (pfntmp, dir, tmpfn);
  9730.             z = check_palette (tmpfn, 1);
  9731.             if (z == 1)
  9732.             {
  9733.                 sprintf (msg1, "File = %s", s);
  9734.                 bad_data2 ("Cannot open palette file. Tried program settings directory also! Request ignored.", msg1);
  9735.                 return (FALSE);
  9736.             }
  9737.             else if (load_rgb (tmpfn, 1))
  9738.                 return (FALSE);
  9739.             else
  9740.                 strcpy (pfn, tmpfn);
  9741.         }
  9742.         else if (load_rgb (pfntmp, 1))
  9743.             return (FALSE);
  9744.         else
  9745.             strcpy (pfn, s);
  9746.         
  9747.         reset_colormap ();
  9748. /*
  9749.         pw_putcolormap (bpw, 0, 256 - 2, red, green, blue);
  9750.         pw_putcolormap (cpw, 0, 256, red, green, blue);
  9751. */
  9752.  
  9753.         while (*s)
  9754.             s++;
  9755.         s++;
  9756.         clear_color = atoi (s);
  9757.     }
  9758.     else if (*s == 't')
  9759.     {
  9760.         while (*q)
  9761.         {
  9762.             if (*q == fd)
  9763.                 *q = nd;
  9764.             q++;
  9765.         }
  9766.         s++;
  9767.         n = atoi (s);
  9768.         while (*s)
  9769.             s++;
  9770.         s++;
  9771.         strcpy (text[n].body, s);
  9772.         while (*s)
  9773.             s++;
  9774.         s++;
  9775.         strcpy (text[n].prefont, s);
  9776.         while (*s)
  9777.             s++;
  9778.         s++;
  9779.         strcpy (text[n].postfont, s);
  9780.         while (*s)
  9781.             s++;
  9782.         s++;
  9783.         text[n].sw = atoi (s);
  9784.         while (*s)
  9785.             s++;
  9786.         s++;
  9787.         text[n].color = atoi (s);
  9788.         while (*s)
  9789.             s++;
  9790.         s++;
  9791.         text[n].xpos = atoi (s);
  9792.         while (*s)
  9793.             s++;
  9794.         s++;
  9795.         text[n].ypos = atoi (s);
  9796.         strcpy (txt, text[n].prefont);
  9797.         strcat (txt, "/");
  9798.         strcat (txt, text[n].postfont);
  9799.         if (NULL == (a = pf_open (txt)))
  9800.         {
  9801.             sprintf (msg1, "Font = %s, text[%d]", txt, n);
  9802.             bad_data2 ("Text string font could not be read, request ignored.", msg1);
  9803.             pf_close (a);
  9804.             null_text (&text[n]);
  9805.             return (FALSE);
  9806.         }
  9807.         else
  9808.             *(rw_toggle + N_image + N_contour + N_vector + n) = TRUE;
  9809.     }
  9810.     else if (*s == 'i')
  9811.     {
  9812.         while (*q)
  9813.         {
  9814.             if (*q == fd)
  9815.                 *q = nd;
  9816.             q++;
  9817.         }
  9818.         s++;
  9819.         n = atoi (s);
  9820.         while (*s)
  9821.             s++;
  9822.         s++;
  9823.         strcpy (image[n].fname, s);
  9824.         while (*s)
  9825.             s++;
  9826.         s++;
  9827.         image[n].sw = atoi (s);
  9828.         while (*s)
  9829.             s++;
  9830.         s++;
  9831.         image[n].xpts = atoi (s);
  9832.         while (*s)
  9833.             s++;
  9834.         s++;
  9835.         image[n].ypts = atoi (s);
  9836.         while (*s)
  9837.             s++;
  9838.         s++;
  9839.         image[n].xpos = atoi (s);
  9840.         while (*s)
  9841.             s++;
  9842.         s++;
  9843.         image[n].ypos = atoi (s);
  9844.         z = check_image (image[n].fname, &image[n].xpts, &image[n].ypts, &nxpts, &nypts, 1, &filetype);
  9845.         if (z == 1)
  9846.         {
  9847.             (void) swapdirnames (image[n].fname, dir, tmpfn);
  9848.             z = check_image (tmpfn, &image[n].xpts, &image[n].ypts, &nxpts, &nypts, 1, &filetype);
  9849.             if (z != 1)
  9850.                 strcpy (image[n].fname, tmpfn);
  9851.         }
  9852.         if (z == 1)
  9853.         {
  9854.             sprintf (msg1, "File = %s, image[%d]", image[n].fname, n);
  9855.             bad_data2 ("Cannot open image file. Tried program settings directory also! Request ignored.", msg1);
  9856.         }
  9857.         else if (z == 2)
  9858.         {
  9859.             sprintf (msg1, "File = %s, image[%d]", image[n].fname, n);
  9860.             bad_data2 ("X-pts * Y-pts != image filesize, request ignored.", msg1);
  9861.         }
  9862.         else if (z == 3)
  9863.         {
  9864.             sprintf (msg1, "File = %s, image[%d]", image[n].fname, n);
  9865.             bad_data2 ("Not enough images in HDF file, request ignored.", msg1);
  9866.         }
  9867.         else if (z < 0)    /* HDF error */
  9868.         {
  9869.             sprintf (msg1, "HDF file error (DFerror = %d), request ignored.", z);
  9870.             sprintf (msg2, "File = %s, image[%d]", image[n].fname, n);
  9871.             bad_data2 (msg1, msg2);
  9872.         }
  9873.         else if (z == 4)/* HDF - different size */
  9874.         {
  9875.             sprintf (msg1, "File = %s, image[%d], old(x=%d,y=%d) != new(x=%d,y=%d)", image[n].fname, n, image[n].xpts, image[n].ypts, nxpts, nypts);
  9876.             bad_data2 ("Image dimensions do not agree with those in HDF file - request ignored.", msg1);
  9877.         }
  9878.         if (z != 0)
  9879.         {
  9880.             null_image (&image[n]);
  9881.             return (FALSE);
  9882.         }
  9883.         else
  9884.             *(rw_toggle + n) = TRUE;
  9885.     }
  9886.     else if (*s == 'c')
  9887.     {
  9888.         while (*q)
  9889.         {
  9890.             if (*q == fd)
  9891.                 *q = nd;
  9892.             q++;
  9893.         }
  9894.         s++;
  9895.         n = atoi (s);
  9896.         while (*s)
  9897.             s++;
  9898.         s++;
  9899.         strcpy (con[n].fname, s);
  9900.         while (*s)
  9901.             s++;
  9902.         s++;
  9903.         con[n].sw = atoi (s);
  9904.         while (*s)
  9905.             s++;
  9906.         s++;
  9907.         con[n].color = atoi (s);
  9908.         while (*s)
  9909.             s++;
  9910.         s++;
  9911.         con[n].first = atoi (s);
  9912.         while (*s)
  9913.             s++;
  9914.         s++;
  9915.         con[n].last = atoi (s);
  9916.         while (*s)
  9917.             s++;
  9918.         s++;
  9919.         con[n].interval = atoi (s);
  9920.         while (*s)
  9921.             s++;
  9922.         s++;
  9923.         con[n].dis = atoi (s);
  9924.         while (*s)
  9925.             s++;
  9926.         s++;
  9927.         con[n].xpts = atoi (s);
  9928.         while (*s)
  9929.             s++;
  9930.         s++;
  9931.         con[n].ypts = atoi (s);
  9932.         while (*s)
  9933.             s++;
  9934.         s++;
  9935.         con[n].xpos = atoi (s);
  9936.         while (*s)
  9937.             s++;
  9938.         s++;
  9939.         con[n].ypos = atoi (s);
  9940.         z = check_image (con[n].fname, &con[n].xpts, &con[n].ypts, &nxpts, &nypts, 1, &filetype);
  9941.         if (z == 1)
  9942.         {
  9943.             (void) swapdirnames (con[n].fname, dir, tmpfn);
  9944.             z = check_image (tmpfn, &con[n].xpts, &con[n].ypts, &nxpts, &nypts, 1, &filetype);
  9945.             if (z != 1)
  9946.                 strcpy (con[n].fname, tmpfn);
  9947.         }
  9948.         if (z == 1)
  9949.         {
  9950.             sprintf (msg1, "File = %s, con[%d]", con[n].fname, n);
  9951.             bad_data2 ("Cannot open contour image file. Tried program settings directory also! Request ignored.", msg1);
  9952.         }
  9953.         else if (z == 2)
  9954.         {
  9955.             sprintf (msg1, "File = %s, con[%d]", con[n].fname, n);
  9956.             bad_data2 ("X-pts * Y-pts != contour image filesize, request ignored.", msg1);
  9957.         }
  9958.         else if (z == 3)
  9959.         {
  9960.             sprintf (msg1, "File = %s, con[%d]", con[n].fname, n);
  9961.             bad_data2 ("Not enough images in HDF file, request ignored.", msg1);
  9962.         }
  9963.         else if (z < 0)    /* HDF error */
  9964.         {
  9965.             sprintf (msg1, "HDF file error (DFerror = %d), request ignored.", z);
  9966.             sprintf (msg2, "File = %s, con[%d]", con[n].fname, n);
  9967.             bad_data2 (msg1, msg2);
  9968.         }
  9969.         else if (z == 4)/* HDF - different size */
  9970.         {
  9971.             sprintf (msg1, "File = %s, con[%d], old(x=%d,y=%d) != new(x=%d,y=%d)", con[n].fname, n, con[n].xpts, con[n].ypts, nxpts, nypts);
  9972.             bad_data2 ("Contour image dimensions do not agree with those in HDF file - request ignored.", msg1);
  9973.         }
  9974.         if (z != 0)
  9975.         {
  9976.             null_contour (&con[n]);
  9977.             return (FALSE);
  9978.         }
  9979.         else
  9980.             *(rw_toggle + N_image + n) = TRUE;
  9981.     }
  9982.     else if (*s == 'v')
  9983.     {
  9984.         while (*q)
  9985.         {
  9986.             if (*q == fd)
  9987.                 *q = nd;
  9988.             q++;
  9989.         }
  9990.         s++;
  9991.         n = atoi (s);
  9992.         while (*s)
  9993.             s++;
  9994.         s++;
  9995.         strcpy (vec[n].xname, s);
  9996.         while (*s)
  9997.             s++;
  9998.         s++;
  9999.         strcpy (vec[n].yname, s);
  10000.         while (*s)
  10001.             s++;
  10002.         s++;
  10003.         vec[n].sw = atoi (s);
  10004.         while (*s)
  10005.             s++;
  10006.         s++;
  10007.         vec[n].color = atoi (s);
  10008.         while (*s)
  10009.             s++;
  10010.         s++;
  10011.         vec[n].maxlen = atoi (s);
  10012.         while (*s)
  10013.             s++;
  10014.         s++;
  10015.         vec[n].xstart = atoi (s);
  10016.         while (*s)
  10017.             s++;
  10018.         s++;
  10019.         vec[n].xend = atoi (s);
  10020.         while (*s)
  10021.             s++;
  10022.         s++;
  10023.         vec[n].xinterval = atoi (s);
  10024.         while (*s)
  10025.             s++;
  10026.         s++;
  10027.         vec[n].xdis = atoi (s);
  10028.         while (*s)
  10029.             s++;
  10030.         s++;
  10031.         vec[n].ystart = atoi (s);
  10032.         while (*s)
  10033.             s++;
  10034.         s++;
  10035.         vec[n].yend = atoi (s);
  10036.         while (*s)
  10037.             s++;
  10038.         s++;
  10039.         vec[n].yinterval = atoi (s);
  10040.         while (*s)
  10041.             s++;
  10042.         s++;
  10043.         vec[n].xzero = atoi (s);
  10044.         while (*s)
  10045.             s++;
  10046.         s++;
  10047.         vec[n].yzero = atoi (s);
  10048.         while (*s)
  10049.             s++;
  10050.         s++;
  10051.         vec[n].ydis = atoi (s);
  10052.         while (*s)
  10053.             s++;
  10054.         s++;
  10055.         vec[n].xpts = atoi (s);
  10056.         while (*s)
  10057.             s++;
  10058.         s++;
  10059.         vec[n].ypts = atoi (s);
  10060.         while (*s)
  10061.             s++;
  10062.         s++;
  10063.         vec[n].xpos = atoi (s);
  10064.         while (*s)
  10065.             s++;
  10066.         s++;
  10067.         vec[n].ypos = atoi (s);
  10068.         while (*s)
  10069.             s++;
  10070.         s++;
  10071.         sscanf (s, "%f", &f);
  10072.         vec[n].xscale = f;
  10073.         while (*s)
  10074.             s++;
  10075.         s++;
  10076.         sscanf (s, "%f", &f);
  10077.         vec[n].yscale = f;
  10078.         z = check_image (vec[n].xname, &vec[n].xpts, &vec[n].ypts, &nxpts, &nypts, 1, &filetype);
  10079.         if (z == 1)
  10080.         {
  10081.             (void) swapdirnames (vec[n].xname, dir, tmpfn);
  10082.             z = check_image (tmpfn, &vec[n].xpts, &vec[n].ypts, &nxpts, &nypts, 1, &filetype);
  10083.             if (z != 1)
  10084.                 strcpy (vec[n].xname, tmpfn);
  10085.         }
  10086.         if (z == 1)
  10087.         {
  10088.             sprintf (msg1, "File = %s, vec[%d]", vec[n].xname, n);
  10089.             bad_data2 ("Cannot open x-image file. Tried program settings directory also! Request ignored.", msg1);
  10090.         }
  10091.         else if (z == 2)
  10092.         {
  10093.             sprintf (msg1, "File = %s, vec[%d]", vec[n].xname, n);
  10094.             bad_data2 ("X-pts * Y-pts != x-image filesize, request ignored.", msg1);
  10095.         }
  10096.         else if (z == 3)
  10097.         {
  10098.             sprintf (msg1, "File = %s, vec[%d]", vec[n].xname, n);
  10099.             bad_data2 ("Not enough images in HDF file, request ignored.", msg1);
  10100.         }
  10101.         else if (z < 0)    /* HDF error */
  10102.         {
  10103.             sprintf (msg1, "HDF file error (DFerror = %d), request ignored.", z);
  10104.             sprintf (msg2, "File = %s, vec[%d]", vec[n].xname, n);
  10105.             bad_data2 (msg1, msg2);
  10106.         }
  10107.         else if (z == 4)/* HDF - different size */
  10108.         {
  10109.             sprintf (msg1, "File = %s, vec[%d], old(x=%d,y=%d) != new(x=%d,y=%d)", vec[n].xname, n, vec[n].xpts, vec[n].ypts, nxpts, nypts);
  10110.             bad_data2 ("X-image dimensions do not agree with those in HDF file - request ignored.", msg1);
  10111.         }
  10112.         if (z != 0)
  10113.         {
  10114.             null_vector (&vec[n]);
  10115.             return (FALSE);
  10116.         }
  10117.         z = check_image (vec[n].yname, &vec[n].xpts, &vec[n].ypts, &nxpts, &nypts, (!strcmp (vec[n].xname, vec[n].yname)) ? 2 : 1, &filetype);
  10118.         if (z == 1)
  10119.         {
  10120.             (void) swapdirnames (vec[n].yname, dir, tmpfn);
  10121.             z = check_image (tmpfn, &vec[n].xpts, &vec[n].ypts, &nxpts, &nypts, (!strcmp (vec[n].xname, tmpfn)) ? 2 : 1, &filetype);
  10122.             if (z != 1)
  10123.                 strcpy (vec[n].yname, tmpfn);
  10124.         }
  10125.         if (z == 1)
  10126.         {
  10127.             sprintf (msg1, "File = %s, vec[%d]", vec[n].yname, n);
  10128.             bad_data2 ("Cannot open y-image file. Tried program settings directory also! Request ignored.", msg1);
  10129.         }
  10130.         else if (z == 2)
  10131.         {
  10132.             sprintf (msg1, "File = %s, vec[%d]", vec[n].yname, n);
  10133.             bad_data2 ("X-pts * Y-pts != y-image filesize, request ignored.", msg1);
  10134.         }
  10135.         else if (z == 3)
  10136.         {
  10137.             sprintf (msg1, "File = %s, vec[%d]", vec[n].yname, n);
  10138.             bad_data2 ("Not enough images in HDF file, request ignored.");
  10139.         }
  10140.         else if (z < 0)    /* HDF error */
  10141.         {
  10142.             sprintf (msg1, "HDF file error (DFerror = %d), request ignored.", z);
  10143.             sprintf (msg2, "File = %s, vec[%d]", vec[n].yname, n);
  10144.             bad_data2 (msg1, msg2);
  10145.         }
  10146.         else if (z == 4)/* HDF - different size */
  10147.         {
  10148.             sprintf (msg1, "File = %s, vec[%d], old(x=%d,y=%d) != new(x=%d,y=%d)", vec[n].yname, n, vec[n].xpts, vec[n].ypts, nxpts, nypts);
  10149.             bad_data2 ("Y-image dimensions do not agree with those in HDF file - request ignored.", msg1);
  10150.         }
  10151.         if (z != 0)
  10152.         {
  10153.             null_vector (&vec[n]);
  10154.             return (FALSE);
  10155.         }
  10156.         else
  10157.             *(rw_toggle + N_image + N_contour + n) = TRUE;
  10158.     }
  10159.     else if (*s == 'f')
  10160.     {
  10161.         while (*q)
  10162.         {
  10163.             if (*q == fd)
  10164.                 *q = nd;
  10165.             q++;
  10166.         }
  10167.         s++;
  10168.         c = *s++;
  10169.         n = atoi (s);
  10170.         if (c == 'c')
  10171.             n = n + N_image;
  10172.         else if (c == 'v')
  10173.             n = n + N_image + N_contour;
  10174.         else;
  10175.         while (*s)
  10176.             s++;
  10177.         s++;
  10178.         feat[n].xax_sw = atoi (s);
  10179.         while (*s)
  10180.             s++;
  10181.         s++;
  10182.         feat[n].xax_thick = atoi (s);
  10183.         while (*s)
  10184.             s++;
  10185.         s++;
  10186.         feat[n].xax_color = atoi (s);
  10187.         while (*s)
  10188.             s++;
  10189.         s++;
  10190.         feat[n].xax_bot = atoi (s);
  10191.         while (*s)
  10192.             s++;
  10193.         s++;
  10194.         feat[n].xax_top = atoi (s);
  10195.         while (*s)
  10196.             s++;
  10197.         s++;
  10198.         feat[n].yax_sw = atoi (s);
  10199.         while (*s)
  10200.             s++;
  10201.         s++;
  10202.         feat[n].yax_thick = atoi (s);
  10203.         while (*s)
  10204.             s++;
  10205.         s++;
  10206.         feat[n].yax_color = atoi (s);
  10207.         while (*s)
  10208.             s++;
  10209.         s++;
  10210.         feat[n].yax_left = atoi (s);
  10211.         while (*s)
  10212.             s++;
  10213.         s++;
  10214.         feat[n].yax_right = atoi (s);
  10215.         while (*s)
  10216.             s++;
  10217.         s++;
  10218.         feat[n].xgr_sw = atoi (s);
  10219.         while (*s)
  10220.             s++;
  10221.         s++;
  10222.         feat[n].xgr_thick = atoi (s);
  10223.         while (*s)
  10224.             s++;
  10225.         s++;
  10226.         feat[n].xgr_color = atoi (s);
  10227.         while (*s)
  10228.             s++;
  10229.         s++;
  10230.         feat[n].xgr_space = atoi (s);
  10231.         while (*s)
  10232.             s++;
  10233.         s++;
  10234.         feat[n].ygr_sw = atoi (s);
  10235.         while (*s)
  10236.             s++;
  10237.         s++;
  10238.         feat[n].ygr_thick = atoi (s);
  10239.         while (*s)
  10240.             s++;
  10241.         s++;
  10242.         feat[n].ygr_color = atoi (s);
  10243.         while (*s)
  10244.             s++;
  10245.         s++;
  10246.         feat[n].ygr_space = atoi (s);
  10247.         while (*s)
  10248.             s++;
  10249.         s++;
  10250.         feat[n].xt1_sw = atoi (s);
  10251.         while (*s)
  10252.             s++;
  10253.         s++;
  10254.         feat[n].xt1_thick = atoi (s);
  10255.         while (*s)
  10256.             s++;
  10257.         s++;
  10258.         feat[n].xt1_color = atoi (s);
  10259.         while (*s)
  10260.             s++;
  10261.         s++;
  10262.         feat[n].xt1_bot = atoi (s);
  10263.         while (*s)
  10264.             s++;
  10265.         s++;
  10266.         feat[n].xt1_top = atoi (s);
  10267.         while (*s)
  10268.             s++;
  10269.         s++;
  10270.         feat[n].xt1_space = atoi (s);
  10271.         while (*s)
  10272.             s++;
  10273.         s++;
  10274.         feat[n].xt1_len = atoi (s);
  10275.         while (*s)
  10276.             s++;
  10277.         s++;
  10278.         feat[n].xt1_direc = atoi (s);
  10279.         while (*s)
  10280.             s++;
  10281.         s++;
  10282.         feat[n].yt1_sw = atoi (s);
  10283.         while (*s)
  10284.             s++;
  10285.         s++;
  10286.         feat[n].yt1_thick = atoi (s);
  10287.         while (*s)
  10288.             s++;
  10289.         s++;
  10290.         feat[n].yt1_color = atoi (s);
  10291.         while (*s)
  10292.             s++;
  10293.         s++;
  10294.         feat[n].yt1_left = atoi (s);
  10295.         while (*s)
  10296.             s++;
  10297.         s++;
  10298.         feat[n].yt1_right = atoi (s);
  10299.         while (*s)
  10300.             s++;
  10301.         s++;
  10302.         feat[n].yt1_space = atoi (s);
  10303.         while (*s)
  10304.             s++;
  10305.         s++;
  10306.         feat[n].yt1_len = atoi (s);
  10307.         while (*s)
  10308.             s++;
  10309.         s++;
  10310.         feat[n].yt1_direc = atoi (s);
  10311.         while (*s)
  10312.             s++;
  10313.         s++;
  10314.         feat[n].xt2_sw = atoi (s);
  10315.         while (*s)
  10316.             s++;
  10317.         s++;
  10318.         feat[n].xt2_thick = atoi (s);
  10319.         while (*s)
  10320.             s++;
  10321.         s++;
  10322.         feat[n].xt2_color = atoi (s);
  10323.         while (*s)
  10324.             s++;
  10325.         s++;
  10326.         feat[n].xt2_bot = atoi (s);
  10327.         while (*s)
  10328.             s++;
  10329.         s++;
  10330.         feat[n].xt2_top = atoi (s);
  10331.         while (*s)
  10332.             s++;
  10333.         s++;
  10334.         feat[n].xt2_space = atoi (s);
  10335.         while (*s)
  10336.             s++;
  10337.         s++;
  10338.         feat[n].xt2_len = atoi (s);
  10339.         while (*s)
  10340.             s++;
  10341.         s++;
  10342.         feat[n].xt2_direc = atoi (s);
  10343.         while (*s)
  10344.             s++;
  10345.         s++;
  10346.         feat[n].yt2_sw = atoi (s);
  10347.         while (*s)
  10348.             s++;
  10349.         s++;
  10350.         feat[n].yt2_thick = atoi (s);
  10351.         while (*s)
  10352.             s++;
  10353.         s++;
  10354.         feat[n].yt2_color = atoi (s);
  10355.         while (*s)
  10356.             s++;
  10357.         s++;
  10358.         feat[n].yt2_left = atoi (s);
  10359.         while (*s)
  10360.             s++;
  10361.         s++;
  10362.         feat[n].yt2_right = atoi (s);
  10363.         while (*s)
  10364.             s++;
  10365.         s++;
  10366.         feat[n].yt2_space = atoi (s);
  10367.         while (*s)
  10368.             s++;
  10369.         s++;
  10370.         feat[n].yt2_len = atoi (s);
  10371.         while (*s)
  10372.             s++;
  10373.         s++;
  10374.         feat[n].yt2_direc = atoi (s);
  10375.     }
  10376.     else if (*s == 'b')
  10377.     {
  10378.         while (*q)
  10379.         {
  10380.             if (*q == fd)
  10381.                 *q = nd;
  10382.             q++;
  10383.         }
  10384.         while (*s)
  10385.             s++;
  10386.         s++;
  10387.         cbar.sw = atoi (s);
  10388.         while (*s)
  10389.             s++;
  10390.         s++;
  10391.         cbar.xpts = atoi (s);
  10392.         while (*s)
  10393.             s++;
  10394.         s++;
  10395.         cbar.ypts = atoi (s);
  10396.         while (*s)
  10397.             s++;
  10398.         s++;
  10399.         cbar.xpos = atoi (s);
  10400.         while (*s)
  10401.             s++;
  10402.         s++;
  10403.         cbar.ypos = atoi (s);
  10404.     }
  10405.     else if (*s == 'g')
  10406.     {
  10407.         while (*q)
  10408.         {
  10409.             if (*q == fd)
  10410.                 *q = nd;
  10411.             q++;
  10412.         }
  10413.         while (*s)
  10414.             s++;
  10415.         s++;
  10416.         grid.sw = atoi (s);
  10417.         while (*s)
  10418.             s++;
  10419.         s++;
  10420.         grid.xpix = atoi (s);
  10421.         while (*s)
  10422.             s++;
  10423.         s++;
  10424.         grid.ypix = atoi (s);
  10425.         while (*s)
  10426.             s++;
  10427.         s++;
  10428.         grid.color = atoi (s);
  10429.     }
  10430.     else;
  10431.     return (TRUE);
  10432. }
  10433. /* EOF */
  10434. /* cat > src+obj/tag_to_string.c << "EOF" */
  10435. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10436. /* tag_to_string: create a char string from a program    */
  10437. /*          tag                    */
  10438. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10439. /* SCCS information: %W%    %G% - NCSA */
  10440.  
  10441. /* #include "all.h" */
  10442.  
  10443. int    tag_to_string(t,n,s) char *t,*s; int n;
  10444. {
  10445.         char            *q,
  10446.                         fd = '\t',
  10447.                         td = '\n',
  10448.                         nd = '\0',
  10449.                         t_string[16];
  10450.     register int    m;
  10451.         *s++    = *t;
  10452.     if (*t == 'f')
  10453.        {if        (n >= N_image + N_contour)
  10454.            {*s++ = 'v';
  10455.         m = n - N_image - N_contour;
  10456.         my_itoa(m,s);
  10457.         while(*s) s++;
  10458.            }
  10459.         else if    (n >= N_image)
  10460.            {*s++ = 'c';
  10461.         m = n - N_image;
  10462.         my_itoa(m,s);
  10463.         while(*s) s++;
  10464.            }
  10465.         else
  10466.            {*s++ = 'i';
  10467.         my_itoa(n,s);
  10468.         while(*s) s++;
  10469.            }
  10470.        }
  10471.     else
  10472.        {if (n > -1)
  10473.            {my_itoa(n,s); while(*s) s++;}
  10474.         else;
  10475.        }
  10476.         *s++    = fd;
  10477.         if (*t == 'p')
  10478.           {q    = pfn;                          while (*q) *s++ = *q++; *s++ = fd;
  10479.            my_itoa(clear_color,s);              while (*s) s++;         *s++ = fd;
  10480.            *s++ = td;                           *s   = nd;
  10481.           }
  10482.         else if (*t == 't')
  10483.           {q    = text[n].body;                 while (*q) *s++ = *q++; *s++ = fd;
  10484.            q    = text[n].prefont;              while (*q) *s++ = *q++; *s++ = fd;
  10485.            q    = text[n].postfont;             while (*q) *s++ = *q++; *s++ = fd;
  10486.            my_itoa(text[n].sw,s);               while (*s) s++;         *s++ = fd;
  10487.            my_itoa(text[n].color,s);            while (*s) s++;         *s++ = fd;
  10488.            my_itoa(text[n].xpos,s);             while (*s) s++;         *s++ = fd;
  10489.            my_itoa(text[n].ypos,s);             while (*s) s++;         *s++ = fd;
  10490.            *s++ = td;                           *s   = nd;
  10491.           }
  10492.         else if (*t == 'v')
  10493.           {q    = vec[n].xname;                 while (*q) *s++ = *q++; *s++ = fd;
  10494.            q    = vec[n].yname;                 while (*q) *s++ = *q++; *s++ = fd;
  10495.            my_itoa(vec[n].sw,s);                while (*s) s++;         *s++ = fd;
  10496.            my_itoa(vec[n].color,s);             while (*s) s++;         *s++ = fd;
  10497.            my_itoa(vec[n].maxlen,s);            while (*s) s++;         *s++ = fd;
  10498.            my_itoa(vec[n].xstart,s);            while (*s) s++;         *s++ = fd;
  10499.            my_itoa(vec[n].xend,s);              while (*s) s++;         *s++ = fd;
  10500.            my_itoa(vec[n].xinterval,s);         while (*s) s++;         *s++ = fd;
  10501.            my_itoa(vec[n].xdis,s);              while (*s) s++;         *s++ = fd;
  10502.            my_itoa(vec[n].ystart,s);            while (*s) s++;         *s++ = fd;
  10503.            my_itoa(vec[n].yend,s);              while (*s) s++;         *s++ = fd;
  10504.            my_itoa(vec[n].yinterval,s);         while (*s) s++;         *s++ = fd;
  10505.            my_itoa(vec[n].xzero,s);             while (*s) s++;         *s++ = fd;
  10506.            my_itoa(vec[n].yzero,s);             while (*s) s++;         *s++ = fd;
  10507.            my_itoa(vec[n].ydis,s);              while (*s) s++;         *s++ = fd;
  10508.            my_itoa(vec[n].xpts,s);              while (*s) s++;         *s++ = fd;
  10509.            my_itoa(vec[n].ypts,s);              while (*s) s++;         *s++ = fd;
  10510.            my_itoa(vec[n].xpos,s);              while (*s) s++;         *s++ = fd;
  10511.            my_itoa(vec[n].ypos,s);              while (*s) s++;         *s++ = fd;
  10512.            sprintf(t_string,"%f",vec[n].xscale);
  10513.            *s-- = nd;
  10514.            strcat(s,t_string);                  while (*s) s++;         *s++ = fd;
  10515.            sprintf(t_string,"%f",vec[n].yscale);
  10516.            *s-- = nd;
  10517.            strcat(s,t_string);                  while (*s) s++;         *s++ = fd;
  10518.            *s++ = td;                           *s   = nd;
  10519.           }
  10520.         else if (*t == 'c')
  10521.           {q    = con[n].fname;                 while (*q) *s++ = *q++; *s++ = fd;
  10522.            my_itoa(con[n].sw,s);                while (*s) s++;         *s++ = fd;
  10523.            my_itoa(con[n].color,s);             while (*s) s++;         *s++ = fd;
  10524.            my_itoa(con[n].first,s);             while (*s) s++;         *s++ = fd;
  10525.            my_itoa(con[n].last,s);              while (*s) s++;         *s++ = fd;
  10526.            my_itoa(con[n].interval,s);          while (*s) s++;         *s++ = fd;
  10527.            my_itoa(con[n].dis,s);               while (*s) s++;         *s++ = fd;
  10528.            my_itoa(con[n].xpts,s);              while (*s) s++;         *s++ = fd;
  10529.            my_itoa(con[n].ypts,s);              while (*s) s++;         *s++ = fd;
  10530.            my_itoa(con[n].xpos,s);              while (*s) s++;         *s++ = fd;
  10531.            my_itoa(con[n].ypos,s);              while (*s) s++;         *s++ = fd;
  10532.            *s++ = td;                           *s   = nd;
  10533.           }
  10534.         else if (*t == 'i')
  10535.           {q    = image[n].fname;               while (*q) *s++ = *q++; *s++ = fd;
  10536.            my_itoa(image[n].sw,s);              while (*s) s++;         *s++ = fd;
  10537.            my_itoa(image[n].xpts,s);            while (*s) s++;         *s++ = fd;
  10538.            my_itoa(image[n].ypts,s);            while (*s) s++;         *s++ = fd;
  10539.            my_itoa(image[n].xpos,s);            while (*s) s++;         *s++ = fd;
  10540.            my_itoa(image[n].ypos,s);            while (*s) s++;         *s++ = fd;
  10541.            *s++ = td;                           *s   = nd;
  10542.           }
  10543.         else if (*t == 'f')
  10544.           {my_itoa(feat[n].xax_sw,s);           while (*s) s++;         *s++ = fd;
  10545.            my_itoa(feat[n].xax_thick,s);        while (*s) s++;         *s++ = fd;
  10546.            my_itoa(feat[n].xax_color,s);        while (*s) s++;         *s++ = fd;
  10547.            my_itoa(feat[n].xax_bot,s);          while (*s) s++;         *s++ = fd;
  10548.            my_itoa(feat[n].xax_top,s);          while (*s) s++;         *s++ = fd;
  10549.            my_itoa(feat[n].yax_sw,s);           while (*s) s++;         *s++ = fd;
  10550.            my_itoa(feat[n].yax_thick,s);        while (*s) s++;         *s++ = fd;
  10551.            my_itoa(feat[n].yax_color,s);        while (*s) s++;         *s++ = fd;
  10552.            my_itoa(feat[n].yax_left,s);         while (*s) s++;         *s++ = fd;
  10553.            my_itoa(feat[n].yax_right,s);        while (*s) s++;         *s++ = fd;
  10554.            my_itoa(feat[n].xgr_sw,s);           while (*s) s++;         *s++ = fd;
  10555.            my_itoa(feat[n].xgr_thick,s);        while (*s) s++;         *s++ = fd;
  10556.            my_itoa(feat[n].xgr_color,s);        while (*s) s++;         *s++ = fd;
  10557.            my_itoa(feat[n].xgr_space,s);        while (*s) s++;         *s++ = fd;
  10558.            my_itoa(feat[n].ygr_sw,s);           while (*s) s++;         *s++ = fd;
  10559.            my_itoa(feat[n].ygr_thick,s);        while (*s) s++;         *s++ = fd;
  10560.            my_itoa(feat[n].ygr_color,s);        while (*s) s++;         *s++ = fd;
  10561.            my_itoa(feat[n].ygr_space,s);        while (*s) s++;         *s++ = fd;
  10562.            my_itoa(feat[n].xt1_sw,s);           while (*s) s++;         *s++ = fd;
  10563.            my_itoa(feat[n].xt1_thick,s);        while (*s) s++;         *s++ = fd;
  10564.            my_itoa(feat[n].xt1_color,s);        while (*s) s++;         *s++ = fd;
  10565.            my_itoa(feat[n].xt1_bot,s);          while (*s) s++;         *s++ = fd;
  10566.            my_itoa(feat[n].xt1_top,s);          while (*s) s++;         *s++ = fd;
  10567.            my_itoa(feat[n].xt1_space,s);        while (*s) s++;         *s++ = fd;
  10568.            my_itoa(feat[n].xt1_len,s);          while (*s) s++;         *s++ = fd;
  10569.            my_itoa(feat[n].xt1_direc,s);        while (*s) s++;         *s++ = fd;
  10570.            my_itoa(feat[n].yt1_sw,s);           while (*s) s++;         *s++ = fd;
  10571.            my_itoa(feat[n].yt1_thick,s);        while (*s) s++;         *s++ = fd;
  10572.            my_itoa(feat[n].yt1_color,s);        while (*s) s++;         *s++ = fd;
  10573.            my_itoa(feat[n].yt1_left,s);         while (*s) s++;         *s++ = fd;
  10574.            my_itoa(feat[n].yt1_right,s);        while (*s) s++;         *s++ = fd;
  10575.            my_itoa(feat[n].yt1_space,s);        while (*s) s++;         *s++ = fd;
  10576.            my_itoa(feat[n].yt1_len,s);          while (*s) s++;         *s++ = fd;
  10577.            my_itoa(feat[n].yt1_direc,s);        while (*s) s++;         *s++ = fd;
  10578.            my_itoa(feat[n].xt2_sw,s);           while (*s) s++;         *s++ = fd;
  10579.            my_itoa(feat[n].xt2_thick,s);        while (*s) s++;         *s++ = fd;
  10580.            my_itoa(feat[n].xt2_color,s);        while (*s) s++;         *s++ = fd;
  10581.            my_itoa(feat[n].xt2_bot,s);          while (*s) s++;         *s++ = fd;
  10582.            my_itoa(feat[n].xt2_top,s);          while (*s) s++;         *s++ = fd;
  10583.            my_itoa(feat[n].xt2_space,s);        while (*s) s++;         *s++ = fd;
  10584.            my_itoa(feat[n].xt2_len,s);          while (*s) s++;         *s++ = fd;
  10585.            my_itoa(feat[n].xt2_direc,s);        while (*s) s++;         *s++ = fd;
  10586.            my_itoa(feat[n].yt2_sw,s);           while (*s) s++;         *s++ = fd;
  10587.            my_itoa(feat[n].yt2_thick,s);        while (*s) s++;         *s++ = fd;
  10588.            my_itoa(feat[n].yt2_color,s);        while (*s) s++;         *s++ = fd;
  10589.            my_itoa(feat[n].yt2_left,s);         while (*s) s++;         *s++ = fd;
  10590.            my_itoa(feat[n].yt2_right,s);        while (*s) s++;         *s++ = fd;
  10591.            my_itoa(feat[n].yt2_space,s);        while (*s) s++;         *s++ = fd;
  10592.            my_itoa(feat[n].yt2_len,s);          while (*s) s++;         *s++ = fd;
  10593.            my_itoa(feat[n].yt2_direc,s);        while (*s) s++;         *s++ = fd;
  10594.            *s++ = td;                           *s   = nd;
  10595.           }
  10596.         else if (*t == 'b')
  10597.           {my_itoa(cbar.sw,s);                  while (*s) s++;         *s++ = fd;
  10598.            my_itoa(cbar.xpts,s);                while (*s) s++;         *s++ = fd;
  10599.            my_itoa(cbar.ypts,s);                while (*s) s++;         *s++ = fd;
  10600.            my_itoa(cbar.xpos,s);                while (*s) s++;         *s++ = fd;
  10601.            my_itoa(cbar.ypos,s);                while (*s) s++;         *s++ = fd;
  10602.            *s++ = td;                           *s   = nd;
  10603.           }
  10604.         else if (*t == 'g')
  10605.           {my_itoa(grid.sw,s);                  while (*s) s++;         *s++ = fd;
  10606.            my_itoa(grid.xpix,s);                while (*s) s++;         *s++ = fd;
  10607.            my_itoa(grid.ypix,s);                while (*s) s++;         *s++ = fd;
  10608.            my_itoa(grid.color,s);               while (*s) s++;         *s++ = fd;
  10609.            *s++ = td;                           *s   = nd;
  10610.           }
  10611.     else;
  10612.         return;
  10613. }
  10614. /* EOF */
  10615. /* cat > src+obj/warn_msg.c << "EOF" */
  10616. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10617. /* warn_msg: warn user that displayed data will be    */
  10618. /*         lost on "Done"                */
  10619. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10620. /* SCCS information: %W%    %G% - NCSA */
  10621.  
  10622. /* #include "all.h" */
  10623.  
  10624. int    warn_msg()
  10625. {
  10626.     info_msg("          ** WARNING ** The data displayed has not been stored",
  10627.          "and will be lost if you put away this frame.  Press CONFIRM to",
  10628.          "put away the frame anyway.");
  10629.     return;
  10630. }
  10631. /* EOF */
  10632. /* cat > src+obj/warn_msgt.c << "EOF" */
  10633. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10634. /* warn_msgt: tag chg - warn user that displayed data    */
  10635. /*          will be lost                */
  10636. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10637. /* SCCS information: %W%    %G% - NCSA */
  10638.  
  10639. /* #include "all.h" */
  10640.  
  10641. int    warn_msgt()
  10642. {
  10643.     info_msg("          ** WARNING ** The data displayed has not been stored",
  10644.          "and will be lost if you change tags now.  Press the same button",
  10645.          "again to change tags anyway.");
  10646.     return;
  10647. }
  10648. /* EOF */
  10649. /* cat > src+obj/bad_data2.c << "EOF" */
  10650. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10651. /* bad_data2: two-line error message on stderr before    */
  10652. /*          the base frame comes up or on the base    */
  10653. /*          frame after it comes up.            */
  10654. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10655. /* SCCS information: %W%    %G% - NCSA */
  10656.  
  10657. /* #include "all.h" */
  10658. /* #include "newext.h" */
  10659.  
  10660. void bad_data2 (s1, s2) char *s1, *s2;
  10661. {
  10662.  
  10663.     if (base_frame_up)
  10664.         info_msg2 ("           ----- ERROR MESSAGE -----",
  10665.                s1, s2,
  10666.                "           ----- ERROR MESSAGE -----");
  10667.     else
  10668.         fprintf (stderr, "%s\n%s\n%s\n%s\n",
  10669.              "           ----- ERROR MESSAGE -----",
  10670.              s1, s2,
  10671.              "           ----- ERROR MESSAGE -----");
  10672.     return;
  10673. }
  10674. /* EOF */
  10675. /* cat > src+obj/check_image.c << "EOF" */
  10676. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10677. /* check_image: return 0 if ok, 1 if file not openable,    */
  10678. /*            2 if badpts for non-HDF files, 3 if not */
  10679. /*        enough images in a HDF file, 4 if HDF    */
  10680. /*        file with new values, DFerror if HDF    */
  10681. /*        error. Returns the filetype.        */
  10682. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10683. /* SCCS information: %W%    %G% - NCSA */
  10684.  
  10685. /* #include "all.h" */
  10686. /* #include "newext.h" */
  10687.  
  10688. int    check_image (s, w1, h1, w2, h2, n, filetype)
  10689.  
  10690.            char    *s;
  10691.            int    *w1, *h1, *w2, *h2;
  10692.            int    n;     /* sequence number of image in HDF file */
  10693.            int *filetype;    /* VALUE RETURNED -
  10694.                         0 - regular file
  10695.                         1 - HDF file
  10696.                        -1 - undefined */
  10697. {
  10698.     int        f, size, i, dummy;
  10699.     DF        *file;
  10700.  
  10701.     *filetype = -1;
  10702.     if (DFR8getdims (s, w2, h2, &dummy))
  10703.     {
  10704.         DFR8restart ();
  10705.         if (DFerror == DFE_FNF)        /* file not found error */
  10706.             return (1);
  10707.         else if (DFerror == DFE_NOTDFFILE)    /* regular file */
  10708.         {
  10709.             stat(s,&my_stat);
  10710.             if (w1 == NULL || h1 == NULL)    /* should have values */
  10711.                 return (2);
  10712.             size = (*w1) * (*h1);
  10713.             *filetype = 0;
  10714.             if (my_stat.st_size != size) return(2);
  10715.             return (0);
  10716.         }
  10717.         else if (DFerror == DFE_NOMATCH)    /* no image */
  10718.             return (3);
  10719.         else
  10720.             return (DFerror);    /* other HDF error */
  10721.     }
  10722.     for (i = 1; i < n; i++)
  10723.         if (DFR8getdims (s, w2, h2, &dummy)) 
  10724.         {
  10725.             DFR8restart ();
  10726.             if (DFerror == DFE_NOMATCH)
  10727.                 return (3);
  10728.             else
  10729.                 return (DFerror);    /* other HDF error */
  10730.         }
  10731.     DFR8restart();
  10732.     *filetype = 1;
  10733.     if (w1 == NULL || h1 == NULL)    /* at least one has no value yet */
  10734.         return (4);
  10735.     if ((*w1) != (*w2) || (*h1) != (*h2))
  10736.         return (4);            /* new size */
  10737.     else
  10738.         return (0);
  10739. }
  10740. /* EOF */
  10741. /* cat > src+obj/check_palette.c << "EOF" */
  10742. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10743. /* check_file: return 0 if ok, 1 if file not openable,    */
  10744. /*           2 if badpts for non-HDF files, 3 if not    */
  10745. /*           enough palettes in HDF file, DFerror if  */
  10746. /*           HDF error.                */
  10747. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10748. /* SCCS information: %W%    %G% - NCSA */
  10749.  
  10750. /* #include "all.h" */
  10751. /* #include "newext.h" */
  10752.  
  10753. #define    PALLETE_SIZE    768
  10754.  
  10755. int    check_palette (s, n)
  10756.  
  10757.            char    *s;
  10758.            int    n;     /* sequence number of palette in HDF file */
  10759. {
  10760.     int        npals, size; 
  10761.  
  10762.     if ((npals = DFPnpals (s)) == -1)
  10763.     {
  10764.         DFPrestart ();
  10765.         if (DFerror == DFE_FNF)        /* file not found error */
  10766.             return (1);
  10767.         else if (DFerror == DFE_NOTDFFILE)    /* regular file */
  10768.         {
  10769.             stat(s,&my_stat);
  10770.             size = PALLETE_SIZE;
  10771.             if (my_stat.st_size != size) return(2);
  10772.             return (0);
  10773.         }
  10774.         else
  10775.             return (DFerror);    /* other HDF error */
  10776.     }
  10777.     else if (npals < n)
  10778.     {
  10779.         DFPrestart();
  10780.         return (3);
  10781.     }
  10782.     else
  10783.     {
  10784.         DFPrestart();
  10785.         return (0);
  10786.     }
  10787. }
  10788. /* EOF */
  10789. /* cat > src+obj/get_defaults.c << "EOF" */
  10790. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10791. /* get_defaults: get value of entry in defaults        */
  10792. /*          database                */
  10793. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10794. /* SCCS information: %W%    %G% - NCSA */
  10795.  
  10796. /* implementation note(s):
  10797.     1. The default value will be "".
  10798.     2. IMPORTANT NOTE: The Sun Defaults software seems to read
  10799.        the value of DEFAULTS_FILE only ONCE on the first call
  10800.        to one of their interface routines.
  10801.     3. In order to get around the problem of having user defaults
  10802.        files with
  10803.         /Defaults/Read_Defaults_DataBase
  10804.        being "False" the following must be done. On the first call
  10805.        a copy of the user's $HOME/.defaults file (if there is one)
  10806.        is copied to a temporary file. If there isn't one a two
  10807.        line file is created.  This temporary file becomes
  10808.        the value of DEFAULTS_FILE in the environment. If a "False"
  10809.        value is detected in the file then another version is created
  10810.        with the value being "True" and then "moved" to the original
  10811.        version.
  10812.     4. IMPORTANT NOTE: The Sun Defaults Software must read the "True"
  10813.        value above from the user's default file. Now the Sun Defaults
  10814.        Software was used to create the scratch version before copying
  10815.        to the original version. The original version may have had
  10816.        a "False" value for the attribute above. After the scratch
  10817.        version is "moved" to the original version the attribute above
  10818.        MUST BE REREAD! Then everything is good!
  10819. */
  10820.  
  10821. /* #include "all.h" */
  10822. /* #include "newext.h" */
  10823.  
  10824. char           *
  10825. get_defaults (s)
  10826.     char           *s;
  10827. {
  10828.     static int      startup = 1;
  10829.     static Bool     value_false = 0;
  10830.     static char     fn_tmp_defaults[36];
  10831.     static char     env_fn_new_defaults[64];
  10832.     static char    *header_line = "SunDefaults_Version 2\n";
  10833.     static char    *read_line = "/Defaults/Read_Defaults_Database    \"True\"\n";
  10834.     static char    *read_attribute = "/Defaults/Read_Defaults_Database";
  10835.     FILE           *fd_new_defaults, *fd_old_defaults, *fd_tmp_defaults;
  10836.     Bool            value_r;
  10837.     char           *home, *fn_old_defaults;
  10838.     char           *value_s;
  10839.     int             status;
  10840.  
  10841.     char           *getenv ();
  10842.  
  10843.     int             i, c;
  10844.  
  10845.     if (startup)
  10846.     {
  10847.         startup = 0;
  10848.         sprintf (fn_new_defaults, "/tmp/.defaults.%d", getpid ());
  10849.         if ((fd_new_defaults = fopen (fn_new_defaults, "w")) == NULL)
  10850.         {
  10851.             sprintf (msg, "File = %s", fn_new_defaults);
  10852.             bad_data2 ("Internal Error: Could not create temporary private database, CompositeTool terminated.", msg);
  10853.             exit (-1);
  10854.         }
  10855.         sprintf (env_fn_new_defaults, "DEFAULTS_FILE=%s", fn_new_defaults);
  10856.         if ((status = putenv (env_fn_new_defaults)) != 0)
  10857.         {
  10858.             bad_data2 ("Internal Error: Could not save DEFAULTS_FILE environment variable, CompositeTool terminated.", "");
  10859.             exit (-1);
  10860.         }
  10861.         if ((home = getenv ("HOME")) == NULL)
  10862.         {
  10863.             bad_data2 ("Internal Error: Could not get the value of $HOME from the environment, CompositeTool terminated.", "");
  10864.             exit (-1);
  10865.         }
  10866.         if ((fn_old_defaults = (char *) malloc (strlen (home) + 11)) == NULL)
  10867.         {
  10868.             bad_data2 ("Internal Error: Could not create storage for $HOME/.defaults string, CompositeTool terminated.", "");
  10869.             exit (-1);
  10870.         }
  10871.         sprintf (fn_old_defaults, "%s/.defaults", home);
  10872.         if ((fd_old_defaults = fopen (fn_old_defaults, "r")) == NULL)
  10873.         {
  10874.             (void) fputs (header_line, fd_new_defaults);
  10875.             (void) fputs (read_line, fd_new_defaults);
  10876.             (void) fclose (fd_new_defaults);
  10877.         }
  10878.         else
  10879.         {        /* copy users private default to temporary
  10880.                    private defaults */
  10881.             while ((c = getc (fd_old_defaults)) != EOF)
  10882.                 (void) putc (c, fd_new_defaults);
  10883.             (void) fflush (fd_new_defaults);
  10884.             (void) fclose (fd_old_defaults);
  10885.             (void) fclose (fd_new_defaults);
  10886.         }
  10887.         free (fn_old_defaults);
  10888.         value_r = defaults_get_boolean ("/Defaults/Read_Defaults_Database", value_false, 0);
  10889.         if (!value_r)
  10890.         {
  10891.             sprintf (fn_tmp_defaults, "/tmp/.defaults.tmp.%d", getpid ());
  10892.             if ((fd_tmp_defaults = fopen (fn_tmp_defaults, "w+")) == NULL)
  10893.             {
  10894.                 sprintf (msg, "File = %s", fn_tmp_defaults);
  10895.                 bad_data2 ("Internal Error: Could not create scratch private database, CompositeTool terminated.", msg);
  10896.                 exit (-1);
  10897.             }
  10898.             (void) fputs (header_line, fd_tmp_defaults);
  10899.             (void) fputs (read_line, fd_tmp_defaults);
  10900.             move_defaults ("/", fd_tmp_defaults);
  10901.             (void) fflush (fd_tmp_defaults);
  10902.             rewind (fd_tmp_defaults);
  10903.             if ((fd_new_defaults = fopen (fn_new_defaults, "w")) == NULL)
  10904.             {
  10905.                 sprintf (msg, "File = %s", fn_tmp_defaults);
  10906.                 bad_data2 ("Internal Error: Could not open temporary private database, CompositeTool terminated.", msg);
  10907.                 exit (-1);
  10908.             }
  10909.             while ((c = getc (fd_tmp_defaults)) != EOF)
  10910.                 putc (c, fd_new_defaults);
  10911.             (void) fflush (fd_new_defaults);
  10912.             (void) fclose (fd_new_defaults);
  10913.             (void) fclose (fd_tmp_defaults);
  10914.             (void) unlink (fn_tmp_defaults);
  10915.                 /* the most important line in the
  10916.                    whole module */
  10917.             defaults_reread (read_attribute, NULL);
  10918.         }
  10919.     }
  10920.  
  10921.     value_s = defaults_get_string (s, "", 0);
  10922.     return ((*value_s == NULL) ? NULL : value_s);
  10923. }
  10924. /* EOF */
  10925. /* cat > src+obj/info_msg2.c << "EOF" */
  10926. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10927. /* info_msg2: put four messages on the main panel    */
  10928. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10929. /* SCCS information: %W%    %G% - NCSA */
  10930.  
  10931. /* #include "all.h" */
  10932.  
  10933. int    info_msg2 (p,q,r,u) char *p,*q,*r,*u;
  10934. {
  10935.     char    m[10],*s,*t;
  10936.     msg_no++;
  10937.     my_itoa(msg_no,m);
  10938.     if (strlen(p) <= strlen(m))
  10939.        panel_set(pm[0],PANEL_LABEL_STRING,m,0);
  10940.     else
  10941.        {s = m;
  10942.         t = p;
  10943.         while (*s) *t++ = *s++;
  10944.         panel_set(pm[0],PANEL_LABEL_STRING,p,0);
  10945.        }
  10946.     panel_set(pm[1],PANEL_LABEL_STRING,q,0);
  10947.     panel_set(pm[2],PANEL_LABEL_STRING,r,0);
  10948.     panel_set(pm[3],PANEL_LABEL_STRING,u,0);
  10949.     return;
  10950. }
  10951. /* EOF */
  10952. /* cat > src+obj/itoa.c << "EOF" */
  10953. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10954. /* itoa: Convert n to characters in s.            */
  10955. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10956. /* SCCS information: %W%    %G% - NCSA */
  10957.  
  10958. /* #include "all.h" */
  10959. /* #include "newext.h" */
  10960.  
  10961. char *itoa (n, s)
  10962.     int n;
  10963.     char s[];
  10964. {
  10965.     int i, sign;
  10966.  
  10967.     if ((sign = n) < 0)    /* record sign */
  10968.         n = -n;        /* make n positive */
  10969.     i = 0;
  10970.     do            /* generate digits in reverse order */
  10971.     {
  10972.         s[i++] = n % 10 + '0';        /* get next digit */
  10973.     }
  10974.     while ((n /= 10) > 0);    /* delete it */
  10975.     if (sign < 0)
  10976.         s[i++] = '-';
  10977.     s[i] = '\0';
  10978.     reverse (s);
  10979.     return (s);
  10980. }
  10981. /* EOF */
  10982. /* cat > src+obj/load_contour_image.c << "EOF" */
  10983. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10984. /* load_contour_image: loads an image from a file -     */
  10985. /*               used by draw_contour.        */
  10986. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  10987. /* SCCS information: %W%    %G% - NCSA */
  10988.  
  10989. /* #include "all.h" */
  10990. /* #include "newext.h" */
  10991.  
  10992. int    load_contour_image (s, xpts, ypts, image, n)
  10993.            char *s; int xpts, ypts;
  10994.            unsigned char *image;
  10995.            int n;    /* sequence number of image in HDF file */
  10996. {
  10997.     int xdim, ydim, ispalette;
  10998.     int f;
  10999.     register int i, j;
  11000.     register unsigned char *p0, *p1;
  11001.  
  11002.     if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11003.     {
  11004.         DFR8restart ();
  11005.         if (DFerror == DFE_NOTDFFILE)    /* regular file */
  11006.         {
  11007.             f = open (s, O_RDONLY);
  11008.             read (f, image, xpts * ypts); 
  11009.             close (f);
  11010.             return (0);
  11011.         }
  11012.         else
  11013.         {    
  11014.             sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for contour image.", DFerror);
  11015.             sprintf (msg2, "File = %s, INTERNAL ERROR!", s);
  11016.             bad_data2 (msg, msg2);
  11017.             return (-1);
  11018.         }
  11019.     }
  11020.     for (i = 1; i < n; i++)    /* skip over the rest of the images */
  11021.         if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11022.         {
  11023.             DFR8restart ();
  11024.             sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for contour image.", DFerror);
  11025.             sprintf (msg2, "File = %s, INTERNAL ERROR!", s);
  11026.             bad_data2 (msg, msg2);
  11027.             return (-1);
  11028.         }
  11029.     if (xpts != xdim || ypts != ydim)
  11030.     {
  11031.         DFR8restart ();
  11032.         sprintf (msg, "Unexpected dimensions from HDF file while loading contour image.");
  11033.         sprintf (msg2, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d) - INTERNAL ERROR!", s, xpts, ypts, xdim, ydim);
  11034.         bad_data2 (msg, msg2);
  11035.         return (-1);
  11036.     }
  11037.     if (DFR8getimage (s, image, xdim, ydim, NULL))
  11038.     {
  11039.         DFR8restart ();
  11040.         sprintf (msg, "Did not load contour image from HDF file (DFerror = %d), request halted", DFerror);
  11041.         sprintf (msg2, "File = %s", s);
  11042.         bad_data2 (msg, msg2);
  11043.         return (-1);
  11044.     }
  11045.     DFR8restart ();
  11046.     return (0);
  11047. }
  11048. /* EOF */
  11049. /* cat > src+obj/load_image.c << "EOF" */
  11050. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11051. /* load_image: loads an image from a file - used by    */
  11052. /*           draw_image. Padding is done by         */
  11053. /*           pad_image.                */
  11054. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11055. /* SCCS information: %W%    %G% - NCSA */
  11056.  
  11057. /* #include "all.h" */
  11058. /* #include "newext.h" */
  11059.  
  11060. int 
  11061. load_image (s, xpts, ypts, xpos, ypos, mpr, n)
  11062.     char           *s;
  11063.     int             xpts, ypts, xpos, ypos;
  11064.     struct pixrect *mpr;
  11065.     int             n;    /* sequence number of image in HDF file */
  11066. {
  11067.     int             xdim, ydim, ispalette;
  11068.     int             f;
  11069.     register int    i, j;
  11070.     register unsigned char *p0, *p1;
  11071.     struct mpr_data *d;
  11072.  
  11073.     d = mpr_d (mpr);
  11074.     if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11075.     {
  11076.         DFR8restart ();
  11077.         if (DFerror == DFE_NOTDFFILE)    /* regular file */
  11078.         {
  11079.             f = open (s, O_RDONLY);
  11080.             read (f, (char *) d->md_image, xpts * ypts);
  11081.             pad_image (xpts, ypts, xpos, ypos, mpr);
  11082.             close (f);
  11083.             return (0);
  11084.         }
  11085.         else
  11086.         {
  11087.             if (base_frame_up)
  11088.             {
  11089.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) - INTERNAL ERROR!", DFerror);
  11090.                 sprintf (msg2, "File = %s", s);
  11091.                 bad_data2 (msg, msg2);
  11092.                 return (-1);
  11093.             }
  11094.             else
  11095.             {
  11096.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d), CompositeTool Terminated", DFerror);
  11097.                 sprintf (msg2, "File = %s - INTERNAL ERROR! ", s);
  11098.                 bad_data2 (msg, msg2);
  11099.                 return (-1);
  11100.             }
  11101.         }
  11102.     }
  11103.     for (i = 1; i < n; i++)    /* skip over the rest of the images */
  11104.         if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11105.         {
  11106.             DFR8restart ();
  11107.             if (base_frame_up)
  11108.             {
  11109.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) - INTERNAL ERROR!", DFerror);
  11110.                 sprintf (msg2, "File = %s", s);
  11111.                 bad_data2 (msg, msg2);
  11112.                 return (-1);
  11113.             }
  11114.             else
  11115.             {
  11116.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d), CompositeTool Terminated", DFerror);
  11117.                 sprintf (msg2, "File = %s - INTERNAL ERROR! ", s);
  11118.                 bad_data2 (msg, msg2);
  11119.                 return (-1);
  11120.             }
  11121.         }
  11122.     if (xpts != xdim || ypts != ydim)
  11123.     {
  11124.         DFR8restart ();
  11125.         if (base_frame_up)
  11126.         {
  11127.             sprintf (msg, "Unexpected dimensions from HDF file while loading - INTERNAL ERROR!", s);
  11128.             sprintf (msg2, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d)", s, xpts, ypts, xdim, ydim);
  11129.             bad_data2 (msg, msg2);
  11130.             return (-1);
  11131.         }
  11132.         else
  11133.         {
  11134.             sprintf (msg, "Unexpected dimensions from HDF file while loading, CompositeTool Terminated");
  11135.             sprintf (msg2, "File = %s - INTERNAL ERROR!", s);
  11136.             bad_data2 (msg, msg2);
  11137.             return (-1);
  11138.         }
  11139.     }
  11140.     if (DFR8getimage (s, (char *) d->md_image, xdim, ydim, NULL))
  11141.     {
  11142.         DFR8restart ();
  11143.         if (base_frame_up)
  11144.         {
  11145.             sprintf (msg, "Did not load image from HDF file (DFerror = %d), request halted", DFerror);
  11146.             sprintf (msg2, "File = %s", s);
  11147.             bad_data2 (msg, msg2);
  11148.             return (-1);
  11149.         }
  11150.         else
  11151.         {
  11152.             sprintf (msg, "Did not load image from HDF file (DFerror = %d), CompositeTool Terminated", DFerror);
  11153.             sprintf (msg2, "File = %s, check defaults database with defaultsedit.", s);
  11154.             bad_data2 (msg, msg2);
  11155.             return (-1);
  11156.         }
  11157.     }
  11158.     DFR8restart ();
  11159.     pad_image (xpts, ypts, xpos, ypos, mpr);
  11160.     return (0);
  11161. }
  11162. /* EOF */
  11163. /* cat > src+obj/load_vector_image.c << "EOF" */
  11164. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11165. /* load_vector_image: loads either x-image or y-image    */
  11166. /*              from a file - used by draw_vector    */
  11167. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11168. /* SCCS information: %W%    %G% - NCSA */
  11169.  
  11170. /* #include "all.h" */
  11171. /* #include "newext.h" */
  11172.  
  11173. int    load_vector_image (s, xpts, ypts, image, n, type)
  11174.            char *s; int xpts, ypts;
  11175.            unsigned char *image;
  11176.            int n;    /* sequence number of image in HDF file */
  11177.            int type;    /* 0 = x-image, 1 = y-image */
  11178. {
  11179.     int xdim, ydim, ispalette;
  11180.     int f;
  11181.     register int i, j;
  11182.     register unsigned char *p0, *p1;
  11183.  
  11184.     if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11185.     {
  11186.         DFR8restart ();
  11187.         if (DFerror == DFE_NOTDFFILE)    /* regular file */
  11188.         {
  11189.             f = open (s, O_RDONLY);
  11190.             read (f, image, xpts * ypts); 
  11191.             close (f);
  11192.             return (0);
  11193.         }
  11194.         else
  11195.         {    
  11196.             if (! type)
  11197.             {
  11198.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for vector x-image", DFerror);
  11199.                 sprintf (msg2, "file = %s - INTERNAL ERROR!", s);
  11200.             }
  11201.             else
  11202.             {
  11203.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for vector y-image", DFerror);
  11204.                 sprintf (msg2, "file = %s - INTERNAL ERROR!", s);
  11205.             }
  11206.             bad_data2 (msg, msg2);
  11207.             return (-1);
  11208.         }
  11209.     }
  11210.     for (i = 1; i < n; i++)    /* skip over the rest of the images */
  11211.         if (DFR8getdims (s, &xdim, &ydim, &ispalette))
  11212.         {
  11213.             DFR8restart ();
  11214.             if (! type)
  11215.             {
  11216.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for vector x-image", DFerror);
  11217.                 sprintf (msg2, "file = %s - INTERNAL ERROR!", s);
  11218.             }
  11219.             else
  11220.             {
  11221.                 sprintf (msg, "HDF error while getting dimensions (DFerror = %d) for vector y-image", DFerror);
  11222.                 sprintf (msg2, "file = %s - INTERNAL ERROR!", s);
  11223.             }
  11224.             bad_data2 (msg, msg2);
  11225.             return (-1);
  11226.         }
  11227.     if (xpts != xdim || ypts != ydim)
  11228.     {
  11229.         DFR8restart ();
  11230.         if (! type)
  11231.         {
  11232.             sprintf (msg, "Unexpected dimensions from HDF file while loading vector x-image.");
  11233.             sprintf (msg2, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d) - INTERNAL ERROR!", s, xpts, ypts, xdim, ydim);
  11234.         }
  11235.         else
  11236.         {
  11237.             sprintf (msg, "Unexpected dimensions from HDF file while loading vector y-image.");
  11238.             sprintf (msg2, "File = %s, old(x=%d,y=%d), new(x=%d,y=%d) - INTERNAL ERROR!", s, xpts, ypts, xdim, ydim);
  11239.         }
  11240.         bad_data2 (msg, msg2);
  11241.         return (-1);
  11242.     }
  11243.     if (DFR8getimage (s, image, xdim, ydim, NULL))
  11244.     {
  11245.         DFR8restart ();
  11246.         if (! type)
  11247.         {
  11248.             sprintf (msg, "Did not load vector x-image from HDF file (DFerror = %d), request halted", DFerror);
  11249.             sprintf (msg2, "File = %s", s);
  11250.         }
  11251.         else
  11252.         {
  11253.             sprintf (msg, "Did not load vector y-image from HDF file (DFerror = %d), request halted", DFerror);
  11254.             sprintf (msg2, "File = %s", s);
  11255.         }
  11256.         bad_data2 (msg, msg2);
  11257.         return (-1);
  11258.     }
  11259.     DFR8restart ();
  11260.     return (0);
  11261. }
  11262. /* EOF */
  11263. /* cat > src+obj/main_destroy_interposer.c << "EOF" */
  11264. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11265. /* main_destroy_interposer: destroy the base frame    */
  11266. /*                frame            */
  11267. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11268. /* SCCS information: %W%    %G% - NCSA */
  11269.  
  11270. /* #include "all.h" */
  11271. /* #include "newext.h" */
  11272.  
  11273. Notify_value 
  11274. main_destroy_interposer (frame, status)
  11275.     Frame frame;
  11276.     Destroy_status status;
  11277. {
  11278.     if (status != DESTROY_CHECKING)
  11279.     {
  11280.         (void) unlink (fn_new_defaults);
  11281.     }
  11282.     return (notify_next_destroy_func (frame, status));
  11283. }
  11284. /* EOF */
  11285. /* cat > src+obj/make_p.c << "EOF" */
  11286. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11287. /* make_p: makes a panel                */
  11288. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11289. /* SCCS information: %W%    %G% - NCSA */
  11290.  
  11291. /* #include "all.h" */
  11292. /* #include "newext.h" */
  11293.  
  11294. Panel make_p (f) Frame f;
  11295. {
  11296.     Panel panel;
  11297.         panel = window_create ( f, PANEL,
  11298.                 WIN_FONT, font_panel,
  11299.                 0);
  11300.     set_panel_colormap (panel, b_cmsn);
  11301.     return (panel);
  11302. }
  11303. /* EOF */
  11304. /* cat > src+obj/move_defaults.c << "EOF" */
  11305. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11306. /* move_defaults: move defaults from users .defaults    */
  11307. /*          file to temporary .defaults file    */
  11308. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11309. /* SCCS information: %W%    %G% - NCSA */
  11310.  
  11311. /* #include "all.h" */
  11312. /* #include "newext.h" */
  11313.  
  11314. void
  11315. move_defaults (path_name, fd)
  11316.     char           *path_name;
  11317.     FILE           *fd;
  11318. {
  11319.     static char    *read_attribute = "/Defaults/Read_Defaults_Database";
  11320.     char           *child, *sibling, *value;
  11321.     char            tmp[1024];
  11322.     int        i, c, len;
  11323.  
  11324.     if ((child = defaults_get_child (path_name, NULL)) == NULL)
  11325.     {
  11326.         if (strcmp (path_name, read_attribute))
  11327.         {
  11328.             (void) fputs (path_name, fd);
  11329.             (void) fputs ("\t\"", fd);
  11330.             value = defaults_get_string (path_name, "", 0);
  11331.             len = strlen (value);
  11332.                 /* special: double quotes in the string */
  11333.             for (i = 0; i < len; i++)
  11334.                 if ((c = (int) *value++) == '"')
  11335.                     (void) fputs ("\\\"", fd);
  11336.                 else
  11337.                     (void) fputc (c, fd);
  11338.             (void) fputs ("\"\n", fd);
  11339.         }
  11340.         return;
  11341.     }
  11342.  
  11343.     if (path_name[1] == NULL)    /* only / */
  11344.         sprintf (tmp, "%s%s", path_name, child);
  11345.     else
  11346.         sprintf (tmp, "%s/%s", path_name, child);
  11347.     move_defaults (tmp, fd);
  11348.     while ((sibling = defaults_get_sibling (tmp, NULL)) != NULL)
  11349.     {
  11350.         if (path_name[1] == NULL)    /* only / */
  11351.             sprintf (tmp, "%s%s", path_name, sibling);
  11352.         else
  11353.             sprintf (tmp, "%s/%s", path_name, sibling);
  11354.         move_defaults (tmp, fd);
  11355.     }
  11356. }
  11357. /* EOF */
  11358. /* cat > src+obj/pad_image.c << "EOF" */
  11359. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11360. /* pad_image: expand and pad a memory pixrect with     */
  11361. /*          clear_color.                */
  11362. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11363. /* SCCS information: %W%    %G% - NCSA */
  11364.  
  11365. /* #include "all.h" */
  11366.  
  11367. void
  11368. pad_image (xpts, ypts, xpos, ypos, mpr)
  11369.     int             xpts, ypts;    /* x and y dimensions of pixrect */
  11370.     int             xpos, ypos;    /* not used currently */
  11371.     Pixrect        *mpr;
  11372. {
  11373.     struct mpr_data *d;
  11374.     char           *image;
  11375.     register int    i, j, npad;
  11376.     register char  *p0;    /* character from pointer */
  11377.     register char  *p1;    /* character to pointer */
  11378.  
  11379.     d = mpr_d (mpr);
  11380.     image = (char *) d->md_image;
  11381.     p0 = image + xpts * ypts - 1;
  11382. /*
  11383.    BUG: mpr_linebytes () is wrong on Sun-3 and Sun-4. It computes padding
  11384.         to 16 bits not 32 bits which mem_create uses. Decided not to use it.
  11385.     Can't tell when it works!
  11386. */
  11387. #if sun == sparc || sun == mc68020 || sun == mc68030
  11388.     npad = (xpts % 4 == 0) ? 0 : 4 - xpts % 4;
  11389.     p1 = image + (xpts + npad) * ypts - 1;
  11390. #else
  11391.     npad = (xpts % 2 == 0) ? 0 : 2 - xpts % 2;
  11392.     p1 = image + (xpts + npad) * ypts - 1;
  11393. #endif
  11394. /*
  11395.     printf ("xpts, npad = %d %d\n", xpts, npad);
  11396. */
  11397.     if (npad == 0)        /* no padding required */
  11398.         return;
  11399.  /* make space and pad with NULL's */
  11400.     for (i = 0; i < npad; i++)
  11401.         *p1-- = clear_color;
  11402.     for (i = 0; i < ypts - 1; i++)    /* do all rows except first */
  11403.     {
  11404.         for (j = 0; j < xpts; j++)
  11405.             *p1-- = *p0--;
  11406.         for (j = 0; j < npad; j++)
  11407.             *p1-- = clear_color;
  11408.     }
  11409.     return;
  11410. }
  11411. /* EOF */
  11412. /* cat > src+obj/reverse.c << "EOF" */
  11413. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11414. /* reverse: reverse string s in place            */
  11415. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11416. /* SCCS information: %W%    %G% - NCSA */
  11417.  
  11418. /* #include "all.h" */
  11419. /* #include "newext.h" */
  11420.  
  11421. void reverse (s)
  11422.     char s[];
  11423. {
  11424.     int c, i, j;
  11425.  
  11426.     for (i = 0, j = strlen(s) - 1; i < j; i++, j--)
  11427.     {
  11428.         c = s[i];
  11429.         s[i] = s[j];
  11430.         s[j] = c;
  11431.     }
  11432. }
  11433. /* EOF */
  11434. /* cat > src+obj/store_image.c << "EOF" */
  11435. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11436. /* store_image: stores image alone in raw raster file    */
  11437. /*        or dimensions, image, and palette as a    */
  11438. /*        HDF 8-bit Raster Image set.        */
  11439. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11440. /* SCCS information: %W%    %G% - NCSA */
  11441.  
  11442. /* #include "all.h" */
  11443. /* #include "newext.h" */
  11444.  
  11445. int
  11446. store_image (fn, nx, ny, s, mode)
  11447.     char           *fn;    /* filename */
  11448.     int             nx, ny;    /* dimensions of image */
  11449.     unsigned char  *s;    /* image */
  11450.     int             mode;    /** 0 - HDF 8-bit Raster Image set
  11451.                     (uncompressed)
  11452.                     1 - HDF 8-bit Raster Image set
  11453.                     (compressed)
  11454.                     2 - image only in raw raster */
  11455. {
  11456.     int             f, i, nw;
  11457.     unsigned char  *p_palette;
  11458.  
  11459.     if ((f = creat (fn, my_otod (644))) == -1)
  11460.     {
  11461.         sprintf (msg, "Unix errno = %d, access or pwd problem?", errno);
  11462.         bad_data2 ("File creation failed, request ignored.", msg);
  11463.         return (-1);
  11464.     }
  11465.     if (mode == 0 || mode == 1)    /* HDF 8-bit Raster Image set */
  11466.     {
  11467.         close (f);
  11468.         p_palette = palette;
  11469.         for (i = 0; i < 256; i++)
  11470.         {
  11471.             *p_palette++ = red[i];
  11472.             *p_palette++ = green[i];
  11473.             *p_palette++ = blue[i];
  11474.         }
  11475.         if (DFR8setpalette (palette))
  11476.         {
  11477.             sprintf (msg, "HDF setpalette call failed (DFerror = %d), request ignored.", DFerror);
  11478.             bad_data (msg);
  11479.             return (-1);
  11480.         }
  11481.         if (DFR8putimage (fn, s, nx, ny, mode))
  11482.         {
  11483.             sprintf (msg, "HDF putimage call failed (DFerror = %d), request ignored.", DFerror);
  11484.             bad_data (msg);
  11485.             return (-1);
  11486.         }
  11487.     }
  11488.     else if (mode == 2)    /* raw raster */
  11489.     {
  11490.         if (nx * ny != (nw = write (f, image, nx * ny)))
  11491.         {
  11492.             if (nw == -1)
  11493.             {
  11494.                 close (f);
  11495.                 sprintf (msg, "UNIX errno = %d", errno);
  11496.                 bad_data2 ("Raw raster write to file failed, request ignored.", msg);
  11497.                 return (-1);
  11498.             }
  11499.             else
  11500.             {
  11501.                 close (f);
  11502.                 sprintf (msg, "Only %d of %d bytes written to raw raster file, request failed.", nw, nx * ny);
  11503.                 bad_data (msg);
  11504.                 return (-1);
  11505.             }
  11506.         }
  11507.         close (f);
  11508.     }
  11509.     else
  11510.     {
  11511.         sprintf (msg, "Mode = %d - INTERNAL ERROR!", mode);
  11512.         bad_data2 ("Bad mode value, request ignored.", msg);
  11513.         return (-1);
  11514.     }
  11515.     return (0);
  11516. }
  11517. /* EOF */
  11518. /* cat > src+obj/unpad_image.c << "EOF" */
  11519. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11520. /* unpad_image: compress out padding in memory pixrect    */
  11521. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11522. /* SCCS information: %W%    %G% - NCSA */
  11523.  
  11524. /* #include "all.h" */
  11525.  
  11526. void 
  11527. unpad_image (xpts, ypts, mpr)
  11528.     int             xpts, ypts;    /* x and y dimensions of pixrect */
  11529.     Pixrect *mpr;
  11530. {
  11531.     struct mpr_data *d;
  11532.     char           *image;
  11533.     register int    i, j, npad;
  11534.     register char  *p0;    /* character from pointer */
  11535.     register char  *p1;    /* character to pointer */
  11536.  
  11537.     d = mpr_d (mpr);
  11538.     image = (char *) d->md_image;
  11539.     p1 = image + xpts;
  11540. /*
  11541.    BUG: mpr_linebytes () is wrong on Sun-3 and Sun-4. It computes padding
  11542.         to 16 bits not 32 bits which mem_create uses. Decided not to use it.
  11543.     Can't tell when it works!
  11544. */
  11545. #if sun == sparc || sun == mc68020 || sun == mc68030
  11546.     npad = (xpts % 4 == 0) ? 0 : 4 - xpts % 4;
  11547.     p0 = image + (xpts + npad);
  11548. #else
  11549.     npad = (xpts % 2 == 0) ? 0 : 2 - xpts % 2;
  11550.     p0 = image + (xpts + npad);
  11551. #endif
  11552. /*
  11553.     printf ("xpts, npad = %d %d\n", xpts, npad);
  11554. */
  11555.     if (npad == 0)        /* no unpadding required */
  11556.         return;
  11557.  
  11558.  /* remove padding */
  11559.  
  11560.     for (i = 0; i < ypts - 1; i++)    /* do all rows except first */
  11561.     {
  11562.         for (j = 0; j < xpts; j++)
  11563.             *p1++ = *p0++;
  11564.         for (j = 0; j < npad; j++)
  11565.             p0++;
  11566.     }
  11567.     return;
  11568. }
  11569. /* EOF */
  11570. /* cat > src+obj/xstrcmp.c << "EOF" */
  11571. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11572. /* xstrcmp: compare two strings without leading or    */
  11573. /*        trailing white space.            */
  11574. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11575. /* SCCS information: %W%    %G% - NCSA */
  11576.  
  11577. /* #include "all.h" */
  11578. /* #include "newext.h" */
  11579.  
  11580. int xstrcmp (s, t)
  11581.     char *s, *t;
  11582. {
  11583.     msg[0] = '\0';
  11584.     msg2[0] = '\0';
  11585.     sscanf (s, "%s", msg);
  11586.     sscanf (t, "%s", msg2);
  11587.     return (strcmp(msg, msg2));
  11588. }
  11589. /* EOF */
  11590. /* cat > src+obj/xstrlen.c << "EOF" */
  11591. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11592. /* xstrlen: length of string with leading and trailing    */
  11593. /*        white space stripped off.            */
  11594. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11595. /* SCCS information: %W%    %G% - NCSA */
  11596.  
  11597. /* #include "all.h" */
  11598. /* #include "newext.h" */
  11599.  
  11600. int xstrlen (s)
  11601.     char *s;
  11602. {
  11603.     msg[0] = '\0';
  11604.     sscanf (s, "%s", msg);
  11605.     return (strlen(msg));
  11606. }
  11607. /* EOF */
  11608. /* cat > src+obj/getdirname.c << "EOF" */
  11609. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11610. /* getdirname: determines the full directory part of    */
  11611. /*           a path. If the path is relative it is    */
  11612. /*           taken relative to the current directory. */
  11613. /*           It is assumed that the path is valid!    */
  11614. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11615. /* SCCS information: %W%    %G% - NCSA */
  11616.  
  11617. /* #include "all.h" */
  11618.  
  11619. int getdirname (path, dir)
  11620.     char *path;
  11621.     char *dir;
  11622. {
  11623.     int i;
  11624.     char current_dir[MAXNAMELEN + 1];
  11625.  
  11626.     (void) getwd (current_dir);
  11627.     for (i = strlen (path) - 1; i >= 0; i--)
  11628.         if (path[i] == '/')
  11629.             break;
  11630.     strncpy (dir, path, ++i);
  11631.     dir[i] = '\0';
  11632.     if (strlen (dir) == 0)
  11633.     {
  11634.         dir[0] = '.';
  11635.         dir[1] = '\0';
  11636.     }
  11637.     (void) chdir (dir);
  11638.     (void) getwd (dir);
  11639.     (void) chdir (current_dir);
  11640.  
  11641.     return (0);
  11642. }
  11643. /* EOF */
  11644. /* cat > src+obj/getbasename.c << "EOF" */
  11645. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11646. /* getbasename: determines the last level of path.    */
  11647. /*        It is assumed that the path is valid!    */
  11648. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11649. /* SCCS information: %W%    %G% - NCSA */
  11650.  
  11651. /* #include "all.h" */
  11652. /* #include "newext.h" */
  11653.  
  11654. int getbasename (path, base)
  11655.     char *path;
  11656.     char *base;
  11657. {
  11658.     int i;
  11659.  
  11660.     for (i = strlen (path) - 1; i >= 0; i--)
  11661.         if (path[i] == '/')
  11662.             break;
  11663.     strcpy (base, &path[i + 1]);
  11664.  
  11665.     return (0);
  11666. }
  11667. /* EOF */
  11668. /* cat > src+obj/swapdirnames.c << "EOF" */
  11669. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11670. /* swapdirnames: returns a new path built by replacing    */
  11671. /*         the directory part by another        */
  11672. /*         directory part. It is assumed that the    */
  11673. /*         that all paths and directories are    */
  11674. /*         valid!                    */
  11675. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11676. /* SCCS information: %W%    %G% - NCSA */
  11677.  
  11678. /* #include "all.h" */
  11679.  
  11680. int swapdirnames (pathin, dir, pathout)
  11681.     char *pathin;
  11682.     char *dir;
  11683.     char *pathout;
  11684. {
  11685.     int lpath;
  11686.  
  11687.     strcpy (pathout, dir);
  11688.     lpath = strlen (pathout);
  11689.     if (pathout[lpath - 1] != '/')
  11690.     {
  11691.         pathout[lpath++] = '/';
  11692.         pathout[lpath] = '\0';
  11693.     }
  11694.     (void) getbasename (pathin, &pathout[lpath]);
  11695.  
  11696.     return (0);
  11697. }
  11698. /* EOF */
  11699. /* cat > src+obj/set_frame_label.c << "EOF" */
  11700. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11701. /* set_frame_label: set the frame label            */
  11702. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11703. /* SCCS information: %W%    %G% - NCSA */
  11704.  
  11705. /* #include "all.h" */
  11706.  
  11707. int
  11708. set_frame_label (frame)
  11709.     Frame frame;
  11710. {
  11711.     char msg1[MAXNAMELEN + 1];
  11712.     char current_dir[MAXNAMELEN + 1];
  11713.     
  11714. /*
  11715.                 FRAME_LABEL, "CompositeTool 1.1 Base Panel",
  11716. */
  11717.     (void) getwd (current_dir);
  11718.     sprintf (msg1, "CompositeTool 1.1 - Dir: %s", current_dir);
  11719.     window_set (frame, FRAME_LABEL, msg1, 0);
  11720. }
  11721. /* EOF */
  11722. /* cat > src+obj/strip_wspace.c << "EOF" */
  11723. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11724. /* strip_wspace: strip off leading and trailing white    */
  11725. /*         space.                    */
  11726. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11727. /* SCCS information: %W%    %G% - NCSA */
  11728.  
  11729. /* #include "all.h" */
  11730.  
  11731. int
  11732. strip_wspace (s)
  11733.         /* returns the length */
  11734.     char *s;
  11735.         /* input: string to strip
  11736.            returns: stripped string with s[0] the first non-whitespace
  11737.                 character */
  11738. {
  11739. /* Implementation note(s):
  11740.     1. Assumes that s is not NULL and the string is NULL 
  11741.        terminated.
  11742. */
  11743.  
  11744.     register int i, j, k;
  11745.  
  11746.         /* strip off trailing white space */
  11747.     if ((i = strlen (s)) == 0)
  11748.         return(0);
  11749.     while (--i >= 0 && (s[i] == ' ' || s[i] == '\t'));
  11750.     s[++i] = '\0';
  11751.     if (i == 0)
  11752.         return (0);
  11753.  
  11754.         /* strip off leading white space */
  11755.     if (s[0] != ' ' && s[0] != '\t')
  11756.         return (i);
  11757.     for (j = 0; s[j] == ' ' || s[j] == '\t'; j++);
  11758.     for (k = 0; k < i - j; k++)
  11759.         s[k] = s[k+j];
  11760.     s[i-j] = '\0';
  11761.     return ((i - j)); 
  11762. }
  11763. /* EOF */
  11764. /* cat > src+obj/util_proc_saveall.c << "EOF" */
  11765. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11766. /* util_proc_saveall: save all screen to file.        */
  11767. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11768. /* SCCS information: %W%    %G% - NCSA */
  11769.  
  11770. /* #include "all.h" */
  11771. /* #include "newext.h" */
  11772.  
  11773. int
  11774. util_proc_saveall ()
  11775. {
  11776.     Pixrect        *p;
  11777.     struct mpr_data *s;
  11778.     int             nx, ny;
  11779.  
  11780.         if (FALSE == (int) window_get (c_frame, WIN_SHOW, 0))
  11781.         {
  11782.                 info_msg ("", "Canvas is not up, request ignored.", "");
  11783.                 return;
  11784.         }
  11785.         else if (xstrlen (panel_get (pt[17], PANEL_VALUE, 0)) == 0)
  11786.         {
  11787.                 bad_data ("No filename given, request ignored.");
  11788.                 return;
  11789.         }
  11790.  
  11791.     sdump.xstart = 0;
  11792.     sdump.xend = N_hpix - 1;
  11793.     sdump.ystart =  0;
  11794.     sdump.yend = N_vpix - 1;
  11795.  
  11796.     nx = sdump.xend - sdump.xstart + 1;
  11797.     ny = sdump.yend - sdump.ystart + 1;
  11798.     p = mem_create (nx, ny, 8);
  11799.     s = mpr_d (p);
  11800.     pw_read (p, 0, 0, nx, ny, PIX_SRC, cpw, sdump.xstart, sdump.ystart);
  11801.     s = mpr_d (p);
  11802.  
  11803.  /* unpad image before saving it */
  11804.  
  11805.     unpad_image (nx, ny, p);
  11806.  
  11807.     if (store_image (panel_get_value (pt[17]), nx, ny, (unsigned char *) s->md_image, (int) panel_get_value (util_pc_save)))
  11808.         return;
  11809.     info_msg ("", "All of screen dumped to file.", "");
  11810.     return;
  11811. }
  11812. /* EOF */
  11813. /* cat > src+obj/adjust_colormap.c << "EOF" */
  11814. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11815. /* adjust_colormap: adjust the palette entries.        */
  11816. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11817. /* SCCS information: %W%    %G% - NCSA */
  11818.  
  11819. /* #include "all.h" */
  11820.  
  11821. void
  11822. adjust_colormap ()
  11823. {
  11824.         *red         = *green         = *blue         = 255;
  11825.         *(red + 255) = *(green + 255) = *(blue + 255) = 0;
  11826.         *(red + 254) = *(green + 254) = *(blue + 254) = 255;
  11827.         *(red + 253) = *(green + 253) = *(blue + 253) = 0;
  11828. }
  11829. /* EOF */
  11830. /* cat > src+obj/set_colormap.c << "EOF" */
  11831. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11832. /* set_colormap: initializes the Sun colormap.        */
  11833. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11834. /* SCCS information: %W%    %G% - NCSA */
  11835.  
  11836. /* #include "all.h" */
  11837. /* #include "newext.h" */
  11838.  
  11839. void
  11840. set_colormap ()
  11841. {
  11842.     set_frame_colormap (fr[0], b_cmsn);
  11843.     set_frame_colormap (c_frame, c_cmsn);
  11844.     set_canvas_colormap (canvas, c_cmsn);
  11845. }
  11846. /* EOF */
  11847. /* cat > src+obj/reset_colormap.c << "EOF" */
  11848. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11849. /* reset_colormap: reset the palette in all windows.    */
  11850. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11851. /* SCCS information: %W%    %G% - NCSA */
  11852.  
  11853. /* #include "all.h" */
  11854.  
  11855. void
  11856. reset_colormap ()
  11857. {
  11858.     int i;
  11859.  
  11860.     set_frame_colormap (fr[0], b_cmsn);
  11861.     set_panel_colormap (pa[0], b_cmsn);
  11862.     set_frame_colormap (c_frame, c_cmsn);
  11863.     set_canvas_colormap (canvas, c_cmsn);
  11864.  
  11865. /* reset all the open windows */
  11866.  
  11867.     for (i = 1; i <= 9; i++)
  11868.         if (fr[i] != NULL)
  11869.         {
  11870.             set_frame_colormap (fr[i], b_cmsn);
  11871.             set_panel_colormap (pa[i], b_cmsn);
  11872.         }
  11873. }
  11874. /* cat > src+obj/set_frame_colormap.c << "EOF" */
  11875. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11876. /* set_frame_colormap: load a frame with colormap.    */
  11877. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11878. /* SCCS information: %W%    %G% - NCSA */
  11879.  
  11880. /* #include "all.h" */
  11881.  
  11882. void
  11883. set_frame_colormap (frame, cmsn)
  11884.     Frame frame;
  11885.             /* input: frame to load colormap */
  11886.     char    *cmsn;
  11887.             /* input: colormap name */
  11888. {
  11889.     Pixwin    *pixw;
  11890.  
  11891.     pixw = (Pixwin *) window_get (frame, WIN_PIXWIN);
  11892.     pw_setcmsname (pixw, cmsn);
  11893.     if (! strcmp (cmsn, b_cmsn))    /* partial palette */
  11894.         pw_putcolormap (pixw, 0, 256 - 2, red, green, blue);
  11895.     else                /* full palette */
  11896.         pw_putcolormap (pixw, 0, 256, red, green, blue);
  11897. }
  11898. /* EOF */
  11899. /* cat > src+obj/set_panel_colormap.c << "EOF" */
  11900. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11901. /* set_panel_colormap: load a panel with colormap.    */
  11902. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11903. /* SCCS information: %W%    %G% - NCSA */
  11904.  
  11905. /* #include "all.h" */
  11906.  
  11907. void
  11908. set_panel_colormap (panel, cmsn)
  11909.     Panel panel;
  11910.             /* input: panel to load colormap */
  11911.     char    *cmsn;
  11912.             /* input: colormap name */
  11913. {
  11914.     Pixwin    *pixw;
  11915.  
  11916.     pixw = (Pixwin *) window_get (panel, WIN_PIXWIN);
  11917.     pw_setcmsname (pixw, cmsn);
  11918.     if (! strcmp (cmsn, b_cmsn))    /* partial palette */
  11919.         pw_putcolormap (pixw, 0, 256 - 2, red, green, blue);
  11920.     else                /* full palette */
  11921.         pw_putcolormap (pixw, 0, 256, red, green, blue);
  11922. }
  11923. /* EOF */
  11924. /* cat > src+obj/set_canvas_colormap.c << "EOF" */
  11925. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11926. /* set_canvas_colormap: load a canvas subwindow        */
  11927. /*            with a colormap.        */
  11928. /* ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ */
  11929. /* SCCS information: %W%    %G% - NCSA */
  11930.  
  11931. /* #include "all.h" */
  11932.  
  11933. void
  11934. set_canvas_colormap (canvas, cmsn)
  11935.     Canvas canvas;
  11936.             /* input: canvas to load colormap */
  11937.     char    *cmsn;
  11938.             /* input: colormap name */
  11939. {
  11940.     Pixwin    *pixw;
  11941.  
  11942.     pixw = canvas_pixwin (canvas);
  11943.     pw_setcmsname (pixw, cmsn);
  11944.     if (! strcmp (cmsn, b_cmsn))    /* partial palette */
  11945.         pw_putcolormap (pixw, 0, 256 - 2, red, green, blue);
  11946.     else                /* full palette */
  11947.         pw_putcolormap (pixw, 0, 256, red, green, blue);
  11948. }
  11949. /* EOF */
  11950.